diff --git a/Buffs/CalamityGlobalBuff.cs b/Buffs/CalamityGlobalBuff.cs index 591cef7456..425eb7dd0d 100644 --- a/Buffs/CalamityGlobalBuff.cs +++ b/Buffs/CalamityGlobalBuff.cs @@ -83,6 +83,18 @@ namespace CalamityMod.Buffs tip = "22.5% increased damage"; break; + case BuffID.BeetleEndurance1: + tip = "Damage taken reduced by 10%"; + break; + + case BuffID.BeetleEndurance2: + tip = "Damage taken reduced by 20%"; + break; + + case BuffID.BeetleEndurance3: + tip = "Damage taken reduced by 30%"; + break; + case BuffID.WeaponImbueVenom: case BuffID.WeaponImbueCursedFlames: case BuffID.WeaponImbueFire: diff --git a/Buffs/Pets/BendyBuff.cs b/Buffs/Pets/BendyBuff.cs new file mode 100644 index 0000000000..9acece95d2 --- /dev/null +++ b/Buffs/Pets/BendyBuff.cs @@ -0,0 +1,28 @@ +using CalamityMod.Projectiles.Pets; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Pets +{ + public class BendyBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Dreamfog"); + Description.SetDefault("Xi believes in Yuu"); + Main.buffNoTimeDisplay[Type] = true; + Main.lightPet[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + player.buffTime[buffIndex] = 18000; + player.Calamity().bendyPet = true; + bool petProjectileNotSpawned = player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0; + if (petProjectileNotSpawned && player.whoAmI == Main.myPlayer) + { + Projectile.NewProjectile(player.position.X + (float)(player.width / 2), player.position.Y + (float)(player.height / 2), 0f, 0f, ModContent.ProjectileType(), 0, 0f, player.whoAmI, 0f, 0f); + } + } + } +} diff --git a/Buffs/Pets/BendyBuff.png b/Buffs/Pets/BendyBuff.png new file mode 100644 index 0000000000..e1606a6350 Binary files /dev/null and b/Buffs/Pets/BendyBuff.png differ diff --git a/Buffs/Pets/RotomBuff.cs b/Buffs/Pets/RotomBuff.cs index e667577316..fe3f71b6cb 100644 --- a/Buffs/Pets/RotomBuff.cs +++ b/Buffs/Pets/RotomBuff.cs @@ -1,28 +1,29 @@ using CalamityMod.Projectiles.Pets; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Pets { - public class RotomBuff : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Electric Troublemaker"); - Description.SetDefault("Lightning never strikes the same place twice"); - Main.buffNoTimeDisplay[Type] = true; - Main.vanityPet[Type] = true; - } + public class RotomBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Electric Troublemaker"); + Description.SetDefault("Lightning never strikes the same place twice"); + Main.buffNoTimeDisplay[Type] = true; + Main.vanityPet[Type] = true; + } - public override void Update(Player player, ref int buffIndex) - { - player.buffTime[buffIndex] = 18000; - player.Calamity().rotomPet = 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); - } - } - } + public override void Update(Player player, ref int buffIndex) + { + player.buffTime[buffIndex] = 18000; + player.Calamity().rotomPet = true; + bool PetProjectileNotSpawned = player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0; + if (PetProjectileNotSpawned && player.whoAmI == Main.myPlayer) + { + Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, player.whoAmI); + } + } + } } diff --git a/Buffs/Pets/SirenLightPetBuff.cs b/Buffs/Pets/SirenLightPetBuff.cs index a51ffaffb0..faf7694757 100644 --- a/Buffs/Pets/SirenLightPetBuff.cs +++ b/Buffs/Pets/SirenLightPetBuff.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Buffs.Pets { public override void SetDefaults() { - DisplayName.SetDefault("Young Siren"); + DisplayName.SetDefault("Ocean Spirit"); Description.SetDefault("Small and cute"); Main.buffNoTimeDisplay[Type] = true; Main.lightPet[Type] = true; diff --git a/Buffs/Pets/SirenLightPetBuff.png b/Buffs/Pets/SirenLightPetBuff.png index d3f7aa5885..e2ff5c8780 100644 Binary files a/Buffs/Pets/SirenLightPetBuff.png and b/Buffs/Pets/SirenLightPetBuff.png differ diff --git a/Buffs/Potions/PenumbraBuff.cs b/Buffs/Potions/PenumbraBuff.cs index 9aa3385d32..371d848858 100644 --- a/Buffs/Potions/PenumbraBuff.cs +++ b/Buffs/Potions/PenumbraBuff.cs @@ -8,8 +8,9 @@ namespace CalamityMod.Buffs.Potions public override void SetDefaults() { DisplayName.SetDefault("Penumbra"); - Description.SetDefault("Stealth regenerates at 10% speed while moving\n" + - "The boost increases to 20% at night and to 30% during an eclipse"); + Description.SetDefault("Stealth regenerates 15% faster while moving\n" + + "At night, stealth additionally regenerates 15% faster while standing still\n" + + "Both boosts increase to 20% during a solar eclipse"); Main.debuff[Type] = false; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = false; diff --git a/Buffs/StatBuffs/BloodyBoost.cs b/Buffs/StatBuffs/BloodyBoost.cs new file mode 100644 index 0000000000..b9dbc83448 --- /dev/null +++ b/Buffs/StatBuffs/BloodyBoost.cs @@ -0,0 +1,25 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.StatBuffs +{ + public class BloodyBoost : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Bloody Boost"); + Description.SetDefault("Increased offensive and defensive stats\n" + + "Healing potions grant more health"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; + canBeCleared = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().bloodPactBoost = true; + } + } +} diff --git a/Buffs/StatBuffs/BloodyBoost.png b/Buffs/StatBuffs/BloodyBoost.png new file mode 100644 index 0000000000..020e7e63c1 Binary files /dev/null and b/Buffs/StatBuffs/BloodyBoost.png differ diff --git a/Buffs/StatBuffs/KamiBuff.cs b/Buffs/StatBuffs/KamiBuff.cs new file mode 100644 index 0000000000..0e89d7656b --- /dev/null +++ b/Buffs/StatBuffs/KamiBuff.cs @@ -0,0 +1,25 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.StatBuffs +{ + public class KamiBuff : ModBuff + { + public const float RunSpeedBoost = 0.2f; + public const float RunAccelerationBoost = 0.4f; + public override void SetDefaults() + { + DisplayName.SetDefault("Kami Injection"); + Description.SetDefault("Increased defense, movement speed, and damage"); + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().kamiBoost = true; + } + } +} diff --git a/Buffs/StatBuffs/KamiBuff.png b/Buffs/StatBuffs/KamiBuff.png new file mode 100644 index 0000000000..4fdc0fff94 Binary files /dev/null and b/Buffs/StatBuffs/KamiBuff.png differ diff --git a/Buffs/StatBuffs/SirenBobs.cs b/Buffs/StatBuffs/SirenBobs.cs index a9980878e3..75d2cd5cc1 100644 --- a/Buffs/StatBuffs/SirenBobs.cs +++ b/Buffs/StatBuffs/SirenBobs.cs @@ -8,8 +8,8 @@ namespace CalamityMod.Buffs.StatBuffs { public override void SetDefaults() { - DisplayName.SetDefault("Siren"); - Description.SetDefault("You are a siren now"); + DisplayName.SetDefault("Water Elemental"); + Description.SetDefault("You are a water elemental now"); Main.debuff[Type] = true; Main.buffNoSave[Type] = true; Main.buffNoTimeDisplay[Type] = true; @@ -22,17 +22,8 @@ namespace CalamityMod.Buffs.StatBuffs if (modPlayer.sirenBoobsPrevious) { modPlayer.sirenBoobsPower = true; - player.statDefense += 1 + - (NPC.downedBoss3 ? 4 : 0) + - (Main.hardMode ? 5 : 0) + - (NPC.downedMoonlord ? 5 : 0); - player.detectCreature = true; - player.lifeRegen += 0 + - (NPC.downedBoss3 ? 1 : 0) + - (NPC.downedMoonlord ? 1 : 0); player.ignoreWater = NPC.downedBoss3; player.accFlipper = true; - player.discount = Main.hardMode; if (player.breath <= player.breathMax + 2 && !modPlayer.ZoneAbyss && NPC.downedBoss3) { player.breath = player.breathMax + 3; diff --git a/Buffs/StatBuffs/SirenBobsAlt.cs b/Buffs/StatBuffs/SirenBobsAlt.cs deleted file mode 100644 index 69acb9cb03..0000000000 --- a/Buffs/StatBuffs/SirenBobsAlt.cs +++ /dev/null @@ -1,52 +0,0 @@ -using CalamityMod.CalPlayer; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs.StatBuffs -{ - public class SirenBobsAlt : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Siren"); - Description.SetDefault("You are a siren now"); - Main.debuff[Type] = true; - Main.buffNoSave[Type] = true; - Main.buffNoTimeDisplay[Type] = true; - canBeCleared = false; - } - - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (modPlayer.sirenBoobsAltPrevious) - { - modPlayer.sirenBoobsAltPower = true; - player.statDefense += 1 + - (NPC.downedBoss3 ? 4 : 0) + - (Main.hardMode ? 5 : 0) + - (NPC.downedMoonlord ? 5 : 0); - player.dangerSense = true; - player.lifeRegen += 0 + - (NPC.downedBoss3 ? 1 : 0) + - (NPC.downedMoonlord ? 1 : 0); - player.ignoreWater = NPC.downedBoss3; - player.accFlipper = true; - player.discount = Main.hardMode; - if (player.breath <= player.breathMax + 2 && !modPlayer.ZoneAbyss && NPC.downedBoss3) - { - player.breath = player.breathMax + 3; - } - if (Main.myPlayer == player.whoAmI && player.wet && NPC.downedBoss3) - { - player.AddBuff(ModContent.BuffType(), 360); - } - } - else - { - player.DelBuff(buffIndex); - buffIndex--; - } - } - } -} diff --git a/Buffs/StatBuffs/SirenBobsAlt.png b/Buffs/StatBuffs/SirenBobsAlt.png deleted file mode 100644 index 7d79587604..0000000000 Binary files a/Buffs/StatBuffs/SirenBobsAlt.png and /dev/null differ diff --git a/Buffs/StatBuffs/XerocRage.png b/Buffs/StatBuffs/XerocRage.png index b4dc31565c..5db048a016 100644 Binary files a/Buffs/StatBuffs/XerocRage.png and b/Buffs/StatBuffs/XerocRage.png differ diff --git a/Buffs/StatBuffs/XerocWrath.png b/Buffs/StatBuffs/XerocWrath.png index e8f6d0c6c1..60b04f7a73 100644 Binary files a/Buffs/StatBuffs/XerocWrath.png and b/Buffs/StatBuffs/XerocWrath.png differ diff --git a/Buffs/StatDebuffs/KamiDebuff.cs b/Buffs/StatDebuffs/KamiDebuff.cs new file mode 100644 index 0000000000..d554fa2441 --- /dev/null +++ b/Buffs/StatDebuffs/KamiDebuff.cs @@ -0,0 +1,33 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.StatDebuffs +{ + public class KamiDebuff : ModBuff + { + public const float MultiplicativeDamageReduction = 0.8f; + public const float MaxNPCSpeed = 16f; // Hard-cap for npc speed when afflicted with this debuff. Does not affect certain NPCs and does not affect any bosses (Basically only works on boss minions). + public override void SetDefaults() + { + DisplayName.SetDefault("Kami Flu"); + Description.SetDefault("Defenseless and dying"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; + } + + public override void Update(NPC npc, ref int buffIndex) + { + if (npc.Calamity().kamiFlu < npc.buffTime[buffIndex]) + npc.Calamity().kamiFlu = npc.buffTime[buffIndex]; + npc.DelBuff(buffIndex); + buffIndex--; + } + + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().teslaFreeze = true; + } + } +} diff --git a/Buffs/StatDebuffs/KamiDebuff.png b/Buffs/StatDebuffs/KamiDebuff.png new file mode 100644 index 0000000000..df7af84f98 Binary files /dev/null and b/Buffs/StatDebuffs/KamiDebuff.png differ diff --git a/Buffs/Summon/Herring.png b/Buffs/Summon/Herring.png index aed61a6102..cd535e3c29 100644 Binary files a/Buffs/Summon/Herring.png and b/Buffs/Summon/Herring.png differ diff --git a/Buffs/Summon/MountedScannerBuff.cs b/Buffs/Summon/MountedScannerBuff.cs new file mode 100644 index 0000000000..46ac809919 --- /dev/null +++ b/Buffs/Summon/MountedScannerBuff.cs @@ -0,0 +1,36 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Projectiles.DraedonsArsenal; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Summon +{ + public class MountedScannerBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Mounted Scanner"); + Description.SetDefault("Powerful machinery surrounds 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.mountedScanner = true; + } + if (!modPlayer.mountedScanner) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} diff --git a/Buffs/Summon/MountedScannerBuff.png b/Buffs/Summon/MountedScannerBuff.png new file mode 100644 index 0000000000..0bcc3c879b Binary files /dev/null and b/Buffs/Summon/MountedScannerBuff.png differ diff --git a/Buffs/Summon/PoleWarperBuff.cs b/Buffs/Summon/PoleWarperBuff.cs new file mode 100644 index 0000000000..bc0ae8af1d --- /dev/null +++ b/Buffs/Summon/PoleWarperBuff.cs @@ -0,0 +1,36 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Projectiles.DraedonsArsenal; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Summon +{ + public class PoleWarperBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Pole Warper"); + Description.SetDefault("Sentient magnets are attracted to 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.poleWarper = true; + } + if (!modPlayer.poleWarper) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} diff --git a/Buffs/Summon/PoleWarperBuff.png b/Buffs/Summon/PoleWarperBuff.png new file mode 100644 index 0000000000..9af97357f5 Binary files /dev/null and b/Buffs/Summon/PoleWarperBuff.png differ diff --git a/Buffs/Summon/SandyHealingWaifu.png b/Buffs/Summon/SandyHealingWaifu.png index 73b9a887be..4c7dbdace9 100644 Binary files a/Buffs/Summon/SandyHealingWaifu.png and b/Buffs/Summon/SandyHealingWaifu.png differ diff --git a/Buffs/Summon/SandyWaifu.png b/Buffs/Summon/SandyWaifu.png index fa0be1df22..4ba562421b 100644 Binary files a/Buffs/Summon/SandyWaifu.png and b/Buffs/Summon/SandyWaifu.png differ diff --git a/Buffs/Summon/SnakeEyesBuff.cs b/Buffs/Summon/SnakeEyesBuff.cs new file mode 100644 index 0000000000..bc3234a40d --- /dev/null +++ b/Buffs/Summon/SnakeEyesBuff.cs @@ -0,0 +1,36 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Projectiles.DraedonsArsenal; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Summon +{ + public class SnakeEyesBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Snake Eyes"); + Description.SetDefault("Always watching..."); + 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.snakeEyes = true; + } + if (!modPlayer.snakeEyes) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} diff --git a/Buffs/Summon/SnakeEyesBuff.png b/Buffs/Summon/SnakeEyesBuff.png new file mode 100644 index 0000000000..25ad95ba9a Binary files /dev/null and b/Buffs/Summon/SnakeEyesBuff.png differ diff --git a/Buffs/Summon/StarSwallowerBuff.cs b/Buffs/Summon/StarSwallowerBuff.cs new file mode 100644 index 0000000000..62c01a7f7e --- /dev/null +++ b/Buffs/Summon/StarSwallowerBuff.cs @@ -0,0 +1,36 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Projectiles.DraedonsArsenal; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Summon +{ + public class StarSwallowerBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Star Swallower"); + Description.SetDefault("Mmmm myes"); + 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.starSwallowerPetFroge = true; + } + if (!modPlayer.starSwallowerPetFroge) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} diff --git a/Buffs/Summon/StarSwallowerBuff.png b/Buffs/Summon/StarSwallowerBuff.png new file mode 100644 index 0000000000..8a0cbca503 Binary files /dev/null and b/Buffs/Summon/StarSwallowerBuff.png differ diff --git a/Buffs/Summon/WaterWaifu.png b/Buffs/Summon/WaterWaifu.png index b9e9cafb73..090fe9a059 100644 Binary files a/Buffs/Summon/WaterWaifu.png and b/Buffs/Summon/WaterWaifu.png differ diff --git a/Buffs/Summon/WulfrumDroidBuff.png b/Buffs/Summon/WulfrumDroidBuff.png index 34b1c798e4..bec3e3f78c 100644 Binary files a/Buffs/Summon/WulfrumDroidBuff.png and b/Buffs/Summon/WulfrumDroidBuff.png differ diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 75c521f8ee..68ae703692 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -9,17 +9,21 @@ using CalamityMod.Items.Accessories; using CalamityMod.Items.Accessories.Vanity; using CalamityMod.Items.Armor; using CalamityMod.Items.DifficultyItems; +using CalamityMod.Items.Dyes; using CalamityMod.Items.Mounts; using CalamityMod.Items.TreasureBags; 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.Items.Weapons.Typeless; using CalamityMod.NPCs; using CalamityMod.NPCs.Abyss; using CalamityMod.NPCs.AcidRain; using CalamityMod.NPCs.Astral; using CalamityMod.NPCs.Calamitas; +using CalamityMod.NPCs.Cryogen; using CalamityMod.NPCs.Crags; using CalamityMod.NPCs.DevourerofGods; using CalamityMod.NPCs.GreatSandShark; @@ -28,6 +32,7 @@ using CalamityMod.NPCs.NormalNPCs; using CalamityMod.NPCs.PlaguebringerGoliath; using CalamityMod.NPCs.Polterghast; using CalamityMod.NPCs.Providence; +using CalamityMod.NPCs.Ravager; using CalamityMod.NPCs.StormWeaver; using CalamityMod.NPCs.SulphurousSea; using CalamityMod.NPCs.SunkenSea; @@ -41,6 +46,7 @@ using CalamityMod.Projectiles.Ranged; using CalamityMod.Projectiles.Rogue; using CalamityMod.Projectiles.Summon; using CalamityMod.Projectiles.Typeless; +using CalamityMod.TileEntities; using CalamityMod.Tiles; using CalamityMod.UI; using CalamityMod.World; @@ -107,6 +113,27 @@ namespace CalamityMod.CalPlayer public Projectile lastProjectileHit; public double acidRoundMultiplier = 1D; public int waterLeechTarget = -1; + public float KameiTrailXScale = 0.1f; + public int KameiBladeUseDelay = 0; + public Vector2[] KameiOldPositions = new Vector2[4]; + public double trueMeleeDamage = 0D; + public double contactDamageReduction = 0D; + public double projectileDamageReduction = 0D; + public bool brimlashBusterBoost = false; + public float animusBoost = 1f; + #endregion + + public int CurrentlyViewedFactoryX = -1; + public int CurrentlyViewedFactoryY = -1; + public TEDraedonFuelFactory CurrentlyViewedFactory; + + public int CurrentlyViewedChargerX = -1; + public int CurrentlyViewedChargerY = -1; + public TEDraedonItemCharger CurrentlyViewedCharger; + + public int CurrentlyViewedHologramX = -1; + public int CurrentlyViewedHologramY = -1; + public string CurrentlyViewedHologramText; #endregion #region External variables -- Only set by Mod.Call @@ -142,8 +169,9 @@ namespace CalamityMod.CalPlayer #endregion #region Stat Meter - public int[] damageStats = new int[5]; + public int[] damageStats = new int[6]; public int[] critStats = new int[4]; + public float actualMeleeDamageStat = 0f; public int defenseStat = 0; public int DRStat = 0; public int meleeSpeedStat = 0; @@ -155,7 +183,8 @@ namespace CalamityMod.CalPlayer public int ammoReductionRanged = 0; public int ammoReductionRogue = 0; public int armorPenetrationStat = 0; - public int wingFlightTimeStat = 0; + public float wingFlightTimeStat = 0f; + public float jumpSpeedStat = 0f; public int adrenalineChargeStat = 0; public int rageDamageStat = 0; public int moveSpeedStat = 0; @@ -186,9 +215,7 @@ namespace CalamityMod.CalPlayer public int tarraLifeAuraTimer = 0; public int bloodflareHeartTimer = 180; public int bloodflareManaTimer = 180; - public int moneyStolenByBandit = 0; public int polarisBoostCounter = 0; - public int reforges = 0; public int gaelSwipes = 0; public float modStealth = 1f; public float aquaticBoost = 1f; @@ -202,6 +229,7 @@ namespace CalamityMod.CalPlayer public int hurtSoundTimer = 0; public int danceOfLightCharge = 0; public int shadowPotCooldown = 0; + public int dogTextCooldown = 0; #endregion #region Sound @@ -247,6 +275,7 @@ namespace CalamityMod.CalPlayer public int throwingCrit = 0; public bool throwingAmmoCost75 = false; public bool throwingAmmoCost66 = false; + public bool throwingAmmoCost55 = false; public bool throwingAmmoCost50 = false; #endregion @@ -283,6 +312,7 @@ namespace CalamityMod.CalPlayer public bool babyGhostBell = false; public bool radiator = false; public bool scalPet = false; + public bool bendyPet = false; #endregion #region Rage @@ -329,6 +359,8 @@ namespace CalamityMod.CalPlayer public bool perforatorLore = false; public bool queenBeeLore = false; public bool skeletronLore = false; + // This lore boolean is a bit different from the others. It just stops Slime God lore effects from stacking. + public bool slimeGodLoreProcessed = false; public bool wallOfFleshLore = false; public bool twinsLore = false; public bool destroyerLore = false; @@ -453,10 +485,13 @@ namespace CalamityMod.CalPlayer public bool shadowMinions = false; public bool tearMinions = false; public bool alchFlask = false; + public bool reducedPlagueDmg = false; + public bool abaddon = false; public bool community = false; public bool fleshTotem = false; public bool fleshTotemCooldown = false; public bool bloodPact = false; + public bool bloodPactBoost = false; public bool bloodflareCore = false; public bool coreOfTheBloodGod = false; public bool elementalHeart = false; @@ -469,12 +504,14 @@ namespace CalamityMod.CalPlayer public bool depthCharm = false; public bool anechoicPlating = false; public bool jellyfishNecklace = false; + public bool abyssDivingGear = false; public bool abyssalAmulet = false; public bool lumenousAmulet = false; public bool reaperToothNecklace = false; public bool aquaticEmblem = false; public bool darkSunRing = false; public bool calamityRing = false; + public bool voidOfExtinction = false; public bool eArtifact = false; public bool dArtifact = false; public bool gArtifact = false; @@ -548,6 +585,10 @@ namespace CalamityMod.CalPlayer public bool rustyMedal = false; public bool noStupidNaturalARSpawns = false; public bool burdenBreakerYeet = false; + public bool roverDrive = false; + public int roverDriveTimer = 0; + public int roverFrameCounter = 0; + public int roverFrame = 0; #endregion #region Armor Set @@ -618,6 +659,11 @@ namespace CalamityMod.CalPlayer public bool auricBoost = false; public bool daedalusReflect = false; public bool daedalusSplit = false; + public bool titanHeartSet = false; + public bool titanHeartMask = false; + public bool titanHeartMantle = false; + public bool titanHeartBoots = false; + public int titanCooldown = 0; public bool umbraphileSet = false; public bool reaverBlast = false; public bool reaverBurst = false; @@ -633,6 +679,8 @@ namespace CalamityMod.CalPlayer public int plagueReaperCooldown = 0; public bool plaguebringerPatronSet = false; public bool plaguebringerCarapace = false; + public bool plaguebringerPistons = false; + public int pistonsCounter = 0; public float ataxiaDmg; public bool ataxiaMage = false; public bool ataxiaGeyser = false; @@ -801,6 +849,7 @@ namespace CalamityMod.CalPlayer public bool hallowedDefense = false; public bool hallowedPower = false; public bool hallowedRegen = false; + public bool kamiBoost = false; #endregion #region Minion @@ -884,9 +933,13 @@ namespace CalamityMod.CalPlayer public List GammaCanisters = new List(); public bool rustyDrone = false; public bool tundraFlameBlossom = false; + public bool starSwallowerPetFroge = false; + public bool snakeEyes = false; + public bool poleWarper = false; public bool causticDragon = false; public bool plaguebringerPatronSummon = false; public bool howlTrio = false; + public bool mountedScanner = false; #endregion #region Biome @@ -922,19 +975,16 @@ namespace CalamityMod.CalPlayer public bool sirenBoobsHide; public bool sirenBoobsForce; public bool sirenBoobsPower; - public bool sirenBoobsAltPrevious; - public bool sirenBoobsAlt; - public bool sirenBoobsAltHide; - public bool sirenBoobsAltForce; - public bool sirenBoobsAltPower; public bool snowmanPrevious; public bool snowman; public bool snowmanHide; public bool snowmanForce; public bool snowmanNoseless; public bool snowmanPower; - #endregion - + public bool meldTransformationPrevious; + public bool meldTransformation; + public bool meldTransformationForce; + public bool meldTransformationPower; #endregion #region SavingAndLoading @@ -1048,8 +1098,6 @@ namespace CalamityMod.CalPlayer { "rogueLevel", rogueLevel }, { "exactRogueLevel", exactRogueLevel }, { "deathCount", deathCount }, - { "moneyStolenByBandit", moneyStolenByBandit }, - { "reforges", reforges }, { "deathModeUnderworldTime", deathModeUnderworldTime }, { "deathModeBlizzardTime", deathModeBlizzardTime } }; @@ -1106,8 +1154,13 @@ namespace CalamityMod.CalPlayer sCalDeathCount = tag.GetInt("sCalDeathCount"); sCalKillCount = tag.GetInt("sCalKillCount"); deathCount = tag.GetInt("deathCount"); - moneyStolenByBandit = tag.GetInt("moneyStolenByBandit"); - reforges = tag.GetInt("reforges"); + + // These two variables are no longer used, as the code was moved into CalamityWorld.cs to support multiplayer. + // As a result, their values are simply fed into a discard. + + _ = tag.GetInt("moneyStolenByBandit"); + _ = tag.GetInt("reforges"); + deathModeUnderworldTime = tag.GetInt("deathModeUnderworldTime"); deathModeBlizzardTime = tag.GetInt("deathModeBlizzardTime"); @@ -1131,8 +1184,13 @@ namespace CalamityMod.CalPlayer sCalDeathCount = reader.ReadInt32(); sCalKillCount = reader.ReadInt32(); deathCount = reader.ReadInt32(); - moneyStolenByBandit = reader.ReadInt32(); - reforges = reader.ReadInt32(); + + // These two variables are no longer used, as the code was moved into CalamityWorld.cs to support multiplayer. + // As a result, their values are simply fed into a discard. + + _ = reader.ReadInt32(); // moneyStolenByBandit + _ = reader.ReadInt32(); // reforges + deathModeUnderworldTime = reader.ReadInt32(); deathModeBlizzardTime = reader.ReadInt32(); @@ -1228,7 +1286,7 @@ namespace CalamityMod.CalPlayer player.statLifeMax2 += player.statLifeMax2 / 5 / 20 * 100; if (leviathanAndSirenLore) { - if (sirenBoobsPrevious || sirenBoobsAltPrevious) + if (sirenBoobsPrevious) player.statLifeMax2 += player.statLifeMax2 / 5 / 20 * 5; } if (absoluteRage) @@ -1274,6 +1332,7 @@ namespace CalamityMod.CalPlayer player.statLifeMax2 = (int)(player.statLifeMax2 * 0.8); // Extra accessory slots + // This is probably fucked in 1.4 if (extraAccessoryML) player.extraAccessorySlots = 1; if (extraAccessoryML && player.extraAccessory && (Main.expertMode || Main.gameMenu)) @@ -1288,14 +1347,20 @@ namespace CalamityMod.CalPlayer ResetRogueStealth(); + contactDamageReduction = 0D; + projectileDamageReduction = 0D; + throwingDamage = 1f; throwingVelocity = 1f; throwingCrit = 0; throwingAmmoCost75 = false; throwingAmmoCost66 = false; + throwingAmmoCost55 = false; throwingAmmoCost50 = false; accStealthGenBoost = 0f; + trueMeleeDamage = 0D; + dashMod = 0; externalAbyssLight = 0; externalColdImmunity = externalHeatImmunity = false; @@ -1324,6 +1389,7 @@ namespace CalamityMod.CalPlayer babyGhostBell = false; radiator = false; scalPet = false; + bendyPet = false; onyxExcavator = false; angryDog = false; fab = false; @@ -1407,6 +1473,7 @@ namespace CalamityMod.CalPlayer perforatorLore = false; queenBeeLore = false; skeletronLore = false; + slimeGodLoreProcessed = false; wallOfFleshLore = false; twinsLore = false; destroyerLore = false; @@ -1486,6 +1553,8 @@ namespace CalamityMod.CalPlayer shadowMinions = false; tearMinions = false; alchFlask = false; + reducedPlagueDmg = false; + abaddon = false; community = false; stressPills = false; laudanum = false; @@ -1502,6 +1571,7 @@ namespace CalamityMod.CalPlayer harpyWingBoost = false; //harpy wings + harpy ring darkSunRing = false; calamityRing = false; + voidOfExtinction = false; eArtifact = false; dArtifact = false; gArtifact = false; @@ -1523,6 +1593,7 @@ namespace CalamityMod.CalPlayer hallowedDefense = false; hallowedRegen = false; hallowedPower = false; + kamiBoost = false; IBoots = false; elysianFire = false; sTracers = false; @@ -1546,6 +1617,7 @@ namespace CalamityMod.CalPlayer rustyMedal = false; noStupidNaturalARSpawns = false; burdenBreakerYeet = false; + roverDrive = false; daedalusReflect = false; daedalusSplit = false; @@ -1565,6 +1637,7 @@ namespace CalamityMod.CalPlayer depthCharm = false; anechoicPlating = false; jellyfishNecklace = false; + abyssDivingGear = false; abyssalAmulet = false; lumenousAmulet = false; reaperToothNecklace = false; @@ -1589,10 +1662,15 @@ namespace CalamityMod.CalPlayer statigelSet = false; + titanHeartSet = false; + titanHeartMask = false; + titanHeartMantle = false; + titanHeartBoots = false; umbraphileSet = false; plagueReaper = false; plaguebringerPatronSet = false; plaguebringerCarapace = false; + plaguebringerPistons = false; fathomSwarmer = false; fathomSwarmerVisage = false; fathomSwarmerBreastplate = false; @@ -1749,6 +1827,7 @@ namespace CalamityMod.CalPlayer polarisBoostTwo = false; polarisBoostThree = false; bloodfinBoost = false; + bloodPactBoost = false; killSpikyBalls = false; @@ -1871,17 +1950,19 @@ namespace CalamityMod.CalPlayer gammaHead = false; rustyDrone = false; tundraFlameBlossom = false; + starSwallowerPetFroge = false; + snakeEyes = false; + poleWarper = false; causticDragon = false; plaguebringerPatronSummon = false; howlTrio = false; + mountedScanner = false; abyssalDivingSuitPrevious = abyssalDivingSuit; abyssalDivingSuit = abyssalDivingSuitHide = abyssalDivingSuitForce = abyssalDivingSuitPower = false; sirenBoobsPrevious = sirenBoobs; sirenBoobs = sirenBoobsHide = sirenBoobsForce = sirenBoobsPower = false; - sirenBoobsAltPrevious = sirenBoobsAlt; - sirenBoobsAlt = sirenBoobsAltHide = sirenBoobsAltForce = sirenBoobsAltPower = false; profanedCrystalPrevious = profanedCrystal; profanedCrystal = profanedCrystalBuffs = profanedCrystalForce = profanedCrystalHide = false; @@ -1889,6 +1970,9 @@ namespace CalamityMod.CalPlayer snowmanPrevious = snowman; snowman = snowmanHide = snowmanForce = snowmanPower = false; + meldTransformationPrevious = meldTransformation; + meldTransformation = meldTransformationForce = meldTransformationPower = false; + rageModeActive = false; adrenalineModeActive = false; @@ -1910,6 +1994,7 @@ namespace CalamityMod.CalPlayer galileoCooldown = 0; soundCooldown = 0; shadowPotCooldown = 0; + dogTextCooldown = 0; rage = 0; adrenaline = 0; raiderStack = 0; @@ -1924,7 +2009,6 @@ namespace CalamityMod.CalPlayer acidRoundMultiplier = 1D; externalAbyssLight = 0; externalColdImmunity = externalHeatImmunity = false; - reforges = 0; polarisBoostCounter = 0; spectralVeilImmunity = 0; jetPackCooldown = 0; @@ -1945,10 +2029,9 @@ namespace CalamityMod.CalPlayer hallowedRuneCooldown = 0; doubledHorror = false; sulphurBubbleCooldown = 0; - forbiddenCooldown = 0; - tornadoCooldown = 0; ladHearts = 0; prismaticLasers = 0; + roverDriveTimer = 0; alcoholPoisoning = false; shadowflame = false; @@ -1997,11 +2080,11 @@ namespace CalamityMod.CalPlayer vaporfied = false; energyShellCooldown = false; prismaticCooldown = false; - #endregion + #endregion - #region Rogue - // Stealth - rogueStealth = 0f; + #region Rogue + // Stealth + rogueStealth = 0f; rogueStealthMax = 0f; stealthAcceleration = 1f; @@ -2010,6 +2093,7 @@ namespace CalamityMod.CalPlayer throwingCrit = 0; throwingAmmoCost75 = false; throwingAmmoCost66 = false; + throwingAmmoCost55 = false; throwingAmmoCost50 = false; #endregion @@ -2042,6 +2126,7 @@ namespace CalamityMod.CalPlayer rRage = false; xRage = false; xWrath = false; + kamiBoost = false; graxDefense = false; encased = false; sMeleeBoost = false; @@ -2125,6 +2210,7 @@ namespace CalamityMod.CalPlayer revivify = false; healCounter = 300; danceOfLightCharge = 0; + bloodPactBoost = false; #endregion #region Armorbonuses @@ -2165,6 +2251,11 @@ namespace CalamityMod.CalPlayer reaverDoubleTap = false; shadeRegen = false; dsSetBonus = false; + titanHeartSet = false; + titanHeartMask = false; + titanHeartMantle = false; + titanHeartBoots = false; + titanCooldown = 0; umbraphileSet = false; reaverBlast = false; reaverBurst = false; @@ -2181,6 +2272,8 @@ namespace CalamityMod.CalPlayer plagueReaperCooldown = 0; plaguebringerPatronSet = false; plaguebringerCarapace = false; + plaguebringerPistons = false; + pistonsCounter = 0; ataxiaMage = false; ataxiaBolt = false; ataxiaGeyser = false; @@ -2191,6 +2284,8 @@ namespace CalamityMod.CalPlayer desertProwler = false; snowRuffianSet = false; forbiddenCirclet = false; + forbiddenCooldown = 0; + tornadoCooldown = 0; eskimoSet = false; //vanilla armor meteorSet = false; //vanilla armor, for Space Gun nerf victideSet = false; @@ -2228,7 +2323,19 @@ namespace CalamityMod.CalPlayer elysianGuard = false; #endregion + CurrentlyViewedFactoryX = CurrentlyViewedFactoryY = -1; + CurrentlyViewedFactory = null; + + CurrentlyViewedChargerX = CurrentlyViewedChargerY = -1; + CurrentlyViewedCharger = null; + + CurrentlyViewedHologramX = CurrentlyViewedHologramY = -1; + CurrentlyViewedHologramText = string.Empty; + + KameiBladeUseDelay = 0; lastProjectileHit = null; + brimlashBusterBoost = false; + animusBoost = 1f; if (CalamityWorld.bossRushActive) { @@ -2280,13 +2387,26 @@ namespace CalamityMod.CalPlayer bool usePlague = NPC.AnyNPCs(ModContent.NPCType()); player.ManageSpecialBiomeVisuals("CalamityMod:PlaguebringerGoliath", usePlague); + bool useCryogen = NPC.AnyNPCs(ModContent.NPCType()); + if (SkyManager.Instance["CalamityMod:Cryogen"] != null && useCryogen != SkyManager.Instance["CalamityMod:Cryogen"].IsActive()) + { + if (useCryogen) + { + SkyManager.Instance.Activate("CalamityMod:Cryogen", player.Center); + } + else + { + SkyManager.Instance.Deactivate("CalamityMod:Cryogen"); + } + } + Point point = player.Center.ToTileCoordinates(); bool aboveGround = point.Y > Main.maxTilesY - 320; bool overworld = player.ZoneOverworldHeight && (point.X < 380 || point.X > Main.maxTilesX - 380); bool useFire = NPC.AnyNPCs(ModContent.NPCType()); player.ManageSpecialBiomeVisuals("CalamityMod:Yharon", useFire); player.ManageSpecialBiomeVisuals("HeatDistortion", Main.UseHeatDistortion && (useFire || trippy || - aboveGround || ((double)point.Y < Main.worldSurface && player.ZoneDesert && !overworld && !Main.raining && !Filters.Scene["Sandstorm"].IsActive()))); + aboveGround || (point.Y < Main.worldSurface && player.ZoneDesert && !overworld && !Main.raining && !Filters.Scene["Sandstorm"].IsActive()))); bool useWater = NPC.AnyNPCs(ModContent.NPCType()); player.ManageSpecialBiomeVisuals("CalamityMod:Leviathan", useWater); @@ -2340,25 +2460,25 @@ namespace CalamityMod.CalPlayer } } - ZoneAbyss = (double)point.Y > (Main.rockLayer - y * 0.05) && + ZoneAbyss = point.Y > (Main.rockLayer - y * 0.05) && !player.lavaWet && !player.honeyWet && abyssPosY && abyssPosX; ZoneAbyssLayer1 = ZoneAbyss && - (double)point.Y <= (Main.rockLayer + y * 0.03); + point.Y <= (Main.rockLayer + y * 0.03); ZoneAbyssLayer2 = ZoneAbyss && - (double)point.Y > (Main.rockLayer + y * 0.03) && - (double)point.Y <= (Main.rockLayer + y * 0.14); + point.Y > (Main.rockLayer + y * 0.03) && + point.Y <= (Main.rockLayer + y * 0.14); ZoneAbyssLayer3 = ZoneAbyss && - (double)point.Y > (Main.rockLayer + y * 0.14) && - (double)point.Y <= (Main.rockLayer + y * 0.26); + point.Y > (Main.rockLayer + y * 0.14) && + point.Y <= (Main.rockLayer + y * 0.26); ZoneAbyssLayer4 = ZoneAbyss && - (double)point.Y > (Main.rockLayer + y * 0.26); + point.Y > (Main.rockLayer + y * 0.26); ZoneSulphur = (CalamityWorld.sulphurTiles > 30 || (player.ZoneOverworldHeight && sulphurPosX)) && !ZoneAbyss; @@ -2653,7 +2773,7 @@ namespace CalamityMod.CalPlayer Main.PlaySound(SoundID.Zombie, (int)player.position.X, (int)player.position.Y, 104); for (int num502 = 0; num502 < 36; num502++) { - int dust = Dust.NewDust(new Vector2(player.position.X, player.position.Y + 16f), player.width, player.height - 16, 235, 0f, 0f, 0, default, 1f); + int dust = Dust.NewDust(new Vector2(player.position.X, player.position.Y + 16f), player.width, player.height - 16, (int)CalamityDusts.Brimstone, 0f, 0f, 0, default, 1f); Main.dust[dust].velocity *= 3f; Main.dust[dust].scale *= 1.15f; } @@ -2663,7 +2783,7 @@ namespace CalamityMod.CalPlayer Vector2 vector6 = Vector2.Normalize(player.velocity) * new Vector2((float)player.width / 2f, (float)player.height) * 0.75f; vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * MathHelper.TwoPi / (float)num226), default) + player.Center; Vector2 vector7 = vector6 - player.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 235, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default, 1.4f); + int num228 = Dust.NewDust(vector6 + vector7, 0, 0, (int)CalamityDusts.Brimstone, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default, 1.4f); Main.dust[num228].noGravity = true; Main.dust[num228].noLight = true; Main.dust[num228].velocity = vector7; @@ -2687,7 +2807,7 @@ namespace CalamityMod.CalPlayer Main.PlaySound(SoundID.Zombie, (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); + int dust = Dust.NewDust(new Vector2(player.position.X, player.position.Y + 16f), player.width, player.height - 16, (int)CalamityDusts.Phantoplasm, 0f, 0f, 0, default, 1f); Main.dust[dust].velocity *= 3f; Main.dust[dust].scale *= 1.15f; } @@ -2697,7 +2817,7 @@ namespace CalamityMod.CalPlayer Vector2 vector6 = Vector2.Normalize(player.velocity) * new Vector2((float)player.width / 2f, (float)player.height) * 0.75f; vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + player.Center; Vector2 vector7 = vector6 - player.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 60, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default, 1.4f); + int num228 = Dust.NewDust(vector6 + vector7, 0, 0, (int)CalamityDusts.Phantoplasm, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default, 1.4f); Main.dust[num228].noGravity = true; Main.dust[num228].noLight = true; Main.dust[num228].velocity = vector7; @@ -2742,7 +2862,7 @@ namespace CalamityMod.CalPlayer Main.PlaySound(SoundID.Zombie, (int)player.position.X, (int)player.position.Y, 104); for (int num502 = 0; num502 < 36; num502++) { - int dust = Dust.NewDust(new Vector2(player.position.X, player.position.Y + 16f), player.width, player.height - 16, 235, 0f, 0f, 0, default, 1f); + int dust = Dust.NewDust(new Vector2(player.position.X, player.position.Y + 16f), player.width, player.height - 16, (int)CalamityDusts.Brimstone, 0f, 0f, 0, default, 1f); Main.dust[dust].velocity *= 3f; Main.dust[dust].scale *= 1.15f; } @@ -2752,7 +2872,7 @@ namespace CalamityMod.CalPlayer Vector2 vector6 = Vector2.Normalize(player.velocity) * new Vector2((float)player.width / 2f, (float)player.height) * 0.75f; vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * MathHelper.TwoPi / (float)num226), default) + player.Center; Vector2 vector7 = vector6 - player.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 235, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default, 1.4f); + int num228 = Dust.NewDust(vector6 + vector7, 0, 0, (int)CalamityDusts.Brimstone, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default, 1.4f); Main.dust[num228].noGravity = true; Main.dust[num228].noLight = true; Main.dust[num228].velocity = vector7; @@ -2777,7 +2897,7 @@ namespace CalamityMod.CalPlayer plagueReaperCooldown = 1800; if (forbiddenCirclet && forbiddenCooldown <= 0) { - forbiddenCooldown = 20; + forbiddenCooldown = 45; int stormMana = (int)(ForbiddenCirclet.manaCost * player.manaCost); if (player.statMana < stormMana) { @@ -2890,7 +3010,7 @@ namespace CalamityMod.CalPlayer Main.PlaySound(SoundID.Zombie, (int)player.position.X, (int)player.position.Y, 104); for (int num502 = 0; num502 < 64; num502++) { - int dust = Dust.NewDust(new Vector2(player.position.X, player.position.Y + 16f), player.width, player.height - 16, 235, 0f, 0f, 0, default, 1f); + int dust = Dust.NewDust(new Vector2(player.position.X, player.position.Y + 16f), player.width, player.height - 16, (int)CalamityDusts.Brimstone, 0f, 0f, 0, default, 1f); Main.dust[dust].velocity *= 3f; Main.dust[dust].scale *= 1.15f; } @@ -2900,7 +3020,7 @@ namespace CalamityMod.CalPlayer Vector2 vector6 = Vector2.Normalize(player.velocity) * new Vector2((float)player.width / 2f, (float)player.height) * 0.75f; vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + player.Center; Vector2 vector7 = vector6 - player.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 235, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default, 1.4f); + int num228 = Dust.NewDust(vector6 + vector7, 0, 0, (int)CalamityDusts.Brimstone, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default, 1.4f); Main.dust[num228].noGravity = true; Main.dust[num228].noLight = true; Main.dust[num228].velocity = vector7; @@ -3232,16 +3352,15 @@ namespace CalamityMod.CalPlayer sirenBoobsHide = false; sirenBoobsForce = true; } - else if (item.type == ModContent.ItemType()) - { - sirenBoobsAltHide = false; - sirenBoobsAltForce = true; - } else if (item.type == ModContent.ItemType()) { profanedCrystalHide = false; profanedCrystalForce = true; } + else if (item.type == ModContent.ItemType()) + { + abyssDivingGear = true; + } } } @@ -3365,9 +3484,16 @@ namespace CalamityMod.CalPlayer meleeSpeedMult += GetMeleeSpeedBonus(); } player.meleeSpeed += meleeSpeedMult; - #endregion - if (snowman) + if (player.inventory[player.selectedItem].type == ModContent.ItemType() || player.inventory[player.selectedItem].type == ModContent.ItemType() || + player.inventory[player.selectedItem].type == ModContent.ItemType() || player.inventory[player.selectedItem].type == ModContent.ItemType()) + { + float newMeleeSpeed = 1f + ((player.meleeSpeed - 1f) * 0.25f); + player.meleeSpeed = newMeleeSpeed; + } + #endregion + + if (snowman) { if (player.whoAmI == Main.myPlayer && !snowmanNoseless) { @@ -3402,11 +3528,7 @@ namespace CalamityMod.CalPlayer { player.AddBuff(ModContent.BuffType(), 60, true); } - else if (sirenBoobsAlt) - { - player.AddBuff(ModContent.BuffType(), 60, true); - } - if ((sirenBoobs || sirenBoobsAlt) && NPC.downedBoss3) + if (sirenBoobs && NPC.downedBoss3) { if (player.whoAmI == Main.myPlayer && !sirenIceCooldown) { @@ -3441,10 +3563,7 @@ namespace CalamityMod.CalPlayer WeakPetrification(); if (player.mount.Active || player.mount.Cart || (CalamityConfig.Instance.BossRushDashCurse && CalamityWorld.bossRushActive)) - { - player.dashDelay = 10; - dashMod = 0; - } + DashExploitFix(true); if (silvaCountdown > 0 && hasSilvaEffect && silvaSet) { @@ -3466,13 +3585,10 @@ namespace CalamityMod.CalPlayer if (weakPetrification) WeakPetrification(); - if (player.mount.Active || player.mount.Cart || (CalamityConfig.Instance.BossRushDashCurse && CalamityWorld.bossRushActive)) - { - player.dashDelay = 10; - dashMod = 0; - } + if (player.mount.Active || player.mount.Cart || (CalamityConfig.Instance.BossRushDashCurse && CalamityWorld.bossRushActive)) + DashExploitFix(true); - if (silvaCountdown > 0 && hasSilvaEffect && silvaSet) + if (silvaCountdown > 0 && hasSilvaEffect && silvaSet) { if (player.lifeRegen < 0) player.lifeRegen = 0; @@ -3481,11 +3597,28 @@ namespace CalamityMod.CalPlayer if (boomerDukeLore) player.buffImmune[ModContent.BuffType()] = false; } - #endregion + #endregion - #region PostUpdate + #region Dash Exploit Fix + private void DashExploitFix(bool mount) + { + if (player.dashDelay != 0) + { + player.velocity *= 0.3f; + player.dashDelay = 0; + } - public override void PostUpdateMiscEffects() + if (!mount) + return; + + player.dash = 0; + dashMod = 0; + } + #endregion + + #region PostUpdate + + public override void PostUpdateMiscEffects() { CalamityPlayerMiscEffects.CalamityPostUpdateMiscEffects(player, mod); @@ -3499,6 +3632,36 @@ namespace CalamityMod.CalPlayer rage = 0; gaelSwitchTimer = GaelSwitchPhase.None; } + + // Disable the factory UI if the player is far from the associated factory. + if (CurrentlyViewedFactory != null) + { + Vector2 factoryPosition = new Vector2(CurrentlyViewedFactoryX, CurrentlyViewedFactoryY); + if (player.Distance(factoryPosition) > 1200f) + { + CurrentlyViewedFactory = null; + CurrentlyViewedFactoryX = CurrentlyViewedFactoryY = -1; + } + } + + // Disable the charger UI if the player is far from the associated charger. + if (CurrentlyViewedCharger != null) + { + Vector2 chargerPosition = new Vector2(CurrentlyViewedChargerX, CurrentlyViewedChargerY); + if (player.Distance(chargerPosition) > 1200f) + { + CurrentlyViewedCharger = null; + CurrentlyViewedChargerX = CurrentlyViewedChargerY = -1; + } + } + + // Disable the hologram UI if the player is far from the associated hologram. + Vector2 hologramPosition = new Vector2(CurrentlyViewedHologramX, CurrentlyViewedHologramY) * 16f; + if (player.Distance(hologramPosition) > 120f) + { + CurrentlyViewedHologramX = CurrentlyViewedHologramY = -1; + CurrentlyViewedHologramText = string.Empty; + } } #region Dragon Scale Logic @@ -3543,6 +3706,7 @@ namespace CalamityMod.CalPlayer ((frostFlare && player.statLife < (int)(player.statLifeMax2 * 0.25)) ? 0.15f : 0f) + (auricSet ? 0.1f : 0f) + (dragonScales ? 0.1f : 0f) + + (kamiBoost ? KamiBuff.RunAccelerationBoost : 0f) + (cTracers ? 0.1f : 0f) + (silvaSet ? 0.05f : 0f) + (eTracers ? 0.05f : 0f) + @@ -3562,6 +3726,7 @@ namespace CalamityMod.CalPlayer (cTracers ? 0.1f : 0f) + (silvaSet ? 0.05f : 0f) + (eTracers ? 0.05f : 0f) + + (kamiBoost ? KamiBuff.RunSpeedBoost : 0f) + (etherealExtorter && player.ZoneBeach ? 0.05f : 0f) + (stressPills ? 0.05f : 0f) + (laudanum && horror ? 0.1f : 0f) + @@ -3607,13 +3772,20 @@ namespace CalamityMod.CalPlayer runAccMult *= 0.5f; runSpeedMult *= 0.5f; } - if (player.powerrun && CalamityWorld.revenge) + if (CalamityWorld.revenge) + { + if (player.powerrun) + { + runSpeedMult *= 0.6666667f; + } + if ((player.slippy || player.slippy2) && player.iceSkate) + { + runAccMult *= 0.6666667f; + } + } + if (CalamityWorld.death && deathModeBlizzardTime > 0) { - runSpeedMult *= 0.6666667f; - } - if (CalamityWorld.death && deathModeBlizzardTime > 0) - { - float speedMult = (float)(3600 - deathModeBlizzardTime) / 3600f; + float speedMult = (3600 - deathModeBlizzardTime) / 3600f; runAccMult *= speedMult; runSpeedMult *= speedMult; } @@ -3626,15 +3798,15 @@ namespace CalamityMod.CalPlayer if (player.pulley && dashMod > 0) { ModDashMovement(); - } + } else if (player.grappling[0] == -1 && !player.tongued) { ModHorizontalMovement(); - if (dashMod > 0) - { + + if (dashMod > 0) ModDashMovement(); - } - if (pAmulet && modStealth < 1f) + + if (pAmulet && modStealth < 1f) { float num43 = player.maxRunSpeed / 2f * (1f - modStealth); player.maxRunSpeed -= num43; @@ -3643,7 +3815,6 @@ namespace CalamityMod.CalPlayer } #endregion } - #endregion #region Rogue Mirrors @@ -3670,6 +3841,11 @@ namespace CalamityMod.CalPlayer Main.projectile[lumenyl].rotation = Main.rand.NextFloat(0, 360); Main.projectile[lumenyl].frame = Main.rand.Next(0, 4); } + + if (player.whoAmI == Main.myPlayer) + { + NetMessage.SendData(MessageID.Dodge, -1, -1, null, player.whoAmI, 1f, 0f, 0f, 0, 0, 0); + } } } @@ -3688,8 +3864,13 @@ namespace CalamityMod.CalPlayer player.hurtCooldowns[k] = player.immuneTime; } - Main.PlaySound(SoundID.Item, (int)Main.player[Main.myPlayer].position.X, (int)Main.player[Main.myPlayer].position.Y, 68); + Main.PlaySound(SoundID.Item68, Main.player[Main.myPlayer].position); int eclipseBurst = Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(7000 * player.RogueDamage()), 0, player.whoAmI); + + if (player.whoAmI == Main.myPlayer) + { + NetMessage.SendData(MessageID.Dodge, -1, -1, null, player.whoAmI, 1f, 0f, 0f, 0, 0, 0); + } } } #endregion @@ -3697,6 +3878,7 @@ namespace CalamityMod.CalPlayer #region Pre Kill public override bool PreKill(double damage, int hitDirection, bool pvp, ref bool playSound, ref bool genGore, ref PlayerDeathReason damageSource) { + PopupGUIManager.SuspendAll(); if (player.Calamity().andromedaState == AndromedaPlayerState.LargeRobot) { if (!Main.dedServ) @@ -3785,7 +3967,17 @@ namespace CalamityMod.CalPlayer { player.ClearBuff(ModContent.BuffType()); player.AddBuff(ModContent.BuffType(), CalamityUtils.SecondsToFrames(60f)); - } + + // Additional potion sickness time + int additionalTime = 0; + for (int i = 0; i < Player.MaxBuffs; i++) + { + if (player.buffType[i] == BuffID.PotionSickness) + additionalTime = player.buffTime[i]; + } + float potionSicknessTime = 30f + (float)Math.Ceiling(additionalTime / 60D); + player.AddBuff(BuffID.PotionSickness, CalamityUtils.SecondsToFrames(potionSicknessTime)); + } player.AddBuff(ModContent.BuffType(), CalamityUtils.SecondsToFrames(45f)); return false; } @@ -3811,7 +4003,17 @@ namespace CalamityMod.CalPlayer { player.ClearBuff(ModContent.BuffType()); player.AddBuff(ModContent.BuffType(), CalamityUtils.SecondsToFrames(60f)); - } + + // Additional potion sickness time + int additionalTime = 0; + for (int i = 0; i < Player.MaxBuffs; i++) + { + if (player.buffType[i] == BuffID.PotionSickness) + additionalTime = player.buffTime[i]; + } + float potionSicknessTime = 30f + (float)Math.Ceiling(additionalTime / 60D); + player.AddBuff(BuffID.PotionSickness, CalamityUtils.SecondsToFrames(potionSicknessTime)); + } } else if (silvaWings) { @@ -3947,16 +4149,19 @@ namespace CalamityMod.CalPlayer sCalDeathCount++; } } - deathCount++; + + if (CalamityWorld.ironHeart) + { + KillPlayer(); + return false; + } + + deathCount++; if (player.whoAmI == Main.myPlayer && Main.netMode == NetmodeID.MultiplayerClient) { DeathPacket(false); } - if (CalamityWorld.ironHeart && areThereAnyDamnBosses) - { - KillPlayer(); - return false; - } + return true; } #endregion @@ -3989,10 +4194,20 @@ namespace CalamityMod.CalPlayer } return 1f; } - #endregion + #endregion - #region Get Weapon Damage And KB - public override void ModifyWeaponDamage(Item item, ref float add, ref float mult, ref float flat) + #region Get Heal Life + public override void GetHealLife(Item item, bool quickHeal, ref int healValue) + { + if (bloodPactBoost) + healValue = (int)(healValue * 1.5); + if (CalamityWorld.ironHeart) + healValue = 0; + } + #endregion + + #region Get Weapon Damage And KB + public override void ModifyWeaponDamage(Item item, ref float add, ref float mult, ref float flat) { if (item.type == ModContent.ItemType()) { @@ -4060,6 +4275,26 @@ namespace CalamityMod.CalPlayer { knockback *= 1.09f; } + if (titanHeartMask && item.Calamity().rogue) + { + knockback *= 1.05f; + } + if (titanHeartMantle && item.Calamity().rogue) + { + knockback *= 1.05f; + } + if (titanHeartBoots && item.Calamity().rogue) + { + knockback *= 1.05f; + } + if (titanHeartSet && item.Calamity().rogue) + { + knockback *= 1.2f; + } + if (titanHeartSet && StealthStrikeAvailable() && item.Calamity().rogue) + { + knockback *= 2f; + } 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) { @@ -4084,9 +4319,9 @@ namespace CalamityMod.CalPlayer #region Melee Effects public override void MeleeEffects(Item item, Rectangle hitbox) { - if (!item.melee && !item.noMelee && (!item.noUseGraphic && (int)player.meleeEnchant > 0)) + if (!item.melee && !item.noMelee && (!item.noUseGraphic && player.meleeEnchant > 0)) { - if ((int)player.meleeEnchant == 7) + if (player.meleeEnchant == 7) { if (Main.rand.NextBool(20)) { @@ -4120,112 +4355,105 @@ namespace CalamityMod.CalPlayer player.itemAnimation == (int)(player.itemAnimationMax * 0.7) || player.itemAnimation == (int)(player.itemAnimationMax * 0.9)) { - float num339 = 0f; - float num340 = 0f; - float num341 = 0f; - float num342 = 0f; + float yVel = 0f; + float xVel = 0f; + float yOffset = 0f; + float xOffset = 0f; if (player.itemAnimation == (int)(player.itemAnimationMax * 0.9)) { - num339 = -7f; + yVel = -7f; } if (player.itemAnimation == (int)(player.itemAnimationMax * 0.7)) { - num339 = -6f; - num340 = 2f; + yVel = -6f; + xVel = 2f; } if (player.itemAnimation == (int)(player.itemAnimationMax * 0.5)) { - num339 = -4f; - num340 = 4f; + yVel = -4f; + xVel = 4f; } if (player.itemAnimation == (int)(player.itemAnimationMax * 0.3)) { - num339 = -2f; - num340 = 6f; + yVel = -2f; + xVel = 6f; } if (player.itemAnimation == (int)(player.itemAnimationMax * 0.1)) { - num340 = 7f; + xVel = 7f; } if (player.itemAnimation == (int)(player.itemAnimationMax * 0.7)) { - num342 = 26f; + xOffset = 26f; } if (player.itemAnimation == (int)(player.itemAnimationMax * 0.3)) { - num342 -= 4f; - num341 -= 20f; + xOffset -= 4f; + yOffset -= 20f; } if (player.itemAnimation == (int)(player.itemAnimationMax * 0.1)) { - num341 += 6f; + yOffset += 6f; } if (player.direction == -1) { if (player.itemAnimation == (int)(player.itemAnimationMax * 0.9)) { - num342 -= 8f; + xOffset -= 8f; } if (player.itemAnimation == (int)(player.itemAnimationMax * 0.7)) { - num342 -= 6f; + xOffset -= 6f; } } - num339 *= 1.5f; - num340 *= 1.5f; - num342 *= (float)player.direction; - num341 *= player.gravDir; - Projectile.NewProjectile((float)(hitbox.X + hitbox.Width / 2) + num342, (float)(hitbox.Y + hitbox.Height / 2) + num341, (float)player.direction * num340, num339 * player.gravDir, ProjectileID.Mushroom, (int)(item.damage * 0.25f * player.MeleeDamage()), 0f, player.whoAmI, 0f, 0f); + yVel *= 1.5f; + xVel *= 1.5f; + xOffset *= (float)player.direction; + yOffset *= player.gravDir; + Projectile.NewProjectile((float)(hitbox.X + hitbox.Width / 2) + xOffset, (float)(hitbox.Y + hitbox.Height / 2) + yOffset, (float)player.direction * xVel, yVel * player.gravDir, ProjectileID.Mushroom, (int)(item.damage * 0.25f * player.MeleeDamage()), 0f, player.whoAmI, 0f, 0f); } } if (aWeapon) { if (Main.rand.NextBool(3)) { - int num280 = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, ModContent.DustType(), player.velocity.X * 0.2f + (float)(player.direction * 3), player.velocity.Y * 0.2f, 100, default, 0.75f); - } - } - if (aChicken) - { - if (Main.rand.NextBool(3)) - { - int num280 = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, 244, player.velocity.X * 0.2f + (float)(player.direction * 3), player.velocity.Y * 0.2f, 100, default, 0.75f); + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, ModContent.DustType(), player.velocity.X * 0.2f + player.direction * 3f, player.velocity.Y * 0.2f, 100, default, 0.75f); } } if (eGauntlet) { if (Main.rand.NextBool(3)) { - int num280 = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, 66, player.velocity.X * 0.2f + (float)(player.direction * 3), player.velocity.Y * 0.2f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.25f); - Main.dust[num280].noGravity = true; + int element = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 66, player.velocity.X * 0.2f + player.direction * 3f, player.velocity.Y * 0.2f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.25f); + Main.dust[element].noGravity = true; } } if (cryogenSoul) { if (Main.rand.NextBool(3)) { - int num280 = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, 67, player.velocity.X * 0.2f + (float)(player.direction * 3), player.velocity.Y * 0.2f, 100, default, 0.75f); + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 67, player.velocity.X * 0.2f + player.direction * 3f, player.velocity.Y * 0.2f, 100, default, 0.75f); } } if (xerocSet) { if (Main.rand.NextBool(3)) { - int num280 = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, 58, player.velocity.X * 0.2f + (float)(player.direction * 3), player.velocity.Y * 0.2f, 100, default, 1.25f); + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 58, player.velocity.X * 0.2f + player.direction * 3f, player.velocity.Y * 0.2f, 100, default, 1.25f); } } if (reaverBlast) { if (Main.rand.NextBool(3)) { - int num280 = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, 74, player.velocity.X * 0.2f + (float)(player.direction * 3), player.velocity.Y * 0.2f, 100, default, 0.75f); + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 74, player.velocity.X * 0.2f + player.direction * 3f, player.velocity.Y * 0.2f, 100, default, 0.75f); } } if (dsSetBonus) { if (Main.rand.NextBool(3)) { - int num280 = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, 27, player.velocity.X * 0.2f + (float)(player.direction * 3), player.velocity.Y * 0.2f, 100, default, 2.5f); + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 27, player.velocity.X * 0.2f + player.direction * 3f, player.velocity.Y * 0.2f, 100, default, 2.5f); } } } @@ -4248,11 +4476,8 @@ namespace CalamityMod.CalPlayer } } } - 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 (item.melee) - titanBoost = 600; + if (!item.melee && player.meleeEnchant == 7) + Projectile.NewProjectile(target.Center, target.velocity, ProjectileID.ConfettiMelee, 0, 0f, player.whoAmI, 0f, 0f); if (omegaBlueChestplate) target.AddBuff(ModContent.BuffType(), 240); @@ -4275,6 +4500,7 @@ namespace CalamityMod.CalPlayer if (item.melee) //prevents Deep Sea Dumbell from snagging true melee debuff memes { + titanBoost = 600; if (eGauntlet) { int duration = 90; @@ -4330,37 +4556,34 @@ namespace CalamityMod.CalPlayer } if (item.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); - }*/ - } + switch (player.meleeEnchant) + { + case 1: + target.AddBuff(BuffID.Venom, 60 * Main.rand.Next(5, 10), false); + break; + case 2: + target.AddBuff(BuffID.CursedInferno, 60 * Main.rand.Next(3, 7), false); + break; + case 3: + target.AddBuff(BuffID.OnFire, 60 * Main.rand.Next(3, 7), false); + break; + case 5: + target.AddBuff(BuffID.Ichor, 60 * Main.rand.Next(10, 20), false); + break; + case 6: + target.AddBuff(BuffID.Confused, 60 * Main.rand.Next(1, 4), false); + break; + case 8: + target.AddBuff(BuffID.Poisoned, 60 * Main.rand.Next(5, 10), false); + break; + case 4: + target.AddBuff(BuffID.Midas, 120, false); + break; + } + if (titanHeartMask) + { + target.AddBuff(ModContent.BuffType(), 60 * Main.rand.Next(1,6), false); // 1 to 5 seconds + } } if (holyWrath) { @@ -4439,11 +4662,13 @@ namespace CalamityMod.CalPlayer } } } + if (proj.Calamity().trueMelee) titanBoost = 600; if (sulfurSet && proj.friendly && !target.friendly) target.AddBuff(BuffID.Poisoned, 120); + if (omegaBlueChestplate && proj.friendly && !target.friendly) target.AddBuff(ModContent.BuffType(), 240); @@ -4458,7 +4683,7 @@ namespace CalamityMod.CalPlayer { CalamityUtils.Inflict246DebuffsNPC(target, ModContent.BuffType()); } - if ((plaguebringerCarapace || uberBees) && (proj.type == 566 || proj.type == 181 || proj.type == 189)) + if ((plaguebringerCarapace || uberBees) && CalamityMod.friendlyBeeList.Contains(proj.type)) { target.AddBuff(ModContent.BuffType(), 360); } @@ -4527,37 +4752,30 @@ namespace CalamityMod.CalPlayer } 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); - } - } + switch (player.meleeEnchant) + { + case 1: + target.AddBuff(BuffID.Venom, 60 * Main.rand.Next(5, 10), false); + break; + case 2: + target.AddBuff(BuffID.CursedInferno, 60 * Main.rand.Next(3, 7), false); + break; + case 3: + target.AddBuff(BuffID.OnFire, 60 * Main.rand.Next(3, 7), false); + break; + case 5: + target.AddBuff(BuffID.Ichor, 60 * Main.rand.Next(10, 20), false); + break; + case 6: + target.AddBuff(BuffID.Confused, 60 * Main.rand.Next(1, 4), false); + break; + case 8: + target.AddBuff(BuffID.Poisoned, 60 * Main.rand.Next(5, 10), false); + break; + case 4: + target.AddBuff(BuffID.Midas, 120, false); + break; + } if (etherealExtorter) { if (ZoneSunkenSea) @@ -4578,6 +4796,10 @@ namespace CalamityMod.CalPlayer target.AddBuff(ModContent.BuffType(), 240, false); } } + if (titanHeartMask) + { + target.AddBuff(ModContent.BuffType(), 60 * Main.rand.Next(1,6), false); // 1 to 5 seconds + } } if (vexation) { @@ -4611,11 +4833,8 @@ namespace CalamityMod.CalPlayer } } - 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 (item.melee) - titanBoost = 600; + if (!item.melee && player.meleeEnchant == 7) + Projectile.NewProjectile(target.Center, target.velocity, ProjectileID.ConfettiMelee, 0, 0f, player.whoAmI, 0f, 0f); if (omegaBlueChestplate) target.AddBuff(ModContent.BuffType(), 240); @@ -4638,6 +4857,7 @@ namespace CalamityMod.CalPlayer if (item.melee) { + titanBoost = 600; if (eGauntlet) { int duration = 90; @@ -4682,37 +4902,34 @@ namespace CalamityMod.CalPlayer } if (item.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); - }*/ - } + switch (player.meleeEnchant) + { + case 1: + target.AddBuff(BuffID.Venom, 60 * Main.rand.Next(5, 10), false); + break; + case 2: + target.AddBuff(BuffID.CursedInferno, 60 * Main.rand.Next(3, 7), false); + break; + case 3: + target.AddBuff(BuffID.OnFire, 60 * Main.rand.Next(3, 7), false); + break; + case 5: + target.AddBuff(BuffID.Ichor, 60 * Main.rand.Next(10, 20), false); + break; + case 6: + target.AddBuff(BuffID.Confused, 60 * Main.rand.Next(1, 4), false); + break; + case 8: + target.AddBuff(BuffID.Poisoned, 60 * Main.rand.Next(5, 10), false); + break; + /*case 4: + target.AddBuff(BuffID.Midas, 120, false); + break;*/ + } + if (titanHeartMask) + { + target.AddBuff(ModContent.BuffType(), 60 * Main.rand.Next(1,6), false); // 1 to 5 seconds + } } if (holyWrath) { @@ -4795,6 +5012,7 @@ namespace CalamityMod.CalPlayer if (sulfurSet && proj.friendly) target.AddBuff(BuffID.Poisoned, 120); + if (omegaBlueChestplate && proj.friendly) target.AddBuff(ModContent.BuffType(), 240); @@ -4806,7 +5024,7 @@ namespace CalamityMod.CalPlayer { CalamityUtils.Inflict246DebuffsPvp(target, ModContent.BuffType()); } - if ((plaguebringerCarapace || uberBees) && (proj.type == 566 || proj.type == 181 || proj.type == 189)) + if ((plaguebringerCarapace || uberBees) && CalamityMod.friendlyBeeList.Contains(proj.type)) { target.AddBuff(ModContent.BuffType(), 360); } @@ -4875,37 +5093,30 @@ namespace CalamityMod.CalPlayer } 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) - { + switch (player.meleeEnchant) + { + case 1: + target.AddBuff(BuffID.Venom, 60 * Main.rand.Next(5, 10), false); + break; + case 2: + target.AddBuff(BuffID.CursedInferno, 60 * Main.rand.Next(3, 7), false); + break; + case 3: + target.AddBuff(BuffID.OnFire, 60 * Main.rand.Next(3, 7), false); + break; + case 5: + target.AddBuff(BuffID.Ichor, 60 * Main.rand.Next(10, 20), false); + break; + case 6: + target.AddBuff(BuffID.Confused, 60 * Main.rand.Next(1, 4), false); + break; + case 8: + target.AddBuff(BuffID.Poisoned, 60 * Main.rand.Next(5, 10), false); + break; + /*case 4: target.AddBuff(BuffID.Midas, 120, false); - }*/ - } + break;*/ + } if (etherealExtorter) { if (ZoneSunkenSea) @@ -4917,15 +5128,19 @@ namespace CalamityMod.CalPlayer target.AddBuff(ModContent.BuffType(), 120, false); target.AddBuff(ModContent.BuffType(), 300, false); } - if (Main.moonPhase == 6) //first quarter + /*if (Main.moonPhase == 6) //first quarter { target.AddBuff(BuffID.Midas, 120, false); - } + }*/ if (ZoneCalamity && CalamityMod.fireWeaponList.Contains(player.ActiveItem().type)) { target.AddBuff(ModContent.BuffType(), 240, false); } } + if (titanHeartMask) + { + target.AddBuff(ModContent.BuffType(), 60 * Main.rand.Next(1,6), false); // 1 to 5 seconds + } } if (vexation) { @@ -4957,13 +5172,7 @@ namespace CalamityMod.CalPlayer } if (item.melee) { - double damageAdd = (dodgeScarf ? 0.2 : 0) + - (evasionScarf ? 0.1 : 0) + - ((aBulwarkRare && aBulwarkRareMeleeBoostTimer > 0) ? 2 : 0) + - (DoGLore ? 0.5 : 0) + - (fungalSymbiote ? 0.25 : 0); - - damageMult += damageAdd; + damageMult += trueMeleeDamage; } if (enraged && !CalamityConfig.Instance.BossRushXerocCurse) { @@ -5051,22 +5260,16 @@ namespace CalamityMod.CalPlayer { if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 3) { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(damage * 0.15), 2f, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(damage * 0.15), 2f, player.whoAmI, 0f, 0f); } } } if (unstablePrism && crit) { - for (int num252 = 0; num252 < 3; num252++) + for (int s = 0; s < 3; s++) { - Vector2 value15 = new Vector2((float)Main.rand.Next(-50, 51), (float)Main.rand.Next(-50, 51)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-50, 51), (float)Main.rand.Next(-50, 51)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(30, 61) * 0.1f; - Projectile.NewProjectile(target.Center.X, target.Center.Y, value15.X, value15.Y, ModContent.ProjectileType(), (int)(damage * 0.15), 0f, player.whoAmI, 0f, 0f); + Vector2 velocity = CalamityUtils.RandomVelocity(50f, 30f, 60f); + Projectile.NewProjectile(target.Center, velocity, ModContent.ProjectileType(), (int)(damage * 0.15), 0f, player.whoAmI); } } if (astralStarRain && crit && astralStarRainCooldown <= 0) @@ -5074,32 +5277,13 @@ namespace CalamityMod.CalPlayer astralStarRainCooldown = 60; for (int n = 0; n < 3; n++) { - float x = target.position.X + (float)Main.rand.Next(-400, 400); - float y = target.position.Y - (float)Main.rand.Next(500, 800); - Vector2 vector = new Vector2(x, y); - float num13 = target.position.X + (float)(target.width / 2) - vector.X; - float num14 = target.position.Y + (float)(target.height / 2) - vector.Y; - num13 += (float)Main.rand.Next(-100, 101); - float num15 = 25f; - int projectileType = Main.rand.Next(3); - if (projectileType == 0) - { - projectileType = ModContent.ProjectileType(); - } - else if (projectileType == 1) - { - projectileType = ProjectileID.HallowStar; - } - else - { - projectileType = ModContent.ProjectileType(); - } - float num16 = (float)Math.Sqrt((double)(num13 * num13 + num14 * num14)); - num16 = num15 / num16; - num13 *= num16; - num14 *= num16; - int num17 = Projectile.NewProjectile(x, y, num13, num14, projectileType, 120, 5f, player.whoAmI, 0f, 0f); - Main.projectile[num17].ranged = false; + int projectileType = Utils.SelectRandom(Main.rand, new int[] + { + ModContent.ProjectileType(), + ProjectileID.HallowStar, + ModContent.ProjectileType() + }); + CalamityUtils.ProjectileRain(target.Center, 400f, 100f, 500f, 800f, 25f, projectileType, (int)(120 * player.AverageDamage()), 5f, player.whoAmI, 6); } } if (bloodflareMelee && item.melee) @@ -5167,16 +5351,11 @@ namespace CalamityMod.CalPlayer public override void ModifyHitNPCWithProj(Projectile proj, NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - if (proj.Calamity().rogue) - { - crit = Main.rand.Next(1, 101) < throwingCrit; - } - if (proj.npcProj || proj.trap) return; bool isTrueMelee = proj.Calamity().trueMelee; - bool isSummon = proj.minion || proj.sentry || CalamityMod.projectileMinionList.Contains(proj.type) || ProjectileID.Sets.MinionShot[proj.type] || ProjectileID.Sets.SentryShot[proj.type]; + bool isSummon = proj.IsSummon(); bool hasClassType = proj.melee || proj.ranged || proj.magic || isSummon || proj.Calamity().rogue; Item heldItem = player.ActiveItem(); @@ -5185,7 +5364,7 @@ namespace CalamityMod.CalPlayer { double useTimeMultiplier = 0.85 + (heldItem.useTime * heldItem.useAnimation / 3600D); //28 * 28 = 784 is average so that equals 784 / 3600 = 0.217777 + 1 = 21.7% boost double wingTimeFraction = player.wingTimeMax / 20D; - double meleeStatMultiplier = (double)(player.meleeDamage * (float)(player.meleeCrit / 10D)); + double meleeStatMultiplier = player.meleeDamage * (float)(player.meleeCrit / 10D); if (player.wingTime < player.wingTimeMax) player.wingTime += (int)(useTimeMultiplier * (wingTimeFraction + meleeStatMultiplier)); @@ -5208,13 +5387,7 @@ namespace CalamityMod.CalPlayer } if (isTrueMelee) { - double damageAdd = (dodgeScarf ? 0.2 : 0) + - (evasionScarf ? 0.1 : 0) + - ((aBulwarkRare && aBulwarkRareMeleeBoostTimer > 0) ? 2 : 0) + - (DoGLore ? 0.5 : 0) + - (fungalSymbiote ? 0.25 : 0); - - damageMult += damageAdd; + damageMult += trueMeleeDamage; } if (screwdriver) { @@ -5262,7 +5435,7 @@ namespace CalamityMod.CalPlayer if (randomChance < 15) randomChance = 15; - if (Main.rand.Next(randomChance) == 0) + if (Main.rand.NextBool(randomChance)) damageMult += 1.0; } if (silvaCountdown > 0 && hasSilvaEffect && silvaRanged && proj.ranged) @@ -5380,7 +5553,7 @@ namespace CalamityMod.CalPlayer int defenseAdd = (int)(target.defense * 0.05 * (proj.damage / 50D) * acidRoundMultiplier); //100 defense * 0.05 = 5 damage += defenseAdd; } - if (uberBees && (proj.type == ProjectileID.GiantBee || proj.type == ProjectileID.Bee || proj.type == ProjectileID.Wasp || proj.type == ModContent.ProjectileType() || proj.type == ModContent.ProjectileType() || proj.type == ModContent.ProjectileType() || proj.type == ModContent.ProjectileType())) + if (uberBees && CalamityMod.friendlyBeeList.Contains(proj.type)) { damage += Main.rand.Next(20, 31); } @@ -5396,6 +5569,7 @@ namespace CalamityMod.CalPlayer if (miniPBG.type == ModContent.ProjectileType() && Vector2.Distance(proj.Center, miniPBG.Center) <= PlaguebringerSummon.auraRange && miniPBG.owner == proj.owner) { damage += Main.rand.Next(10, 21); + break; } } } @@ -5434,20 +5608,24 @@ namespace CalamityMod.CalPlayer #endregion #region MultiplicativeReductions - // Fearmonger armor makes you immune to the summoner cross-class nerf - // Forbidden armor makes you immune when holding the respective helmet's preferred weapon type + // Fearmonger armor reduces the summoner cross-class nerf + // Forbidden armor reduces said nerf when holding the respective helmet's preferred weapon type // 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 && !profanedCrystalBuffs && - (!forbidden || !heldItem.magic) && (!forbiddenCirclet || !heldItem.Calamity().rogue)) + bool reducedNerf = fearmongerSet || (forbidden && heldItem.magic); + double summonNerfMult = 0.5; + if (reducedNerf) + summonNerfMult = 0.75; + if (isSummon && !profanedCrystalBuffs) { if (heldItem.type > ItemID.None) { 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.hammer == 0 && heldItem.pick == 0 && heldItem.axe == 0 && heldItem.useStyle != 0 && + !heldItem.accessory && heldItem.ammo == AmmoID.None) { - damage = (int)(damage * 0.75); + damage = (int)(damage * summonNerfMult); } } } @@ -5465,9 +5643,7 @@ namespace CalamityMod.CalPlayer damage = (int)(damage * 0.7); break; } - if (proj.type == ModContent.ProjectileType()) - damage = (int)(damage * 0.8); - else if (proj.type == ModContent.ProjectileType() && heldItem.type == ModContent.ItemType()) + if (proj.type == ModContent.ProjectileType() && heldItem.type == ModContent.ItemType()) damage = (int)(damage * 0.75); } if (proj.type == ProjectileID.SpectreWrath && player.ghostHurt) @@ -5489,36 +5665,24 @@ namespace CalamityMod.CalPlayer { if (theBee && player.statLife >= player.statLifeMax2) { - Main.PlaySound(SoundID.Item, (int)proj.position.X, (int)proj.position.Y, 110); + Main.PlaySound(SoundID.Item110, proj.Center); } if (unstablePrism && crit) { - for (int num252 = 0; num252 < 3; num252++) + for (int s = 0; s < 3; s++) { - Vector2 value15 = new Vector2((float)Main.rand.Next(-50, 51), (float)Main.rand.Next(-50, 51)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-50, 51), (float)Main.rand.Next(-50, 51)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(30, 61) * 0.1f; - Projectile.NewProjectile(proj.oldPosition.X + (float)(proj.width / 2), proj.oldPosition.Y + (float)(proj.height / 2), value15.X, value15.Y, ModContent.ProjectileType(), (int)(damage * 0.15), 0f, player.whoAmI, 0f, 0f); + Vector2 velocity = CalamityUtils.RandomVelocity(50f, 30f, 60f); + Projectile.NewProjectile(target.Center, velocity, ModContent.ProjectileType(), (int)(damage * 0.15), 0f, player.whoAmI); } } if (electricianGlove && proj.Calamity().stealthStrike && proj.Calamity().rogue) { - for (int num252 = 0; num252 < 3; num252++) + for (int s = 0; s < 3; s++) { - Vector2 value15 = new Vector2((float)Main.rand.Next(-50, 51), (float)Main.rand.Next(-50, 51)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-50, 51), (float)Main.rand.Next(-50, 51)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(30, 61) * 0.1f; - 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)(damage * 0.1), 0f, player.whoAmI, 0f, 0f); - Main.projectile[num17].Calamity().forceRogue = true; - Main.projectile[num17].localNPCHitCooldown = -1; + Vector2 velocity = CalamityUtils.RandomVelocity(50f, 30f, 60f); + int spark = Projectile.NewProjectile(target.Center, velocity, ModContent.ProjectileType(), (int)(damage * 0.1), 0f, player.whoAmI); + Main.projectile[spark].Calamity().forceRogue = true; + Main.projectile[spark].localNPCHitCooldown = -1; } } if (astralStarRain && crit && astralStarRainCooldown <= 0) @@ -5526,48 +5690,22 @@ namespace CalamityMod.CalPlayer astralStarRainCooldown = 60; for (int n = 0; n < 3; n++) { - float x = target.position.X + (float)Main.rand.Next(-400, 400); - float y = target.position.Y - (float)Main.rand.Next(500, 800); - Vector2 vector = new Vector2(x, y); - float num13 = target.position.X + (float)(target.width / 2) - vector.X; - float num14 = target.position.Y + (float)(target.height / 2) - vector.Y; - num13 += (float)Main.rand.Next(-100, 101); - float num15 = 25f; - int projectileType = Main.rand.Next(3); - if (projectileType == 0) - { - projectileType = ModContent.ProjectileType(); - } - else if (projectileType == 1) - { - projectileType = ProjectileID.HallowStar; - } - else - { - projectileType = ProjectileID.FallingStar; - } - float num16 = (float)Math.Sqrt((double)(num13 * num13 + num14 * num14)); - num16 = num15 / num16; - num13 *= num16; - num14 *= num16; - int num17 = Projectile.NewProjectile(x, y, num13, num14, projectileType, 120, 5f, player.whoAmI, 0f, 0f); - Main.projectile[num17].Calamity().forceTypeless = true; + int projectileType = Utils.SelectRandom(Main.rand, new int[] + { + ModContent.ProjectileType(), + ProjectileID.HallowStar, + ModContent.ProjectileType() + }); + CalamityUtils.ProjectileRain(target.Center, 400f, 100f, 500f, 800f, 25f, projectileType, (int)(120 * player.AverageDamage()), 5f, player.whoAmI, 6); } } if (tarraRanged && crit && proj.ranged) { - int num251 = Main.rand.Next(2, 4); - for (int num252 = 0; num252 < num251; num252++) + int leafAmt = Main.rand.Next(2, 4); + for (int l = 0; l < leafAmt; l++) { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - int FUCKYOU = Projectile.NewProjectile(target.position.X + (float)(target.width / 2), target.position.Y + (float)(target.height / 2), - value15.X, value15.Y, ProjectileID.Leaf, (int)(damage * 0.25), 0f, player.whoAmI, 0f, 0f); + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); + int FUCKYOU = Projectile.NewProjectile(target.Center, velocity, ProjectileID.Leaf, (int)(damage * 0.25), 0f, player.whoAmI); Main.projectile[FUCKYOU].Calamity().forceTypeless = true; Main.projectile[FUCKYOU].netUpdate = true; } @@ -5576,22 +5714,22 @@ namespace CalamityMod.CalPlayer { if (target.canGhostHeal) { - float num11 = 0.03f; - num11 -= (float)proj.numHits * 0.015f; - if (num11 < 0f) + float projHitMult = 0.03f; + projHitMult -= (float)proj.numHits * 0.015f; + if (projHitMult < 0f) { - num11 = 0f; + projHitMult = 0f; } - float num12 = (float)proj.damage * num11; - if (num12 < 0f) + float cooldownMult = proj.damage * projHitMult; + if (cooldownMult < 0f) { - num12 = 0f; + cooldownMult = 0f; } if (player.lifeSteal > 0f) { player.statLife += 1; player.HealEffect(1); - player.lifeSteal -= num12 * 2f; + player.lifeSteal -= cooldownMult * 2f; } } } @@ -5600,22 +5738,15 @@ namespace CalamityMod.CalPlayer bloodflareMageCooldown = 120; for (int i = 0; i < 3; i++) { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - int fire = Projectile.NewProjectile(target.position.X + (float)(target.width / 2), target.position.Y + (float)(target.height / 2), - value15.X, value15.Y, ProjectileID.BallofFire, (int)(damage * 0.5), 0f, player.whoAmI, 0f, 0f); + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); + int fire = Projectile.NewProjectile(target.Center, velocity, ProjectileID.BallofFire, (int)(damage * 0.5), 0f, player.whoAmI); Main.projectile[fire].Calamity().forceTypeless = true; Main.projectile[fire].netUpdate = true; } } - if (umbraphileSet && proj.Calamity().rogue && (Main.rand.NextBool(4) || proj.Calamity().stealthStrike)) + if (umbraphileSet && proj.Calamity().rogue && (Main.rand.NextBool(4) || proj.Calamity().stealthStrike) && proj.type != ModContent.ProjectileType()) { - Projectile.NewProjectile(proj.Center.X, proj.Center.Y, 0f, 0f, ModContent.ProjectileType(), CalamityUtils.DamageSoftCap(proj.damage * 0.25, 50), 0f, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(proj.Center, Vector2.Zero, ModContent.ProjectileType(), CalamityUtils.DamageSoftCap(proj.damage * 0.25, 50), 0f, player.whoAmI); } if (bloodflareMelee && isTrueMelee) { @@ -5785,60 +5916,147 @@ namespace CalamityMod.CalPlayer if (npc.velocity == Vector2.Zero) { - damage = (int)(damage * velocityScalar); + contactDamageReduction += 1f - velocityScalar; } else { - float amount = npc.velocity.Length() / npc.Calamity().maxVelocity; + float amount = npc.velocity.Length() / (npc.Calamity().maxVelocity * 0.5f); if (amount > 1f) amount = 1f; - damage = (int)(damage * MathHelper.Lerp(velocityScalar, 1.1f, amount)); + float damageReduction = MathHelper.Lerp(velocityScalar, 1.1f, amount); + if (damageReduction < 1f) + contactDamageReduction += 1f - damageReduction; + else + damage = (int)(damage * damageReduction); } } if (triumph) - { - double HPMultiplier = 0.15 * (1.0 - (npc.life / (double)npc.lifeMax)); - int damageReduction = (int)(damage * HPMultiplier); - damage -= damageReduction; - } + contactDamageReduction += 0.15 * (1D - (npc.life / (double)npc.lifeMax)); if (aSparkRare) { if (npc.type == NPCID.BlueJellyfish || npc.type == NPCID.PinkJellyfish || npc.type == NPCID.GreenJellyfish || npc.type == NPCID.FungoFish || npc.type == NPCID.BloodJelly || npc.type == NPCID.AngryNimbus || npc.type == NPCID.GigaZapper || npc.type == NPCID.MartianTurret || npc.type == ModContent.NPCType() || npc.type == ModContent.NPCType() || npc.type == ModContent.NPCType()) - damage /= 2; + contactDamageReduction += 0.5; } if (fleshTotem && !fleshTotemCooldown) { player.AddBuff(ModContent.BuffType(), 1200, false); //20 seconds - damage /= 2; - } + contactDamageReduction += 0.5; + } if (tarragonCloak && !tarragonCloakCooldown && tarraMelee) - { - damage /= 2; - } + contactDamageReduction += 0.5; if (bloodflareMelee && bloodflareFrenzy && !bloodFrenzyCooldown) - { - damage /= 2; - } + contactDamageReduction += 0.5; if (silvaMelee && silvaCountdown <= 0 && hasSilvaEffect) - { - damage = (int)(damage * 0.8); - } + contactDamageReduction += 0.2; - if (aBulwarkRare) - { - aBulwarkRareMeleeBoostTimer += 3 * damage; - if (aBulwarkRareMeleeBoostTimer > 900) - aBulwarkRareMeleeBoostTimer = 900; - } + if (npc.Calamity().tSad > 0) + contactDamageReduction += 0.5; + + if (npc.Calamity().relicOfResilienceWeakness > 0) + { + contactDamageReduction += RelicOfResilience.WeaknessDR; + npc.Calamity().relicOfResilienceWeakness = 0; + } + + if (beeResist) + { + if (CalamityMod.beeEnemyList.Contains(npc.type)) + contactDamageReduction += 0.25; + } + + if (eskimoSet) + { + if (npc.coldDamage) + contactDamageReduction += 0.1; + } + + if (trinketOfChiBuff) + contactDamageReduction += 0.15; + + // Fearmonger set provides 15% multiplicative DR that ignores caps during the Holiday Moons. + // To prevent abuse, this effect does not work if there are any bosses alive. + if (fearmongerSet && !areThereAnyDamnBosses && (Main.pumpkinMoon || Main.snowMoon)) + contactDamageReduction += 0.15; + + if (abyssalDivingSuitPlates) + contactDamageReduction += 0.15; + + if (sirenIce) + contactDamageReduction += 0.2; + + if (encased) + contactDamageReduction += 0.3; + + if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0 && player.ActiveItem().type == ModContent.ItemType()) + contactDamageReduction += 0.5; + + if (theBee && player.statLife >= player.statLifeMax2 && theBeeCooldown <= 0) + { + contactDamageReduction += 0.5; + theBeeCooldown = 600; + } + + if (CalamityWorld.revenge) + { + if (!CalamityWorld.downedBossAny) + contactDamageReduction += 0.2; + + if (CalamityConfig.Instance.Rippers) + { + if (adrenaline == adrenalineMax && !adrenalineModeActive) + contactDamageReduction += 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) + contactDamageReduction += 0.1; + + if (leviathanAndSirenLore) + { + if (!player.IsUnderwater()) + contactDamageReduction -= 0.05; + } + + if (vHex) + contactDamageReduction -= 0.3; + + if (irradiated) + contactDamageReduction -= 0.1; + + if (corrEffigy) + contactDamageReduction -= 0.2; + + if (calamityRing && !voidOfExtinction) + contactDamageReduction -= 0.15; + + // 10% is converted to 9%, 25% is converted to 20%, 50% is converted to 33%, 75% is converted to 43%, 100% is converted to 50% + if (contactDamageReduction > 0D) + { + if (marked || reaperToothNecklace) + contactDamageReduction *= 0.5; + + if (aCrunch) + contactDamageReduction *= 0.33; + + if (wCleave) + contactDamageReduction *= 0.75; + + // Scale with base damage reduction + if (DRStat > 0) + contactDamageReduction *= 1f - (DRStat * 0.01f); + + contactDamageReduction = 1D / (1D + contactDamageReduction); + damage = (int)(damage * contactDamageReduction); + } if (Main.hardMode && Main.expertMode) { @@ -5848,6 +6066,24 @@ namespace CalamityMod.CalPlayer damage = (int)(damage * 0.6); } + if (CalamityWorld.ironHeart) + { + int damageMin = 60 + (player.statLifeMax2 / 10); + int damageWithDR = (int)(damage * (1f - player.endurance)); + if (damage < damageMin) + { + player.endurance = 0f; + damage = damageMin; + } + } + + if (aBulwarkRare) + { + aBulwarkRareMeleeBoostTimer += 3 * damage; + if (aBulwarkRareMeleeBoostTimer > 900) + aBulwarkRareMeleeBoostTimer = 900; + } + if (player.whoAmI == Main.myPlayer && gainRageCooldown <= 0) { if (CalamityWorld.revenge && CalamityConfig.Instance.Rippers && !npc.SpawnedFromStatue) @@ -5870,7 +6106,7 @@ namespace CalamityMod.CalPlayer } } } - } + } #endregion #region Modify Hit By Proj @@ -5896,9 +6132,68 @@ namespace CalamityMod.CalPlayer player.immuneNoBlink = true; player.immuneTime = 4; damage = 0; + return; } } + if (proj.type == ModContent.ProjectileType()) + { + damage = 0; + return; + } + + // Reduce damage from vanilla traps + // 350 in normal, 450 in expert + if (proj.type == ProjectileID.Explosives) + damage = (int)(damage * (Main.expertMode ? 0.225 : 0.35)); + if (Main.expertMode) + { + // 140 in normal, 182 in expert + if (proj.type == ProjectileID.Boulder) + damage = (int)(damage * 0.65); + } + + // Reduce the bullshit damage Ichor Stickers do + if (proj.type == ProjectileID.GoldenShowerHostile) + damage = (int)(damage * 0.35); + + 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; + } + + if (CalamityWorld.death) + damageMultiplier += (damageMultiplier - 1D) * 0.6; + + damage = (int)(damage * damageMultiplier); + } + + int bossRushDamage = (Main.expertMode ? 125 : 150) + (CalamityWorld.bossRushStage / 2); + if (CalamityWorld.bossRushActive) + { + if (damage < bossRushDamage) + damage = bossRushDamage; + } + // Reduce projectile damage based on banner type // IMPORTANT NOTE: Rework this in 1.4! Point point = player.Center.ToTileCoordinates(); @@ -5941,92 +6236,125 @@ namespace CalamityMod.CalPlayer // Reduce damage if (hasBanner) - { BannerProjectileDamageReduction(proj, ref damage, NPCBannerBuff); - } - - int bossRushDamage = (Main.expertMode ? 125 : 150) + (CalamityWorld.bossRushStage / 2); - if (CalamityWorld.bossRushActive) - { - if (damage < bossRushDamage) - damage = bossRushDamage; - } if (projRefRare) { if (proj.type == projTypeJustHitBy) - damage = (int)(damage * 0.85); + projectileDamageReduction += 0.15; } if (aSparkRare) { - if (proj.type == ProjectileID.MartianTurretBolt || proj.type == ProjectileID.GigaZapperSpear || proj.type == ProjectileID.CultistBossLightningOrbArc || proj.type == ModContent.ProjectileType() || - proj.type == ProjectileID.BulletSnowman || proj.type == ProjectileID.BulletDeadeye || proj.type == ProjectileID.SniperBullet) - damage /= 2; - } - - if (proj.type == ProjectileID.Nail) - { - damage = (int)(damage * 0.75); + if (proj.type == ProjectileID.MartianTurretBolt || proj.type == ProjectileID.GigaZapperSpear || proj.type == ProjectileID.CultistBossLightningOrbArc || proj.type == ModContent.ProjectileType() || proj.type == ProjectileID.VortexLightning || + proj.type == ProjectileID.BulletSnowman || proj.type == ProjectileID.BulletDeadeye || proj.type == ProjectileID.SniperBullet || proj.type == ProjectileID.VortexLaser) + projectileDamageReduction += 0.5; } + if (beeResist) { if (CalamityMod.beeProjectileList.Contains(proj.type)) - damage = (int)(damage * 0.75); + projectileDamageReduction += 0.25; } if (Main.hardMode && Main.expertMode && !CalamityWorld.spawnedHardBoss && proj.active && !proj.friendly && proj.hostile && damage > 0) { if (CalamityMod.hardModeNerfList.Contains(proj.type)) - damage = (int)(damage * 0.75); + projectileDamageReduction += 0.25; } - 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; - } + if (trinketOfChiBuff) + projectileDamageReduction += 0.15; - if (CalamityWorld.death) - damageMultiplier += (damageMultiplier - 1D) * 0.6; + // Fearmonger set provides 15% multiplicative DR that ignores caps during the Holiday Moons. + // To prevent abuse, this effect does not work if there are any bosses alive. + if (fearmongerSet && !areThereAnyDamnBosses && (Main.pumpkinMoon || Main.snowMoon)) + projectileDamageReduction += 0.15; - damage = (int)(damage * damageMultiplier); - } + if (abyssalDivingSuitPlates) + projectileDamageReduction += 0.15; - // Reduce damage from vanilla traps - // 350 in normal, 450 in expert - if (proj.type == ProjectileID.Explosives) - damage = (int)(damage * (Main.expertMode ? 0.225 : 0.35)); - if (Main.expertMode) - { - // 140 in normal, 182 in expert - if (proj.type == ProjectileID.Boulder) - damage = (int)(damage * 0.65); - } + if (sirenIce) + projectileDamageReduction += 0.2; - if (proj.type == ModContent.ProjectileType()) - damage = 0; + if (encased) + projectileDamageReduction += 0.3; - if (player.whoAmI == Main.myPlayer && gainRageCooldown <= 0) + if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0 && player.ActiveItem().type == ModContent.ItemType()) + projectileDamageReduction += 0.5; + + if (theBee && player.statLife >= player.statLifeMax2 && theBeeCooldown <= 0) + { + projectileDamageReduction += 0.5; + theBeeCooldown = 600; + } + + if (CalamityWorld.revenge) + { + if (!CalamityWorld.downedBossAny) + projectileDamageReduction += 0.2; + + if (CalamityConfig.Instance.Rippers) + { + if (adrenaline == adrenalineMax && !adrenalineModeActive) + projectileDamageReduction += 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) + projectileDamageReduction += 0.1; + + if (leviathanAndSirenLore) + { + if (!player.IsUnderwater()) + projectileDamageReduction -= 0.05; + } + + if (vHex) + projectileDamageReduction -= 0.3; + + if (irradiated) + projectileDamageReduction -= 0.1; + + if (corrEffigy) + projectileDamageReduction -= 0.2; + + if (calamityRing && !voidOfExtinction) + projectileDamageReduction -= 0.15; + + // 10% is converted to 9%, 25% is converted to 20%, 50% is converted to 33%, 75% is converted to 43%, 100% is converted to 50% + if (projectileDamageReduction > 0D) + { + if (marked || reaperToothNecklace) + projectileDamageReduction *= 0.5; + + if (aCrunch) + projectileDamageReduction *= 0.33; + + if (wCleave) + projectileDamageReduction *= 0.75; + + // Scale with base damage reduction + if (DRStat > 0) + projectileDamageReduction *= 1f - (DRStat * 0.01f); + + projectileDamageReduction = 1D / (1D + projectileDamageReduction); + damage = (int)(damage * projectileDamageReduction); + } + + if (CalamityWorld.ironHeart) + { + int damageMin = 60 + (player.statLifeMax2 / 10); + int damageWithDR = (int)(damage * (1f - player.endurance)); + if (damage < damageMin) + { + player.endurance = 0f; + damage = damageMin; + } + } + + if (player.whoAmI == Main.myPlayer && gainRageCooldown <= 0) { if (CalamityWorld.revenge && CalamityConfig.Instance.Rippers && !CalamityMod.trapProjectileList.Contains(proj.type)) { @@ -6097,7 +6425,7 @@ namespace CalamityMod.CalPlayer if (bannerNPCType == ModContent.NPCType()) reduceDamage = true; } - else if (proj.type == ModContent.ProjectileType() || proj.type == ModContent.ProjectileType() || proj.type == ModContent.ProjectileType() || proj.type == ModContent.ProjectileType()) + else if (proj.type == ModContent.ProjectileType() || proj.type == ModContent.ProjectileType() || proj.type == ModContent.ProjectileType() || proj.type == ModContent.ProjectileType()) { if (bannerNPCType == ModContent.NPCType()) reduceDamage = true; @@ -6180,17 +6508,17 @@ namespace CalamityMod.CalPlayer else if (proj.type == ProjectileID.EyeBeam) { if (bannerNPCType == ModContent.NPCType()) - reduceDamage = !NPC.AnyNPCs(NPCID.Golem); + reduceDamage = !NPC.AnyNPCs(NPCID.Golem) && !NPC.AnyNPCs(ModContent.NPCType()); } else if (proj.type == ProjectileID.CultistBossIceMist || proj.type == ProjectileID.CultistBossLightningOrbArc) { if (bannerNPCType == ModContent.NPCType() || bannerNPCType == ModContent.NPCType()) - reduceDamage = !NPC.AnyNPCs(ModContent.NPCType()) && !NPC.AnyNPCs(ModContent.NPCType()) && !NPC.AnyNPCs(NPCID.CultistBoss); + reduceDamage = !NPC.AnyNPCs(ModContent.NPCType()) && !NPC.AnyNPCs(ModContent.NPCType()) && !NPC.AnyNPCs(NPCID.CultistBoss) && proj.Calamity().lineColor != 1; } else if (proj.type == ProjectileID.SaucerScrap) { if (bannerNPCType == ModContent.NPCType()) - reduceDamage = Main.invasionType != InvasionID.MartianMadness; + reduceDamage = Main.invasionType != InvasionID.MartianMadness && (!NPC.AnyNPCs(NPCID.TheDestroyer) || !CalamityWorld.revenge); } else { @@ -6262,7 +6590,7 @@ namespace CalamityMod.CalPlayer case ProjectileID.CursedFlameHostile: if (bannerNPCType == NPCID.Clinger) { - reduceDamage = !NPC.AnyNPCs(NPCID.Spazmatism); + reduceDamage = !NPC.AnyNPCs(NPCID.Spazmatism) && (!NPC.AnyNPCs(NPCID.EaterofWorldsHead) || !CalamityWorld.revenge); } break; @@ -6277,14 +6605,14 @@ namespace CalamityMod.CalPlayer case ProjectileID.InfernoHostileBolt: if (bannerNPCType == NPCID.DiabolistRed || bannerNPCType == NPCID.DiabolistWhite) { - reduceDamage = true; + reduceDamage = !NPC.AnyNPCs(NPCID.Golem) || !CalamityWorld.revenge; } break; case ProjectileID.Shadowflames: if (bannerNPCType == NPCID.GiantCursedSkull) { - reduceDamage = true; + reduceDamage = !NPC.AnyNPCs(NPCID.SkeletronHead) || !CalamityWorld.revenge; } break; @@ -6344,8 +6672,29 @@ namespace CalamityMod.CalPlayer } break; + case ProjectileID.WoodenArrowHostile: + if (bannerNPCType == NPCID.GoblinArcher || bannerNPCType == NPCID.CultistArcherBlue || bannerNPCType == NPCID.CultistArcherWhite) + { + reduceDamage = true; + } + break; + case ProjectileID.FlamingArrow: - if (bannerNPCType == NPCID.SkeletonArcher || bannerNPCType == NPCID.PirateCrossbower || bannerNPCType == NPCID.GoblinArcher || bannerNPCType == NPCID.ElfArcher) + if (bannerNPCType == NPCID.SkeletonArcher || bannerNPCType == NPCID.PirateCrossbower || bannerNPCType == NPCID.ElfArcher) + { + reduceDamage = true; + } + break; + + case ProjectileID.SalamanderSpit: + if (bannerNPCType >= NPCID.Salamander && bannerNPCType <= NPCID.Salamander9) + { + reduceDamage = true; + } + break; + + case ProjectileID.SkeletonBone: + if (bannerNPCType == NPCID.Skeleton) { reduceDamage = true; } @@ -6379,6 +6728,13 @@ namespace CalamityMod.CalPlayer } break; + case ProjectileID.FrostShard: + if (bannerNPCType == NPCID.AngryNimbus) + { + reduceDamage = !NPC.AnyNPCs(NPCID.IceQueen) && CalamityWorld.death; + } + break; + case ProjectileID.FrostBeam: if (bannerNPCType == NPCID.IceGolem) { @@ -6418,7 +6774,7 @@ namespace CalamityMod.CalPlayer case ProjectileID.EyeLaser: if (bannerNPCType == NPCID.Eyezor) { - reduceDamage = !NPC.AnyNPCs(NPCID.Retinazer); + reduceDamage = !NPC.AnyNPCs(NPCID.Retinazer) && !NPC.AnyNPCs(NPCID.WallofFleshEye); } break; @@ -6464,6 +6820,13 @@ namespace CalamityMod.CalPlayer } break; + case ProjectileID.Twinkle: + if (bannerNPCType == NPCID.StardustSpiderBig) + { + reduceDamage = true; + } + break; + case ProjectileID.VortexAcid: if (bannerNPCType == NPCID.VortexHornetQueen) { @@ -6506,15 +6869,8 @@ namespace CalamityMod.CalPlayer } break; - case ProjectileID.ScutlixLaser: - if (bannerNPCType == NPCID.Scutlix) - { - reduceDamage = true; - } - break; - case ProjectileID.MartianTurretBolt: - if ((bannerNPCType == NPCID.MartianTurret && Main.invasionType == InvasionID.MartianMadness) || (bannerNPCType == ModContent.NPCType() && Main.invasionType != InvasionID.MartianMadness)) + if ((bannerNPCType == NPCID.MartianTurret && Main.invasionType == InvasionID.MartianMadness) || ((bannerNPCType == ModContent.NPCType() || bannerNPCType == ModContent.NPCType()) && Main.invasionType != InvasionID.MartianMadness)) { reduceDamage = true; } @@ -6559,21 +6915,31 @@ namespace CalamityMod.CalPlayer else if (npc.type == NPCID.Plantera && npc.life < npc.lifeMax / 2) { player.AddBuff(BuffID.Poisoned, 180); - player.AddBuff(BuffID.Bleeding, 300); + player.AddBuff(BuffID.Venom, 180); + player.AddBuff(BuffID.Bleeding, 300); } else if (npc.type == NPCID.PlanterasTentacle) { player.AddBuff(BuffID.Poisoned, 120); - player.AddBuff(BuffID.Bleeding, 180); + player.AddBuff(BuffID.Venom, 120); + player.AddBuff(BuffID.Bleeding, 180); } - } + else if (npc.type == NPCID.AncientDoom) + { + player.AddBuff(ModContent.BuffType(), 180); + } + else if (npc.type == NPCID.AncientLight) + { + player.AddBuff(ModContent.BuffType(), 180); + } + } } public override void OnHitByProjectile(Projectile proj, int damage, bool crit) { if (sulfurSet && !proj.friendly) { - if (Main.player[proj.owner] == null) + if (Main.player[proj.owner] is null) { if (!Main.npc[proj.owner].friendly) Main.npc[proj.owner].AddBuff(BuffID.Poisoned, 120); @@ -6600,7 +6966,7 @@ namespace CalamityMod.CalPlayer { player.AddBuff(ModContent.BuffType(), 120); } - else if (proj.type == ProjectileID.DeathLaser) + else if (proj.type == ProjectileID.DeathLaser || proj.type == ProjectileID.RocketSkeleton) { player.AddBuff(BuffID.OnFire, 240); } @@ -6611,7 +6977,8 @@ namespace CalamityMod.CalPlayer else if (proj.type == ProjectileID.ThornBall) { player.AddBuff(BuffID.Poisoned, 240); - } + player.AddBuff(BuffID.Venom, 120); + } else if (proj.type == ProjectileID.CultistBossIceMist) { player.AddBuff(BuffID.Frozen, 60); @@ -6620,10 +6987,15 @@ 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 + int deathModeDuration = NPC.downedMoonlord ? 80 : NPC.downedPlantBoss ? 40 : Main.hardMode ? 20 : 10; + player.AddBuff(BuffID.Electrified, proj.Calamity().lineColor == 1 ? deathModeDuration : 120); + // Scaled duration for DM lightning, 2 seconds for Storm Weaver/Cultist lightning } - } + else if (proj.type == ProjectileID.AncientDoomProjectile) + { + player.AddBuff(ModContent.BuffType(), 180); + } + } if (CalamityMod.projectileDestroyExceptionList.TrueForAll(x => proj.type != x)) { if (projRef && proj.active && !proj.friendly && proj.hostile && damage > 0 && Main.rand.NextBool(20)) @@ -6647,7 +7019,7 @@ namespace CalamityMod.CalPlayer } if (aSparkRare && proj.active && !proj.friendly && proj.hostile && damage > 0) { - if (proj.type == ProjectileID.BulletSnowman || proj.type == ProjectileID.BulletDeadeye || proj.type == ProjectileID.SniperBullet) + if (proj.type == ProjectileID.BulletSnowman || proj.type == ProjectileID.BulletDeadeye || proj.type == ProjectileID.SniperBullet || proj.type == ProjectileID.VortexLaser) { proj.hostile = false; proj.friendly = true; @@ -6673,7 +7045,7 @@ namespace CalamityMod.CalPlayer #region Can Hit public override bool? CanHitNPC(Item item, NPC target) { - if (camper && ((double)Math.Abs(player.velocity.X) > 0.05 || (double)Math.Abs(player.velocity.Y) > 0.05)) + if (camper && player.StandingStill()) { return false; } @@ -6682,7 +7054,7 @@ namespace CalamityMod.CalPlayer public override bool? CanHitNPCWithProj(Projectile proj, NPC target) { - if (camper && ((double)Math.Abs(player.velocity.X) > 0.05 || (double)Math.Abs(player.velocity.Y) > 0.05)) + if (camper && player.StandingStill()) { return false; } @@ -6749,9 +7121,12 @@ namespace CalamityMod.CalPlayer num79 *= num80; float speedX4 = num78 + (float)Main.rand.Next(-30, 31) * 0.02f; float speedY5 = num79 + (float)Main.rand.Next(-30, 31) * 0.02f; - int p = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, (int)(damage * 0.15f), (int)(knockBack), player.whoAmI, 0f, (float)Main.rand.Next(15)); - Main.projectile[p].knockBack /= 2; + int p = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, (int)(damage * 0.15f), knockBack * 0.5f, player.whoAmI); Main.projectile[p].Calamity().forceRogue = true; //in case melee/rogue variants bug out + if (item.type == ModContent.ItemType()) + { + Main.projectile[p].ai[1] = 1f; + } if (StealthStrikeAvailable()) { int knifeCount = 15; @@ -6791,93 +7166,101 @@ namespace CalamityMod.CalPlayer } #endregion - #region Frame Effects + #region Frame Effects + public override void FrameEffects() + { + if (player.Calamity().andromedaState == AndromedaPlayerState.LargeRobot || + player.Calamity().andromedaState == AndromedaPlayerState.SpecialAttack) + { + player.head = mod.GetEquipSlot("NoHead", EquipType.Head); // To make the head invisible on the map. The map was having a hissy fit because of hitbox changes. + } + 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); + player.face = -1; - public override void FrameEffects() - { - if (player.Calamity().andromedaState == AndromedaPlayerState.LargeRobot || - player.Calamity().andromedaState == AndromedaPlayerState.SpecialAttack) + bool enrage = !profanedCrystalForce && profanedCrystalBuffs && player.statLife <= (int)(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); + player.head = snowmanNoseless ? mod.GetEquipSlot("PopoNoselessHead", EquipType.Head) : mod.GetEquipSlot("PopoHead", EquipType.Head); + player.face = -1; + } + else if ((abyssalDivingSuitPower || abyssalDivingSuitForce) && !abyssalDivingSuitHide) + { + player.legs = mod.GetEquipSlot("AbyssalDivingSuitLeg", EquipType.Legs); + player.body = mod.GetEquipSlot("AbyssalDivingSuitBody", EquipType.Body); + player.head = mod.GetEquipSlot("AbyssalDivingSuitHead", EquipType.Head); + player.face = -1; + } + else if ((sirenBoobsPower || sirenBoobsForce) && !sirenBoobsHide) + { + player.legs = mod.GetEquipSlot("SirenLeg", EquipType.Legs); + player.body = mod.GetEquipSlot("SirenBody", EquipType.Body); + player.head = mod.GetEquipSlot("SirenHead", EquipType.Head); + player.face = -1; + } + else if (meldTransformationPower || meldTransformationForce) { - player.head = mod.GetEquipSlot("NoHead", EquipType.Head); // To make the head invisible on the map. The map was having a hissy fit because of hitbox changes. + player.legs = mod.GetEquipSlot("MeldTransformationLegs", EquipType.Legs); + player.body = mod.GetEquipSlot("MeldTransformationBody", EquipType.Body); + player.head = mod.GetEquipSlot("MeldTransformationHead", EquipType.Head); } - else 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 (profanedCrystalWingCounter.Key != 1) + profanedCrystalWingCounter = new KeyValuePair(1, 7); + if (profanedCrystalAnimCounter.Key != 0) + profanedCrystalAnimCounter = new KeyValuePair(0, 10); + } + 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; player.noFallDmg = true; player.fallStart = (int)(player.position.Y / 16f); - } - } - 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); + } + } + if (abyssDivingGear && (player.head == -1 || player.head == ArmorIDs.Head.FamiliarWig)) + { + player.head = mod.GetEquipSlot("AbyssDivingGearHead", EquipType.Head); + player.face = -1; + } - bool enrage = !profanedCrystalForce && profanedCrystalBuffs && player.statLife <= (int)(player.statLifeMax2 * 0.5); + if (CalamityWorld.defiled) + Defiled(); - 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); - player.head = snowmanNoseless ? mod.GetEquipSlot("PopoNoselessHead", EquipType.Head) : mod.GetEquipSlot("PopoHead", EquipType.Head); - } - else if ((abyssalDivingSuitPower || abyssalDivingSuitForce) && !abyssalDivingSuitHide) - { - player.legs = mod.GetEquipSlot("AbyssalDivingSuitLeg", EquipType.Legs); - player.body = mod.GetEquipSlot("AbyssalDivingSuitBody", EquipType.Body); - player.head = mod.GetEquipSlot("AbyssalDivingSuitHead", EquipType.Head); - } - else if ((sirenBoobsPower || sirenBoobsForce) && !sirenBoobsHide) - { - player.legs = mod.GetEquipSlot("SirenLeg", EquipType.Legs); - player.body = mod.GetEquipSlot("SirenBody", EquipType.Body); - player.head = mod.GetEquipSlot("SirenHead", EquipType.Head); - } - else if ((sirenBoobsAltPower || sirenBoobsAltForce) && !sirenBoobsAltHide) - { - player.legs = mod.GetEquipSlot("SirenLegAlt", EquipType.Legs); - player.body = mod.GetEquipSlot("SirenBodyAlt", EquipType.Body); - player.head = mod.GetEquipSlot("SirenHeadAlt", EquipType.Head); - } - else - { - if (profanedCrystalWingCounter.Key != 1) - profanedCrystalWingCounter = new KeyValuePair(1, 7); - if (profanedCrystalAnimCounter.Key != 0) - profanedCrystalAnimCounter = new KeyValuePair(0, 10); - } - - if (CalamityWorld.defiled) - Defiled(); - - if (weakPetrification) - WeakPetrification(); - } - #endregion + if (weakPetrification) + WeakPetrification(); + } + #endregion #region Limitations private void WeakPetrification() @@ -6959,23 +7342,39 @@ namespace CalamityMod.CalPlayer Main.PlaySound(SoundID.NPCHit, (int)player.position.X, (int)player.position.Y, 4, 1f, 0f); //metal hit noise hurtSoundTimer = 10; } - else if (((sirenBoobsPower || sirenBoobsForce) && !sirenBoobsHide) || ((sirenBoobsAltPower || sirenBoobsAltForce) && !sirenBoobsAltHide)) + else if ((sirenBoobsPower || sirenBoobsForce) && !sirenBoobsHide) { playSound = false; Main.PlaySound(SoundID.FemaleHit, (int)player.position.X, (int)player.position.Y, 1, 1f, 0f); //female hit noise hurtSoundTimer = 10; } + else if (titanHeartSet) + { + playSound = false; + Terraria.Audio.LegacySoundStyle atlasHurt = Utils.SelectRandom(Main.rand, new Terraria.Audio.LegacySoundStyle[] + { + mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AtlasHurt0"), + mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AtlasHurt1"), + mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AtlasHurt2") + }); + Main.PlaySound(atlasHurt, (int)player.position.X, (int)player.position.Y); + hurtSoundTimer = 10; + } } - #region MultiplierBoosts double damageMult = 1.0 + (dArtifact ? 0.25 : 0.0) + (DoGLore ? 0.1 : 0.0) + ((player.beetleDefense && player.beetleOrbs > 0) ? (0.05 * player.beetleOrbs) : 0.0) + (enraged ? 0.25 : 0.0) + - ((CalamityWorld.defiled && Main.rand.NextBool(4)) ? 0.5 : 0.0) + - ((bloodPact && Main.rand.NextBool(4)) ? 1.5 : 0.0); + ((CalamityWorld.defiled && Main.rand.NextBool(4)) ? 0.5 : 0.0); + + if (bloodPact && Main.rand.NextBool(4)) + { + player.AddBuff(ModContent.BuffType(), 600); + damageMult += 1.25; + } if (CalamityWorld.revenge) { @@ -6991,8 +7390,14 @@ namespace CalamityMod.CalPlayer if (CalamityWorld.revenge) { customDamage = true; - double newDamage = damage - (player.statDefense * 0.75); - double newDamageLimit = 5.0 + (Main.hardMode ? 5.0 : 0.0) + (NPC.downedPlantBoss ? 5.0 : 0.0) + (NPC.downedMoonlord ? 5.0 : 0.0); //5, 10, 15, 20 + + double defenseMultiplier = /*Main.masterMode ? 1D :*/ 0.75; + double newDamage = damage - (player.statDefense * defenseMultiplier); + double bossDamageLimitIncrease = CalamityWorld.death ? 40D : 20D; // dude why would you even do that? super uncool fab, 0/10, you should jump off a bridge for having the audacity to do something like this :((((( + double newDamageLimit = NPC.downedMoonlord ? 20D : (NPC.downedPlantBoss || CalamityWorld.downedCalamitas) ? 15D : Main.hardMode ? 10D : 5D; + /*if (areThereAnyDamnBosses && Main.masterMode) + newDamageLimit += bossDamageLimitIncrease;*/ + if (newDamage < newDamageLimit) { newDamage = newDamageLimit; @@ -7000,64 +7405,22 @@ namespace CalamityMod.CalPlayer damage = (int)newDamage; } - #region MultiplicativeReductions - if (trinketOfChiBuff) - { - damage = (int)(damage * 0.85); - } - if (purpleCandle) - { - damage = (int)(damage - (player.statDefense * 0.05)); - } - // Fearmonger set provides 15% multiplicative DR that ignores caps during the Holiday Moons. - // To prevent abuse, this effect does not work if there are any bosses alive. - if (fearmongerSet && !areThereAnyDamnBosses && (Main.pumpkinMoon || Main.snowMoon)) - { - damage = (int)(damage * 0.85f); - } - if (abyssalDivingSuitPlates) - { - damage = (int)(damage * 0.85); - } - if (sirenIce) - { - damage = (int)(damage * 0.85); - } - if (encased) - { - damage = (int)(damage * 0.7); - } - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0 && player.ActiveItem().type == ModContent.ItemType()) - { - damage = (int)(damage * 0.5); - } - if (theBee && player.statLife >= player.statLifeMax2 && theBeeCooldown <= 0) - { - damage = (int)(damage * 0.5); - theBeeCooldown = 600; - } - if (CalamityWorld.revenge) - { - if (!CalamityWorld.downedBossAny) - damage = (int)(damage * 0.8); + if (CalamityWorld.ironHeart) + { + int damageMin = 60 + (player.statLifeMax2 / 10); + playSound = false; + hurtSoundTimer = 20; + if (damage <= damageMin) + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/IronHeartHurt"), (int)player.position.X, (int)player.position.Y); + else + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/IronHeartBigHurt"), (int)player.position.X, (int)player.position.Y); + } - if (CalamityConfig.Instance.Rippers) - { - if (adrenaline == adrenalineMax && !adrenalineModeActive) - damage = (int)(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) - { - damage = (int)(damage * 0.9); - } - #endregion + if (purpleCandle) + damage = (int)(damage - (player.statDefense * 0.05)); - if ((godSlayerDamage && damage <= 80) || damage < 1) - { + if ((godSlayerDamage && damage <= 80) || damage < 1) damage = 1; - } #region HealingEffects if (revivify) @@ -7115,76 +7478,48 @@ namespace CalamityMod.CalPlayer { Main.PlaySound(SoundID.NPCKilled, (int)player.position.X, (int)player.position.Y, 14); player.AddBuff(ModContent.BuffType(), 10830); - for (int num621 = 0; num621 < 20; num621++) + for (int d = 0; d < 20; d++) { - int num622 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 31, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int dust = Dust.NewDust(player.position, player.width, player.height, 31, 0f, 0f, 100, default, 2f); + Main.dust[dust].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; + Main.dust[dust].scale = 0.5f; + Main.dust[dust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 35; num623++) + for (int d = 0; d < 35; d++) { - int num624 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 6, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 6, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - for (int num625 = 0; num625 < 3; num625++) - { - float scaleFactor10 = 0.33f; - if (num625 == 1) - { - scaleFactor10 = 0.66f; - } - if (num625 == 2) - { - scaleFactor10 = 1f; - } - int num626 = Gore.NewGore(new Vector2(player.position.X + (float)(player.width / 2) - 24f, player.position.Y + (float)(player.height / 2) - 24f), default, 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(player.position.X + (float)(player.width / 2) - 24f, player.position.Y + (float)(player.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(player.position.X + (float)(player.width / 2) - 24f, player.position.Y + (float)(player.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(player.position.X + (float)(player.width / 2) - 24f, player.position.Y + (float)(player.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X -= 1f; - gore.velocity.Y -= 1f; + int fire = Dust.NewDust(player.position, player.width, player.height, DustID.Fire, 0f, 0f, 100, default, 3f); + Main.dust[fire].noGravity = true; + Main.dust[fire].velocity *= 5f; + fire = Dust.NewDust(player.position, player.width, player.height, DustID.Fire, 0f, 0f, 100, default, 2f); + Main.dust[fire].velocity *= 2f; } + CalamityUtils.ExplosionGores(player.Center, 3); } } if (sirenIce) { - Main.PlaySound(SoundID.NPCKilled, (int)player.position.X, (int)player.position.Y, 7); + Main.PlaySound(SoundID.NPCKilled, (int)player.Center.X, (int)player.Center.Y, 7); player.AddBuff(ModContent.BuffType(), 1800); - for (int num621 = 0; num621 < 10; num621++) + for (int d = 0; d < 10; d++) { - int num622 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 67, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int ice = Dust.NewDust(player.position, player.width, player.height, 67, 0f, 0f, 100, default, 2f); + Main.dust[ice].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; + Main.dust[ice].scale = 0.5f; + Main.dust[ice].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 15; num623++) + for (int d = 0; d < 15; d++) { - int num624 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 67, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 67, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int ice = Dust.NewDust(player.position, player.width, player.height, 67, 0f, 0f, 100, default, 3f); + Main.dust[ice].noGravity = true; + Main.dust[ice].velocity *= 5f; + ice = Dust.NewDust(player.position, player.width, player.height, 67, 0f, 0f, 100, default, 2f); + Main.dust[ice].velocity *= 2f; } } if (tarraMelee) @@ -7203,31 +7538,31 @@ namespace CalamityMod.CalPlayer { player.AddBuff(ModContent.BuffType(), 180); } - if (fBarrier || ((sirenBoobs || sirenBoobsAlt) && NPC.downedBoss3)) + if (fBarrier || (sirenBoobs && NPC.downedBoss3)) { Main.PlaySound(SoundID.Item, (int)player.position.X, (int)player.position.Y, 27); for (int m = 0; m < Main.maxNPCs; m++) { if (Main.npc[m].active && !Main.npc[m].friendly) { - float distance = (Main.npc[m].Center - player.Center).Length(); - float num10 = (float)Main.rand.Next(200 + (int)damage / 2, 301 + (int)damage * 2); - if (num10 > 500f) + float npcDist = (Main.npc[m].Center - player.Center).Length(); + float freezeDist = (float)Main.rand.Next(200 + (int)damage / 2, 301 + (int)damage * 2); + if (freezeDist > 500f) { - num10 = 500f + (num10 - 500f) * 0.75f; + freezeDist = 500f + (freezeDist - 500f) * 0.75f; } - if (num10 > 700f) + if (freezeDist > 700f) { - num10 = 700f + (num10 - 700f) * 0.5f; + freezeDist = 700f + (freezeDist - 700f) * 0.5f; } - if (num10 > 900f) + if (freezeDist > 900f) { - num10 = 900f + (num10 - 900f) * 0.25f; + freezeDist = 900f + (freezeDist - 900f) * 0.25f; } - if (distance < num10) + if (npcDist < freezeDist) { - float num11 = (float)Main.rand.Next(90 + (int)damage / 3, 240 + (int)damage / 2); - Main.npc[m].AddBuff(ModContent.BuffType(), (int)num11, false); + float duration = (float)Main.rand.Next(90 + (int)damage / 3, 240 + (int)damage / 2); + Main.npc[m].AddBuff(ModContent.BuffType(), (int)duration, false); } } } @@ -7350,18 +7685,7 @@ namespace CalamityMod.CalPlayer { for (int n = 0; n < 4; n++) { - float x = player.position.X + (float)Main.rand.Next(-400, 400); - float y = player.position.Y - (float)Main.rand.Next(500, 800); - Vector2 vector = new Vector2(x, y); - float num13 = player.position.X + (float)(player.width / 2) - vector.X; - float num14 = player.position.Y + (float)(player.height / 2) - vector.Y; - num13 += (float)Main.rand.Next(-100, 101); - int num15 = 20; - float num16 = (float)Math.Sqrt((double)(num13 * num13 + num14 * num14)); - num16 = (float)num15 / num16; - num13 *= num16; - num14 *= num16; - int num17 = Projectile.NewProjectile(x, y, num13, num14, ModContent.ProjectileType(), (int)(20 * player.AverageDamage()), 1f, player.whoAmI, 0f, 0f); + CalamityUtils.ProjectileRain(player.Center, 400f, 100f, 500f, 800f, 20f, ModContent.ProjectileType(), (int)(20 * player.AverageDamage()), 1f, player.whoAmI); } } } @@ -7375,39 +7699,14 @@ namespace CalamityMod.CalPlayer int starAmt = aBulwarkRare ? 12 : 5; for (int n = 0; n < starAmt; n++) { - float x = player.position.X + (float)Main.rand.Next(-400, 400); - float y = player.position.Y - (float)Main.rand.Next(500, 800); - Vector2 vector = new Vector2(x, y); - float num13 = player.position.X + (float)(player.width / 2) - vector.X; - float num14 = player.position.Y + (float)(player.height / 2) - vector.Y; - num13 += (float)Main.rand.Next(-100, 101); - int num15 = 29; - float num16 = (float)Math.Sqrt((double)(num13 * num13 + num14 * num14)); - num16 = (float)num15 / num16; - num13 *= num16; - num14 *= num16; - int num17 = Projectile.NewProjectile(x, y, num13, num14, ModContent.ProjectileType(), (int)(320 * player.AverageDamage()), 5f, player.whoAmI, 0f, 0f); + CalamityUtils.ProjectileRain(player.Center, 400f, 100f, 500f, 800f, 29f, ModContent.ProjectileType(), (int)(320 * player.AverageDamage()), 5f, player.whoAmI); } } if (dAmulet) { for (int n = 0; n < 3; n++) { - float x = player.position.X + (float)Main.rand.Next(-400, 400); - float y = player.position.Y - (float)Main.rand.Next(500, 800); - Vector2 vector = new Vector2(x, y); - float num13 = player.position.X + (float)(player.width / 2) - vector.X; - float num14 = player.position.Y + (float)(player.height / 2) - vector.Y; - num13 += (float)Main.rand.Next(-100, 101); - int num15 = 29; - float num16 = (float)Math.Sqrt((double)(num13 * num13 + num14 * num14)); - num16 = (float)num15 / num16; - num13 *= num16; - num14 *= num16; - int star = Projectile.NewProjectile(x, y, num13, num14, ProjectileID.HallowStar, (int)(130 * player.AverageDamage()), 4f, player.whoAmI, 0f, 0f); - Main.projectile[star].usesLocalNPCImmunity = true; - Main.projectile[star].localNPCHitCooldown = 5; - Main.projectile[star].Calamity().forceTypeless = true; + CalamityUtils.ProjectileRain(player.Center, 400f, 100f, 500f, 800f, 29f, ProjectileID.HallowStar, (int)(130 * player.AverageDamage()), 4f, player.whoAmI, 6, 1, 5); } /*int num = 1; @@ -7428,21 +7727,7 @@ namespace CalamityMod.CalPlayer { for (int n = 0; n < 3; n++) { - float x = player.position.X + (float)Main.rand.Next(-400, 400); - float y = player.position.Y - (float)Main.rand.Next(500, 800); - Vector2 vector = new Vector2(x, y); - float num13 = player.position.X + (float)(player.width / 2) - vector.X; - float num14 = player.position.Y + (float)(player.height / 2) - vector.Y; - num13 += (float)Main.rand.Next(-100, 101); - int num15 = 29; - float num16 = (float)Math.Sqrt((double)(num13 * num13 + num14 * num14)); - num16 = (float)num15 / num16; - num13 *= num16; - num14 *= num16; - int star = Projectile.NewProjectile(x, y, num13, num14, ProjectileID.HallowStar, (int)(150 * player.AverageDamage()), 4f, player.whoAmI, 0f, 0f); - Main.projectile[star].usesLocalNPCImmunity = true; - Main.projectile[star].localNPCHitCooldown = 5; - Main.projectile[star].Calamity().forceTypeless = true; + CalamityUtils.ProjectileRain(player.Center, 400f, 100f, 500f, 800f, 29f, ProjectileID.HallowStar, (int)(150 * player.AverageDamage()), 4f, player.whoAmI, 6, 1, 5); } int num = 1; if (Main.rand.NextBool(3)) @@ -7468,17 +7753,16 @@ namespace CalamityMod.CalPlayer double startAngle = Math.Atan2(player.velocity.X, player.velocity.Y) - spread / 2; double deltaAngle = spread / 8f; double offsetAngle; - int i; int fDamage = (int)(56 * player.AverageDamage()); if (player.whoAmI == Main.myPlayer) { - for (i = 0; i < 4; i++) + for (int i = 0; i < 4; i++) { float xPos = Main.rand.NextBool(2) ? player.Center.X + 100 : player.Center.X - 100; - Vector2 vector2 = new Vector2(xPos, player.Center.Y + Main.rand.Next(-100, 101)); + Vector2 spawnPos = new Vector2(xPos, player.Center.Y + Main.rand.Next(-100, 101)); offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - int spore1 = Projectile.NewProjectile(vector2.X, vector2.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), 590, fDamage, 1.25f, player.whoAmI, 0f, 0f); - int spore2 = Projectile.NewProjectile(vector2.X, vector2.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), 590, fDamage, 1.25f, player.whoAmI, 0f, 0f); + int spore1 = Projectile.NewProjectile(spawnPos.X, spawnPos.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ProjectileID.TruffleSpore, fDamage, 1.25f, player.whoAmI, 0f, 0f); + int spore2 = Projectile.NewProjectile(spawnPos.X, spawnPos.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ProjectileID.TruffleSpore, fDamage, 1.25f, player.whoAmI, 0f, 0f); Main.projectile[spore1].timeLeft = 120; Main.projectile[spore2].timeLeft = 120; } @@ -7494,13 +7778,12 @@ namespace CalamityMod.CalPlayer double startAngle = Math.Atan2(player.velocity.X, player.velocity.Y) - spread / 2; double deltaAngle = spread / 8f; double offsetAngle; - int i; int sDamage = hardMode ? 36 : 6; if (aSparkRare) sDamage += hardMode ? 12 : 2; if (player.whoAmI == Main.myPlayer) { - for (i = 0; i < 4; i++) + for (int i = 0; i < 4; i++) { offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; int spark1 = Projectile.NewProjectile(player.Center.X, player.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(sDamage * player.AverageDamage()), 1.25f, player.whoAmI, 0f, 0f); @@ -7522,7 +7805,7 @@ namespace CalamityMod.CalPlayer for (int i = 0; i < 5; i++) { Main.PlaySound(SoundID.Item, (int)Main.player[Main.myPlayer].position.X, (int)Main.player[Main.myPlayer].position.Y, 61); - int inkBomb = Projectile.NewProjectile(player.Center.X, player.Center.Y, Main.rand.NextFloat(-3f, 3f), Main.rand.NextFloat(-0f, -4f), ModContent.ProjectileType(), 0, 0, player.whoAmI); + Projectile.NewProjectile(player.Center.X, player.Center.Y, Main.rand.NextFloat(-3f, 3f), Main.rand.NextFloat(-0f, -4f), ModContent.ProjectileType(), 0, 0, player.whoAmI); } } } @@ -7550,7 +7833,7 @@ namespace CalamityMod.CalPlayer int eDamage = (int)(100 * player.AverageDamage()); if (player.whoAmI == Main.myPlayer) { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, ModContent.ProjectileType(), eDamage, 1f, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), eDamage, 1f, player.whoAmI, 0f, 0f); } } } @@ -7563,17 +7846,16 @@ namespace CalamityMod.CalPlayer double startAngle = Math.Atan2(player.velocity.X, player.velocity.Y) - spread / 2; double deltaAngle = spread / 8f; double offsetAngle; - int i; int sDamage = (int)(27 * player.RangedDamage()); //daedalus ranged helm if (player.whoAmI == Main.myPlayer) { - for (i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { float randomSpeed = (float)Main.rand.Next(1, 7); float randomSpeed2 = (float)Main.rand.Next(1, 7); offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - int shard = Projectile.NewProjectile(player.Center.X, player.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f) + randomSpeed, 90, sDamage, 1f, player.whoAmI, 0f, 0f); - int shard2 = Projectile.NewProjectile(player.Center.X, player.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f) + randomSpeed2, 90, sDamage, 1f, player.whoAmI, 0f, 0f); + int shard = Projectile.NewProjectile(player.Center.X, player.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f) + randomSpeed, ProjectileID.CrystalShard, sDamage, 1f, player.whoAmI, 0f, 0f); + int shard2 = Projectile.NewProjectile(player.Center.X, player.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f) + randomSpeed2, ProjectileID.CrystalShard, sDamage, 1f, player.whoAmI, 0f, 0f); Main.projectile[shard].Calamity().forceTypeless = true; Main.projectile[shard2].Calamity().forceTypeless = true; } @@ -7589,19 +7871,18 @@ namespace CalamityMod.CalPlayer double startAngle = Math.Atan2(player.velocity.X, player.velocity.Y) - spread / 2; double deltaAngle = spread / 8f; double offsetAngle; - int i; int rDamage = (int)(58 * player.RogueDamage()); //Reaver rogue helm if (player.whoAmI == Main.myPlayer) { - for (i = 0; i < 4; i++) + for (int i = 0; i < 4; i++) { float xPos = Main.rand.NextBool(2) ? player.Center.X + 100 : player.Center.X - 100; - Vector2 vector2 = new Vector2(xPos, player.Center.Y + Main.rand.Next(-100, 101)); + Vector2 spawnPos = new Vector2(xPos, player.Center.Y + Main.rand.Next(-100, 101)); offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - int rspore1 = Projectile.NewProjectile(vector2.X, vector2.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), 567, rDamage, 2f, player.whoAmI, 0f, 0f); + int rspore1 = Projectile.NewProjectile(spawnPos.X, spawnPos.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), rDamage, 2f, player.whoAmI, 0f, 0f); Main.projectile[rspore1].usesLocalNPCImmunity = true; Main.projectile[rspore1].localNPCHitCooldown = 60; - int rspore2 = Projectile.NewProjectile(vector2.X, vector2.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), 568, rDamage, 2f, player.whoAmI, 0f, 0f); + int rspore2 = Projectile.NewProjectile(spawnPos.X, spawnPos.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), rDamage, 2f, player.whoAmI, 1f, 0f); Main.projectile[rspore2].usesLocalNPCImmunity = true; Main.projectile[rspore2].localNPCHitCooldown = 60; } @@ -7617,10 +7898,9 @@ namespace CalamityMod.CalPlayer double startAngle = Math.Atan2(player.velocity.X, player.velocity.Y) - spread / 2; double deltaAngle = spread / 8f; double offsetAngle; - int i; if (player.whoAmI == Main.myPlayer) { - for (i = 0; i < 4; i++) + for (int i = 0; i < 4; i++) { offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; Projectile.NewProjectile(player.Center.X, player.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(900 * player.MeleeDamage()), 5f, player.whoAmI, 0f, 0f); @@ -7636,7 +7916,7 @@ namespace CalamityMod.CalPlayer Main.PlaySound(SoundID.Item, (int)player.position.X, (int)player.position.Y, 74); if (player.whoAmI == Main.myPlayer) { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)((auricSet ? 2400 : 1200) * player.MagicDamage()), 1f, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), (int)((auricSet ? 2400 : 1200) * player.MagicDamage()), 1f, player.whoAmI, 0f, 0f); } } } @@ -7646,41 +7926,11 @@ namespace CalamityMod.CalPlayer { for (int l = 0; l < 2; l++) { - float x = player.position.X + (float)Main.rand.Next(-400, 400); - float y = player.position.Y - (float)Main.rand.Next(500, 800); - Vector2 vector = new Vector2(x, y); - float num15 = player.position.X + (float)(player.width / 2) - vector.X; - float num16 = player.position.Y + (float)(player.height / 2) - vector.Y; - num15 += (float)Main.rand.Next(-100, 101); - int num17 = 22; - float num18 = (float)Math.Sqrt((double)(num15 * num15 + num16 * num16)); - num18 = (float)num17 / num18; - num15 *= num18; - num16 *= num18; - int num19 = Projectile.NewProjectile(x, y, num15, num16, ProjectileID.ShadowBeamFriendly, (int)(3000 * player.AverageDamage()), 7f, player.whoAmI, 0f, 0f); - Main.projectile[num19].ai[1] = player.position.Y; - Main.projectile[num19].usesLocalNPCImmunity = true; - Main.projectile[num19].localNPCHitCooldown = 10; - Main.projectile[num19].Calamity().forceTypeless = true; + CalamityUtils.ProjectileRain(player.Center, 400f, 100f, 500f, 800f, 22f, ProjectileID.ShadowBeamFriendly, (int)(3000 * player.AverageDamage()), 7f, player.whoAmI, 6, 1); } for (int l = 0; l < 5; l++) { - float x = player.position.X + (float)Main.rand.Next(-400, 400); - float y = player.position.Y - (float)Main.rand.Next(500, 800); - Vector2 vector = new Vector2(x, y); - float num15 = player.position.X + (float)(player.width / 2) - vector.X; - float num16 = player.position.Y + (float)(player.height / 2) - vector.Y; - num15 += (float)Main.rand.Next(-100, 101); - int num17 = 22; - float num18 = (float)Math.Sqrt((double)(num15 * num15 + num16 * num16)); - num18 = (float)num17 / num18; - num15 *= num18; - num16 *= num18; - int num19 = Projectile.NewProjectile(x, y, num15, num16, ProjectileID.DemonScythe, (int)(5000 * player.AverageDamage()), 7f, player.whoAmI, 0f, 0f); - Main.projectile[num19].ai[1] = player.position.Y; - Main.projectile[num19].usesLocalNPCImmunity = true; - Main.projectile[num19].localNPCHitCooldown = 10; - Main.projectile[num19].Calamity().forceTypeless = true; + CalamityUtils.ProjectileRain(player.Center, 400f, 100f, 500f, 800f, 22f, ProjectileID.DemonScythe, (int)(5000 * player.AverageDamage()), 7f, player.whoAmI, 6, 1); } } } @@ -7716,7 +7966,7 @@ namespace CalamityMod.CalPlayer player.lastDeathPostion = player.Center; player.lastDeathTime = DateTime.Now; player.showLastDeath = true; - bool specialDeath = CalamityWorld.ironHeart && areThereAnyDamnBosses; + bool specialDeath = CalamityWorld.ironHeart; int coinsOwned = (int)Utils.CoinsCount(out bool flag, player.inventory, new int[0]); if (Main.myPlayer == player.whoAmI) { @@ -7730,13 +7980,7 @@ namespace CalamityMod.CalPlayer if (Main.myPlayer == player.whoAmI) { player.trashItem.SetDefaults(0, false); - if (specialDeath) - { - player.difficulty = 2; - player.DropItems(); - player.KillMeForGood(); - } - else if (player.difficulty == 0) + if (player.difficulty == 0) { for (int i = 0; i < 59; i++) { @@ -7878,11 +8122,11 @@ namespace CalamityMod.CalPlayer Rectangle rectangle = new Rectangle((int)((double)player.position.X + (double)player.velocity.X * 0.5 - 4.0), (int)((double)player.position.Y + (double)player.velocity.Y * 0.5 - 4.0), player.width + 8, player.height + 8); for (int i = 0; i < Main.maxNPCs; i++) { - if (Main.npc[i].active && !Main.npc[i].dontTakeDamage && !Main.npc[i].friendly && Main.npc[i].immune[player.whoAmI] <= 0) + NPC npc = Main.npc[i]; + if (npc.active && !npc.dontTakeDamage && !npc.friendly && npc.immune[player.whoAmI] <= 0) { - NPC nPC = Main.npc[i]; - Rectangle rect = nPC.getRect(); - if (rectangle.Intersects(rect) && (nPC.noTileCollide || player.CanHit(nPC))) + Rectangle rect = npc.getRect(); + if (rectangle.Intersects(rect) && (npc.noTileCollide || player.CanHit(npc))) { float num = 50f * player.AverageDamage(); float num2 = 3f; @@ -7910,11 +8154,11 @@ namespace CalamityMod.CalPlayer } if (player.whoAmI == Main.myPlayer) { - player.ApplyDamageToNPC(nPC, (int)num, num2, direction, crit); + player.ApplyDamageToNPC(npc, (int)num, num2, direction, crit); } - if (nPC.immune[player.whoAmI] < 6) - nPC.immune[player.whoAmI] = 6; - nPC.AddBuff(ModContent.BuffType(), 300); + if (npc.immune[player.whoAmI] < 6) + npc.immune[player.whoAmI] = 6; + npc.AddBuff(ModContent.BuffType(), 300); player.immune = true; player.immuneNoBlink = true; if (player.immuneTime < 4) @@ -7932,11 +8176,11 @@ namespace CalamityMod.CalPlayer Rectangle rectangle = new Rectangle((int)((double)player.position.X + (double)player.velocity.X * 0.5 - 4.0), (int)((double)player.position.Y + (double)player.velocity.Y * 0.5 - 4.0), player.width + 8, player.height + 8); for (int i = 0; i < Main.maxNPCs; i++) { - if (Main.npc[i].active && !Main.npc[i].dontTakeDamage && !Main.npc[i].friendly && Main.npc[i].immune[player.whoAmI] <= 0) + NPC npc = Main.npc[i]; + if (npc.active && !npc.dontTakeDamage && !npc.friendly && npc.immune[player.whoAmI] <= 0) { - NPC nPC = Main.npc[i]; - Rectangle rect = nPC.getRect(); - if (rectangle.Intersects(rect) && (nPC.noTileCollide || player.CanHit(nPC))) + Rectangle rect = npc.getRect(); + if (rectangle.Intersects(rect) && (npc.noTileCollide || player.CanHit(npc))) { float num = 1500f * player.AverageDamage(); float num2 = 15f; @@ -7964,13 +8208,13 @@ namespace CalamityMod.CalPlayer } if (player.whoAmI == Main.myPlayer) { - player.ApplyDamageToNPC(nPC, (int)num, num2, direction, crit); + player.ApplyDamageToNPC(npc, (int)num, num2, direction, crit); Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(1000 * player.AverageDamage()), 20f, Main.myPlayer, 0f, 0f); Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(780 * player.AverageDamage()), 5f, Main.myPlayer, 0f, 0f); } - if (nPC.immune[player.whoAmI] < 6) - nPC.immune[player.whoAmI] = 6; - nPC.AddBuff(ModContent.BuffType(), 300); + if (npc.immune[player.whoAmI] < 6) + npc.immune[player.whoAmI] = 6; + npc.AddBuff(ModContent.BuffType(), 300); player.immune = true; player.immuneNoBlink = true; if (player.immuneTime < 4) @@ -7988,11 +8232,11 @@ namespace CalamityMod.CalPlayer Rectangle rectangle = new Rectangle((int)((double)player.position.X + (double)player.velocity.X * 0.5 - 4.0), (int)((double)player.position.Y + (double)player.velocity.Y * 0.5 - 4.0), player.width + 8, player.height + 8); for (int i = 0; i < Main.maxNPCs; i++) { - if (Main.npc[i].active && !Main.npc[i].dontTakeDamage && !Main.npc[i].friendly && Main.npc[i].immune[player.whoAmI] <= 0) + NPC npc = Main.npc[i]; + if (npc.active && !npc.dontTakeDamage && !npc.friendly && npc.immune[player.whoAmI] <= 0) { - NPC nPC = Main.npc[i]; - Rectangle rect = nPC.getRect(); - if (rectangle.Intersects(rect) && (nPC.noTileCollide || player.CanHit(nPC))) + Rectangle rect = npc.getRect(); + if (rectangle.Intersects(rect) && (npc.noTileCollide || player.CanHit(npc))) { float num = 500f * player.AverageDamage(); float num2 = 12f; @@ -8020,12 +8264,12 @@ namespace CalamityMod.CalPlayer } if (player.whoAmI == Main.myPlayer) { - player.ApplyDamageToNPC(nPC, (int)num, num2, direction, crit); + player.ApplyDamageToNPC(npc, (int)num, num2, direction, crit); Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(500 * player.AverageDamage()), 15f, Main.myPlayer, 0f, 0f); Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(380 * player.AverageDamage()), 5f, Main.myPlayer, 0f, 0f); } - if (nPC.immune[player.whoAmI] < 6) - nPC.immune[player.whoAmI] = 6; + if (npc.immune[player.whoAmI] < 6) + npc.immune[player.whoAmI] = 6; player.immune = true; player.immuneNoBlink = true; if (player.immuneTime < 4) @@ -8043,11 +8287,11 @@ namespace CalamityMod.CalPlayer Rectangle rectangle = new Rectangle((int)((double)player.position.X + (double)player.velocity.X * 0.5 - 4.0), (int)((double)player.position.Y + (double)player.velocity.Y * 0.5 - 4.0), player.width + 8, player.height + 8); for (int i = 0; i < Main.maxNPCs; i++) { - if (Main.npc[i].active && !Main.npc[i].dontTakeDamage && !Main.npc[i].friendly && Main.npc[i].immune[player.whoAmI] <= 0) + NPC npc = Main.npc[i]; + if (npc.active && !npc.dontTakeDamage && !npc.friendly && npc.immune[player.whoAmI] <= 0) { - NPC nPC = Main.npc[i]; - Rectangle rect = nPC.getRect(); - if (rectangle.Intersects(rect) && (nPC.noTileCollide || player.CanHit(nPC))) + Rectangle rect = npc.getRect(); + if (rectangle.Intersects(rect) && (npc.noTileCollide || player.CanHit(npc))) { float num = 100f * player.AverageDamage(); float num2 = 9f; @@ -8075,11 +8319,11 @@ namespace CalamityMod.CalPlayer } if (player.whoAmI == Main.myPlayer) { - player.ApplyDamageToNPC(nPC, (int)num, num2, direction, crit); + player.ApplyDamageToNPC(npc, (int)num, num2, direction, crit); Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(100 * player.AverageDamage()), 15f, Main.myPlayer, 0f, 0f); } - if (nPC.immune[player.whoAmI] < 6) - nPC.immune[player.whoAmI] = 6; + if (npc.immune[player.whoAmI] < 6) + npc.immune[player.whoAmI] = 6; player.immune = true; player.immuneNoBlink = true; if (player.immuneTime < 4) @@ -8097,11 +8341,11 @@ namespace CalamityMod.CalPlayer Rectangle rectangle = new Rectangle((int)(player.position.X + player.velocity.X * 0.5f - 4f), (int)(player.position.Y + player.velocity.Y * 0.5f - 4f), player.width + 8, player.height + 8); for (int i = 0; i < Main.maxNPCs; i++) { - if (Main.npc[i].active && !Main.npc[i].dontTakeDamage && !Main.npc[i].friendly && Main.npc[i].immune[player.whoAmI] <= 0) + NPC npc = Main.npc[i]; + if (npc.active && !npc.dontTakeDamage && !npc.friendly && npc.immune[player.whoAmI] <= 0) { - NPC nPC = Main.npc[i]; - Rectangle rect = nPC.getRect(); - if (rectangle.Intersects(rect) && (nPC.noTileCollide || player.CanHit(nPC))) + Rectangle rect = npc.getRect(); + if (rectangle.Intersects(rect) && (npc.noTileCollide || player.CanHit(npc))) { float num = 50f * player.MinionDamage(); float num2 = 3f; @@ -8117,11 +8361,11 @@ namespace CalamityMod.CalPlayer } if (player.whoAmI == Main.myPlayer) { - player.ApplyDamageToNPC(nPC, (int)num, num2, direction, crit); + player.ApplyDamageToNPC(npc, (int)num, num2, direction, crit); } - if (nPC.immune[player.whoAmI] < 6) - nPC.immune[player.whoAmI] = 6; - nPC.AddBuff(ModContent.BuffType(), 300); + if (npc.immune[player.whoAmI] < 6) + npc.immune[player.whoAmI] = 6; + npc.AddBuff(ModContent.BuffType(), 300); player.immune = true; player.immuneNoBlink = true; if (player.immuneTime < 4) @@ -8139,11 +8383,11 @@ namespace CalamityMod.CalPlayer Rectangle rectangle = new Rectangle((int)((double)player.position.X + (double)player.velocity.X * 0.5 - 4.0), (int)((double)player.position.Y + (double)player.velocity.Y * 0.5 - 4.0), player.width + 8, player.height + 8); for (int i = 0; i < Main.maxNPCs; i++) { - if (Main.npc[i].active && !Main.npc[i].dontTakeDamage && !Main.npc[i].friendly && !Main.npc[i].townNPC && Main.npc[i].immune[player.whoAmI] <= 0 && Main.npc[i].damage > 0) + NPC npc = Main.npc[i]; + if (npc.active && !npc.dontTakeDamage && !npc.friendly && !npc.townNPC && npc.immune[player.whoAmI] <= 0 && npc.damage > 0) { - NPC nPC = Main.npc[i]; - Rectangle rect = nPC.getRect(); - if (rectangle.Intersects(rect) && (nPC.noTileCollide || player.CanHit(nPC))) + Rectangle rect = npc.getRect(); + if (rectangle.Intersects(rect) && (npc.noTileCollide || player.CanHit(npc))) { OnDodge(); break; @@ -8152,9 +8396,9 @@ namespace CalamityMod.CalPlayer } for (int i = 0; i < Main.maxProjectiles; i++) { - if (Main.projectile[i].active && !Main.projectile[i].friendly && Main.projectile[i].hostile && Main.projectile[i].damage > 0) + Projectile proj = Main.projectile[i]; + if (proj.active && !proj.friendly && proj.hostile && proj.damage > 0) { - Projectile proj = Main.projectile[i]; Rectangle rect = proj.getRect(); if (rectangle.Intersects(rect)) { @@ -9117,7 +9361,6 @@ namespace CalamityMod.CalPlayer #endregion #region Drawing - public static readonly PlayerLayer MiscEffectsBack = new PlayerLayer("CalamityMod", "MiscEffectsBack", PlayerLayer.MiscEffectsBack, delegate (PlayerDrawInfo drawInfo) { if (drawInfo.shadow != 0f) @@ -9148,10 +9391,40 @@ namespace CalamityMod.CalPlayer { if (drawInfo.shadow != 0f) return; - Player drawPlayer = drawInfo.drawPlayer; Item item = drawPlayer.ActiveItem(); + // Kamei trail/afterimage effect. + if (drawPlayer.Calamity().kamiBoost) + { + for (int i = drawPlayer.Calamity().KameiOldPositions.Length - 1; i > 0; i--) + { + if (drawPlayer.Calamity().KameiOldPositions[i - 1] == Vector2.Zero) + drawPlayer.Calamity().KameiOldPositions[i - 1] = drawPlayer.position; + drawPlayer.Calamity().KameiOldPositions[i] = drawPlayer.Calamity().KameiOldPositions[i - 1]; + } + drawPlayer.Calamity().KameiOldPositions[0] = drawPlayer.position; + + List existingDrawData = Main.playerDrawData; + for (int i = 0; i < drawPlayer.Calamity().KameiOldPositions.Length; i++) + { + float scale = MathHelper.Lerp(1f, 0.5f, i / (float)drawPlayer.Calamity().KameiOldPositions.Length); + float opacity = MathHelper.Lerp(0.25f, 0.08f, i / (float)drawPlayer.Calamity().KameiOldPositions.Length); + List afterimage = new List(); + for (int j = 0; j < existingDrawData.Count; j++) + { + var drawData = existingDrawData[j]; + drawData.position = existingDrawData[j].position - drawPlayer.position + drawPlayer.oldPosition; + drawData.color = Color.Cyan * opacity; + drawData.color.G = (byte)(drawData.color.G * 1.6); + drawData.color.B = (byte)(drawData.color.B * 1.2); + drawData.scale = new Vector2(scale); + afterimage.Add(drawData); + } + Main.playerDrawData.InsertRange(0, afterimage); + } + } + if (!drawPlayer.frozen && item.type > ItemID.None && !drawPlayer.dead && @@ -9311,6 +9584,24 @@ namespace CalamityMod.CalPlayer } } }); + + public static readonly PlayerLayer DyeInvisibilityFix = new PlayerLayer("CalamityMod", "DyeInvisibilityFix", PlayerLayer.Arms, (PlayerDrawInfo drawInfo) => + { + Player drawPlayer = drawInfo.drawPlayer; + CalamityPlayer modPlayer = drawPlayer.Calamity(); + if (!drawPlayer.invis || + drawPlayer.itemAnimation > 0) + { + return; + } + for (int i = 0; i < Main.playerDrawData.Count; i++) + { + var copy = Main.playerDrawData[i]; + copy.shader = 0; // There's no other easy solution here to my knowledge since DrawData is a value type. + Main.playerDrawData[i] = copy; + } + }); + public override void ModifyDrawInfo(ref PlayerDrawInfo drawInfo) { if (drawInfo.shadow != 0f) @@ -9399,8 +9690,53 @@ namespace CalamityMod.CalPlayer } } } + public static readonly List MoonlightDyeDayColors = new List() + { + new Color(255, 163, 56), + new Color(235, 30, 19), + new Color(242, 48, 187), + }; + public static readonly List MoonlightDyeNightColors = new List() + { + new Color(24, 134, 198), + new Color(130, 40, 150), + new Color(40, 64, 150), + }; - public override void PreUpdate() + public static void DetermineMoonlightDyeColors(out Color drawColor, Color dayColor, Color nightColor) + { + int totalTime = Main.dayTime ? 54000 : 32400; + float transitionTime = 5400; + //Color dayColor = new Color(255, 163, 56); + //Color nightColor = new Color(24, 134, 198); + float interval = Utils.InverseLerp(0f, transitionTime, (float)Main.time, true) + Utils.InverseLerp(totalTime - transitionTime, totalTime, (float)Main.time, true); + if (Main.dayTime) + { + // Dusk. + if (Main.time >= totalTime - transitionTime) + drawColor = Color.Lerp(dayColor, nightColor, Utils.InverseLerp(totalTime - transitionTime, totalTime, (float)Main.time, true)); + // Dawn. + else if (Main.time <= transitionTime) + drawColor = Color.Lerp(nightColor, dayColor, interval); + else + drawColor = dayColor; + } + else + { + drawColor = nightColor; + } + } + public static Color GetCurrentMoonlightDyeColor(float angleOffset = 0f) + { + float interval = (float)Math.Cos(Main.GlobalTime * 0.6f + angleOffset) * 0.5f + 0.5f; + interval = MathHelper.Clamp(interval, 0f, 0.995f); + Color dayColorToUse = CalamityUtils.MulticolorLerp(interval, MoonlightDyeDayColors.ToArray()); + Color nightColorToUse = CalamityUtils.MulticolorLerp(interval, MoonlightDyeNightColors.ToArray()); + DetermineMoonlightDyeColors(out Color drawColor, dayColorToUse, nightColorToUse); + return drawColor; + } + + public override void PreUpdate() { tailFrameUp++; if (tailFrameUp == 8) @@ -9411,8 +9747,25 @@ namespace CalamityMod.CalPlayer tailFrame = 0; } tailFrameUp = 0; + } + + int frameAmt = 11; + if (roverFrameCounter >= 7) + { + roverFrameCounter = -1; + roverFrame = roverFrame == frameAmt - 1 ? 0 : roverFrame + 1; } - } + roverFrameCounter++; + + for (int i = 0; i < player.dye.Length; i++) + { + if (player.dye[i].type == ModContent.ItemType()) + { + GameShaders.Armor.GetSecondaryShader(player.dye[i].dye, player)?.UseColor(GetCurrentMoonlightDyeColor()); + } + } + Main.blockInput = PopupGUIManager.AnyGUIsActive; + } public static readonly PlayerLayer Tail = new PlayerLayer("CalamityMod", "Tail", PlayerLayer.BackAcc, delegate (PlayerDrawInfo drawInfo) { @@ -9516,6 +9869,28 @@ namespace CalamityMod.CalPlayer } }); + public static readonly PlayerLayer RoverDriveShield = new PlayerLayer("CalamityMod", "RoverDrive", PlayerLayer.Skin, (drawInfo) => + { + Player drawPlayer = drawInfo.drawPlayer; + CalamityPlayer modPlayer = drawPlayer.Calamity(); + if (modPlayer.roverDriveTimer < 616 && modPlayer.roverDrive) + { + Texture2D texture = ModContent.GetTexture("CalamityMod/ExtraTextures/RoverAccShield"); + int frameAmt = 11; + int height = texture.Height / frameAmt; + int frameHeight = height * modPlayer.roverFrame; + Vector2 drawPos = drawPlayer.Center - Main.screenPosition + new Vector2(0f, drawPlayer.gfxOffY); + Rectangle frame = new Rectangle(0, frameHeight, texture.Width, height); + Color color = Color.White * 0.625f; + Vector2 origin = new Vector2(texture.Width / 2f, height / 2f); + float scale = 1f + (float)Math.Cos(Main.GlobalTime) * 0.1f; + SpriteEffects spriteEffects = drawPlayer.direction != -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + + DrawData data = new DrawData(texture, drawPos, frame, color, 0f, origin, scale, spriteEffects, 0); + Main.playerDrawData.Add(data); + } + }); + public static readonly PlayerLayer StratusSphereDrawing = new PlayerLayer("CalamityMod", "StratusSphereDrawing", PlayerLayer.HeldProjFront, (drawInfo) => { Player drawPlayer = drawInfo.drawPlayer; @@ -9637,7 +10012,7 @@ namespace CalamityMod.CalPlayer Texture2D robotTexture = ModContent.GetTexture("CalamityMod/Projectiles/Summon/AndromedaSmall"); Rectangle frame = new Rectangle(0, robotEntityInstance.CurrentFrame * 54, robotTexture.Width, robotTexture.Height / 21); DrawData drawData = new DrawData(robotTexture, - drawPlayer.Center + new Vector2(0f, -8f) - Main.screenPosition, + drawPlayer.Center + new Vector2(drawPlayer.direction == 1 ? -24 : -10, -8f) - Main.screenPosition, frame, Color.White, 0f, @@ -9651,6 +10026,44 @@ namespace CalamityMod.CalPlayer } }); + public static readonly PlayerLayer ProfanedMoonlightDyeEffects = new PlayerLayer("CalamityMod", "ProfanedMoonlight", PlayerLayer.Body, (drawInfo) => + { + Player drawPlayer = drawInfo.drawPlayer; + int totalMoonlightDyes = drawPlayer.dye.Count(dyeItem => dyeItem.type == ModContent.ItemType()); + if (totalMoonlightDyes <= 0) + return; + float auroraCount = 12 + (int)MathHelper.Clamp(totalMoonlightDyes, 0f, 4f) * 2; + float opacity = MathHelper.Clamp(totalMoonlightDyes / 3f, 0f, 1f); + + if (Main.dayTime) + opacity *= 0.4f; + else + opacity *= 0.25f; + + float time01 = Main.GlobalTime % 3f / 3f; + Texture2D auroraTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/AuroraTexture"); + for (int i = 0; i < auroraCount; i++) + { + float incrementOffsetAngle = MathHelper.TwoPi * i / auroraCount; + float timeOffset = (float)Math.Sin(time01 * MathHelper.TwoPi + incrementOffsetAngle * 2f); + float rotation = (float)Math.Sin(incrementOffsetAngle) * MathHelper.Pi / 12f; + float yOffset = (float)Math.Sin(time01 * MathHelper.TwoPi + incrementOffsetAngle * 2f + MathHelper.ToRadians(60f)) * 6f; + Color color = GetCurrentMoonlightDyeColor(incrementOffsetAngle); + Vector2 offset = new Vector2(20f * timeOffset, yOffset - 14f); + DrawData drawData = new DrawData(auroraTexture, + drawPlayer.Top + offset - Main.screenPosition, + null, + color * opacity, + rotation + MathHelper.PiOver2, + auroraTexture.Size() * 0.5f, + 0.135f, + SpriteEffects.None, + 1); + + Main.playerDrawData.Add(drawData); + } + }); + public override void ModifyDrawLayers(List list) { MiscEffectsBack.visible = true; @@ -9678,8 +10091,11 @@ namespace CalamityMod.CalPlayer list.Insert(drawTheStupidSign, ForbiddenCircletSign); } list.Add(ColdDivinityOverlay); + list.Add(RoverDriveShield); list.Add(StratusSphereDrawing); + list.Add(ProfanedMoonlightDyeEffects); list.Add(IbanDevRobot); + list.Add(DyeInvisibilityFix); } public PlayerLayer clAfterAll = new PlayerLayer("Calamity", "clAfterAll", PlayerLayer.MiscEffectsFront, delegate (PlayerDrawInfo drawInfo) @@ -9710,8 +10126,8 @@ namespace CalamityMod.CalPlayer public override void DrawEffects(PlayerDrawInfo drawInfo, ref float r, ref float g, ref float b, ref float a, ref bool fullBright) { - // Dust modifications while high - if (trippy) + // Dust modifications while high + if (trippy) { if (Main.myPlayer == player.whoAmI) { @@ -9848,7 +10264,7 @@ namespace CalamityMod.CalPlayer } if (IBoots) { - if (((double)Math.Abs(player.velocity.X) > 0.05 || (double)Math.Abs(player.velocity.Y) > 0.05) && !player.mount.Active) + if (player.velocity.Length() > 0.05f && !player.mount.Active) { if (Main.rand.NextBool(2) && drawInfo.shadow == 0f) { @@ -9868,7 +10284,7 @@ namespace CalamityMod.CalPlayer } if (elysianFire) { - if (((double)Math.Abs(player.velocity.X) > 0.05 || (double)Math.Abs(player.velocity.Y) > 0.05) && !player.mount.Active) + if (player.velocity.Length() > 0.05f && !player.mount.Active) { if (Main.rand.NextBool(2) && drawInfo.shadow == 0f) { @@ -9888,7 +10304,7 @@ namespace CalamityMod.CalPlayer } if (dsSetBonus) { - if (((double)Math.Abs(player.velocity.X) > 0.05 || (double)Math.Abs(player.velocity.Y) > 0.05) && !player.mount.Active) + if (player.velocity.Length() > 0.05f && !player.mount.Active) { if (Main.rand.NextBool(2) && drawInfo.shadow == 0f) { @@ -9908,7 +10324,7 @@ namespace CalamityMod.CalPlayer } if (auricSet) { - if (((double)Math.Abs(player.velocity.X) > 0.05 || (double)Math.Abs(player.velocity.Y) > 0.05) && !player.mount.Active) + if (player.velocity.Length() > 0.05f && !player.mount.Active) { if (drawInfo.shadow == 0f) { @@ -10138,7 +10554,7 @@ namespace CalamityMod.CalPlayer fullBright = true; } } - if (draedonsHeart && !shadeRegen && !cFreeze && (double)Math.Abs(player.velocity.X) < 0.05 && (double)Math.Abs(player.velocity.Y) < 0.05 && player.itemAnimation == 0) + if (draedonsHeart && !shadeRegen && !cFreeze && player.StandingStill() && player.itemAnimation == 0) { if (noRogueStealth) { @@ -10227,6 +10643,7 @@ namespace CalamityMod.CalPlayer chatText = "Now is not the time!"; return false; } + return true; } @@ -10389,8 +10806,14 @@ namespace CalamityMod.CalPlayer private float UpdateStealthGenStats() { + int finalDawnProjCount = player.ownedProjectileCounts[ModContent.ProjectileType()] + + player.ownedProjectileCounts[ModContent.ProjectileType()] + + player.ownedProjectileCounts[ModContent.ProjectileType()] + + player.ownedProjectileCounts[ModContent.ProjectileType()] + + player.ownedProjectileCounts[ModContent.ProjectileType()]; + // If you are actively using an item, you cannot gain stealth. - if (player.itemAnimation > 0) + if (player.itemAnimation > 0 || finalDawnProjCount > 0) return 0f; // Penumbra Potion provides various boosts to rogue stealth generation @@ -10461,7 +10884,7 @@ namespace CalamityMod.CalPlayer // You get 100% stealth regen while standing still and not on a mount. Otherwise, you get your stealth regeneration while moving. // Stealth only regenerates at 1/3 speed while moving. - bool standstill = Math.Abs(player.velocity.X) < 0.1f && Math.Abs(player.velocity.Y) < 0.1f && !player.mount.Active; + bool standstill = player.StandingStill(0.1f) && !player.mount.Active; return standstill ? stealthGenStandstill : stealthGenMoving * 0.333333f * stealthAcceleration; } @@ -11756,11 +12179,13 @@ namespace CalamityMod.CalPlayer light += 1; if (radiator) light += 1; + if (bendyPet) + light += 1; if (sparks) light += 1; if (fathomSwarmerVisage) light += 1; - if (sirenBoobs || sirenBoobsAlt) + if (sirenBoobs) light += 1; if (aAmpoule) // sponge inherits this and doesn't stack with ampoule light += 1; diff --git a/CalPlayer/CalamityPlayerFishing.cs b/CalPlayer/CalamityPlayerFishing.cs index 01064f7d9d..d803b09b2d 100644 --- a/CalPlayer/CalamityPlayerFishing.cs +++ b/CalPlayer/CalamityPlayerFishing.cs @@ -97,6 +97,8 @@ namespace CalamityMod.CalPlayer CalamityUtils.AddWithCondition(fishList, ItemID.FlarefinKoi, !modPlayer.ZoneCalamity); CalamityUtils.AddWithCondition(fishList, ItemID.Obsidifish, !modPlayer.ZoneCalamity); CalamityUtils.AddWithCondition(fishList, ModContent.ItemType(), modPlayer.ZoneCalamity); + CalamityUtils.AddWithCondition(fishList, ModContent.ItemType(), modPlayer.ZoneCalamity); + CalamityUtils.AddWithCondition(fishList, ModContent.ItemType(), modPlayer.ZoneCalamity); } else if (water) { @@ -166,7 +168,7 @@ namespace CalamityMod.CalPlayer { if (Main.rand.Next(100) < chanceForCrates) { - if (Main.rand.NextBool(chanceForRareItems) && modPlayer.enchantedPearl && modPlayer.fishingStation && player.cratePotion) + if (Main.rand.NextBool(chanceForBiomeCrate)) { if (modPlayer.ZoneCalamity) caughtType = ModContent.ItemType(); @@ -436,14 +438,14 @@ namespace CalamityMod.CalPlayer } } - if (power >= 60 && player.FindBuffIndex(BuffID.Gills) > -1 && CalamityWorld.downedCalamitas && Main.rand.NextBool(25) && power < 160) + if (player.FindBuffIndex(BuffID.Gills) > -1 && CalamityWorld.downedCalamitas && Main.rand.NextBool(25)) { caughtType = ModContent.ItemType(); } if (junk) { - if (canSulphurFish && power < 40) + if (canSulphurFish) { caughtType = ModContent.ItemType(); } @@ -472,23 +474,17 @@ namespace CalamityMod.CalPlayer if (canSulphurFish) { - if (power >= 40) + if (Main.rand.NextBool(15)) { - if (Main.rand.NextBool(15) && power < 80) + caughtType = ModContent.ItemType(); + } + if (Main.rand.NextFloat() < 0.08f) + { + caughtType = Utils.SelectRandom(Main.rand, new int[] { - caughtType = ModContent.ItemType(); - } - if (Main.rand.NextBool(25) && power < 160) - { - caughtType = ModContent.ItemType(); - } - if (power >= 110) - { - if (Main.rand.NextBool(25) && power < 240) - { - caughtType = ModContent.ItemType(); - } - } + ModContent.ItemType(), + ModContent.ItemType() + }); } if (player.cratePotion && Main.rand.NextBool(5)) // 20% { diff --git a/CalPlayer/CalamityPlayerLifeRegen.cs b/CalPlayer/CalamityPlayerLifeRegen.cs index a7e0ecebd6..51b45ca9eb 100644 --- a/CalPlayer/CalamityPlayerLifeRegen.cs +++ b/CalPlayer/CalamityPlayerLifeRegen.cs @@ -91,7 +91,7 @@ namespace CalamityMod.CalPlayer player.lifeRegen = 0; player.lifeRegenTime = 0; - lifeRegenLost += 16; + lifeRegenLost += modPlayer.abaddon ? 8 : 16; } if (modPlayer.nightwither) @@ -205,7 +205,7 @@ namespace CalamityMod.CalPlayer player.lifeRegen = 0; player.lifeRegenTime = 0; - lifeRegenLost += 20; + lifeRegenLost += modPlayer.reducedPlagueDmg ? 10 : 20; } if (modPlayer.bBlood) @@ -391,7 +391,7 @@ namespace CalamityMod.CalPlayer if (player.whoAmI == Main.myPlayer && modPlayer.bloodfinTimer <= 0) { modPlayer.bloodfinTimer = 30; - if (player.statLife <= (int)(player.statLifeMax2 * 0.75)) + if (player.statLife <= (int)(player.statLifeMax2 * 0.75) && !CalamityWorld.ironHeart) player.statLife += 1; } } @@ -461,7 +461,7 @@ namespace CalamityMod.CalPlayer player.lifeRegen /= 2; } - if (modPlayer.omegaBlueChestplate || player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) + if (CalamityWorld.ironHeart || modPlayer.omegaBlueChestplate || modPlayer.godSlayerCooldown || player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) { if (player.lifeRegen > 0) player.lifeRegen = 0; @@ -472,7 +472,7 @@ namespace CalamityMod.CalPlayer player.lifeRegenCount = 0; } - if (CalamityConfig.Instance.LethalLava || CalamityWorld.death) //always occurs in Death regardless of config + if (CalamityConfig.Instance.LethalLava || CalamityWorld.death) // Always occurs in Death regardless of config { if (Main.myPlayer == player.whoAmI) { @@ -488,23 +488,23 @@ namespace CalamityMod.CalPlayer player.AddBuff(ModContent.BuffType(), 2, true); } } - - if (modPlayer.lethalLavaBurn) - { - if (player.lifeRegen > 0) - player.lifeRegen = 0; - - player.lifeRegenTime = 0; - int lifeRegenDown = player.lavaImmune ? 9 : 18; - - if (player.lavaRose) - lifeRegenDown = 3; - - player.lifeRegen -= lifeRegenDown * lifeRegenMult; - } } - if (modPlayer.hInferno) + if (modPlayer.lethalLavaBurn) + { + if (player.lifeRegen > 0) + player.lifeRegen = 0; + + player.lifeRegenTime = 0; + int lifeRegenDown = player.lavaImmune ? 9 : 18; + + if (player.lavaRose) + lifeRegenDown = 3; + + player.lifeRegen -= lifeRegenDown * lifeRegenMult; + } + + if (modPlayer.hInferno) { modPlayer.hInfernoBoost++; @@ -596,7 +596,7 @@ namespace CalamityMod.CalPlayer if (modPlayer.absorber) { - if (Math.Abs(player.velocity.X) < 0.05f && Math.Abs(player.velocity.Y) < 0.05f && player.itemAnimation == 0) + if (player.StandingStill() && player.itemAnimation == 0) player.lifeRegen += 2; } @@ -691,6 +691,10 @@ namespace CalamityMod.CalPlayer player.lifeRegen += 2; } if (modPlayer.handWarmer && modPlayer.eskimoSet) + { + player.lifeRegen += 2; + } + if (modPlayer.bloodPactBoost) { player.lifeRegen += 2; } @@ -713,195 +717,159 @@ namespace CalamityMod.CalPlayer player.lifeRegen += 1; // Standing still healing bonuses (all exclusive with vanilla Shiny Stone) - if (!player.shinyStone) - { - int lifeRegenTimeMaxBoost = CalamityPlayer.areThereAnyDamnBosses ? 450 : 1800; - int lifeRegenMaxBoost = CalamityPlayer.areThereAnyDamnBosses ? 1 : 4; - float lifeRegenLifeRegenTimeMaxBoost = CalamityPlayer.areThereAnyDamnBosses ? 8f : 30f; + if (!player.shinyStone) + { + int lifeRegenTimeMaxBoost = CalamityPlayer.areThereAnyDamnBosses ? 450 : 1800; + int lifeRegenMaxBoost = CalamityPlayer.areThereAnyDamnBosses ? 1 : 4; + float lifeRegenLifeRegenTimeMaxBoost = CalamityPlayer.areThereAnyDamnBosses ? 8f : 30f; - if (Math.Abs(player.velocity.X) < 0.05f && Math.Abs(player.velocity.Y) < 0.05f && player.itemAnimation == 0) - { - if (modPlayer.shadeRegen) - { - if (player.lifeRegenTime > 90 && player.lifeRegenTime < lifeRegenTimeMaxBoost) - player.lifeRegenTime = lifeRegenTimeMaxBoost; + if (player.StandingStill() && player.itemAnimation == 0) + { + bool boostedRegen = false; + bool noSunlight = false; + if (modPlayer.shadeRegen) + { + boostedRegen = true; + if (player.lifeRegen > 0 && player.statLife < modPlayer.actualMaxLife) + { + if (Main.rand.Next(30000) < player.lifeRegenTime || Main.rand.NextBool(30)) + { + int num5 = Dust.NewDust(player.position, player.width, player.height, 173, 0f, 0f, 200, default, 1f); + Main.dust[num5].noGravity = true; + Main.dust[num5].velocity *= 0.75f; + Main.dust[num5].fadeIn = 1.3f; + Vector2 vector = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + vector.Normalize(); + vector *= (float)Main.rand.Next(50, 100) * 0.04f; + Main.dust[num5].velocity = vector; + vector.Normalize(); + vector *= 34f; + Main.dust[num5].position = player.Center - vector; + } + } + } + else if (modPlayer.cFreeze) + { + boostedRegen = true; + if (player.lifeRegen > 0 && player.statLife < modPlayer.actualMaxLife) + { + if (Main.rand.Next(30000) < player.lifeRegenTime || Main.rand.NextBool(30)) + { + int num5 = Dust.NewDust(player.position, player.width, player.height, 67, 0f, 0f, 200, new Color(150, Main.DiscoG, 255), 0.75f); + Main.dust[num5].noGravity = true; + Main.dust[num5].velocity *= 0.75f; + Main.dust[num5].fadeIn = 1.3f; + Vector2 vector = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + vector.Normalize(); + vector *= (float)Main.rand.Next(50, 100) * 0.04f; + Main.dust[num5].velocity = vector; + vector.Normalize(); + vector *= 34f; + Main.dust[num5].position = player.Center - vector; + } + } + } + else if (modPlayer.draedonsHeart) + { + boostedRegen = true; + if (player.lifeRegen > 0 && player.statLife < modPlayer.actualMaxLife) + { + if (Main.rand.Next(30000) < player.lifeRegenTime || Main.rand.NextBool(2)) + { + int num5 = Dust.NewDust(player.position, player.width, player.height, 107, 0f, 0f, 200, default, 1f); + Main.dust[num5].noGravity = true; + Main.dust[num5].velocity *= 0.75f; + Main.dust[num5].fadeIn = 1.3f; + Vector2 vector = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + vector.Normalize(); + vector *= (float)Main.rand.Next(50, 100) * 0.04f; + Main.dust[num5].velocity = vector; + vector.Normalize(); + vector *= 34f; + Main.dust[num5].position = player.Center - vector; + } + } + } + else if (modPlayer.photosynthesis) + { + boostedRegen = true; + if (!Main.dayTime) + noSunlight = true; + if (player.lifeRegen > 0 && player.statLife < modPlayer.actualMaxLife) + { + if (Main.rand.Next(30000) < player.lifeRegenTime || Main.rand.NextBool(2)) + { + int num5 = Dust.NewDust(player.position, player.width, player.height, 244, 0f, 0f, 200, default, 1f); + Main.dust[num5].noGravity = true; + Main.dust[num5].velocity *= 0.75f; + Main.dust[num5].fadeIn = 1.3f; + Vector2 vector = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + vector.Normalize(); + vector *= (float)Main.rand.Next(50, 100) * 0.04f; + Main.dust[num5].velocity = vector; + vector.Normalize(); + vector *= 34f; + Main.dust[num5].position = player.Center - vector; + } + } + } + if (boostedRegen) + { + int lifeRegenTimeMaxBoost2 = !noSunlight ? lifeRegenTimeMaxBoost : (lifeRegenTimeMaxBoost / 5); + int lifeRegenMaxBoost2 = !noSunlight ? lifeRegenMaxBoost : (lifeRegenMaxBoost / 5); + float lifeRegenLifeRegenTimeMaxBoost2 = !noSunlight ? lifeRegenLifeRegenTimeMaxBoost : (lifeRegenLifeRegenTimeMaxBoost / 5); - player.lifeRegenTime += lifeRegenMaxBoost; - player.lifeRegen += lifeRegenMaxBoost; + if (player.lifeRegenTime > 90 && player.lifeRegenTime < lifeRegenTimeMaxBoost2) + player.lifeRegenTime = lifeRegenTimeMaxBoost2; - float num3 = player.lifeRegenTime * 2.5f; // lifeRegenTime max is 3600 - num3 /= 300f; - if (num3 > 0f) - { - if (num3 > lifeRegenLifeRegenTimeMaxBoost) - num3 = lifeRegenLifeRegenTimeMaxBoost; + player.lifeRegenTime += lifeRegenMaxBoost2; + player.lifeRegen += lifeRegenMaxBoost2; - player.lifeRegen += (int)num3; - } + float num3 = player.lifeRegenTime * 2.5f; // lifeRegenTime max is 3600 + num3 /= 300f; + if (num3 > 0f) + { + if (num3 > lifeRegenLifeRegenTimeMaxBoost2) + num3 = lifeRegenLifeRegenTimeMaxBoost2; - if (player.lifeRegen > 0 && player.statLife < modPlayer.actualMaxLife) - { - player.lifeRegenCount++; - if (Main.rand.Next(30000) < player.lifeRegenTime || Main.rand.NextBool(30)) - { - int num5 = Dust.NewDust(player.position, player.width, player.height, 173, 0f, 0f, 200, default, 1f); - Main.dust[num5].noGravity = true; - Main.dust[num5].velocity *= 0.75f; - Main.dust[num5].fadeIn = 1.3f; - Vector2 vector = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - vector.Normalize(); - vector *= (float)Main.rand.Next(50, 100) * 0.04f; - Main.dust[num5].velocity = vector; - vector.Normalize(); - vector *= 34f; - Main.dust[num5].position = player.Center - vector; - } - } - } - else if (modPlayer.cFreeze) - { - if (player.lifeRegenTime > 90 && player.lifeRegenTime < lifeRegenTimeMaxBoost) - player.lifeRegenTime = lifeRegenTimeMaxBoost; - - player.lifeRegenTime += lifeRegenMaxBoost; - player.lifeRegen += lifeRegenMaxBoost; - - float num3 = (player.lifeRegenTime * 2.5f); // lifeRegenTime max is 3600 - num3 /= 300f; - if (num3 > 0f) - { - if (num3 > lifeRegenLifeRegenTimeMaxBoost) - num3 = lifeRegenLifeRegenTimeMaxBoost; - - player.lifeRegen += (int)num3; - } - - if (player.lifeRegen > 0 && player.statLife < modPlayer.actualMaxLife) - { - player.lifeRegenCount++; - if (Main.rand.Next(30000) < player.lifeRegenTime || Main.rand.NextBool(30)) - { - int num5 = Dust.NewDust(player.position, player.width, player.height, 67, 0f, 0f, 200, new Color(150, Main.DiscoG, 255), 0.75f); - Main.dust[num5].noGravity = true; - Main.dust[num5].velocity *= 0.75f; - Main.dust[num5].fadeIn = 1.3f; - Vector2 vector = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - vector.Normalize(); - vector *= (float)Main.rand.Next(50, 100) * 0.04f; - Main.dust[num5].velocity = vector; - vector.Normalize(); - vector *= 34f; - Main.dust[num5].position = player.Center - vector; - } - } - } - else if (modPlayer.draedonsHeart) - { - if (player.lifeRegenTime > 90 && player.lifeRegenTime < lifeRegenTimeMaxBoost) - player.lifeRegenTime = lifeRegenTimeMaxBoost; - - player.lifeRegenTime += lifeRegenMaxBoost; - player.lifeRegen += lifeRegenMaxBoost; - - float num3 = player.lifeRegenTime * 2.5f; // lifeRegenTime max is 3600 - num3 /= 300f; - if (num3 > 0f) - { - if (num3 > lifeRegenLifeRegenTimeMaxBoost) - num3 = lifeRegenLifeRegenTimeMaxBoost; - - player.lifeRegen += (int)num3; - } - - if (player.lifeRegen > 0 && player.statLife < modPlayer.actualMaxLife) - { - player.lifeRegenCount++; - if (Main.rand.Next(30000) < player.lifeRegenTime || Main.rand.NextBool(2)) - { - int num5 = Dust.NewDust(player.position, player.width, player.height, 107, 0f, 0f, 200, default, 1f); - Main.dust[num5].noGravity = true; - Main.dust[num5].velocity *= 0.75f; - Main.dust[num5].fadeIn = 1.3f; - Vector2 vector = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - vector.Normalize(); - vector *= (float)Main.rand.Next(50, 100) * 0.04f; - Main.dust[num5].velocity = vector; - vector.Normalize(); - vector *= 34f; - Main.dust[num5].position = player.Center - vector; - } - } - } - else if (modPlayer.photosynthesis) - { - int lifeRegenTimeMaxBoost2 = Main.dayTime ? lifeRegenTimeMaxBoost : (lifeRegenTimeMaxBoost / 5); - int lifeRegenMaxBoost2 = Main.dayTime ? lifeRegenMaxBoost : (lifeRegenMaxBoost / 5); - float lifeRegenLifeRegenTimeMaxBoost2 = Main.dayTime ? lifeRegenLifeRegenTimeMaxBoost : (lifeRegenLifeRegenTimeMaxBoost / 5); - - if (player.lifeRegenTime > 90 && player.lifeRegenTime < lifeRegenTimeMaxBoost2) - player.lifeRegenTime = lifeRegenTimeMaxBoost2; - - player.lifeRegenTime += lifeRegenMaxBoost2; - player.lifeRegen += lifeRegenMaxBoost2; - - float num3 = player.lifeRegenTime * 2.5f; // lifeRegenTime max is 3600 - num3 /= 300f; - if (num3 > 0f) - { - if (num3 > lifeRegenLifeRegenTimeMaxBoost2) - num3 = lifeRegenLifeRegenTimeMaxBoost2; - - player.lifeRegen += (int)num3; - } - - if (player.lifeRegen > 0 && player.statLife < modPlayer.actualMaxLife) - { - player.lifeRegenCount++; - if (Main.rand.Next(30000) < player.lifeRegenTime || Main.rand.NextBool(2)) - { - int num5 = Dust.NewDust(player.position, player.width, player.height, 244, 0f, 0f, 200, default, 1f); - Main.dust[num5].noGravity = true; - Main.dust[num5].velocity *= 0.75f; - Main.dust[num5].fadeIn = 1.3f; - Vector2 vector = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - vector.Normalize(); - vector *= (float)Main.rand.Next(50, 100) * 0.04f; - Main.dust[num5].velocity = vector; - vector.Normalize(); - vector *= 34f; - Main.dust[num5].position = player.Center - vector; - } - } - } - } - else if (modPlayer.camper && player.statLife < modPlayer.actualMaxLife) - { - player.lifeRegen = (int)((player.lifeRegen * 2) * 1.75f); - player.lifeRegenCount = player.lifeRegenCount > 30 ? player.lifeRegenCount : 30; - player.lifeRegenCount++; - if (Main.rand.Next(30000) < player.lifeRegenTime || Main.rand.NextBool(2)) - { - int num5 = Dust.NewDust(player.position, player.width, player.height, 12, 0f, 0f, 200, Color.OrangeRed, 1f); - Main.dust[num5].noGravity = true; - Main.dust[num5].velocity *= 0.75f; - Main.dust[num5].fadeIn = 1.3f; - Vector2 vector = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - vector.Normalize(); - vector *= (float)Main.rand.Next(50, 100) * 0.04f; - Main.dust[num5].velocity = vector; - vector.Normalize(); - vector *= 34f; - Main.dust[num5].position = player.Center - vector; - } - } - } + player.lifeRegen += (int)num3; + } + if (player.lifeRegen > 0 && player.statLife < modPlayer.actualMaxLife) + { + player.lifeRegenCount++; + } + } + else if (modPlayer.camper && player.statLife < modPlayer.actualMaxLife) + { + float camperRegenMult = CalamityPlayer.areThereAnyDamnBosses ? 1.3f : 1.75f; + int camperCap = CalamityPlayer.areThereAnyDamnBosses ? 20 : 30; + player.lifeRegen = (int)((player.lifeRegen * 2) * camperRegenMult); + player.lifeRegenCount = player.lifeRegenCount > camperCap ? player.lifeRegenCount : camperCap; + player.lifeRegenCount++; + if (Main.rand.Next(30000) < player.lifeRegenTime || Main.rand.NextBool(2)) + { + int num5 = Dust.NewDust(player.position, player.width, player.height, 12, 0f, 0f, 200, Color.OrangeRed, 1f); + Main.dust[num5].noGravity = true; + Main.dust[num5].velocity *= 0.75f; + Main.dust[num5].fadeIn = 1.3f; + Vector2 vector = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + vector.Normalize(); + vector *= (float)Main.rand.Next(50, 100) * 0.04f; + Main.dust[num5].velocity = vector; + vector.Normalize(); + vector *= 34f; + Main.dust[num5].position = player.Center - vector; + } + } + } + } if (CalamityWorld.revenge) { if (player.statLife < modPlayer.actualMaxLife) { bool noLifeRegenCap = (player.shinyStone || modPlayer.draedonsHeart || modPlayer.cFreeze || modPlayer.shadeRegen || modPlayer.photosynthesis || modPlayer.camper) && - Math.Abs(player.velocity.X) < 0.05f && Math.Abs(player.velocity.Y) < 0.05f && player.itemAnimation == 0; + player.StandingStill() && player.itemAnimation == 0; if (!noLifeRegenCap) { diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 01bbc11bb5..c9bd4e7bdd 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -8,6 +8,7 @@ using CalamityMod.Dusts; using CalamityMod.Items.Armor; using CalamityMod.Items.Fishing.AstralCatches; using CalamityMod.Items.Fishing.FishingRods; +using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.NPCs; using CalamityMod.NPCs.AcidRain; @@ -157,6 +158,8 @@ namespace CalamityMod.CalPlayer // Adjusts the life steal cap in rev/death float lifeStealCap = CalamityWorld.death ? 50f : 60f; + /*if (Main.masterMode) + lifeStealCap *= 0.75f;*/ if (player.lifeSteal > lifeStealCap) player.lifeSteal = lifeStealCap; @@ -337,10 +340,10 @@ namespace CalamityMod.CalPlayer { player.Calamity().andromedaState = AndromedaPlayerState.Inactive; } - - if (player.Calamity().andromedaState == AndromedaPlayerState.LargeRobot) + + if(player.Calamity().andromedaState == AndromedaPlayerState.LargeRobot) { - player.width = 152; + player.width = 80; player.height = 212; player.position.Y -= 170; } @@ -374,6 +377,8 @@ namespace CalamityMod.CalPlayer // Revengeance mode recovery rate is 0.3/s // Death mode recovery rate is 0.25/s float lifeStealCooldown = CalamityWorld.death ? 0.25f : CalamityWorld.revenge ? 0.2f : Main.expertMode ? 0.15f : 0.1f; + /*if (Main.masterMode) + lifeStealCooldown *= 1.25f;*/ player.lifeSteal -= lifeStealCooldown; // Nebula Armor nerf @@ -413,7 +418,7 @@ namespace CalamityMod.CalPlayer } // Immunity to most debuffs - if (modPlayer.silvaSet || modPlayer.invincible) + if (modPlayer.invincible) { foreach (int debuff in CalamityMod.debuffList) player.buffImmune[debuff] = true; @@ -424,7 +429,7 @@ namespace CalamityMod.CalPlayer player.buffImmune[BuffID.Electrified] = true; // Reduce breath meter while in icy water instead of chilling - bool canBreath = ((modPlayer.sirenBoobs && NPC.downedBoss3) || (modPlayer.sirenBoobsAlt && NPC.downedBoss3) || player.gills || player.merman); + bool canBreath = (modPlayer.sirenBoobs && NPC.downedBoss3) || player.gills || player.merman; if (player.arcticDivingGear || canBreath) { player.buffImmune[ModContent.BuffType()] = true; @@ -460,10 +465,10 @@ namespace CalamityMod.CalPlayer { if (CalamityWorld.rainingAcid && modPlayer.ZoneSulphur && !CalamityPlayer.areThereAnyDamnBosses && player.Center.Y < Main.worldSurface * 16f + 800f) { - int acidRainDropRate = (int)(MathHelper.Clamp(Main.invasionSize * 0.4f, 13.5f, 50) * 2.25); + int slimeRainRate = (int)(MathHelper.Clamp(Main.invasionSize * 0.4f, 13.5f, 50) * 2.25); 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) + if (player.miscCounter % slimeRainRate == 0f) { if (CalamityWorld.downedAquaticScourge && !CalamityWorld.downedPolterghast && Main.rand.NextBool(12)) { @@ -478,12 +483,12 @@ namespace CalamityMod.CalPlayer { if (modPlayer.hydrothermalSmoke) { - if ((double)player.velocity.X > 0 || (double)player.velocity.Y > 0 || (double)player.velocity.X < -0.1 || (double)player.velocity.Y < -0.1) + if (Math.Abs(player.velocity.X) > 0.1f || Math.Abs(player.velocity.Y) > 0.1f) { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, ModContent.ProjectileType(), 0, 0f, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, player.whoAmI); } } - //trying to find a workaround because apparently putting the bool in ResetEffects prevents it from working + //Trying to find a workaround because apparently putting the bool in ResetEffects prevents it from working if (!player.armorEffectDrawOutlines) { modPlayer.hydrothermalSmoke = false; @@ -512,7 +517,7 @@ namespace CalamityMod.CalPlayer if (depthRatio > FadeAwayStart) { // Varies from 1.0 to 0.0 as depthRatio varies from FadeAwayStart to 1.0. - darknessStrength = (1f - (float)depthRatio) / (1f - FadeAwayStart); + darknessStrength = MathHelper.Lerp(0f, 0.75f, (1f - (float)depthRatio) / (1f - FadeAwayStart)); } // Reduce the power of cave darkness based on your light level. 5+ is enough to totally eliminate it. @@ -551,12 +556,12 @@ namespace CalamityMod.CalPlayer // Thorn and spike effects // 10 = crimson/corruption thorns, 17 = jungle thorns, 40 = dungeon spikes, 60 = temple spikes - Vector2 vector; + Vector2 tileType; if (!player.mount.Active || !player.mount.Cart) - vector = Collision.HurtTiles(player.position, player.velocity, player.width, player.height, player.fireWalk); + tileType = Collision.HurtTiles(player.position, player.velocity, player.width, player.height, player.fireWalk); else - vector = Collision.HurtTiles(player.position, player.velocity, player.width, player.height - 16, player.fireWalk); - switch ((int)vector.Y) + tileType = Collision.HurtTiles(player.position, player.velocity, player.width, player.height - 16, player.fireWalk); + switch ((int)tileType.Y) { case 10: player.AddBuff(BuffID.Weak, 300, false); @@ -605,17 +610,17 @@ namespace CalamityMod.CalPlayer // Ice shards, lightning and sharknadoes bool nearPillar = player.PillarZone(); - if (player.ZoneOverworldHeight && !CalamityPlayer.areThereAnyDamnBosses && Main.invasionType == 0 && NPC.MoonLordCountdown == 0 && !player.InSpace() && !DD2Event.Ongoing && !nearPillar) + if (player.ZoneOverworldHeight && !CalamityPlayer.areThereAnyDamnBosses && !CalamityPlayer.areThereAnyDamnEvents && NPC.MoonLordCountdown == 0 && !player.InSpace()) { - Vector2 sharknadoSpawnPoint = new Vector2(player.Center.X - (float)Main.rand.Next(300, 701), player.Center.Y - (float)Main.rand.Next(700, 801)); + Vector2 sharknadoSpawnPoint = new Vector2(player.Center.X - Main.rand.Next(300, 701), player.Center.Y - Main.rand.Next(700, 801)); if (point.X > Main.maxTilesX / 2) - sharknadoSpawnPoint.X = player.Center.X + (float)Main.rand.Next(300, 701); + sharknadoSpawnPoint.X = player.Center.X + Main.rand.Next(300, 701); if (Main.raining) { float frequencyMult = (1f - Main.cloudAlpha) * CalamityConfig.Instance.DeathWeatherMultiplier; // 3 to 0.055 - Vector2 spawnPoint = new Vector2(player.Center.X + (float)Main.rand.Next(-1000, 1001), player.Center.Y - (float)Main.rand.Next(700, 801)); + Vector2 spawnPoint = new Vector2(player.Center.X + Main.rand.Next(-1000, 1001), player.Center.Y - Main.rand.Next(700, 801)); Tile tileSafely = Framing.GetTileSafely((int)(spawnPoint.X / 16f), (int)(spawnPoint.Y / 16f)); if (player.ZoneSnow) @@ -623,11 +628,11 @@ namespace CalamityMod.CalPlayer if (!tileSafely.active()) { int divisor = (int)((Main.hardMode ? 50f : 60f) * frequencyMult); - float windVelocity = (float)Math.Sqrt((double)Math.Abs(Main.windSpeed)) * (float)Math.Sign(Main.windSpeed) * (Main.cloudAlpha + 0.5f) * 25f + Main.rand.NextFloat() * 0.2f - 0.1f; + float windVelocity = (float)Math.Sqrt(Math.Abs(Main.windSpeed)) * Math.Sign(Main.windSpeed) * (Main.cloudAlpha + 0.5f) * 25f + Main.rand.NextFloat() * 0.2f - 0.1f; Vector2 velocity = new Vector2(windVelocity * 0.2f, 3f * Main.rand.NextFloat()); if (player.miscCounter % divisor == 0 && Main.rand.NextBool(3)) - Projectile.NewProjectile(spawnPoint.X, spawnPoint.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), 20, 0f, player.whoAmI, 2f, 0f); + Projectile.NewProjectile(spawnPoint, velocity, ModContent.ProjectileType(), 20, 0f, player.whoAmI, 2f, 0f); } } else @@ -638,31 +643,31 @@ namespace CalamityMod.CalPlayer if (player.miscCounter == 280 && Main.rand.NextBool(randomFrequency) && player.ownedProjectileCounts[ProjectileID.Cthulunado] < 1) { Main.PlaySound(SoundID.NPCDeath19, (int)sharknadoSpawnPoint.X, (int)sharknadoSpawnPoint.Y); - int num331 = (int)(sharknadoSpawnPoint.Y / 16f); - int num332 = (int)(sharknadoSpawnPoint.X / 16f); - int num333 = 100; - if (num332 < 10) - num332 = 10; - if (num332 > Main.maxTilesX - 10) - num332 = Main.maxTilesX - 10; - if (num331 < 10) - num331 = 10; - if (num331 > Main.maxTilesY - num333 - 10) - num331 = Main.maxTilesY - num333 - 10; + int y = (int)(sharknadoSpawnPoint.Y / 16f); + int x = (int)(sharknadoSpawnPoint.X / 16f); + int yAdjust = 100; + if (x < 10) + x = 10; + if (x > Main.maxTilesX - 10) + x = Main.maxTilesX - 10; + if (y < 10) + y = 10; + if (y > Main.maxTilesY - yAdjust - 10) + y = Main.maxTilesY - yAdjust - 10; - int spawnAreaY = Main.maxTilesY - num331; - for (int num334 = num331; num334 < num331 + spawnAreaY; num334++) + int spawnAreaY = Main.maxTilesY - y; + for (int j = y; j < y + spawnAreaY; j++) { - Tile tile = Main.tile[num332, num334]; - if ((tile.active() && Main.tileSolid[(int)tile.type]) || tile.liquid >= 200) + Tile tile = Main.tile[x, j]; + if ((tile.active() && Main.tileSolid[tile.type]) || tile.liquid >= 200) { - num331 = num334; + y = j; break; } } - int num336 = Projectile.NewProjectile((float)(num332 * 16 + 8), (float)(num331 * 16 - 24), 0f, 0f, ProjectileID.Cthulunado, 50, 4f, player.whoAmI, 16f, 24f); - Main.projectile[num336].netUpdate = true; + int tornado = Projectile.NewProjectile(x * 16 + 8, y * 16 - 24, 0f, 0f, ProjectileID.Cthulunado, 50, 4f, player.whoAmI, 16f, 24f); + Main.projectile[tornado].netUpdate = true; } } @@ -675,8 +680,8 @@ namespace CalamityMod.CalPlayer { float randomVelocity = Main.rand.NextFloat() - 0.5f; Vector2 fireTo = new Vector2(spawnPoint.X + 100f * randomVelocity, spawnPoint.Y + 900f); - Vector2 ai0 = fireTo - spawnPoint; - Vector2 velocity = Vector2.Normalize(ai0) * 12f; + Vector2 direction = fireTo - spawnPoint; + Vector2 velocity = Vector2.Normalize(direction) * 12f; Projectile.NewProjectile(spawnPoint.X, spawnPoint.Y, 0f, velocity.Y, ModContent.ProjectileType(), 0, 0f, player.whoAmI, 0f, 0f); } } @@ -688,32 +693,32 @@ namespace CalamityMod.CalPlayer { if (player.miscCounter == 280 && Main.rand.NextBool(10) && player.ownedProjectileCounts[ProjectileID.Sharknado] < 1) { - Main.PlaySound(SoundID.NPCDeath19, (int)sharknadoSpawnPoint.X, (int)sharknadoSpawnPoint.Y); - int num331 = (int)(sharknadoSpawnPoint.Y / 16f); - int num332 = (int)(sharknadoSpawnPoint.X / 16f); + Main.PlaySound(SoundID.NPCDeath19, sharknadoSpawnPoint); + int y = (int)(sharknadoSpawnPoint.Y / 16f); + int x = (int)(sharknadoSpawnPoint.X / 16f); int num333 = 100; - if (num332 < 10) - num332 = 10; - if (num332 > Main.maxTilesX - 10) - num332 = Main.maxTilesX - 10; - if (num331 < 10) - num331 = 10; - if (num331 > Main.maxTilesY - num333 - 10) - num331 = Main.maxTilesY - num333 - 10; + if (x < 10) + x = 10; + if (x > Main.maxTilesX - 10) + x = Main.maxTilesX - 10; + if (y < 10) + y = 10; + if (y > Main.maxTilesY - num333 - 10) + y = Main.maxTilesY - num333 - 10; - int spawnAreaY = Main.maxTilesY - num331; - for (int num334 = num331; num334 < num331 + spawnAreaY; num334++) + int spawnAreaY = Main.maxTilesY - y; + for (int j = y; j < y + spawnAreaY; j++) { - Tile tile = Main.tile[num332, num334]; - if ((tile.active() && Main.tileSolid[(int)tile.type]) || tile.liquid >= 200) + Tile tile = Main.tile[x, j]; + if ((tile.active() && Main.tileSolid[tile.type]) || tile.liquid >= 200) { - num331 = num334; + y = j; break; } } - int num336 = Projectile.NewProjectile((float)(num332 * 16 + 8), (float)(num331 * 16 - 24), 0.01f, 0f, ProjectileID.Sharknado, 25, 4f, player.whoAmI, 16f, 15f); - Main.projectile[num336].netUpdate = true; + int tornado = Projectile.NewProjectile(x * 16 + 8, y * 16 - 24, 0.01f, 0f, ProjectileID.Sharknado, 25, 4f, player.whoAmI, 16f, 15f); + Main.projectile[tornado].netUpdate = true; } } } @@ -820,7 +825,7 @@ namespace CalamityMod.CalPlayer if (modPlayer.omegaBlueSet) { // Add tentacles - if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 6) + if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 6 && Main.myPlayer == player.whoAmI) { bool[] tentaclesPresent = new bool[6]; for (int i = 0; i < Main.maxProjectiles; i++) @@ -851,7 +856,7 @@ namespace CalamityMod.CalPlayer player.allDamage += damageUp; modPlayer.AllCritBoost(critUp); } - bool canProvideBuffs = player.Calamity().profanedCrystalBuffs || (!modPlayer.profanedCrystal && modPlayer.pArtifact) || (player.Calamity().profanedCrystal && CalamityWorld.downedSCal); + bool canProvideBuffs = modPlayer.profanedCrystalBuffs || (!modPlayer.profanedCrystal && modPlayer.pArtifact) || (modPlayer.profanedCrystal && CalamityWorld.downedSCal); bool attack = player.ownedProjectileCounts[ModContent.ProjectileType()] > 0; // Guardian bonuses if not burnt out if (!modPlayer.bOut && canProvideBuffs) @@ -865,8 +870,8 @@ namespace CalamityMod.CalPlayer if (modPlayer.healCounter <= 0) { - bool enrage = player.statLife <= (int)((double)player.statLifeMax2 * 0.5); - modPlayer.healCounter = (!enrage && player.Calamity().profanedCrystalBuffs) ? 360 : 300; + bool enrage = player.statLife <= (int)(player.statLifeMax2 * 0.5); + modPlayer.healCounter = (!enrage && modPlayer.profanedCrystalBuffs) ? 360 : 300; if (player.whoAmI == Main.myPlayer) { int healAmount = 5 + @@ -901,6 +906,8 @@ namespace CalamityMod.CalPlayer // Cooldowns and timers if (modPlayer.gainRageCooldown > 0) modPlayer.gainRageCooldown--; + if (modPlayer.KameiBladeUseDelay > 0) + modPlayer.KameiBladeUseDelay--; if (modPlayer.galileoCooldown > 0) modPlayer.galileoCooldown--; if (modPlayer.soundCooldown > 0) @@ -977,26 +984,42 @@ namespace CalamityMod.CalPlayer modPlayer.titanBoost--; if (modPlayer.prismaticLasers > 0) modPlayer.prismaticLasers--; + if (modPlayer.dogTextCooldown > 0) + modPlayer.dogTextCooldown--; + if (modPlayer.titanCooldown > 0) + modPlayer.titanCooldown--; + if (modPlayer.roverDrive) + { + if (modPlayer.roverDriveTimer < CalamityUtils.SecondsToFrames(30f)) + modPlayer.roverDriveTimer++; + if (modPlayer.roverDriveTimer >= CalamityUtils.SecondsToFrames(30f)) + modPlayer.roverDriveTimer = 0; + } + else + modPlayer.roverDriveTimer = 616; //Doesn't reset to zero to prevent exploits // Silva invincibility effects if (modPlayer.silvaCountdown > 0 && modPlayer.hasSilvaEffect && modPlayer.silvaSet) { + foreach (int debuff in CalamityMod.debuffList) + player.buffImmune[debuff] = true; + player.buffImmune[ModContent.BuffType()] = true; modPlayer.silvaCountdown -= modPlayer.auricSet ? 2 : 1; if (modPlayer.silvaCountdown <= 0) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SilvaDispel"), (int)player.position.X, (int)player.position.Y); + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SilvaDispel"), player.Center); for (int j = 0; j < 2; j++) { - int num = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 157, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 2f); - Main.dust[num].position.X += (float)Main.rand.Next(-20, 21); - Main.dust[num].position.Y += (float)Main.rand.Next(-20, 21); - Main.dust[num].velocity *= 0.9f; - Main.dust[num].noGravity = true; - Main.dust[num].scale *= 1f + (float)Main.rand.Next(40) * 0.01f; - Main.dust[num].shader = GameShaders.Armor.GetSecondaryShader(player.cWaist, player); + int green = Dust.NewDust(player.position, player.width, player.height, 157, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 2f); + Main.dust[green].position.X += (float)Main.rand.Next(-20, 21); + Main.dust[green].position.Y += (float)Main.rand.Next(-20, 21); + Main.dust[green].velocity *= 0.9f; + Main.dust[green].noGravity = true; + Main.dust[green].scale *= 1f + (float)Main.rand.Next(40) * 0.01f; + Main.dust[green].shader = GameShaders.Armor.GetSecondaryShader(player.cWaist, player); if (Main.rand.NextBool(2)) - Main.dust[num].scale *= 1f + (float)Main.rand.Next(40) * 0.01f; + Main.dust[green].scale *= 1f + (float)Main.rand.Next(40) * 0.01f; } } @@ -1013,8 +1036,8 @@ namespace CalamityMod.CalPlayer for (int j = 0; j < 2; j++) { - int num = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 157, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 2f); - Dust dust = Main.dust[num]; + int green = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 157, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 2f); + Dust dust = Main.dust[green]; dust.position.X += (float)Main.rand.Next(-20, 21); dust.position.Y += (float)Main.rand.Next(-20, 21); dust.velocity *= 0.9f; @@ -1093,8 +1116,8 @@ namespace CalamityMod.CalPlayer for (int j = 0; j < 2; j++) { - int num = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 5, 0f, 0f, 100, default, 2f); - Dust dust = Main.dust[num]; + int blood = Dust.NewDust(player.position, player.width, player.height, DustID.Blood, 0f, 0f, 100, default, 2f); + Dust dust = Main.dust[blood]; dust.position.X += (float)Main.rand.Next(-20, 21); dust.position.Y += (float)Main.rand.Next(-20, 21); dust.velocity *= 0.9f; @@ -1132,15 +1155,28 @@ namespace CalamityMod.CalPlayer player.endurance += 0.07f; } - // Absorber bonus - if (modPlayer.absorber) + if (modPlayer.kamiBoost) + { + player.allDamage += 0.3f; + player.statDefense += 20; + } + + if (modPlayer.roverDriveTimer < 616) + { + player.statDefense += 10; + if (modPlayer.roverDriveTimer > 606) + player.statDefense -= modPlayer.roverDriveTimer - 606; //so it scales down when the shield dies + } + + // Absorber bonus + if (modPlayer.absorber) { player.moveSpeed += 0.12f; player.jumpSpeedBoost += 1.2f; - player.thorns = 0.5f; + player.thorns += 0.5f; player.endurance += 0.05f; - if ((double)Math.Abs(player.velocity.X) < 0.05 && (double)Math.Abs(player.velocity.Y) < 0.05 && player.itemAnimation == 0) + if (player.StandingStill() && player.itemAnimation == 0) player.manaRegenBonus += 2; } @@ -1168,6 +1204,7 @@ namespace CalamityMod.CalPlayer { player.buffTime[l] *= 2; modPlayer.doubledHorror = true; + break; } } } @@ -1186,7 +1223,7 @@ namespace CalamityMod.CalPlayer if (modPlayer.draedonsHeart) { player.allDamage += 0.05f; - if ((double)Math.Abs(player.velocity.X) < 0.05 && (double)Math.Abs(player.velocity.Y) < 0.05 && player.itemAnimation == 0) + if (player.StandingStill() && player.itemAnimation == 0) player.statDefense += 25; } @@ -1228,7 +1265,7 @@ namespace CalamityMod.CalPlayer if (modPlayer.cFreeze) { light[0] += 0.3f; - light[1] += (float)Main.DiscoG / 400f; + light[1] += Main.DiscoG / 400f; light[2] += 0.5f; } if (modPlayer.sirenIce) @@ -1237,11 +1274,11 @@ namespace CalamityMod.CalPlayer light[1] += 1f; light[2] += 1.25f; } - if (modPlayer.sirenBoobs || modPlayer.sirenBoobsAlt) + if (modPlayer.sirenBoobs) { - light[0] += 1.5f; + light[0] += 0.1f; light[1] += 1f; - light[2] += 0.1f; + light[2] += 1.5f; } if (modPlayer.tarraSummon) { @@ -1281,9 +1318,9 @@ namespace CalamityMod.CalPlayer player.velocity.X = 0f; player.velocity.Y = -0.4f; //should negate gravity - int d = Dust.NewDust(player.position, player.width, player.height, 88); - Main.dust[d].noGravity = true; - Main.dust[d].velocity *= 2f; + int ice = Dust.NewDust(player.position, player.width, player.height, 88); + Main.dust[ice].noGravity = true; + Main.dust[ice].velocity *= 2f; player.buffImmune[BuffID.Frozen] = true; player.buffImmune[BuffID.Chilled] = true; @@ -1293,20 +1330,19 @@ namespace CalamityMod.CalPlayer // Cosmic Discharge Cosmic Freeze buff, gives surrounding enemies the Glacial State debuff if (modPlayer.cFreeze) { - int num = ModContent.BuffType(); - float num2 = 200f; - int random = Main.rand.Next(5); + int buffType = ModContent.BuffType(); + float freezeDist = 200f; if (player.whoAmI == Main.myPlayer) { - if (random == 0) + if (Main.rand.NextBool(5)) { for (int l = 0; l < Main.maxNPCs; l++) { - NPC nPC = Main.npc[l]; - if (nPC.active && !nPC.friendly && nPC.damage > 0 && !nPC.dontTakeDamage && !nPC.buffImmune[num] && Vector2.Distance(player.Center, nPC.Center) <= num2) + NPC npc = Main.npc[l]; + if (npc.active && !npc.friendly && npc.damage > 0 && !npc.dontTakeDamage && !npc.buffImmune[buffType] && Vector2.Distance(player.Center, npc.Center) <= freezeDist) { - if (nPC.FindBuffIndex(num) == -1) - nPC.AddBuff(num, 120, false); + if (npc.FindBuffIndex(buffType) == -1) + npc.AddBuff(buffType, 120, false); } } } @@ -1382,25 +1418,25 @@ namespace CalamityMod.CalPlayer float knockBack = 1f; if (Main.rand.NextBool(15)) { - int num = 0; + int projCount = 0; for (int i = 0; i < Main.maxProjectiles; i++) { if (Main.projectile[i].active && Main.projectile[i].owner == player.whoAmI && Main.projectile[i].type == ModContent.ProjectileType()) - num++; + projCount++; } - if (Main.rand.Next(15) >= num && num < 6) + if (Main.rand.Next(15) >= projCount && projCount < 6) { - int num2 = 50; + int loopAmt = 50; int num3 = 24; int num4 = 90; - for (int j = 0; j < num2; j++) + for (int j = 0; j < loopAmt; j++) { - int num5 = Main.rand.Next(200 - j * 2, 400 + j * 2); + int sourceVariance = Main.rand.Next(200 - j * 2, 400 + j * 2); Vector2 center = player.Center; - center.X += (float)Main.rand.Next(-num5, num5 + 1); - center.Y += (float)Main.rand.Next(-num5, num5 + 1); + center.X += (float)Main.rand.Next(-sourceVariance, sourceVariance + 1); + center.Y += (float)Main.rand.Next(-sourceVariance, sourceVariance + 1); if (!Collision.SolidCollision(center, num3, num3) && !Collision.WetCollision(center, num3, num3)) { @@ -1409,12 +1445,12 @@ namespace CalamityMod.CalPlayer if (Collision.CanHit(new Vector2(player.Center.X, player.position.Y), 1, 1, center, 1, 1) || Collision.CanHit(new Vector2(player.Center.X, player.position.Y - 50f), 1, 1, center, 1, 1)) { - int num6 = (int)center.X / 16; - int num7 = (int)center.Y / 16; - bool flag = false; + int xSpawn = (int)center.X / 16; + int ySpawn = (int)center.Y / 16; + bool shouldSpawn = false; - if (Main.rand.NextBool(3) && Main.tile[num6, num7] != null && Main.tile[num6, num7].wall > 0) - flag = true; + if (Main.rand.NextBool(3) && Main.tile[xSpawn, ySpawn] != null && Main.tile[xSpawn, ySpawn].wall > 0) + shouldSpawn = true; else { center.X -= (float)(num4 / 2); @@ -1424,23 +1460,23 @@ namespace CalamityMod.CalPlayer { center.X += (float)(num4 / 2); center.Y += (float)(num4 / 2); - flag = true; + shouldSpawn = true; } } - if (flag) + if (shouldSpawn) { for (int k = 0; k < Main.maxProjectiles; k++) { if (Main.projectile[k].active && Main.projectile[k].owner == player.whoAmI && Main.projectile[k].type == ModContent.ProjectileType() && (center - Main.projectile[k].Center).Length() < 48f) { - flag = false; + shouldSpawn = false; break; } } - if (flag && Main.myPlayer == player.whoAmI) - Projectile.NewProjectile(center.X, center.Y, 0f, 0f, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + if (shouldSpawn && Main.myPlayer == player.whoAmI) + Projectile.NewProjectile(center, Vector2.Zero, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); } } } @@ -1497,34 +1533,36 @@ namespace CalamityMod.CalPlayer if (player.spelunkerTimer >= 10) { player.spelunkerTimer = 0; - int num65 = 30; - int num66 = (int)player.Center.X / 16; - int num67 = (int)player.Center.Y / 16; + int distance = 30; + int i = (int)player.Center.X / 16; + int j = (int)player.Center.Y / 16; - for (int num68 = num66 - num65; num68 <= num66 + num65; num68++) + for (int x = i - distance; x <= i + distance; x++) { - for (int num69 = num67 - num65; num69 <= num67 + num65; num69++) + for (int y = j - distance; y <= j + distance; y++) { + Tile tile = Main.tile[x, y]; if (Main.rand.NextBool(4)) { - Vector2 vector = new Vector2((float)(num66 - num68), (float)(num67 - num69)); - if (vector.Length() < (float)num65 && num68 > 0 && num68 < Main.maxTilesX - 1 && num69 > 0 && num69 < Main.maxTilesY - 1 && Main.tile[num68, num69] != null && Main.tile[num68, num69].active()) + Vector2 vector = new Vector2((float)(i - x), (float)(j - y)); + if (vector.Length() < (float)distance && x > 0 && x < Main.maxTilesX - 1 && y > 0 && y < Main.maxTilesY - 1 && tile != null && tile.active()) { - bool flag7 = false; - if (Main.tile[num68, num69].type == 185 && Main.tile[num68, num69].frameY == 18) + bool shouldSpawnDust = false; + //These checks are for money piles. They share a sheet with other background objects so it checks for frames. + if (tile.type == TileID.SmallPiles && tile.frameY == 18) { - if (Main.tile[num68, num69].frameX >= 576 && Main.tile[num68, num69].frameX <= 882) - flag7 = true; + if (tile.frameX >= 576 && tile.frameX <= 882) + shouldSpawnDust = true; } - else if (Main.tile[num68, num69].type == 186 && Main.tile[num68, num69].frameX >= 864 && Main.tile[num68, num69].frameX <= 1170) - flag7 = true; + else if (tile.type == TileID.LargePiles && tile.frameX >= 864 && tile.frameX <= 1170) + shouldSpawnDust = true; - if (flag7 || Main.tileSpelunker[(int)Main.tile[num68, num69].type] || (Main.tileAlch[(int)Main.tile[num68, num69].type] && Main.tile[num68, num69].type != 82)) + if (shouldSpawnDust || Main.tileSpelunker[tile.type] || (Main.tileAlch[tile.type] && tile.type != TileID.ImmatureHerbs)) { - int num70 = Dust.NewDust(new Vector2((float)(num68 * 16), (float)(num69 * 16)), 16, 16, 204, 0f, 0f, 150, default, 0.3f); - Main.dust[num70].fadeIn = 0.75f; - Main.dust[num70].velocity *= 0.1f; - Main.dust[num70].noLight = true; + int sparkle = Dust.NewDust(new Vector2((x * 16f), (y * 16f)), 16, 16, 204, 0f, 0f, 150, default, 0.3f); + Main.dust[sparkle].fadeIn = 0.75f; + Main.dust[sparkle].velocity *= 0.1f; + Main.dust[sparkle].noLight = true; } } } @@ -1542,7 +1580,7 @@ namespace CalamityMod.CalPlayer } if (modPlayer.golemLore) { - if ((double)Math.Abs(player.velocity.X) < 0.05 && (double)Math.Abs(player.velocity.Y) < 0.05 && player.itemAnimation == 0) + if (player.StandingStill() && player.itemAnimation == 0) player.statDefense += 10; } if (modPlayer.dukeFishronLore) @@ -1594,59 +1632,52 @@ namespace CalamityMod.CalPlayer { for (int j = 0; j < Main.maxItems; j++) { - if (Main.item[j].active && Main.item[j].noGrabDelay == 0 && Main.item[j].owner == player.whoAmI) + Item item = Main.item[j]; + if (item.active && item.noGrabDelay == 0 && item.owner == player.whoAmI) { - Main.item[j].beingGrabbed = true; - if ((double)player.position.X + (double)player.width * 0.5 > (double)Main.item[j].position.X + (double)Main.item[j].width * 0.5) + item.beingGrabbed = true; + if (player.Center.X > item.Center.X) { - if (Main.item[j].velocity.X < 90f + player.velocity.X) + if (item.velocity.X < 90f + player.velocity.X) { - Item item = Main.item[j]; item.velocity.X += 9f; } - if (Main.item[j].velocity.X < 0f) + if (item.velocity.X < 0f) { - Item item = Main.item[j]; item.velocity.X += 9f * 0.75f; } } else { - if (Main.item[j].velocity.X > -90f + player.velocity.X) + if (item.velocity.X > -90f + player.velocity.X) { - Item item = Main.item[j]; item.velocity.X -= 9f; } - if (Main.item[j].velocity.X > 0f) + if (item.velocity.X > 0f) { - Item item = Main.item[j]; item.velocity.X -= 9f * 0.75f; } } - if ((double)player.position.Y + (double)player.height * 0.5 > (double)Main.item[j].position.Y + (double)Main.item[j].height * 0.5) + if (player.Center.Y > item.Center.Y) { - if (Main.item[j].velocity.Y < 90f) + if (item.velocity.Y < 90f) { - Item item = Main.item[j]; item.velocity.Y += 9f; } - if (Main.item[j].velocity.Y < 0f) + if (item.velocity.Y < 0f) { - Item item = Main.item[j]; item.velocity.Y += 9f * 0.75f; } } else { - if (Main.item[j].velocity.Y > -90f) + if (item.velocity.Y > -90f) { - Item item = Main.item[j]; item.velocity.Y -= 9f; } - if (Main.item[j].velocity.Y > 0f) + if (item.velocity.Y > 0f) { - Item item = Main.item[j]; item.velocity.Y -= 9f * 0.75f; } } @@ -1657,14 +1688,14 @@ namespace CalamityMod.CalPlayer // Spectral Veil effects if (modPlayer.spectralVeil && modPlayer.spectralVeilImmunity > 0) { - Rectangle sVeilRectangle = new Rectangle((int)((double)player.position.X + (double)player.velocity.X * 0.5 - 4.0), (int)((double)player.position.Y + (double)player.velocity.Y * 0.5 - 4.0), player.width + 8, player.height + 8); + Rectangle sVeilRectangle = new Rectangle((int)(player.position.X + player.velocity.X * 0.5f - 4f), (int)(player.position.Y + player.velocity.Y * 0.5f - 4f), player.width + 8, player.height + 8); for (int i = 0; i < Main.maxNPCs; i++) { - if (Main.npc[i].active && !Main.npc[i].dontTakeDamage && !Main.npc[i].friendly && !Main.npc[i].townNPC && Main.npc[i].immune[player.whoAmI] <= 0 && Main.npc[i].damage > 0) + NPC npc = Main.npc[i]; + if (npc.active && !npc.dontTakeDamage && !npc.friendly && !npc.townNPC && npc.immune[player.whoAmI] <= 0 && npc.damage > 0) { - NPC nPC = Main.npc[i]; - Rectangle rect = nPC.getRect(); - if (sVeilRectangle.Intersects(rect) && (nPC.noTileCollide || player.CanHit(nPC))) + Rectangle rect = npc.getRect(); + if (sVeilRectangle.Intersects(rect) && (npc.noTileCollide || player.CanHit(npc))) { if (player.whoAmI == Main.myPlayer) { @@ -1689,7 +1720,7 @@ namespace CalamityMod.CalPlayer Main.dust[sVeilDustIndex2].noLight = false; } - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SilvaDispel"), (int)Main.player[Main.myPlayer].position.X, (int)Main.player[Main.myPlayer].position.Y); + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SilvaDispel"), player.Center); } break; } @@ -1698,9 +1729,9 @@ namespace CalamityMod.CalPlayer for (int i = 0; i < Main.maxProjectiles; i++) { - if (Main.projectile[i].active && !Main.projectile[i].friendly && Main.projectile[i].hostile && Main.projectile[i].damage > 0) + Projectile proj = Main.projectile[i]; + if (proj.active && !proj.friendly && proj.hostile && proj.damage > 0) { - Projectile proj = Main.projectile[i]; Rectangle rect = proj.getRect(); if (sVeilRectangle.Intersects(rect)) { @@ -1727,7 +1758,7 @@ namespace CalamityMod.CalPlayer Main.dust[sVeilDustIndex2].noLight = false; } - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SilvaDispel"), (int)Main.player[Main.myPlayer].position.X, (int)Main.player[Main.myPlayer].position.Y); + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SilvaDispel"), player.Center); } break; } @@ -1736,7 +1767,7 @@ namespace CalamityMod.CalPlayer } // Plagued Fuel Pack effects - if (modPlayer.plaguedFuelPackDash > 0) + if (modPlayer.plaguedFuelPackDash > 0 && player.whoAmI == Main.myPlayer) { int velocityMult = modPlayer.plaguedFuelPackDash > 1 ? 25 : 5; player.velocity = new Vector2(modPlayer.plaguedFuelPackDirection, -1) * velocityMult; @@ -1761,7 +1792,7 @@ namespace CalamityMod.CalPlayer } // Blunder Booster effects - if (modPlayer.blunderBoosterDash > 0) + if (modPlayer.blunderBoosterDash > 0 && player.whoAmI == Main.myPlayer) { int velocityMult = modPlayer.blunderBoosterDash > 1 ? 35 : 5; player.velocity = new Vector2(modPlayer.blunderBoosterDirection, -1) * velocityMult; @@ -1786,7 +1817,7 @@ namespace CalamityMod.CalPlayer } // Gravistar Sabaton effects - if (modPlayer.gSabaton) + if (modPlayer.gSabaton && player.whoAmI == Main.myPlayer) { if (modPlayer.gSabatonCooldown <= 0 && !player.mount.Active) { @@ -1795,7 +1826,7 @@ namespace CalamityMod.CalPlayer modPlayer.gSabatonFall = 300; modPlayer.gSabatonCooldown = 480; //8 second cooldown player.gravity *= 2f; - Projectile.NewProjectile(player.Center.X, player.Center.Y, player.velocity.X, player.velocity.Y, ModContent.ProjectileType(), 0, 0, player.whoAmI); + Projectile.NewProjectile(player.Center.X, player.Center.Y + (player.height / 5f), player.velocity.X, player.velocity.Y, ModContent.ProjectileType(), 0, 0, player.whoAmI); } } if (modPlayer.gSabatonCooldown == 1) //dust when ready to use again @@ -1891,7 +1922,7 @@ namespace CalamityMod.CalPlayer (modPlayer.aquaticEmblem ? 0.25 : 0D) - // 0.75 (player.accMerman ? 0.3 : 0D) - // 0.7 (modPlayer.victideSet ? 0.2 : 0D) - // 0.85 - (((modPlayer.sirenBoobs || modPlayer.sirenBoobsAlt) && NPC.downedBoss3) ? 0.3 : 0D) - // 0.7 + ((modPlayer.sirenBoobs && NPC.downedBoss3) ? 0.3 : 0D) - // 0.7 (modPlayer.abyssalDivingSuit ? 0.3 : 0D); // 0.7 // Limit the multiplier to 5% @@ -1955,7 +1986,7 @@ namespace CalamityMod.CalPlayer (modPlayer.aquaticEmblem ? 10D : 0D) + // 40 (player.accMerman ? 15D : 0D) + // 55 (modPlayer.victideSet ? 5D : 0D) + // 60 - (((modPlayer.sirenBoobs || modPlayer.sirenBoobsAlt) && NPC.downedBoss3) ? 15D : 0D) + // 75 + ((modPlayer.sirenBoobs && NPC.downedBoss3) ? 15D : 0D) + // 75 (modPlayer.abyssalDivingSuit ? 15D : 0D); // 90 // Limit the multiplier to 50 @@ -2112,7 +2143,7 @@ namespace CalamityMod.CalPlayer modPlayer.chiBuffTimer = 0; } - if ((double)Math.Abs(player.velocity.X) < 0.1 && (double)Math.Abs(player.velocity.Y) < 0.1 && !player.mount.Active) + if (player.StandingStill(0.1f) && !player.mount.Active) { if (modPlayer.chiBuffTimer < 120) modPlayer.chiBuffTimer++; @@ -2134,7 +2165,7 @@ namespace CalamityMod.CalPlayer if (modPlayer.aquaticBoost > 0f) { modPlayer.aquaticBoost -= 0.0002f; // 0.015 - if ((double)modPlayer.aquaticBoost <= 0.0) + if (modPlayer.aquaticBoost <= 0f) { modPlayer.aquaticBoost = 0f; if (Main.netMode == NetmodeID.MultiplayerClient) @@ -2163,12 +2194,12 @@ namespace CalamityMod.CalPlayer if (player.itemAnimation > 0) modPlayer.modStealthTimer = 5; - if ((double)Math.Abs(player.velocity.X) < 0.1 && (double)Math.Abs(player.velocity.Y) < 0.1 && !player.mount.Active) + if (player.StandingStill(0.1f) && !player.mount.Active) { if (modPlayer.modStealthTimer == 0 && modPlayer.modStealth > 0f) { modPlayer.modStealth -= 0.015f; - if ((double)modPlayer.modStealth <= 0.0) + if (modPlayer.modStealth <= 0f) { modPlayer.modStealth = 0f; if (Main.netMode == NetmodeID.MultiplayerClient) @@ -2178,8 +2209,8 @@ namespace CalamityMod.CalPlayer } else { - float num27 = Math.Abs(player.velocity.X) + Math.Abs(player.velocity.Y); - modPlayer.modStealth += num27 * 0.0075f; + float playerVel = Math.Abs(player.velocity.X) + Math.Abs(player.velocity.Y); + modPlayer.modStealth += playerVel * 0.0075f; if (modPlayer.modStealth > 1f) modPlayer.modStealth = 1f; if (player.mount.Active) @@ -2202,12 +2233,12 @@ namespace CalamityMod.CalPlayer if (player.itemAnimation > 0) modPlayer.modStealthTimer = 5; - if ((double)Math.Abs(player.velocity.X) < 0.1 && (double)Math.Abs(player.velocity.Y) < 0.1 && !player.mount.Active) + if (player.StandingStill(0.1f) && !player.mount.Active) { if (modPlayer.modStealthTimer == 0 && modPlayer.modStealth > 0f) { modPlayer.modStealth -= 0.015f; - if ((double)modPlayer.modStealth <= 0.0) + if (modPlayer.modStealth <= 0f) { modPlayer.modStealth = 0f; if (Main.netMode == NetmodeID.MultiplayerClient) @@ -2217,8 +2248,8 @@ namespace CalamityMod.CalPlayer } else { - float num27 = Math.Abs(player.velocity.X) + Math.Abs(player.velocity.Y); - modPlayer.modStealth += num27 * 0.0075f; + float playerVel = Math.Abs(player.velocity.X) + Math.Abs(player.velocity.Y); + modPlayer.modStealth += playerVel * 0.0075f; if (modPlayer.modStealth > 1f) modPlayer.modStealth = 1f; if (player.mount.Active) @@ -2241,7 +2272,7 @@ namespace CalamityMod.CalPlayer { if (modPlayer.elysianAegis) { - bool flag14 = false; + bool spawnDust = false; // Activate buff if (modPlayer.elysianGuard) @@ -2249,14 +2280,14 @@ namespace CalamityMod.CalPlayer if (player.whoAmI == Main.myPlayer) player.AddBuff(ModContent.BuffType(), 2, false); - float num29 = modPlayer.shieldInvinc; + float shieldBoostInitial = modPlayer.shieldInvinc; modPlayer.shieldInvinc -= 0.08f; if (modPlayer.shieldInvinc < 0f) modPlayer.shieldInvinc = 0f; else - flag14 = true; + spawnDust = true; - if (modPlayer.shieldInvinc == 0f && num29 != modPlayer.shieldInvinc && Main.netMode == NetmodeID.MultiplayerClient) + if (modPlayer.shieldInvinc == 0f && shieldBoostInitial != modPlayer.shieldInvinc && Main.netMode == NetmodeID.MultiplayerClient) NetMessage.SendData(MessageID.PlayerStealth, -1, -1, null, player.whoAmI, 0f, 0f, 0f, 0, 0, 0); float damageBoost = (5f - modPlayer.shieldInvinc) * 0.03f; @@ -2276,38 +2307,38 @@ namespace CalamityMod.CalPlayer // Remove buff else { - float num30 = modPlayer.shieldInvinc; + float shieldBoostInitial = modPlayer.shieldInvinc; modPlayer.shieldInvinc += 0.08f; if (modPlayer.shieldInvinc > 5f) modPlayer.shieldInvinc = 5f; else - flag14 = true; + spawnDust = true; - if (modPlayer.shieldInvinc == 5f && num30 != modPlayer.shieldInvinc && Main.netMode == NetmodeID.MultiplayerClient) + if (modPlayer.shieldInvinc == 5f && shieldBoostInitial != modPlayer.shieldInvinc && Main.netMode == NetmodeID.MultiplayerClient) NetMessage.SendData(MessageID.PlayerStealth, -1, -1, null, player.whoAmI, 0f, 0f, 0f, 0, 0, 0); } // Emit dust - if (flag14) + if (spawnDust) { if (Main.rand.NextBool(2)) { - Vector2 vector = Vector2.UnitY.RotatedByRandom(6.2831854820251465); - Dust dust = Main.dust[Dust.NewDust(player.Center - vector * 30f, 0, 0, 244, 0f, 0f, 0, default, 1f)]; + Vector2 vector = Vector2.UnitY.RotatedByRandom(Math.PI * 2D); + Dust dust = Main.dust[Dust.NewDust(player.Center - vector * 30f, 0, 0, (int)CalamityDusts.ProfanedFire, 0f, 0f, 0, default, 1f)]; dust.noGravity = true; dust.position = player.Center - vector * (float)Main.rand.Next(5, 11); - dust.velocity = vector.RotatedBy(1.5707963705062866, default) * 4f; + dust.velocity = vector.RotatedBy(Math.PI / 2D, default) * 4f; dust.scale = 0.5f + Main.rand.NextFloat(); dust.fadeIn = 0.5f; } if (Main.rand.NextBool(2)) { - Vector2 vector2 = Vector2.UnitY.RotatedByRandom(6.2831854820251465); + Vector2 vector2 = Vector2.UnitY.RotatedByRandom(Math.PI * 2D); Dust dust2 = Main.dust[Dust.NewDust(player.Center - vector2 * 30f, 0, 0, 246, 0f, 0f, 0, default, 1f)]; dust2.noGravity = true; dust2.position = player.Center - vector2 * 12f; - dust2.velocity = vector2.RotatedBy(-1.5707963705062866, default) * 2f; + dust2.velocity = vector2.RotatedBy(-Math.PI / 2D, default) * 2f; dust2.scale = 0.5f + Main.rand.NextFloat(); dust2.fadeIn = 0.5f; } @@ -2422,9 +2453,6 @@ namespace CalamityMod.CalPlayer if (modPlayer.xWrath) modPlayer.throwingCrit += 5; - if (modPlayer.godSlayerCooldown) - player.allDamage += 0.1f; - if (modPlayer.graxDefense) { player.statDefense += 30; @@ -2498,6 +2526,15 @@ namespace CalamityMod.CalPlayer player.magicQuiver = true; } + if (modPlayer.bloodPactBoost) + { + player.allDamage += 0.05f; + player.statDefense += 20; + player.endurance += 0.1f; + player.longInvince = true; + player.crimsonRegen = true; + } + if (modPlayer.fabsolVodka) { player.allDamage += 0.08f; @@ -2653,6 +2690,17 @@ namespace CalamityMod.CalPlayer modPlayer.planarSpeedBoost = 0; } + if (modPlayer.brimlashBusterBoost) + { + if (player.ActiveItem().type != ModContent.ItemType() && player.ActiveItem().type != ModContent.ItemType()) + modPlayer.brimlashBusterBoost = false; + } + if (modPlayer.animusBoost > 1f) + { + if (player.ActiveItem().type != ModContent.ItemType()) + modPlayer.animusBoost = 1f; + } + if (modPlayer.etherealExtorter) { bool ZoneForest = !modPlayer.ZoneAbyss && !modPlayer.ZoneSulphur && !modPlayer.ZoneAstral && !modPlayer.ZoneCalamity && @@ -2677,7 +2725,7 @@ namespace CalamityMod.CalPlayer if (modPlayer.ZoneAstral) { if (player.wingTimeMax > 0) - player.wingTimeMax = (int)((double)player.wingTimeMax * 1.05); + player.wingTimeMax = (int)(player.wingTimeMax * 1.05); } if (player.ZoneJungle && CalamityMod.natureWeaponList.Contains(player.ActiveItem().type)) @@ -2824,7 +2872,6 @@ namespace CalamityMod.CalPlayer player.ClearBuff(BuffID.Regeneration); if (player.FindBuffIndex(BuffID.Lifeforce) > -1) player.ClearBuff(BuffID.Lifeforce); - player.discount = true; player.lifeMagnet = true; player.calmed = true; } @@ -2857,13 +2904,13 @@ namespace CalamityMod.CalPlayer player.minionKB += floatTypeBoost; player.moveSpeed += floatTypeBoost; if (player.wingTimeMax > 0) - player.wingTimeMax = (int)((double)player.wingTimeMax * 1.15); + player.wingTimeMax = (int)(player.wingTimeMax * 1.15); } if (modPlayer.ravagerLore) { if (player.wingTimeMax > 0) - player.wingTimeMax = (int)((double)player.wingTimeMax * 0.5); + player.wingTimeMax = (int)(player.wingTimeMax * 0.5); player.allDamage += 0.1f; } @@ -3062,36 +3109,10 @@ namespace CalamityMod.CalPlayer { player.panic = true; player.pStone = true; - player.armorPenetration += 10; + player.armorPenetration += modPlayer.rampartOfDeities ? 20 : 10; } - if (modPlayer.rampartOfDeities) - { - player.armorPenetration += 10; - player.noKnockback = true; - if (player.statLife > (int)(player.statLifeMax2 * 0.25)) - { - player.hasPaladinShield = true; - if (player.whoAmI != Main.myPlayer && player.miscCounter % 10 == 0) - { - int myPlayer = Main.myPlayer; - if (Main.player[myPlayer].team == player.team && player.team != 0) - { - float arg = player.position.X - Main.player[myPlayer].position.X; - float num3 = player.position.Y - Main.player[myPlayer].position.Y; - - if ((float)Math.Sqrt((double)(arg * arg + num3 * num3)) < 800f) - Main.player[myPlayer].AddBuff(43, 20, true); - } - } - } - - if (player.statLife <= (int)(player.statLifeMax2 * 0.5)) - player.AddBuff(62, 5, true); - if (player.statLife <= (int)(player.statLifeMax2 * 0.15)) - player.endurance += 0.05f; - } - else if (modPlayer.fBulwark) + if (modPlayer.fBulwark) { player.noKnockback = true; if (player.statLife > (int)(player.statLifeMax2 * 0.25)) @@ -3102,17 +3123,16 @@ namespace CalamityMod.CalPlayer int myPlayer = Main.myPlayer; if (Main.player[myPlayer].team == player.team && player.team != 0) { - float arg = player.position.X - Main.player[myPlayer].position.X; - float num3 = player.position.Y - Main.player[myPlayer].position.Y; + Vector2 otherPlayerPos = player.position - Main.player[myPlayer].position; - if ((float)Math.Sqrt((double)(arg * arg + num3 * num3)) < 800f) - Main.player[myPlayer].AddBuff(43, 20, true); + if (otherPlayerPos.Length() < 800f) + Main.player[myPlayer].AddBuff(BuffID.PaladinsShield, 20, true); } } } if (player.statLife <= (int)(player.statLifeMax2 * 0.5)) - player.AddBuff(62, 5, true); + player.AddBuff(BuffID.IceBarrier, 5, true); if (player.statLife <= (int)(player.statLifeMax2 * 0.15)) player.endurance += 0.05f; } @@ -3168,7 +3188,7 @@ namespace CalamityMod.CalPlayer modPlayer.bloodflareSummonTimer = 900; for (int I = 0; I < 3; I++) { - float ai1 = (float)(I * 120); + float ai1 = I * 120; Projectile.NewProjectile(player.Center.X + (float)(Math.Sin(I * 120) * 550), player.Center.Y + (float)(Math.Cos(I * 120) * 550), 0f, 0f, ModContent.ProjectileType(), (int)((modPlayer.auricSet ? 15000f : 5000f) * player.MinionDamage()), 1f, player.whoAmI, ai1, 0f); } @@ -3178,7 +3198,6 @@ namespace CalamityMod.CalPlayer if (modPlayer.yInsignia) { player.longInvince = true; - player.kbGlove = true; player.meleeDamage += 0.05f; player.lavaMax += 240; if (player.statLife <= (int)(player.statLifeMax2 * 0.5)) @@ -3188,7 +3207,8 @@ namespace CalamityMod.CalPlayer if (modPlayer.reaperToothNecklace) { player.allDamage += 0.25f; - player.statDefense /= 2; + if (player.statDefense > 0) + player.statDefense /= 2; } if (modPlayer.deepDiver) @@ -3250,12 +3270,12 @@ namespace CalamityMod.CalPlayer for (int i = 0; i < Main.maxNPCs; ++i) { - NPC nPC = Main.npc[i]; - if (!nPC.active || nPC.friendly || nPC.damage <= 0 || nPC.dontTakeDamage) + NPC npc = Main.npc[i]; + if (!npc.active || npc.friendly || npc.damage <= 0 || npc.dontTakeDamage) continue; - if (Vector2.Distance(player.Center, nPC.Center) <= range) - Projectile.NewProjectileDirect(nPC.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, player.whoAmI, i); + if (Vector2.Distance(player.Center, npc.Center) <= range) + Projectile.NewProjectileDirect(npc.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, player.whoAmI, i); } } } @@ -3277,23 +3297,23 @@ namespace CalamityMod.CalPlayer for (int i = 0; i < Main.maxNPCs; ++i) { - NPC nPC = Main.npc[i]; - if (!nPC.active || nPC.friendly || nPC.damage <= 0 || nPC.dontTakeDamage) + NPC npc = Main.npc[i]; + if (!npc.active || npc.friendly || npc.damage <= 0 || npc.dontTakeDamage) continue; - if (Vector2.Distance(player.Center, nPC.Center) <= range) - Projectile.NewProjectileDirect(nPC.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, player.whoAmI, i); + if (Vector2.Distance(player.Center, npc.Center) <= range) + Projectile.NewProjectileDirect(npc.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, player.whoAmI, i); // Occasionally spawn cute sparks so it looks like an electrical aura if (Main.rand.NextBool(10)) { - Vector2 value15 = new Vector2((float)Main.rand.Next(-50, 51), (float)Main.rand.Next(-50, 51)); - while (value15.X == 0f && value15.Y == 0f) - value15 = new Vector2((float)Main.rand.Next(-50, 51), (float)Main.rand.Next(-50, 51)); + Vector2 velocity = new Vector2((float)Main.rand.Next(-50, 51), (float)Main.rand.Next(-50, 51)); + while (velocity.X == 0f && velocity.Y == 0f) + velocity = new Vector2((float)Main.rand.Next(-50, 51), (float)Main.rand.Next(-50, 51)); - value15.Normalize(); - value15 *= (float)Main.rand.Next(30, 61) * 0.1f; - int spark = Projectile.NewProjectile(nPC.Center.X, nPC.Center.Y, value15.X, value15.Y, ModContent.ProjectileType(), damage / 2, 0f, player.whoAmI, 0f, 0f); + velocity.Normalize(); + velocity *= (float)Main.rand.Next(30, 61) * 0.1f; + int spark = Projectile.NewProjectile(npc.Center, velocity, ModContent.ProjectileType(), damage / 2, 0f, player.whoAmI, 0f, 0f); Main.projectile[spark].Calamity().forceTypeless = true; Main.projectile[spark].localNPCHitCooldown = -2; Main.projectile[spark].penetrate = 5; @@ -3303,7 +3323,7 @@ namespace CalamityMod.CalPlayer } // Brimstone Elemental lore inferno potion boost - if (modPlayer.brimstoneElementalLore && player.inferno) + if ((modPlayer.brimstoneElementalLore || modPlayer.ataxiaBlaze) && player.inferno) { const int FramesPerHit = 30; @@ -3320,15 +3340,15 @@ namespace CalamityMod.CalPlayer for (int i = 0; i < Main.maxNPCs; ++i) { - NPC nPC = Main.npc[i]; - if (!nPC.active || nPC.friendly || nPC.damage <= 0 || nPC.dontTakeDamage) + NPC npc = Main.npc[i]; + if (!npc.active || npc.friendly || npc.damage <= 0 || npc.dontTakeDamage) continue; - if (Vector2.Distance(player.Center, nPC.Center) <= range) + if (Vector2.Distance(player.Center, npc.Center) <= range) { - nPC.AddBuff(ModContent.BuffType(), 120); + npc.AddBuff(ModContent.BuffType(), 120); if (modPlayer.brimLoreInfernoTimer == 0) - Projectile.NewProjectileDirect(nPC.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, player.whoAmI, i); + Projectile.NewProjectileDirect(npc.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, player.whoAmI, i); } } } @@ -3347,6 +3367,7 @@ namespace CalamityMod.CalPlayer player.npcTypeNoAggro[ModContent.NPCType()] = true; player.npcTypeNoAggro[ModContent.NPCType()] = true; player.npcTypeNoAggro[ModContent.NPCType()] = true; + player.npcTypeNoAggro[ModContent.NPCType()] = true; // LATER -- When Wulfrum Slimes start being definitely robots, remove this immunity. player.npcTypeNoAggro[ModContent.NPCType()] = true; } @@ -3356,17 +3377,17 @@ namespace CalamityMod.CalPlayer player.buffImmune[ModContent.BuffType()] = true; player.buffImmune[BuffID.Poisoned] = true; player.buffImmune[BuffID.Venom] = true; - if (player.statLife <= (int)((double)player.statLifeMax2 * 0.75)) + if (player.statLife <= (int)(player.statLifeMax2 * 0.75)) { player.allDamage += 0.06f; modPlayer.AllCritBoost(3); } - if (player.statLife <= (int)((double)player.statLifeMax2 * 0.5)) + if (player.statLife <= (int)(player.statLifeMax2 * 0.5)) { player.allDamage += 0.06f; modPlayer.AllCritBoost(3); } - if (player.statLife <= (int)((double)player.statLifeMax2 * 0.25)) + if (player.statLife <= (int)(player.statLifeMax2 * 0.25)) { player.allDamage += 0.06f; modPlayer.AllCritBoost(3); @@ -3380,7 +3401,7 @@ namespace CalamityMod.CalPlayer if (modPlayer.auricSet && modPlayer.silvaMelee) { - double multiplier = (double)player.statLife / (double)player.statLifeMax2; + double multiplier = player.statLife / (double)player.statLifeMax2; player.meleeDamage += (float)(multiplier * 0.2); //ranges from 1.2 times to 1 times } @@ -3406,9 +3427,10 @@ namespace CalamityMod.CalPlayer player.AddBuff(ModContent.BuffType(), 3600, true); if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 2) - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(232f * player.MinionDamage()), 2f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(232f * player.MinionDamage()), 2f, Main.myPlayer, 0f, 0f); } } + if (modPlayer.pArtifact) { if (player.whoAmI == Main.myPlayer) @@ -3417,6 +3439,8 @@ namespace CalamityMod.CalPlayer player.AddBuff(ModContent.BuffType(), 3600, true); bool crystal = modPlayer.profanedCrystal && !modPlayer.profanedCrystalForce; + bool summonSet = modPlayer.tarraSummon || modPlayer.bloodflareSummon || modPlayer.godSlayerSummon || modPlayer.silvaSummon || modPlayer.dsSetBonus || modPlayer.omegaBlueSet || modPlayer.fearmongerSet; + if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -6f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, 0f); @@ -3428,7 +3452,7 @@ namespace CalamityMod.CalPlayer Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -3f, ModContent.ProjectileType(), 1, 1f, Main.myPlayer, 0f, 0f); } - if (crystal || (modPlayer.tarraSummon || modPlayer.bloodflareSummon || modPlayer.godSlayerSummon || modPlayer.silvaSummon || modPlayer.dsSetBonus || modPlayer.omegaBlueSet || modPlayer.fearmongerSet)) + if (crystal || summonSet) { player.Calamity().gOffense = true; @@ -3437,6 +3461,7 @@ namespace CalamityMod.CalPlayer } } } + if (modPlayer.profanedCrystalBuffs && modPlayer.gOffense && modPlayer.gDefense) { if (player.whoAmI == Main.myPlayer) @@ -3458,7 +3483,7 @@ namespace CalamityMod.CalPlayer player.moveSpeed += 0.25f; player.statDefense -= 15; if (!player.Calamity().yharonLore) - player.wingTimeMax = (int)((float)player.wingTimeMax * 1.1f); + player.wingTimeMax = (int)(player.wingTimeMax * 1.1f); player.ignoreWater = true; } else @@ -3468,7 +3493,7 @@ namespace CalamityMod.CalPlayer player.statDefense += 15; player.lifeRegen += 5; } - bool enrage = player.statLife <= (int)((double)player.statLifeMax2 * 0.5); + bool enrage = player.statLife <= (int)(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); @@ -3477,10 +3502,37 @@ namespace CalamityMod.CalPlayer 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; + int fire = Dust.NewDust(player.position, player.width, player.height, special ? 231 : (int)CalamityDusts.ProfanedFire, 0f, 0f, 100, special ? Color.DarkRed : default, 1f); + Main.dust[fire].scale = special ? 1.169f : 2f; + Main.dust[fire].noGravity = true; + Main.dust[fire].velocity *= special ? 10f : 6.9f; + } + } + } + } + + if (modPlayer.plaguebringerPistons) + { + //Spawn bees while sprinting or dashing + modPlayer.pistonsCounter++; + if (modPlayer.pistonsCounter % 12 == 0) + { + if (player.velocity.Length() >= 5f && player.whoAmI == Main.myPlayer) + { + int beeCount = 1; + if (Main.rand.NextBool(3)) + ++beeCount; + if (Main.rand.NextBool(3)) + ++beeCount; + if (player.strongBees && Main.rand.NextBool(3)) + ++beeCount; + int damage = (int)(30 * player.MinionDamage()); + for (int index = 0; index < beeCount; ++index) + { + int bee = Projectile.NewProjectile(player.Center.X, player.Center.Y, Main.rand.NextFloat(-35f, 35f) * 0.02f, Main.rand.NextFloat(-35f, 35f) * 0.02f, (Main.rand.NextBool(4) ? ModContent.ProjectileType() : player.beeType()), damage, player.beeKB(0f), player.whoAmI, 0f, 0f); + Main.projectile[bee].usesLocalNPCImmunity = true; + Main.projectile[bee].localNPCHitCooldown = 10; + Main.projectile[bee].penetrate = 2; } } } @@ -3522,7 +3574,7 @@ namespace CalamityMod.CalPlayer if (player.whoAmI == Main.myPlayer) { if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(30 * player.RogueDamage()), 0f, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(30 * player.RogueDamage()), 0f, player.whoAmI, 0f, 0f); } } else if (player.ownedProjectileCounts[ModContent.ProjectileType()] != 0) @@ -3544,8 +3596,18 @@ namespace CalamityMod.CalPlayer { if (player.whoAmI == Main.myPlayer) { + //Reduce the buffTime of Electrified + for (int l = 0; l < Player.MaxBuffs; l++) + { + bool electrified = player.buffType[l] == BuffID.Electrified; + if (player.buffTime[l] > 2 && electrified) + { + player.buffTime[l]--; + } + } + //Summon the aura if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(10 * player.AverageDamage()), 0f, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(10 * player.AverageDamage()), 0f, player.whoAmI, 0f, 0f); } } else if (player.ownedProjectileCounts[ModContent.ProjectileType()] != 0) @@ -3571,12 +3633,12 @@ namespace CalamityMod.CalPlayer Vector2 velocity = Main.MouseWorld - startPos; if (player.gravDir == -1f) { - velocity.Y = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - startPos.Y; + velocity.Y = Main.screenPosition.Y + Main.screenHeight - Main.mouseY - startPos.Y; } float travelDist = velocity.Length(); if ((float.IsNaN(velocity.X) && float.IsNaN(velocity.Y)) || (velocity.X == 0f && velocity.Y == 0f)) { - velocity.X = (float)player.direction; + velocity.X = player.direction; velocity.Y = 0f; travelDist = shootSpeed; } @@ -3588,11 +3650,11 @@ namespace CalamityMod.CalPlayer int laserAmt = Main.rand.Next(2); for (int index = 0; index < laserAmt; index++) { - startPos = new Vector2(player.Center.X + (float)(Main.rand.Next(201) * -(float)player.direction) + (Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); - startPos.X = (startPos.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); - startPos.Y -= (float)(100 * index); - velocity.X = (float)Main.mouseX + Main.screenPosition.X - startPos.X; - velocity.Y = (float)Main.mouseY + Main.screenPosition.Y - startPos.Y; + startPos = new Vector2(player.Center.X + (Main.rand.Next(201) * -(float)player.direction) + (Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); + startPos.X = (startPos.X + player.Center.X) / 2f + Main.rand.Next(-200, 201); + startPos.Y -= 100 * index; + velocity.X = Main.mouseX + Main.screenPosition.X - startPos.X; + velocity.Y = Main.mouseY + Main.screenPosition.Y - startPos.Y; if (velocity.Y < 0f) { velocity.Y *= -1f; @@ -3605,12 +3667,12 @@ namespace CalamityMod.CalPlayer travelDist = shootSpeed / travelDist; velocity.X *= travelDist; velocity.Y *= travelDist; - velocity.X += (float)Main.rand.Next(-50, 51) * 0.02f; - velocity.Y += (float)Main.rand.Next(-50, 51) * 0.02f; - int laser = Projectile.NewProjectile(startPos, velocity, ModContent.ProjectileType(), dmg, 4f, player.whoAmI, 0f, Main.rand.Next(10)); + velocity.X += Main.rand.Next(-50, 51) * 0.02f; + velocity.Y += Main.rand.Next(-50, 51) * 0.02f; + int laser = Projectile.NewProjectile(startPos, velocity, ModContent.ProjectileType(), dmg, 4f, player.whoAmI, 0f, 0f); Main.projectile[laser].localNPCHitCooldown = 5; } - Main.PlaySound(SoundID.Item12, player.position); + Main.PlaySound(SoundID.Item12, player.Center); } if (modPlayer.prismaticLasers == 1800) { @@ -3638,13 +3700,13 @@ namespace CalamityMod.CalPlayer new Color(255, 0, 255, 50), //Fuschia new Color(255, 0, 128, 50) //Hot Pink }); - Vector2 vector6 = Vector2.Normalize(player.velocity) * new Vector2((float)player.width / 2f, (float)player.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(dustIndex - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + player.Center; - Vector2 vector7 = vector6 - player.Center; - int dusty = Dust.NewDust(vector6 + vector7, 0, 0, 267, vector7.X * 1f, vector7.Y * 1f, 100, color, 1f); + Vector2 source = Vector2.Normalize(player.velocity) * new Vector2(player.width / 2f, player.height) * 0.75f; + source = source.RotatedBy((dustIndex - (dustAmt / 2 - 1)) * MathHelper.TwoPi / dustAmt, default) + player.Center; + Vector2 dustVel = source - player.Center; + int dusty = Dust.NewDust(source + dustVel, 0, 0, 267, dustVel.X * 1f, dustVel.Y * 1f, 100, color, 1f); Main.dust[dusty].noGravity = true; Main.dust[dusty].noLight = true; - Main.dust[dusty].velocity = vector7; + Main.dust[dusty].velocity = dustVel; } } @@ -3671,6 +3733,19 @@ namespace CalamityMod.CalPlayer if (CalamityConfig.Instance.Proficiency) modPlayer.GetStatBonuses(); + + // True melee damage bonuses + double damageAdd = (modPlayer.dodgeScarf ? 0.15 : 0) + + (modPlayer.evasionScarf ? 0.1 : 0) + + ((modPlayer.aBulwarkRare && modPlayer.aBulwarkRareMeleeBoostTimer > 0) ? 0.5 : 0) + + (modPlayer.DoGLore ? 0.25 : 0) + + (modPlayer.fungalSymbiote ? 0.15 : 0) + + ((player.head == ArmorIDs.Head.MoltenHelmet && player.body == ArmorIDs.Body.MoltenBreastplate && player.legs == ArmorIDs.Legs.MoltenGreaves) ? 0.2 : 0) + + (player.kbGlove ? 0.1 : 0) + + (modPlayer.eGauntlet ? 0.1 : 0) + + (modPlayer.yInsignia ? 0.1 : 0) + + (modPlayer.badgeOfBraveryRare ? 0.2 : 0); + modPlayer.trueMeleeDamage += damageAdd; } #endregion @@ -3692,13 +3767,14 @@ namespace CalamityMod.CalPlayer } } - /*if (player.meleeSpeed < 0.5f) - player.meleeSpeed = 0.5f;*/ - // 10% is converted to 9%, 25% is converted to 20%, 50% is converted to 33%, 75% is converted to 43%, 100% is converted to 50% if (player.endurance > 0f) player.endurance = 1f - (1f / (1f + player.endurance)); + // Very similar scaling to damage reduction. Ex. Frog Leg goes from 48% jump speed to 38% + //if (player.jumpSpeedBoost > 0f) + // player.jumpSpeedBoost = (1f - 1f / (1f + (player.jumpSpeedBoost / 10f))) * 10f + if (modPlayer.yharonLore && !CalamityWorld.defiled) { if (player.wingTimeMax < 50000) @@ -3737,15 +3813,17 @@ namespace CalamityMod.CalPlayer private static void UpdateStatMeter(Player player, CalamityPlayer modPlayer) { float allDamageStat = player.allDamage - 1f; + modPlayer.actualMeleeDamageStat = player.meleeDamage + allDamageStat; modPlayer.damageStats[0] = (int)((player.meleeDamage + allDamageStat - 1f) * 100f); modPlayer.damageStats[1] = (int)((player.rangedDamage + allDamageStat - 1f) * 100f); modPlayer.damageStats[2] = (int)((player.magicDamage + allDamageStat - 1f) * 100f); modPlayer.damageStats[3] = (int)((player.minionDamage + allDamageStat - 1f) * 100f); modPlayer.damageStats[4] = (int)((modPlayer.throwingDamage + allDamageStat - 1f) * 100f); + modPlayer.damageStats[5] = (int)(modPlayer.trueMeleeDamage * 100D); modPlayer.critStats[0] = player.meleeCrit; modPlayer.critStats[1] = player.rangedCrit; modPlayer.critStats[2] = player.magicCrit; - modPlayer.critStats[3] = modPlayer.throwingCrit; + modPlayer.critStats[3] = player.thrownCrit + modPlayer.throwingCrit; modPlayer.ammoReductionRanged = (int)(100f * (player.ammoBox ? 0.8f : 1f) * (player.ammoPotion ? 0.8f : 1f) * @@ -3773,7 +3851,11 @@ namespace CalamityMod.CalPlayer modPlayer.manaRegenStat = player.manaRegen; modPlayer.armorPenetrationStat = player.armorPenetration; modPlayer.moveSpeedStat = (int)((player.moveSpeed - 1f) * 100f); - modPlayer.wingFlightTimeStat = player.wingTimeMax; + modPlayer.wingFlightTimeStat = player.wingTimeMax / 60f; + float trueJumpSpeedBoost = player.jumpSpeedBoost + + (player.wereWolf ? 0.2f : 0f) + + (player.jumpBoost ? 1.5f : 0f); + modPlayer.jumpSpeedStat = trueJumpSpeedBoost * 20f; modPlayer.adrenalineChargeStat = 45 - (modPlayer.adrenalineBoostOne ? 10 : 0) - (modPlayer.adrenalineBoostTwo ? 10 : 0) - @@ -3790,7 +3872,7 @@ namespace CalamityMod.CalPlayer #region Rogue Mirrors private static void RogueMirrors(Player player, CalamityPlayer modPlayer) { - Rectangle rectangle = new Rectangle((int)((double)player.position.X + (double)player.velocity.X * 0.5 - 4.0), (int)((double)player.position.Y + (double)player.velocity.Y * 0.5 - 4.0), player.width + 8, player.height + 8); + Rectangle rectangle = new Rectangle((int)(player.position.X + player.velocity.X * 0.5f - 4f), (int)(player.position.Y + player.velocity.Y * 0.5f - 4f), player.width + 8, player.height + 8); for (int i = 0; i < Main.maxNPCs; i++) { NPC npc = Main.npc[i]; diff --git a/CalamityConfig.cs b/CalamityConfig.cs index a4686a4d84..ba3be07e85 100644 --- a/CalamityConfig.cs +++ b/CalamityConfig.cs @@ -64,7 +64,7 @@ namespace CalamityMod [BackgroundColor(192, 54, 64, 192)] [Label("Lock Meter Positions")] - [DefaultValue(false)] + [DefaultValue(true)] [Tooltip("Prevents clicking on the Stealth, Rage and Adrenaline Meters.\nThis stops them from being dragged around with the mouse.")] public bool MeterPosLock { get; set; } @@ -116,6 +116,12 @@ namespace CalamityMod [Tooltip("Increases the player's mining speed by 75%.\nThis does not affect drills.")] public bool MiningSpeedBoost { get; set; } + [Label("Boss Zen")] + [BackgroundColor(192, 54, 64, 192)] + [DefaultValue(true)] + [Tooltip("While a boss is alive, all players receive the Boss Zen buff which drastically reduces enemy spawn rates.")] + public bool BossZen { get; set; } + [Label("Never Weaken Reactive Boss DR")] [BackgroundColor(192, 54, 64, 192)] [DefaultValue(false)] diff --git a/CalamityMod.cs b/CalamityMod.cs index c4869db4a4..c1c5e06629 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -20,6 +20,7 @@ using CalamityMod.Items.Placeables; using CalamityMod.Items.Placeables.Furniture.Trophies; using CalamityMod.Items.Tools; using CalamityMod.Items.TreasureBags; +using CalamityMod.Items.Weapons.DraedonsArsenal; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; @@ -59,15 +60,20 @@ using CalamityMod.NPCs.SunkenSea; using CalamityMod.NPCs.SupremeCalamitas; using CalamityMod.NPCs.Yharon; using CalamityMod.Projectiles.Boss; +using CalamityMod.Projectiles.DraedonsArsenal; using CalamityMod.Projectiles.Enemy; using CalamityMod.Projectiles.Hybrid; using CalamityMod.Projectiles.Magic; using CalamityMod.Projectiles.Melee; +using CalamityMod.Projectiles.Melee.Spears; using CalamityMod.Projectiles.Ranged; using CalamityMod.Projectiles.Rogue; using CalamityMod.Projectiles.Summon; -using CalamityMod.Tiles.LivingFire; +using CalamityMod.Schematics; using CalamityMod.Skies; +using CalamityMod.TileEntities; +using CalamityMod.Tiles; +using CalamityMod.Tiles.LivingFire; using CalamityMod.UI; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -108,10 +114,9 @@ namespace CalamityMod // Boss Spawners public static int ghostKillCount = 0; public static int sharkKillCount = 0; - public static int astralKillCount = 0; // Textures & Shaders - public static Texture2D heartOriginal2; + public static Texture2D heartOriginal2; public static Texture2D heartOriginal; public static Texture2D rainOriginal; public static Texture2D manaOriginal; @@ -122,6 +127,7 @@ namespace CalamityMod public static Effect CustomShader; public static Effect LightShader; public static Effect TentacleShader; + public static Effect LightDistortionShader; // DR data structure public static SortedDictionary DRValues; @@ -136,6 +142,7 @@ namespace CalamityMod // Lists public static IList donatorList; + public static List trueMeleeProjectileList; // DO NOT, EVER, DELETE THIS LIST, OR I WILL COME FOR YOU :D public static List rangedProjectileExceptionList; public static List projectileDestroyExceptionList; public static List projectileMinionList; @@ -146,6 +153,7 @@ namespace CalamityMod public static List bossHPScaleList; public static List beeEnemyList; public static List beeProjectileList; + public static List friendlyBeeList; public static List hardModeNerfList; public static List debuffList; public static List fireWeaponList; @@ -178,6 +186,7 @@ namespace CalamityMod public static List revengeanceProjectileBuffList5Percent; public static List revengeanceLifeStealExceptionList; public static List movementImpairImmuneList; + public static List needsDebuffIconDisplayList; public static List trapProjectileList; public static List scopedWeaponList; public static List boomerangList; @@ -203,6 +212,7 @@ namespace CalamityMod public static List angryBonesList; public static List hornetList; public static List mossHornetList; + public static List bossMinionList; public static List legOverrideList; @@ -240,7 +250,6 @@ namespace CalamityMod } ILChanges.Initialize(); - thorium = ModLoader.GetMod("ThoriumMod"); BossHealthBarManager.Load(this); @@ -264,10 +273,6 @@ namespace CalamityMod AddEquipTexture(new SirenBody(), null, EquipType.Body, "SirenBody", "CalamityMod/Items/Accessories/SirenTrans_Body", "CalamityMod/Items/Accessories/SirenTrans_Arms"); AddEquipTexture(new SirenLegs(), null, EquipType.Legs, "SirenLeg", "CalamityMod/Items/Accessories/SirenTrans_Legs"); - AddEquipTexture(new SirenHeadAlt(), null, EquipType.Head, "SirenHeadAlt", "CalamityMod/Items/Accessories/SirenTransAlt_Head"); - AddEquipTexture(new SirenBodyAlt(), null, EquipType.Body, "SirenBodyAlt", "CalamityMod/Items/Accessories/SirenTransAlt_Body", "CalamityMod/Items/Accessories/SirenTransAlt_Arms"); - AddEquipTexture(new SirenLegsAlt(), null, EquipType.Legs, "SirenLegAlt", "CalamityMod/Items/Accessories/SirenTransAlt_Legs"); - AddEquipTexture(new AndromedaHead(), null, EquipType.Head, "NoHead", "CalamityMod/ExtraTextures/AndromedaWithout_Head"); AddEquipTexture(new PopoHead(), null, EquipType.Head, "PopoHead", "CalamityMod/Items/Accessories/Vanity/Popo_Head"); @@ -282,12 +287,19 @@ namespace CalamityMod AddEquipTexture(new SnowRuffianWings(), null, EquipType.Wings, "SnowRuffWings", "CalamityMod/Items/Armor/SnowRuffianWings"); + AddEquipTexture(new MeldTransformationHead(), null, EquipType.Head, "MeldTransformationHead", "CalamityMod/Items/Armor/MeldTransformation_Head"); + AddEquipTexture(new MeldTransformationBody(), null, EquipType.Body, "MeldTransformationBody", "CalamityMod/Items/Armor/MeldTransformation_Body", "CalamityMod/Items/Armor/MeldTransformation_Arms"); + AddEquipTexture(new MeldTransformationLegs(), null, EquipType.Legs, "MeldTransformationLegs", "CalamityMod/Items/Armor/MeldTransformation_Legs"); + + AddEquipTexture(new AbyssDivingGearHair(), null, EquipType.Head, "AbyssDivingGearHead", "CalamityMod/Items/Accessories/AbyssalDivingGear_Face"); + AstralCactusTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/Tiles/AstralCactus"); AstralCactusGlowTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/Tiles/AstralCactusGlow"); AstralSky = ModContent.GetTexture("CalamityMod/ExtraTextures/AstralSky"); CustomShader = GetEffect("Effects/CustomShader"); LightShader = GetEffect("Effects/LightBurstShader"); TentacleShader = GetEffect("Effects/TentacleShader"); + LightDistortionShader = GetEffect("Effects/DistortionShader"); Filters.Scene["CalamityMod:DevourerofGodsHead"] = new Filter(new DoGScreenShaderData("FilterMiniTower").UseColor(0.4f, 0.1f, 1.0f).UseOpacity(0.5f), EffectPriority.VeryHigh); SkyManager.Instance["CalamityMod:DevourerofGodsHead"] = new DoGSky(); @@ -323,6 +335,7 @@ namespace CalamityMod Filters.Scene["CalamityMod:LightBurst"].Load(); GameShaders.Misc["CalamityMod:SubsumingTentacle"] = new MiscShaderData(new Ref(TentacleShader), "BurstPass"); + GameShaders.Misc["CalamityMod:LightDistortion"] = new MiscShaderData(new Ref(LightDistortionShader), "DistortionPass"); RipperUI.Reset(); AstralArcanumUI.Load(this); @@ -331,6 +344,10 @@ namespace CalamityMod GameShaders.Hair.BindShader(ModContent.ItemType(), new LegacyHairShaderData().UseLegacyMethod((Player player, Color newColor, ref bool lighting) => Color.Lerp(player.hairColor, new Color(255, 83, 48), ((float)player.Calamity().rage / (float)player.Calamity().rageMax)))); GameShaders.Hair.BindShader(ModContent.ItemType(), new LegacyHairShaderData().UseLegacyMethod((Player player, Color newColor, ref bool lighting) => Color.Lerp(player.hairColor, new Color(139, 205, 255), ((float)player.wingTime / (float)player.wingTimeMax)))); GameShaders.Hair.BindShader(ModContent.ItemType(), new LegacyHairShaderData().UseLegacyMethod((Player player, Color newColor, ref bool lighting) => Color.Lerp(player.hairColor, new Color(186, 85, 211), (player.Calamity().rogueStealth / player.Calamity().rogueStealthMax)))); + + SchematicLoader.LoadEverything(); + + PopupGUIManager.LoadGUIs(); } #endregion @@ -361,6 +378,7 @@ namespace CalamityMod bossVelocityDamageScaleValues = null; donatorList = null; + trueMeleeProjectileList = null; rangedProjectileExceptionList = null; projectileDestroyExceptionList = null; projectileMinionList = null; @@ -370,6 +388,7 @@ namespace CalamityMod bossScaleList = null; bossHPScaleList = null; beeEnemyList = null; + friendlyBeeList = null; beeProjectileList = null; hardModeNerfList = null; debuffList = null; @@ -402,6 +421,7 @@ namespace CalamityMod revengeanceProjectileBuffList5Percent = null; revengeanceLifeStealExceptionList = null; movementImpairImmuneList = null; + needsDebuffIconDisplayList = null; trapProjectileList = null; scopedWeaponList = null; boomerangList = null; @@ -427,6 +447,7 @@ namespace CalamityMod angryBonesList = null; hornetList = null; mossHornetList = null; + bossMinionList = null; legOverrideList = null; @@ -435,6 +456,8 @@ namespace CalamityMod Instance = null; + PopupGUIManager.UnloadGUIs(); + SchematicLoader.UnloadEverything(); BossHealthBarManager.Unload(); base.Unload(); @@ -458,7 +481,7 @@ namespace CalamityMod rainOriginal = null; manaOriginal = null; carpetOriginal = null; - } + } #endregion #region Late Loading @@ -615,7 +638,88 @@ namespace CalamityMod "RKMoon" }; - rangedProjectileExceptionList = new List() + trueMeleeProjectileList = new List() + { + // Vanilla shit + ProjectileID.Spear, + ProjectileID.Trident, + ProjectileID.TheRottedFork, + ProjectileID.Swordfish, + ProjectileID.Arkhalis, + ProjectileID.DarkLance, + ProjectileID.CobaltNaginata, + ProjectileID.PalladiumPike, + ProjectileID.MythrilHalberd, + ProjectileID.OrichalcumHalberd, + ProjectileID.AdamantiteGlaive, + ProjectileID.TitaniumTrident, + ProjectileID.MushroomSpear, + ProjectileID.Gungnir, + ProjectileID.ObsidianSwordfish, + ProjectileID.ChlorophytePartisan, + ProjectileID.MonkStaffT1, + ProjectileID.MonkStaffT2, + ProjectileID.MonkStaffT3, + ProjectileID.NorthPoleWeapon, + + // Tools + ProjectileID.CobaltDrill, + ProjectileID.MythrilDrill, + ProjectileID.AdamantiteDrill, + ProjectileID.PalladiumDrill, + ProjectileID.OrichalcumDrill, + ProjectileID.TitaniumDrill, + ProjectileID.ChlorophyteDrill, + ProjectileID.CobaltChainsaw, + ProjectileID.MythrilChainsaw, + ProjectileID.AdamantiteChainsaw, + ProjectileID.PalladiumChainsaw, + ProjectileID.OrichalcumChainsaw, + ProjectileID.TitaniumChainsaw, + ProjectileID.ChlorophyteChainsaw, + ProjectileID.VortexDrill, + ProjectileID.VortexChainsaw, + ProjectileID.NebulaDrill, + ProjectileID.NebulaChainsaw, + ProjectileID.SolarFlareDrill, + ProjectileID.SolarFlareChainsaw, + ProjectileID.StardustDrill, + ProjectileID.StardustChainsaw, + ProjectileID.Hamdrax, + ProjectileID.ChlorophyteJackhammer, + ProjectileID.SawtoothShark, + ProjectileID.ButchersChainsaw, + + // Calamity shit + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType() + }; + + rangedProjectileExceptionList = new List() { ProjectileID.Phantasm, ProjectileID.VortexBeater, @@ -644,7 +748,10 @@ namespace CalamityMod ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType(), - ModContent.ProjectileType() + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), // Because of potential dust lag. + ModContent.ProjectileType() }; projectileDestroyExceptionList = new List() @@ -675,6 +782,8 @@ namespace CalamityMod ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), //Some hostile boss projectiles ModContent.ProjectileType(), @@ -902,6 +1011,17 @@ namespace CalamityMod ModContent.ProjectileType() }; + friendlyBeeList = new List() + { + ProjectileID.GiantBee, + ProjectileID.Bee, + ProjectileID.Wasp, + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType() + }; + hardModeNerfList = new List() { ProjectileID.WebSpit, @@ -963,8 +1083,10 @@ namespace CalamityMod ModContent.BuffType(), ModContent.BuffType(), ModContent.BuffType(), - ModContent.BuffType() - }; + ModContent.BuffType(), + ModContent.BuffType(), + ModContent.BuffType() + }; fireWeaponList = new List() { @@ -1062,7 +1184,8 @@ namespace CalamityMod ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType() + ModContent.ItemType(), + ModContent.ItemType() }; iceWeaponList = new List() @@ -1238,7 +1361,13 @@ namespace CalamityMod ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType() + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType() }; alcoholList = new List() @@ -1798,7 +1927,6 @@ namespace CalamityMod ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType(), - ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType(), @@ -1868,6 +1996,11 @@ namespace CalamityMod NPCID.QueenBee, }; + needsDebuffIconDisplayList = new List() + { + NPCID.WallofFleshEye + }; + trapProjectileList = new List() { ProjectileID.PoisonDartTrap, @@ -2008,7 +2141,7 @@ namespace CalamityMod ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType(), - ModContent.ProjectileType(), + ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType() }; @@ -2122,7 +2255,8 @@ namespace CalamityMod ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType() + ModContent.ItemType(), + ModContent.ItemType() }; flaskBombProjList = new List() @@ -2152,7 +2286,8 @@ namespace CalamityMod ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType(), - ModContent.ProjectileType() + ModContent.ProjectileType(), + ModContent.ProjectileType() }; spikyBallList = new List() @@ -2295,6 +2430,7 @@ namespace CalamityMod ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), + ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), @@ -2349,80 +2485,117 @@ namespace CalamityMod ItemID.SuperHealingPotion }; - livingFireBlockList = new List() - { - ModContent.TileType(), - ModContent.TileType(), - ModContent.TileType(), + livingFireBlockList = new List() + { + ModContent.TileType(), + ModContent.TileType(), + ModContent.TileType(), TileID.LivingFire, TileID.LivingCursedFire, TileID.LivingDemonFire, TileID.LivingFrostFire, TileID.LivingIchor, TileID.LivingUltrabrightFire - }; + }; - zombieList = new List() - { - NPCID.Zombie, - NPCID.ArmedZombie, - NPCID.BaldZombie, - NPCID.PincushionZombie, - NPCID.ArmedZombiePincussion, // what is this spelling - NPCID.SlimedZombie, - NPCID.ArmedZombieSlimed, - NPCID.SwampZombie, - NPCID.ArmedZombieSwamp, - NPCID.TwiggyZombie, - NPCID.ArmedZombieTwiggy, - NPCID.FemaleZombie, - NPCID.ArmedZombieCenx, - NPCID.ZombieRaincoat, - NPCID.ZombieEskimo, - NPCID.ArmedZombieEskimo - // halloween zombies not included because they don't drop shackles or zombie arms - }; + zombieList = new List() + { + NPCID.Zombie, + NPCID.ArmedZombie, + NPCID.BaldZombie, + NPCID.PincushionZombie, + NPCID.ArmedZombiePincussion, // what is this spelling + NPCID.SlimedZombie, + NPCID.ArmedZombieSlimed, + NPCID.SwampZombie, + NPCID.ArmedZombieSwamp, + NPCID.TwiggyZombie, + NPCID.ArmedZombieTwiggy, + NPCID.FemaleZombie, + NPCID.ArmedZombieCenx, + NPCID.ZombieRaincoat, + NPCID.ZombieEskimo, + NPCID.ArmedZombieEskimo, + NPCID.BigRainZombie, + NPCID.SmallRainZombie, + NPCID.BigFemaleZombie, + NPCID.SmallFemaleZombie, + NPCID.BigTwiggyZombie, + NPCID.SmallTwiggyZombie, + NPCID.BigSwampZombie, + NPCID.SmallSwampZombie, + NPCID.BigSlimedZombie, + NPCID.SmallSlimedZombie, + NPCID.BigPincushionZombie, + NPCID.SmallPincushionZombie, + NPCID.BigBaldZombie, + NPCID.SmallBaldZombie, + NPCID.BigZombie, + NPCID.SmallZombie + // halloween zombies not included because they don't drop shackles or zombie arms + }; - demonEyeList = new List() - { - NPCID.DemonEye, - NPCID.CataractEye, - NPCID.SleepyEye, - NPCID.DialatedEye, // it is spelled "dilated" - NPCID.GreenEye, - NPCID.PurpleEye, - NPCID.DemonEyeOwl, - NPCID.DemonEyeSpaceship - }; + demonEyeList = new List() + { + NPCID.DemonEye, + NPCID.CataractEye, + NPCID.SleepyEye, + NPCID.DialatedEye, // it is spelled "dilated" + NPCID.GreenEye, + NPCID.PurpleEye, + NPCID.DemonEyeOwl, + NPCID.DemonEyeSpaceship, + NPCID.DemonEye2, + NPCID.PurpleEye2, + NPCID.GreenEye2, + NPCID.DialatedEye2, + NPCID.SleepyEye2, + NPCID.CataractEye2 + }; - skeletonList = new List() - { - NPCID.Skeleton, - NPCID.ArmoredSkeleton, - NPCID.SkeletonArcher, - NPCID.HeadacheSkeleton, - NPCID.MisassembledSkeleton, - NPCID.PantlessSkeleton, - NPCID.SkeletonTopHat, - NPCID.SkeletonAstonaut, - NPCID.SkeletonAlien, - NPCID.BoneThrowingSkeleton, - NPCID.BoneThrowingSkeleton2, - NPCID.BoneThrowingSkeleton3, - NPCID.BoneThrowingSkeleton4, - NPCID.GreekSkeleton - }; + skeletonList = new List() + { + NPCID.Skeleton, + NPCID.HeadacheSkeleton, + NPCID.MisassembledSkeleton, + NPCID.PantlessSkeleton, + NPCID.BoneThrowingSkeleton, + NPCID.BoneThrowingSkeleton2, + NPCID.BoneThrowingSkeleton3, + NPCID.BoneThrowingSkeleton4, + NPCID.BigPantlessSkeleton, + NPCID.SmallPantlessSkeleton, + NPCID.BigMisassembledSkeleton, + NPCID.SmallMisassembledSkeleton, + NPCID.BigHeadacheSkeleton, + NPCID.SmallHeadacheSkeleton, + NPCID.BigSkeleton, + NPCID.SmallSkeleton, - angryBonesList = new List() - { - NPCID.AngryBones, - NPCID.AngryBonesBig, - NPCID.AngryBonesBigMuscle, - NPCID.AngryBonesBigHelmet - }; + //Note: These skeletons don't count for Skeleton Banner for some god forsaken reason + NPCID.SkeletonTopHat, + NPCID.SkeletonAstonaut, + NPCID.SkeletonAlien, - hornetList = new List() - { + //Other skeleton types + NPCID.ArmoredSkeleton, + NPCID.HeavySkeleton, + NPCID.SkeletonArcher, + NPCID.GreekSkeleton + }; + + angryBonesList = new List() + { + NPCID.AngryBones, + NPCID.AngryBonesBig, + NPCID.AngryBonesBigMuscle, + NPCID.AngryBonesBigHelmet, + NPCID.BigBoned, + NPCID.ShortBones + }; + + hornetList = new List() + { NPCID.BigHornetStingy, NPCID.LittleHornetStingy, NPCID.BigHornetSpikey, @@ -2436,20 +2609,121 @@ namespace CalamityMod NPCID.BigStinger, NPCID.LittleStinger, NPCID.Hornet, - NPCID.HornetFatty, - NPCID.HornetHoney, - NPCID.HornetLeafy, - NPCID.HornetSpikey, - NPCID.HornetStingy - }; + NPCID.HornetFatty, + NPCID.HornetHoney, + NPCID.HornetLeafy, + NPCID.HornetSpikey, + NPCID.HornetStingy + }; - mossHornetList = new List() + mossHornetList = new List() + { + NPCID.MossHornet, + NPCID.TinyMossHornet, + NPCID.LittleMossHornet, + NPCID.BigMossHornet, + NPCID.GiantMossHornet + }; + + bossMinionList = new List() { - NPCID.MossHornet, - NPCID.TinyMossHornet, - NPCID.LittleMossHornet, - NPCID.BigMossHornet, - NPCID.GiantMossHornet + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + NPCID.SlimeSpiked, + NPCID.ServantofCthulhu, + ModContent.NPCType(), + NPCID.EaterofWorldsHead, + NPCID.EaterofWorldsBody, + NPCID.EaterofWorldsTail, + NPCID.Creeper, + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + NPCID.SkeletronHand, + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + NPCID.LeechHead, + NPCID.LeechBody, + NPCID.LeechTail, + NPCID.WallofFleshEye, + NPCID.TheHungry, + NPCID.TheHungryII, + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + NPCID.PrimeCannon, + NPCID.PrimeLaser, + NPCID.PrimeSaw, + NPCID.PrimeVice, + ModContent.NPCType(), + NPCID.TheDestroyer, + NPCID.TheDestroyerBody, + NPCID.TheDestroyerTail, + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + NPCID.PlanterasTentacle, + ModContent.NPCType(), + NPCID.Spore, + NPCID.GolemHead, + NPCID.GolemHeadFree, + NPCID.GolemFistLeft, + NPCID.GolemFistRight, + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + NPCID.CultistDragonHead, + NPCID.CultistDragonBody1, + NPCID.CultistDragonBody2, + NPCID.CultistDragonBody3, + NPCID.CultistDragonBody4, + NPCID.CultistDragonTail, + NPCID.AncientCultistSquidhead, + NPCID.MoonLordFreeEye, + NPCID.MoonLordHand, + NPCID.MoonLordHead, + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType() }; Mod thorium = ModLoader.GetMod("ThoriumMod"); @@ -2750,8 +3024,8 @@ namespace CalamityMod { NPCID.Creeper, 1800 }, { NPCID.QueenBee, 7200 }, { NPCID.SkeletronHead, 9000 }, - { NPCID.WallofFlesh, 10800 }, - { NPCID.WallofFleshEye, 10800 }, + { NPCID.WallofFlesh, 7200 }, + { NPCID.WallofFleshEye, 7200 }, { NPCID.Spazmatism, 10800 }, { NPCID.Retinazer, 10800 }, { NPCID.TheDestroyer, 10800 }, @@ -3090,6 +3364,29 @@ namespace CalamityMod return true; }, InterfaceScaleType.None)); + layers.Insert(mouseIndex, new LegacyGameInterfaceLayer("Draedon Hologram", () => + { + DraedonHologramChatUI.Draw(Main.spriteBatch); + return true; + }, InterfaceScaleType.None)); + + layers.Insert(mouseIndex, new LegacyGameInterfaceLayer("Draedon Factory Tiles", () => + { + DraedonsFactoryUI.Draw(Main.spriteBatch); + DraedonsItemChargerUI.Draw(Main.spriteBatch); + return true; + }, InterfaceScaleType.Game)); // InterfaceScaleType.Game tells the game that this UI should take zoom into account. + + layers.Insert(mouseIndex, new LegacyGameInterfaceLayer("Boss HP Bars", delegate () + { + if (Main.LocalPlayer.Calamity().drawBossHPBar) + { + BossHealthBarManager.Update(); + BossHealthBarManager.Draw(Main.spriteBatch); + } + return true; + }, InterfaceScaleType.None)); + // Astral Arcanum overlay (if open) layers.Insert(mouseIndex, new LegacyGameInterfaceLayer("Astral Arcanum UI", delegate () { @@ -3110,6 +3407,13 @@ namespace CalamityMod StealthUI.Draw(Main.spriteBatch, Main.LocalPlayer); return true; }, InterfaceScaleType.None)); + + // Popup GUIs. + layers.Insert(mouseIndex, new LegacyGameInterfaceLayer("Popup GUIs", () => + { + PopupGUIManager.UpdateAndDraw(Main.spriteBatch); + return true; + }, InterfaceScaleType.None)); } // Invasion UI (used for Acid Rain) @@ -3712,9 +4016,17 @@ namespace CalamityMod int countdown2 = reader.ReadInt32(); CalamityWorld.bossSpawnCountdown = countdown2; break; - case CalamityModMessageType.DeathBossSpawnCountdownSync: + case CalamityModMessageType.BRHostileProjKillSync: int countdown3 = reader.ReadInt32(); - CalamityWorld.deathBossSpawnCooldown = countdown3; + CalamityWorld.bossRushHostileProjKillCounter = countdown3; + break; + case CalamityModMessageType.DeathBossSpawnCountdownSync: + int countdown4 = reader.ReadInt32(); + CalamityWorld.deathBossSpawnCooldown = countdown4; + break; + case CalamityModMessageType.ArmoredDiggerCountdownSync: + int countdown5 = reader.ReadInt32(); + CalamityWorld.ArmoredDiggerSpawnCooldown = countdown5; break; case CalamityModMessageType.BossTypeSync: int type = reader.ReadInt32(); @@ -3779,6 +4091,40 @@ namespace CalamityMod if (Main.netMode != NetmodeID.MultiplayerClient) NPC.NewNPC(x, y, ModContent.NPCType()); break; + case CalamityModMessageType.DraedonGeneratorStackSync: + (TileEntity.ByID[reader.ReadInt32()] as TEDraedonFuelFactory).HeldItem.stack = reader.ReadInt32(); + break; + case CalamityModMessageType.DraedonChargerSync: + int entityID = reader.ReadInt32(); + (TileEntity.ByID[entityID] as TEDraedonItemCharger).FuelItem.type = reader.ReadInt32(); + (TileEntity.ByID[entityID] as TEDraedonItemCharger).FuelItem.stack = reader.ReadInt32(); + (TileEntity.ByID[entityID] as TEDraedonItemCharger).ItemBeingCharged.type = reader.ReadInt32(); + (TileEntity.ByID[entityID] as TEDraedonItemCharger).ItemBeingCharged.stack = reader.ReadInt32(); + int currentCharge = reader.ReadInt32(); + if (currentCharge != -1) + { + (TileEntity.ByID[entityID] as TEDraedonItemCharger).ItemBeingCharged.Calamity().CurrentCharge = currentCharge; + } + (TileEntity.ByID[entityID] as TEDraedonItemCharger).ActiveTimer = reader.ReadInt32(); + (TileEntity.ByID[entityID] as TEDraedonItemCharger).DepositWithdrawCooldown = reader.ReadInt32(); + break; + case CalamityModMessageType.DraedonFieldGeneratorSync: + int entityID2 = reader.ReadInt32(); + (TileEntity.ByID[entityID2] as TEDraedonFieldGenerator).Time = reader.ReadInt32(); + (TileEntity.ByID[entityID2] as TEDraedonFieldGenerator).ActiveTimer = reader.ReadInt32(); + break; + case CalamityModMessageType.SyncCalamityNPCAIArray: + byte npcIndex2 = reader.ReadByte(); + Main.npc[npcIndex2].Calamity().newAI[0] = reader.ReadSingle(); + Main.npc[npcIndex2].Calamity().newAI[1] = reader.ReadSingle(); + Main.npc[npcIndex2].Calamity().newAI[2] = reader.ReadSingle(); + Main.npc[npcIndex2].Calamity().newAI[3] = reader.ReadSingle(); + break; + case CalamityModMessageType.ProvidenceDyeConditionSync: + byte npcIndex3 = reader.ReadByte(); + (Main.npc[npcIndex3].modNPC as Providence).hasTakenDaytimeDamage = reader.ReadBoolean(); + break; + default: Logger.Error($"Failed to parse Calamity packet: No Calamity packet exists with ID {msgType}."); break; @@ -3816,8 +4162,8 @@ namespace CalamityMod NetMessage.SendData(MessageID.WorldData, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); } } - #endregion - } + #endregion + } public enum Season : byte { @@ -3845,6 +4191,8 @@ namespace CalamityMod BossRushStage, DoGCountdownSync, BossSpawnCountdownSync, + BRHostileProjKillSync, + ArmoredDiggerCountdownSync, BossTypeSync, DeathCountSync, RevengeanceBoolSync, @@ -3861,6 +4209,11 @@ namespace CalamityMod AcidRainUIDrawFadeSync, AcidRainOldDukeSummonSync, GaelsGreatswordSwingSync, - SpawnSuperDummy + SpawnSuperDummy, + SyncCalamityNPCAIArray, + ProvidenceDyeConditionSync, // We shouldn't fucking need this. Die in a hole, Multiplayer. + DraedonGeneratorStackSync, + DraedonChargerSync, + DraedonFieldGeneratorSync } } diff --git a/Effects/DistortionShader.xnb b/Effects/DistortionShader.xnb new file mode 100644 index 0000000000..fc85ee9639 Binary files /dev/null and b/Effects/DistortionShader.xnb differ diff --git a/Effects/Dyes/ProfanedMoonlightDye.xnb b/Effects/Dyes/ProfanedMoonlightDye.xnb new file mode 100644 index 0000000000..c6650c5567 Binary files /dev/null and b/Effects/Dyes/ProfanedMoonlightDye.xnb differ diff --git a/Events/AcidRainEvent.cs b/Events/AcidRainEvent.cs index 4d72473cef..80c62c783d 100644 --- a/Events/AcidRainEvent.cs +++ b/Events/AcidRainEvent.cs @@ -34,6 +34,8 @@ namespace CalamityMod.Events // A partially bright pale-ish cyan with a hint of yellow. public static readonly Color TextColor = new Color(115, 194, 147); + public static int MaxNuclearToadCount = 5; // To prevent the things from spamming. This happens frequently in pre-HM. + public const int InvasionNoKillPersistTime = 14400; // How long the invasion persists, in frames, if nothing is killed. public const float BloodwormSpawnRate = 0.1f; @@ -141,11 +143,11 @@ namespace CalamityMod.Events } } /// - /// Attempts to start the Acid Rain event. Will fail if there is another invasion going on or the EoC has not been killed yet (unless you're in hardmode). + /// Attempts to start the Acid Rain event. Will fail if there is another invasion or boss rush going on. It will also fail if the EoC, WoF, or AS has not been killed yet. /// public static void TryStartEvent(bool forceRain = false) { - if (CalamityWorld.rainingAcid || (!NPC.downedBoss1 && !Main.hardMode) || CalamityWorld.bossRushActive) + if (CalamityWorld.rainingAcid || (!NPC.downedBoss1 && !Main.hardMode && !CalamityWorld.downedAquaticScourge) || CalamityWorld.bossRushActive) return; int playerCount = 0; for (int i = 0; i < Main.player.Length; i++) diff --git a/ExtraTextures/AuroraTexture.png b/ExtraTextures/AuroraTexture.png new file mode 100644 index 0000000000..4254c6a1d5 Binary files /dev/null and b/ExtraTextures/AuroraTexture.png differ diff --git a/ExtraTextures/Chains/BallOFuguChain.png b/ExtraTextures/Chains/BallOFuguChain.png index 0a507b3c27..72c9a548c3 100644 Binary files a/ExtraTextures/Chains/BallOFuguChain.png and b/ExtraTextures/Chains/BallOFuguChain.png differ diff --git a/ExtraTextures/Chains/PlantationChain.png b/ExtraTextures/Chains/PlantationChain.png new file mode 100644 index 0000000000..0ce93ea713 Binary files /dev/null and b/ExtraTextures/Chains/PlantationChain.png differ diff --git a/ExtraTextures/DraedonChargerSpark.png b/ExtraTextures/DraedonChargerSpark.png new file mode 100644 index 0000000000..8476556238 Binary files /dev/null and b/ExtraTextures/DraedonChargerSpark.png differ diff --git a/ExtraTextures/LaserWallTelegraphBeam.png b/ExtraTextures/LaserWallTelegraphBeam.png new file mode 100644 index 0000000000..de6615dfbf Binary files /dev/null and b/ExtraTextures/LaserWallTelegraphBeam.png differ diff --git a/ExtraTextures/Lasers/UltimaRayEnd.png b/ExtraTextures/Lasers/UltimaRayEnd.png new file mode 100644 index 0000000000..26fefb2eb4 Binary files /dev/null and b/ExtraTextures/Lasers/UltimaRayEnd.png differ diff --git a/ExtraTextures/Lasers/UltimaRayMid.png b/ExtraTextures/Lasers/UltimaRayMid.png new file mode 100644 index 0000000000..9a13aa9d6b Binary files /dev/null and b/ExtraTextures/Lasers/UltimaRayMid.png differ diff --git a/ExtraTextures/Lasers/UltimaRayStart.png b/ExtraTextures/Lasers/UltimaRayStart.png new file mode 100644 index 0000000000..6ebfb4d0e7 Binary files /dev/null and b/ExtraTextures/Lasers/UltimaRayStart.png differ diff --git a/ExtraTextures/RoverAccShield.png b/ExtraTextures/RoverAccShield.png new file mode 100644 index 0000000000..9250879d99 Binary files /dev/null and b/ExtraTextures/RoverAccShield.png differ diff --git a/ExtraTextures/SnakeEye.png b/ExtraTextures/SnakeEye.png new file mode 100644 index 0000000000..794bb1b5a4 Binary files /dev/null and b/ExtraTextures/SnakeEye.png differ diff --git a/ExtraTextures/Tanks/Backpack_TheEmpyrean.png b/ExtraTextures/Tanks/Backpack_TheEmpyrean.png index 585763a882..9a350cbd98 100644 Binary files a/ExtraTextures/Tanks/Backpack_TheEmpyrean.png and b/ExtraTextures/Tanks/Backpack_TheEmpyrean.png differ diff --git a/ExtraTextures/UI/DraedonsLogArrow.png b/ExtraTextures/UI/DraedonsLogArrow.png new file mode 100644 index 0000000000..6bcf2aea23 Binary files /dev/null and b/ExtraTextures/UI/DraedonsLogArrow.png differ diff --git a/ExtraTextures/UI/DraedonsLogArrowHover.png b/ExtraTextures/UI/DraedonsLogArrowHover.png new file mode 100644 index 0000000000..70110f3448 Binary files /dev/null and b/ExtraTextures/UI/DraedonsLogArrowHover.png differ diff --git a/ExtraTextures/UI/DraedonsLogPage.png b/ExtraTextures/UI/DraedonsLogPage.png new file mode 100644 index 0000000000..7980b30dfb Binary files /dev/null and b/ExtraTextures/UI/DraedonsLogPage.png differ diff --git a/ExtraTextures/WulfrumPylon.png b/ExtraTextures/WulfrumPylon.png new file mode 100644 index 0000000000..c578407dd3 Binary files /dev/null and b/ExtraTextures/WulfrumPylon.png differ diff --git a/Gores/LeviathanGores/LeviGore.png b/Gores/LeviathanGores/LeviGore.png new file mode 100644 index 0000000000..2fa7b63295 Binary files /dev/null and b/Gores/LeviathanGores/LeviGore.png differ diff --git a/Gores/LeviathanGores/LeviGore2.png b/Gores/LeviathanGores/LeviGore2.png new file mode 100644 index 0000000000..dd6f7cab00 Binary files /dev/null and b/Gores/LeviathanGores/LeviGore2.png differ diff --git a/Gores/LeviathanGores/LeviGore3.png b/Gores/LeviathanGores/LeviGore3.png new file mode 100644 index 0000000000..3021ab4ddc Binary files /dev/null and b/Gores/LeviathanGores/LeviGore3.png differ diff --git a/Gores/LeviathanGores/LeviGore4.png b/Gores/LeviathanGores/LeviGore4.png new file mode 100644 index 0000000000..be05c90eaa Binary files /dev/null and b/Gores/LeviathanGores/LeviGore4.png differ diff --git a/Gores/Leviathangib1.png b/Gores/Leviathangib1.png deleted file mode 100644 index 0ecb8917b0..0000000000 Binary files a/Gores/Leviathangib1.png and /dev/null differ diff --git a/Gores/Leviathangib2.png b/Gores/Leviathangib2.png deleted file mode 100644 index 439118a08d..0000000000 Binary files a/Gores/Leviathangib2.png and /dev/null differ diff --git a/Gores/Leviathangib3.png b/Gores/Leviathangib3.png deleted file mode 100644 index e574799f70..0000000000 Binary files a/Gores/Leviathangib3.png and /dev/null differ diff --git a/Gores/SirenGores/Siren.png b/Gores/SirenGores/Siren.png deleted file mode 100644 index 5fd3fd11c7..0000000000 Binary files a/Gores/SirenGores/Siren.png and /dev/null differ diff --git a/Gores/SirenGores/Siren2.png b/Gores/SirenGores/Siren2.png deleted file mode 100644 index 773164636b..0000000000 Binary files a/Gores/SirenGores/Siren2.png and /dev/null differ diff --git a/Gores/SirenGores/Siren3.png b/Gores/SirenGores/Siren3.png deleted file mode 100644 index 5fc6575960..0000000000 Binary files a/Gores/SirenGores/Siren3.png and /dev/null differ diff --git a/Gores/SirenGores/Siren4.png b/Gores/SirenGores/Siren4.png deleted file mode 100644 index d819fb0058..0000000000 Binary files a/Gores/SirenGores/Siren4.png and /dev/null differ diff --git a/Gores/SirenGores/Siren5.png b/Gores/SirenGores/Siren5.png deleted file mode 100644 index 21f1e550d5..0000000000 Binary files a/Gores/SirenGores/Siren5.png and /dev/null differ diff --git a/Items/Accessories/Abaddon.cs b/Items/Accessories/Abaddon.cs index 8e34d287bd..9e74cb74b4 100644 --- a/Items/Accessories/Abaddon.cs +++ b/Items/Accessories/Abaddon.cs @@ -10,21 +10,21 @@ namespace CalamityMod.Items.Accessories public override void SetStaticDefaults() { DisplayName.SetDefault("Abaddon"); - Tooltip.SetDefault("Makes you immune to Brimstone Flames"); + Tooltip.SetDefault("Reduces the damage caused by the Brimstone Flames debuff"); } public override void SetDefaults() { item.width = 26; item.height = 26; - item.value = Item.buyPrice(0, 15, 0, 0); - item.rare = ItemRarityID.Lime; + item.value = CalamityGlobalItem.Rarity5BuyPrice; + item.rare = 5; item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) { - player.buffImmune[ModContent.BuffType()] = true; + player.Calamity().abaddon = true; } } } diff --git a/Items/Accessories/AbyssalAmulet.cs b/Items/Accessories/AbyssalAmulet.cs index 89ae80a10a..80bd11538a 100644 --- a/Items/Accessories/AbyssalAmulet.cs +++ b/Items/Accessories/AbyssalAmulet.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Accessories { item.width = 26; item.height = 26; - item.value = Item.buyPrice(0, 9, 0, 0); + item.value = CalamityGlobalItem.Rarity3BuyPrice; item.rare = 3; item.accessory = true; } diff --git a/Items/Accessories/AbyssalDivingGear.cs b/Items/Accessories/AbyssalDivingGear.cs index 2eeb853a28..202b02f1b9 100644 --- a/Items/Accessories/AbyssalDivingGear.cs +++ b/Items/Accessories/AbyssalDivingGear.cs @@ -6,54 +6,70 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { - [AutoloadEquip(EquipType.Face)] - public class AbyssalDivingGear : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Abyssal Diving Gear"); - Tooltip.SetDefault("Reduces the damage caused by the pressure of the abyss while out of breath\n" + - "Removes the bleed effect caused by the abyss\n" + - "Grants the ability to swim and greatly extends underwater breathing\n" + - "Provides light underwater and extra mobility on ice\n" + - "Provides a moderate amount of light in the abyss\n" + - "Greatly reduces breath loss in the abyss"); - } + //[AutoloadEquip(EquipType.Face)] + public class AbyssalDivingGear : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Abyssal Diving Gear"); + Tooltip.SetDefault("Reduces the damage caused by the pressure of the abyss while out of breath\n" + + "Removes the bleed effect caused by the abyss\n" + + "Grants the ability to swim and greatly extends underwater breathing\n" + + "Provides light underwater and extra mobility on ice\n" + + "Provides a moderate amount of light in the abyss\n" + + "Greatly reduces breath loss in the abyss"); + } - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.value = Item.buyPrice(0, 45, 0, 0); - item.rare = 6; - item.accessory = true; - } + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.value = CalamityGlobalItem.Rarity7BuyPrice; + item.rare = 7; + item.accessory = true; + } - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.depthCharm = true; - modPlayer.jellyfishNecklace = true; - player.arcticDivingGear = true; - player.accFlipper = true; - player.accDivingHelm = true; - player.iceSkate = true; - if (player.wet) - { - Lighting.AddLight((int)player.Center.X / 16, (int)player.Center.Y / 16, 0.2f, 0.8f, 0.9f); - } - } + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.depthCharm = true; + modPlayer.jellyfishNecklace = true; + if (!hideVisual) + modPlayer.abyssDivingGear = true; //this bool is just used for drawing + player.arcticDivingGear = true; + player.accFlipper = true; + player.accDivingHelm = true; + player.iceSkate = true; + if (player.wet) + { + Lighting.AddLight((int)player.Center.X / 16, (int)player.Center.Y / 16, 0.2f, 0.8f, 0.9f); + } + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.ArcticDivingGear); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void UpdateVanity(Player player, EquipType type) + { + player.Calamity().abyssDivingGear = true; //this bool is just used for drawing + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.ArcticDivingGear); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } + + public class AbyssDivingGearHair : EquipTexture + { + public override void DrawHair(ref bool drawHair, ref bool drawAltHair) + { + drawHair = false; + drawAltHair = false; + } + } } diff --git a/Items/Accessories/AbyssalDivingSuit.cs b/Items/Accessories/AbyssalDivingSuit.cs index 7286bbb8cc..2f1554e808 100644 --- a/Items/Accessories/AbyssalDivingSuit.cs +++ b/Items/Accessories/AbyssalDivingSuit.cs @@ -33,8 +33,9 @@ namespace CalamityMod.Items.Accessories item.width = 18; item.height = 18; item.accessory = true; - item.value = Item.buyPrice(0, 90, 0, 0); + item.value = CalamityGlobalItem.Rarity12BuyPrice; item.rare = 10; + item.Calamity().postMoonLordRarity = 12; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/AbyssalMirror.cs b/Items/Accessories/AbyssalMirror.cs index a77614f9b0..31b4576249 100644 --- a/Items/Accessories/AbyssalMirror.cs +++ b/Items/Accessories/AbyssalMirror.cs @@ -23,8 +23,8 @@ namespace CalamityMod.Items.Accessories { item.width = 30; item.height = 38; - item.value = Item.buyPrice(0, 6, 0, 0); - item.rare = 8; + item.value = CalamityGlobalItem.Rarity7BuyPrice; + item.rare = 7; item.accessory = true; } diff --git a/Items/Accessories/AeroStone.cs b/Items/Accessories/AeroStone.cs index 642e4fab63..67c5d1d5ca 100644 --- a/Items/Accessories/AeroStone.cs +++ b/Items/Accessories/AeroStone.cs @@ -1,3 +1,4 @@ +using System.Collections.Generic; using Terraria; using Terraria.DataStructures; using Terraria.ModLoader; @@ -10,7 +11,7 @@ namespace CalamityMod.Items.Accessories { DisplayName.SetDefault("Aero Stone"); Tooltip.SetDefault("One of the ancient relics\n" + - "Increases movement speed by 10%, jump speed by 100%, and all damage by 3%"); + "Increases movement speed by 10%, jump speed by 20%, and all damage by 3%"); Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(4, 8)); } @@ -18,11 +19,24 @@ namespace CalamityMod.Items.Accessories { item.width = 40; item.height = 50; - item.value = Item.buyPrice(0, 15, 0, 0); - item.rare = 5; + item.value = CalamityGlobalItem.Rarity2BuyPrice; + item.rare = 2; item.accessory = true; } + public override void ModifyTooltips(List list) + { + bool autoJump = Main.player[Main.myPlayer].autoJump; + string jumpAmt = autoJump ? "5" : "20"; + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip1") + { + line2.text = "Increases movement speed by 10%, jump speed by " + jumpAmt + "%, and all damage by 3%"; + } + } + } + public override void UpdateAccessory(Player player, bool hideVisual) { Lighting.AddLight((int)player.Center.X / 16, (int)player.Center.Y / 16, 0f, 0.425f, 0.425f); diff --git a/Items/Accessories/Affliction.cs b/Items/Accessories/Affliction.cs index 9da265f7e3..ea18e115c8 100644 --- a/Items/Accessories/Affliction.cs +++ b/Items/Accessories/Affliction.cs @@ -20,10 +20,10 @@ namespace CalamityMod.Items.Accessories { item.width = 38; item.height = 44; - item.value = Item.buyPrice(0, 60, 0, 0); + item.value = CalamityGlobalItem.Rarity13BuyPrice; item.accessory = true; item.expert = true; - item.rare = 9; + item.rare = 10; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) diff --git a/Items/Accessories/AlchemicalFlask.cs b/Items/Accessories/AlchemicalFlask.cs index e5ad4cacb6..465e3709fa 100644 --- a/Items/Accessories/AlchemicalFlask.cs +++ b/Items/Accessories/AlchemicalFlask.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Accessories { DisplayName.SetDefault("Alchemical Flask"); Tooltip.SetDefault("All attacks inflict the plague\n" + - "Makes you immune to the plague\n" + + "Reduces the damage caused to you by the plague\n" + "Projectiles spawn plague seekers on enemy hits"); } @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Accessories { item.width = 26; item.height = 26; - item.value = Item.buyPrice(0, 24, 0, 0); + item.value = CalamityGlobalItem.Rarity8BuyPrice; item.rare = 8; item.accessory = true; } @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Accessories { CalamityPlayer modPlayer = player.Calamity(); modPlayer.alchFlask = true; - player.buffImmune[ModContent.BuffType()] = true; + modPlayer.reducedPlagueDmg = true; } public override void AddRecipes() diff --git a/Items/Accessories/AlluringBait.cs b/Items/Accessories/AlluringBait.cs index e985fa4d3b..f352fd3042 100644 --- a/Items/Accessories/AlluringBait.cs +++ b/Items/Accessories/AlluringBait.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Accessories { item.width = 26; item.height = 26; - item.value = Item.buyPrice(0, 9, 0, 0); + item.value = CalamityGlobalItem.Rarity3BuyPrice; item.rare = 3; item.accessory = true; } diff --git a/Items/Accessories/AmalgamatedBrain.cs b/Items/Accessories/AmalgamatedBrain.cs index 9f2d57bcee..031d0cea48 100644 --- a/Items/Accessories/AmalgamatedBrain.cs +++ b/Items/Accessories/AmalgamatedBrain.cs @@ -22,9 +22,9 @@ namespace CalamityMod.Items.Accessories { item.width = 34; item.height = 34; - item.value = Item.buyPrice(0, 15, 0, 0); + item.value = CalamityGlobalItem.Rarity4BuyPrice; item.expert = true; - item.rare = 9; + item.rare = 4; item.accessory = true; } @@ -38,26 +38,8 @@ namespace CalamityMod.Items.Accessories { if (player.whoAmI == Main.myPlayer) { - for (int l = 0; l < 1; l++) - { - float x = player.position.X + (float)Main.rand.Next(-400, 400); - float y = player.position.Y - (float)Main.rand.Next(500, 800); - Vector2 vector = new Vector2(x, y); - float num15 = player.position.X + (float)(player.width / 2) - vector.X; - float num16 = player.position.Y + (float)(player.height / 2) - vector.Y; - num15 += (float)Main.rand.Next(-100, 101); - int num17 = 22; - float num18 = (float)Math.Sqrt((double)(num15 * num15 + num16 * num16)); - num18 = (float)num17 / num18; - num15 *= num18; - num16 *= num18; - int num19 = Projectile.NewProjectile(x, y, num15, num16, ModContent.ProjectileType(), (int)(60 * player.AverageDamage()), 2f, player.whoAmI, 0f, 0f); - Main.projectile[num19].ai[1] = player.position.Y; - Main.projectile[num19].tileCollide = false; - Main.projectile[num19].usesLocalNPCImmunity = true; - Main.projectile[num19].localNPCHitCooldown = 10; - Main.projectile[num19].Calamity().forceTypeless = true; - } + Projectile rain = CalamityUtils.ProjectileRain(player.Center, 400f, 100f, 500f, 800f, 22f, ModContent.ProjectileType(), (int)(60 * player.AverageDamage()), 2f, player.whoAmI, 6, 1); + rain.tileCollide = false; } } } diff --git a/Items/Accessories/AmbrosialAmpoule.cs b/Items/Accessories/AmbrosialAmpoule.cs index b64ab83459..21235fc272 100644 --- a/Items/Accessories/AmbrosialAmpoule.cs +++ b/Items/Accessories/AmbrosialAmpoule.cs @@ -1,5 +1,7 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.World; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -16,8 +18,7 @@ namespace CalamityMod.Items.Accessories "5% increased damage reduction and increased life regen\n" + "Poison, Freeze, Chill, Frostburn, and Venom immunity\n" + "Honey-like life regen with no speed penalty\n" + - "Most bee/hornet enemies and projectiles do 75% damage to you\n" + - "Provides cold protection in Death Mode"); + "Most bee/hornet enemies and projectiles do 75% damage to you"); } public override void SetDefaults() @@ -25,17 +26,31 @@ namespace CalamityMod.Items.Accessories item.defense = 4; item.width = 20; item.height = 20; - item.value = Item.buyPrice(0, 45, 0, 0); - item.rare = 10; + item.value = CalamityGlobalItem.Rarity5BuyPrice; + item.rare = 5; item.accessory = true; } + public override void ModifyTooltips(List list) + { + if (CalamityWorld.death) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip5") + { + line2.text = "Most bee/hornet enemies and projectiles do 75% damage to you\n" + + "Provides cold protection in Death Mode"; + } + } + } + } + public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); modPlayer.beeResist = true; modPlayer.aAmpoule = true; - } public override void AddRecipes() diff --git a/Items/Accessories/AmbrosialAmpoule.png b/Items/Accessories/AmbrosialAmpoule.png index 0af3db041c..9248b66a27 100644 Binary files a/Items/Accessories/AmbrosialAmpoule.png and b/Items/Accessories/AmbrosialAmpoule.png differ diff --git a/Items/Accessories/AmidiasPendant.cs b/Items/Accessories/AmidiasPendant.cs index b49b033189..9324523fb7 100644 --- a/Items/Accessories/AmidiasPendant.cs +++ b/Items/Accessories/AmidiasPendant.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Accessories { item.width = 26; item.height = 46; - item.value = Item.buyPrice(0, 3, 0, 0); + item.value = CalamityGlobalItem.Rarity2BuyPrice; item.rare = 2; item.accessory = true; } diff --git a/Items/Accessories/AmidiasSpark.cs b/Items/Accessories/AmidiasSpark.cs index 3c22b43486..d001a5fafa 100644 --- a/Items/Accessories/AmidiasSpark.cs +++ b/Items/Accessories/AmidiasSpark.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Accessories { item.width = 26; item.height = 26; - item.value = Item.buyPrice(0, 3, 0, 0); + item.value = CalamityGlobalItem.Rarity1BuyPrice; item.rare = 1; item.accessory = true; } diff --git a/Items/Accessories/AncientFossil.cs b/Items/Accessories/AncientFossil.cs index a362702b5f..7b89e95d3f 100644 --- a/Items/Accessories/AncientFossil.cs +++ b/Items/Accessories/AncientFossil.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Accessories { item.width = 26; item.height = 26; - item.value = Item.buyPrice(0, 3, 0, 0); + item.value = CalamityGlobalItem.Rarity1BuyPrice; item.rare = 1; item.accessory = true; } diff --git a/Items/Accessories/AnechoicPlating.cs b/Items/Accessories/AnechoicPlating.cs index 04145e4c27..a0541a997d 100644 --- a/Items/Accessories/AnechoicPlating.cs +++ b/Items/Accessories/AnechoicPlating.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Accessories { item.width = 26; item.height = 26; - item.value = Item.buyPrice(0, 9, 0, 0); + item.value = CalamityGlobalItem.Rarity3BuyPrice; item.rare = 3; item.accessory = true; } diff --git a/Items/Accessories/AngelTreads.cs b/Items/Accessories/AngelTreads.cs index 395224d5d1..26391d7720 100644 --- a/Items/Accessories/AngelTreads.cs +++ b/Items/Accessories/AngelTreads.cs @@ -1,5 +1,7 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.World; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -17,19 +19,33 @@ namespace CalamityMod.Items.Accessories "Increased flight time\n" + "Greater mobility on ice\n" + "Water and lava walking\n" + - "Temporary immunity to lava\n" + - "Provides heat protection in Death Mode"); + "Temporary immunity to lava"); } public override void SetDefaults() { item.width = 36; item.height = 32; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 8; + item.value = CalamityGlobalItem.Rarity6BuyPrice; + item.rare = 6; item.accessory = true; } + public override void ModifyTooltips(List list) + { + if (CalamityWorld.death) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip5") + { + line2.text = "Temporary immunity to lava\n" + + "Provides heat protection in Death Mode"; + } + } + } + } + public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); diff --git a/Items/Accessories/AquaticEmblem.cs b/Items/Accessories/AquaticEmblem.cs index 0ef1cd7087..1500b41cb3 100644 --- a/Items/Accessories/AquaticEmblem.cs +++ b/Items/Accessories/AquaticEmblem.cs @@ -1,5 +1,6 @@ using CalamityMod.CalPlayer; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories @@ -21,8 +22,8 @@ namespace CalamityMod.Items.Accessories { item.width = 18; item.height = 26; - item.value = Item.buyPrice(0, 30, 0, 0); - item.rare = 9; + item.value = CalamityGlobalItem.Rarity5BuyPrice; + item.rare = 5; item.accessory = true; item.expert = true; } @@ -31,11 +32,11 @@ namespace CalamityMod.Items.Accessories { CalamityPlayer modPlayer = player.Calamity(); modPlayer.aquaticEmblem = true; - player.npcTypeNoAggro[65] = true; - player.npcTypeNoAggro[220] = true; - player.npcTypeNoAggro[64] = true; - player.npcTypeNoAggro[67] = true; - player.npcTypeNoAggro[221] = true; + player.npcTypeNoAggro[NPCID.Shark] = true; + player.npcTypeNoAggro[NPCID.SeaSnail] = true; + player.npcTypeNoAggro[NPCID.PinkJellyfish] = true; + player.npcTypeNoAggro[NPCID.Crab] = true; + player.npcTypeNoAggro[NPCID.Squid] = true; player.gills = true; } } diff --git a/Items/Accessories/ArcanumoftheVoid.cs b/Items/Accessories/ArcanumoftheVoid.cs index 20668e48c7..911fcae376 100644 --- a/Items/Accessories/ArcanumoftheVoid.cs +++ b/Items/Accessories/ArcanumoftheVoid.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Accessories { item.width = 26; item.height = 26; - item.value = Item.buyPrice(0, 60, 0, 0); + item.value = CalamityGlobalItem.Rarity13BuyPrice; item.accessory = true; item.Calamity().customRarity = CalamityRarity.PureGreen; } diff --git a/Items/Accessories/ArchaicPowder.cs b/Items/Accessories/ArchaicPowder.cs index 05235d40a9..b47b4db5f8 100644 --- a/Items/Accessories/ArchaicPowder.cs +++ b/Items/Accessories/ArchaicPowder.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Accessories { item.width = 20; item.height = 20; - item.value = Item.buyPrice(0, 9, 0, 0); + item.value = CalamityGlobalItem.Rarity3BuyPrice; item.rare = 3; item.accessory = true; } diff --git a/Items/Accessories/AsgardianAegis.cs b/Items/Accessories/AsgardianAegis.cs index 796adf6e9b..517c4d7edc 100644 --- a/Items/Accessories/AsgardianAegis.cs +++ b/Items/Accessories/AsgardianAegis.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Accessories { item.width = 60; item.height = 54; - item.value = Item.buyPrice(0, 90, 0, 0); //30 gold reforge + item.value = CalamityGlobalItem.Rarity14BuyPrice; item.defense = 10; item.accessory = true; item.Calamity().customRarity = CalamityRarity.DarkBlue; diff --git a/Items/Accessories/AsgardsValor.cs b/Items/Accessories/AsgardsValor.cs index 9f09c33d86..4d2eeadc6c 100644 --- a/Items/Accessories/AsgardsValor.cs +++ b/Items/Accessories/AsgardsValor.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Accessories { DisplayName.SetDefault("Asgard's Valor"); Tooltip.SetDefault("Grants immunity to fire blocks and knockback\n" + - "Immune to most debuffs including Brimstone Flames, and Glacial State\n" + + "Immune to most debuffs and reduces the damage caused by the Brimstone Flames debuff\n" + "10% damage reduction while submerged in liquid\n" + "+20 max life\n" + "Grants a holy dash which can be used to ram enemies\n" + @@ -26,8 +26,8 @@ namespace CalamityMod.Items.Accessories { item.width = 38; item.height = 44; - item.value = Item.buyPrice(0, 45, 0, 0); - item.rare = 9; + item.value = CalamityGlobalItem.Rarity7BuyPrice; + item.rare = 7; item.defense = 8; item.accessory = true; } @@ -39,6 +39,7 @@ namespace CalamityMod.Items.Accessories { modPlayer.dashMod = 2; } player.noKnockback = true; player.fireWalk = true; + modPlayer.abaddon = true; player.buffImmune[BuffID.Chilled] = true; player.buffImmune[BuffID.Frostburn] = true; player.buffImmune[BuffID.Weak] = true; @@ -50,8 +51,6 @@ namespace CalamityMod.Items.Accessories player.buffImmune[BuffID.Silenced] = true; player.buffImmune[BuffID.Cursed] = true; player.buffImmune[BuffID.Darkness] = true; - player.buffImmune[ModContent.BuffType()] = true; - player.buffImmune[ModContent.BuffType()] = true; player.statLifeMax2 += 20; if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) { player.endurance += 0.1f; } diff --git a/Items/Accessories/AstralArcanum.cs b/Items/Accessories/AstralArcanum.cs index aff0160b81..31f0944cec 100644 --- a/Items/Accessories/AstralArcanum.cs +++ b/Items/Accessories/AstralArcanum.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Accessories { item.width = 26; item.height = 26; - item.value = Item.buyPrice(0, 90, 0, 0); + item.value = CalamityGlobalItem.Rarity13BuyPrice; item.accessory = true; item.Calamity().customRarity = CalamityRarity.PureGreen; } diff --git a/Items/Accessories/AstralBulwark.cs b/Items/Accessories/AstralBulwark.cs index f40da571ca..70617569d4 100644 --- a/Items/Accessories/AstralBulwark.cs +++ b/Items/Accessories/AstralBulwark.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Accessories { item.width = 26; item.height = 26; - item.value = Item.buyPrice(0, 15, 0, 0); + item.value = CalamityGlobalItem.Rarity9BuyPrice; item.expert = true; item.rare = 9; item.accessory = true; diff --git a/Items/Accessories/BadgeofBravery.cs b/Items/Accessories/BadgeofBravery.cs index 4a393de88f..c74096e0a6 100644 --- a/Items/Accessories/BadgeofBravery.cs +++ b/Items/Accessories/BadgeofBravery.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Accessories { item.width = 30; item.height = 30; - item.value = Item.buyPrice(0, 21, 0, 0); + item.value = CalamityGlobalItem.Rarity12BuyPrice; item.accessory = true; item.Calamity().customRarity = CalamityRarity.Turquoise; } diff --git a/Items/Accessories/BlazingCore.cs b/Items/Accessories/BlazingCore.cs index 81c6160db0..eb25eb462c 100644 --- a/Items/Accessories/BlazingCore.cs +++ b/Items/Accessories/BlazingCore.cs @@ -1,4 +1,6 @@ using CalamityMod.CalPlayer; +using CalamityMod.World; +using System.Collections.Generic; using Terraria; using Terraria.DataStructures; using Terraria.ModLoader; @@ -15,8 +17,7 @@ namespace CalamityMod.Items.Accessories "Being hit creates a miniature sun that lingers, dealing damage to nearby enemies\n" + "The sun will slowly drag enemies into it\n" + "Only one sun can be active at once\n" + - "Provides a moderate amount of light in the Abyss\n" + - "Provides heat and cold protection in Death Mode"); + "Provides a moderate amount of light in the Abyss"); Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(5, 6)); } @@ -27,7 +28,22 @@ namespace CalamityMod.Items.Accessories item.accessory = true; item.expert = true; item.rare = 9; - item.value = Item.buyPrice(1, 20, 0, 0); + item.value = CalamityGlobalItem.Rarity12BuyPrice; + } + + public override void ModifyTooltips(List list) + { + if (CalamityWorld.death) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip5") + { + line2.text = "Provides a moderate amount of light in the Abyss\n" + + "Provides heat and cold protection in Death Mode"; + } + } + } } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/BloodPact.cs b/Items/Accessories/BloodPact.cs index 3df409447a..034f361058 100644 --- a/Items/Accessories/BloodPact.cs +++ b/Items/Accessories/BloodPact.cs @@ -10,7 +10,9 @@ namespace CalamityMod.Items.Accessories { DisplayName.SetDefault("Blood Pact"); Tooltip.SetDefault("Doubles your max HP\n" + - "Allows you to be critically hit 25% of the time"); + "Allows you to be critically hit 25% of the time\n" + + "After a critical hit, you gain various buffs for ten seconds\n" + + "Any healing potions consumed during this time period heal 50 percent more health"); } public override void SetDefaults() @@ -18,7 +20,7 @@ namespace CalamityMod.Items.Accessories item.width = 26; item.height = 26; item.rare = 8; - item.value = Item.buyPrice(0, 24, 0, 0); + item.value = CalamityGlobalItem.Rarity8BuyPrice; item.accessory = true; } diff --git a/Items/Accessories/BloodflareCore.cs b/Items/Accessories/BloodflareCore.cs index 5e42871eae..f7418a508c 100644 --- a/Items/Accessories/BloodflareCore.cs +++ b/Items/Accessories/BloodflareCore.cs @@ -1,33 +1,34 @@ using CalamityMod.CalPlayer; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { - public class BloodflareCore : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bloodflare Core"); - Tooltip.SetDefault("When below 50% life you gain 5% increased damage reduction and 10% increased damage\n" + - "When below 15% life you gain 10% increased damage reduction and 20% increased damage\n" + - "When below 100 defense you gain 15% increased damage"); - } + public class BloodflareCore : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bloodflare Core"); + Tooltip.SetDefault("When below 50% life you gain 5% increased damage reduction and 10% increased damage\n" + + "When below 15% life you gain 10% increased damage reduction and 20% increased damage\n" + + "When below 100 defense you gain 15% increased damage"); + } - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.value = Item.buyPrice(0, 45, 0, 0); - item.expert = true; - item.rare = 9; - item.accessory = true; - } + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.value = CalamityGlobalItem.Rarity13BuyPrice; + item.expert = true; + item.rare = ItemRarityID.Red; + item.accessory = true; + } - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.bloodflareCore = true; - } - } + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.bloodflareCore = true; + } + } } diff --git a/Items/Accessories/BloodstainedGlove.cs b/Items/Accessories/BloodstainedGlove.cs index 2d84bef368..765976917e 100644 --- a/Items/Accessories/BloodstainedGlove.cs +++ b/Items/Accessories/BloodstainedGlove.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Accessories { item.width = 26; item.height = 36; - item.value = Item.buyPrice(0, 4, 0, 0); + item.value = CalamityGlobalItem.Rarity3BuyPrice; item.accessory = true; item.rare = 3; } diff --git a/Items/Accessories/BloodyWormScarf.cs b/Items/Accessories/BloodyWormScarf.cs index a0869e6d28..81a112b206 100644 --- a/Items/Accessories/BloodyWormScarf.cs +++ b/Items/Accessories/BloodyWormScarf.cs @@ -17,9 +17,9 @@ namespace CalamityMod.Items.Accessories { item.width = 26; item.height = 42; - item.value = Item.buyPrice(0, 15, 0, 0); + item.value = CalamityGlobalItem.Rarity4BuyPrice; item.expert = true; - item.rare = 9; + item.rare = 4; item.accessory = true; } diff --git a/Items/Accessories/BloodyWormTooth.cs b/Items/Accessories/BloodyWormTooth.cs index c9e7bc1aa2..ec12c5aeb4 100644 --- a/Items/Accessories/BloodyWormTooth.cs +++ b/Items/Accessories/BloodyWormTooth.cs @@ -17,9 +17,9 @@ namespace CalamityMod.Items.Accessories { item.width = 12; item.height = 15; - item.value = Item.buyPrice(0, 9, 0, 0); + item.value = CalamityGlobalItem.Rarity3BuyPrice; item.expert = true; - item.rare = 9; + item.rare = 3; item.accessory = true; } diff --git a/Items/Accessories/BloomStone.cs b/Items/Accessories/BloomStone.cs index d7f0c8a2ed..c2881e60f7 100644 --- a/Items/Accessories/BloomStone.cs +++ b/Items/Accessories/BloomStone.cs @@ -23,8 +23,8 @@ namespace CalamityMod.Items.Accessories { item.width = 20; item.height = 20; - item.value = Item.buyPrice(0, 15, 0, 0); - item.rare = 5; + item.value = CalamityGlobalItem.Rarity8BuyPrice; + item.rare = 8; item.accessory = true; } diff --git a/Items/Accessories/BlunderBooster.cs b/Items/Accessories/BlunderBooster.cs index 945a4b7476..3f9ec276eb 100644 --- a/Items/Accessories/BlunderBooster.cs +++ b/Items/Accessories/BlunderBooster.cs @@ -54,7 +54,6 @@ namespace CalamityMod.Items.Accessories ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Accessories/BurdenBreaker.cs b/Items/Accessories/BurdenBreaker.cs index 7eaee8d0e4..3fce200977 100644 --- a/Items/Accessories/BurdenBreaker.cs +++ b/Items/Accessories/BurdenBreaker.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Accessories { item.width = 28; item.height = 28; - item.value = Item.buyPrice(0, 5, 0, 0); + item.value = CalamityGlobalItem.Rarity3BuyPrice; item.rare = 3; item.accessory = true; } diff --git a/Items/Accessories/CalamityRing.cs b/Items/Accessories/CalamityRing.cs index d5992874e9..e96d9921a1 100644 --- a/Items/Accessories/CalamityRing.cs +++ b/Items/Accessories/CalamityRing.cs @@ -21,50 +21,27 @@ namespace CalamityMod.Items.Accessories { item.width = 20; item.height = 22; - item.value = Item.buyPrice(0, 24, 0, 0); - item.rare = 9; + item.value = CalamityGlobalItem.Rarity7BuyPrice; + item.rare = 7; item.accessory = true; item.expert = true; } - public override bool CanEquipAccessory(Player player, int slot) - { - CalamityPlayer modPlayer = player.Calamity(); - if (modPlayer.calamityRing) - { - return false; - } - return true; - } + public override bool CanEquipAccessory(Player player, int slot) => !player.Calamity().calamityRing; public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); modPlayer.calamityRing = true; player.allDamage += 0.15f; - player.endurance -= 0.3f; + player.endurance -= 0.15f; if (player.whoAmI == Main.myPlayer) { if (player.immune) { if (Main.rand.NextBool(10)) { - for (int l = 0; l < 1; l++) - { - float x = player.position.X + (float)Main.rand.Next(-400, 400); - float y = player.position.Y - (float)Main.rand.Next(500, 800); - Vector2 vector = new Vector2(x, y); - float num15 = player.position.X + (float)(player.width / 2) - vector.X; - float num16 = player.position.Y + (float)(player.height / 2) - vector.Y; - num15 += (float)Main.rand.Next(-100, 101); - int num17 = 22; - float num18 = (float)Math.Sqrt((double)(num15 * num15 + num16 * num16)); - num18 = (float)num17 / num18; - num15 *= num18; - num16 *= num18; - int num19 = Projectile.NewProjectile(x, y, num15, num16, ModContent.ProjectileType(), (int)(30 * player.AverageDamage()), 5f, player.whoAmI, 0f, 0f); - Main.projectile[num19].ai[1] = player.position.Y; - } + CalamityUtils.ProjectileRain(player.Center, 400f, 100f, 500f, 800f, 22f, ModContent.ProjectileType(), (int)(30 * player.AverageDamage()), 5f, player.whoAmI); } } } diff --git a/Items/Accessories/CelestialJewel.cs b/Items/Accessories/CelestialJewel.cs index 6fabf5503c..cf89883c6b 100644 --- a/Items/Accessories/CelestialJewel.cs +++ b/Items/Accessories/CelestialJewel.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Accessories { item.width = 26; item.height = 26; - item.value = Item.buyPrice(0, 15, 0, 0); + item.value = CalamityGlobalItem.Rarity7BuyPrice; item.rare = 7; item.accessory = true; } diff --git a/Items/Accessories/ChaosAmulet.cs b/Items/Accessories/ChaosAmulet.cs index 3e55947eb8..71642a8565 100644 --- a/Items/Accessories/ChaosAmulet.cs +++ b/Items/Accessories/ChaosAmulet.cs @@ -18,8 +18,8 @@ namespace CalamityMod.Items.Accessories item.width = 20; item.height = 24; item.lifeRegen = 2; - item.value = Item.buyPrice(0, 15, 0, 0); - item.rare = 5; + item.value = CalamityGlobalItem.Rarity4BuyPrice; + item.rare = 4; item.accessory = true; } diff --git a/Items/Accessories/ChaosStone.cs b/Items/Accessories/ChaosStone.cs index 04277b032a..018ba06e30 100644 --- a/Items/Accessories/ChaosStone.cs +++ b/Items/Accessories/ChaosStone.cs @@ -18,8 +18,8 @@ namespace CalamityMod.Items.Accessories { item.width = 20; item.height = 20; - item.value = Item.buyPrice(0, 15, 0, 0); - item.rare = 5; + item.value = CalamityGlobalItem.Rarity7BuyPrice; + item.rare = 7; item.accessory = true; } diff --git a/Items/Accessories/CheatTestThing.cs b/Items/Accessories/CheatTestThing.cs index a37be3c5f1..a6ca44adaf 100644 --- a/Items/Accessories/CheatTestThing.cs +++ b/Items/Accessories/CheatTestThing.cs @@ -16,8 +16,8 @@ namespace CalamityMod.Items.Accessories { item.width = 26; item.height = 26; - item.value = 1; - item.rare = 1; + item.value = CalamityGlobalItem.Rarity16BuyPrice; + item.Calamity().postMoonLordRarity = 16; item.accessory = true; } diff --git a/Items/Accessories/CoinofDeceit.cs b/Items/Accessories/CoinofDeceit.cs index 23e4a72eed..05bf985301 100644 --- a/Items/Accessories/CoinofDeceit.cs +++ b/Items/Accessories/CoinofDeceit.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Accessories { item.width = 20; item.height = 22; - item.value = Item.buyPrice(0, 2, 0, 0); + item.value = CalamityGlobalItem.Rarity1BuyPrice; item.accessory = true; item.rare = 1; } diff --git a/Items/Accessories/CoreOfTheBloodGod.cs b/Items/Accessories/CoreOfTheBloodGod.cs index c6b3b65af3..9864386d8a 100644 --- a/Items/Accessories/CoreOfTheBloodGod.cs +++ b/Items/Accessories/CoreOfTheBloodGod.cs @@ -23,9 +23,9 @@ namespace CalamityMod.Items.Accessories { item.width = 26; item.height = 26; - item.value = Item.buyPrice(0, 90, 0, 0); + item.value = CalamityGlobalItem.Rarity14BuyPrice; item.expert = true; - item.rare = 9; + item.rare = 10; item.accessory = true; } diff --git a/Items/Accessories/CorruptFlask.cs b/Items/Accessories/CorruptFlask.cs index 7f8ec3029d..cfcc07129e 100644 --- a/Items/Accessories/CorruptFlask.cs +++ b/Items/Accessories/CorruptFlask.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Accessories { item.width = 20; item.height = 20; - item.value = Item.buyPrice(0, 3, 0, 0); + item.value = CalamityGlobalItem.Rarity2BuyPrice; item.rare = 2; item.accessory = true; } diff --git a/Items/Accessories/CounterScarf.cs b/Items/Accessories/CounterScarf.cs index df0ca83a33..cc2a7e8674 100644 --- a/Items/Accessories/CounterScarf.cs +++ b/Items/Accessories/CounterScarf.cs @@ -10,10 +10,12 @@ namespace CalamityMod.Items.Accessories public override void SetStaticDefaults() { DisplayName.SetDefault("Counter Scarf"); - Tooltip.SetDefault("True melee strikes deal 20% more damage\n" + + Tooltip.SetDefault("True melee strikes deal 15% more damage\n" + "Grants the ability to dash; dashing into an attack will cause you to dodge it\n" + "After a dodge you will be granted a buff to all damage, melee speed, and all crit chance for a short time\n" + "After a successful dodge you must wait 15 seconds before you can dodge again\n" + + "This cooldown will be twice as long if you have Chaos State\n" + + "While on cooldown, Chaos State will last twice as long\n" + "Revengeance drop"); } @@ -21,8 +23,8 @@ namespace CalamityMod.Items.Accessories { item.width = 26; item.height = 26; - item.value = Item.buyPrice(0, 9, 0, 0); - item.rare = 3; + item.value = CalamityGlobalItem.Rarity2BuyPrice; + item.rare = 2; item.accessory = true; } diff --git a/Items/Accessories/CrawCarapace.cs b/Items/Accessories/CrawCarapace.cs index 8cb1b4f854..d333e95580 100644 --- a/Items/Accessories/CrawCarapace.cs +++ b/Items/Accessories/CrawCarapace.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Accessories item.defense = 3; item.width = 28; item.height = 28; - item.value = Item.buyPrice(0, 3, 0, 0); + item.value = CalamityGlobalItem.Rarity1BuyPrice; item.rare = 1; item.accessory = true; } diff --git a/Items/Accessories/CrimsonFlask.cs b/Items/Accessories/CrimsonFlask.cs index 4884087736..9a2fa895ac 100644 --- a/Items/Accessories/CrimsonFlask.cs +++ b/Items/Accessories/CrimsonFlask.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Accessories { item.width = 20; item.height = 20; - item.value = Item.buyPrice(0, 3, 0, 0); + item.value = CalamityGlobalItem.Rarity2BuyPrice; item.rare = 2; item.accessory = true; } diff --git a/Items/Accessories/CrownJewel.cs b/Items/Accessories/CrownJewel.cs index e14f3e24c1..6dfb3ccd68 100644 --- a/Items/Accessories/CrownJewel.cs +++ b/Items/Accessories/CrownJewel.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Accessories { item.width = 26; item.height = 26; - item.value = Item.buyPrice(0, 3, 0, 0); + item.value = CalamityGlobalItem.Rarity1BuyPrice; item.rare = 1; item.accessory = true; } diff --git a/Items/Accessories/CryoStone.cs b/Items/Accessories/CryoStone.cs index 00da5e3408..3c8f3dbb03 100644 --- a/Items/Accessories/CryoStone.cs +++ b/Items/Accessories/CryoStone.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Accessories { item.width = 40; item.height = 40; - item.value = Item.buyPrice(0, 15, 0, 0); + item.value = CalamityGlobalItem.Rarity5BuyPrice; item.rare = 5; item.defense = 6; item.accessory = true; diff --git a/Items/Accessories/DaedalusEmblem.cs b/Items/Accessories/DaedalusEmblem.cs index 4dee335e7c..d21286cf49 100644 --- a/Items/Accessories/DaedalusEmblem.cs +++ b/Items/Accessories/DaedalusEmblem.cs @@ -18,8 +18,8 @@ namespace CalamityMod.Items.Accessories { item.width = 28; item.height = 32; - item.value = Item.buyPrice(0, 30, 0, 0); - item.rare = 9; + item.value = CalamityGlobalItem.Rarity8BuyPrice; + item.rare = 8; item.accessory = true; } diff --git a/Items/Accessories/DarkGodsSheath.cs b/Items/Accessories/DarkGodsSheath.cs index 8d0492ed21..4b81fed3d4 100644 --- a/Items/Accessories/DarkGodsSheath.cs +++ b/Items/Accessories/DarkGodsSheath.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Accessories { item.width = 48; item.height = 62; - item.value = Item.buyPrice(0, 26, 0, 0); + item.value = CalamityGlobalItem.Rarity9BuyPrice; item.rare = 9; item.accessory = true; } @@ -44,7 +44,6 @@ namespace CalamityMod.Items.Accessories recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 25); recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Accessories/DarkGodsSheath.png b/Items/Accessories/DarkGodsSheath.png index f2bd3b2b32..0a71033b81 100644 Binary files a/Items/Accessories/DarkGodsSheath.png and b/Items/Accessories/DarkGodsSheath.png differ diff --git a/Items/Accessories/DarkSunRing.cs b/Items/Accessories/DarkSunRing.cs index 964a8acf04..5250242bb1 100644 --- a/Items/Accessories/DarkSunRing.cs +++ b/Items/Accessories/DarkSunRing.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Accessories { item.width = 26; item.height = 26; - item.value = Item.buyPrice(0, 90, 0, 0); + item.value = CalamityGlobalItem.Rarity15BuyPrice; item.defense = 10; item.lifeRegen = 1; item.accessory = true; diff --git a/Items/Accessories/DeepDiver.cs b/Items/Accessories/DeepDiver.cs index fc72e63709..811af76c8f 100644 --- a/Items/Accessories/DeepDiver.cs +++ b/Items/Accessories/DeepDiver.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Accessories { item.width = 24; item.height = 28; - item.value = Item.buyPrice(0, 3, 0, 0); + item.value = CalamityGlobalItem.Rarity2BuyPrice; item.rare = 2; item.defense = 2; item.accessory = true; diff --git a/Items/Accessories/DeificAmulet.cs b/Items/Accessories/DeificAmulet.cs index 817a2ef703..f16cee7e64 100644 --- a/Items/Accessories/DeificAmulet.cs +++ b/Items/Accessories/DeificAmulet.cs @@ -22,8 +22,8 @@ namespace CalamityMod.Items.Accessories { item.width = 26; item.height = 26; - item.rare = 8; - item.value = Item.buyPrice(0, 45, 0, 0); + item.rare = 5; + item.value = CalamityGlobalItem.Rarity5BuyPrice; item.accessory = true; } diff --git a/Items/Accessories/DepthCharm.cs b/Items/Accessories/DepthCharm.cs index c728b6e8a9..c4240032a6 100644 --- a/Items/Accessories/DepthCharm.cs +++ b/Items/Accessories/DepthCharm.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Accessories { item.width = 26; item.height = 26; - item.value = Item.buyPrice(0, 9, 0, 0); + item.value = CalamityGlobalItem.Rarity3BuyPrice; item.rare = 3; item.accessory = true; } diff --git a/Items/Accessories/DimensionalSoulArtifact.cs b/Items/Accessories/DimensionalSoulArtifact.cs index 914f1cc56a..cf4d0decef 100644 --- a/Items/Accessories/DimensionalSoulArtifact.cs +++ b/Items/Accessories/DimensionalSoulArtifact.cs @@ -1,6 +1,6 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Plates; using CalamityMod.Items.Placeables.Ores; using Terraria; using Terraria.ID; @@ -22,10 +22,10 @@ namespace CalamityMod.Items.Accessories { item.width = 28; item.height = 28; - item.value = Item.buyPrice(1, 50, 0, 0); + item.value = CalamityGlobalItem.Rarity14BuyPrice; item.accessory = true; item.rare = 10; - item.Calamity().customRarity = CalamityRarity.Developer; + item.Calamity().postMoonLordRarity = 14; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/DraedonsHeart.cs b/Items/Accessories/DraedonsHeart.cs index 78cd45dc35..072aaa4fe6 100644 --- a/Items/Accessories/DraedonsHeart.cs +++ b/Items/Accessories/DraedonsHeart.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Accessories { item.width = 26; item.height = 26; - item.value = Item.buyPrice(0, 60, 0, 0); + item.value = CalamityGlobalItem.Rarity14BuyPrice; item.accessory = true; item.Calamity().customRarity = CalamityRarity.DarkBlue; } diff --git a/Items/Accessories/DragonScales.cs b/Items/Accessories/DragonScales.cs index f421cd630d..7fa2875f7d 100644 --- a/Items/Accessories/DragonScales.cs +++ b/Items/Accessories/DragonScales.cs @@ -9,17 +9,17 @@ namespace CalamityMod.Items.Accessories public override void SetStaticDefaults() { DisplayName.SetDefault("Dragon Scales"); - Tooltip.SetDefault("Causes all rogue projectiles to emit a slow fireball as it travels\n" + + Tooltip.SetDefault("Only a living dragon holds true treasure\n" + + "Rogue projectiles create slow fireballs as they travel\n" + "Stealth strikes create infernados on death\n" + - "After Yharon is dead, you are granted 10% movement speed and acceleration\n" + - "'Only a living dragon holds true treasure'"); + "After Yharon is dead, you gain 10% movement speed and acceleration"); } public override void SetDefaults() { item.width = 32; item.height = 34; - item.value = Item.buyPrice(0, 90, 0, 0); + item.value = CalamityGlobalItem.Rarity15BuyPrice; item.rare = 10; item.Calamity().customRarity = CalamityRarity.Violet; item.accessory = true; diff --git a/Items/Accessories/DukeScales.cs b/Items/Accessories/DukeScales.cs index fc0923c027..36b9e857cf 100644 --- a/Items/Accessories/DukeScales.cs +++ b/Items/Accessories/DukeScales.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Accessories { item.width = 28; item.height = 26; - item.value = Item.buyPrice(0, 80, 0, 0); + item.value = CalamityGlobalItem.Rarity13BuyPrice; item.accessory = true; item.rare = 10; item.Calamity().postMoonLordRarity = 13; diff --git a/Items/Accessories/DynamoStemCells.cs b/Items/Accessories/DynamoStemCells.cs index 551123bb6c..4a090f28ca 100644 --- a/Items/Accessories/DynamoStemCells.cs +++ b/Items/Accessories/DynamoStemCells.cs @@ -18,7 +18,7 @@ Ranged weapons have a chance to fire mini swarmers"); { item.width = 20; item.height = 20; - item.value = Item.buyPrice(0, 60, 0, 0); + item.value = CalamityGlobalItem.Rarity12BuyPrice; item.accessory = true; item.expert = true; item.rare = 10; diff --git a/Items/Accessories/EclipseMirror.cs b/Items/Accessories/EclipseMirror.cs index e62c6a0edf..68b0199c6b 100644 --- a/Items/Accessories/EclipseMirror.cs +++ b/Items/Accessories/EclipseMirror.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Accessories { item.width = 38; item.height = 38; - item.value = Item.buyPrice(0, 90, 0, 0); + item.value = CalamityGlobalItem.Rarity15BuyPrice; item.Calamity().customRarity = CalamityRarity.Violet; item.accessory = true; } diff --git a/Items/Accessories/EldritchSoulArtifact.cs b/Items/Accessories/EldritchSoulArtifact.cs index abc1eb938e..07d49c5be4 100644 --- a/Items/Accessories/EldritchSoulArtifact.cs +++ b/Items/Accessories/EldritchSoulArtifact.cs @@ -1,6 +1,6 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Plates; using CalamityMod.Items.Placeables.Ores; using Terraria; using Terraria.ID; @@ -21,10 +21,10 @@ namespace CalamityMod.Items.Accessories { item.width = 28; item.height = 28; - item.value = Item.buyPrice(1, 50, 0, 0); + item.value = CalamityGlobalItem.Rarity12BuyPrice; item.accessory = true; item.rare = 10; - item.Calamity().customRarity = CalamityRarity.Developer; + item.Calamity().postMoonLordRarity = 12; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/ElectriciansGlove.cs b/Items/Accessories/ElectriciansGlove.cs index 4c65458df2..e383c32a24 100644 --- a/Items/Accessories/ElectriciansGlove.cs +++ b/Items/Accessories/ElectriciansGlove.cs @@ -18,9 +18,9 @@ Stealth strikes also have +30 armor penetration, deal 10% more damage, and heal { item.width = 24; item.height = 40; - item.value = Item.buyPrice(0, 36, 0, 0); + item.value = CalamityGlobalItem.Rarity5BuyPrice; item.accessory = true; - item.rare = 6; + item.rare = 5; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/ElementalGauntlet.cs b/Items/Accessories/ElementalGauntlet.cs index daf2600bb2..6204e7e09a 100644 --- a/Items/Accessories/ElementalGauntlet.cs +++ b/Items/Accessories/ElementalGauntlet.cs @@ -1,6 +1,8 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.World; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -14,22 +16,37 @@ namespace CalamityMod.Items.Accessories DisplayName.SetDefault("Elemental Gauntlet"); Tooltip.SetDefault("Melee attacks and projectiles inflict most debuffs\n" + "15% increased melee speed, damage, and 5% increased melee critical strike chance\n" + + "20% increased true melee damage\n" + "Increased invincibility after taking damage\n" + "Temporary immunity to lava\n" + "Increased melee knockback\n" + - "Melee attacks have a chance to instantly kill normal enemies\n" + - "Provides heat and cold protection in Death Mode"); + "Melee attacks have a chance to instantly kill normal enemies"); } public override void SetDefaults() { item.width = 22; item.height = 38; - item.value = Item.buyPrice(0, 90, 0, 0); + item.value = CalamityGlobalItem.Rarity14BuyPrice; item.accessory = true; item.Calamity().customRarity = CalamityRarity.DarkBlue; } + public override void ModifyTooltips(List list) + { + if (CalamityWorld.death) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip6") + { + line2.text = "Melee attacks have a chance to instantly kill normal enemies\n" + + "Provides heat and cold protection in Death Mode"; + } + } + } + } + public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); diff --git a/Items/Accessories/ElementalQuiver.cs b/Items/Accessories/ElementalQuiver.cs index 0768cc01b8..052e452834 100644 --- a/Items/Accessories/ElementalQuiver.cs +++ b/Items/Accessories/ElementalQuiver.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Accessories { item.width = 28; item.height = 32; - item.value = Item.buyPrice(0, 90, 0, 0); + item.value = CalamityGlobalItem.Rarity14BuyPrice; item.accessory = true; item.Calamity().customRarity = CalamityRarity.DarkBlue; } diff --git a/Items/Accessories/ElysianAegis.cs b/Items/Accessories/ElysianAegis.cs index 18dffeb0f3..6cbd4e0927 100644 --- a/Items/Accessories/ElysianAegis.cs +++ b/Items/Accessories/ElysianAegis.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Accessories { item.width = 48; item.height = 42; - item.value = Item.buyPrice(0, 60, 0, 0); + item.value = CalamityGlobalItem.Rarity12BuyPrice; item.rare = 10; item.Calamity().customRarity = CalamityRarity.Turquoise; item.defense = 8; diff --git a/Items/Accessories/EnchantedPearl.cs b/Items/Accessories/EnchantedPearl.cs index a442616cf2..29815e0cce 100644 --- a/Items/Accessories/EnchantedPearl.cs +++ b/Items/Accessories/EnchantedPearl.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Accessories { item.width = 26; item.height = 26; - item.value = Item.buyPrice(0, 9, 0, 0); + item.value = CalamityGlobalItem.Rarity3BuyPrice; item.rare = 3; item.accessory = true; } diff --git a/Items/Accessories/EnchantedPearl.png b/Items/Accessories/EnchantedPearl.png index a036b0d126..db3018d0fe 100644 Binary files a/Items/Accessories/EnchantedPearl.png and b/Items/Accessories/EnchantedPearl.png differ diff --git a/Items/Accessories/EtherealExtorter.cs b/Items/Accessories/EtherealExtorter.cs index 5137bbf7b8..97b80debc1 100644 --- a/Items/Accessories/EtherealExtorter.cs +++ b/Items/Accessories/EtherealExtorter.cs @@ -19,7 +19,7 @@ Rogue projectiles rarely explode into homing souls item.width = 28; item.height = 32; item.accessory = true; - item.value = Item.buyPrice(0, 24, 0, 0); + item.value = CalamityGlobalItem.Rarity8BuyPrice; item.rare = 8; } diff --git a/Items/Accessories/EtherealTalisman.cs b/Items/Accessories/EtherealTalisman.cs index 4195c10187..0bbd4820a5 100644 --- a/Items/Accessories/EtherealTalisman.cs +++ b/Items/Accessories/EtherealTalisman.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Accessories { item.width = 28; item.height = 32; - item.value = Item.buyPrice(0, 90, 0, 0); + item.value = CalamityGlobalItem.Rarity14BuyPrice; item.accessory = true; item.Calamity().customRarity = CalamityRarity.DarkBlue; } diff --git a/Items/Accessories/EvasionScarf.cs b/Items/Accessories/EvasionScarf.cs index da59176343..9907cb2e8c 100644 --- a/Items/Accessories/EvasionScarf.cs +++ b/Items/Accessories/EvasionScarf.cs @@ -11,10 +11,12 @@ namespace CalamityMod.Items.Accessories public override void SetStaticDefaults() { DisplayName.SetDefault("Evasion Scarf"); - Tooltip.SetDefault("True melee strikes deal 30% more damage\n" + + Tooltip.SetDefault("True melee strikes deal 25% more damage\n" + "Grants the ability to dash; dashing into an attack will cause you to dodge it\n" + "After a dodge you will be granted a buff to all damage, melee speed, and all crit chance for a short time\n" + - "After a successful dodge you must wait 13 seconds before you can dodge again"); + "After a successful dodge you must wait 13 seconds before you can dodge again\n" + + "This cooldown will be 50 percent longer if you have Chaos State\n" + + "While on cooldown, Chaos State will be 50 percent longer"); } public override void SetDefaults() diff --git a/Items/Accessories/EyeoftheStorm.cs b/Items/Accessories/EyeoftheStorm.cs index 2141387886..504321cdfd 100644 --- a/Items/Accessories/EyeoftheStorm.cs +++ b/Items/Accessories/EyeoftheStorm.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Accessories { item.width = 20; item.height = 26; - item.value = Item.buyPrice(0, 15, 0, 0); + item.value = CalamityGlobalItem.Rarity5BuyPrice; item.rare = 5; item.accessory = true; } diff --git a/Items/Accessories/FabledTortoiseShell.cs b/Items/Accessories/FabledTortoiseShell.cs index f823e69be8..3e4fe0f5f2 100644 --- a/Items/Accessories/FabledTortoiseShell.cs +++ b/Items/Accessories/FabledTortoiseShell.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Accessories item.defense = 35; item.width = 20; item.height = 24; - item.value = Item.buyPrice(0, 9, 0, 0); + item.value = CalamityGlobalItem.Rarity5BuyPrice; item.rare = 5; item.accessory = true; item.Calamity().customRarity = CalamityRarity.RareVariant; diff --git a/Items/Accessories/FeatherCrown.cs b/Items/Accessories/FeatherCrown.cs index a81b82e21a..a4b606de33 100644 --- a/Items/Accessories/FeatherCrown.cs +++ b/Items/Accessories/FeatherCrown.cs @@ -19,8 +19,8 @@ namespace CalamityMod.Items.Accessories { item.width = 44; item.height = 38; - item.value = Item.buyPrice(0, 0, 80, 0); - item.rare = 4; + item.value = CalamityGlobalItem.Rarity3BuyPrice; + item.rare = 3; item.accessory = true; } diff --git a/Items/Accessories/FilthyGlove.cs b/Items/Accessories/FilthyGlove.cs index 5bef54139a..e3d57f7170 100644 --- a/Items/Accessories/FilthyGlove.cs +++ b/Items/Accessories/FilthyGlove.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Accessories { item.width = 24; item.height = 38; - item.value = Item.buyPrice(0, 4, 0, 0); + item.value = CalamityGlobalItem.Rarity3BuyPrice; item.accessory = true; item.rare = 3; } diff --git a/Items/Accessories/FleshTotem.cs b/Items/Accessories/FleshTotem.cs index b4ae75b762..b3d392cc8c 100644 --- a/Items/Accessories/FleshTotem.cs +++ b/Items/Accessories/FleshTotem.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Accessories item.width = 26; item.height = 26; item.rare = 8; - item.value = Item.buyPrice(0, 24, 0, 0); + item.value = CalamityGlobalItem.Rarity8BuyPrice; item.accessory = true; } diff --git a/Items/Accessories/FrigidBulwark.cs b/Items/Accessories/FrigidBulwark.cs index ae11e4f707..781cffd5c5 100644 --- a/Items/Accessories/FrigidBulwark.cs +++ b/Items/Accessories/FrigidBulwark.cs @@ -1,5 +1,7 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.World; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -15,20 +17,34 @@ namespace CalamityMod.Items.Accessories "Only active above 25% life\n" + "Grants immunity to knockback\n" + "Puts a shell around the owner when below 50% life that reduces damage\n" + - "The shell becomes more powerful when below 15% life and reduces damage even further\n" + - "Provides heat and cold protection in Death Mode"); + "The shell becomes more powerful when below 15% life and reduces damage even further"); } public override void SetDefaults() { item.width = 38; item.height = 44; - item.value = Item.buyPrice(0, 30, 0, 0); - item.rare = 9; + item.value = CalamityGlobalItem.Rarity7BuyPrice; + item.rare = 7; item.defense = 8; item.accessory = true; } + public override void ModifyTooltips(List list) + { + if (CalamityWorld.death) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip4") + { + line2.text = "The shell becomes more powerful when below 15% life and reduces damage even further\n" + + "Provides heat and cold protection in Death Mode"; + } + } + } + } + public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); diff --git a/Items/Accessories/FrostBarrier.cs b/Items/Accessories/FrostBarrier.cs index 63c0da9caf..95b82045cb 100644 --- a/Items/Accessories/FrostBarrier.cs +++ b/Items/Accessories/FrostBarrier.cs @@ -1,5 +1,8 @@ using CalamityMod.CalPlayer; +using CalamityMod.World; +using System.Collections.Generic; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories @@ -10,8 +13,7 @@ namespace CalamityMod.Items.Accessories { DisplayName.SetDefault("Frost Barrier"); Tooltip.SetDefault("You will freeze enemies near you when you are struck\n" + - "You are immune to the chilled debuff\n" + - "Provides heat and cold protection in Death Mode"); + "You are immune to the chilled debuff"); } public override void SetDefaults() @@ -19,16 +21,31 @@ namespace CalamityMod.Items.Accessories item.defense = 4; item.width = 20; item.height = 24; - item.value = Item.buyPrice(0, 9, 0, 0); - item.rare = 3; + item.value = CalamityGlobalItem.Rarity4BuyPrice; + item.rare = 4; item.accessory = true; } + public override void ModifyTooltips(List list) + { + if (CalamityWorld.death) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip1") + { + line2.text = "You are immune to the chilled debuff\n" + + "Provides heat and cold protection in Death Mode"; + } + } + } + } + public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); modPlayer.fBarrier = true; - player.buffImmune[46] = true; + player.buffImmune[BuffID.Chilled] = true; } } } diff --git a/Items/Accessories/FrostFlare.cs b/Items/Accessories/FrostFlare.cs index f66a8c5566..17507e218b 100644 --- a/Items/Accessories/FrostFlare.cs +++ b/Items/Accessories/FrostFlare.cs @@ -1,4 +1,6 @@ using CalamityMod.CalPlayer; +using CalamityMod.World; +using System.Collections.Generic; using Terraria; using Terraria.DataStructures; using Terraria.ModLoader; @@ -15,8 +17,7 @@ namespace CalamityMod.Items.Accessories "Resistant to cold attacks and +1 life regen\n" + "Being above 75% life grants the player 10% increased damage\n" + "Being below 25% life grants the player 10 defense and 15% increased max movement speed and acceleration\n" + - "Provides heat and cold protection in Death Mode\n" + - "Revengeance drop"); + "Revengeance drop"); Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(5, 4)); } @@ -25,11 +26,26 @@ namespace CalamityMod.Items.Accessories item.width = 20; item.height = 24; item.lifeRegen = 1; - item.value = Item.buyPrice(0, 24, 0, 0); + item.value = CalamityGlobalItem.Rarity5BuyPrice; item.rare = 5; item.accessory = true; } + public override void ModifyTooltips(List list) + { + if (CalamityWorld.death) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip5") + { + line2.text = "Provides heat and cold protection in Death Mode\n" + + "Revengeance drop"; + } + } + } + } + public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); diff --git a/Items/Accessories/FungalCarapace.cs b/Items/Accessories/FungalCarapace.cs index d7beaa3eee..9585986dde 100644 --- a/Items/Accessories/FungalCarapace.cs +++ b/Items/Accessories/FungalCarapace.cs @@ -17,8 +17,8 @@ namespace CalamityMod.Items.Accessories item.defense = 2; item.width = 20; item.height = 24; - item.value = Item.buyPrice(0, 15, 0, 0); - item.rare = 5; + item.value = CalamityGlobalItem.Rarity4BuyPrice; + item.rare = 4; item.accessory = true; } diff --git a/Items/Accessories/FungalClump.cs b/Items/Accessories/FungalClump.cs index cd885de770..4b69a53c36 100644 --- a/Items/Accessories/FungalClump.cs +++ b/Items/Accessories/FungalClump.cs @@ -20,9 +20,9 @@ namespace CalamityMod.Items.Accessories { item.width = 20; item.height = 26; - item.value = Item.buyPrice(0, 9, 0, 0); + item.value = CalamityGlobalItem.Rarity2BuyPrice; item.expert = true; - item.rare = 9; + item.rare = 2; item.accessory = true; } diff --git a/Items/Accessories/FungalSymbiote.cs b/Items/Accessories/FungalSymbiote.cs index 836fdadad8..c49ea8fb6d 100644 --- a/Items/Accessories/FungalSymbiote.cs +++ b/Items/Accessories/FungalSymbiote.cs @@ -10,14 +10,14 @@ namespace CalamityMod.Items.Accessories { DisplayName.SetDefault("Fungal Symbiote"); Tooltip.SetDefault("Various melee weapons emit mushrooms in true melee range\n" + - "True melee strikes deal 25% more damage"); + "True melee strikes deal 15% more damage"); } public override void SetDefaults() { item.width = 38; item.height = 36; - item.value = Item.buyPrice(0, 9, 0, 0); + item.value = CalamityGlobalItem.Rarity3BuyPrice; item.rare = 3; item.accessory = true; } diff --git a/Items/Accessories/Gehenna.cs b/Items/Accessories/Gehenna.cs index 71e1f63069..48d6d40aca 100644 --- a/Items/Accessories/Gehenna.cs +++ b/Items/Accessories/Gehenna.cs @@ -21,9 +21,9 @@ namespace CalamityMod.Items.Accessories { item.width = 26; item.height = 26; - item.value = Item.buyPrice(0, 15, 0, 0); + item.value = CalamityGlobalItem.Rarity5BuyPrice; item.expert = true; - item.rare = 9; + item.rare = 5; item.accessory = true; } diff --git a/Items/Accessories/GiantPearl.cs b/Items/Accessories/GiantPearl.cs index 0c82ffe5c3..c2e119ac94 100644 --- a/Items/Accessories/GiantPearl.cs +++ b/Items/Accessories/GiantPearl.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Accessories { item.width = 42; item.height = 32; - item.value = Item.buyPrice(0, 3, 0, 0); + item.value = CalamityGlobalItem.Rarity2BuyPrice; item.rare = 2; item.accessory = true; } @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Accessories { CalamityPlayer modPlayer = player.Calamity(); modPlayer.giantPearl = true; - Lighting.AddLight((int)(player.position.X + (float)(player.width / 2)) / 16, (int)(player.position.Y + (float)(player.height / 2)) / 16, 0.45f, 0.8f, 0.8f); + Lighting.AddLight((int)player.Center.X / 16, (int)player.Center.Y / 16, 0.45f, 0.8f, 0.8f); } } } diff --git a/Items/Accessories/GiantShell.cs b/Items/Accessories/GiantShell.cs index d298b0c214..c569253fea 100644 --- a/Items/Accessories/GiantShell.cs +++ b/Items/Accessories/GiantShell.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Accessories item.defense = 6; item.width = 20; item.height = 24; - item.value = Item.buyPrice(0, 3, 0, 0); + item.value = CalamityGlobalItem.Rarity1BuyPrice; item.rare = 1; item.accessory = true; } diff --git a/Items/Accessories/GiantTortoiseShell.cs b/Items/Accessories/GiantTortoiseShell.cs index 797b62bd62..c1fd1e6daa 100644 --- a/Items/Accessories/GiantTortoiseShell.cs +++ b/Items/Accessories/GiantTortoiseShell.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Accessories item.defense = 8; item.width = 20; item.height = 24; - item.value = Item.buyPrice(0, 9, 0, 0); + item.value = CalamityGlobalItem.Rarity5BuyPrice; item.rare = 5; item.accessory = true; } diff --git a/Items/Accessories/GladiatorsLocket.cs b/Items/Accessories/GladiatorsLocket.cs index 92d8991cd4..98e567de6d 100644 --- a/Items/Accessories/GladiatorsLocket.cs +++ b/Items/Accessories/GladiatorsLocket.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Accessories { item.width = 42; item.height = 36; - item.value = Item.buyPrice(0, 9, 0, 0); + item.value = CalamityGlobalItem.Rarity3BuyPrice; item.rare = 3; item.defense = 5; item.accessory = true; diff --git a/Items/Accessories/GloveOfRecklessness.cs b/Items/Accessories/GloveOfRecklessness.cs index 8ccd8226ee..f907f1d508 100644 --- a/Items/Accessories/GloveOfRecklessness.cs +++ b/Items/Accessories/GloveOfRecklessness.cs @@ -17,9 +17,9 @@ namespace CalamityMod.Items.Accessories { item.width = 24; item.height = 40; - item.value = Item.buyPrice(0, 50, 0, 0); + item.value = CalamityGlobalItem.Rarity7BuyPrice; item.accessory = true; - item.rare = 8; + item.rare = 7; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/GloveofPrecision.cs b/Items/Accessories/GloveofPrecision.cs index afd6a5a729..1233028f28 100644 --- a/Items/Accessories/GloveofPrecision.cs +++ b/Items/Accessories/GloveofPrecision.cs @@ -16,9 +16,9 @@ namespace CalamityMod.Items.Accessories { item.width = 24; item.height = 40; - item.value = Item.buyPrice(0, 50, 0, 0); + item.value = CalamityGlobalItem.Rarity7BuyPrice; item.accessory = true; - item.rare = 8; + item.rare = 7; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/GodlySoulArtifact.cs b/Items/Accessories/GodlySoulArtifact.cs index b3afb40c51..b146ccbf2b 100644 --- a/Items/Accessories/GodlySoulArtifact.cs +++ b/Items/Accessories/GodlySoulArtifact.cs @@ -1,6 +1,6 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Plates; using CalamityMod.Items.Placeables.Ores; using Terraria; using Terraria.ID; @@ -21,10 +21,10 @@ namespace CalamityMod.Items.Accessories { item.width = 28; item.height = 28; - item.value = Item.buyPrice(1, 50, 0, 0); + item.value = CalamityGlobalItem.Rarity15BuyPrice; item.accessory = true; item.rare = 10; - item.Calamity().customRarity = CalamityRarity.Developer; + item.Calamity().customRarity = CalamityRarity.Violet; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/GoldBurdenBreaker.cs b/Items/Accessories/GoldBurdenBreaker.cs index b4fae34092..1c76b66fe3 100644 --- a/Items/Accessories/GoldBurdenBreaker.cs +++ b/Items/Accessories/GoldBurdenBreaker.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Accessories { item.width = 28; item.height = 28; - item.value = Item.buyPrice(0, 21, 0, 0); + item.value = CalamityGlobalItem.Rarity12BuyPrice; item.rare = 10; item.accessory = true; item.Calamity().customRarity = CalamityRarity.Turquoise; diff --git a/Items/Accessories/GrandGelatin.cs b/Items/Accessories/GrandGelatin.cs index c25916bf5c..e28518e65d 100644 --- a/Items/Accessories/GrandGelatin.cs +++ b/Items/Accessories/GrandGelatin.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,7 +12,7 @@ namespace CalamityMod.Items.Accessories { DisplayName.SetDefault("Grand Gelatin"); Tooltip.SetDefault("10% increased movement speed\n" + - "200% increased jump speed\n" + + "40% increased jump speed\n" + "+20 max life and mana\n" + "Standing still boosts life and mana regen"); } @@ -20,18 +21,31 @@ namespace CalamityMod.Items.Accessories { item.width = 20; item.height = 24; - item.value = Item.buyPrice(0, 15, 0, 0); - item.rare = 6; + item.value = CalamityGlobalItem.Rarity5BuyPrice; + item.rare = 5; item.accessory = true; } + public override void ModifyTooltips(List list) + { + bool autoJump = Main.player[Main.myPlayer].autoJump; + string jumpAmt = autoJump ? "10" : "40"; + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip1") + { + line2.text = jumpAmt + "% increased jump speed"; + } + } + } + public override void UpdateAccessory(Player player, bool hideVisual) { player.moveSpeed += 0.1f; - player.jumpSpeedBoost += player.autoJump ? 0.5f : 2.0f; + player.jumpSpeedBoost += player.autoJump ? 0.5f : 2f; player.statLifeMax2 += 20; player.statManaMax2 += 20; - if ((double)Math.Abs(player.velocity.X) < 0.05 && (double)Math.Abs(player.velocity.Y) < 0.05 && player.itemAnimation == 0) + if (Math.Abs(player.velocity.X) < 0.05f && Math.Abs(player.velocity.Y) < 0.05f && player.itemAnimation == 0) { player.lifeRegen += 2; player.manaRegenBonus += 2; diff --git a/Items/Accessories/GravistarSabaton.cs b/Items/Accessories/GravistarSabaton.cs index 20d5a68d72..e000d073fc 100644 --- a/Items/Accessories/GravistarSabaton.cs +++ b/Items/Accessories/GravistarSabaton.cs @@ -17,10 +17,10 @@ namespace CalamityMod.Items.Accessories { item.width = 20; item.height = 22; - item.value = Item.buyPrice(0, 30, 0, 0); + item.value = CalamityGlobalItem.Rarity7BuyPrice; item.accessory = true; item.expert = true; - item.rare = 9; + item.rare = 7; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/HarpyRing.cs b/Items/Accessories/HarpyRing.cs index bd7e8fea56..44321bfe6e 100644 --- a/Items/Accessories/HarpyRing.cs +++ b/Items/Accessories/HarpyRing.cs @@ -19,8 +19,8 @@ namespace CalamityMod.Items.Accessories { item.width = 20; item.height = 22; - item.value = Item.buyPrice(0, 3, 0, 0); - item.rare = 4; + item.value = CalamityGlobalItem.Rarity3BuyPrice; + item.rare = 3; item.accessory = true; } diff --git a/Items/Accessories/HeartofDarkness.cs b/Items/Accessories/HeartofDarkness.cs index 81e7c7d448..478ba78681 100644 --- a/Items/Accessories/HeartofDarkness.cs +++ b/Items/Accessories/HeartofDarkness.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Accessories { item.width = 26; item.height = 26; - item.value = Item.buyPrice(0, 9, 0, 0); + item.value = CalamityGlobalItem.Rarity3BuyPrice; item.rare = 3; item.accessory = true; } diff --git a/Items/Accessories/HeartoftheElements.cs b/Items/Accessories/HeartoftheElements.cs index c8a91869d6..0fb723f893 100644 --- a/Items/Accessories/HeartoftheElements.cs +++ b/Items/Accessories/HeartoftheElements.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Accessories DisplayName.SetDefault("Heart of the Elements"); Tooltip.SetDefault("The heart of the world\n" + "Increases max life by 20, life regen by 1, and all damage by 8%\n" + - "Increases movement speed by 10% and jump speed by 100%\n" + + "Increases movement speed by 10% and jump speed by 20%\n" + "Increases damage reduction by 5%\n" + "Increases max mana by 50 and reduces mana usage by 5%\n" + "You grow flowers on the grass beneath you, chance to grow very random dye plants on grassless dirt\n" + @@ -32,7 +32,8 @@ namespace CalamityMod.Items.Accessories { item.width = 20; item.height = 20; - item.value = Item.buyPrice(0, 60, 0, 0); + item.value = CalamityGlobalItem.Rarity10BuyPrice; + item.rare = 10; item.defense = 9; item.accessory = true; item.Calamity().customRarity = CalamityRarity.Rainbow; diff --git a/Items/Accessories/HideofAstrumDeus.cs b/Items/Accessories/HideofAstrumDeus.cs index d382fc8b19..496099c033 100644 --- a/Items/Accessories/HideofAstrumDeus.cs +++ b/Items/Accessories/HideofAstrumDeus.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Accessories public override void SetStaticDefaults() { DisplayName.SetDefault("Hide of Astrum Deus"); - Tooltip.SetDefault("Taking damage drops an immense amount of astral stars from the sky and boosts true melee damage by 200% for a time\n" + + Tooltip.SetDefault("Taking damage drops an immense amount of astral stars from the sky and boosts true melee damage by 50% for a time\n" + "Boost duration is based on the amount of damage you took, the higher the damage the longer the boost\n" + "Provides immunity to the astral infection, cursed inferno, on fire, and frostburn debuffs\n" + "Enemies take damage when they hit you and are inflicted with the astral infection debuff"); @@ -21,7 +21,8 @@ namespace CalamityMod.Items.Accessories { item.width = 26; item.height = 26; - item.value = Item.buyPrice(0, 30, 0, 0); + item.value = CalamityGlobalItem.Rarity9BuyPrice; + item.rare = 9; item.accessory = true; item.Calamity().customRarity = CalamityRarity.RareVariant; } diff --git a/Items/Accessories/HoneyDew.cs b/Items/Accessories/HoneyDew.cs index 1272f5c886..e9d1fade78 100644 --- a/Items/Accessories/HoneyDew.cs +++ b/Items/Accessories/HoneyDew.cs @@ -1,4 +1,5 @@ using CalamityMod.CalPlayer; +using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -20,8 +21,8 @@ namespace CalamityMod.Items.Accessories { item.width = 20; item.height = 20; - item.value = Item.buyPrice(0, 15, 0, 0); - item.rare = 7; + item.value = CalamityGlobalItem.Rarity4BuyPrice; + item.rare = 4; item.accessory = true; } @@ -35,8 +36,8 @@ namespace CalamityMod.Items.Accessories player.statDefense += 5; player.endurance += 0.05f; } - player.buffImmune[70] = true; - player.buffImmune[20] = true; + player.buffImmune[BuffID.Venom] = true; + player.buffImmune[BuffID.Poisoned] = true; if (!player.honey && player.lifeRegen < 0) { player.lifeRegen += 2; @@ -54,8 +55,9 @@ namespace CalamityMod.Items.Accessories ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ItemID.BottledHoney, 10); - recipe.AddIngredient(ItemID.BeeWax, 10); - recipe.AddIngredient(ItemID.Bezoar); + recipe.AddIngredient(ModContent.ItemType(), 2); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType(), 3); recipe.AddTile(TileID.MythrilAnvil); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Accessories/InkBomb.cs b/Items/Accessories/InkBomb.cs index ba91beb059..a9b42a24b3 100644 --- a/Items/Accessories/InkBomb.cs +++ b/Items/Accessories/InkBomb.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Accessories { item.width = 22; item.height = 50; - item.value = Item.buyPrice(0, 3, 0, 0); + item.value = CalamityGlobalItem.Rarity3BuyPrice; item.rare = 3; item.accessory = true; } @@ -28,9 +28,5 @@ namespace CalamityMod.Items.Accessories CalamityPlayer modPlayer = player.Calamity(); modPlayer.inkBomb = true; } - - public override void AddRecipes() - { - } } } diff --git a/Items/Accessories/IronBoots.cs b/Items/Accessories/IronBoots.cs index 17ee004f75..905159b88d 100644 --- a/Items/Accessories/IronBoots.cs +++ b/Items/Accessories/IronBoots.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Accessories { item.width = 26; item.height = 26; - item.value = Item.buyPrice(0, 9, 0, 0); + item.value = CalamityGlobalItem.Rarity3BuyPrice; item.rare = 3; item.accessory = true; } diff --git a/Items/Accessories/JellyChargedBattery.cs b/Items/Accessories/JellyChargedBattery.cs index 6eaf774eff..2da23872fb 100644 --- a/Items/Accessories/JellyChargedBattery.cs +++ b/Items/Accessories/JellyChargedBattery.cs @@ -18,9 +18,9 @@ namespace CalamityMod.Items.Accessories { item.width = 20; item.height = 22; - item.value = Item.buyPrice(0, 2, 0, 0); + item.value = CalamityGlobalItem.Rarity4BuyPrice; item.accessory = true; - item.rare = 3; + item.rare = 4; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/Laudanum.cs b/Items/Accessories/Laudanum.cs index 9cef7a4e86..7be348eff8 100644 --- a/Items/Accessories/Laudanum.cs +++ b/Items/Accessories/Laudanum.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Accessories { item.width = 26; item.height = 26; - item.value = Item.buyPrice(0, 9, 0, 0); + item.value = CalamityGlobalItem.Rarity3BuyPrice; item.rare = 3; item.accessory = true; } diff --git a/Items/Accessories/LeadCore.cs b/Items/Accessories/LeadCore.cs index 52fc9a0b46..96002b3fcf 100644 --- a/Items/Accessories/LeadCore.cs +++ b/Items/Accessories/LeadCore.cs @@ -15,8 +15,8 @@ namespace CalamityMod.Items.Accessories { item.width = 26; item.height = 26; - item.rare = 2; - item.value = Item.buyPrice(0, 3, 0, 0); + item.rare = 5; + item.value = CalamityGlobalItem.Rarity5BuyPrice; item.accessory = true; } diff --git a/Items/Accessories/LeviathanAmbergris.cs b/Items/Accessories/LeviathanAmbergris.cs index 010f303042..ab037f4cf8 100644 --- a/Items/Accessories/LeviathanAmbergris.cs +++ b/Items/Accessories/LeviathanAmbergris.cs @@ -21,10 +21,10 @@ namespace CalamityMod.Items.Accessories { item.width = 20; item.height = 22; - item.value = Item.buyPrice(0, 30, 0, 0); + item.value = CalamityGlobalItem.Rarity7BuyPrice; item.accessory = true; item.expert = true; - item.rare = 9; + item.rare = 7; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/LeviathanAmbergris.png b/Items/Accessories/LeviathanAmbergris.png index 88034a76f7..35d439497c 100644 Binary files a/Items/Accessories/LeviathanAmbergris.png and b/Items/Accessories/LeviathanAmbergris.png differ diff --git a/Items/Accessories/LifeJelly.cs b/Items/Accessories/LifeJelly.cs index c7c79a17bf..bfe74550a5 100644 --- a/Items/Accessories/LifeJelly.cs +++ b/Items/Accessories/LifeJelly.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Accessories { item.width = 20; item.height = 24; - item.value = Item.buyPrice(0, 6, 0, 0); + item.value = CalamityGlobalItem.Rarity1BuyPrice; item.rare = 1; item.accessory = true; } diff --git a/Items/Accessories/LivingDew.cs b/Items/Accessories/LivingDew.cs index 1840c1cd34..43eb694e8c 100644 --- a/Items/Accessories/LivingDew.cs +++ b/Items/Accessories/LivingDew.cs @@ -10,15 +10,16 @@ namespace CalamityMod.Items.Accessories public override void SetStaticDefaults() { DisplayName.SetDefault("Living Dew"); - Tooltip.SetDefault("5% increased damage reduction, +5 defense, and increased life regen while in the Jungle"); + Tooltip.SetDefault("5% increased damage reduction, +5 defense, and increased life regen while in the Jungle\n" + + "Immunity to Poison"); } public override void SetDefaults() { item.width = 20; item.height = 20; - item.value = Item.buyPrice(0, 12, 0, 0); - item.rare = 5; + item.value = CalamityGlobalItem.Rarity3BuyPrice; + item.rare = 3; item.accessory = true; } @@ -30,17 +31,17 @@ namespace CalamityMod.Items.Accessories player.statDefense += 5; player.endurance += 0.05f; } + player.buffImmune[BuffID.Poisoned] = true; } public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddIngredient(ModContent.ItemType(), 2); recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddTile(TileID.MythrilAnvil); + recipe.AddIngredient(ItemID.BeeWax, 10); + recipe.AddIngredient(ItemID.Bezoar); + recipe.AddTile(TileID.Anvils); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Accessories/LumenousAmulet.cs b/Items/Accessories/LumenousAmulet.cs index 0247f2cfd0..6e49778897 100644 --- a/Items/Accessories/LumenousAmulet.cs +++ b/Items/Accessories/LumenousAmulet.cs @@ -22,8 +22,8 @@ namespace CalamityMod.Items.Accessories { item.width = 26; item.height = 26; - item.value = Item.buyPrice(0, 15, 0, 0); - item.rare = 5; + item.value = CalamityGlobalItem.Rarity7BuyPrice; + item.rare = 7; item.accessory = true; } diff --git a/Items/Accessories/LureofEnthrallment.cs b/Items/Accessories/LureofEnthrallment.cs index 458d27f756..fc0f696056 100644 --- a/Items/Accessories/LureofEnthrallment.cs +++ b/Items/Accessories/LureofEnthrallment.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Accessories { item.width = 56; item.height = 56; - item.value = Item.buyPrice(0, 30, 0, 0); + item.value = CalamityGlobalItem.Rarity7BuyPrice; item.rare = 7; item.accessory = true; } diff --git a/Items/Accessories/LureofEnthrallment.png b/Items/Accessories/LureofEnthrallment.png index 91eb37c1de..d89b82671e 100644 Binary files a/Items/Accessories/LureofEnthrallment.png and b/Items/Accessories/LureofEnthrallment.png differ diff --git a/Items/Accessories/LuxorsGift.cs b/Items/Accessories/LuxorsGift.cs index 8909f72368..e2748a26da 100644 --- a/Items/Accessories/LuxorsGift.cs +++ b/Items/Accessories/LuxorsGift.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Accessories { item.width = 58; item.height = 48; - item.value = Item.buyPrice(0, 9, 0, 0); + item.value = CalamityGlobalItem.Rarity3BuyPrice; item.rare = 3; item.accessory = true; } diff --git a/Items/Accessories/ManaJelly.cs b/Items/Accessories/ManaJelly.cs index 28ad8ae3ce..e44bfa8874 100644 --- a/Items/Accessories/ManaJelly.cs +++ b/Items/Accessories/ManaJelly.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Accessories { item.width = 20; item.height = 24; - item.value = Item.buyPrice(0, 6, 0, 0); + item.value = CalamityGlobalItem.Rarity1BuyPrice; item.rare = 1; item.accessory = true; } diff --git a/Items/Accessories/ManaOverloader.cs b/Items/Accessories/ManaOverloader.cs index 5d4d6691e3..48550050ea 100644 --- a/Items/Accessories/ManaOverloader.cs +++ b/Items/Accessories/ManaOverloader.cs @@ -12,6 +12,7 @@ namespace CalamityMod.Items.Accessories Tooltip.SetDefault("Increases max mana by 50 and magic damage by 6%\n" + "Life regen lowered by 3 if mana is above 50% of its maximum\n" + "Grants spectre healing, the amount healed scales with your mana\n" + + "The healing only works while holding a magic weapon\n" + "The more mana you have, the more you heal"); } @@ -19,8 +20,8 @@ namespace CalamityMod.Items.Accessories { item.width = 30; item.height = 30; - item.value = Item.buyPrice(0, 15, 0, 0); - item.rare = 9; + item.value = CalamityGlobalItem.Rarity4BuyPrice; + item.rare = 4; item.accessory = true; item.expert = true; } diff --git a/Items/Accessories/MirageMirror.cs b/Items/Accessories/MirageMirror.cs index 5877e21aa2..a77f7ed2aa 100644 --- a/Items/Accessories/MirageMirror.cs +++ b/Items/Accessories/MirageMirror.cs @@ -19,8 +19,8 @@ namespace CalamityMod.Items.Accessories { item.width = 30; item.height = 30; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; + item.value = CalamityGlobalItem.Rarity3BuyPrice; + item.rare = 3; item.accessory = true; } diff --git a/Items/Accessories/MomentumCapacitor.cs b/Items/Accessories/MomentumCapacitor.cs index 30431528d9..0d14790fb1 100644 --- a/Items/Accessories/MomentumCapacitor.cs +++ b/Items/Accessories/MomentumCapacitor.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Accessories item.height = 32; item.value = Item.buyPrice(0, 36, 0, 0); item.accessory = true; - item.rare = 6; + item.rare = 5; } public override void ModifyTooltips(List list) diff --git a/Items/Accessories/MoonstoneCrown.cs b/Items/Accessories/MoonstoneCrown.cs index 18a590a446..d913dd1257 100644 --- a/Items/Accessories/MoonstoneCrown.cs +++ b/Items/Accessories/MoonstoneCrown.cs @@ -20,7 +20,8 @@ namespace CalamityMod.Items.Accessories { item.width = 46; item.height = 40; - item.value = Item.buyPrice(0, 18, 0, 0); + item.value = CalamityGlobalItem.Rarity12BuyPrice; + item.rare = 10; item.Calamity().customRarity = CalamityRarity.Turquoise; item.accessory = true; } diff --git a/Items/Accessories/MutatedTruffle.cs b/Items/Accessories/MutatedTruffle.cs index 62f7b7c671..14263c6d8a 100644 --- a/Items/Accessories/MutatedTruffle.cs +++ b/Items/Accessories/MutatedTruffle.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Accessories { item.width = 24; item.height = 26; - item.value = Item.buyPrice(0, 80, 0, 0); + item.value = CalamityGlobalItem.Rarity13BuyPrice; item.rare = 10; item.expert = true; item.accessory = true; diff --git a/Items/Accessories/Nanotech.cs b/Items/Accessories/Nanotech.cs index e0c77bf200..bd8640bb9c 100644 --- a/Items/Accessories/Nanotech.cs +++ b/Items/Accessories/Nanotech.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Accessories { item.width = 28; item.height = 32; - item.value = Item.buyPrice(0, 90, 0, 0); + item.value = CalamityGlobalItem.Rarity14BuyPrice; item.accessory = true; item.Calamity().customRarity = CalamityRarity.DarkBlue; } diff --git a/Items/Accessories/NebulousCore.cs b/Items/Accessories/NebulousCore.cs index 3063cedc7e..36e10f9c87 100644 --- a/Items/Accessories/NebulousCore.cs +++ b/Items/Accessories/NebulousCore.cs @@ -21,10 +21,10 @@ namespace CalamityMod.Items.Accessories { item.width = 16; item.height = 14; - item.value = Item.buyPrice(0, 60, 0, 0); + item.value = CalamityGlobalItem.Rarity13BuyPrice; item.accessory = true; item.expert = true; - item.rare = 9; + item.rare = 10; } public override void Update(ref float gravity, ref float maxFallSpeed) diff --git a/Items/Accessories/NecklaceofVexation.cs b/Items/Accessories/NecklaceofVexation.cs index 78832ad83c..6002f0375b 100644 --- a/Items/Accessories/NecklaceofVexation.cs +++ b/Items/Accessories/NecklaceofVexation.cs @@ -20,8 +20,8 @@ namespace CalamityMod.Items.Accessories { item.width = 26; item.height = 34; - item.value = Item.buyPrice(0, 15, 0, 0); - item.rare = 6; + item.value = CalamityGlobalItem.Rarity7BuyPrice; + item.rare = 7; item.accessory = true; } diff --git a/Items/Accessories/NuclearRod.cs b/Items/Accessories/NuclearRod.cs index 108be9407b..bb51bbeb83 100644 --- a/Items/Accessories/NuclearRod.cs +++ b/Items/Accessories/NuclearRod.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Accessories { item.width = 28; item.height = 32; - item.value = Item.buyPrice(0, 25, 0, 0); + item.value = CalamityGlobalItem.Rarity5BuyPrice; item.rare = 5; item.accessory = true; } diff --git a/Items/Accessories/Nucleogenesis.cs b/Items/Accessories/Nucleogenesis.cs index 4a53b5bd86..ab9cce1062 100644 --- a/Items/Accessories/Nucleogenesis.cs +++ b/Items/Accessories/Nucleogenesis.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Accessories { item.width = 28; item.height = 32; - item.value = Item.buyPrice(0, 90, 0, 0); + item.value = CalamityGlobalItem.Rarity14BuyPrice; item.accessory = true; item.Calamity().customRarity = CalamityRarity.DarkBlue; } diff --git a/Items/Accessories/OceanCrest.cs b/Items/Accessories/OceanCrest.cs index 300b61afed..e983282be5 100644 --- a/Items/Accessories/OceanCrest.cs +++ b/Items/Accessories/OceanCrest.cs @@ -1,4 +1,5 @@ using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories @@ -15,19 +16,19 @@ namespace CalamityMod.Items.Accessories { item.width = 18; item.height = 26; - item.value = Item.buyPrice(0, 6, 0, 0); - item.rare = 9; + item.value = CalamityGlobalItem.Rarity2BuyPrice; + item.rare = 2; item.accessory = true; item.expert = true; } public override void UpdateAccessory(Player player, bool hideVisual) { - player.npcTypeNoAggro[65] = true; - player.npcTypeNoAggro[220] = true; - player.npcTypeNoAggro[64] = true; - player.npcTypeNoAggro[67] = true; - player.npcTypeNoAggro[221] = true; + player.npcTypeNoAggro[NPCID.Shark] = true; + player.npcTypeNoAggro[NPCID.SeaSnail] = true; + player.npcTypeNoAggro[NPCID.PinkJellyfish] = true; + player.npcTypeNoAggro[NPCID.Crab] = true; + player.npcTypeNoAggro[NPCID.Squid] = true; player.gills = true; } } diff --git a/Items/Accessories/OldDie.cs b/Items/Accessories/OldDie.cs index 9862cd5c82..48844d0b20 100644 --- a/Items/Accessories/OldDie.cs +++ b/Items/Accessories/OldDie.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Accessories item.width = 24; item.height = 26; item.rare = 3; - item.value = Item.buyPrice(0, 10, 0, 0); + item.value = CalamityGlobalItem.Rarity3BuyPrice; item.accessory = true; } diff --git a/Items/Accessories/OldDie.png b/Items/Accessories/OldDie.png index 924aef845b..3e469aaf20 100644 Binary files a/Items/Accessories/OldDie.png and b/Items/Accessories/OldDie.png differ diff --git a/Items/Accessories/OrnateShield.cs b/Items/Accessories/OrnateShield.cs index bc6ac8bb02..e4b36c2695 100644 --- a/Items/Accessories/OrnateShield.cs +++ b/Items/Accessories/OrnateShield.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Accessories { item.width = 36; item.height = 32; - item.value = Item.buyPrice(0, 12, 0, 0); + item.value = CalamityGlobalItem.Rarity5BuyPrice; item.rare = 5; item.defense = 8; item.accessory = true; diff --git a/Items/Accessories/PermafrostsConcoction.cs b/Items/Accessories/PermafrostsConcoction.cs index bd0ce51854..fa2c7d887e 100644 --- a/Items/Accessories/PermafrostsConcoction.cs +++ b/Items/Accessories/PermafrostsConcoction.cs @@ -1,3 +1,5 @@ +using CalamityMod.World; +using System.Collections.Generic; using Terraria; using Terraria.ModLoader; @@ -12,8 +14,7 @@ namespace CalamityMod.Items.Accessories Increases life regen as life decreases Increases life regen when afflicted with Poison, On Fire, or Brimstone Flames You will survive fatal damage and revive with 30% life on a 3 minute cooldown -You are encased in an ice barrier for 3 seconds when revived -Provides heat and cold protection in Death Mode"); +You are encased in an ice barrier for 3 seconds when revived"); } public override void SetDefaults() @@ -21,10 +22,25 @@ Provides heat and cold protection in Death Mode"); item.accessory = true; item.width = 36; item.height = 34; - item.value = Item.buyPrice(0, 45, 0, 0); + item.value = CalamityGlobalItem.Rarity5BuyPrice; item.rare = 5; } + public override void ModifyTooltips(List list) + { + if (CalamityWorld.death) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip4") + { + line2.text = "You are encased in an ice barrier for 3 seconds when revived\n" + + "Provides heat and cold protection in Death Mode"; + } + } + } + } + public override void UpdateAccessory(Player player, bool hideVisual) { player.Calamity().permafrostsConcoction = true; diff --git a/Items/Accessories/PlagueHive.cs b/Items/Accessories/PlagueHive.cs index 9684774f91..5509810c03 100644 --- a/Items/Accessories/PlagueHive.cs +++ b/Items/Accessories/PlagueHive.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Accessories "Releases bees when damaged\n" + "Friendly bees inflict the plague\n" + "All of your attacks inflict the plague\n" + - "Makes you immune to the plague\n" + + "Reduces the damage caused to you by the plague\n" + "Projectiles spawn plague seekers on enemy hits"); } @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Accessories { item.width = 30; item.height = 38; - item.value = Item.buyPrice(0, 60, 0, 0); + item.value = CalamityGlobalItem.Rarity9BuyPrice; item.expert = true; item.rare = 9; item.accessory = true; @@ -47,11 +47,11 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - player.buffImmune[ModContent.BuffType()] = true; player.bee = true; modPlayer.uberBees = true; player.strongBees = true; modPlayer.alchFlask = true; + modPlayer.reducedPlagueDmg = true; int plagueCounter = 0; Lighting.AddLight((int)(player.Center.X / 16f), (int)(player.Center.Y / 16f), 0.1f, 2f, 0.2f); int num = ModContent.BuffType(); diff --git a/Items/Accessories/PlaguedFuelPack.cs b/Items/Accessories/PlaguedFuelPack.cs index 4af0f75c0e..56fd678474 100644 --- a/Items/Accessories/PlaguedFuelPack.cs +++ b/Items/Accessories/PlaguedFuelPack.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Accessories { item.width = 20; item.height = 36; - item.value = Item.buyPrice(0, 24, 0, 0); + item.value = CalamityGlobalItem.Rarity8BuyPrice; item.rare = 8; item.accessory = true; } diff --git a/Items/Accessories/ProfanedSoulArtifact.cs b/Items/Accessories/ProfanedSoulArtifact.cs index 98f96a7413..8697d7be47 100644 --- a/Items/Accessories/ProfanedSoulArtifact.cs +++ b/Items/Accessories/ProfanedSoulArtifact.cs @@ -1,6 +1,6 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Plates; using CalamityMod.Items.Placeables.Ores; using Terraria; using Terraria.DataStructures; @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Accessories { item.width = 32; item.height = 40; - item.value = Item.buyPrice(1, 40, 0, 0); + item.value = CalamityGlobalItem.Rarity12BuyPrice; item.rare = 10; item.accessory = true; item.Calamity().customRarity = CalamityRarity.Dedicated; diff --git a/Items/Accessories/ProfanedSoulCrystal.cs b/Items/Accessories/ProfanedSoulCrystal.cs index 6f059f0239..36c2e250d0 100644 --- a/Items/Accessories/ProfanedSoulCrystal.cs +++ b/Items/Accessories/ProfanedSoulCrystal.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Accessories * 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. + * You enrage below or at 50% hp. */ public override void SetStaticDefaults() { @@ -39,9 +39,7 @@ namespace CalamityMod.Items.Accessories "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]"); + "This line is modified below"); Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(8, 4)); } @@ -97,6 +95,29 @@ namespace CalamityMod.Items.Accessories line.text = "[c/3a83e4:Transforms Magic attacks into a powerful splitting fireball for " + manaCost + " mana per cast]"; } } + if (CalamityWorld.death) + { + foreach (TooltipLine line in tooltips) + { + if (line.mod == "Terraria" && line.Name == "Tooltip11") + { + line.text = "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]"; + } + } + } + else + { + foreach (TooltipLine line in tooltips) + { + if (line.mod == "Terraria" && line.Name == "Tooltip11") + { + line.text = "Thinking back, it was a boring life\n" + + "[c/FFBF49:And so we burn it all in the name of purity]"; + } + } + } } } diff --git a/Items/Accessories/PsychoticAmulet.cs b/Items/Accessories/PsychoticAmulet.cs index 6e08ca679d..86cfea1da1 100644 --- a/Items/Accessories/PsychoticAmulet.cs +++ b/Items/Accessories/PsychoticAmulet.cs @@ -17,8 +17,8 @@ namespace CalamityMod.Items.Accessories { item.width = 26; item.height = 26; - item.value = Item.buyPrice(0, 15, 0, 0); - item.rare = 6; + item.value = CalamityGlobalItem.Rarity5BuyPrice; + item.rare = 5; item.accessory = true; } diff --git a/Items/Accessories/RadiantOoze.cs b/Items/Accessories/RadiantOoze.cs index 2a3e432b2c..370c62d21d 100644 --- a/Items/Accessories/RadiantOoze.cs +++ b/Items/Accessories/RadiantOoze.cs @@ -17,8 +17,8 @@ namespace CalamityMod.Items.Accessories { item.width = 20; item.height = 20; - item.value = Item.buyPrice(0, 6, 0, 0); - item.rare = 3; + item.value = CalamityGlobalItem.Rarity4BuyPrice; + item.rare = 4; item.accessory = true; } diff --git a/Items/Accessories/RaidersTalisman.cs b/Items/Accessories/RaidersTalisman.cs index 4654ecc26d..4109867459 100644 --- a/Items/Accessories/RaidersTalisman.cs +++ b/Items/Accessories/RaidersTalisman.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Accessories { item.width = 20; item.height = 20; - item.value = Item.buyPrice(0, 9, 0, 0); + item.value = CalamityGlobalItem.Rarity2BuyPrice; item.rare = 2; item.accessory = true; } diff --git a/Items/Accessories/RampartofDeities.cs b/Items/Accessories/RampartofDeities.cs index bd38defdc1..6be7867887 100644 --- a/Items/Accessories/RampartofDeities.cs +++ b/Items/Accessories/RampartofDeities.cs @@ -1,6 +1,8 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.World; +using System.Collections.Generic; using Terraria; using Terraria.ModLoader; @@ -19,25 +21,40 @@ namespace CalamityMod.Items.Accessories "Only active above 25% life\n" + "Grants immunity to knockback and reduces the cooldown of healing potions\n" + "Puts a shell around the owner when below 50% life that reduces damage\n" + - "The shell becomes more powerful when below 15% life and reduces damage even further\n" + - "Provides heat and cold protection in Death Mode"); + "The shell becomes more powerful when below 15% life and reduces damage even further"); } public override void SetDefaults() { item.width = 38; item.height = 44; - item.value = Item.buyPrice(0, 90, 0, 0); + item.value = CalamityGlobalItem.Rarity14BuyPrice; item.defense = 12; item.accessory = true; item.Calamity().customRarity = CalamityRarity.DarkBlue; } + public override void ModifyTooltips(List list) + { + if (CalamityWorld.death) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip8") + { + line2.text = "The shell becomes more powerful when below 15% life and reduces damage even further\n" + + "Provides heat and cold protection in Death Mode"; + } + } + } + } + public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); modPlayer.dAmulet = true; modPlayer.rampartOfDeities = true; + modPlayer.fBulwark = true; modPlayer.jellyfishNecklace = true; } diff --git a/Items/Accessories/ReaperToothNecklace.cs b/Items/Accessories/ReaperToothNecklace.cs index 0053e0b13f..8a7950d10e 100644 --- a/Items/Accessories/ReaperToothNecklace.cs +++ b/Items/Accessories/ReaperToothNecklace.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Accessories { item.width = 26; item.height = 26; - item.value = Item.buyPrice(0, 60, 0, 0); + item.value = CalamityGlobalItem.Rarity13BuyPrice; item.rare = 10; item.accessory = true; item.Calamity().customRarity = CalamityRarity.PureGreen; diff --git a/Items/Accessories/Regenator.cs b/Items/Accessories/Regenator.cs index 2656f6241c..aba20fbf1c 100644 --- a/Items/Accessories/Regenator.cs +++ b/Items/Accessories/Regenator.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Accessories { item.width = 36; item.height = 32; - item.value = Item.buyPrice(0, 12, 0, 0); + item.value = CalamityGlobalItem.Rarity5BuyPrice; item.rare = 5; item.defense = 6; item.accessory = true; diff --git a/Items/Accessories/RogueEmblem.cs b/Items/Accessories/RogueEmblem.cs index b6887e989e..27d08654c5 100644 --- a/Items/Accessories/RogueEmblem.cs +++ b/Items/Accessories/RogueEmblem.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Accessories { item.width = 24; item.height = 24; - item.value = 100000; + item.value = CalamityGlobalItem.Rarity4BuyPrice; item.rare = 4; item.accessory = true; } diff --git a/Items/Accessories/RoseStone.cs b/Items/Accessories/RoseStone.cs index a4059168c3..ff29ececd6 100644 --- a/Items/Accessories/RoseStone.cs +++ b/Items/Accessories/RoseStone.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Accessories { item.width = 20; item.height = 20; - item.value = Item.buyPrice(0, 15, 0, 0); + item.value = CalamityGlobalItem.Rarity5BuyPrice; item.rare = 5; item.accessory = true; } diff --git a/Items/Accessories/RottenBrain.cs b/Items/Accessories/RottenBrain.cs index 83cbd5ed35..6ada62f8f1 100644 --- a/Items/Accessories/RottenBrain.cs +++ b/Items/Accessories/RottenBrain.cs @@ -19,9 +19,9 @@ namespace CalamityMod.Items.Accessories { item.width = 34; item.height = 34; - item.value = Item.buyPrice(0, 9, 0, 0); + item.value = CalamityGlobalItem.Rarity3BuyPrice; item.expert = true; - item.rare = 9; + item.rare = 3; item.accessory = true; } @@ -33,26 +33,8 @@ namespace CalamityMod.Items.Accessories { if (player.whoAmI == Main.myPlayer) { - for (int l = 0; l < 1; l++) - { - float x = player.position.X + (float)Main.rand.Next(-400, 400); - float y = player.position.Y - (float)Main.rand.Next(500, 800); - Vector2 vector = new Vector2(x, y); - float num15 = player.position.X + (float)(player.width / 2) - vector.X; - float num16 = player.position.Y + (float)(player.height / 2) - vector.Y; - num15 += (float)Main.rand.Next(-100, 101); - int num17 = 22; - float num18 = (float)Math.Sqrt((double)(num15 * num15 + num16 * num16)); - num18 = (float)num17 / num18; - num15 *= num18; - num16 *= num18; - int num19 = Projectile.NewProjectile(x, y, num15, num16, ModContent.ProjectileType(), (int)(18 * player.AverageDamage()), 2f, player.whoAmI, 0f, 0f); - Main.projectile[num19].ai[1] = player.position.Y; - Main.projectile[num19].tileCollide = false; - Main.projectile[num19].usesLocalNPCImmunity = true; - Main.projectile[num19].localNPCHitCooldown = 10; - Main.projectile[num19].Calamity().forceTypeless = true; - } + Projectile rain = CalamityUtils.ProjectileRain(player.Center, 400f, 100f, 500f, 800f, 22f, ModContent.ProjectileType(), (int)(18 * player.AverageDamage()), 2f, player.whoAmI, 6, 1); + rain.tileCollide = false; } } } diff --git a/Items/Accessories/RottenBrain.png b/Items/Accessories/RottenBrain.png index d13f858da3..f8552e6402 100644 Binary files a/Items/Accessories/RottenBrain.png and b/Items/Accessories/RottenBrain.png differ diff --git a/Items/Accessories/RoverDrive.cs b/Items/Accessories/RoverDrive.cs new file mode 100644 index 0000000000..eb6db78b0b --- /dev/null +++ b/Items/Accessories/RoverDrive.cs @@ -0,0 +1,32 @@ +using CalamityMod.CalPlayer; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Accessories +{ + public class RoverDrive : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Rover Drive"); + Tooltip.SetDefault("Activates a protective shield that grants 10 defense for 10 seconds\n" + + //Actually 10.1 seconds at full power with a dissipation across 0.1666 seconds but whatever + "The shield then dissipates and recharges for 20 seconds before being reactivated"); + } + + public override void SetDefaults() + { + item.width = 38; + item.height = 26; + item.value = CalamityGlobalItem.Rarity1BuyPrice; + item.rare = 1; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.roverDrive = true; + } + } +} diff --git a/Items/Accessories/RoverDrive.png b/Items/Accessories/RoverDrive.png new file mode 100644 index 0000000000..dc5b42b8ba Binary files /dev/null and b/Items/Accessories/RoverDrive.png differ diff --git a/Items/Accessories/RuinMedallion.cs b/Items/Accessories/RuinMedallion.cs index b55ec290eb..3e70d33bf4 100644 --- a/Items/Accessories/RuinMedallion.cs +++ b/Items/Accessories/RuinMedallion.cs @@ -19,8 +19,8 @@ namespace CalamityMod.Items.Accessories { item.width = 20; item.height = 28; - item.value = Item.buyPrice(0, 13, 0, 0); - item.rare = 6; + item.value = CalamityGlobalItem.Rarity5BuyPrice; + item.rare = 5; item.accessory = true; } diff --git a/Items/Accessories/SamuraiBadge.cs b/Items/Accessories/SamuraiBadge.cs index 94eeab7dd8..6835e18af3 100644 --- a/Items/Accessories/SamuraiBadge.cs +++ b/Items/Accessories/SamuraiBadge.cs @@ -9,15 +9,15 @@ namespace CalamityMod.Items.Accessories public override void SetStaticDefaults() { DisplayName.SetDefault("Samurai Badge"); - Tooltip.SetDefault("20% increased melee damage and speed\n" + - "Reduces max life by 25%"); + Tooltip.SetDefault("20% increased melee and true melee damage and speed\n" + + "Reduces max life by 25%"); } public override void SetDefaults() { item.width = 30; item.height = 30; - item.value = Item.buyPrice(0, 21, 0, 0); + item.value = CalamityGlobalItem.Rarity12BuyPrice; item.accessory = true; item.Calamity().customRarity = CalamityRarity.RareVariant; } diff --git a/Items/Accessories/SandCloak.cs b/Items/Accessories/SandCloak.cs index 3ae66ca741..f3dea286ed 100644 --- a/Items/Accessories/SandCloak.cs +++ b/Items/Accessories/SandCloak.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Accessories { item.width = 30; item.height = 44; - item.value = Item.buyPrice(0, 2, 0, 0); + item.value = CalamityGlobalItem.Rarity2BuyPrice; item.rare = 2; item.accessory = true; } diff --git a/Items/Accessories/ScuttlersJewel.cs b/Items/Accessories/ScuttlersJewel.cs index c01bd63a66..a297c7f94e 100644 --- a/Items/Accessories/ScuttlersJewel.cs +++ b/Items/Accessories/ScuttlersJewel.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Accessories { item.width = 26; item.height = 26; - item.value = Item.buyPrice(0, 3, 0, 0); + item.value = CalamityGlobalItem.Rarity1BuyPrice; item.rare = 1; item.accessory = true; } diff --git a/Items/Accessories/SeaShell.cs b/Items/Accessories/SeaShell.cs index a3ca77070a..a9de56b345 100644 --- a/Items/Accessories/SeaShell.cs +++ b/Items/Accessories/SeaShell.cs @@ -18,8 +18,8 @@ namespace CalamityMod.Items.Accessories item.defense = 2; item.width = 20; item.height = 24; - item.value = Item.buyPrice(0, 3, 0, 0); - item.rare = 1; + item.value = CalamityGlobalItem.Rarity2BuyPrice; + item.rare = 2; item.accessory = true; } diff --git a/Items/Accessories/ShieldoftheOcean.cs b/Items/Accessories/ShieldoftheOcean.cs index 909b9d3835..166cce3ea0 100644 --- a/Items/Accessories/ShieldoftheOcean.cs +++ b/Items/Accessories/ShieldoftheOcean.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Accessories { item.width = 24; item.height = 28; - item.value = Item.buyPrice(0, 3, 0, 0); + item.value = CalamityGlobalItem.Rarity2BuyPrice; item.rare = 2; item.defense = 2; item.accessory = true; diff --git a/Items/Accessories/SigilofCalamitas.cs b/Items/Accessories/SigilofCalamitas.cs index 2a26337511..18459b597d 100644 --- a/Items/Accessories/SigilofCalamitas.cs +++ b/Items/Accessories/SigilofCalamitas.cs @@ -21,8 +21,8 @@ namespace CalamityMod.Items.Accessories { item.width = 28; item.height = 32; - item.value = Item.buyPrice(0, 30, 0, 0); - item.rare = 9; + item.value = CalamityGlobalItem.Rarity8BuyPrice; + item.rare = 8; item.accessory = true; } diff --git a/Items/Accessories/SilencingSheath.cs b/Items/Accessories/SilencingSheath.cs index 9bd46f5e43..6e83f81a2e 100644 --- a/Items/Accessories/SilencingSheath.cs +++ b/Items/Accessories/SilencingSheath.cs @@ -18,8 +18,8 @@ namespace CalamityMod.Items.Accessories { item.width = 32; item.height = 34; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; + item.value = CalamityGlobalItem.Rarity3BuyPrice; + item.rare = 3; item.accessory = true; } diff --git a/Items/Accessories/SirenTransAlt_Arms.png b/Items/Accessories/SirenTransAlt_Arms.png deleted file mode 100644 index 30e0af12cd..0000000000 Binary files a/Items/Accessories/SirenTransAlt_Arms.png and /dev/null differ diff --git a/Items/Accessories/SirenTransAlt_Body.png b/Items/Accessories/SirenTransAlt_Body.png deleted file mode 100644 index 5d11f8d6c6..0000000000 Binary files a/Items/Accessories/SirenTransAlt_Body.png and /dev/null differ diff --git a/Items/Accessories/SirenTransAlt_Head.png b/Items/Accessories/SirenTransAlt_Head.png deleted file mode 100644 index 43736c4466..0000000000 Binary files a/Items/Accessories/SirenTransAlt_Head.png and /dev/null differ diff --git a/Items/Accessories/SirenTransAlt_Legs.png b/Items/Accessories/SirenTransAlt_Legs.png deleted file mode 100644 index 2da8caf407..0000000000 Binary files a/Items/Accessories/SirenTransAlt_Legs.png and /dev/null differ diff --git a/Items/Accessories/SirensHeart.cs b/Items/Accessories/SirensHeart.cs index 5a6ff51139..84930c300f 100644 --- a/Items/Accessories/SirensHeart.cs +++ b/Items/Accessories/SirensHeart.cs @@ -8,17 +8,13 @@ namespace CalamityMod.Items.Accessories { public override void SetStaticDefaults() { - DisplayName.SetDefault("Siren's Heart (Blue)"); - Tooltip.SetDefault("Transforms the holder into a siren\n" + - "Siren scales give increased defense (gives more defense in hardmode and post-ML)\n" + - "Siren sight reveals enemy locations (blue-only)\n" + - "Increases life regen (gives more life regen in hardmode and post-ML)\n" + + DisplayName.SetDefault("Aquatic Heart"); + Tooltip.SetDefault("Transforms the holder into a water elemental\n" + "Going underwater gives you a buff\n" + "Greatly reduces breath loss and provides a small amount of light in the abyss\n" + "Enemies become frozen when they touch you\n" + - "You have a layer of ice around you that absorbs 15% damage but breaks after one hit\n" + + "You have a layer of ice around you that absorbs 20% damage but breaks after one hit\n" + "After 30 seconds the ice shield will regenerate\n" + - "Your alluring figure allows you to buy items at a reduced price from town npcs (only works in hardmode)\n" + "Wow, you can swim now!\n" + "Most of these effects are only active after Skeletron has been defeated\n" + "Revengeance drop"); @@ -29,8 +25,8 @@ namespace CalamityMod.Items.Accessories item.width = 18; item.height = 18; item.accessory = true; - item.value = Item.buyPrice(0, 45, 0, 0); - item.rare = 7; + item.value = CalamityGlobalItem.Rarity4BuyPrice; + item.rare = 4; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/SirensHeartAlt.cs b/Items/Accessories/SirensHeartAlt.cs deleted file mode 100644 index 1d4a2d36a1..0000000000 --- a/Items/Accessories/SirensHeartAlt.cs +++ /dev/null @@ -1,68 +0,0 @@ -using CalamityMod.CalPlayer; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Accessories -{ - public class SirensHeartAlt : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Siren's Heart (Green)"); - Tooltip.SetDefault("Transforms the holder into a siren\n" + - "Siren scales give increased defense (gives more defense in hardmode and post-ML)\n" + - "Siren sight reveals danger locations (green-only)\n" + - "Increases life regen (gives more life regen in hardmode and post-ML)\n" + - "Going underwater gives you a buff\n" + - "Greatly reduces breath loss and provides a small amount of light in the abyss\n" + - "Enemies become frozen when they touch you\n" + - "You have a layer of ice around you that absorbs 15% damage but breaks after one hit\n" + - "After 30 seconds the ice shield will regenerate\n" + - "Your alluring figure allows you to buy items at a reduced price from town npcs (only works in hardmode)\n" + - "Wow, you can swim now!\n" + - "Most of these effects are only active after Skeletron has been defeated\n" + - "Revengeance drop"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.accessory = true; - item.value = Item.buyPrice(0, 45, 0, 0); - item.rare = 7; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.sirenBoobsAlt = true; - if (hideVisual) - modPlayer.sirenBoobsAltHide = true; - } - } - - public class SirenHeadAlt : EquipTexture - { - public override bool DrawHead() - { - return false; - } - } - - public class SirenBodyAlt : EquipTexture - { - public override bool DrawBody() - { - return false; - } - } - - public class SirenLegsAlt : EquipTexture - { - public override bool DrawLegs() - { - return false; - } - } -} diff --git a/Items/Accessories/SirensHeartAlt.png b/Items/Accessories/SirensHeartAlt.png deleted file mode 100644 index eb1eb7b206..0000000000 Binary files a/Items/Accessories/SirensHeartAlt.png and /dev/null differ diff --git a/Items/Accessories/SpectralVeil.cs b/Items/Accessories/SpectralVeil.cs index 36cc32ba5e..df38695fce 100644 --- a/Items/Accessories/SpectralVeil.cs +++ b/Items/Accessories/SpectralVeil.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Accessories { item.width = 30; item.height = 38; - item.value = Item.buyPrice(1, 40, 0, 0); + item.value = CalamityGlobalItem.Rarity13BuyPrice; item.Calamity().customRarity = CalamityRarity.PureGreen; item.accessory = true; } diff --git a/Items/Accessories/SpiritGenerator.cs b/Items/Accessories/SpiritGenerator.cs index bcb286e074..a549597cf5 100644 --- a/Items/Accessories/SpiritGenerator.cs +++ b/Items/Accessories/SpiritGenerator.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Accessories { item.width = 26; item.height = 26; - item.value = Item.buyPrice(0, 9, 0, 0); + item.value = CalamityGlobalItem.Rarity2BuyPrice; item.rare = 2; item.accessory = true; } diff --git a/Items/Accessories/Sponge.cs b/Items/Accessories/Sponge.cs index 316eb68d3a..3f051fdb75 100644 --- a/Items/Accessories/Sponge.cs +++ b/Items/Accessories/Sponge.cs @@ -1,9 +1,11 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; +using System.Collections.Generic; using Terraria; using Terraria.DataStructures; using Terraria.ModLoader; @@ -23,15 +25,14 @@ namespace CalamityMod.Items.Accessories "Poison, Freeze, Chill, Frostburn, and Venom immunity\n" + "Honey-like life regen with no speed penalty, +20 max life and mana\n" + "Most bee/hornet enemies and projectiles do 75% damage to you\n" + - "120% increased jump speed and 12% increased movement speed\n" + + "24% increased jump speed and 12% increased movement speed\n" + "Standing still boosts life and mana regen\n" + "Increased defense and damage reduction when submerged in liquid\n" + "Increased movement speed when submerged in liquid\n" + "Enemies take damage when they hit you\n" + "Taking a hit will make you move very fast for a short time\n" + "You emit a mushroom spore and spark explosion when you are hit\n" + - "Enemy attacks will have part of their damage absorbed and used to heal you\n" + - "Provides cold protection in Death Mode"); + "Enemy attacks will have part of their damage absorbed and used to heal you"); Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(5, 30)); } @@ -40,11 +41,26 @@ namespace CalamityMod.Items.Accessories item.defense = 10; item.width = 20; item.height = 20; - item.value = Item.buyPrice(0, 90, 0, 0); + item.value = CalamityGlobalItem.Rarity14BuyPrice; item.accessory = true; item.Calamity().customRarity = CalamityRarity.DarkBlue; } + public override void ModifyTooltips(List list) + { + if (CalamityWorld.death) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip12") + { + line2.text = "Enemy attacks will have part of their damage absorbed and used to heal you\n" + + "Provides cold protection in Death Mode"; + } + } + } + } + public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); diff --git a/Items/Accessories/StarTaintedGenerator.cs b/Items/Accessories/StarTaintedGenerator.cs index 6a70ead983..24151976e7 100644 --- a/Items/Accessories/StarTaintedGenerator.cs +++ b/Items/Accessories/StarTaintedGenerator.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Accessories item.width = 20; item.height = 22; item.accessory = true; - item.value = Item.buyPrice(0, 45, 0, 0); + item.value = CalamityGlobalItem.Rarity8BuyPrice; item.rare = 8; } diff --git a/Items/Accessories/StarbusterCore.cs b/Items/Accessories/StarbusterCore.cs index e7c728a60c..8c515b9b35 100644 --- a/Items/Accessories/StarbusterCore.cs +++ b/Items/Accessories/StarbusterCore.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Accessories { item.width = 28; item.height = 32; - item.value = Item.buyPrice(0, 24, 0, 0); + item.value = CalamityGlobalItem.Rarity7BuyPrice; item.rare = 7; item.accessory = true; } diff --git a/Items/Accessories/StatMeter.cs b/Items/Accessories/StatMeter.cs index e261dc73d3..72bf551374 100644 --- a/Items/Accessories/StatMeter.cs +++ b/Items/Accessories/StatMeter.cs @@ -62,7 +62,8 @@ namespace CalamityMod.Items.Accessories int lifeRegen = modPlayer.lifeRegenStat; int manaRegen = modPlayer.manaRegenStat; int armorPenetration = modPlayer.armorPenetrationStat; - int wingFlightTime = modPlayer.wingFlightTimeStat; + string wingFlightTime = modPlayer.wingFlightTimeStat.ToString("n2"); + string jumpSpeed = modPlayer.jumpSpeedStat.ToString("n2"); int moveSpeed = modPlayer.moveSpeedStat; int lightLevel = modPlayer.abyssLightLevelStat; int breathLoss = modPlayer.abyssBreathLossStat; @@ -87,6 +88,7 @@ namespace CalamityMod.Items.Accessories if (heldItem.melee) { sb.Append("Melee Damage: ").Append(modPlayer.damageStats[0]) + .Append("% | True Melee Damage: ").Append(modPlayer.damageStats[5]) .Append("% | Melee Crit Chance: ").Append(modPlayer.critStats[0]) .Append("%\nMelee Speed Boost: ").Append(meleeSpeed).Append("%\n\n"); } @@ -123,10 +125,11 @@ namespace CalamityMod.Items.Accessories // Generic stats always render. sb.Append("Defense: ").Append(defense); - sb.Append(" | DR: ").Append(DR).Append("%\n"); - sb.Append("Life Regen: ").Append(lifeRegen); - sb.Append(" | Armor Penetration: ").Append(armorPenetration).Append("\n"); - sb.Append("Wing Flight Time: ").Append(wingFlightTime); + sb.Append(" | DR: ").Append(DR).Append("%"); + sb.Append(" | Life Regen: ").Append(lifeRegen).Append("\n"); + sb.Append("Armor Penetration: ").Append(armorPenetration); + sb.Append(" | Wing Flight Time: ").Append(wingFlightTime).Append(" seconds\n"); + sb.Append("Jump Speed Boost: ").Append(jumpSpeed).Append("%"); sb.Append(" | Movement Speed Boost: ").Append(moveSpeed).Append("%\n\n"); sb.Append(CalamityWorld.death ? "Abyss/Cave Light Strength: " : "Abyss Light Strength: ").Append(lightLevel).Append("\n\n"); diff --git a/Items/Accessories/StatisBeltOfCurses.cs b/Items/Accessories/StatisBeltOfCurses.cs index cf21088fb7..4fa75465a5 100644 --- a/Items/Accessories/StatisBeltOfCurses.cs +++ b/Items/Accessories/StatisBeltOfCurses.cs @@ -12,7 +12,8 @@ namespace CalamityMod.Items.Accessories public override void SetStaticDefaults() { DisplayName.SetDefault("Statis' Void Sash"); - Tooltip.SetDefault("Increases jump speed and allows constant jumping\n" + + Tooltip.SetDefault("24% increased jump speed and allows constant jumping\n" + + "Increases fall damage resistance by 50 blocks\n" + "Can climb walls, dash, and dodge attacks\n" + "Dashes leave homing scythes in your wake\n" + "Toggle visibility of this accessory to enable/disable the dash"); @@ -23,7 +24,7 @@ namespace CalamityMod.Items.Accessories { item.width = 28; item.height = 32; - item.value = Item.buyPrice(0, 90, 0, 0); + item.value = CalamityGlobalItem.Rarity14BuyPrice; item.accessory = true; item.Calamity().postMoonLordRarity = 14; } diff --git a/Items/Accessories/StatisBlessing.cs b/Items/Accessories/StatisBlessing.cs index a4256bea5d..0253039d1b 100644 --- a/Items/Accessories/StatisBlessing.cs +++ b/Items/Accessories/StatisBlessing.cs @@ -21,8 +21,8 @@ namespace CalamityMod.Items.Accessories { item.width = 28; item.height = 32; - item.value = Item.buyPrice(0, 45, 0, 0); - item.rare = 9; + item.value = CalamityGlobalItem.Rarity7BuyPrice; + item.rare = 7; item.accessory = true; } diff --git a/Items/Accessories/StatisCurse.cs b/Items/Accessories/StatisCurse.cs index 9ed5b61071..88e91b8c22 100644 --- a/Items/Accessories/StatisCurse.cs +++ b/Items/Accessories/StatisCurse.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Accessories { item.width = 28; item.height = 32; - item.value = Item.buyPrice(0, 60, 0, 0); + item.value = CalamityGlobalItem.Rarity10BuyPrice; item.rare = 10; item.accessory = true; } diff --git a/Items/Accessories/StatisNinjaBelt.cs b/Items/Accessories/StatisNinjaBelt.cs index 3225f87f6b..dd713bf077 100644 --- a/Items/Accessories/StatisNinjaBelt.cs +++ b/Items/Accessories/StatisNinjaBelt.cs @@ -11,7 +11,8 @@ namespace CalamityMod.Items.Accessories public override void SetStaticDefaults() { DisplayName.SetDefault("Statis' Ninja Belt"); - Tooltip.SetDefault("Increases jump speed and allows constant jumping\n" + + Tooltip.SetDefault("8% increased jump speed and allows constant jumping\n" + + "Increased fall damage resistance by 35 blocks\n" + "Can climb walls, dash, and dodge attacks\n" + "Toggle visibility of this accessory to enable/disable the dash"); } @@ -20,8 +21,8 @@ namespace CalamityMod.Items.Accessories { item.width = 28; item.height = 32; - item.value = Item.buyPrice(0, 45, 0, 0); - item.rare = 9; + item.value = CalamityGlobalItem.Rarity7BuyPrice; + item.rare = 7; item.accessory = true; } diff --git a/Items/Accessories/StressPills.cs b/Items/Accessories/StressPills.cs index c7d3180783..cb10a8ce8c 100644 --- a/Items/Accessories/StressPills.cs +++ b/Items/Accessories/StressPills.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Accessories { item.width = 26; item.height = 26; - item.value = Item.buyPrice(0, 6, 0, 0); + item.value = CalamityGlobalItem.Rarity3BuyPrice; item.rare = 3; item.accessory = true; } diff --git a/Items/Accessories/SupremeBaitTackleBoxFishingStation.cs b/Items/Accessories/SupremeBaitTackleBoxFishingStation.cs index 8f6d44be6e..3fabdf713a 100644 --- a/Items/Accessories/SupremeBaitTackleBoxFishingStation.cs +++ b/Items/Accessories/SupremeBaitTackleBoxFishingStation.cs @@ -20,8 +20,8 @@ namespace CalamityMod.Items.Accessories { item.width = 26; item.height = 26; - item.value = Item.buyPrice(0, 45, 0, 0); - item.rare = 10; + item.value = CalamityGlobalItem.Rarity5BuyPrice; + item.rare = 5; item.accessory = true; } diff --git a/Items/Accessories/TheAbsorber.cs b/Items/Accessories/TheAbsorber.cs index 21f68cc4ab..75215db544 100644 --- a/Items/Accessories/TheAbsorber.cs +++ b/Items/Accessories/TheAbsorber.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Accessories { DisplayName.SetDefault("The Absorber"); Tooltip.SetDefault("12% increased movement speed\n" + - "120% increased jump speed\n" + + "24% increased jump speed\n" + "+20 max life and mana\n" + "Standing still boosts life and mana regen\n" + "Increased defense and damage reduction when submerged in liquid\n" + @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Accessories item.defense = 6; item.width = 20; item.height = 24; - item.value = Item.buyPrice(0, 60, 0, 0); + item.value = CalamityGlobalItem.Rarity10BuyPrice; item.rare = 10; item.accessory = true; } @@ -55,6 +55,7 @@ namespace CalamityMod.Items.Accessories recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType(), 15); recipe.AddIngredient(ModContent.ItemType(), 15); recipe.AddIngredient(ModContent.ItemType(), 5); @@ -68,6 +69,7 @@ namespace CalamityMod.Items.Accessories recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType(), 15); recipe.AddIngredient(ModContent.ItemType(), 15); recipe.AddIngredient(ModContent.ItemType(), 5); diff --git a/Items/Accessories/TheAmalgam.cs b/Items/Accessories/TheAmalgam.cs index 370ef77780..945040cc4b 100644 --- a/Items/Accessories/TheAmalgam.cs +++ b/Items/Accessories/TheAmalgam.cs @@ -5,7 +5,9 @@ using CalamityMod.Projectiles.Magic; using CalamityMod.Projectiles.Summon; using CalamityMod.Projectiles.Typeless; using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System.Collections.Generic; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -35,8 +37,7 @@ namespace CalamityMod.Items.Accessories "75% increased movement speed, 10% increase to all damage, and plus 40 defense while submerged in any liquid\n" + "The above bonuses also apply when passing through the clump's poisonous seawater\n" + "Temporary immunity to lava, greatly reduces lava burn damage, and 15% increased damage while in lava\n" + - "You have a damaging aura that envenoms nearby enemies and increased movement in liquids\n" + - "Provides heat protection in Death Mode"); + "You have a damaging aura that envenoms nearby enemies and increased movement in liquids"); Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(9, 6)); } @@ -44,12 +45,27 @@ namespace CalamityMod.Items.Accessories { item.width = 34; item.height = 34; - item.value = Item.buyPrice(0, 90, 0, 0); + item.value = CalamityGlobalItem.Rarity14BuyPrice; item.expert = true; item.rare = 9; item.accessory = true; } + public override void ModifyTooltips(List list) + { + if (CalamityWorld.death) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip8") + { + line2.text = "You have a damaging aura that envenoms nearby enemies and increased movement in liquids\n" + + "Provides heat protection in Death Mode"; + } + } + } + } + public override bool CanEquipAccessory(Player player, int slot) => !player.Calamity().fungalClump; public override void UpdateAccessory(Player player, bool hideVisual) @@ -115,26 +131,10 @@ namespace CalamityMod.Items.Accessories { if (player.whoAmI == Main.myPlayer) { - float x = player.position.X + Main.rand.NextFloat(-400, 400); - float y = player.position.Y - Main.rand.NextFloat(500, 800); - Vector2 projOrigin = new Vector2(x, y); - float xDist = player.Center.X - projOrigin.X; - float yDist = player.Center.Y - projOrigin.Y; - xDist += Main.rand.NextFloat(-100, 100); - float speed = 22f; - Vector2 playerVector = new Vector2(xDist, yDist); - float playerDist = playerVector.Length(); - playerDist = speed / playerDist; - playerVector.X *= playerDist; - playerVector.Y *= playerDist; int type = Main.rand.NextBool(2) ? ProjectileType() : ProjectileType(); - int rain = Projectile.NewProjectile(projOrigin, playerVector, type, (int)(ProjectileDamage * player.AverageDamage()), 1f, player.whoAmI, 0f, 0f); - Projectile proj = Main.projectile[rain]; - proj.tileCollide = false; - proj.usesLocalNPCImmunity = true; - proj.localNPCHitCooldown = 10; - proj.usesIDStaticNPCImmunity = false; - proj.Calamity().forceTypeless = true; + Projectile rain = CalamityUtils.ProjectileRain(player.Center, 400f, 100f, 500f, 800f, 22f, type, (int)(ProjectileDamage * player.AverageDamage()), 5f, player.whoAmI, 6, 1); + if (type == ProjectileType()) + rain.tileCollide = false; } } } diff --git a/Items/Accessories/TheBee.cs b/Items/Accessories/TheBee.cs index f8e516400a..eef5e34a74 100644 --- a/Items/Accessories/TheBee.cs +++ b/Items/Accessories/TheBee.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Accessories { item.width = 24; item.height = 28; - item.value = Item.buyPrice(0, 9, 0, 0); + item.value = CalamityGlobalItem.Rarity4BuyPrice; item.rare = 4; item.accessory = true; item.Calamity().customRarity = CalamityRarity.RareVariant; diff --git a/Items/Accessories/TheCamper.cs b/Items/Accessories/TheCamper.cs index 9aa882e694..a1bc81a9f6 100644 --- a/Items/Accessories/TheCamper.cs +++ b/Items/Accessories/TheCamper.cs @@ -1,7 +1,9 @@ using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Typeless; +using CalamityMod.World; using Microsoft.Xna.Framework; using System; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -17,25 +19,39 @@ namespace CalamityMod.Items.Accessories public override void SetStaticDefaults() { DisplayName.SetDefault("The Camper"); - Tooltip.SetDefault("You deal no damage unless stationary\n" + + Tooltip.SetDefault("In rest may we find victory.\n" + + "You deal no damage unless stationary\n" + "Standing still grants buff(s) dependent on what weapon you're holding\n" + "Standing still provides a damaging aura around you\n" + "While moving, you regenerate health as if standing still\n" + - "Provides a small amount of light in the Abyss\n" + - "Provides cold protection in Death Mode\n" + - "In rest may we find victory."); + "Provides a small amount of light in the Abyss"); } public override void SetDefaults() { item.width = 26; item.height = 26; - item.value = Item.buyPrice(0, 12, 0, 0); + item.value = CalamityGlobalItem.Rarity7BuyPrice; item.rare = 7; item.accessory = true; item.defense = 10; } + public override void ModifyTooltips(List list) + { + if (CalamityWorld.death) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip5") + { + line2.text = "Provides a small amount of light in the Abyss\n" + + "Provides cold protection in Death Mode"; + } + } + } + } + public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); @@ -47,7 +63,7 @@ namespace CalamityMod.Items.Accessories Lighting.AddLight(player.Center, 0.825f, 0.66f, 0f); if (Main.myPlayer == player.whoAmI) { - if ((double)Math.Abs(player.velocity.X) < 0.05 && (double)Math.Abs(player.velocity.Y) < 0.05) + if (Math.Abs(player.velocity.X) < 0.05f && Math.Abs(player.velocity.Y) < 0.05f) { player.allDamage += 0.15f; auraCounter++; diff --git a/Items/Accessories/TheCommunity.cs b/Items/Accessories/TheCommunity.cs index e45b03735f..e9e32fdc1d 100644 --- a/Items/Accessories/TheCommunity.cs +++ b/Items/Accessories/TheCommunity.cs @@ -25,7 +25,8 @@ namespace CalamityMod.Items.Accessories { item.width = 20; item.height = 20; - item.value = Item.buyPrice(0, 60, 0, 0); + item.value = CalamityGlobalItem.Rarity7BuyPrice; + item.rare = 7; item.accessory = true; item.Calamity().customRarity = CalamityRarity.Rainbow; } diff --git a/Items/Accessories/TheFirstShadowflame.cs b/Items/Accessories/TheFirstShadowflame.cs index b91765e2f7..b82344ab0b 100644 --- a/Items/Accessories/TheFirstShadowflame.cs +++ b/Items/Accessories/TheFirstShadowflame.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Accessories { item.width = 26; item.height = 26; - item.value = Item.buyPrice(0, 15, 0, 0); + item.value = CalamityGlobalItem.Rarity5BuyPrice; item.rare = 5; item.accessory = true; } diff --git a/Items/Accessories/TheTransformer.cs b/Items/Accessories/TheTransformer.cs index f395f0592a..544645bccf 100644 --- a/Items/Accessories/TheTransformer.cs +++ b/Items/Accessories/TheTransformer.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Accessories { item.width = 26; item.height = 26; - item.value = Item.buyPrice(0, 3, 0, 0); + item.value = CalamityGlobalItem.Rarity1BuyPrice; item.rare = 1; item.accessory = true; item.Calamity().customRarity = CalamityRarity.RareVariant; diff --git a/Items/Accessories/ToxicHeart.cs b/Items/Accessories/ToxicHeart.cs index 6a076cb67c..2fee888283 100644 --- a/Items/Accessories/ToxicHeart.cs +++ b/Items/Accessories/ToxicHeart.cs @@ -18,9 +18,9 @@ namespace CalamityMod.Items.Accessories { item.width = 28; item.height = 32; - item.value = Item.buyPrice(0, 30, 0, 0); + item.value = CalamityGlobalItem.Rarity8BuyPrice; item.expert = true; - item.rare = 9; + item.rare = 8; item.accessory = true; } diff --git a/Items/Accessories/TrinketofChi.cs b/Items/Accessories/TrinketofChi.cs index ac8857c96c..59bc2014ac 100644 --- a/Items/Accessories/TrinketofChi.cs +++ b/Items/Accessories/TrinketofChi.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Accessories { item.width = 34; item.height = 32; - item.value = Item.buyPrice(0, 9, 0, 0); + item.value = CalamityGlobalItem.Rarity3BuyPrice; item.rare = 3; item.accessory = true; } diff --git a/Items/Accessories/UnstablePrism.cs b/Items/Accessories/UnstablePrism.cs index 94a6ceb7d0..321655c51d 100644 --- a/Items/Accessories/UnstablePrism.cs +++ b/Items/Accessories/UnstablePrism.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Accessories { item.width = 22; item.height = 38; - item.value = Item.buyPrice(0, 9, 0, 0); + item.value = CalamityGlobalItem.Rarity3BuyPrice; item.rare = 3; item.accessory = true; } diff --git a/Items/Accessories/VampiricTalisman.cs b/Items/Accessories/VampiricTalisman.cs index d7d9d2523f..99cd052d96 100644 --- a/Items/Accessories/VampiricTalisman.cs +++ b/Items/Accessories/VampiricTalisman.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Accessories { item.width = 50; item.height = 26; - item.value = Item.buyPrice(0, 40, 0, 0); + item.value = CalamityGlobalItem.Rarity6BuyPrice; item.accessory = true; item.rare = 6; } diff --git a/Items/Accessories/Vanity/Popo.cs b/Items/Accessories/Vanity/Popo.cs index d01f998f21..d07d44f54d 100644 --- a/Items/Accessories/Vanity/Popo.cs +++ b/Items/Accessories/Vanity/Popo.cs @@ -1,4 +1,6 @@ using CalamityMod.CalPlayer; +using CalamityMod.World; +using System.Collections.Generic; using Terraria; using Terraria.ModLoader; @@ -10,8 +12,7 @@ namespace CalamityMod.Items.Accessories.Vanity { DisplayName.SetDefault("Magic Scarf and Hat"); Tooltip.SetDefault("Don't let the demons steal your nose\n" + - "Transforms the holder into a snowman\n" + - "Provides heat and cold protection in Death Mode"); + "Transforms the holder into a snowman"); } public override void SetDefaults() @@ -19,10 +20,25 @@ namespace CalamityMod.Items.Accessories.Vanity item.width = 26; item.height = 30; item.accessory = true; - item.value = 1000000; + item.value = CalamityGlobalItem.Rarity5BuyPrice; item.rare = 5; } + public override void ModifyTooltips(List list) + { + if (CalamityWorld.death) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip1") + { + line2.text = "Transforms the holder into a snowman\n" + + "Provides heat and cold protection in Death Mode"; + } + } + } + } + public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); diff --git a/Items/Accessories/VeneratedLocket.cs b/Items/Accessories/VeneratedLocket.cs index 91160edff1..f1352a1f4d 100644 --- a/Items/Accessories/VeneratedLocket.cs +++ b/Items/Accessories/VeneratedLocket.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Accessories { item.width = 34; item.height = 36; - item.value = Item.buyPrice(25, 0, 0, 0); + item.value = CalamityGlobalItem.Rarity14BuyPrice; item.rare = 10; item.Calamity().customRarity = CalamityRarity.DarkBlue; item.accessory = true; diff --git a/Items/Accessories/VitalJelly.cs b/Items/Accessories/VitalJelly.cs index a532c509c6..785dd687f1 100644 --- a/Items/Accessories/VitalJelly.cs +++ b/Items/Accessories/VitalJelly.cs @@ -1,3 +1,4 @@ +using System.Collections.Generic; using Terraria; using Terraria.ModLoader; @@ -8,23 +9,36 @@ namespace CalamityMod.Items.Accessories public override void SetStaticDefaults() { DisplayName.SetDefault("Vital Jelly"); - Tooltip.SetDefault("10% increased movement speed\n" + - "200% increased jump speed"); + Tooltip.SetDefault("20% increased movement speed\n" + + "24% increased jump speed"); } public override void SetDefaults() { item.width = 20; item.height = 24; - item.value = Item.buyPrice(0, 12, 0, 0); - item.rare = 5; + item.value = CalamityGlobalItem.Rarity3BuyPrice; + item.rare = 3; item.accessory = true; } + public override void ModifyTooltips(List list) + { + bool autoJump = Main.player[Main.myPlayer].autoJump; + string jumpAmt = autoJump ? "6" : "24"; + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip1") + { + line2.text = jumpAmt + "% increased jump speed"; + } + } + } + public override void UpdateAccessory(Player player, bool hideVisual) { - player.moveSpeed += 0.1f; - player.jumpSpeedBoost += player.autoJump ? 0.5f : 2.0f; + player.moveSpeed += 0.2f; + player.jumpSpeedBoost += player.autoJump ? 0.3f : 1.2f; } } } diff --git a/Items/Accessories/VoidofExtinction.cs b/Items/Accessories/VoidofExtinction.cs index a0c53e5fe5..04e20bbf6c 100644 --- a/Items/Accessories/VoidofExtinction.cs +++ b/Items/Accessories/VoidofExtinction.cs @@ -1,7 +1,10 @@ using CalamityMod.CalPlayer; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Typeless; +using CalamityMod.World; using Microsoft.Xna.Framework; using System; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -21,36 +24,44 @@ namespace CalamityMod.Items.Accessories "Drops brimstone fireballs from the sky occasionally\n" + "15% increase to all damage\n" + "Brimstone fire rains down while invincibility is active\n" + - "Temporary immunity to lava, greatly reduces lava burn damage, and 25% increased damage while in lava\n" + - "Provides heat protection in Death Mode"); + "Temporary immunity to lava, greatly reduces lava burn damage, and 25% increased damage while in lava"); } public override void SetDefaults() { item.width = 26; item.height = 26; - item.value = Item.buyPrice(0, 30, 0, 0); + item.value = CalamityGlobalItem.Rarity8BuyPrice; item.expert = true; - item.rare = 9; + item.rare = 8; item.accessory = true; } - public override bool CanEquipAccessory(Player player, int slot) + public override void ModifyTooltips(List list) { - CalamityPlayer modPlayer = player.Calamity(); - if (modPlayer.calamityRing) - { - return false; - } - return true; + if (CalamityWorld.death) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip4") + { + line2.text = "Temporary immunity to lava, greatly reduces lava burn damage, and 25% increased damage while in lava\n" + + "Provides heat protection in Death Mode"; + } + } + } } + public override bool CanEquipAccessory(Player player, int slot) => !player.Calamity().calamityRing; + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.ObsidianRose); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType(), 3); recipe.AddTile(TileID.MythrilAnvil); recipe.SetResult(this); recipe.AddRecipe(); @@ -60,6 +71,7 @@ namespace CalamityMod.Items.Accessories { CalamityPlayer modPlayer = player.Calamity(); modPlayer.calamityRing = true; + modPlayer.voidOfExtinction = true; player.lavaRose = true; player.lavaMax += 240; player.allDamage += 0.15f; @@ -73,26 +85,7 @@ namespace CalamityMod.Items.Accessories { if (player.whoAmI == Main.myPlayer) { - for (int l = 0; l < 1; l++) - { - float x = player.position.X + (float)Main.rand.Next(-400, 400); - float y = player.position.Y - (float)Main.rand.Next(500, 800); - Vector2 vector = new Vector2(x, y); - float num15 = player.position.X + (float)(player.width / 2) - vector.X; - float num16 = player.position.Y + (float)(player.height / 2) - vector.Y; - num15 += (float)Main.rand.Next(-100, 101); - int num17 = 22; - float num18 = (float)Math.Sqrt((double)(num15 * num15 + num16 * num16)); - num18 = (float)num17 / num18; - num15 *= num18; - num16 *= num18; - int num19 = Projectile.NewProjectile(x, y, num15, num16, ModContent.ProjectileType(), (int)(40 * player.AverageDamage()), 5f, player.whoAmI, 0f, 0f); - Main.projectile[num19].ai[1] = player.position.Y; - Main.projectile[num19].usesLocalNPCImmunity = true; - Main.projectile[num19].localNPCHitCooldown = 60; - Main.projectile[num19].usesIDStaticNPCImmunity = false; - - } + CalamityUtils.ProjectileRain(player.Center, 400f, 100f, 500f, 800f, 22f, ModContent.ProjectileType(), (int)(30 * player.AverageDamage()), 5f, player.whoAmI, 0, 1, 60); } } } @@ -107,20 +100,20 @@ namespace CalamityMod.Items.Accessories { if (player.whoAmI == Main.myPlayer) { - int speed2 = 25; + int projSpeed = 25; float spawnX = Main.rand.Next(1000) - 500 + player.Center.X; float spawnY = -1000 + player.Center.Y; Vector2 baseSpawn = new Vector2(spawnX, spawnY); Vector2 baseVelocity = player.Center - baseSpawn; baseVelocity.Normalize(); - baseVelocity *= speed2; + baseVelocity *= projSpeed; for (int i = 0; i < FireProjectiles; i++) { Vector2 spawn = baseSpawn; - spawn.X = spawn.X + i * 30 - (FireProjectiles * 15); + spawn.X += i * 30 - (FireProjectiles * 15); Vector2 velocity = baseVelocity.RotatedBy(MathHelper.ToRadians(-FireAngleSpread / 2 + (FireAngleSpread * i / (float)FireProjectiles))); velocity.X = velocity.X + 3 * Main.rand.NextFloat() - 1.5f; - Projectile.NewProjectile(spawn.X, spawn.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), (int)(70 * player.AverageDamage()), 5f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(spawn, velocity, ModContent.ProjectileType(), (int)(70 * player.AverageDamage()), 5f, Main.myPlayer, 0f, 0f); } } } diff --git a/Items/Accessories/WifeinaBottle.cs b/Items/Accessories/WifeinaBottle.cs index e324774e6b..b9675a1466 100644 --- a/Items/Accessories/WifeinaBottle.cs +++ b/Items/Accessories/WifeinaBottle.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Accessories { item.width = 20; item.height = 26; - item.value = Item.buyPrice(0, 15, 0, 0); + item.value = CalamityGlobalItem.Rarity5BuyPrice; item.rare = 5; item.accessory = true; } diff --git a/Items/Accessories/WifeinaBottle.png b/Items/Accessories/WifeinaBottle.png index bc29babf45..79320b4e72 100644 Binary files a/Items/Accessories/WifeinaBottle.png and b/Items/Accessories/WifeinaBottle.png differ diff --git a/Items/Accessories/WifeinaBottlewithBoobs.cs b/Items/Accessories/WifeinaBottlewithBoobs.cs index de79d8cdb0..6eef6a546e 100644 --- a/Items/Accessories/WifeinaBottlewithBoobs.cs +++ b/Items/Accessories/WifeinaBottlewithBoobs.cs @@ -18,9 +18,9 @@ namespace CalamityMod.Items.Accessories { item.width = 20; item.height = 26; - item.value = Item.buyPrice(0, 15, 0, 0); + item.value = CalamityGlobalItem.Rarity5BuyPrice; item.expert = true; - item.rare = 9; + item.rare = 5; item.accessory = true; } diff --git a/Items/Accessories/WifeinaBottlewithBoobs.png b/Items/Accessories/WifeinaBottlewithBoobs.png index e82ffdfbb2..6bed262079 100644 Binary files a/Items/Accessories/WifeinaBottlewithBoobs.png and b/Items/Accessories/WifeinaBottlewithBoobs.png differ diff --git a/Items/Accessories/Wings/AureateWings.cs b/Items/Accessories/Wings/AureateWings.cs index a3b39d14f6..89245c193c 100644 --- a/Items/Accessories/Wings/AureateWings.cs +++ b/Items/Accessories/Wings/AureateWings.cs @@ -26,8 +26,8 @@ namespace CalamityMod.Items.Accessories.Wings { item.width = 54; item.height = 26; - item.value = Item.buyPrice(0, 39, 99, 99); - item.rare = 6; + item.value = CalamityGlobalItem.Rarity7BuyPrice; + item.rare = 7; item.accessory = true; } diff --git a/Items/Accessories/Wings/CelestialTracers.cs b/Items/Accessories/Wings/CelestialTracers.cs index 985b528f50..c45d509d0b 100644 --- a/Items/Accessories/Wings/CelestialTracers.cs +++ b/Items/Accessories/Wings/CelestialTracers.cs @@ -1,7 +1,9 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System.Collections.Generic; using Terraria; using Terraria.Graphics.Shaders; using Terraria.ModLoader; @@ -24,19 +26,33 @@ namespace CalamityMod.Items.Accessories.Wings "Greater mobility on ice\n" + "Water and lava walking\n" + "Temporary immunity to lava\n" + - "Being hit for over 200 damage will make you immune for an extended period of time\n" + - "Provides heat protection in Death Mode"); + "Being hit for over 200 damage will make you immune for an extended period of time"); } public override void SetDefaults() { item.width = 36; item.height = 32; - item.value = Item.buyPrice(1, 20, 0, 0); + item.value = CalamityGlobalItem.Rarity15BuyPrice; item.accessory = true; item.Calamity().customRarity = CalamityRarity.Violet; } + public override void ModifyTooltips(List list) + { + if (CalamityWorld.death) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip10") + { + line2.text = "Being hit for over 200 damage will make you immune for an extended period of time\n" + + "Provides heat protection in Death Mode"; + } + } + } + } + public override void UpdateAccessory(Player player, bool hideVisual) { if (player.controlJump && player.wingTime > 0f && !player.jumpAgainCloud && player.jump == 0 && player.velocity.Y != 0f && !hideVisual) diff --git a/Items/Accessories/Wings/DiscordianWings.cs b/Items/Accessories/Wings/DiscordianWings.cs index 6bc9a7f7dd..7d5f86056d 100644 --- a/Items/Accessories/Wings/DiscordianWings.cs +++ b/Items/Accessories/Wings/DiscordianWings.cs @@ -19,14 +19,14 @@ namespace CalamityMod.Items.Accessories.Wings "Acceleration multiplier: 1.5\n" + "Average vertical speed\n" + "Flight time: 180\n" + - "10% increased damage while wearing the Hydrothermic Armor"); + "5% increased damage while wearing the Hydrothermic Armor"); } public override void SetDefaults() { item.width = 22; item.height = 20; - item.value = Item.buyPrice(0, 39, 99, 99); + item.value = CalamityGlobalItem.Rarity8BuyPrice; item.rare = 8; item.accessory = true; } @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Accessories.Wings player.armor[0].type == ModContent.ItemType()) && player.armor[1].type == ModContent.ItemType() && player.armor[2].type == ModContent.ItemType()) { - player.allDamage += 0.1f; + player.allDamage += 0.05f; } if (player.controlJump && player.wingTime > 0f && !player.jumpAgainCloud && player.jump == 0 && player.velocity.Y != 0f && !hideVisual) diff --git a/Items/Accessories/Wings/DrewsWings.cs b/Items/Accessories/Wings/DrewsWings.cs index a29e50298f..d5295a164b 100644 --- a/Items/Accessories/Wings/DrewsWings.cs +++ b/Items/Accessories/Wings/DrewsWings.cs @@ -22,8 +22,8 @@ namespace CalamityMod.Items.Accessories.Wings { item.width = 22; item.height = 20; - item.value = Item.buyPrice(1, 0, 0, 0); - item.Calamity().customRarity = CalamityRarity.DarkBlue; + item.value = CalamityGlobalItem.Rarity15BuyPrice; + item.Calamity().customRarity = CalamityRarity.Violet; item.accessory = true; } diff --git a/Items/Accessories/Wings/ElysianTracers.cs b/Items/Accessories/Wings/ElysianTracers.cs index db1c2f31b3..58d77ee823 100644 --- a/Items/Accessories/Wings/ElysianTracers.cs +++ b/Items/Accessories/Wings/ElysianTracers.cs @@ -1,6 +1,8 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System.Collections.Generic; using Terraria; using Terraria.Graphics.Shaders; using Terraria.ID; @@ -23,19 +25,33 @@ namespace CalamityMod.Items.Accessories.Wings "36% increased running acceleration\n" + "Greater mobility on ice\n" + "Water and lava walking\n" + - "Temporary immunity to lava\n" + - "Provides heat protection in Death Mode"); + "Temporary immunity to lava"); } public override void SetDefaults() { item.width = 36; item.height = 32; - item.value = Item.buyPrice(0, 90, 0, 0); + item.value = CalamityGlobalItem.Rarity14BuyPrice; item.accessory = true; item.Calamity().customRarity = CalamityRarity.DarkBlue; } + public override void ModifyTooltips(List list) + { + if (CalamityWorld.death) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip9") + { + line2.text = "Temporary immunity to lava\n" + + "Provides heat protection in Death Mode"; + } + } + } + } + public override void UpdateAccessory(Player player, bool hideVisual) { if (player.controlJump && player.wingTime > 0f && !player.jumpAgainCloud && player.jump == 0 && player.velocity.Y != 0f && !hideVisual) diff --git a/Items/Accessories/Wings/ElysianWings.cs b/Items/Accessories/Wings/ElysianWings.cs index 00fa3b003a..8730a980a7 100644 --- a/Items/Accessories/Wings/ElysianWings.cs +++ b/Items/Accessories/Wings/ElysianWings.cs @@ -1,4 +1,6 @@ using CalamityMod.CalPlayer; +using CalamityMod.World; +using System.Collections.Generic; using Terraria; using Terraria.ModLoader; @@ -15,20 +17,34 @@ namespace CalamityMod.Items.Accessories.Wings "Acceleration multiplier: 2.7\n" + "Great vertical speed\n" + "Flight time: 200\n" + - "Temporary immunity to lava and 40% increased movement speed\n" + - "Provides heat protection in Death Mode"); + "Temporary immunity to lava and 40% increased movement speed"); } public override void SetDefaults() { item.width = 36; item.height = 32; - item.value = Item.buyPrice(0, 45, 0, 0); + item.value = CalamityGlobalItem.Rarity12BuyPrice; item.rare = 10; item.Calamity().customRarity = CalamityRarity.Turquoise; item.accessory = true; } + public override void ModifyTooltips(List list) + { + if (CalamityWorld.death) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip5") + { + line2.text = "Temporary immunity to lava and 40% increased movement speed\n" + + "Provides heat protection in Death Mode"; + } + } + } + } + public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); diff --git a/Items/Accessories/Wings/HadarianWings.cs b/Items/Accessories/Wings/HadarianWings.cs index 45efc6b27f..7ee4b9e037 100644 --- a/Items/Accessories/Wings/HadarianWings.cs +++ b/Items/Accessories/Wings/HadarianWings.cs @@ -22,14 +22,14 @@ namespace CalamityMod.Items.Accessories.Wings "Acceleration multiplier: 1.75\n" + "Good vertical speed\n" + "Flight time: 120\n" + - "20% increased movement speed and 40% increased jump speed while wearing the Astral Armor"); + "20% increased movement speed and 8% increased jump speed while wearing the Astral Armor"); } public override void SetDefaults() { item.width = 24; item.height = 36; - item.value = Item.buyPrice(0, 39, 99, 99); + item.value = CalamityGlobalItem.Rarity9BuyPrice; item.rare = 9; item.accessory = true; } diff --git a/Items/Accessories/Wings/InfinityBoots.cs b/Items/Accessories/Wings/InfinityBoots.cs index dc035315e3..df7f25a3cd 100644 --- a/Items/Accessories/Wings/InfinityBoots.cs +++ b/Items/Accessories/Wings/InfinityBoots.cs @@ -1,6 +1,8 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System.Collections.Generic; using Terraria; using Terraria.Graphics.Shaders; using Terraria.ID; @@ -23,19 +25,33 @@ namespace CalamityMod.Items.Accessories.Wings "24% increased running acceleration\n" + "Greater mobility on ice\n" + "Water and lava walking\n" + - "Temporary immunity to lava\n" + - "Provides heat protection in Death Mode"); + "Temporary immunity to lava"); } public override void SetDefaults() { item.width = 36; item.height = 32; - item.value = Item.buyPrice(0, 60, 0, 0); + item.value = CalamityGlobalItem.Rarity12BuyPrice; item.accessory = true; item.Calamity().customRarity = CalamityRarity.Turquoise; } + public override void ModifyTooltips(List list) + { + if (CalamityWorld.death) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip9") + { + line2.text = "Temporary immunity to lava\n" + + "Provides heat protection in Death Mode"; + } + } + } + } + public override void UpdateAccessory(Player player, bool hideVisual) { if (player.controlJump && player.wingTime > 0f && !player.jumpAgainCloud && player.jump == 0 && player.velocity.Y != 0f && !hideVisual) diff --git a/Items/Accessories/Wings/MOAB.cs b/Items/Accessories/Wings/MOAB.cs index 7bb6e3b45d..67ff14258b 100644 --- a/Items/Accessories/Wings/MOAB.cs +++ b/Items/Accessories/Wings/MOAB.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Accessories.Wings "Acceleration multiplier: 1\n" + "Good vertical speed\n" + "Flight time: 75\n" + - "Increases jump height and allows auto-jump\n" + + "16% increased jump speed and allows auto-jump\n" + "Grants the player cloud, blizzard, and sandstorm mid-air jumps"); } @@ -26,8 +26,8 @@ namespace CalamityMod.Items.Accessories.Wings { item.width = 28; item.height = 32; - item.value = Item.buyPrice(0, 39, 99, 99); - item.rare = 8; + item.value = CalamityGlobalItem.Rarity6BuyPrice; + item.rare = 6; item.accessory = true; } @@ -41,46 +41,46 @@ namespace CalamityMod.Items.Accessories.Wings Main.PlaySound(SoundID.Item13, player.position); player.rocketDelay2 = 60; } - int num66 = 2; + int dustAmt = 2; if (player.controlUp) { - num66 = 4; + dustAmt = 4; } - for (int num67 = 0; num67 < num66; num67++) + for (int index = 0; index < dustAmt; index++) { - int type = 6; + int type = DustID.Fire; if (player.head == 41) { int arg_58FD_0 = player.body; } float scale = 1.75f; int alpha = 100; - float x = player.position.X + (float)(player.width / 2) + 16f; + float xStart = player.Center.X + 16f; if (player.direction > 0) { - x = player.position.X + (float)(player.width / 2) - 26f; + xStart = player.Center.X - 26f; } - float num68 = player.position.Y + (float)player.height - 18f; - if (num67 == 1 || num67 == 3) + float yStart = player.position.Y + (float)player.height - 18f; + if (index == 1 || index == 3) { - x = player.position.X + (float)(player.width / 2) + 8f; + xStart = player.Center.X + 8f; if (player.direction > 0) { - x = player.position.X + (float)(player.width / 2) - 20f; + xStart = player.Center.X - 20f; } - num68 += 6f; + yStart += 6f; } - if (num67 > 1) + if (index > 1) { - num68 += player.velocity.Y; + yStart += player.velocity.Y; } - int num69 = Dust.NewDust(new Vector2(x, num68), 8, 8, type, 0f, 0f, alpha, default, scale); + int num69 = Dust.NewDust(new Vector2(xStart, yStart), 8, 8, type, 0f, 0f, alpha, default, scale); Dust dust = Main.dust[num69]; dust.velocity.X *= 0.1f; dust.velocity.Y = Main.dust[num69].velocity.Y * 1f + 2f * player.gravDir - player.velocity.Y * 0.3f; dust.noGravity = true; dust.shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player); - if (num66 == 4) + if (dustAmt == 4) { dust.velocity.Y += 6f; } diff --git a/Items/Accessories/Wings/MOAB.png b/Items/Accessories/Wings/MOAB.png index e67e251f22..ecafba2594 100644 Binary files a/Items/Accessories/Wings/MOAB.png and b/Items/Accessories/Wings/MOAB.png differ diff --git a/Items/Accessories/Wings/MOAB_Wings.png b/Items/Accessories/Wings/MOAB_Wings.png index b7e594948f..c02706a974 100644 Binary files a/Items/Accessories/Wings/MOAB_Wings.png and b/Items/Accessories/Wings/MOAB_Wings.png differ diff --git a/Items/Accessories/Wings/SilvaWings.cs b/Items/Accessories/Wings/SilvaWings.cs index fb9e8dc5e0..380ab19352 100644 --- a/Items/Accessories/Wings/SilvaWings.cs +++ b/Items/Accessories/Wings/SilvaWings.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Accessories.Wings { item.width = 22; item.height = 20; - item.value = Item.buyPrice(0, 95, 0, 0); + item.value = CalamityGlobalItem.Rarity15BuyPrice; item.Calamity().postMoonLordRarity = 15; item.accessory = true; } diff --git a/Items/Accessories/Wings/SkylineWings.cs b/Items/Accessories/Wings/SkylineWings.cs index 9b51edfadc..1df024f0af 100644 --- a/Items/Accessories/Wings/SkylineWings.cs +++ b/Items/Accessories/Wings/SkylineWings.cs @@ -16,14 +16,14 @@ namespace CalamityMod.Items.Accessories.Wings "Acceleration multiplier: 1\n" + "Average vertical speed\n" + "Flight time: 60\n" + - "25% increased jump speed while wearing the Aerospec armor"); + "5% increased jump speed while wearing the Aerospec armor"); } public override void SetDefaults() { item.width = 22; item.height = 20; - item.value = Item.buyPrice(0, 9, 0, 0); + item.value = CalamityGlobalItem.Rarity3BuyPrice; item.rare = 3; item.accessory = true; } diff --git a/Items/Accessories/Wings/SoulofCryogen.cs b/Items/Accessories/Wings/SoulofCryogen.cs index 615bf881f3..4edba47e34 100644 --- a/Items/Accessories/Wings/SoulofCryogen.cs +++ b/Items/Accessories/Wings/SoulofCryogen.cs @@ -1,5 +1,7 @@ using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Rogue; +using CalamityMod.World; +using System.Collections.Generic; using Terraria; using Terraria.DataStructures; using Terraria.ModLoader; @@ -20,8 +22,7 @@ namespace CalamityMod.Items.Accessories.Wings "Flight time: 120\n" + "7% increase to all damage\n" + "All melee attacks and projectiles inflict frostburn\n" + - "Icicles rain down as you fly\n" + - "Provides heat and cold protection in Death Mode"); + "Icicles rain down as you fly"); Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 3)); } @@ -29,12 +30,27 @@ namespace CalamityMod.Items.Accessories.Wings { item.width = 26; item.height = 26; - item.value = Item.buyPrice(0, 39, 99, 99); + item.value = CalamityGlobalItem.Rarity5BuyPrice; item.expert = true; - item.rare = 9; + item.rare = 5; item.accessory = true; } + public override void ModifyTooltips(List list) + { + if (CalamityWorld.death) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip8") + { + line2.text = "Icicles rain down as you fly\n" + + "Provides heat and cold protection in Death Mode"; + } + } + } + } + public override void Update(ref float gravity, ref float maxFallSpeed) { float num = (float)Main.rand.Next(90, 111) * 0.01f; diff --git a/Items/Accessories/Wings/StarlightWings.cs b/Items/Accessories/Wings/StarlightWings.cs index bf3c1a8a7e..a38acf3375 100644 --- a/Items/Accessories/Wings/StarlightWings.cs +++ b/Items/Accessories/Wings/StarlightWings.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Accessories.Wings { item.width = 22; item.height = 20; - item.value = Item.buyPrice(0, 39, 99, 99); + item.value = CalamityGlobalItem.Rarity5BuyPrice; item.rare = 5; item.accessory = true; } diff --git a/Items/Accessories/Wings/TarragonWings.cs b/Items/Accessories/Wings/TarragonWings.cs index 004f4efcb6..6c1a04a708 100644 --- a/Items/Accessories/Wings/TarragonWings.cs +++ b/Items/Accessories/Wings/TarragonWings.cs @@ -28,21 +28,11 @@ namespace CalamityMod.Items.Accessories.Wings { item.width = 22; item.height = 20; - item.value = Item.buyPrice(0, 39, 99, 99); + item.value = CalamityGlobalItem.Rarity12BuyPrice; + item.Calamity().postMoonLordRarity = 12; item.accessory = true; } - public override void ModifyTooltips(List list) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "ItemName") - { - line2.overrideColor = new Color(0, 255, 200); - } - } - } - public override void UpdateAccessory(Player player, bool hideVisual) { if ((player.armor[0].type == ModContent.ItemType() || player.armor[0].type == ModContent.ItemType() || diff --git a/Items/Accessories/Wings/XerocWings.cs b/Items/Accessories/Wings/XerocWings.cs index acc3672c70..00ee2b732b 100644 --- a/Items/Accessories/Wings/XerocWings.cs +++ b/Items/Accessories/Wings/XerocWings.cs @@ -13,20 +13,20 @@ namespace CalamityMod.Items.Accessories.Wings { public override void SetStaticDefaults() { - DisplayName.SetDefault("Xeroc Wings"); + DisplayName.SetDefault("Exodus Wings"); Tooltip.SetDefault("Highly radioactive\n" + "Horizontal speed: 8.5\n" + "Acceleration multiplier: 2\n" + "Good vertical speed\n" + "Flight time: 180\n" + - "5% increased rogue damage and critical strike chance while wearing the Xeroc Armor"); + "5% increased rogue damage and critical strike chance while wearing the Empyrean Armor"); } public override void SetDefaults() { item.width = 22; item.height = 20; - item.value = Item.buyPrice(0, 39, 99, 99); + item.value = CalamityGlobalItem.Rarity9BuyPrice; item.rare = 9; item.accessory = true; } @@ -41,19 +41,19 @@ namespace CalamityMod.Items.Accessories.Wings if (player.controlJump && player.wingTime > 0f && !player.jumpAgainCloud && player.jump == 0 && player.velocity.Y != 0f && !hideVisual) { - int num59 = 4; + float xOffset = 4f; if (player.direction == 1) { - num59 = -40; + xOffset = -40f; } - int num60 = Dust.NewDust(new Vector2(player.position.X + (float)(player.width / 2) + (float)num59, player.position.Y + (float)(player.height / 2) - 15f), 30, 30, 242, 0f, 0f, 100, default, 2.4f); - Main.dust[num60].noGravity = true; - Main.dust[num60].velocity *= 0.3f; + int index = Dust.NewDust(new Vector2(player.Center.X + xOffset, player.Center.Y - 15f), 30, 30, 62, 0f, 0f, 100, default, 2.4f); + Main.dust[index].noGravity = true; + Main.dust[index].velocity *= 0.3f; if (Main.rand.NextBool(10)) { - Main.dust[num60].fadeIn = 2f; + Main.dust[index].fadeIn = 2f; } - Main.dust[num60].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player); + Main.dust[index].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player); } player.wingTimeMax = 180; player.noFallDmg = true; diff --git a/Items/Accessories/Wings/XerocWings.png b/Items/Accessories/Wings/XerocWings.png index 7e14b06cf9..5044f88358 100644 Binary files a/Items/Accessories/Wings/XerocWings.png and b/Items/Accessories/Wings/XerocWings.png differ diff --git a/Items/Accessories/Wings/XerocWings_Wings.png b/Items/Accessories/Wings/XerocWings_Wings.png index 62064efbca..22d8a51361 100644 Binary files a/Items/Accessories/Wings/XerocWings_Wings.png and b/Items/Accessories/Wings/XerocWings_Wings.png differ diff --git a/Items/Accessories/WulfrumBattery.png b/Items/Accessories/WulfrumBattery.png index 3bc19a4875..ada5ddef24 100644 Binary files a/Items/Accessories/WulfrumBattery.png and b/Items/Accessories/WulfrumBattery.png differ diff --git a/Items/Accessories/YharimsGift.cs b/Items/Accessories/YharimsGift.cs index fabd3084d7..b832b69edf 100644 --- a/Items/Accessories/YharimsGift.cs +++ b/Items/Accessories/YharimsGift.cs @@ -23,10 +23,10 @@ namespace CalamityMod.Items.Accessories { item.width = 20; item.height = 22; - item.value = Item.buyPrice(1, 0, 0, 0); + item.value = CalamityGlobalItem.Rarity14BuyPrice; item.accessory = true; item.expert = true; - item.rare = 9; + item.rare = 10; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/YharimsInsignia.cs b/Items/Accessories/YharimsInsignia.cs index 0c596447c4..54df009ba7 100644 --- a/Items/Accessories/YharimsInsignia.cs +++ b/Items/Accessories/YharimsInsignia.cs @@ -1,5 +1,7 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.World; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -13,23 +15,37 @@ namespace CalamityMod.Items.Accessories DisplayName.SetDefault("Yharim's Insignia"); Tooltip.SetDefault("10% increased damage when under 50% life\n" + "10% increased melee speed\n" + - "5% increased melee damage\n" + + "5% increased melee damage and 10% increased true melee damage\n" + "Melee attacks and melee projectiles inflict holy fire\n" + "Increased invincibility after taking damage\n" + "Temporary immunity to lava\n" + - "Increased melee knockback\n" + - "Provides heat protection in Death Mode"); + "Increased melee knockback"); } public override void SetDefaults() { item.width = 22; item.height = 38; - item.value = Item.buyPrice(0, 30, 0, 0); + item.value = CalamityGlobalItem.Rarity12BuyPrice; item.accessory = true; item.Calamity().customRarity = CalamityRarity.Turquoise; } + public override void ModifyTooltips(List list) + { + if (CalamityWorld.death) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip6") + { + line2.text = "Increased melee knockback\n" + + "Provides heat protection in Death Mode"; + } + } + } + } + public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); diff --git a/Items/Ammo/AccelerationBullet.cs b/Items/Ammo/AccelerationBullet.cs index c67e963118..5d096e116e 100644 --- a/Items/Ammo/AccelerationBullet.cs +++ b/Items/Ammo/AccelerationBullet.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Ammo item.rare = 1; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 1f; - item.ammo = 97; + item.ammo = AmmoID.Bullet; } public override void AddRecipes() diff --git a/Items/Ammo/ArcticArrow.png b/Items/Ammo/ArcticArrow.png index d667dfa5b6..5fcacaa5de 100644 Binary files a/Items/Ammo/ArcticArrow.png and b/Items/Ammo/ArcticArrow.png differ diff --git a/Items/Ammo/ElysianArrow.png b/Items/Ammo/ElysianArrow.png index ed813a16ae..e0936c2556 100644 Binary files a/Items/Ammo/ElysianArrow.png and b/Items/Ammo/ElysianArrow.png differ diff --git a/Items/Ammo/FrostsparkBullet.png b/Items/Ammo/FrostsparkBullet.png index 0cda33bf5a..b79682dc0d 100644 Binary files a/Items/Ammo/FrostsparkBullet.png and b/Items/Ammo/FrostsparkBullet.png differ diff --git a/Items/Ammo/IcicleArrow.png b/Items/Ammo/IcicleArrow.png index 6812f4d459..6be666a75d 100644 Binary files a/Items/Ammo/IcicleArrow.png and b/Items/Ammo/IcicleArrow.png differ diff --git a/Items/Ammo/NapalmArrow.png b/Items/Ammo/NapalmArrow.png index 254f05c605..48ef48d4c4 100644 Binary files a/Items/Ammo/NapalmArrow.png and b/Items/Ammo/NapalmArrow.png differ diff --git a/Items/Ammo/VeriumBullet.cs b/Items/Ammo/VeriumBullet.cs index 55ed586105..a3d7e56632 100644 --- a/Items/Ammo/VeriumBullet.cs +++ b/Items/Ammo/VeriumBullet.cs @@ -9,7 +9,8 @@ namespace CalamityMod.Items.Ammo public override void SetStaticDefaults() { DisplayName.SetDefault("Verium Bullet"); - Tooltip.SetDefault("There is no escape!"); + Tooltip.SetDefault("There is no escape!\n" + + "Homes in after striking an enemy"); } public override void SetDefaults() @@ -25,7 +26,7 @@ namespace CalamityMod.Items.Ammo item.rare = 3; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 16f; - item.ammo = 97; + item.ammo = AmmoID.Bullet; } public override void AddRecipes() diff --git a/Items/Armor/AerospecHelmet.cs b/Items/Armor/AerospecHelmet.cs index 79efe6f96b..60b5e75c02 100644 --- a/Items/Armor/AerospecHelmet.cs +++ b/Items/Armor/AerospecHelmet.cs @@ -54,7 +54,7 @@ namespace CalamityMod.Items.Armor } if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), (int)(25f * (player.allDamage + player.minionDamage - 1f)), 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), (int)(20 * player.MinionDamage()), 0f, Main.myPlayer, 0f, 0f); } } player.minionDamage += 0.16f; diff --git a/Items/Armor/AtaxiaHeadgear.cs b/Items/Armor/AtaxiaHeadgear.cs index fbba6b04f1..fefda8b5b4 100644 --- a/Items/Armor/AtaxiaHeadgear.cs +++ b/Items/Armor/AtaxiaHeadgear.cs @@ -1,5 +1,7 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.World; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -13,8 +15,7 @@ namespace CalamityMod.Items.Armor { DisplayName.SetDefault("Hydrothermic Headgear"); Tooltip.SetDefault("12% increased ranged damage and 10% increased ranged critical strike chance\n" + - "Reduces ammo usage by 25%, temporary immunity to lava, and immunity to fire damage\n" + - "Provides heat protection in Death Mode"); + "Reduces ammo usage by 25%, temporary immunity to lava, and immunity to fire damage"); } public override void SetDefaults() @@ -26,6 +27,21 @@ namespace CalamityMod.Items.Armor item.defense = 15; //53 } + public override void ModifyTooltips(List list) + { + if (CalamityWorld.death) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip1") + { + line2.text = "Reduces ammo usage by 25%, temporary immunity to lava, and immunity to fire damage\n" + + "Provides heat protection in Death Mode"; + } + } + } + } + public override bool IsArmorSet(Item head, Item body, Item legs) { return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); diff --git a/Items/Armor/AtaxiaHelm.cs b/Items/Armor/AtaxiaHelm.cs index 40fcb0cd07..2187c89c4d 100644 --- a/Items/Armor/AtaxiaHelm.cs +++ b/Items/Armor/AtaxiaHelm.cs @@ -1,5 +1,7 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.World; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -15,8 +17,7 @@ namespace CalamityMod.Items.Armor Tooltip.SetDefault("12% increased melee damage and 10% increased melee critical strike chance\n" + "12% increased melee and movement speed\n" + "Melee attacks and melee projectiles inflict on fire\n" + - "Temporary immunity to lava and immunity to fire damage\n" + - "Provides heat protection in Death Mode"); + "Temporary immunity to lava and immunity to fire damage"); } public override void SetDefaults() @@ -28,6 +29,21 @@ namespace CalamityMod.Items.Armor item.defense = 25; //67 } + public override void ModifyTooltips(List list) + { + if (CalamityWorld.death) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip3") + { + line2.text = "Temporary immunity to lava and immunity to fire damage\n" + + "Provides heat protection in Death Mode"; + } + } + } + } + public override bool IsArmorSet(Item head, Item body, Item legs) { return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); diff --git a/Items/Armor/AtaxiaHelmet.cs b/Items/Armor/AtaxiaHelmet.cs index d29355e319..165ca43cc5 100644 --- a/Items/Armor/AtaxiaHelmet.cs +++ b/Items/Armor/AtaxiaHelmet.cs @@ -2,6 +2,8 @@ using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; +using CalamityMod.World; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -16,8 +18,7 @@ namespace CalamityMod.Items.Armor DisplayName.SetDefault("Hydrothermic Helmet"); Tooltip.SetDefault("5% increased minion damage and increased minion knockback\n" + "+2 max minions\n" + - "Temporary immunity to lava and immunity to fire damage\n" + - "Provides heat protection in Death Mode"); + "Temporary immunity to lava and immunity to fire damage"); } public override void SetDefaults() @@ -29,6 +30,21 @@ namespace CalamityMod.Items.Armor item.defense = 6; //40 } + public override void ModifyTooltips(List list) + { + if (CalamityWorld.death) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip2") + { + line2.text = "Temporary immunity to lava and immunity to fire damage\n" + + "Provides heat protection in Death Mode"; + } + } + } + } + public override bool IsArmorSet(Item head, Item body, Item legs) { return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); diff --git a/Items/Armor/AtaxiaHood.cs b/Items/Armor/AtaxiaHood.cs index 23330ec8cd..df51b79164 100644 --- a/Items/Armor/AtaxiaHood.cs +++ b/Items/Armor/AtaxiaHood.cs @@ -1,5 +1,7 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.World; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -14,8 +16,7 @@ namespace CalamityMod.Items.Armor DisplayName.SetDefault("Hydrothermic Hood"); Tooltip.SetDefault("12% increased rogue damage and 10% increased rogue critical strike chance\n" + "50% chance to not consume rogue items and 15% increased movement speed\n" + - "Temporary immunity to lava and immunity to fire damage\n" + - "Provides heat protection in Death Mode"); + "Temporary immunity to lava and immunity to fire damage"); } public override void SetDefaults() @@ -27,6 +28,21 @@ namespace CalamityMod.Items.Armor item.defense = 12; //49 } + public override void ModifyTooltips(List list) + { + if (CalamityWorld.death) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip2") + { + line2.text = "Temporary immunity to lava and immunity to fire damage\n" + + "Provides heat protection in Death Mode"; + } + } + } + } + public override bool IsArmorSet(Item head, Item body, Item legs) { return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); diff --git a/Items/Armor/AtaxiaMask.cs b/Items/Armor/AtaxiaMask.cs index 4299c241c8..339ae4ff52 100644 --- a/Items/Armor/AtaxiaMask.cs +++ b/Items/Armor/AtaxiaMask.cs @@ -1,5 +1,7 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.World; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -13,8 +15,7 @@ namespace CalamityMod.Items.Armor { DisplayName.SetDefault("Hydrothermic Mask"); Tooltip.SetDefault("12% increased magic damage, reduces mana usage by 15%, and 10% increased magic critical strike chance\n" + - "+100 max mana, temporary immunity to lava, and immunity to fire damage\n" + - "Provides heat protection in Death Mode"); + "+100 max mana, temporary immunity to lava, and immunity to fire damage"); } public override void SetDefaults() @@ -26,6 +27,21 @@ namespace CalamityMod.Items.Armor item.defense = 9; //45 } + public override void ModifyTooltips(List list) + { + if (CalamityWorld.death) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip1") + { + line2.text = "Temporary immunity to lava and immunity to fire damage\n" + + "Provides heat protection in Death Mode"; + } + } + } + } + public override bool IsArmorSet(Item head, Item body, Item legs) { return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); diff --git a/Items/Armor/AuricTeslaBodyArmor.cs b/Items/Armor/AuricTeslaBodyArmor.cs index 308688ea12..a64c4cc0ef 100644 --- a/Items/Armor/AuricTeslaBodyArmor.cs +++ b/Items/Armor/AuricTeslaBodyArmor.cs @@ -2,6 +2,8 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.World; +using System.Collections.Generic; using Terraria; using Terraria.ModLoader; @@ -17,8 +19,7 @@ namespace CalamityMod.Items.Armor "25% increased movement speed\n" + "Attacks have a 2% chance to do no damage to you\n" + "8% increased damage and 5% increased critical strike chance\n" + - "You will freeze enemies near you when you are struck\n" + - "Provides heat and cold protection in Death Mode"); + "You will freeze enemies near you when you are struck"); } public override void SetDefaults() @@ -30,6 +31,21 @@ namespace CalamityMod.Items.Armor item.Calamity().customRarity = CalamityRarity.Violet; } + public override void ModifyTooltips(List list) + { + if (CalamityWorld.death) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip4") + { + line2.text = "You will freeze enemies near you when you are struck\n" + + "Provides heat and cold protection in Death Mode"; + } + } + } + } + public override void UpdateEquip(Player player) { CalamityPlayer modPlayer = player.Calamity(); diff --git a/Items/Armor/BloodflareHelm.cs b/Items/Armor/BloodflareHelm.cs index 5cb35e9c2f..b606d8a68a 100644 --- a/Items/Armor/BloodflareHelm.cs +++ b/Items/Armor/BloodflareHelm.cs @@ -1,5 +1,7 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.World; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -13,8 +15,7 @@ namespace CalamityMod.Items.Armor { DisplayName.SetDefault("Bloodflare Imp Mask"); Tooltip.SetDefault("You can move freely through liquids and have temporary immunity to lava\n" + - "10% increased rogue damage and critical strike chance, 15% increased movement speed\n" + - "Provides heat protection in Death Mode"); + "10% increased rogue damage and critical strike chance, 15% increased movement speed"); } public override void SetDefaults() @@ -26,6 +27,21 @@ namespace CalamityMod.Items.Armor item.Calamity().customRarity = CalamityRarity.PureGreen; } + public override void ModifyTooltips(List list) + { + if (CalamityWorld.death) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip1") + { + line2.text = "10% increased rogue damage and critical strike chance, 15% increased movement speed\n" + + "Provides heat protection in Death Mode"; + } + } + } + } + public override bool IsArmorSet(Item head, Item body, Item legs) { return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); diff --git a/Items/Armor/BloodflareHelmet.cs b/Items/Armor/BloodflareHelmet.cs index eced0d7cce..b3bb0eee2c 100644 --- a/Items/Armor/BloodflareHelmet.cs +++ b/Items/Armor/BloodflareHelmet.cs @@ -1,5 +1,7 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.World; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -13,8 +15,7 @@ namespace CalamityMod.Items.Armor { DisplayName.SetDefault("Bloodflare Wyvern Helm"); Tooltip.SetDefault("You can move freely through liquids and have temporary immunity to lava\n" + - "+3 max minions\n" + - "Provides heat protection in Death Mode"); + "+3 max minions"); } public override void SetDefaults() @@ -26,6 +27,21 @@ namespace CalamityMod.Items.Armor item.Calamity().customRarity = CalamityRarity.PureGreen; } + public override void ModifyTooltips(List list) + { + if (CalamityWorld.death) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip1") + { + line2.text = "+3 max minions\n" + + "Provides heat protection in Death Mode"; + } + } + } + } + public override bool IsArmorSet(Item head, Item body, Item legs) { return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); diff --git a/Items/Armor/BloodflareHornedHelm.cs b/Items/Armor/BloodflareHornedHelm.cs index 2169c9027f..44987146ec 100644 --- a/Items/Armor/BloodflareHornedHelm.cs +++ b/Items/Armor/BloodflareHornedHelm.cs @@ -1,5 +1,7 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.World; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -13,8 +15,7 @@ namespace CalamityMod.Items.Armor { DisplayName.SetDefault("Bloodflare Horned Helm"); Tooltip.SetDefault("You can move freely through liquids and have temporary immunity to lava\n" + - "10% increased ranged damage and critical strike chance\n" + - "Provides heat protection in Death Mode"); + "10% increased ranged damage and critical strike chance"); } public override void SetDefaults() @@ -26,6 +27,21 @@ namespace CalamityMod.Items.Armor item.Calamity().customRarity = CalamityRarity.PureGreen; } + public override void ModifyTooltips(List list) + { + if (CalamityWorld.death) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip1") + { + line2.text = "10% increased ranged damage and critical strike chance\n" + + "Provides heat protection in Death Mode"; + } + } + } + } + public override bool IsArmorSet(Item head, Item body, Item legs) { return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); diff --git a/Items/Armor/BloodflareHornedMask.cs b/Items/Armor/BloodflareHornedMask.cs index 0b9fcc6490..1e2cf84381 100644 --- a/Items/Armor/BloodflareHornedMask.cs +++ b/Items/Armor/BloodflareHornedMask.cs @@ -1,5 +1,7 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.World; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -13,8 +15,7 @@ namespace CalamityMod.Items.Armor { DisplayName.SetDefault("Bloodflare Hydra Hood"); Tooltip.SetDefault("You can move freely through liquids and have temporary immunity to lava\n" + - "10% increased magic damage and critical strike chance, +100 max mana, and 17% reduced mana usage\n" + - "Provides heat protection in Death Mode"); + "10% increased magic damage and critical strike chance, +100 max mana, and 17% reduced mana usage"); } public override void SetDefaults() @@ -26,6 +27,21 @@ namespace CalamityMod.Items.Armor item.Calamity().customRarity = CalamityRarity.PureGreen; } + public override void ModifyTooltips(List list) + { + if (CalamityWorld.death) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip1") + { + line2.text = "10% increased magic damage and critical strike chance, +100 max mana, and 17% reduced mana usage\n" + + "Provides heat protection in Death Mode"; + } + } + } + } + public override bool IsArmorSet(Item head, Item body, Item legs) { return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); diff --git a/Items/Armor/BloodflareMask.cs b/Items/Armor/BloodflareMask.cs index 6754860b83..563e01663c 100644 --- a/Items/Armor/BloodflareMask.cs +++ b/Items/Armor/BloodflareMask.cs @@ -1,5 +1,7 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.World; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -13,8 +15,7 @@ namespace CalamityMod.Items.Armor { DisplayName.SetDefault("Bloodflare Ram Mask"); Tooltip.SetDefault("You can move freely through liquids and have temporary immunity to lava\n" + - "10% increased melee damage and critical strike chance\n" + - "Provides heat protection in Death Mode"); + "10% increased melee damage and critical strike chance"); } public override void SetDefaults() @@ -26,6 +27,21 @@ namespace CalamityMod.Items.Armor item.Calamity().customRarity = CalamityRarity.PureGreen; } + public override void ModifyTooltips(List list) + { + if (CalamityWorld.death) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip1") + { + line2.text = "10% increased melee damage and critical strike chance\n" + + "Provides heat protection in Death Mode"; + } + } + } + } + public override bool IsArmorSet(Item head, Item body, Item legs) { return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); diff --git a/Items/Armor/DaedalusVisor.cs b/Items/Armor/DaedalusVisor.cs index 1fee11c457..a61a43b5b4 100644 --- a/Items/Armor/DaedalusVisor.cs +++ b/Items/Armor/DaedalusVisor.cs @@ -47,8 +47,8 @@ namespace CalamityMod.Items.Armor CalamityPlayer modPlayer = player.Calamity(); modPlayer.daedalusSplit = true; modPlayer.rogueStealthMax += 1.05f; - player.Calamity().throwingDamage += 0.05f; - player.Calamity().wearingRogueArmor = true; + modPlayer.throwingDamage += 0.05f; + modPlayer.wearingRogueArmor = true; } public override void UpdateEquip(Player player) diff --git a/Items/Armor/FathomSwarmerBoots.cs b/Items/Armor/FathomSwarmerBoots.cs index 9fd55c2784..778d2237aa 100644 --- a/Items/Armor/FathomSwarmerBoots.cs +++ b/Items/Armor/FathomSwarmerBoots.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Armor public override void SetStaticDefaults() { DisplayName.SetDefault("Fathom Swarmer Greaves"); - Tooltip.SetDefault("7% increased minion damage\n" + + Tooltip.SetDefault("4% increased minion damage\n" + "Grants the ability to swim\n" + "Speed greatly increased while submerged in liquid"); } @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Armor public override void UpdateEquip(Player player) { - player.minionDamage += 0.07f; + player.minionDamage += 0.04f; if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) { player.moveSpeed += 0.5f; diff --git a/Items/Armor/FathomSwarmerBreastplate.cs b/Items/Armor/FathomSwarmerBreastplate.cs index c40488a041..7543f0d3e1 100644 --- a/Items/Armor/FathomSwarmerBreastplate.cs +++ b/Items/Armor/FathomSwarmerBreastplate.cs @@ -12,8 +12,8 @@ namespace CalamityMod.Items.Armor public override void SetStaticDefaults() { DisplayName.SetDefault("Fathom Swarmer Breastplate"); - Tooltip.SetDefault("12% increased damage reduction and minion damage\n" + - "+1 max minion\n" + + Tooltip.SetDefault("12% increased damage reduction\n" + + "6% increased minion damage and +1 max minion\n" + "Boosted defense and regen increased while submerged in liquid\n" + "Reduces defense loss within the Abyss"); } @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Armor public override void UpdateEquip(Player player) { - player.minionDamage += 0.12f; + player.minionDamage += 0.06f; player.endurance += 0.12f; player.maxMinions++; if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) diff --git a/Items/Armor/FathomSwarmerVisage.cs b/Items/Armor/FathomSwarmerVisage.cs index 4c32ddabd7..252bd66efa 100644 --- a/Items/Armor/FathomSwarmerVisage.cs +++ b/Items/Armor/FathomSwarmerVisage.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Armor public override void SetStaticDefaults() { DisplayName.SetDefault("Fathom Swarmer Visage"); - Tooltip.SetDefault("10% increased minion damage\n" + + Tooltip.SetDefault("5% increased minion damage\n" + "Provides breathing and light underwater"); } @@ -41,7 +41,7 @@ namespace CalamityMod.Items.Armor modPlayer.fathomSwarmer = true; player.spikedBoots = 2; player.maxMinions++; - player.minionDamage += 0.1f; + player.minionDamage += 0.05f; if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) { player.minionDamage += 0.3f; diff --git a/Items/Armor/FearmongerGreathelm.cs b/Items/Armor/FearmongerGreathelm.cs index 78cdc5f32f..1224f14374 100644 --- a/Items/Armor/FearmongerGreathelm.cs +++ b/Items/Armor/FearmongerGreathelm.cs @@ -2,6 +2,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Materials; using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.World; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -52,13 +53,25 @@ namespace CalamityMod.Items.Armor public override void UpdateArmorSet(Player player) { - player.setBonus = @"30% increased minion damage -Minions deal full damage while wielding weaponry + if (CalamityWorld.death) + { + player.setBonus = @"30% increased minion damage +The minion damage nerf while wielding weaponry is reduced Immunity to all forms of frost and flame All minion attacks grant colossal life regeneration 15% increased damage reduction during the Pumpkin and Frost Moons This extra damage reduction ignores the soft cap Provides cold protection in Death Mode"; + } + else + { + player.setBonus = @"30% increased minion damage +The minion damage nerf while wielding weaponry is reduced +Immunity to all forms of frost and flame +All minion attacks grant colossal life regeneration +15% increased damage reduction during the Pumpkin and Frost Moons +This extra damage reduction ignores the soft cap"; + } // This bool encompasses cross-class nerf immunity, colossal life regen on minion attack, and the holiday moon DR player.Calamity().fearmongerSet = true; diff --git a/Items/Armor/ForbiddenCirclet.cs b/Items/Armor/ForbiddenCirclet.cs index f26db05c40..4f1fdde063 100644 --- a/Items/Armor/ForbiddenCirclet.cs +++ b/Items/Armor/ForbiddenCirclet.cs @@ -8,8 +8,8 @@ namespace CalamityMod.Items.Armor [AutoloadEquip(EquipType.Head)] public class ForbiddenCirclet : ModItem { - public const int manaCost = 50; - public const int tornadoBaseDmg = 100; + public const int manaCost = 60; + public const int tornadoBaseDmg = 80; public const float tornadoBaseKB = 1f; public override void SetStaticDefaults() @@ -48,7 +48,6 @@ namespace CalamityMod.Items.Armor player.setBonus = "Press " + hotkey + " to call an ancient storm to the cursor location\n" + "The ancient storm costs " + stormMana + " mana and benefits from both summon and rogue bonuses\n" + "Rogue stealth strikes spawn homing eaters on enemy hits\n" + - "Minions deal full damage while wielding rogue weapons\n" + "Rogue and summon attacks will scale off of the stat with a higher boost\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" + diff --git a/Items/Armor/GodSlayerHelm.cs b/Items/Armor/GodSlayerHelm.cs index 3f91c72339..081ac52b0c 100644 --- a/Items/Armor/GodSlayerHelm.cs +++ b/Items/Armor/GodSlayerHelm.cs @@ -41,7 +41,7 @@ namespace CalamityMod.Items.Armor modPlayer.godSlayerDamage = true; player.setBonus = "You will survive fatal damage and will be healed 150 HP if an attack would have killed you\n" + "This effect can only occur once every 45 seconds\n" + - "While the cooldown for this effect is active you gain a 10% increase to all damage\n" + + "While the cooldown for this effect is active all life regen is disabled\n" + "Taking over 80 damage in one hit will cause you to release a swarm of high-damage god killer darts\n" + "Enemies take a lot of damage when they hit you\n" + "An attack that would deal 80 damage or less will have its damage reduced to 1"; diff --git a/Items/Armor/GodSlayerHelmet.cs b/Items/Armor/GodSlayerHelmet.cs index 783b0663d4..17743bb8cf 100644 --- a/Items/Armor/GodSlayerHelmet.cs +++ b/Items/Armor/GodSlayerHelmet.cs @@ -41,8 +41,8 @@ namespace CalamityMod.Items.Armor modPlayer.godSlayerRanged = true; player.setBonus = "You will survive fatal damage and will be healed 150 HP if an attack would have killed you\n" + "This effect can only occur once every 45 seconds\n" + - "While the cooldown for this effect is active you gain a 10% increase to all damage\n" + - "Your ranged critical hits have a chance to critically hit, causing 4 times the damage\n" + + "While the cooldown for this effect is active all life regen is disabled\n" + + "Your ranged critical hits have a chance to critically hit, causing 4 times the damage\n" + "You have a chance to fire a god killer shrapnel round while firing ranged weapons"; } diff --git a/Items/Armor/GodSlayerHornedHelm.cs b/Items/Armor/GodSlayerHornedHelm.cs index 6f60df9410..554ab92943 100644 --- a/Items/Armor/GodSlayerHornedHelm.cs +++ b/Items/Armor/GodSlayerHornedHelm.cs @@ -169,8 +169,8 @@ namespace CalamityMod.Items.Armor player.setBonus = "65% increased minion damage\n" + "You will survive fatal damage and will be healed 150 HP if an attack would have killed you\n" + "This effect can only occur once every 45 seconds\n" + - "While the cooldown for this effect is active you gain a 10% increase to all damage\n" + - "Hitting enemies will summon god slayer phantoms\n" + + "While the cooldown for this effect is active all life regen is disabled\n" + + "Hitting enemies will summon god slayer phantoms\n" + "Summons a god-eating mechworm to fight for you"; player.minionDamage += 0.65f; } diff --git a/Items/Armor/GodSlayerMask.cs b/Items/Armor/GodSlayerMask.cs index 4987995557..9fc064b626 100644 --- a/Items/Armor/GodSlayerMask.cs +++ b/Items/Armor/GodSlayerMask.cs @@ -43,8 +43,8 @@ namespace CalamityMod.Items.Armor modPlayer.wearingRogueArmor = true; player.setBonus = "You will survive fatal damage and will be healed 150 HP if an attack would have killed you\n" + "This effect can only occur once every 45 seconds\n" + - "While the cooldown for this effect is active you gain a 10% increase to all damage\n" + - "While at full HP all of your rogue stats are boosted by 10%\n" + + "While the cooldown for this effect is active all life regen is disabled\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 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" + diff --git a/Items/Armor/GodSlayerVisage.cs b/Items/Armor/GodSlayerVisage.cs index b3b7dc8bd5..1e2ce44e8e 100644 --- a/Items/Armor/GodSlayerVisage.cs +++ b/Items/Armor/GodSlayerVisage.cs @@ -42,8 +42,8 @@ namespace CalamityMod.Items.Armor modPlayer.godSlayerMage = true; player.setBonus = "You will survive fatal damage and will be healed 150 HP if an attack would have killed you\n" + "This effect can only occur once every 45 seconds\n" + - "While the cooldown for this effect is active you gain a 10% increase to all damage\n" + - "Enemies will release god slayer flames and healing flames when hit with magic attacks\n" + + "While the cooldown for this effect is active all life regen is disabled\n" + + "Enemies will release god slayer flames and healing flames when hit with magic attacks\n" + "Taking damage will cause you to release a magical god slayer explosion"; } diff --git a/Items/Armor/MeldTransformation_Arms.png b/Items/Armor/MeldTransformation_Arms.png new file mode 100644 index 0000000000..d8caa7f60a Binary files /dev/null and b/Items/Armor/MeldTransformation_Arms.png differ diff --git a/Items/Armor/MeldTransformation_Body.png b/Items/Armor/MeldTransformation_Body.png new file mode 100644 index 0000000000..c35fedf436 Binary files /dev/null and b/Items/Armor/MeldTransformation_Body.png differ diff --git a/Items/Armor/MeldTransformation_Head.png b/Items/Armor/MeldTransformation_Head.png new file mode 100644 index 0000000000..6045927bc4 Binary files /dev/null and b/Items/Armor/MeldTransformation_Head.png differ diff --git a/Items/Armor/MeldTransformation_Legs.png b/Items/Armor/MeldTransformation_Legs.png new file mode 100644 index 0000000000..fbf2427684 Binary files /dev/null and b/Items/Armor/MeldTransformation_Legs.png differ diff --git a/Items/Armor/MolluskShellmet.cs b/Items/Armor/MolluskShellmet.cs index 4b8ceb4030..ff09f23829 100644 --- a/Items/Armor/MolluskShellmet.cs +++ b/Items/Armor/MolluskShellmet.cs @@ -57,8 +57,7 @@ namespace CalamityMod.Items.Armor } if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 2) { - int shellfish = Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), (int)(200f * player.MinionDamage()), 0f, Main.myPlayer, 0f, 0f); - Main.projectile[shellfish].Calamity().lineColor = 1; + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), (int)(140 * player.MinionDamage()), 0f, player.whoAmI); } } player.Calamity().wearingRogueArmor = true; diff --git a/Items/Armor/PlagueReaperMask.cs b/Items/Armor/PlagueReaperMask.cs index 8e665a4118..22915a3866 100644 --- a/Items/Armor/PlagueReaperMask.cs +++ b/Items/Armor/PlagueReaperMask.cs @@ -82,23 +82,7 @@ namespace CalamityMod.Items.Armor { if (Main.rand.NextBool(10)) { - for (int l = 0; l < 1; l++) - { - float x = player.position.X + (float)Main.rand.Next(-400, 400); - float y = player.position.Y - (float)Main.rand.Next(500, 800); - Vector2 vector = new Vector2(x, y); - float num15 = player.position.X + (float)(player.width / 2) - vector.X; - float num16 = player.position.Y + (float)(player.height / 2) - vector.Y; - num15 += (float)Main.rand.Next(-100, 101); - int num17 = 22; - float num18 = (float)Math.Sqrt((double)(num15 * num15 + num16 * num16)); - num18 = (float)num17 / num18; - num15 *= num18; - num16 *= num18; - int num19 = Projectile.NewProjectile(x, y, num15, num16, ModContent.ProjectileType(), (int)(40 * player.RangedDamage()),4f, player.whoAmI, 0f, 0f); - Main.projectile[num19].Calamity().rogue = false; - Main.projectile[num19].ai[1] = player.position.Y; - } + CalamityUtils.ProjectileRain(player.Center, 400f, 100f, 500f, 800f, 22f, ModContent.ProjectileType(), (int)(40 * player.RangedDamage()), 4f, player.whoAmI, 6); } } } diff --git a/Items/Armor/PlagueReaperVest.cs b/Items/Armor/PlagueReaperVest.cs index 797920e71e..32ec1ac593 100644 --- a/Items/Armor/PlagueReaperVest.cs +++ b/Items/Armor/PlagueReaperVest.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Armor public override void SetStaticDefaults() { DisplayName.SetDefault("Plague Reaper Vest"); - Tooltip.SetDefault("Immunity to the Plague\n" + + Tooltip.SetDefault("Reduces the damage caused to you by the plague\n" + "15% increased ranged damage and 5% increased ranged critical strike chance"); } @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Armor { player.rangedDamage += 0.15f; player.rangedCrit += 5; - player.buffImmune[ModContent.BuffType()] = true; + player.Calamity().reducedPlagueDmg = true; } public override void AddRecipes() diff --git a/Items/Armor/PlaguebringerCarapace.cs b/Items/Armor/PlaguebringerCarapace.cs index 066a4dafbb..8a9461f946 100644 --- a/Items/Armor/PlaguebringerCarapace.cs +++ b/Items/Armor/PlaguebringerCarapace.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Armor public override void SetStaticDefaults() { DisplayName.SetDefault("Plaguebringer Carapace"); - Tooltip.SetDefault("Immunity to the Plague\n" + + Tooltip.SetDefault("Reduces the damage caused to you by the plague\n" + "12% increased minion damage and +1 max minions\n" + "Friendly bees inflict the plague"); } @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Armor player.Calamity().plaguebringerCarapace = true; player.maxMinions += 2; player.minionDamage += 0.12f; - player.buffImmune[ModContent.BuffType()] = true; + player.Calamity().reducedPlagueDmg = true; } public override void AddRecipes() diff --git a/Items/Armor/PlaguebringerPistons.cs b/Items/Armor/PlaguebringerPistons.cs index 6cb56583b8..45241d0e3b 100644 --- a/Items/Armor/PlaguebringerPistons.cs +++ b/Items/Armor/PlaguebringerPistons.cs @@ -32,32 +32,7 @@ namespace CalamityMod.Items.Armor { player.minionDamage += 0.13f; player.moveSpeed += 0.15f; - - //Spawn bees while sprinting or dashing - counter++; - if (counter % 12 == 0) - { - if ((Math.Abs(player.velocity.X) >= 5 || Math.Abs(player.velocity.Y) >= 5) && player.whoAmI == Main.myPlayer) - { - int beeCount = 1; - if (Main.rand.NextBool(3)) - ++beeCount; - if (Main.rand.NextBool(3)) - ++beeCount; - if (player.strongBees && Main.rand.NextBool(3)) - ++beeCount; - int damage = 30; - damage = (int)(damage * player.MinionDamage()); - for (int index = 0; index < beeCount; ++index) - { - int bee = Projectile.NewProjectile(player.Center.X, player.Center.Y, Main.rand.NextFloat(-35f, 35f) * 0.02f, Main.rand.NextFloat(-35f, 35f) * 0.02f, (Main.rand.NextBool(4) ? ModContent.ProjectileType() : player.beeType()), damage, player.beeKB(0f), player.whoAmI, 0f, 0f); - Main.projectile[bee].Calamity().forceMinion = true; - Main.projectile[bee].usesLocalNPCImmunity = true; - Main.projectile[bee].localNPCHitCooldown = 10; - Main.projectile[bee].penetrate = 2; - } - } - } + player.Calamity().plaguebringerPistons = true; //Flower Boots code if (player.whoAmI == Main.myPlayer && player.velocity.Y == 0f && player.grappling[0] == -1) diff --git a/Items/Armor/PrismaticGreaves.cs b/Items/Armor/PrismaticGreaves.cs index 89c4ebf7ef..29b5d83c97 100644 --- a/Items/Armor/PrismaticGreaves.cs +++ b/Items/Armor/PrismaticGreaves.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Armor DisplayName.SetDefault("Prismatic Greaves"); Tooltip.SetDefault("10% increased magic damage and 12% increased magic crit\n" + "20% decreased non-magic damage\n" + - "Increases flight time and jump speed by 10%"); + "10% increased flight time and 2% increased jump speed"); } public override void SetDefaults() diff --git a/Items/Armor/PrismaticHelmet.cs b/Items/Armor/PrismaticHelmet.cs index cad0474c9b..1d37f3b3a7 100644 --- a/Items/Armor/PrismaticHelmet.cs +++ b/Items/Armor/PrismaticHelmet.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Armor DisplayName.SetDefault("Prismatic Helmet"); Tooltip.SetDefault("8% increased magic damage and 12% increased magic crit\n" + "20% decreased non-magic damage\n" + - "Enemies with less than 500 health deal no damage\n" + + "Enemies with less than 500 max health deal no contact damage\n" + "This does not occur while a boss is alive"); } diff --git a/Items/Armor/SilvaHelm.cs b/Items/Armor/SilvaHelm.cs index 71c350f7b3..6b76c3eec1 100644 --- a/Items/Armor/SilvaHelm.cs +++ b/Items/Armor/SilvaHelm.cs @@ -40,8 +40,7 @@ namespace CalamityMod.Items.Armor CalamityPlayer modPlayer = player.Calamity(); modPlayer.silvaSet = true; modPlayer.silvaMelee = true; - player.setBonus = "You are immune to almost all debuffs\n" + - "All projectiles spawn healing leaf orbs on enemy hits\n" + + player.setBonus = "All projectiles spawn healing leaf orbs on enemy hits\n" + "Max run speed and acceleration boosted by 5%\n" + "If you are reduced to 1 HP you will not die from any further damage for 10 seconds\n" + "If you get reduced to 1 HP again while this effect is active you will lose 100 max life\n" + @@ -49,8 +48,7 @@ namespace CalamityMod.Items.Armor "Your max life will return to normal if you die\n" + "True melee strikes have a 25% chance to do five times damage\n" + "After the silva invincibility is over you will take 20% less contact damage\n" + - "Melee projectiles have a 25% chance to stun enemies for a very brief moment\n" + - "Provides cold protection in Death Mode"; + "Melee projectiles have a 25% chance to stun enemies for a very brief moment"; } public override void UpdateEquip(Player player) diff --git a/Items/Armor/SilvaHelmet.cs b/Items/Armor/SilvaHelmet.cs index 44a7107719..9cae6f926f 100644 --- a/Items/Armor/SilvaHelmet.cs +++ b/Items/Armor/SilvaHelmet.cs @@ -43,7 +43,6 @@ namespace CalamityMod.Items.Armor modPlayer.silvaSet = true; modPlayer.silvaSummon = true; player.setBonus = "75% increased minion damage\n" + - "You are immune to almost all debuffs\n" + "All projectiles spawn healing leaf orbs on enemy hits\n" + "Max run speed and acceleration boosted by 5%\n" + "If you are reduced to 1 HP you will not die from any further damage for 10 seconds\n" + @@ -51,8 +50,7 @@ namespace CalamityMod.Items.Armor "This effect only triggers once per life and if you are reduced to 400 max life the invincibility effect will stop\n" + "Your max life will return to normal if you die\n" + "Summons an ancient leaf prism to blast your enemies with life energy\n" + - "After the silva invulnerability time your minions will deal 10% more damage and you will gain +2 max minions\n" + - "Provides cold protection in Death Mode"; + "After the silva invulnerability time your minions will deal 10% more damage and you will gain +2 max minions"; if (player.whoAmI == Main.myPlayer) { if (player.FindBuffIndex(ModContent.BuffType()) == -1) diff --git a/Items/Armor/SilvaHornedHelm.cs b/Items/Armor/SilvaHornedHelm.cs index 5b292d01ac..0fd7d507e9 100644 --- a/Items/Armor/SilvaHornedHelm.cs +++ b/Items/Armor/SilvaHornedHelm.cs @@ -40,16 +40,14 @@ namespace CalamityMod.Items.Armor CalamityPlayer modPlayer = player.Calamity(); modPlayer.silvaSet = true; modPlayer.silvaRanged = true; - player.setBonus = "You are immune to almost all debuffs\n" + - "All projectiles spawn healing leaf orbs on enemy hits\n" + + player.setBonus = "All projectiles spawn healing leaf orbs on enemy hits\n" + "Max run speed and acceleration boosted by 5%\n" + "If you are reduced to 1 HP you will not die from any further damage for 10 seconds\n" + "If you get reduced to 1 HP again while this effect is active you will lose 100 max life\n" + "This effect only triggers once per life and if you are reduced to 400 max life the invincibility effect will stop\n" + "Your max life will return to normal if you die\n" + "Increases your rate of fire with all ranged weapons\n" + - "During the silva invulnerability time your ranged weapons will do 40% more damage\n" + - "Provides cold protection in Death Mode"; + "During the silva invulnerability time your ranged weapons will do 40% more damage"; } public override void UpdateEquip(Player player) diff --git a/Items/Armor/SilvaMask.cs b/Items/Armor/SilvaMask.cs index 07cc847b99..9d7829e77f 100644 --- a/Items/Armor/SilvaMask.cs +++ b/Items/Armor/SilvaMask.cs @@ -42,8 +42,7 @@ namespace CalamityMod.Items.Armor modPlayer.silvaThrowing = true; modPlayer.rogueStealthMax += 1.25f; modPlayer.wearingRogueArmor = true; - player.setBonus = "You are immune to almost all debuffs\n" + - "All projectiles spawn healing leaf orbs on enemy hits\n" + + player.setBonus = "All projectiles spawn healing leaf orbs on enemy hits\n" + "Max run speed and acceleration boosted by 5%\n" + "If you are reduced to 1 HP you will not die from any further damage for 10 seconds\n" + "If you get reduced to 1 HP again while this effect is active you will lose 100 max life\n" + @@ -54,8 +53,7 @@ namespace CalamityMod.Items.Armor "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" + - "Provides cold protection in Death Mode"; + "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; } public override void UpdateEquip(Player player) diff --git a/Items/Armor/SilvaMaskedCap.cs b/Items/Armor/SilvaMaskedCap.cs index b36548d93a..fe3aced15a 100644 --- a/Items/Armor/SilvaMaskedCap.cs +++ b/Items/Armor/SilvaMaskedCap.cs @@ -41,16 +41,14 @@ namespace CalamityMod.Items.Armor CalamityPlayer modPlayer = player.Calamity(); modPlayer.silvaSet = true; modPlayer.silvaMage = true; - player.setBonus = "You are immune to almost all debuffs\n" + - "All projectiles spawn healing leaf orbs on enemy hits\n" + + player.setBonus = "All projectiles spawn healing leaf orbs on enemy hits\n" + "Max run speed and acceleration boosted by 5%\n" + "If you are reduced to 1 HP you will not die from any further damage for 10 seconds\n" + "If you get reduced to 1 HP again while this effect is active you will lose 100 max life\n" + "This effect only triggers once per life and if you are reduced to 400 max life the invincibility effect will stop\n" + "Your max life will return to normal if you die\n" + "Magic projectiles have a 10% chance to cause a massive explosion on enemy hits\n" + - "After the silva invulnerability time your magic weapons will do 10% more damage\n" + - "Provides cold protection in Death Mode"; + "After the silva invulnerability time your magic weapons will do 10% more damage"; } public override void UpdateEquip(Player player) diff --git a/Items/Armor/StatigelArmor.cs b/Items/Armor/StatigelArmor.cs index 8e5cd4fac1..42fbd4e999 100644 --- a/Items/Armor/StatigelArmor.cs +++ b/Items/Armor/StatigelArmor.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -25,10 +26,7 @@ namespace CalamityMod.Items.Armor public override void UpdateEquip(Player player) { - player.meleeCrit += 5; - player.magicCrit += 5; - player.rangedCrit += 5; - player.Calamity().throwingCrit += 5; + player.Calamity().AllCritBoost(5); } public override void AddRecipes() @@ -36,7 +34,7 @@ namespace CalamityMod.Items.Armor ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 8); recipe.AddIngredient(ItemID.HellstoneBar, 13); - recipe.AddTile(TileID.Anvils); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Armor/StatigelCap.cs b/Items/Armor/StatigelCap.cs index d7f0aa1201..4ac3046f6d 100644 --- a/Items/Armor/StatigelCap.cs +++ b/Items/Armor/StatigelCap.cs @@ -1,5 +1,6 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -33,7 +34,8 @@ namespace CalamityMod.Items.Armor public override void UpdateArmorSet(Player player) { player.setBonus = "When you take over 100 damage in one hit you become immune to damage for an extended period of time\n" + - "Grants an extra jump and increased jump height"; + "Grants an extra jump and increased jump height\n" + + "30% increased jump speed"; CalamityPlayer modPlayer = player.Calamity(); modPlayer.statigelSet = true; player.doubleJumpSail = true; @@ -54,7 +56,7 @@ namespace CalamityMod.Items.Armor ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddIngredient(ItemID.HellstoneBar, 9); - recipe.AddTile(TileID.Anvils); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Armor/StatigelGreaves.cs b/Items/Armor/StatigelGreaves.cs index 4391101bd5..5c579abd68 100644 --- a/Items/Armor/StatigelGreaves.cs +++ b/Items/Armor/StatigelGreaves.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -34,7 +35,7 @@ namespace CalamityMod.Items.Armor ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 6); recipe.AddIngredient(ItemID.HellstoneBar, 11); - recipe.AddTile(TileID.Anvils); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Armor/StatigelHeadgear.cs b/Items/Armor/StatigelHeadgear.cs index 02c79d77f4..0f199aa456 100644 --- a/Items/Armor/StatigelHeadgear.cs +++ b/Items/Armor/StatigelHeadgear.cs @@ -1,5 +1,6 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -33,7 +34,8 @@ namespace CalamityMod.Items.Armor public override void UpdateArmorSet(Player player) { player.setBonus = "When you take over 100 damage in one hit you become immune to damage for an extended period of time\n" + - "Grants an extra jump and increased jump height"; + "Grants an extra jump and increased jump height\n" + + "30% increased jump speed"; CalamityPlayer modPlayer = player.Calamity(); modPlayer.statigelSet = true; player.doubleJumpSail = true; @@ -52,7 +54,7 @@ namespace CalamityMod.Items.Armor ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddIngredient(ItemID.HellstoneBar, 9); - recipe.AddTile(TileID.Anvils); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Armor/StatigelHelm.cs b/Items/Armor/StatigelHelm.cs index 923b2340a0..42e3982386 100644 --- a/Items/Armor/StatigelHelm.cs +++ b/Items/Armor/StatigelHelm.cs @@ -1,5 +1,6 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -33,7 +34,8 @@ namespace CalamityMod.Items.Armor public override void UpdateArmorSet(Player player) { player.setBonus = "When you take over 100 damage in one hit you become immune to damage for an extended period of time\n" + - "Grants an extra jump and increased jump height"; + "Grants an extra jump and increased jump height\n" + + "30% increased jump speed"; CalamityPlayer modPlayer = player.Calamity(); modPlayer.statigelSet = true; player.doubleJumpSail = true; @@ -53,7 +55,7 @@ namespace CalamityMod.Items.Armor ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddIngredient(ItemID.HellstoneBar, 9); - recipe.AddTile(TileID.Anvils); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Armor/StatigelHood.cs b/Items/Armor/StatigelHood.cs index 7fc6b4d38b..b19e5d77fa 100644 --- a/Items/Armor/StatigelHood.cs +++ b/Items/Armor/StatigelHood.cs @@ -2,6 +2,7 @@ using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -36,7 +37,8 @@ namespace CalamityMod.Items.Armor player.setBonus = "18% increased minion damage\n" + "Summons a mini slime god to fight for you, the type depends on what world evil you have\n" + "When you take over 100 damage in one hit you become immune to damage for an extended period of time\n" + - "Grants an extra jump and increased jump height"; + "Grants an extra jump and increased jump height\n" + + "30% increased jump speed"; CalamityPlayer modPlayer = player.Calamity(); modPlayer.statigelSet = true; modPlayer.slimeGod = true; @@ -72,7 +74,7 @@ namespace CalamityMod.Items.Armor ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddIngredient(ItemID.HellstoneBar, 9); - recipe.AddTile(TileID.Anvils); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Armor/StatigelMask.cs b/Items/Armor/StatigelMask.cs index fa6aa180ce..8625f8e775 100644 --- a/Items/Armor/StatigelMask.cs +++ b/Items/Armor/StatigelMask.cs @@ -1,5 +1,6 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -34,6 +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" + + "30% increased jump speed\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" + @@ -60,7 +62,7 @@ namespace CalamityMod.Items.Armor ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddIngredient(ItemID.HellstoneBar, 9); - recipe.AddTile(TileID.Anvils); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Armor/TarragonBreastplate.cs b/Items/Armor/TarragonBreastplate.cs index 209474037e..bbb980ad81 100644 --- a/Items/Armor/TarragonBreastplate.cs +++ b/Items/Armor/TarragonBreastplate.cs @@ -11,9 +11,9 @@ namespace CalamityMod.Items.Armor public override void SetStaticDefaults() { DisplayName.SetDefault("Tarragon Breastplate"); - Tooltip.SetDefault("10% increased damage and 5% increased critical strike chance\n" + - "+2 life regen and +40 max life\n" + - "Breastplate of the exiler"); + Tooltip.SetDefault("Breastplate of the exiler\n" + + "10% increased damage and 5% increased critical strike chance\n" + + "+2 life regen and +40 max life"); } public override void SetDefaults() diff --git a/Items/Armor/TarragonHelm.cs b/Items/Armor/TarragonHelm.cs index f9f079167f..92116f98ca 100644 --- a/Items/Armor/TarragonHelm.cs +++ b/Items/Armor/TarragonHelm.cs @@ -1,5 +1,7 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.World; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -13,11 +15,10 @@ namespace CalamityMod.Items.Armor { DisplayName.SetDefault("Tarragon Helm"); Tooltip.SetDefault("Helm of the disciple of ancients\n" + - "Temporary immunity to lava and immunity to cursed inferno, fire, cursed, and chilled debuffs\n" + + "Temporary immunity to lava\n" + "Can move freely through liquids\n" + "5% increased damage reduction\n" + - "10% increased melee damage and critical strike chance\n" + - "Provides heat protection in Death Mode"); + "10% increased melee damage and critical strike chance"); } public override void SetDefaults() @@ -29,6 +30,21 @@ namespace CalamityMod.Items.Armor item.Calamity().customRarity = CalamityRarity.Turquoise; } + public override void ModifyTooltips(List list) + { + if (CalamityWorld.death) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip4") + { + line2.text = "10% increased melee damage and critical strike chance\n" + + "Provides heat protection in Death Mode"; + } + } + } + } + public override bool IsArmorSet(Item head, Item body, Item legs) { return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); @@ -60,10 +76,6 @@ namespace CalamityMod.Items.Armor player.endurance += 0.05f; player.lavaMax += 240; player.ignoreWater = true; - player.buffImmune[BuffID.CursedInferno] = true; - player.buffImmune[BuffID.OnFire] = true; - player.buffImmune[BuffID.Cursed] = true; - player.buffImmune[BuffID.Chilled] = true; } public override void AddRecipes() diff --git a/Items/Armor/TarragonHelmet.cs b/Items/Armor/TarragonHelmet.cs index d3a76200bf..ce0d17de40 100644 --- a/Items/Armor/TarragonHelmet.cs +++ b/Items/Armor/TarragonHelmet.cs @@ -1,5 +1,7 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.World; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -12,11 +14,10 @@ namespace CalamityMod.Items.Armor public override void SetStaticDefaults() { DisplayName.SetDefault("Tarragon Helmet"); - Tooltip.SetDefault("Temporary immunity to lava and immunity to cursed inferno, fire, cursed, and chilled debuffs\n" + + Tooltip.SetDefault("Temporary immunity to lava\n" + "Can move freely through liquids and 12% increased movement speed\n" + "10% increased rogue damage and critical strike chance\n" + - "5% increased damage reduction\n" + - "Provides heat protection in Death Mode"); + "5% increased damage reduction"); } public override void SetDefaults() @@ -28,6 +29,21 @@ namespace CalamityMod.Items.Armor item.Calamity().customRarity = CalamityRarity.Turquoise; } + public override void ModifyTooltips(List list) + { + if (CalamityWorld.death) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip3") + { + line2.text = "5% increased damage reduction\n" + + "Provides heat protection in Death Mode"; + } + } + } + } + public override bool IsArmorSet(Item head, Item body, Item legs) { return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); @@ -66,10 +82,6 @@ namespace CalamityMod.Items.Armor player.endurance += 0.05f; player.lavaMax += 240; player.ignoreWater = true; - player.buffImmune[BuffID.CursedInferno] = true; - player.buffImmune[BuffID.OnFire] = true; - player.buffImmune[BuffID.Cursed] = true; - player.buffImmune[BuffID.Chilled] = true; } public override void AddRecipes() diff --git a/Items/Armor/TarragonHornedHelm.cs b/Items/Armor/TarragonHornedHelm.cs index ff43b9c950..92498eb39a 100644 --- a/Items/Armor/TarragonHornedHelm.cs +++ b/Items/Armor/TarragonHornedHelm.cs @@ -1,5 +1,7 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.World; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -12,10 +14,9 @@ namespace CalamityMod.Items.Armor public override void SetStaticDefaults() { DisplayName.SetDefault("Tarragon Horned Helm"); - Tooltip.SetDefault("Temporary immunity to lava and immunity to cursed inferno, fire, cursed, and chilled debuffs\n" + + Tooltip.SetDefault("Temporary immunity to lava\n" + "Can move freely through liquids\n" + - "5% increased damage reduction and +3 max minions\n" + - "Provides heat protection in Death Mode"); + "5% increased damage reduction and +3 max minions"); } public override void SetDefaults() @@ -27,6 +28,21 @@ namespace CalamityMod.Items.Armor item.Calamity().customRarity = CalamityRarity.Turquoise; } + public override void ModifyTooltips(List list) + { + if (CalamityWorld.death) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip2") + { + line2.text = "5% increased damage reduction and +3 max minions\n" + + "Provides heat protection in Death Mode"; + } + } + } + } + public override bool IsArmorSet(Item head, Item body, Item legs) { return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); @@ -58,10 +74,6 @@ namespace CalamityMod.Items.Armor player.endurance += 0.05f; player.lavaMax += 240; player.ignoreWater = true; - player.buffImmune[BuffID.CursedInferno] = true; - player.buffImmune[BuffID.OnFire] = true; - player.buffImmune[BuffID.Cursed] = true; - player.buffImmune[BuffID.Chilled] = true; } public override void AddRecipes() diff --git a/Items/Armor/TarragonMask.cs b/Items/Armor/TarragonMask.cs index a73d7c459e..1f7b49b661 100644 --- a/Items/Armor/TarragonMask.cs +++ b/Items/Armor/TarragonMask.cs @@ -1,5 +1,7 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.World; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -12,11 +14,10 @@ namespace CalamityMod.Items.Armor public override void SetStaticDefaults() { DisplayName.SetDefault("Tarragon Mask"); - Tooltip.SetDefault("Temporary immunity to lava and immunity to cursed inferno, fire, cursed, and chilled debuffs\n" + + Tooltip.SetDefault("Temporary immunity to lava\n" + "Can move freely through liquids\n" + "10% increased magic damage and critical strike chance\n" + - "5% increased damage reduction, +100 max mana, and 15% reduced mana usage\n" + - "Provides heat protection in Death Mode"); + "5% increased damage reduction, +100 max mana, and 15% reduced mana usage"); } public override void SetDefaults() @@ -28,6 +29,21 @@ namespace CalamityMod.Items.Armor item.Calamity().customRarity = CalamityRarity.Turquoise; } + public override void ModifyTooltips(List list) + { + if (CalamityWorld.death) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip3") + { + line2.text = "5% increased damage reduction, +100 max mana, and 15% reduced mana usage\n" + + "Provides heat protection in Death Mode"; + } + } + } + } + public override bool IsArmorSet(Item head, Item body, Item legs) { return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); @@ -61,10 +77,6 @@ namespace CalamityMod.Items.Armor player.lavaMax += 240; player.statManaMax2 += 100; player.ignoreWater = true; - player.buffImmune[BuffID.CursedInferno] = true; - player.buffImmune[BuffID.OnFire] = true; - player.buffImmune[BuffID.Cursed] = true; - player.buffImmune[BuffID.Chilled] = true; } public override void AddRecipes() diff --git a/Items/Armor/TarragonVisage.cs b/Items/Armor/TarragonVisage.cs index 52835aa915..acf2a59ff7 100644 --- a/Items/Armor/TarragonVisage.cs +++ b/Items/Armor/TarragonVisage.cs @@ -1,5 +1,7 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.World; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -12,11 +14,10 @@ namespace CalamityMod.Items.Armor public override void SetStaticDefaults() { DisplayName.SetDefault("Tarragon Visage"); - Tooltip.SetDefault("Temporary immunity to lava and immunity to cursed inferno, fire, cursed, and chilled debuffs\n" + + Tooltip.SetDefault("Temporary immunity to lava\n" + "Can move freely through liquids\n" + "10% increased ranged damage and critical strike chance\n" + - "5% increased damage reduction\n" + - "Provides heat protection in Death Mode"); + "5% increased damage reduction"); } public override void SetDefaults() @@ -28,6 +29,21 @@ namespace CalamityMod.Items.Armor item.Calamity().customRarity = CalamityRarity.Turquoise; } + public override void ModifyTooltips(List list) + { + if (CalamityWorld.death) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip3") + { + line2.text = "5% increased damage reduction\n" + + "Provides heat protection in Death Mode"; + } + } + } + } + public override bool IsArmorSet(Item head, Item body, Item legs) { return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); @@ -58,10 +74,6 @@ namespace CalamityMod.Items.Armor player.endurance += 0.05f; player.lavaMax += 240; player.ignoreWater = true; - player.buffImmune[BuffID.CursedInferno] = true; - player.buffImmune[BuffID.OnFire] = true; - player.buffImmune[BuffID.Cursed] = true; - player.buffImmune[BuffID.Chilled] = true; } public override void AddRecipes() diff --git a/Items/Armor/TitanHeartBoots.cs b/Items/Armor/TitanHeartBoots.cs new file mode 100644 index 0000000000..6f5db48111 --- /dev/null +++ b/Items/Armor/TitanHeartBoots.cs @@ -0,0 +1,44 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Legs)] + public class TitanHeartBoots : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Titan Heart Boots"); + Tooltip.SetDefault("4% increased rogue damage, 10% increased rogue velocity, and 5% increased rogue knockback"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 12, 0, 0); + item.rare = 5; + item.defense = 14; + } + + public override void UpdateEquip(Player player) + { + player.Calamity().titanHeartBoots = true; + player.Calamity().throwingVelocity += 0.1f; + player.Calamity().throwingDamage += 0.04f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 14); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/TitanHeartBoots.png b/Items/Armor/TitanHeartBoots.png new file mode 100644 index 0000000000..97012de069 Binary files /dev/null and b/Items/Armor/TitanHeartBoots.png differ diff --git a/Items/Armor/TitanHeartBoots_Legs.png b/Items/Armor/TitanHeartBoots_Legs.png new file mode 100644 index 0000000000..dbd89ea24a Binary files /dev/null and b/Items/Armor/TitanHeartBoots_Legs.png differ diff --git a/Items/Armor/TitanHeartMantle.cs b/Items/Armor/TitanHeartMantle.cs new file mode 100644 index 0000000000..6b90544891 --- /dev/null +++ b/Items/Armor/TitanHeartMantle.cs @@ -0,0 +1,44 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Body)] + public class TitanHeartMantle : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Titan Heart Mantle"); + Tooltip.SetDefault("45% chance to not consume rogue items\n" + + "5% boosted rogue knockback but 15% lowered rogue shoot speed"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 12, 0, 0); + item.rare = 5; + item.defense = 17; + } + + public override void UpdateEquip(Player player) + { + player.Calamity().titanHeartMantle = true; + player.Calamity().throwingAmmoCost55 = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 20); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/TitanHeartMantle.png b/Items/Armor/TitanHeartMantle.png new file mode 100644 index 0000000000..fa0b8a8c39 Binary files /dev/null and b/Items/Armor/TitanHeartMantle.png differ diff --git a/Items/Armor/TitanHeartMantle_Arms.png b/Items/Armor/TitanHeartMantle_Arms.png new file mode 100644 index 0000000000..871f504511 Binary files /dev/null and b/Items/Armor/TitanHeartMantle_Arms.png differ diff --git a/Items/Armor/TitanHeartMantle_Body.png b/Items/Armor/TitanHeartMantle_Body.png new file mode 100644 index 0000000000..2aeac92624 Binary files /dev/null and b/Items/Armor/TitanHeartMantle_Body.png differ diff --git a/Items/Armor/TitanHeartMask.cs b/Items/Armor/TitanHeartMask.cs new file mode 100644 index 0000000000..c427c49faf --- /dev/null +++ b/Items/Armor/TitanHeartMask.cs @@ -0,0 +1,66 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class TitanHeartMask : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Titan Heart Mask"); + Tooltip.SetDefault("5% increased rogue damage and knockback\n" + + "Rogue weapons spread the astral infection"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 12, 0, 0); + item.rare = 5; + item.defense = 12; //43 + } + + 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) + { + player.setBonus = "20% increased rogue damage and knockback\n" + + "Stealth strikes deal double knockback and cause an astral explosion\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"; + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.titanHeartSet = true; + modPlayer.throwingDamage += 0.2f; + modPlayer.rogueStealthMax += 1f; + modPlayer.wearingRogueArmor = true; + } + + public override void UpdateEquip(Player player) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.titanHeartMask = true; + modPlayer.throwingDamage += 0.05f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/TitanHeartMask.png b/Items/Armor/TitanHeartMask.png new file mode 100644 index 0000000000..2d29c5f4a3 Binary files /dev/null and b/Items/Armor/TitanHeartMask.png differ diff --git a/Items/Armor/TitanHeartMask_Head.png b/Items/Armor/TitanHeartMask_Head.png new file mode 100644 index 0000000000..0da57b829a Binary files /dev/null and b/Items/Armor/TitanHeartMask_Head.png differ diff --git a/Items/Armor/Vanity/AnahitaMask.cs b/Items/Armor/Vanity/AnahitaMask.cs new file mode 100644 index 0000000000..dbb1c899ec --- /dev/null +++ b/Items/Armor/Vanity/AnahitaMask.cs @@ -0,0 +1,22 @@ +using Terraria.ModLoader; +namespace CalamityMod.Items.Armor.Vanity +{ + [AutoloadEquip(EquipType.Head)] + public class AnahitaMask : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Anahita Mask"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + item.rare = 1; + item.vanity = true; + } + + public override bool DrawHead() => false; + } +} diff --git a/Items/Armor/Vanity/AnahitaMask.png b/Items/Armor/Vanity/AnahitaMask.png new file mode 100644 index 0000000000..ad122a30d9 Binary files /dev/null and b/Items/Armor/Vanity/AnahitaMask.png differ diff --git a/Items/Armor/Vanity/AnahitaMask_Head.png b/Items/Armor/Vanity/AnahitaMask_Head.png new file mode 100644 index 0000000000..9e9469605b Binary files /dev/null and b/Items/Armor/Vanity/AnahitaMask_Head.png differ diff --git a/Items/Armor/Vanity/LeviathanMask.png b/Items/Armor/Vanity/LeviathanMask.png index cc7e565bfc..8f9f7e506e 100644 Binary files a/Items/Armor/Vanity/LeviathanMask.png and b/Items/Armor/Vanity/LeviathanMask.png differ diff --git a/Items/Armor/Vanity/LeviathanMask_Head.png b/Items/Armor/Vanity/LeviathanMask_Head.png index 28b1546778..ce1b8bbeee 100644 Binary files a/Items/Armor/Vanity/LeviathanMask_Head.png and b/Items/Armor/Vanity/LeviathanMask_Head.png differ diff --git a/Items/Armor/VictideHelm.cs b/Items/Armor/VictideHelm.cs index 7d1d7582b0..786d277b0b 100644 --- a/Items/Armor/VictideHelm.cs +++ b/Items/Armor/VictideHelm.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Armor player.setBonus = "Increased life regen and melee damage while submerged in liquid\n" + "When using any weapon you have a 10% chance to throw a returning seashell projectile\n" + "This seashell does true damage and does not benefit from any damage class\n" + - "Slightly reduces breath loss in the abyss"; + "Provides increased underwater mobility and slightly reduces breath loss in the abyss"; CalamityPlayer modPlayer = player.Calamity(); modPlayer.victideSet = true; player.ignoreWater = true; diff --git a/Items/Armor/VictideHelmet.cs b/Items/Armor/VictideHelmet.cs index 8f8c1a1996..55b19a5e9c 100644 --- a/Items/Armor/VictideHelmet.cs +++ b/Items/Armor/VictideHelmet.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Armor "Summons a sea urchin to protect you\n" + "When using any weapon you have a 10% chance to throw a returning seashell projectile\n" + "This seashell does true damage and does not benefit from any damage class\n" + - "Slightly reduces breath loss in the abyss"; + "Provides increased underwater mobility and slightly reduces breath loss in the abyss"; CalamityPlayer modPlayer = player.Calamity(); modPlayer.victideSet = true; modPlayer.urchin = true; diff --git a/Items/Armor/VictideMask.cs b/Items/Armor/VictideMask.cs index 8cd1e26784..e1852913c2 100644 --- a/Items/Armor/VictideMask.cs +++ b/Items/Armor/VictideMask.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Armor player.setBonus = "Increased life regen and magic damage while submerged in liquid\n" + "When using any weapon you have a 10% chance to throw a returning seashell projectile\n" + "This seashell does true damage and does not benefit from any damage class\n" + - "Slightly reduces breath loss in the abyss"; + "Provides increased underwater mobility and slightly reduces breath loss in the abyss"; CalamityPlayer modPlayer = player.Calamity(); modPlayer.victideSet = true; player.ignoreWater = true; diff --git a/Items/Armor/VictideVisage.cs b/Items/Armor/VictideVisage.cs index 86641b1a04..98dc42a033 100644 --- a/Items/Armor/VictideVisage.cs +++ b/Items/Armor/VictideVisage.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Armor player.setBonus = "Increased life regen and ranged damage while submerged in liquid\n" + "When using any weapon you have a 10% chance to throw a returning seashell projectile\n" + "This seashell does true damage and does not benefit from any damage class\n" + - "Slightly reduces breath loss in the abyss"; + "Provides increased underwater mobility and slightly reduces breath loss in the abyss"; CalamityPlayer modPlayer = player.Calamity(); modPlayer.victideSet = true; player.ignoreWater = true; diff --git a/Items/Armor/WulfrumArmor.cs b/Items/Armor/WulfrumArmor.cs index 184f6f3e39..a310356c7a 100644 --- a/Items/Armor/WulfrumArmor.cs +++ b/Items/Armor/WulfrumArmor.cs @@ -32,6 +32,7 @@ namespace CalamityMod.Items.Armor { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 12); + recipe.AddIngredient(ModContent.ItemType()); recipe.AddTile(TileID.Anvils); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Armor/WulfrumArmor.png b/Items/Armor/WulfrumArmor.png index 6b588b347a..f99eacd3b0 100644 Binary files a/Items/Armor/WulfrumArmor.png and b/Items/Armor/WulfrumArmor.png differ diff --git a/Items/Armor/WulfrumArmor_Arms.png b/Items/Armor/WulfrumArmor_Arms.png index f4658bd88d..d746fc89f8 100644 Binary files a/Items/Armor/WulfrumArmor_Arms.png and b/Items/Armor/WulfrumArmor_Arms.png differ diff --git a/Items/Armor/WulfrumArmor_Body.png b/Items/Armor/WulfrumArmor_Body.png index 44e60bb227..0122566d95 100644 Binary files a/Items/Armor/WulfrumArmor_Body.png and b/Items/Armor/WulfrumArmor_Body.png differ diff --git a/Items/Armor/WulfrumArmor_FemaleBody.png b/Items/Armor/WulfrumArmor_FemaleBody.png index 44e60bb227..0122566d95 100644 Binary files a/Items/Armor/WulfrumArmor_FemaleBody.png and b/Items/Armor/WulfrumArmor_FemaleBody.png differ diff --git a/Items/Armor/WulfrumHeadgear.cs b/Items/Armor/WulfrumHeadgear.cs index 6cdfc216f8..9d4dabb104 100644 --- a/Items/Armor/WulfrumHeadgear.cs +++ b/Items/Armor/WulfrumHeadgear.cs @@ -48,6 +48,7 @@ namespace CalamityMod.Items.Armor { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddIngredient(ModContent.ItemType()); recipe.AddTile(TileID.Anvils); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Armor/WulfrumHeadgear.png b/Items/Armor/WulfrumHeadgear.png index 671c39b7f4..e6d08596e8 100644 Binary files a/Items/Armor/WulfrumHeadgear.png and b/Items/Armor/WulfrumHeadgear.png differ diff --git a/Items/Armor/WulfrumHeadgear_Head.png b/Items/Armor/WulfrumHeadgear_Head.png index 4ea3156130..cf9ef4f3ac 100644 Binary files a/Items/Armor/WulfrumHeadgear_Head.png and b/Items/Armor/WulfrumHeadgear_Head.png differ diff --git a/Items/Armor/WulfrumHelm.cs b/Items/Armor/WulfrumHelm.cs index 6282432f34..8aa0a192c9 100644 --- a/Items/Armor/WulfrumHelm.cs +++ b/Items/Armor/WulfrumHelm.cs @@ -48,6 +48,7 @@ namespace CalamityMod.Items.Armor { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddIngredient(ModContent.ItemType()); recipe.AddTile(TileID.Anvils); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Armor/WulfrumHelm.png b/Items/Armor/WulfrumHelm.png index 500b44d32a..b2611d63d1 100644 Binary files a/Items/Armor/WulfrumHelm.png and b/Items/Armor/WulfrumHelm.png differ diff --git a/Items/Armor/WulfrumHelm_Head.png b/Items/Armor/WulfrumHelm_Head.png index 1498d2b0be..9c56efc53a 100644 Binary files a/Items/Armor/WulfrumHelm_Head.png and b/Items/Armor/WulfrumHelm_Head.png differ diff --git a/Items/Armor/WulfrumHelmet.cs b/Items/Armor/WulfrumHelmet.cs index b5491ec39c..39e6910971 100644 --- a/Items/Armor/WulfrumHelmet.cs +++ b/Items/Armor/WulfrumHelmet.cs @@ -49,6 +49,7 @@ namespace CalamityMod.Items.Armor { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddIngredient(ModContent.ItemType()); recipe.AddTile(TileID.Anvils); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Armor/WulfrumHelmet.png b/Items/Armor/WulfrumHelmet.png index a531fdf4a6..e549a7c76e 100644 Binary files a/Items/Armor/WulfrumHelmet.png and b/Items/Armor/WulfrumHelmet.png differ diff --git a/Items/Armor/WulfrumHelmet_Head.png b/Items/Armor/WulfrumHelmet_Head.png index a62f01cf1d..50ce885f3f 100644 Binary files a/Items/Armor/WulfrumHelmet_Head.png and b/Items/Armor/WulfrumHelmet_Head.png differ diff --git a/Items/Armor/WulfrumHood.cs b/Items/Armor/WulfrumHood.cs index ae10a22c7e..830e20dfeb 100644 --- a/Items/Armor/WulfrumHood.cs +++ b/Items/Armor/WulfrumHood.cs @@ -48,6 +48,7 @@ namespace CalamityMod.Items.Armor { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddIngredient(ModContent.ItemType()); recipe.AddTile(TileID.Anvils); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Armor/WulfrumHood.png b/Items/Armor/WulfrumHood.png index 73ea374b5a..82655fd91e 100644 Binary files a/Items/Armor/WulfrumHood.png and b/Items/Armor/WulfrumHood.png differ diff --git a/Items/Armor/WulfrumHood_Head.png b/Items/Armor/WulfrumHood_Head.png index dc5bcd550e..6b273ef5e1 100644 Binary files a/Items/Armor/WulfrumHood_Head.png and b/Items/Armor/WulfrumHood_Head.png differ diff --git a/Items/Armor/WulfrumLeggings.cs b/Items/Armor/WulfrumLeggings.cs index b769ea91a3..bf591c7ff6 100644 --- a/Items/Armor/WulfrumLeggings.cs +++ b/Items/Armor/WulfrumLeggings.cs @@ -32,6 +32,7 @@ namespace CalamityMod.Items.Armor { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 8); + recipe.AddIngredient(ModContent.ItemType()); recipe.AddTile(TileID.Anvils); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Armor/WulfrumLeggings.png b/Items/Armor/WulfrumLeggings.png index 6ed06d8882..ba9f776ea1 100644 Binary files a/Items/Armor/WulfrumLeggings.png and b/Items/Armor/WulfrumLeggings.png differ diff --git a/Items/Armor/WulfrumLeggings_Legs.png b/Items/Armor/WulfrumLeggings_Legs.png index 56268cf5de..9b96d20767 100644 Binary files a/Items/Armor/WulfrumLeggings_Legs.png and b/Items/Armor/WulfrumLeggings_Legs.png differ diff --git a/Items/Armor/WulfrumMask.cs b/Items/Armor/WulfrumMask.cs index 75e87db6d0..518a9ec763 100644 --- a/Items/Armor/WulfrumMask.cs +++ b/Items/Armor/WulfrumMask.cs @@ -56,6 +56,7 @@ namespace CalamityMod.Items.Armor { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddIngredient(ModContent.ItemType()); recipe.AddTile(TileID.Anvils); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Armor/WulfrumMask.png b/Items/Armor/WulfrumMask.png index 81852ac847..07edc75dce 100644 Binary files a/Items/Armor/WulfrumMask.png and b/Items/Armor/WulfrumMask.png differ diff --git a/Items/Armor/WulfrumMask_Head.png b/Items/Armor/WulfrumMask_Head.png index 77d7eabf9f..56756bdf03 100644 Binary files a/Items/Armor/WulfrumMask_Head.png and b/Items/Armor/WulfrumMask_Head.png differ diff --git a/Items/Armor/XerocCuisses.cs b/Items/Armor/XerocCuisses.cs index 7d20d317bd..6a568d2d42 100644 --- a/Items/Armor/XerocCuisses.cs +++ b/Items/Armor/XerocCuisses.cs @@ -10,10 +10,10 @@ namespace CalamityMod.Items.Armor { public override void SetStaticDefaults() { - DisplayName.SetDefault("Xeroc Cuisses"); - Tooltip.SetDefault("5% increased rogue damage and critical strike chance\n" + - "20% increased movement speed\n" + - "Speed of the cosmos"); + DisplayName.SetDefault("Empyrean Cuisses"); + Tooltip.SetDefault("Speed of the cosmos\n" + + "5% increased rogue damage and critical strike chance\n" + + "20% increased movement speed"); } public override void SetDefaults() diff --git a/Items/Armor/XerocCuisses.png b/Items/Armor/XerocCuisses.png index b2a9795649..86af5c1d75 100644 Binary files a/Items/Armor/XerocCuisses.png and b/Items/Armor/XerocCuisses.png differ diff --git a/Items/Armor/XerocCuisses_Legs.png b/Items/Armor/XerocCuisses_Legs.png index 38062343b0..9128b5898c 100644 Binary files a/Items/Armor/XerocCuisses_Legs.png and b/Items/Armor/XerocCuisses_Legs.png differ diff --git a/Items/Armor/XerocMask.cs b/Items/Armor/XerocMask.cs index 679aa57301..15e13c5c86 100644 --- a/Items/Armor/XerocMask.cs +++ b/Items/Armor/XerocMask.cs @@ -1,5 +1,7 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.World; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,11 +13,10 @@ namespace CalamityMod.Items.Armor { public override void SetStaticDefaults() { - DisplayName.SetDefault("Xeroc Mask"); - Tooltip.SetDefault("11% increased rogue damage and critical strike chance, 22% increased movement speed\n" + - "Temporary immunity to lava and immunity to cursed, fire, cursed inferno, and chilled\n" + - "Provides heat protection in Death Mode\n" + - "Wrath of the cosmos"); + DisplayName.SetDefault("Empyrean Mask"); + Tooltip.SetDefault("Wrath of the cosmos\n" + + "11% increased rogue damage and critical strike chance, 22% increased movement speed\n" + + "Temporary immunity to lava"); } public override void SetDefaults() @@ -27,6 +28,21 @@ namespace CalamityMod.Items.Armor item.defense = 20; //71 } + public override void ModifyTooltips(List list) + { + if (CalamityWorld.death) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip2") + { + line2.text = "Temporary immunity to lava\n" + + "Provides heat protection in Death Mode"; + } + } + } + } + public override bool IsArmorSet(Item head, Item body, Item legs) { return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); @@ -36,6 +52,8 @@ namespace CalamityMod.Items.Armor { player.armorEffectDrawShadow = true; player.armorEffectDrawOutlines = true; + player.Calamity().meldTransformation = true; + player.Calamity().meldTransformationForce = true; } public override void UpdateArmorSet(Player player) @@ -50,7 +68,7 @@ namespace CalamityMod.Items.Armor "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"; - if (player.statLife <= (int)((double)player.statLifeMax2 * 0.5)) + if (player.statLife <= (int)(player.statLifeMax2 * 0.5)) { player.AddBuff(BuffID.Wrath, 2); player.AddBuff(BuffID.Rage, 2); @@ -66,10 +84,6 @@ namespace CalamityMod.Items.Armor player.Calamity().throwingCrit += 11; player.moveSpeed += 0.22f; player.lavaMax += 240; - player.buffImmune[BuffID.OnFire] = true; - player.buffImmune[BuffID.CursedInferno] = true; - player.buffImmune[BuffID.Cursed] = true; - player.buffImmune[BuffID.Chilled] = true; } public override void AddRecipes() @@ -82,4 +96,28 @@ namespace CalamityMod.Items.Armor recipe.AddRecipe(); } } + + public class MeldTransformationHead : EquipTexture + { + public override bool DrawHead() + { + return false; + } + } + + public class MeldTransformationBody : EquipTexture + { + public override bool DrawBody() + { + return false; + } + } + + public class MeldTransformationLegs : EquipTexture + { + public override bool DrawLegs() + { + return false; + } + } } diff --git a/Items/Armor/XerocMask.png b/Items/Armor/XerocMask.png index 7fc3160e93..47578c6049 100644 Binary files a/Items/Armor/XerocMask.png and b/Items/Armor/XerocMask.png differ diff --git a/Items/Armor/XerocMask_Head.png b/Items/Armor/XerocMask_Head.png index b7555ffc81..04e8bb52e5 100644 Binary files a/Items/Armor/XerocMask_Head.png and b/Items/Armor/XerocMask_Head.png differ diff --git a/Items/Armor/XerocPlateMail.cs b/Items/Armor/XerocPlateMail.cs index 3d439a6533..93da93177a 100644 --- a/Items/Armor/XerocPlateMail.cs +++ b/Items/Armor/XerocPlateMail.cs @@ -10,11 +10,11 @@ namespace CalamityMod.Items.Armor { public override void SetStaticDefaults() { - DisplayName.SetDefault("Xeroc Plate Mail"); - Tooltip.SetDefault("+20 max life\n" + + DisplayName.SetDefault("Empyrean Cloak"); + Tooltip.SetDefault("Armor of the cosmos\n" + + "+20 max life\n" + "6% increased movement speed\n" + - "7% increased rogue damage and critical strike chance\n" + - "Armor of the cosmos"); + "7% increased rogue damage and critical strike chance"); } public override void SetDefaults() diff --git a/Items/Armor/XerocPlateMail.png b/Items/Armor/XerocPlateMail.png index df27234edb..6fecf62e4a 100644 Binary files a/Items/Armor/XerocPlateMail.png and b/Items/Armor/XerocPlateMail.png differ diff --git a/Items/Armor/XerocPlateMail_Arms.png b/Items/Armor/XerocPlateMail_Arms.png index bba2164400..dc99ae730b 100644 Binary files a/Items/Armor/XerocPlateMail_Arms.png and b/Items/Armor/XerocPlateMail_Arms.png differ diff --git a/Items/Armor/XerocPlateMail_Body.png b/Items/Armor/XerocPlateMail_Body.png index 6fe45adf32..4b6581a9cb 100644 Binary files a/Items/Armor/XerocPlateMail_Body.png and b/Items/Armor/XerocPlateMail_Body.png differ diff --git a/Items/Armor/XerocPlateMail_FemaleBody.png b/Items/Armor/XerocPlateMail_FemaleBody.png deleted file mode 100644 index 6fe45adf32..0000000000 Binary files a/Items/Armor/XerocPlateMail_FemaleBody.png and /dev/null differ diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index 52ee2ba370..001d63e635 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -21,6 +21,7 @@ using CalamityMod.Projectiles.Ranged; using CalamityMod.Projectiles.Rogue; using CalamityMod.Projectiles.Summon; using CalamityMod.Projectiles.Typeless; +using CalamityMod.UI; using CalamityMod.World; using Microsoft.Xna.Framework; using System; @@ -31,7 +32,6 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.IO; -using Terraria.Utilities; namespace CalamityMod.Items { @@ -60,8 +60,15 @@ namespace CalamityMod.Items public int timesUsed = 0; - // Rarity is provided both as the classic int and the new enum. - public CalamityRarity customRarity = CalamityRarity.NoEffect; + // The damage modifications for the item are handled in player files. + public int CurrentCharge; + public bool Chargeable = false; + public int ChargeMax; + public const float ChargeDamageMinMultiplier = 0.75f; + public const float ChargeDamageReductionThreshold = 0.75f; + + // Rarity is provided both as the classic int and the new enum. + public CalamityRarity customRarity = CalamityRarity.NoEffect; public int postMoonLordRarity { get => (int)customRarity; @@ -92,6 +99,7 @@ namespace CalamityMod.Items #region SetDefaults public override void SetDefaults(Item item) { + item.Calamity().ChargeMax = ChargeMax; if (customRarity.IsPostML() && item.rare != 10) item.rare = 10; @@ -155,12 +163,12 @@ namespace CalamityMod.Items item.defense = 41; //7 more defense else if (item.type == ItemID.SolarFlareLeggings) item.defense = 24; //4 more defense - else if (item.type == ItemID.GladiatorHelmet) //total defense pre-buff = 7 post-buff = 21 - item.defense = 4; //2 more defense + else if (item.type == ItemID.GladiatorHelmet) //total defense pre-buff = 7 post-buff = 15 + item.defense = 3; //1 more defense else if (item.type == ItemID.GladiatorBreastplate) - item.defense = 7; //4 more defense + item.defense = 5; //2 more defense else if (item.type == ItemID.GladiatorLeggings) - item.defense = 5; //3 more defense + item.defense = 4; //2 more defense else if (item.type == ItemID.HallowedPlateMail) //total defense pre-buff = 31, 50, 35 post-buff = 36, 55, 40 item.defense = 18; //3 more defense else if (item.type == ItemID.HallowedGreaves) @@ -212,6 +220,10 @@ namespace CalamityMod.Items #region Shoot public override bool Shoot(Item item, Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { + if (item.type >= ItemID.Count && item.Calamity().Chargeable && item.Calamity().CurrentCharge > 0 && Main.rand.NextBool(120 / (int)MathHelper.Max(1, item.useAnimation))) + { + CurrentCharge--; + } CalamityPlayer modPlayer = player.Calamity(); if (rogue) { @@ -232,7 +244,7 @@ namespace CalamityMod.Items if (item.useTime < 10) damageMult -= (double)(10 - item.useTime) / 10.0; - double newDamage = (double)damage * damageMult; + double newDamage = damage * damageMult; if (player.whoAmI == Main.myPlayer) { @@ -240,19 +252,19 @@ namespace CalamityMod.Items Projectile.NewProjectile(position.X, position.Y, speedX * 0.5f, speedY * 0.5f, ModContent.ProjectileType(), (int)(newDamage * 0.6), 0f, player.whoAmI, 0f, 0f); else if (rogue) - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), (int)(newDamage * 0.5), 0f, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), (int)(newDamage * 0.5), 0f, player.whoAmI, 0f, 0f); else if (item.ranged) Projectile.NewProjectile(position.X, position.Y, speedX * 1.5f, speedY * 1.5f, ModContent.ProjectileType(), (int)(newDamage * 0.4), 0f, player.whoAmI, 0f, 0f); else if (item.magic) - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), (int)(newDamage * 0.8), 0f, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), (int)(newDamage * 0.8), 0f, player.whoAmI, 0f, 0f); else if (item.summon && player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) - Projectile.NewProjectile(position.X, position.Y, 0f, 0f, ModContent.ProjectileType(), damage, 0f, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, player.whoAmI, 0f, 0f); } } - if (modPlayer.eArtifact && item.ranged && !rogue) + if (modPlayer.eArtifact && item.ranged) { speedX *= 1.25f; speedY *= 1.25f; @@ -263,17 +275,17 @@ namespace CalamityMod.Items { if (player.whoAmI == Main.myPlayer) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), (int)(damage * (modPlayer.auricSet ? 4.2 : 2.6)), 1f, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), (int)(damage * (modPlayer.auricSet ? 4.2 : 2.6)), 1f, player.whoAmI, 0f, 0f); } } } if (modPlayer.bloodflareRanged) //0 - 99 { - if (item.ranged && !rogue && Main.rand.Next(0, 100) >= 98) + if (item.ranged && Main.rand.Next(0, 100) >= 98) { if (player.whoAmI == Main.myPlayer) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), (int)(damage * (modPlayer.auricSet ? 2.2 : 1.6)), 2f, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), (int)(damage * (modPlayer.auricSet ? 2.2 : 1.6)), 2f, player.whoAmI, 0f, 0f); } } } @@ -298,7 +310,7 @@ namespace CalamityMod.Items } if (modPlayer.ataxiaBolt) { - if (item.ranged && !rogue && Main.rand.NextBool(2)) + if (item.ranged && Main.rand.NextBool(2)) { if (player.whoAmI == Main.myPlayer) { @@ -308,7 +320,7 @@ namespace CalamityMod.Items } if (modPlayer.godSlayerRanged) //0 - 99 { - if (item.ranged && !rogue && Main.rand.Next(0, 100) >= 95) + if (item.ranged && Main.rand.Next(0, 100) >= 95) { if (player.whoAmI == Main.myPlayer) { @@ -340,7 +352,7 @@ namespace CalamityMod.Items } if (modPlayer.reaverDoubleTap) //0 - 99 { - if (item.ranged && !rogue && Main.rand.Next(0, 100) >= 90) + if (item.ranged && Main.rand.Next(0, 100) >= 90) { if (player.whoAmI == Main.myPlayer) { @@ -350,8 +362,7 @@ namespace CalamityMod.Items } if (modPlayer.victideSet) { - if ((item.ranged || item.melee || item.magic || - rogue || item.summon) && item.rare < 8 && Main.rand.NextBool(10)) + if ((item.ranged || item.melee || item.magic || item.thrown || rogue || item.summon) && item.rare < ItemRarityID.Yellow && Main.rand.NextBool(10)) { if (player.whoAmI == Main.myPlayer) { @@ -361,10 +372,9 @@ namespace CalamityMod.Items } if (modPlayer.dynamoStemCells) { - if (item.ranged && !rogue && Main.rand.Next(0, 100) >= 80) + if (item.ranged && Main.rand.Next(0, 100) >= 80) { - double damageMult = 1.0; - damageMult = (double)(item.useTime) / 30; + double damageMult = item.useTime / 30D; if (damageMult < 0.35) damageMult = 0.35; @@ -378,7 +388,7 @@ namespace CalamityMod.Items } if (modPlayer.prismaticRegalia) //0 - 99 { - if (item.magic && Main.rand.Next(0, 100) >= 90) + if (item.magic && Main.rand.Next(0, 100) >= 95) { if (player.whoAmI == Main.myPlayer) { @@ -387,7 +397,8 @@ namespace CalamityMod.Items if (i != 0) { Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.ToRadians(i)); - Projectile.NewProjectile(position.X, position.Y, perturbedSpeed.X, perturbedSpeed.Y, ModContent.ProjectileType(), (int)(damage * 1.3), 2f, player.whoAmI, 0f, 0f); + int rocket = Projectile.NewProjectile(position.X, position.Y, perturbedSpeed.X, perturbedSpeed.Y, ModContent.ProjectileType(), (int)(damage * 0.8), 2f, player.whoAmI, 0f, 0f); + Main.projectile[rocket].Calamity().forceTypeless = true; } } } @@ -431,7 +442,7 @@ namespace CalamityMod.Items for (int i = -8; i <= 8; i += 8) { Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.ToRadians(i)); - Projectile.NewProjectile(position.X, position.Y, perturbedSpeed.X, perturbedSpeed.Y, ModContent.ProjectileType(), damage, 0f, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position, perturbedSpeed, ModContent.ProjectileType(), damage, 0f, player.whoAmI, 0f, 0f); } } return true; @@ -448,15 +459,10 @@ namespace CalamityMod.Items { return new TagCompound { - { - "rogue", rogue - }, - { - "timesUsed", timesUsed - }, - { - "rarity", (int)customRarity - } + ["rogue"] = rogue, + ["timesUsed"] = timesUsed, + ["rarity"] = (int)customRarity, + ["Charge"] = CurrentCharge }; } @@ -465,6 +471,7 @@ namespace CalamityMod.Items rogue = tag.GetBool("rogue"); timesUsed = tag.GetInt("timesUsed"); customRarity = (CalamityRarity)tag.GetInt("rarity"); + CurrentCharge = tag.GetInt("Charge"); } public override void LoadLegacy(Item item, BinaryReader reader) @@ -472,6 +479,7 @@ namespace CalamityMod.Items int loadVersion = reader.ReadInt32(); customRarity = (CalamityRarity)reader.ReadInt32(); timesUsed = reader.ReadInt32(); + CurrentCharge = reader.ReadInt32(); if (loadVersion == 0) { @@ -492,6 +500,7 @@ namespace CalamityMod.Items writer.Write(flags); writer.Write((int)customRarity); writer.Write(timesUsed); + writer.Write(CurrentCharge); } public override void NetReceive(Item item, BinaryReader reader) @@ -501,6 +510,7 @@ namespace CalamityMod.Items customRarity = (CalamityRarity)reader.ReadInt32(); timesUsed = reader.ReadInt32(); + CurrentCharge = reader.ReadInt32(); } #endregion @@ -868,6 +878,11 @@ namespace CalamityMod.Items public override bool CanUseItem(Item item, Player player) { CalamityPlayer modPlayer = player.Calamity(); + + // Restrict behavior when reading Dreadon's Log. + if (PopupGUIManager.AnyGUIsActive) + return false; + if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0 && (item.damage > 0 || item.ammo != AmmoID.None)) { @@ -880,16 +895,17 @@ namespace CalamityMod.Items return false; } - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0 && - item.pick == 0 && item.axe == 0 && item.hammer == 0 && item.autoReuse && (item.Calamity().rogue || item.magic || item.ranged || item.melee)) + if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) { - if (player.altFunctionUse == 0) + if (item.type == ItemID.WireKite) + return false; + if (item.pick > 0 && item.axe > 0 && item.hammer > 0) + return false; + if (item.Calamity().rogue || item.magic || item.ranged || item.melee) { - return PerformAndromedaAttacks(item, player); - } - else - { - return AltFunctionUse(item, player); + if (player.altFunctionUse == 0) + return PerformAndromedaAttacks(item, player); + else return false; } } @@ -986,6 +1002,20 @@ namespace CalamityMod.Items } #endregion + #region Modify Weapon Damage + public override void ModifyWeaponDamage(Item item, Player player, ref float add, ref float mult, ref float flat) + { + if (item.Calamity().Chargeable) + { + float chargeDamageMultiplier = 1f; + float chargeRatio = item.Calamity().CurrentCharge / (float)ChargeMax; + if (chargeRatio < ChargeDamageReductionThreshold) + chargeDamageMultiplier = MathHelper.Lerp(ChargeDamageMinMultiplier, 1f, chargeRatio * ChargeDamageReductionThreshold); + mult *= chargeDamageMultiplier; + } + } + #endregion + #region Modify Tooltips public override void ModifyTooltips(Item item, List tooltips) { @@ -1038,6 +1068,9 @@ namespace CalamityMod.Items case CalamityRarity.Rainbow: tt2.overrideColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); break; + case CalamityRarity.DraedonRust: + tt2.overrideColor = new Color(204, 71, 35); + break; case CalamityRarity.RareVariant: tt2.overrideColor = new Color(255, 140, 0); break; @@ -1129,9 +1162,9 @@ namespace CalamityMod.Items } } } - #endregion + #endregion - /*if (item.ammo == 97) + /*if (item.ammo == 97) { foreach (TooltipLine line2 in tooltips) { @@ -1143,14 +1176,13 @@ namespace CalamityMod.Items } }*/ - if (item.type == ItemID.RodofDiscord) + if (item.type == ItemID.RodofDiscord) { foreach (TooltipLine line2 in tooltips) { if (line2.mod == "Terraria" && line2.Name == "Tooltip0") { - line2.text = "Teleports you to the position of the mouse\n" + - "Teleportation is disabled while Chaos State is active"; + line2.text += "\nTeleportation is disabled while Chaos State is active"; } } } @@ -1160,8 +1192,7 @@ namespace CalamityMod.Items { if (line2.mod == "Terraria" && line2.Name == "Tooltip0") { - line2.text = "Capable of soaking up an endless amount of water\n" + - "Cannot be used in the Abyss"; + line2.text += "\nCannot be used in the Abyss"; } } } @@ -1171,8 +1202,7 @@ namespace CalamityMod.Items { if (line2.mod == "Terraria" && line2.Name == "Defense") { - line2.text = "1 defense\n" + - "Cannot be used in the Abyss"; + line2.text += "\nCannot be used in the Abyss"; } } } @@ -1182,8 +1212,7 @@ namespace CalamityMod.Items { if (line2.mod == "Terraria" && line2.Name == "Tooltip0") { - line2.text = "Summons a heart to provide light\n" + - "Provides a small amount of light in the abyss"; + line2.text += "\nProvides a small amount of light in the abyss"; } } } @@ -1193,8 +1222,7 @@ namespace CalamityMod.Items { if (line2.mod == "Terraria" && line2.Name == "Tooltip0") { - line2.text = "Creates a magical shadow orb\n" + - "Provides a small amount of light in the abyss"; + line2.text += "\nProvides a small amount of light in the abyss"; } } } @@ -1204,8 +1232,7 @@ namespace CalamityMod.Items { if (line2.mod == "Terraria" && line2.Name == "Tooltip0") { - line2.text = "Summons a magic lantern that exposes nearby treasure\n" + - "Provides a small amount of light in the abyss"; + line2.text += "\nProvides a small amount of light in the abyss"; } } } @@ -1215,8 +1242,7 @@ namespace CalamityMod.Items { if (line2.mod == "Terraria" && line2.Name == "Tooltip1") { - line2.text = "Provides light under water and extra mobility on ice\n" + - "Provides a small amount of light in the abyss\n" + + line2.text += "\nProvides a small amount of light in the abyss\n" + "Moderately reduces breath loss in the abyss"; } } @@ -1227,8 +1253,7 @@ namespace CalamityMod.Items { if (line2.mod == "Terraria" && line2.Name == "Tooltip0") { - line2.text = "Provides light under water\n" + - "Provides a small amount of light in the abyss"; + line2.text += "\nProvides a small amount of light in the abyss"; } } } @@ -1238,8 +1263,7 @@ namespace CalamityMod.Items { if (line2.mod == "Terraria" && line2.Name == "Tooltip1") { - line2.text = "Provides light under water\n" + - "Provides a small amount of light in the abyss"; + line2.text += "\nProvides a small amount of light in the abyss"; } } } @@ -1249,8 +1273,7 @@ namespace CalamityMod.Items { if (line2.mod == "Terraria" && line2.Name == "Tooltip0") { - line2.text = "Summons a magical fairy\n" + - "Provides a moderate amount of light in the abyss"; + line2.text += "\nProvides a moderate amount of light in the abyss"; } } } @@ -1260,8 +1283,7 @@ namespace CalamityMod.Items { if (line2.mod == "Terraria" && line2.Name == "Tooltip0") { - line2.text = "Summons a pet flickerwick to provide light\n" + - "Provides a moderate amount of light in the abyss"; + line2.text += "\nProvides a moderate amount of light in the abyss"; } } } @@ -1271,8 +1293,7 @@ namespace CalamityMod.Items { if (line2.mod == "Terraria" && line2.Name == "BuffTime") { - line2.text = "5 minute duration\n" + - "Provides a moderate amount of light in the abyss"; + line2.text += "\nProvides a moderate amount of light in the abyss"; } } } @@ -1282,8 +1303,7 @@ namespace CalamityMod.Items { if (line2.mod == "Terraria" && line2.Name == "Tooltip0") { - line2.text = "Summons a Wisp to provide light\n" + - "Provides a large amount of light in the abyss"; + line2.text += "\nProvides a large amount of light in the abyss"; } } } @@ -1293,8 +1313,7 @@ namespace CalamityMod.Items { if (line2.mod == "Terraria" && line2.Name == "Tooltip1") { - line2.text = "'I know what you're thinking...'\n" + - "Provides a large amount of light in the abyss"; + line2.text += "\nProvides a large amount of light in the abyss"; } } } @@ -1304,8 +1323,7 @@ namespace CalamityMod.Items { if (line2.mod == "Terraria" && line2.Name == "BuffTime") { - line2.text = "2 minute duration\n" + - "Greatly reduces breath loss in the abyss"; + line2.text += "\nGreatly reduces breath loss in the abyss"; } } } @@ -1315,30 +1333,17 @@ namespace CalamityMod.Items { if (line2.mod == "Terraria" && line2.Name == "Tooltip0") { - line2.text = "Greatly extends underwater breathing\n" + - "Moderately reduces breath loss in the abyss"; + line2.text += "\nModerately reduces breath loss in the abyss"; } } } - if (item.type == ItemID.NeptunesShell) + if (item.type == ItemID.NeptunesShell || item.type == ItemID.MoonShell) { foreach (TooltipLine line2 in tooltips) { if (line2.mod == "Terraria" && line2.Name == "Tooltip0") { - line2.text = "Transforms the holder into merfolk when entering water\n" + - "Greatly reduces breath loss in the abyss"; - } - } - } - if (item.type == ItemID.MoonShell) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Turns the holder into a werewolf at night and a merfolk when entering water\n" + - "Greatly reduces breath loss in the abyss"; + line2.text += "\nGreatly reduces breath loss in the abyss"; } } } @@ -1348,22 +1353,33 @@ namespace CalamityMod.Items { if (line2.mod == "Terraria" && line2.Name == "Tooltip1") { - line2.text = "Minor increases to all stats\n" + - "Greatly reduces breath loss in the abyss"; + line2.text += "\nGreatly reduces breath loss in the abyss"; } } } if (item.type == ItemID.WarmthPotion) { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Reduces damage from cold sources\n" + - "Makes you immune to the Chilled, Frozen, and Glacial State debuffs\n" + - "Provides cold protection in Death Mode"; - } - } + if (CalamityWorld.death) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text += "\nMakes you immune to the Chilled, Frozen, and Glacial State debuffs\n" + + "Provides cold protection in Death Mode"; + } + } + } + else + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text += "\nMakes you immune to the Chilled, Frozen, and Glacial State debuffs"; + } + } + } } if (item.type == ItemID.FlaskofVenom) { @@ -1455,16 +1471,61 @@ namespace CalamityMod.Items } } } - if (item.type == ItemID.FireGauntlet) + if (item.type == ItemID.TitanGlove) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text += "\n10% increased true melee damage"; + } + } + } + if (item.type == ItemID.PowerGlove) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip1") + { + line2.text += "\n10% increased true melee damage"; + } + } + } + if (item.type == ItemID.MechanicalGlove) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip1") + { + line2.text += "\n10% increased true melee damage"; + } + } + } + if (item.type == ItemID.FireGauntlet) { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip1") - { - line2.text = "14% increased melee damage and speed\n" + - "Provides heat and cold protection in Death Mode"; - } - } + if (CalamityWorld.death) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip1") + { + line2.text = "14% increased melee damage and speed\n" + + "10% increased true melee damage\n" + + "Provides heat and cold protection in Death Mode"; + } + } + } + else + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip1") + { + line2.text = "14% increased melee damage and speed\n" + + "10% increased true melee damage"; + } + } + } } if (item.type == ItemID.SpectreHood) { @@ -1478,59 +1539,85 @@ namespace CalamityMod.Items } if (item.type == ItemID.ObsidianSkinPotion) { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Provides immunity to direct damage from touching lava\n" + - "Provides temporary immunity to lava burn damage\n" + - "Reduces lava burn damage\n" + - "Provides heat protection in Death Mode"; - } - } + if (CalamityWorld.death) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Provides immunity to direct damage from touching lava\n" + + "Provides temporary immunity to lava burn damage\n" + + "Reduces lava burn damage\n" + + "Provides heat protection in Death Mode"; + } + } + } + else + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Provides immunity to direct damage from touching lava\n" + + "Provides temporary immunity to lava burn damage\n" + + "Reduces lava burn damage"; + } + } + } } if (item.type == ItemID.ObsidianRose) { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Reduced direct damage from touching lava\n" + - "Greatly reduces lava burn damage\n" + - "Provides heat protection in Death Mode"; - } - } + if (CalamityWorld.death) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Reduced direct damage from touching lava\n" + + "Greatly reduces lava burn damage\n" + + "Provides heat protection in Death Mode"; + } + } + } + else + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Reduced direct damage from touching lava\n" + + "Greatly reduces lava burn damage"; + } + } + } } - if (item.type == ItemID.MagmaStone) + if (item.type == ItemID.MagmaStone && CalamityWorld.death) { foreach (TooltipLine line2 in tooltips) { if (line2.mod == "Terraria" && line2.Name == "Tooltip0") { - line2.text = "Inflicts fire damage on attack\n" + - "Provides heat and cold protection in Death Mode"; + line2.text += "\nProvides heat and cold protection in Death Mode"; } } } - if (item.type == ItemID.LavaCharm) + if (item.type == ItemID.LavaCharm && CalamityWorld.death) { foreach (TooltipLine line2 in tooltips) { if (line2.mod == "Terraria" && line2.Name == "Tooltip0") { - line2.text = "Provides 7 seconds of immunity to lava\n" + - "Provides heat protection in Death Mode"; + line2.text += "\nProvides heat protection in Death Mode"; } } } - if (item.type == ItemID.LavaWaders) + if (item.type == ItemID.LavaWaders && CalamityWorld.death) { foreach (TooltipLine line2 in tooltips) { if (line2.mod == "Terraria" && line2.Name == "Tooltip1") { - line2.text = "Grants immunity to fire blocks and 7 seconds of immunity to lava\n" + - "Provides heat protection in Death Mode"; + line2.text += "\nProvides heat protection in Death Mode"; } } } @@ -1540,8 +1627,7 @@ namespace CalamityMod.Items { if (line2.mod == "Terraria" && line2.Name == "Tooltip0") { - line2.text = "Grants invisibility\n" + - "Boosts certain stats when holding certain types of rogue weapons"; + line2.text += "\nBoosts certain stats when holding certain types of rogue weapons"; } } } @@ -1562,8 +1648,8 @@ namespace CalamityMod.Items { if (line2.mod == "Terraria" && line2.Name == "Tooltip0") { - line2.text = "Capable of mining Lihzahrd Bricks\n" + - "Also capable of mining Scoria Ore found in the Abyss"; + // I'm leaving this intentionally ambiguous so that people have to search for Scoria Ore + line2.text = "Capable of mining Lihzahrd Bricks and Scoria Ore"; } } } @@ -1611,7 +1697,23 @@ namespace CalamityMod.Items } } } - if (item.type == ItemID.MeteorHelmet || item.type == ItemID.MeteorSuit || item.type == ItemID.MeteorLeggings) + + if (Main.player[Main.myPlayer].Calamity().trueMeleeDamage > 0D) + { + if (item.melee && item.damage > 0) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Damage") + { + line2.text += " : " + string.Concat((int)(Main.player[Main.myPlayer].Calamity().actualMeleeDamageStat * item.damage * + (1D + Main.player[Main.myPlayer].Calamity().trueMeleeDamage) + 5E-06f)) + " true melee damage"; + } + } + } + } + + if (item.type == ItemID.MeteorHelmet || item.type == ItemID.MeteorSuit || item.type == ItemID.MeteorLeggings) { foreach (TooltipLine line2 in tooltips) { @@ -1701,7 +1803,7 @@ namespace CalamityMod.Items } } } - if (item.type == ItemID.AncientBattleArmorHat || item.type == ItemID.AncientBattleArmorShirt || item.type == ItemID.AncientBattleArmorPants) + if (item.type == ItemID.AncientBattleArmorHat || item.type == ItemID.AncientBattleArmorShirt || item.type == ItemID.AncientBattleArmorPants) { if (!Main.player[Main.myPlayer].Calamity().forbiddenCirclet) { @@ -1709,8 +1811,7 @@ namespace CalamityMod.Items { if (line2.mod == "Terraria" && line2.Name == "SetBonus") { - line2.text = "Set Bonus: Double tap " + (Main.ReversedUpDownArmorSetBonuses ? "UP" : "DOWN") + " to call an ancient storm to the cursor location\n" + - "Minions deal full damage while wielding magic weapons"; + line2.text += "\nThe minion damage nerf is reduced while wielding magic weapons"; } } } @@ -1721,7 +1822,7 @@ namespace CalamityMod.Items { if (line2.mod == "Terraria" && line2.Name == "Defense") { - line2.text = "4 defense\n" + + line2.text = "3 defense\n" + "3% increased rogue damage"; } } @@ -1732,7 +1833,7 @@ namespace CalamityMod.Items { if (line2.mod == "Terraria" && line2.Name == "Defense") { - line2.text = "7 defense\n" + + line2.text = "5 defense\n" + "3% increased rogue critical strike chance"; } } @@ -1743,7 +1844,7 @@ namespace CalamityMod.Items { if (line2.mod == "Terraria" && line2.Name == "Defense") { - line2.text = "5 defense\n" + + line2.text = "4 defense\n" + "3% increased rogue velocity"; } } @@ -1781,28 +1882,46 @@ namespace CalamityMod.Items } } } - if (item.type == ItemID.MoltenHelmet || item.type == ItemID.MoltenBreastplate || item.type == ItemID.MoltenGreaves) + if (item.type == ItemID.MoltenHelmet || item.type == ItemID.MoltenBreastplate || item.type == ItemID.MoltenGreaves) { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "SetBonus") - { - line2.text = @"Set Bonus: 17% extra melee damage + if (CalamityWorld.death) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "SetBonus") + { + line2.text = @"Set Bonus: 17% extra melee damage +20% extra true melee damage Grants immunity to fire blocks, and temporary immunity to lava Provides heat and cold protection in Death Mode"; - } + } + } + } + else + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "SetBonus") + { + line2.text = @"Set Bonus: 17% extra melee damage +20% extra true melee damage +Grants immunity to fire blocks, and temporary immunity to lava"; + } + } } } if (item.type == ItemID.FrostHelmet || item.type == ItemID.FrostBreastplate || item.type == ItemID.FrostLeggings) { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "SetBonus") - { - line2.text = @"Set Bonus: Melee and ranged attacks cause frostburn -Provides heat and cold protection in Death Mode"; - } - } + if (CalamityWorld.death) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "SetBonus") + { + line2.text += "\nProvides heat and cold protection in Death Mode"; + } + } + } } if (item.type == ItemID.MagicQuiver) { @@ -2038,7 +2157,7 @@ Provides heat and cold protection in Death Mode"; "Flight time: 100\n" + "Gills effect and you can move freely through liquids\n" + "You fall faster while submerged in liquid\n" + - "20% increased movement speed and 180% increased jump speed"; + "20% increased movement speed and 36% increased jump speed"; } } } @@ -2067,8 +2186,8 @@ Provides heat and cold protection in Death Mode"; "Acceleration multiplier: 1\n" + "Average vertical speed\n" + "Flight time: 180\n" + - "+10 defense, 10% increased movement speed,\n" + - "and 5% increased damage and critical strike chance"; + "+8 defense, 10% increased movement speed,\n" + + "4% increased damage, and 2% increased critical strike chance"; } } } @@ -2100,7 +2219,7 @@ Provides heat and cold protection in Death Mode"; "Average vertical speed\n" + "Flight time: 140\n" + "At night or during an eclipse, you will gain the following boosts:\n" + - "10% increased movement speed, 100% increased jump speed,\n" + + "10% increased movement speed, 20% increased jump speed,\n" + "+15 defense, 10% increased damage, and 5% increased critical strike chance"; } } @@ -2148,7 +2267,7 @@ Provides heat and cold protection in Death Mode"; "Acceleration multiplier: 1\n" + "Average vertical speed\n" + "Flight time: 180\n" + - "+1 max minion and 5% increased minion damage while wearing the Spooky Armor"; + "Increased minion knockback and 5% increased minion damage while wearing the Spooky Armor"; } } } @@ -2195,9 +2314,8 @@ Provides heat and cold protection in Death Mode"; "Acceleration multiplier: 0\n" + "Average vertical speed\n" + "Flight time: 160\n" + - "+10 defense, 10% increased damage, " + - "5% increased critical strike chance, " + - "10% increased movement speed and 120% increased jump speed"; + "+5 defense, 5% increased damage,\n" + + "10% increased movement speed and 24% increased jump speed"; } } } @@ -2713,13 +2831,21 @@ Provides heat and cold protection in Death Mode"; TooltipLine line = new TooltipLine(mod, "Tooltip0", "Forces surrounding biome state to Astral upon activation"); tooltips.Add(line); } - } - } - #endregion + } - // NOTE: this function applies to all treasure bags, even modded ones (despite the name). - #region Boss Bag Changes - public override void OpenVanillaBag(string context, Player player, int arg) + if (item.type > ItemID.Count && item.Calamity().Chargeable) + { + float chargeRatio = item.Calamity().CurrentCharge / (float)ChargeMax; + chargeRatio *= 100f; // Turn the 0-1 ratio to a 0-100 percentage. + TooltipLine line = new TooltipLine(mod, "Tooltip0", $"Current Charge: {chargeRatio:N1}%"); + tooltips.Add(line); + } + } + #endregion + + // NOTE: this function applies to all treasure bags, even modded ones (despite the name). + #region Boss Bag Changes + public override void OpenVanillaBag(string context, Player player, int arg) { if (context == "crate") { @@ -2923,8 +3049,8 @@ Provides heat and cold protection in Death Mode"; modPlayer.wearingRogueArmor = true; player.Calamity().throwingDamage += 0.05f; player.Calamity().throwingVelocity += 0.1f; - player.statDefense += 5; - player.setBonus = "+5 defense\n" + + player.statDefense += 3; + player.setBonus = "+3 defense\n" + "5% increased rogue damage and 10% increased velocity\n" + "Rogue stealth builds while not attacking and not moving, up to a max of 70\n" + "Once you have built max stealth, you will be able to perform a Stealth Strike\n" + @@ -2940,14 +3066,27 @@ Provides heat and cold protection in Death Mode"; player.statDefense += 2; player.fireWalk = true; player.lavaMax += 180; - player.setBonus = "+2 defense\n" + - "5% increased rogue damage and critical strike chance\n" + - "Grants immunity to fire blocks and temporary immunity to lava\n" + - "Rogue stealth builds while not attacking and not moving, up to a max of 80\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" + - "Provides heat protection in Death Mode"; + if (CalamityWorld.death) + { + player.setBonus = "+2 defense\n" + + "5% increased rogue damage and critical strike chance\n" + + "Grants immunity to fire blocks and temporary immunity to lava\n" + + "Rogue stealth builds while not attacking and not moving, up to a max of 80\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" + + "Provides heat protection in Death Mode"; + } + else + { + player.setBonus = "+2 defense\n" + + "5% increased rogue damage and critical strike chance\n" + + "Grants immunity to fire blocks and temporary immunity to lava\n" + + "Rogue stealth builds while not attacking and not moving, up to a max of 80\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"; + } } else if (set == "Molten") { @@ -2959,10 +3098,19 @@ Provides heat and cold protection in Death Mode"; modPlayer.eskimoSet = true; player.buffImmune[BuffID.Frostburn] = true; player.buffImmune[ModContent.BuffType()] = true; - player.setBonus = "All ice-themed weapons receive a 10% damage bonus\n" + - "Cold enemies will deal reduced contact damage to the player\n" + - "Provides immunity to the Frostburn and Glacial State debuffs\n" + - "Provides cold immunity in Death Mode"; + if (CalamityWorld.death) + { + player.setBonus = "All ice-themed weapons receive a 10% damage bonus\n" + + "Cold enemies will deal reduced contact damage to the player\n" + + "Provides immunity to the Frostburn and Glacial State debuffs\n" + + "Provides cold immunity in Death Mode"; + } + else + { + player.setBonus = "All ice-themed weapons receive a 10% damage bonus\n" + + "Cold enemies will deal reduced contact damage to the player\n" + + "Provides immunity to the Frostburn and Glacial State debuffs"; + } } else if (set == "Meteor") { @@ -3090,9 +3238,8 @@ Provides heat and cold protection in Death Mode"; } else if (item.type == ItemID.MothronWings) // Spawn baby mothrons over time to attack enemies, max of 3 { - player.statDefense += 10; - player.allDamage += 0.1f; - modPlayer.AllCritBoost(5); + player.statDefense += 5; + player.allDamage += 0.05f; player.moveSpeed += 0.1f; player.jumpSpeedBoost += 1.2f; player.noFallDmg = true; @@ -3203,7 +3350,7 @@ Provides heat and cold protection in Death Mode"; player.noFallDmg = true; if (player.head == ArmorIDs.Head.SpookyHelmet && player.body == ArmorIDs.Body.SpookyBreastplate && player.legs == ArmorIDs.Legs.SpookyLeggings) { - player.maxMinions++; + player.minionKB += 2f; player.minionDamage += 0.05f; } } @@ -3215,9 +3362,9 @@ Provides heat and cold protection in Death Mode"; } else if (item.type == ItemID.SteampunkWings) { - player.statDefense += 10; - player.allDamage += 0.05f; - modPlayer.AllCritBoost(5); + player.statDefense += 8; + player.allDamage += 0.04f; + modPlayer.AllCritBoost(2); player.moveSpeed += 0.1f; player.noFallDmg = true; } @@ -3438,7 +3585,7 @@ Provides heat and cold protection in Death Mode"; for (int i = 54; i < Main.maxInventory; i++) { - if (player.inventory[i].ammo == item.useAmmo && player.inventory[i].stack >= ammoConsumed) + if (player.inventory[i].ammo == item.useAmmo && (player.inventory[i].stack >= ammoConsumed || !player.inventory[i].consumable)) { itemAmmo = player.inventory[i]; flag = true; @@ -3450,7 +3597,7 @@ Provides heat and cold protection in Death Mode"; { for (int j = 0; j < 54; j++) { - if (player.inventory[j].ammo == item.useAmmo && player.inventory[j].stack >= ammoConsumed) + if (player.inventory[j].ammo == item.useAmmo && (player.inventory[j].stack >= ammoConsumed || !player.inventory[j].consumable)) { itemAmmo = player.inventory[j]; break; @@ -3496,11 +3643,8 @@ Provides heat and cold protection in Death Mode"; { int value = item.value; ItemLoader.ReforgePrice(item, ref value, ref Main.LocalPlayer.discount); - if (Main.LocalPlayer.Calamity().reforges <= 9) //to be reset later - { - Main.LocalPlayer.Calamity().moneyStolenByBandit += value / 5; - Main.LocalPlayer.Calamity().reforges++; - } + CalamityWorld.MoneyStolenByBandit += value / 5; + CalamityWorld.Reforges++; } } #endregion diff --git a/Items/DifficultyItems/IronHeart.cs b/Items/DifficultyItems/IronHeart.cs index eb3d38a3c2..10704165c4 100644 --- a/Items/DifficultyItems/IronHeart.cs +++ b/Items/DifficultyItems/IronHeart.cs @@ -2,6 +2,7 @@ using CalamityMod.NPCs.SlimeGod; using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -13,10 +14,10 @@ namespace CalamityMod.Items.DifficultyItems public override void SetStaticDefaults() { DisplayName.SetDefault("Iron Heart"); - Tooltip.SetDefault("Makes dying while a boss is alive permanently kill you.\n" + + Tooltip.SetDefault("Healing with potions and all positive life regen is disabled.\n" + + "Enemy damage scales with your max health.\n" + "Can be toggled on and off.\n" + - "Using this while a boss is alive will permanently kill you.\n" + - "Cannot be activated if any boss has been killed."); + "Using this while a boss is alive will instantly kill you and despawn the boss."); } public override void SetDefaults() @@ -32,24 +33,19 @@ namespace CalamityMod.Items.DifficultyItems item.consumable = false; } - public override bool CanUseItem(Player player) - { - return !CalamityWorld.downedBossAny; - } - public override bool UseItem(Player player) { - for (int doom = 0; doom < 200; doom++) - { - if ((Main.npc[doom].active && (Main.npc[doom].boss || Main.npc[doom].type == NPCID.EaterofWorldsHead || Main.npc[doom].type == NPCID.EaterofWorldsTail || Main.npc[doom].type == ModContent.NPCType() || - Main.npc[doom].type == ModContent.NPCType() || Main.npc[doom].type == ModContent.NPCType() || Main.npc[doom].type == ModContent.NPCType())) || CalamityWorld.DoGSecondStageCountdown > 0) - { - player.KillMeForGood(); - Main.npc[doom].active = Main.npc[doom].friendly; - Main.npc[doom].netUpdate = true; - } - } - if (!CalamityWorld.ironHeart) + for (int doom = 0; doom < Main.npc.Length; doom++) + { + if ((Main.npc[doom].active && (Main.npc[doom].boss || Main.npc[doom].type == NPCID.EaterofWorldsHead || Main.npc[doom].type == NPCID.EaterofWorldsTail || Main.npc[doom].type == ModContent.NPCType() || + Main.npc[doom].type == ModContent.NPCType() || Main.npc[doom].type == ModContent.NPCType() || Main.npc[doom].type == ModContent.NPCType())) || CalamityWorld.DoGSecondStageCountdown > 0) + { + player.KillMe(PlayerDeathReason.ByCustomReason(player.name + " tried to change the rules."), 1000.0, 0, false); + Main.npc[doom].active = Main.npc[doom].friendly; + Main.npc[doom].netUpdate = true; + } + } + if (!CalamityWorld.ironHeart) { CalamityWorld.ironHeart = true; string key = "Mods.CalamityMod.IronHeartText"; diff --git a/Items/DifficultyItems/Revenge.cs b/Items/DifficultyItems/Revenge.cs index a681d76e41..2736aca44a 100644 --- a/Items/DifficultyItems/Revenge.cs +++ b/Items/DifficultyItems/Revenge.cs @@ -1,6 +1,7 @@ using CalamityMod.NPCs.SlimeGod; using CalamityMod.World; using Microsoft.Xna.Framework; +using System.Collections.Generic; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -13,23 +14,21 @@ namespace CalamityMod.Items.DifficultyItems public override void SetStaticDefaults() { DisplayName.SetDefault("Revengeance"); - Tooltip.SetDefault("Activates Revengeance Mode, can only be used in expert mode.\n" + - "Activates rage. When rage is maxed press V to activate rage mode.\n" + + Tooltip.SetDefault("Enables/disables Revengeance Mode, can only be used in expert mode.\n" + + "RAGE TOOLTIP LINE HERE\n" + "You gain rage whenever you take damage or hit an enemy with a true melee weapon.\n" + - "Activates adrenaline. When adrenaline is maxed press B to activate adrenaline mode.\n" + + "ADRENALINE TOOLTIP LINE HERE\n" + "You gain adrenaline whenever a boss is alive. Getting hit drops adrenaline back to 0.\n" + - "All enemies drop 50% more cash.\n" + + "All enemies drop 50% more cash and spawn 15% more frequently\n" + + "Certain enemies and projectiles deal between 5% and 25% more damage.\n" + "Makes certain enemies immune to life steal and nerfs the effectiveness of life steal.\n" + - "Increases enemy damage by 25% and spawn rates by 15%.\n" + "Nerfs the effectiveness of the Titanium Armor set bonus.\n" + "Makes life regen scale with your current HP, the higher your HP the lower your life regen (this is not based on max HP).\n" + - "Reduces maximum asphalt run speed by 33%.\n" + - "Increases Nurse healing price.\n" + + "Asphalt run speed is reduced by 33%, and the Nurse's healing cost is increased\n" + "Allows certain enemies to inflict the Horror and Marked debuffs.\n" + "Before you have killed your first boss you take 20% less damage from everything.\n" + "Changes ALL boss AIs and some enemy AIs in vanilla and the Calamity Mod.\n" + - "DO NOT USE IF A BOSS IS ALIVE!\n" + - "Can be toggled on and off."); + "Using this while a boss is alive will instantly kill you and despawn the boss."); } public override void SetDefaults() @@ -44,25 +43,35 @@ namespace CalamityMod.Items.DifficultyItems item.consumable = false; } - public override bool CanUseItem(Player player) + public override void ModifyTooltips(List list) { - if (!Main.expertMode || CalamityWorld.bossRushActive) + string rageKey = CalamityMod.RageHotKey.TooltipHotkeyString(); + string adrenKey = CalamityMod.AdrenalineHotKey.TooltipHotkeyString(); + foreach (TooltipLine line2 in list) { - return false; + if (line2.mod == "Terraria" && line2.Name == "Tooltip1") + { + line2.text = "Activates rage. When rage is maxed press " + rageKey + " to activate rage mode."; + } + if (line2.mod == "Terraria" && line2.Name == "Tooltip3") + { + line2.text = "Activates adrenaline. When adrenaline is maxed press " + adrenKey + " to activate adrenaline mode."; + } } - return true; } + public override bool CanUseItem(Player player) => Main.expertMode && !CalamityWorld.bossRushActive; + public override bool UseItem(Player player) { for (int doom = 0; doom < Main.npc.Length; doom++) { - if ((Main.npc[doom].active && (Main.npc[doom].boss || Main.npc[doom].type == NPCID.EaterofWorldsHead || Main.npc[doom].type == NPCID.EaterofWorldsTail || Main.npc[doom].type == ModContent.NPCType() || - Main.npc[doom].type == ModContent.NPCType() || Main.npc[doom].type == ModContent.NPCType() || Main.npc[doom].type == ModContent.NPCType())) || CalamityWorld.DoGSecondStageCountdown > 0) + NPC npc = Main.npc[doom]; + if ((npc.active && (npc.boss || npc.type == NPCID.EaterofWorldsHead || npc.type == NPCID.EaterofWorldsTail || npc.type == ModContent.NPCType() || npc.type == ModContent.NPCType() || npc.type == ModContent.NPCType() || npc.type == ModContent.NPCType())) || CalamityWorld.DoGSecondStageCountdown > 0) { player.KillMe(PlayerDeathReason.ByCustomReason(player.name + " tried to change the rules."), 1000.0, 0, false); - Main.npc[doom].active = Main.npc[doom].friendly; - Main.npc[doom].netUpdate = true; + npc.active = npc.friendly; + npc.netUpdate = true; } } if (!CalamityWorld.revenge) diff --git a/Items/DraedonsLog.cs b/Items/DraedonsLog.cs new file mode 100644 index 0000000000..ac8fd422b7 --- /dev/null +++ b/Items/DraedonsLog.cs @@ -0,0 +1,35 @@ +using CalamityMod.UI; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items +{ + public class DraedonsLog : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Draedon's Log"); + Tooltip.SetDefault("Click to view its contents"); + } + + public override void SetDefaults() + { + item.width = 40; + item.height = 40; + item.rare = ItemRarityID.Red; + item.Calamity().customRarity = CalamityRarity.DraedonRust; + item.useAnimation = item.useTime = 20; + item.useStyle = ItemUseStyleID.HoldingUp; + } + + public override bool UseItem(Player player) + { + if (Main.myPlayer == player.whoAmI) + { + PopupGUIManager.DraedonLogGUI.Active = !PopupGUIManager.DraedonLogGUI.Active; + } + return true; + } + } +} diff --git a/Items/DraedonsLog.png b/Items/DraedonsLog.png new file mode 100644 index 0000000000..9059a2fb2a Binary files /dev/null and b/Items/DraedonsLog.png differ diff --git a/Items/Dyes/AstralSwirlDye.cs b/Items/Dyes/AstralSwirlDye.cs index 33ff3d0f06..d82a951e4d 100644 --- a/Items/Dyes/AstralSwirlDye.cs +++ b/Items/Dyes/AstralSwirlDye.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Dyes recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddTile(TileID.DyeVat); - recipe.SetResult(this); + recipe.SetResult(this, 2); recipe.AddRecipe(); } } diff --git a/Items/Dyes/CeaselessDye.cs b/Items/Dyes/CeaselessDye.cs index c865caa946..74ec09aeda 100644 --- a/Items/Dyes/CeaselessDye.cs +++ b/Items/Dyes/CeaselessDye.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Dyes recipe.AddIngredient(ItemID.ShadowDye); recipe.AddIngredient(ModContent.ItemType()); recipe.AddTile(TileID.DyeVat); - recipe.SetResult(this); + recipe.SetResult(this, 2); recipe.AddRecipe(); } } diff --git a/Items/Dyes/DragonSoulDye.cs b/Items/Dyes/DragonSoulDye.cs index 7e6f265b0c..93a6009f42 100644 --- a/Items/Dyes/DragonSoulDye.cs +++ b/Items/Dyes/DragonSoulDye.cs @@ -25,10 +25,10 @@ namespace CalamityMod.Items.Dyes public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater); + recipe.AddIngredient(ItemID.BottledWater, 2); recipe.AddIngredient(ModContent.ItemType()); recipe.AddTile(TileID.DyeVat); - recipe.SetResult(this); + recipe.SetResult(this, 2); recipe.AddRecipe(); } } diff --git a/Items/Dyes/ElementalDye.cs b/Items/Dyes/ElementalDye.cs index a53145c467..b9ffc2506e 100644 --- a/Items/Dyes/ElementalDye.cs +++ b/Items/Dyes/ElementalDye.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Dyes recipe.AddIngredient(ItemID.NebulaDye); recipe.AddIngredient(ModContent.ItemType()); recipe.AddTile(TileID.DyeVat); - recipe.SetResult(this); + recipe.SetResult(this, 5); recipe.AddRecipe(); } } diff --git a/Items/Dyes/EndothermicDye.cs b/Items/Dyes/EndothermicDye.cs index 6630a5ac20..5812406c34 100644 --- a/Items/Dyes/EndothermicDye.cs +++ b/Items/Dyes/EndothermicDye.cs @@ -27,10 +27,10 @@ namespace CalamityMod.Items.Dyes public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater); + recipe.AddIngredient(ItemID.BottledWater, 2); recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddTile(TileID.DyeVat); - recipe.SetResult(this); + recipe.SetResult(this, 2); recipe.AddRecipe(); } } diff --git a/Items/Dyes/NightmareDye.cs b/Items/Dyes/NightmareDye.cs index 9807c284bb..3f5b89ac10 100644 --- a/Items/Dyes/NightmareDye.cs +++ b/Items/Dyes/NightmareDye.cs @@ -27,10 +27,10 @@ namespace CalamityMod.Items.Dyes public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater); + recipe.AddIngredient(ItemID.BottledWater, 2); recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddTile(TileID.DyeVat); - recipe.SetResult(this); + recipe.SetResult(this, 2); recipe.AddRecipe(); } } diff --git a/Items/Dyes/ProfanedMoonlightDye.cs b/Items/Dyes/ProfanedMoonlightDye.cs new file mode 100644 index 0000000000..dc10aab350 --- /dev/null +++ b/Items/Dyes/ProfanedMoonlightDye.cs @@ -0,0 +1,22 @@ +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Graphics.Shaders; + +namespace CalamityMod.Items.Dyes +{ + public class ProfanedMoonlightDye : BaseDye + { + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(mod.GetEffect("Effects/Dyes/ProfanedMoonlightDye")), "DyePass"); + public override void SafeSetStaticDefaults() + { + DisplayName.SetDefault("Profaned Moonlight Dye"); + } + + public override void SafeSetDefaults() + { + item.rare = 10; + item.Calamity().customRarity = CalamityRarity.Turquoise; + item.value = Item.sellPrice(0, 10, 0, 0); + } + } +} \ No newline at end of file diff --git a/Items/Dyes/ProfanedMoonlightDye.png b/Items/Dyes/ProfanedMoonlightDye.png new file mode 100644 index 0000000000..ff6fb894ad Binary files /dev/null and b/Items/Dyes/ProfanedMoonlightDye.png differ diff --git a/Items/Dyes/ReaverDye.cs b/Items/Dyes/ReaverDye.cs index 6c297af31c..3a01787ddc 100644 --- a/Items/Dyes/ReaverDye.cs +++ b/Items/Dyes/ReaverDye.cs @@ -26,10 +26,10 @@ namespace CalamityMod.Items.Dyes public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater); + recipe.AddIngredient(ItemID.BottledWater, 2); recipe.AddIngredient(ModContent.ItemType(), 4); recipe.AddTile(TileID.DyeVat); - recipe.SetResult(this); + recipe.SetResult(this, 2); recipe.AddRecipe(); } } diff --git a/Items/Dyes/ShadowspecDye.cs b/Items/Dyes/ShadowspecDye.cs index 03e6b1997f..9b6c88844c 100644 --- a/Items/Dyes/ShadowspecDye.cs +++ b/Items/Dyes/ShadowspecDye.cs @@ -27,10 +27,10 @@ namespace CalamityMod.Items.Dyes public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater); + recipe.AddIngredient(ItemID.BottledWater, 2); recipe.AddIngredient(ModContent.ItemType()); recipe.AddTile(TileID.DyeVat); - recipe.SetResult(this); + recipe.SetResult(this, 2); recipe.AddRecipe(); } } diff --git a/Items/Dyes/StratusDye.cs b/Items/Dyes/StratusDye.cs index f7e57b0be3..47f384cfa5 100644 --- a/Items/Dyes/StratusDye.cs +++ b/Items/Dyes/StratusDye.cs @@ -28,11 +28,12 @@ namespace CalamityMod.Items.Dyes public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater); + recipe.AddIngredient(ItemID.BottledWater, 2); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType()); recipe.AddTile(TileID.DyeVat); - recipe.SetResult(this); + recipe.SetResult(this, 2); recipe.AddRecipe(); } } diff --git a/Items/Fishing/AstralCatches/UrsaSergeant.cs b/Items/Fishing/AstralCatches/UrsaSergeant.cs index 6f0857fe54..77e40e67ed 100644 --- a/Items/Fishing/AstralCatches/UrsaSergeant.cs +++ b/Items/Fishing/AstralCatches/UrsaSergeant.cs @@ -1,6 +1,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.CalPlayer; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Fishing.AstralCatches @@ -30,7 +31,7 @@ namespace CalamityMod.Items.Fishing.AstralCatches modPlayer.ursaSergeant = true; player.statDefense += 20; player.buffImmune[ModContent.BuffType()] = true; - player.buffImmune[148] = true; //Feral Bite + player.buffImmune[BuffID.Rabies] = true; //Feral Bite } } } diff --git a/Items/Fishing/BrimstoneCragCatches/Bloodfin.cs b/Items/Fishing/BrimstoneCragCatches/Bloodfin.cs index 4ea4280573..871ca5599d 100644 --- a/Items/Fishing/BrimstoneCragCatches/Bloodfin.cs +++ b/Items/Fishing/BrimstoneCragCatches/Bloodfin.cs @@ -2,6 +2,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using CalamityMod.Buffs.Potions; +using CalamityMod.World; using System.Collections.Generic; namespace CalamityMod.Items.Fishing.BrimstoneCragCatches @@ -38,14 +39,18 @@ The life regen boost is stronger if below 75% health"); public override void OnConsumeItem(Player player) { - player.statLife += 240; + int healAmt = CalamityWorld.ironHeart ? 0 : 240; + if (player.Calamity().bloodPactBoost) + healAmt = (int)(healAmt * 1.5); + player.statLife += healAmt; if (player.statLife > player.statLifeMax2) { player.statLife = player.statLifeMax2; } if (Main.myPlayer == player.whoAmI) { - player.HealEffect(240, true); + if (!CalamityWorld.ironHeart) + player.HealEffect(healAmt, true); } player.AddBuff(ModContent.BuffType(), 600); @@ -63,7 +68,10 @@ The life regen boost is stronger if below 75% health"); // Forces the "Restores X life" tooltip to display the actual life restored instead of zero (due to the previous function). public override void ModifyTooltips(List tooltips) { - tooltips.Find(line => line.Name == "HealLife").text = "Restores " + item.healLife + " life"; + float healMult = 1f; + if (Main.player[Main.myPlayer].Calamity().bloodPactBoost) + healMult = 1.5f; + tooltips.Find(line => line.Name == "HealLife").text = "Restores " + (CalamityWorld.ironHeart ? 0 : (int)(item.healLife * healMult)) + " life"; } } } diff --git a/Items/Fishing/BrimstoneCragCatches/BrimstoneCrate.cs b/Items/Fishing/BrimstoneCragCatches/BrimstoneCrate.cs index 0d0297c164..bb644037cb 100644 --- a/Items/Fishing/BrimstoneCragCatches/BrimstoneCrate.cs +++ b/Items/Fishing/BrimstoneCragCatches/BrimstoneCrate.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches DropHelper.DropItem(player, ModContent.ItemType(), 3, 5); DropHelper.DropItemCondition(player, ModContent.ItemType(), Main.hardMode, 0.5f, 5, 15); DropHelper.DropItemCondition(player, ModContent.ItemType(), Main.hardMode, 0.15f, 2, 6); - DropHelper.DropItemCondition(player, ModContent.ItemType(), NPC.downedMechBoss1 && NPC.downedMechBoss2 && NPC.downedMechBoss3, 0.5f, 5, 15); + DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.downedBrimstoneElemental, 0.5f, 5, 15); DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.downedProvidence, 0.25f, 8, 10); // Weapons (none) diff --git a/Items/Fishing/FishingRods/WulfrumRod.png b/Items/Fishing/FishingRods/WulfrumRod.png index 3371287464..593ae2bc0c 100644 Binary files a/Items/Fishing/FishingRods/WulfrumRod.png and b/Items/Fishing/FishingRods/WulfrumRod.png differ diff --git a/Items/Fishing/SunkenSeaCatches/SunkenCrate.cs b/Items/Fishing/SunkenSeaCatches/SunkenCrate.cs index ca9397f4e0..f085d1a405 100644 --- a/Items/Fishing/SunkenSeaCatches/SunkenCrate.cs +++ b/Items/Fishing/SunkenSeaCatches/SunkenCrate.cs @@ -55,7 +55,7 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches } // Weapons - DropHelper.DropItemFromSetCondition(player, CalamityWorld.downedCLAM && Main.hardMode, 0.2f, + DropHelper.DropItemFromSetCondition(player, CalamityWorld.downedCLAMHardMode, 0.2f, ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), diff --git a/Items/LoreItems/KnowledgeAquaticScourge.cs b/Items/LoreItems/KnowledgeAquaticScourge.cs index 725d3ce13d..58d2e763bf 100644 --- a/Items/LoreItems/KnowledgeAquaticScourge.cs +++ b/Items/LoreItems/KnowledgeAquaticScourge.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("Aquatic Scourge"); Tooltip.SetDefault("A horror born of pollution and insatiable hunger; based on size alone this was merely a juvenile.\n" + "These scourge creatures are the largest aquatic predators and very rarely do they frequent such shallow waters.\n" + - "Place in your inventory to gain immunity to the sulphurous waters and increase the stat gains from the Well Fed buff.\n" + + "Favorite this item to gain immunity to the sulphurous waters and increase the stat gains from the Well Fed buff.\n" + "However, without the Well Fed buff your stats will decrease due to your insatiable hunger."); } @@ -31,11 +31,12 @@ namespace CalamityMod.Items.LoreItems return false; } - public override void UpdateInventory(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.aquaticScourgeLore = true; - } + public override void UpdateInventory(Player player) + { + CalamityPlayer modPlayer = player.Calamity(); + if (item.favorited) + modPlayer.aquaticScourgeLore = true; + } public override void AddRecipes() { diff --git a/Items/LoreItems/KnowledgeAstrumAureus.cs b/Items/LoreItems/KnowledgeAstrumAureus.cs index 7b1d99ae7d..c651b54717 100644 --- a/Items/LoreItems/KnowledgeAstrumAureus.cs +++ b/Items/LoreItems/KnowledgeAstrumAureus.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("Astrum Aureus"); Tooltip.SetDefault("A titanic cyborg infected by a star-borne disease expelled from the belly of an ancient god.\n" + "The destruction of this creature will not prevent the spread of the disease.\n" + - "Place in your inventory to gain increased jump speed in space."); + "Favorite this item to gain 10% increased jump speed in space."); } public override void SetDefaults() @@ -33,7 +33,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.astrumAureusLore = true; + if (item.favorited) + modPlayer.astrumAureusLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeAstrumDeus.cs b/Items/LoreItems/KnowledgeAstrumDeus.cs index e892c5c7e8..9a369f5a92 100644 --- a/Items/LoreItems/KnowledgeAstrumDeus.cs +++ b/Items/LoreItems/KnowledgeAstrumDeus.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("Astrum Deus"); Tooltip.SetDefault("God of the stars and largest vessel for the Astral Infection.\n" + "Though struck down from its place among the stars its remnants have gathered strength, aiming to take its rightful place in the cosmos once more.\n" + - "Place in your inventory to gain increased movement speed in space."); + "Favorite this item to gain increased movement speed in space."); } public override void SetDefaults() @@ -33,7 +33,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.astrumDeusLore = true; + if (item.favorited) + modPlayer.astrumDeusLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeBrainofCthulhu.cs b/Items/LoreItems/KnowledgeBrainofCthulhu.cs index 4e6a899dbb..e5f11cc641 100644 --- a/Items/LoreItems/KnowledgeBrainofCthulhu.cs +++ b/Items/LoreItems/KnowledgeBrainofCthulhu.cs @@ -15,7 +15,8 @@ namespace CalamityMod.Items.LoreItems "Most likely another abomination spawned from this inchoate mass of flesh.\n" + "Allows you to teleport similar to the Rod of Discord while in the crimson. Place in your hotbar to use it.\n" + "Teleportation is disabled while Chaos State is active.\n" + - "However, you become confused for a few seconds after you use it due to your overwhelming brain power."); + "However, you become confused for a few seconds after you use it due to your overwhelming brain power.\n" + + "Teleportation only occurs if the item is favorited."); } public override void SetDefaults() @@ -33,7 +34,7 @@ namespace CalamityMod.Items.LoreItems public override bool CanUseItem(Player player) { - return player.ZoneCrimson; + return player.ZoneCrimson && item.favorited; } public override bool UseItem(Player player) diff --git a/Items/LoreItems/KnowledgeBrimstoneElemental.cs b/Items/LoreItems/KnowledgeBrimstoneElemental.cs index 336c1e75a2..1cc9c218e6 100644 --- a/Items/LoreItems/KnowledgeBrimstoneElemental.cs +++ b/Items/LoreItems/KnowledgeBrimstoneElemental.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("Brimstone Elemental"); Tooltip.SetDefault("The most powerful of the elementals, bent on exacting revenge upon the bloody inferno that demolished her home.\n" + "Finally put to rest, she will suffer no longer from the grief caused by the deaths of her people.\n" + - "Place in your inventory to improve the inferno potion effect."); + "Favorite this item to improve the inferno potion effect."); } public override void SetDefaults() @@ -33,7 +33,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.brimstoneElementalLore = true; + if (item.favorited) + modPlayer.brimstoneElementalLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeCalamitas.cs b/Items/LoreItems/KnowledgeCalamitas.cs index a4f20b294d..09f6cd25a4 100644 --- a/Items/LoreItems/KnowledgeCalamitas.cs +++ b/Items/LoreItems/KnowledgeCalamitas.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.LoreItems Tooltip.SetDefault("The witch unrivaled. Perhaps the only one amongst my cohorts to have ever given me cause for doubt.\n" + "Now that you have defeated her your destiny is clear.\n" + "Come now, face me.\n" + - "Place in your inventory to die instantly from every hit."); + "Favorite this item to die instantly from every hit."); } public override void SetDefaults() @@ -35,7 +35,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.SCalLore = true; + if (item.favorited) + modPlayer.SCalLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeCalamitasClone.cs b/Items/LoreItems/KnowledgeCalamitasClone.cs index d7fc3ef186..cd8a243315 100644 --- a/Items/LoreItems/KnowledgeCalamitasClone.cs +++ b/Items/LoreItems/KnowledgeCalamitasClone.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("Calamitas Clone"); Tooltip.SetDefault("You are indeed stronger than I thought.\n" + "Though the bloody inferno still lingers, observing your progress.\n" + - "Place in your inventory to gain a boost to your minion slots but at the cost of reduced max health."); + "Favorite this item to gain a boost to your minion slots but at the cost of reduced max health."); } public override void SetDefaults() @@ -33,7 +33,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.calamitasLore = true; + if (item.favorited) + modPlayer.calamitasLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeCorruption.cs b/Items/LoreItems/KnowledgeCorruption.cs index ca722fac4e..7841002d85 100644 --- a/Items/LoreItems/KnowledgeCorruption.cs +++ b/Items/LoreItems/KnowledgeCorruption.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("The Corruption"); Tooltip.SetDefault("The rotten and forever-deteriorating landscape of infected life, brought upon by a deadly microbe long ago.\n" + "It is rumored that the microbe was created through experimentation by a long-dead race, predating the Terrarians.\n" + - "Place in your inventory to prevent hive cysts from spawning."); + "Favorite this item to prevent hive cysts from spawning."); } public override void SetDefaults() @@ -32,7 +32,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.corruptionLore = true; + if (item.favorited) + modPlayer.corruptionLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeCrabulon.cs b/Items/LoreItems/KnowledgeCrabulon.cs index 57bf38da6e..55583c83f1 100644 --- a/Items/LoreItems/KnowledgeCrabulon.cs +++ b/Items/LoreItems/KnowledgeCrabulon.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("Crabulon"); Tooltip.SetDefault("A crab and its mushrooms, a love story.\n" + "It's interesting how creatures can adapt given certain circumstances.\n" + - "Place in your inventory to gain the Mushy buff while underground or in the mushroom biome.\n" + + "Favorite this item to gain the Mushy buff while underground or in the mushroom biome.\n" + "However, your movement speed will be decreased while in these areas due to you being covered in fungi."); } @@ -33,7 +33,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.crabulonLore = true; + if (item.favorited) + modPlayer.crabulonLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeCrimson.cs b/Items/LoreItems/KnowledgeCrimson.cs index 6cdf1c5d07..08905ab61a 100644 --- a/Items/LoreItems/KnowledgeCrimson.cs +++ b/Items/LoreItems/KnowledgeCrimson.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("The Crimson"); Tooltip.SetDefault("This bloody hell, spawned from a formless mass of flesh that fell from the stars eons ago.\n" + "It is now home to many hideous creatures, spawned from the pumping blood and lurching organs deep within.\n" + - "Place in your inventory to prevent perforator cysts from spawning."); + "Favorite this item to prevent perforator cysts from spawning."); } public override void SetDefaults() @@ -32,7 +32,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.crimsonLore = true; + if (item.favorited) + modPlayer.crimsonLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeCryogen.cs b/Items/LoreItems/KnowledgeCryogen.cs index 184c4b9776..e3e40b1f1c 100644 --- a/Items/LoreItems/KnowledgeCryogen.cs +++ b/Items/LoreItems/KnowledgeCryogen.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("Cryogen"); Tooltip.SetDefault("The archmage's prison.\n" + "I am unsure if it has grown weaker over the decades of imprisonment.\n" + - "Place in your inventory to gain a frost dash that freezes enemies, at the cost of slightly reduced defense due to your brittle body."); + "Favorite this item to gain a frost dash that freezes enemies, at the cost of slightly reduced defense due to your brittle body."); } public override void SetDefaults() @@ -33,7 +33,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.dashMod = 6; + if (item.favorited) + modPlayer.dashMod = 6; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeDesertScourge.cs b/Items/LoreItems/KnowledgeDesertScourge.cs index 082f206049..b97efbacf6 100644 --- a/Items/LoreItems/KnowledgeDesertScourge.cs +++ b/Items/LoreItems/KnowledgeDesertScourge.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.LoreItems Tooltip.SetDefault("The great sea worm appears to have survived the extreme heat and has even adapted to it.\n" + "What used to be a majestic beast swimming through the water has now become a dried-up and\n" + "gluttonous husk, constantly on a voracious search for its next meal.\n" + - "Place in your inventory for an increase to defense while in the desert or sunken sea.\n" + + "Favorite this item for an increase to defense while in the desert or sunken sea.\n" + "However, you will deal decreased damage while in these areas due to being a husk of your former self."); } @@ -33,7 +33,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { - player.Calamity().desertScourgeLore = true; + if (item.favorited) + player.Calamity().desertScourgeLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeDestroyer.cs b/Items/LoreItems/KnowledgeDestroyer.cs index 55303b8bff..cea12b9e5e 100644 --- a/Items/LoreItems/KnowledgeDestroyer.cs +++ b/Items/LoreItems/KnowledgeDestroyer.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("The Destroyer"); Tooltip.SetDefault("A machine brought to life by the mighty souls of warriors, and built to excavate massive tunnels in planets to gather resources.\n" + "Could have proven useful if Draedon didn't have an obsession with turning everything into a tool of destruction.\n" + - "Place in your inventory to gain a boost to your pick speed.\n" + + "Favorite this item to gain a boost to your pick speed.\n" + "However, your max acceleration is decreased slightly due to you feeling heavier."); } @@ -33,7 +33,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.destroyerLore = true; + if (item.favorited) + modPlayer.destroyerLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeDevourerofGods.cs b/Items/LoreItems/KnowledgeDevourerofGods.cs index f4f40aee8b..f34573d0fd 100644 --- a/Items/LoreItems/KnowledgeDevourerofGods.cs +++ b/Items/LoreItems/KnowledgeDevourerofGods.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("The Devourer of Gods"); Tooltip.SetDefault("This serpent’s power to assimilate the abilities and energy of those it consumed is unique in almost all the known cosmos, save for its lesser brethren.\n" + "I would have soon had to eliminate it as a threat had it been given more time and creatures to feast upon.\n" + - "Place in your inventory to boost the power of your true melee strikes by 50%.\n" + + "Favorite this item to boost the power of your true melee strikes by 25%.\n" + "However, due to your reckless nature you will take increased damage."); } @@ -35,7 +35,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.DoGLore = true; + if (item.favorited) + modPlayer.DoGLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeDukeFishron.cs b/Items/LoreItems/KnowledgeDukeFishron.cs index 516bd28ad7..e82c8dc7a7 100644 --- a/Items/LoreItems/KnowledgeDukeFishron.cs +++ b/Items/LoreItems/KnowledgeDukeFishron.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("Duke Fishron"); Tooltip.SetDefault("The mutant terror of the sea was once the trusted companion of an old king; he tamed it using its favorite treat.\n" + "Long ago, the creature flew in desperation from the raging bloody inferno consuming its home, ultimately finding its way to the ocean.\n" + - "Place in your inventory for an increase to all damage, crit and movement speed while submerged in liquid.\n" + + "Favorite this item for an increase to all damage, crit and movement speed while submerged in liquid.\n" + "However, while not submerged in liquid you will have slightly decreased damage, crit and movement speed due to feeling dried out."); } @@ -33,7 +33,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.dukeFishronLore = true; + if (item.favorited) + modPlayer.dukeFishronLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeEaterofWorlds.cs b/Items/LoreItems/KnowledgeEaterofWorlds.cs index 40a7adf76f..9c69fba845 100644 --- a/Items/LoreItems/KnowledgeEaterofWorlds.cs +++ b/Items/LoreItems/KnowledgeEaterofWorlds.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("The Eater of Worlds"); Tooltip.SetDefault("Perhaps it was just a giant worm infected by the microbe, given centuries to feed and grow its festering body.\n" + "Seems likely, given the origins of this place.\n" + - "Deadly microbes spawn around you while this is placed in your inventory.\n" + + "Deadly microbes spawn around you while this item is favorited.\n" + "However, you will have decreased life regen due to your skin rotting off."); } @@ -33,7 +33,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.eaterOfWorldsLore = true; + if (item.favorited) + modPlayer.eaterOfWorldsLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeEyeofCthulhu.cs b/Items/LoreItems/KnowledgeEyeofCthulhu.cs index 61a1a60a44..34854f3d4b 100644 --- a/Items/LoreItems/KnowledgeEyeofCthulhu.cs +++ b/Items/LoreItems/KnowledgeEyeofCthulhu.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("The Eye of Cthulhu"); Tooltip.SetDefault("That eye...how peculiar.\n" + "I sensed it watching you more intensely as you grew stronger.\n" + - "Place in your inventory for night vision at night.\n" + + "Favorite this item for night vision at night.\n" + "However, your vision is reduced during the day."); } @@ -31,10 +31,13 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { - if (!Main.dayTime) - player.nightVision = true; - else - player.blind = true; + if (item.favorited) + { + if (!Main.dayTime) + player.nightVision = true; + else + player.blind = true; + } } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeGolem.cs b/Items/LoreItems/KnowledgeGolem.cs index 4fc871658b..d2a7451b6c 100644 --- a/Items/LoreItems/KnowledgeGolem.cs +++ b/Items/LoreItems/KnowledgeGolem.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("Golem"); Tooltip.SetDefault("A primitive construct.\n" + "I admire the lihzahrd race for their ingenuity, though finding faith in such a flawed idol would invariably lead to their downfall.\n" + - "Place in your inventory to gain increased defense while standing still."); + "Favorite this item to gain increased defense while standing still."); } public override void SetDefaults() @@ -32,7 +32,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.golemLore = true; + if (item.favorited) + modPlayer.golemLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeHiveMind.cs b/Items/LoreItems/KnowledgeHiveMind.cs index 2d7b59c989..e2d694dd1c 100644 --- a/Items/LoreItems/KnowledgeHiveMind.cs +++ b/Items/LoreItems/KnowledgeHiveMind.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("The Hive Mind"); Tooltip.SetDefault("A hive of clustered microbial-infected flesh.\n" + "I do not believe killing it will lessen the corruption here.\n" + - "Place in your inventory for all of your projectiles to inflict cursed flames when in the corruption.\n" + + "Favorite this item for all of your projectiles to inflict cursed flames when in the corruption.\n" + "However, enemy spawn rates will be greatly reduced while in the corruption due to your overwhelmingly-putrid odor."); } @@ -33,7 +33,7 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { - if (player.ZoneCorrupt) + if (player.ZoneCorrupt && item.favorited) { CalamityPlayer modPlayer = player.Calamity(); modPlayer.hiveMindLore = true; diff --git a/Items/LoreItems/KnowledgeKingSlime.cs b/Items/LoreItems/KnowledgeKingSlime.cs index 9b7704180f..fdd0f6a6f4 100644 --- a/Items/LoreItems/KnowledgeKingSlime.cs +++ b/Items/LoreItems/KnowledgeKingSlime.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -12,8 +13,8 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("King Slime"); Tooltip.SetDefault("Only a fool could be caught by this pitiful excuse for a hunter.\n" + "Unfortunately, our world has no shortage of those.\n" + - "Place in your inventory to gain a slight movement speed and jump boost.\n" + - "However, your defense is slightly reduced due to your gelatinous body."); + "Favorite this item to gain 5% increased movement speed and 2% increased jump speed.\n" + + "However, your defense is reduced by 3 due to your gelatinous body."); } public override void SetDefaults() @@ -24,6 +25,20 @@ namespace CalamityMod.Items.LoreItems item.consumable = false; } + public override void ModifyTooltips(List list) + { + bool autoJump = Main.player[Main.myPlayer].autoJump; + string hasJumpBoost = "Place in your inventory to gain 5% increased movement speed and 2% increased jump speed."; + string noJumpBoost = "Place in your inventory to gain 5% increased movement speed."; + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip2") + { + line2.text = autoJump ? noJumpBoost : hasJumpBoost; + } + } + } + public override bool CanUseItem(Player player) { return false; @@ -31,7 +46,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { - player.Calamity().kingSlimeLore = true; + if (item.favorited) + player.Calamity().kingSlimeLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeLeviathanandSiren.cs b/Items/LoreItems/KnowledgeLeviathanandSiren.cs index b0207cd611..2e4bc424c7 100644 --- a/Items/LoreItems/KnowledgeLeviathanandSiren.cs +++ b/Items/LoreItems/KnowledgeLeviathanandSiren.cs @@ -11,11 +11,11 @@ namespace CalamityMod.Items.LoreItems { public override void SetStaticDefaults() { - DisplayName.SetDefault("Leviathan and Siren"); + DisplayName.SetDefault("Leviathan and Anahita"); Tooltip.SetDefault("An odd pair of creatures; one seeking companionship and the other seeking sustenance.\n" + "Perhaps two genetic misfits outcast from their homes that found comfort in assisting one another.\n" + - "Place in your inventory to gain increased max health while wearing the siren heart and treasure detect while wearing the strange orb.\n" + - "Allows the young siren pet to move normally while outside of liquids.\n" + + "Favorite this item to gain increased max health while wearing the aquatic heart and treasure detect while wearing the strange orb.\n" + + "Allows the young Ocean Spirit light pet to move normally while outside of liquids.\n" + "However, if you're not submerged in liquid you will have decreased defense and damage reduction."); } @@ -35,7 +35,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.leviathanAndSirenLore = true; + if (item.favorited) + modPlayer.leviathanAndSirenLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeLeviathanandSiren.png b/Items/LoreItems/KnowledgeLeviathanandSiren.png index 155928f2bf..b1e8746bb8 100644 Binary files a/Items/LoreItems/KnowledgeLeviathanandSiren.png and b/Items/LoreItems/KnowledgeLeviathanandSiren.png differ diff --git a/Items/LoreItems/KnowledgeLunaticCultist.cs b/Items/LoreItems/KnowledgeLunaticCultist.cs index 85eefb0946..a701aee0f5 100644 --- a/Items/LoreItems/KnowledgeLunaticCultist.cs +++ b/Items/LoreItems/KnowledgeLunaticCultist.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.LoreItems Tooltip.SetDefault("The gifted one that terminated my grand summoning so long ago with his uncanny powers over the arcane.\n" + "Someone I once held in such contempt for his actions is now...deceased, his sealing ritual undone...prepare for the end.\n" + "Your impending doom approaches...\n" + - "Place in your inventory for an increase to all stats during the lunar event.\n" + + "Favorite this item for an increase to all stats during the lunar event.\n" + "However, your vision is decreased due to eldritch knowledge damaging your mind."); } @@ -33,7 +33,7 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { - if (NPC.LunarApocalypseIsUp) + if (NPC.LunarApocalypseIsUp && item.favorited) { CalamityPlayer modPlayer = player.Calamity(); modPlayer.lunaticCultistLore = true; diff --git a/Items/LoreItems/KnowledgeMoonLord.cs b/Items/LoreItems/KnowledgeMoonLord.cs index de993228b6..113e46931d 100644 --- a/Items/LoreItems/KnowledgeMoonLord.cs +++ b/Items/LoreItems/KnowledgeMoonLord.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.LoreItems Tooltip.SetDefault("What a waste.\n" + "Had it been fully restored it would have been a force to behold, but what you fought was an empty shell.\n" + "However, that doesn't diminish the immense potential locked within it, released upon its death.\n" + - "Place in your inventory to gain an improved Gravity Globe that gives you an increase to all stats while upside down.\n" + + "Favorite this item to gain an improved Gravity Globe that gives you an increase to all stats while upside down.\n" + "However, while not upside down you have permanent featherfall."); } @@ -34,7 +34,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.moonLordLore = true; + if (item.favorited) + modPlayer.moonLordLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeOcean.cs b/Items/LoreItems/KnowledgeOcean.cs index 3928714138..7b3af37673 100644 --- a/Items/LoreItems/KnowledgeOcean.cs +++ b/Items/LoreItems/KnowledgeOcean.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("The Ocean"); Tooltip.SetDefault("Take care to not disturb the deep waters of this world.\n" + "You may awaken something more terrifying than death itself.\n" + - "Place in your inventory to prevent the mysterious siren lure from spawning."); + "Favorite this item to prevent the mysterious siren lure from spawning."); } public override void SetDefaults() @@ -33,7 +33,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.oceanLore = true; + if (item.favorited) + modPlayer.oceanLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeOldDuke.cs b/Items/LoreItems/KnowledgeOldDuke.cs index 78a1498a80..0747a4d8d1 100644 --- a/Items/LoreItems/KnowledgeOldDuke.cs +++ b/Items/LoreItems/KnowledgeOldDuke.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("Old Duke"); Tooltip.SetDefault("Strange, to find out that the mutant terror of the seas was not alone in its unique biology.\n" + "Perhaps I was mistaken to classify the creature from its relation to pigrons alone.\n" + - "Place in your inventory to convert negative effects from the Acid Rain debuff to positive effects."); + "Favorite this item to convert negative effects from the Acid Rain debuff to positive effects."); } public override void SetDefaults() @@ -34,7 +34,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.boomerDukeLore = true; + if (item.favorited) + modPlayer.boomerDukeLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgePerforators.cs b/Items/LoreItems/KnowledgePerforators.cs index aed58f7645..b3a903fa69 100644 --- a/Items/LoreItems/KnowledgePerforators.cs +++ b/Items/LoreItems/KnowledgePerforators.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.LoreItems { DisplayName.SetDefault("The Perforators and their Hive"); Tooltip.SetDefault("An abomination of comingled flesh, bone, and organ, infested primarily by blood-slurping worms.\n" + - "Place in your inventory for all of your projectiles to inflict ichor when in the crimson.\n" + + "Favorite this item for all of your projectiles to inflict ichor when in the crimson.\n" + "However, enemy spawn rates will be greatly increased while in the crimson due to your body excreting a sweet-smelling pus."); } @@ -32,7 +32,7 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { - if (player.ZoneCrimson) + if (player.ZoneCrimson && item.favorited) { CalamityPlayer modPlayer = player.Calamity(); modPlayer.perforatorLore = true; diff --git a/Items/LoreItems/KnowledgePlaguebringerGoliath.cs b/Items/LoreItems/KnowledgePlaguebringerGoliath.cs index 54bc9ee369..6e781bb644 100644 --- a/Items/LoreItems/KnowledgePlaguebringerGoliath.cs +++ b/Items/LoreItems/KnowledgePlaguebringerGoliath.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("The Plaguebringer Goliath"); Tooltip.SetDefault("A horrific amalgam of steel, flesh, and infection, capable of destroying an entire civilization in just one onslaught.\n" + "Its plague nuke barrage can leave an entire area uninhabitable for months. A shame that it came to this but the plague must be contained.\n" + - "Place in your inventory to gain increased wing flight time, but at the cost of reduced life regen."); + "Favorite this item to gain increased wing flight time, but at the cost of reduced life regen."); } public override void SetDefaults() @@ -33,7 +33,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.plaguebringerGoliathLore = true; + if (item.favorited) + modPlayer.plaguebringerGoliathLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgePlantera.cs b/Items/LoreItems/KnowledgePlantera.cs index b5a07a9743..4ad06181b9 100644 --- a/Items/LoreItems/KnowledgePlantera.cs +++ b/Items/LoreItems/KnowledgePlantera.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.LoreItems Tooltip.SetDefault("Well done, you killed a plant.\n" + "It was used as a vessel to house the spirits of those unfortunate enough to find their way down here.\n" + "I wish you luck in dealing with the fallout.\n" + - "Place in your inventory to gain increased item grab range."); + "Favorite this item to gain increased item grab range."); } public override void SetDefaults() @@ -33,7 +33,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.planteraLore = true; + if (item.favorited) + modPlayer.planteraLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgePolterghast.cs b/Items/LoreItems/KnowledgePolterghast.cs index 80488cdddb..4cb59d9af4 100644 --- a/Items/LoreItems/KnowledgePolterghast.cs +++ b/Items/LoreItems/KnowledgePolterghast.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("Polterghast"); Tooltip.SetDefault("A creature born of hatred and anger, formed by countless human souls with all of their energy entirely devoted to consuming others.\n" + "It seems a waste to have had such a potent source of power ravage mindlessly through these empty halls.\n" + - "Place in your inventory to gain increased item grab range."); + "Favorite this item to gain increased item grab range."); } public override void SetDefaults() @@ -34,7 +34,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.polterghastLore = true; + if (item.favorited) + modPlayer.polterghastLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeProvidence.cs b/Items/LoreItems/KnowledgeProvidence.cs index 4c6d5cb9e0..73be8e36d1 100644 --- a/Items/LoreItems/KnowledgeProvidence.cs +++ b/Items/LoreItems/KnowledgeProvidence.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("Providence, the Profaned Goddess"); Tooltip.SetDefault("A core surrounded by stone and flame, a simple origin and a simple goal.\n" + "What would have become of us had she not been defeated is a frightening concept to consider.\n" + - "Place in your inventory to imbue all projectiles with profaned flames, causing them to inflict extra damage.\n" + + "Favorite this item to imbue all projectiles with profaned flames, causing them to inflict extra damage.\n" + "However, your max life is decreased due to a part of your soul being required to fuel the profaned flames."); } @@ -35,7 +35,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.providenceLore = true; + if (item.favorited) + modPlayer.providenceLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeQueenBee.cs b/Items/LoreItems/KnowledgeQueenBee.cs index f4ed7c5ed5..6981252208 100644 --- a/Items/LoreItems/KnowledgeQueenBee.cs +++ b/Items/LoreItems/KnowledgeQueenBee.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.LoreItems { DisplayName.SetDefault("Queen Bee"); Tooltip.SetDefault("As crude as the giant insects are they can prove useful in certain situations...given the ability to control them.\n" + - "Place in your inventory to make small bees and weak hornets friendly."); + "Favorite this item to make small bees and weak hornets friendly."); } public override void SetDefaults() @@ -31,7 +31,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.queenBeeLore = true; + if (item.favorited) + modPlayer.queenBeeLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeRavager.cs b/Items/LoreItems/KnowledgeRavager.cs index 8a2b2fc156..736ed52ef6 100644 --- a/Items/LoreItems/KnowledgeRavager.cs +++ b/Items/LoreItems/KnowledgeRavager.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("Ravager"); Tooltip.SetDefault("The flesh golem constructed using twisted necromancy during the time of my conquest to counter my unstoppable forces.\n" + "Its creators were slaughtered by it moments after its conception. It is for the best that it has been destroyed.\n" + - "Place in your inventory to gain an increase to all damage, but at the cost of reduced wing flight time."); + "Favorite this item to gain an increase to all damage, but at the cost of reduced wing flight time."); } public override void SetDefaults() @@ -33,7 +33,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.ravagerLore = true; + if (item.favorited) + modPlayer.ravagerLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeSkeletron.cs b/Items/LoreItems/KnowledgeSkeletron.cs index 81a3cf3fdc..ece05bc9b5 100644 --- a/Items/LoreItems/KnowledgeSkeletron.cs +++ b/Items/LoreItems/KnowledgeSkeletron.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("Skeletron"); Tooltip.SetDefault("The curse is said to only affect the elderly.\n" + "After they are afflicted they become an immortal vessel for an ancient demon of the underworld.\n" + - "Place in your inventory to gain increased damage while in the dungeon.\n" + + "Favorite this item to gain increased damage while in the dungeon.\n" + "However, your max health is decreased due to Skeletron's curse."); } @@ -32,7 +32,7 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { - if (player.ZoneDungeon) + if (player.ZoneDungeon && item.favorited) { CalamityPlayer modPlayer = player.Calamity(); modPlayer.skeletronLore = true; diff --git a/Items/LoreItems/KnowledgeSkeletronPrime.cs b/Items/LoreItems/KnowledgeSkeletronPrime.cs index bbb95cff60..9e89adf1f1 100644 --- a/Items/LoreItems/KnowledgeSkeletronPrime.cs +++ b/Items/LoreItems/KnowledgeSkeletronPrime.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("Skeletron Prime"); Tooltip.SetDefault("What a silly and pointless contraption for something created with the essence of pure terror.\n" + "Draedon obviously took several liberties with its design...I am not impressed.\n" + - "Place in your inventory to gain a boost to your armor penetration.\n" + + "Favorite this item to gain a boost to your armor penetration.\n" + "However, your max acceleration is decreased due to you feeling heavier."); } @@ -33,7 +33,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.skeletronPrimeLore = true; + if (item.favorited) + modPlayer.skeletronPrimeLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeSlimeGod.cs b/Items/LoreItems/KnowledgeSlimeGod.cs index e980523588..0d60631de9 100644 --- a/Items/LoreItems/KnowledgeSlimeGod.cs +++ b/Items/LoreItems/KnowledgeSlimeGod.cs @@ -1,3 +1,4 @@ +using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Furniture.Trophies; using Terraria; @@ -13,7 +14,7 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("The Slime God"); Tooltip.SetDefault("It is a travesty, one of the most threatening biological terrors ever created.\n" + "If this creature were allowed to combine every slime on the planet it would become nearly unstoppable.\n" + - "Place in your inventory to become slimed and able to slide around on tiles quickly, at the cost of reduced defense.\n" + + "Favorite this item to become slimed and able to slide around on tiles quickly, at the cost of reduced defense.\n" + "This effect makes dashing more difficult and does not work with mounts."); } @@ -32,10 +33,13 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { - if (player.mount.Active) + CalamityPlayer modPlayer = player.Calamity(); + if (player.mount.Active || !item.favorited || modPlayer.slimeGodLoreProcessed) return; - if (player.dashDelay < 0) + modPlayer.slimeGodLoreProcessed = true; + + if (player.dashDelay < 0 || (player.velocity.Length() >= 11f && CalamityPlayer.areThereAnyDamnBosses)) //If you go over 52.8 mph player.velocity.X *= 0.9f; player.slippy2 = true; diff --git a/Items/LoreItems/KnowledgeTwins.cs b/Items/LoreItems/KnowledgeTwins.cs index 7314c7f2ba..c4a4cc77bf 100644 --- a/Items/LoreItems/KnowledgeTwins.cs +++ b/Items/LoreItems/KnowledgeTwins.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("The Twins"); Tooltip.SetDefault("The bio-mechanical watchers of the night, originally created as security using the souls extracted from human eyes.\n" + "These creatures did not belong in this world, it's best to be rid of them.\n" + - "Place in your inventory to gain invisibility and rogue bonuses at night.\n" + + "Favorite this item to gain invisibility and rogue bonuses at night.\n" + "However, your defense is reduced while above 50% life due to you feeling softer.\n" + "Your max acceleration is reduced while below 50% life due to you feeling heavier."); } @@ -34,7 +34,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.twinsLore = true; + if (item.favorited) + modPlayer.twinsLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeUnderworld.cs b/Items/LoreItems/KnowledgeUnderworld.cs index 4d86b79d3d..e4c3123334 100644 --- a/Items/LoreItems/KnowledgeUnderworld.cs +++ b/Items/LoreItems/KnowledgeUnderworld.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("The Underworld"); Tooltip.SetDefault("These obsidian and hellstone towers were once home to thousands of...'people'.\n" + "Unfortunately for them, they were twisted by their inner demons until they were beyond saving.\n" + - "Place in your inventory to prevent voodoo demons from spawning."); + "Favorite this item to prevent voodoo demons from dropping voodoo dolls."); } public override void SetDefaults() @@ -32,7 +32,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.underworldLore = true; + if (item.favorited) + modPlayer.underworldLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeWallofFlesh.cs b/Items/LoreItems/KnowledgeWallofFlesh.cs index 7f485be3dc..cff5e2c5b6 100644 --- a/Items/LoreItems/KnowledgeWallofFlesh.cs +++ b/Items/LoreItems/KnowledgeWallofFlesh.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.LoreItems Tooltip.SetDefault("I see the deed is done.\n" + "The unholy amalgamation of flesh and hatred has been defeated.\n" + "Prepare to face the terrors that lurk in the light and dark parts of this world.\n" + - "Place in your inventory to gain increased item grab range."); + "Favorite this item to gain increased item grab range."); } public override void SetDefaults() @@ -33,7 +33,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.wallOfFleshLore = true; + if (item.favorited) + modPlayer.wallOfFleshLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeYharon.cs b/Items/LoreItems/KnowledgeYharon.cs index 535ff8a48d..586afec642 100644 --- a/Items/LoreItems/KnowledgeYharon.cs +++ b/Items/LoreItems/KnowledgeYharon.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("Jungle Dragon, Yharon"); Tooltip.SetDefault("I would not be able to bear a world without my faithful companion by my side.\n" + "Fortunately, fate will have it so that it is a world I shall never have to see, for better or for worse.\n" + - "Place in your inventory to gain nearly-infinite wing flight time, but at the cost of a 25% decrease to all damage."); + "Favorite this item to gain nearly-infinite wing flight time, but at the cost of a 25% decrease to all damage."); } public override void SetDefaults() @@ -34,7 +34,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.yharonLore = true; + if (item.favorited) + modPlayer.yharonLore = true; } public override void AddRecipes() diff --git a/Items/Materials/BloodOrb.cs b/Items/Materials/BloodOrb.cs index 781a4ae398..22c6e82464 100644 --- a/Items/Materials/BloodOrb.cs +++ b/Items/Materials/BloodOrb.cs @@ -21,9 +21,9 @@ namespace CalamityMod.Items.Materials public override void Update(ref float gravity, ref float maxFallSpeed) { - float num = (float)Main.rand.Next(90, 111) * 0.01f; + float num = Main.rand.Next(90, 111) * 0.01f; num *= Main.essScale; - Lighting.AddLight((int)((item.position.X + (float)(item.width / 2)) / 16f), (int)((item.position.Y + (float)(item.height / 2)) / 16f), 0.75f * num, 0f, 0f); + Lighting.AddLight((int)((item.position.X + (item.width / 2)) / 16f), (int)((item.position.Y + (item.height / 2)) / 16f), 0.75f * num, 0f, 0f); } } } diff --git a/Items/Materials/CruptixBar.cs b/Items/Materials/CruptixBar.cs index 5ab4c43ff1..a9d7be51db 100644 --- a/Items/Materials/CruptixBar.cs +++ b/Items/Materials/CruptixBar.cs @@ -1,46 +1,73 @@ using CalamityMod.Items.Placeables.Ores; +using CalamityMod.Tiles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Tiles; namespace CalamityMod.Items.Materials { - public class CruptixBar : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Scoria Bar"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 6)); - Tooltip.SetDefault("The smoke feels warm\n" + - "Looks funky when placed"); //explaining the texture shown when placed. same bug as red lightning container and ectoheart tbh - } + public class CruptixBar : ModItem + { + private int frameCounter = 0; + private int frame = 0; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Scoria Bar"); + Tooltip.SetDefault("The smoke feels warm"); + } - public override void SetDefaults() - { - item.createTile = ModContent.TileType(); - item.noUseGraphic = true; //no use graphic because animated things swing their entire sheet - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTurn = true; - item.useAnimation = 15; - item.useTime = 10; - item.autoReuse = true; - item.consumable = true; - item.width = 30; - item.height = 24; - item.maxStack = 999; - item.value = Item.sellPrice(gold: 1, silver: 20); - item.rare = 8; - } + public override void SetDefaults() + { + item.createTile = ModContent.TileType(); + item.useStyle = ItemUseStyleID.SwingThrow; + item.useTurn = true; + item.useAnimation = 15; + item.useTime = 10; + item.autoReuse = true; + item.consumable = true; + item.width = 40; + item.height = 52; + item.maxStack = 999; + item.value = Item.sellPrice(gold: 1, silver: 20); + item.rare = 8; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.AdamantiteForge); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + internal Rectangle GetCurrentFrame() + { + int frameAmt = 6; + if (frameCounter >= 6) + { + frameCounter = -1; + frame = frame == frameAmt - 1 ? 0 : frame + 1; + } + frameCounter++; + return new Rectangle(0, item.height * frame, item.width, item.height); + } + + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Materials/CruptixBar_Animated"); + spriteBatch.Draw(texture, position, GetCurrentFrame(), Color.White, 0f, origin, scale, SpriteEffects.None, 0); + return false; + } + + public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) + { + Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Materials/CruptixBar_Animated"); + spriteBatch.Draw(texture, item.position - Main.screenPosition, GetCurrentFrame(), lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddTile(TileID.AdamantiteForge); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Materials/CruptixBar.png b/Items/Materials/CruptixBar.png index 670ec3fa3a..f1adabf4a3 100644 Binary files a/Items/Materials/CruptixBar.png and b/Items/Materials/CruptixBar.png differ diff --git a/Items/Materials/CruptixBar_Animated.png b/Items/Materials/CruptixBar_Animated.png new file mode 100644 index 0000000000..670ec3fa3a Binary files /dev/null and b/Items/Materials/CruptixBar_Animated.png differ diff --git a/Items/Materials/DarkPlasma.cs b/Items/Materials/DarkPlasma.cs index e3197be99c..3290acf117 100644 --- a/Items/Materials/DarkPlasma.cs +++ b/Items/Materials/DarkPlasma.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Items.Materials public override void SetStaticDefaults() { DisplayName.SetDefault("Dark Plasma"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(7, 8)); + Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(7, 4)); } public override void SetDefaults() diff --git a/Items/Materials/DarkPlasma.png b/Items/Materials/DarkPlasma.png index 96deb2b895..979258b919 100644 Binary files a/Items/Materials/DarkPlasma.png and b/Items/Materials/DarkPlasma.png differ diff --git a/Items/Materials/DubiousPlating.cs b/Items/Materials/DubiousPlating.cs new file mode 100644 index 0000000000..30d2dca04a --- /dev/null +++ b/Items/Materials/DubiousPlating.cs @@ -0,0 +1,24 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Materials +{ + public class DubiousPlating : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dubious Plating"); + } + + public override void SetDefaults() + { + item.width = 30; + item.height = 24; + item.maxStack = 999; + item.rare = ItemRarityID.Red; + item.Calamity().customRarity = CalamityRarity.DraedonRust; + item.value = Item.sellPrice(silver: 6); + } + } +} diff --git a/Items/Materials/DubiousPlating.png b/Items/Materials/DubiousPlating.png new file mode 100644 index 0000000000..5032233513 Binary files /dev/null and b/Items/Materials/DubiousPlating.png differ diff --git a/Items/Materials/EnergyCore.cs b/Items/Materials/EnergyCore.cs new file mode 100644 index 0000000000..8a2a3343fa --- /dev/null +++ b/Items/Materials/EnergyCore.cs @@ -0,0 +1,22 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Materials +{ + public class EnergyCore : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Energy Core"); + Tooltip.SetDefault("It pulses with energy"); + } + + public override void SetDefaults() + { + item.width = item.height = 22; + item.maxStack = 999; + item.value = Item.sellPrice(copper: 80); + item.rare = 1; + } + } +} diff --git a/Items/Materials/EnergyCore.png b/Items/Materials/EnergyCore.png new file mode 100644 index 0000000000..5b2ee40e5d Binary files /dev/null and b/Items/Materials/EnergyCore.png differ diff --git a/Items/Materials/GalacticaSingularity.cs b/Items/Materials/GalacticaSingularity.cs index 4111002d92..705513e4c4 100644 --- a/Items/Materials/GalacticaSingularity.cs +++ b/Items/Materials/GalacticaSingularity.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Materials { DisplayName.SetDefault("Galactica Singularity"); Tooltip.SetDefault("A shard of the cosmos"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(3, 8)); + Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(3, 24)); } public override void SetDefaults() diff --git a/Items/Materials/GalacticaSingularity.png b/Items/Materials/GalacticaSingularity.png index b9817b6e13..cdf70f5cf0 100644 Binary files a/Items/Materials/GalacticaSingularity.png and b/Items/Materials/GalacticaSingularity.png differ diff --git a/Items/Materials/MeldBlob.png b/Items/Materials/MeldBlob.png index 48341ed30c..a24387680f 100644 Binary files a/Items/Materials/MeldBlob.png and b/Items/Materials/MeldBlob.png differ diff --git a/Items/Materials/MeldiateBar.cs b/Items/Materials/MeldiateBar.cs index 570ff475ff..e9d66056da 100644 --- a/Items/Materials/MeldiateBar.cs +++ b/Items/Materials/MeldiateBar.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Items.Materials { public override void SetStaticDefaults() { - DisplayName.SetDefault("Meld Bar"); + DisplayName.SetDefault("Meld Construct"); } public override void SetDefaults() @@ -23,9 +23,8 @@ namespace CalamityMod.Items.Materials public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Ectoplasm); - recipe.AddIngredient(ItemID.HallowedBar); recipe.AddIngredient(ModContent.ItemType(), 6); + recipe.AddIngredient(ModContent.ItemType(), 3); recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this, 3); recipe.AddRecipe(); diff --git a/Items/Materials/MeldiateBar.png b/Items/Materials/MeldiateBar.png index d2067434db..1150c8db8f 100644 Binary files a/Items/Materials/MeldiateBar.png and b/Items/Materials/MeldiateBar.png differ diff --git a/Items/Materials/MysteriousCircuitry.cs b/Items/Materials/MysteriousCircuitry.cs new file mode 100644 index 0000000000..374634ce67 --- /dev/null +++ b/Items/Materials/MysteriousCircuitry.cs @@ -0,0 +1,24 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Materials +{ + public class MysteriousCircuitry : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mysterious Circuitry"); + } + + public override void SetDefaults() + { + item.width = 30; + item.height = 24; + item.maxStack = 999; + item.rare = ItemRarityID.Red; + item.Calamity().customRarity = CalamityRarity.DraedonRust; + item.value = Item.sellPrice(silver: 6); + } + } +} diff --git a/Items/Materials/MysteriousCircuitry.png b/Items/Materials/MysteriousCircuitry.png new file mode 100644 index 0000000000..3ca5918a2c Binary files /dev/null and b/Items/Materials/MysteriousCircuitry.png differ diff --git a/Items/Materials/TitanHeart.cs b/Items/Materials/TitanHeart.cs new file mode 100644 index 0000000000..80eafd1844 --- /dev/null +++ b/Items/Materials/TitanHeart.cs @@ -0,0 +1,23 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Materials +{ + public class TitanHeart : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Titan Heart"); + Tooltip.SetDefault("Also used at the Astral Beacon"); + } + + public override void SetDefaults() + { + item.width = 10; + item.height = 10; + item.maxStack = 999; + item.value = Item.sellPrice(gold: 1); + item.rare = 5; + } + } +} diff --git a/Items/Materials/TitanHeart.png b/Items/Materials/TitanHeart.png new file mode 100644 index 0000000000..ad923c8224 Binary files /dev/null and b/Items/Materials/TitanHeart.png differ diff --git a/Items/Materials/UnholyCore.png b/Items/Materials/UnholyCore.png index 480bddf481..d13404b0e2 100644 Binary files a/Items/Materials/UnholyCore.png and b/Items/Materials/UnholyCore.png differ diff --git a/Items/Materials/WulfrumShard.cs b/Items/Materials/WulfrumShard.cs index e7975c53b3..bcdec89051 100644 --- a/Items/Materials/WulfrumShard.cs +++ b/Items/Materials/WulfrumShard.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Items.Materials { public override void SetStaticDefaults() { - DisplayName.SetDefault("Wulfrum Shard"); + DisplayName.SetDefault("Wulfrum Metal Scrap"); } public override void SetDefaults() diff --git a/Items/Materials/WulfrumShard.png b/Items/Materials/WulfrumShard.png index ffe827c29e..384f3c9372 100644 Binary files a/Items/Materials/WulfrumShard.png and b/Items/Materials/WulfrumShard.png differ diff --git a/Items/NormalityRelocator.cs b/Items/NormalityRelocator.cs index f45b610a90..e83c8d9212 100644 --- a/Items/NormalityRelocator.cs +++ b/Items/NormalityRelocator.cs @@ -1,5 +1,5 @@ using CalamityMod.CalPlayer; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Plates; using CalamityMod.Items.Placeables.Ores; using System.Collections.Generic; using Terraria; diff --git a/Items/PermanentBoosters/BloodOrange.cs b/Items/PermanentBoosters/BloodOrange.cs index 66069735ac..61de1eacc5 100644 --- a/Items/PermanentBoosters/BloodOrange.cs +++ b/Items/PermanentBoosters/BloodOrange.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.PermanentBoosters item.width = 20; item.height = 20; item.useAnimation = 30; - item.rare = 5; + item.rare = ItemRarityID.LightPurple; item.useTime = 30; item.useStyle = ItemUseStyleID.HoldingUp; item.UseSound = SoundID.Item4; @@ -57,12 +57,12 @@ namespace CalamityMod.Items.PermanentBoosters { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.LifeFruit, 5); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ItemID.SoulofNight, 10); - recipe.AddIngredient(ItemID.SoulofLight, 10); - recipe.AddTile(TileID.MythrilAnvil); + recipe.AddIngredient(ItemID.OrangeBloodroot); + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddIngredient(ItemID.SoulofMight, 5); + recipe.AddIngredient(ItemID.SoulofSight, 5); + recipe.AddIngredient(ItemID.SoulofFright, 5); + recipe.AddTile(TileID.MythrilAnvil); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/PermanentBoosters/Dragonfruit.cs b/Items/PermanentBoosters/Dragonfruit.cs index 7b73d56c32..958ee7bf41 100644 --- a/Items/PermanentBoosters/Dragonfruit.cs +++ b/Items/PermanentBoosters/Dragonfruit.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.PermanentBoosters item.useStyle = ItemUseStyleID.HoldingUp; item.UseSound = SoundID.Item4; item.consumable = true; - item.rare = 10; + item.rare = ItemRarityID.Red; item.Calamity().customRarity = CalamityRarity.Violet; } @@ -59,11 +59,10 @@ namespace CalamityMod.Items.PermanentBoosters { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.LifeFruit, 5); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddIngredient(ItemID.SkyBlueFlower); recipe.AddIngredient(ItemID.FragmentSolar, 15); - recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); diff --git a/Items/PermanentBoosters/Ectoheart.cs b/Items/PermanentBoosters/Ectoheart.cs index e187a6d4b0..20f868f541 100644 --- a/Items/PermanentBoosters/Ectoheart.cs +++ b/Items/PermanentBoosters/Ectoheart.cs @@ -9,52 +9,73 @@ using Terraria.ModLoader; namespace CalamityMod.Items.PermanentBoosters { public class Ectoheart : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ectoheart"); - Tooltip.SetDefault("Permanently makes Adrenaline Mode take 5 less seconds to charge\n" + - "Revengeance drop"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(8, 3)); - } + { + private int frameCounter = 0; + private int frame = 0; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ectoheart"); + Tooltip.SetDefault("Permanently makes Adrenaline Mode take 5 less seconds to charge\n" + + "Revengeance drop"); + } - public override void SetDefaults() - { - item.width = 42; - item.height = 44; - item.useAnimation = 30; - item.useTime = 30; - item.useStyle = ItemUseStyleID.HoldingUp; - item.UseSound = SoundID.Item122; - item.consumable = true; - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.PureGreen; - } + public override void SetDefaults() + { + item.width = 42; + item.height = 44; + item.useAnimation = 30; + item.useTime = 30; + item.useStyle = ItemUseStyleID.HoldingUp; + item.UseSound = SoundID.Item122; + item.consumable = true; + item.rare = 10; + item.Calamity().customRarity = CalamityRarity.PureGreen; + } - public override bool CanUseItem(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - if (modPlayer.adrenalineBoostThree) - { - return false; - } - return true; - } + public override bool CanUseItem(Player player) => !player.Calamity().adrenalineBoostThree; - public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) - { - CalamityUtils.DrawItemGlowmask(item, spriteBatch, 3, rotation, ModContent.GetTexture("CalamityMod/Items/PermanentBoosters/EctoheartGlow")); - } + internal Rectangle GetCurrentFrame(bool frameCounterUp = true) + { + int frameAmt = 3; + if (frameCounter >= 8) + { + frameCounter = -1; + frame = frame == frameAmt - 1 ? 0 : frame + 1; + } + if (frameCounterUp) + frameCounter++; + return new Rectangle(0, item.height * frame, item.width, item.height); + } - public override bool UseItem(Player player) - { - if (player.itemAnimation > 0 && player.itemTime == 0) - { - player.itemTime = item.useTime; - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.adrenalineBoostThree = true; - } - return true; - } - } + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + Texture2D texture = ModContent.GetTexture("CalamityMod/Items/PermanentBoosters/Ectoheart_Animated"); + spriteBatch.Draw(texture, position, GetCurrentFrame(), Color.White, 0f, origin, scale, SpriteEffects.None, 0); + return false; + } + + public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) + { + Texture2D texture = ModContent.GetTexture("CalamityMod/Items/PermanentBoosters/Ectoheart_Animated"); + spriteBatch.Draw(texture, item.position - Main.screenPosition, GetCurrentFrame(), lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + return false; + } + + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Texture2D texture = ModContent.GetTexture("CalamityMod/Items/PermanentBoosters/EctoheartGlow"); + spriteBatch.Draw(texture, item.position - Main.screenPosition, GetCurrentFrame(false), Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + } + + public override bool UseItem(Player player) + { + if (player.itemAnimation > 0 && player.itemTime == 0) + { + player.itemTime = item.useTime; + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.adrenalineBoostThree = true; + } + return true; + } + } } diff --git a/Items/PermanentBoosters/Ectoheart.png b/Items/PermanentBoosters/Ectoheart.png index 26d587ff6e..e03dbaa21e 100644 Binary files a/Items/PermanentBoosters/Ectoheart.png and b/Items/PermanentBoosters/Ectoheart.png differ diff --git a/Items/PermanentBoosters/Ectoheart_Animated.png b/Items/PermanentBoosters/Ectoheart_Animated.png new file mode 100644 index 0000000000..26d587ff6e Binary files /dev/null and b/Items/PermanentBoosters/Ectoheart_Animated.png differ diff --git a/Items/PermanentBoosters/Elderberry.cs b/Items/PermanentBoosters/Elderberry.cs index 7f5293d1f0..6c578c6593 100644 --- a/Items/PermanentBoosters/Elderberry.cs +++ b/Items/PermanentBoosters/Elderberry.cs @@ -21,8 +21,9 @@ namespace CalamityMod.Items.PermanentBoosters item.width = 20; item.height = 20; item.useAnimation = 30; - item.rare = 10; - item.useTime = 30; + item.rare = ItemRarityID.Red; + item.Calamity().customRarity = CalamityRarity.Turquoise; + item.useTime = 30; item.useStyle = ItemUseStyleID.HoldingUp; item.UseSound = SoundID.Item4; item.consumable = true; @@ -57,8 +58,9 @@ namespace CalamityMod.Items.PermanentBoosters { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.LifeFruit, 5); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ItemID.LunarBar, 10); + recipe.AddIngredient(ItemID.BlueBerries); + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddIngredient(ModContent.ItemType(), 10); recipe.AddIngredient(ModContent.ItemType(), 20); recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); diff --git a/Items/PermanentBoosters/MiracleFruit.cs b/Items/PermanentBoosters/MiracleFruit.cs index 8db3c03a1e..a90671f387 100644 --- a/Items/PermanentBoosters/MiracleFruit.cs +++ b/Items/PermanentBoosters/MiracleFruit.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.PermanentBoosters item.width = 20; item.height = 20; item.useAnimation = 30; - item.rare = 7; + item.rare = ItemRarityID.Yellow; item.useTime = 30; item.useStyle = ItemUseStyleID.HoldingUp; item.UseSound = SoundID.Item4; @@ -58,9 +58,10 @@ namespace CalamityMod.Items.PermanentBoosters { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.LifeFruit, 5); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 20); + recipe.AddIngredient(ItemID.TealMushroom); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddIngredient(ModContent.ItemType(), 10); recipe.AddTile(TileID.MythrilAnvil); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/PermanentBoosters/RedLightningContainer.cs b/Items/PermanentBoosters/RedLightningContainer.cs index eaf3a9e1a9..99a9c38cd4 100644 --- a/Items/PermanentBoosters/RedLightningContainer.cs +++ b/Items/PermanentBoosters/RedLightningContainer.cs @@ -1,4 +1,6 @@ using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -6,48 +8,74 @@ using Terraria.ModLoader; namespace CalamityMod.Items.PermanentBoosters { - public class RedLightningContainer : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Red Lightning Container"); - Tooltip.SetDefault("Permanently makes Rage Mode do 15% more damage\n" + - "Revengeance drop"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(5, 6)); - } + public class RedLightningContainer : ModItem + { + private int frameCounter = 0; + private int frame = 0; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Red Lightning Container"); + Tooltip.SetDefault("Permanently makes Rage Mode do 15% more damage\n" + + "Revengeance drop"); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.useAnimation = 30; - item.useTime = 30; - item.useStyle = ItemUseStyleID.HoldingUp; - item.UseSound = SoundID.Item122; - item.consumable = true; - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.Turquoise; - } + public override void SetDefaults() + { + item.width = 30; + item.height = 40; + item.useAnimation = 30; + item.useTime = 30; + item.useStyle = ItemUseStyleID.HoldingUp; + item.UseSound = SoundID.Item122; + item.consumable = true; + item.rare = 10; + item.Calamity().customRarity = CalamityRarity.Turquoise; + } - public override bool CanUseItem(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - if (modPlayer.rageBoostThree) - { - return false; - } - return true; - } + public override bool CanUseItem(Player player) => !player.Calamity().rageBoostThree; - public override bool UseItem(Player player) - { - if (player.itemAnimation > 0 && player.itemTime == 0) - { - player.itemTime = item.useTime; - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.rageBoostThree = true; - } - return true; - } - } + internal Rectangle GetCurrentFrame(bool frameCounterUp = true) + { + int frameAmt = 6; + if (frameCounter >= 5) + { + frameCounter = -1; + frame = frame == frameAmt - 1 ? 0 : frame + 1; + } + if (frameCounterUp) + frameCounter++; + return new Rectangle(0, item.height * frame, item.width, item.height); + } + + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + Texture2D texture = ModContent.GetTexture("CalamityMod/Items/PermanentBoosters/RedLightningContainer_Animated"); + spriteBatch.Draw(texture, position, GetCurrentFrame(), Color.White, 0f, origin, scale, SpriteEffects.None, 0); + return false; + } + + public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) + { + Texture2D texture = ModContent.GetTexture("CalamityMod/Items/PermanentBoosters/RedLightningContainer_Animated"); + spriteBatch.Draw(texture, item.position - Main.screenPosition, GetCurrentFrame(), lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + return false; + } + + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Texture2D texture = ModContent.GetTexture("CalamityMod/Items/PermanentBoosters/RedLightningContainerGlow"); + spriteBatch.Draw(texture, item.position - Main.screenPosition, GetCurrentFrame(false), Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + } + + public override bool UseItem(Player player) + { + if (player.itemAnimation > 0 && player.itemTime == 0) + { + player.itemTime = item.useTime; + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.rageBoostThree = true; + } + return true; + } + } } diff --git a/Items/PermanentBoosters/RedLightningContainer.png b/Items/PermanentBoosters/RedLightningContainer.png index c859aca470..e47f72a848 100644 Binary files a/Items/PermanentBoosters/RedLightningContainer.png and b/Items/PermanentBoosters/RedLightningContainer.png differ diff --git a/Items/PermanentBoosters/RedLightningContainerGlow.png b/Items/PermanentBoosters/RedLightningContainerGlow.png new file mode 100644 index 0000000000..523b6d4572 Binary files /dev/null and b/Items/PermanentBoosters/RedLightningContainerGlow.png differ diff --git a/Items/PermanentBoosters/RedLightningContainer_Animated.png b/Items/PermanentBoosters/RedLightningContainer_Animated.png new file mode 100644 index 0000000000..c859aca470 Binary files /dev/null and b/Items/PermanentBoosters/RedLightningContainer_Animated.png differ diff --git a/Items/Pets/ChromaticOrb.cs b/Items/Pets/ChromaticOrb.cs new file mode 100644 index 0000000000..2880f8a9a3 --- /dev/null +++ b/Items/Pets/ChromaticOrb.cs @@ -0,0 +1,35 @@ +using CalamityMod.Buffs.Pets; +using CalamityMod.Projectiles.Pets; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Pets +{ + public class ChromaticOrb : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Chromatic Orb"); + Tooltip.SetDefault("It glows warmly in your hand\n" + + "Summons an ancient dragon light pet that highlights nearby enemies and danger sources\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.Calamity().customRarity = CalamityRarity.Dedicated; + } + + public override void UseStyle(Player player) + { + if (player.whoAmI == Main.myPlayer && player.itemTime == 0) + { + player.AddBuff(item.buffType, 3600, true); + } + } + } +} diff --git a/Items/Pets/ChromaticOrb.png b/Items/Pets/ChromaticOrb.png new file mode 100644 index 0000000000..71b117535b Binary files /dev/null and b/Items/Pets/ChromaticOrb.png differ diff --git a/Items/Pets/RotomRemote.cs b/Items/Pets/RotomRemote.cs index a1c7771531..6122e39750 100644 --- a/Items/Pets/RotomRemote.cs +++ b/Items/Pets/RotomRemote.cs @@ -10,39 +10,39 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Pets { - public class RotomRemote : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Triboluminescent Etomer"); - Tooltip.SetDefault("Summons an electric troublemaker\n" + + public class RotomRemote : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Triboluminescent Etomer"); + Tooltip.SetDefault("Summons an electric troublemaker\n" + "A little note is attached:\n" + "Thank you, Aloe! Very much appreciated from Ben"); - } + } - public override void SetDefaults() - { - item.damage = 0; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.width = 30; - item.height = 34; - item.value = Item.buyPrice(0, 4, 0, 0); - item.UseSound = SoundID.Item113; - item.shoot = ModContent.ProjectileType(); - item.buffType = ModContent.BuffType(); - item.rare = 3; - } + public override void SetDefaults() + { + item.damage = 0; + item.useTime = item.useAnimation = 20; + item.shoot = ModContent.ProjectileType(); + item.buffType = ModContent.BuffType(); - public override void UseStyle(Player player) - { - if (player.whoAmI == Main.myPlayer && player.itemTime == 0) - { - player.AddBuff(item.buffType, 3600, true); - } - } + item.width = 30; + item.height = 34; + item.useStyle = ItemUseStyleID.SwingThrow; + item.noMelee = true; + item.UseSound = SoundID.Item113; + item.value = Item.buyPrice(0, 4, 0, 0); + item.rare = 3; + } + + public override void UseStyle(Player player) + { + if (player.whoAmI == Main.myPlayer && player.itemTime == 0) + { + player.AddBuff(item.buffType, 3600, true); + } + } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { @@ -51,15 +51,15 @@ namespace CalamityMod.Items.Pets spriteBatch.Draw(texture, item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddRecipeGroup("AnyGoldBar", 8); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddRecipeGroup("AnyGoldBar", 8); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Pets/StrangeOrb.cs b/Items/Pets/StrangeOrb.cs index 8dfb85d620..6a95995312 100644 --- a/Items/Pets/StrangeOrb.cs +++ b/Items/Pets/StrangeOrb.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Pets public override void SetStaticDefaults() { DisplayName.SetDefault("Strange Orb"); - Tooltip.SetDefault("Summons a young Siren light pet\n" + + Tooltip.SetDefault("Summons a miniature Ocean Spirit light pet\n" + "Provides a large amount of light while underwater"); } diff --git a/Items/Pets/StrangeOrb.png b/Items/Pets/StrangeOrb.png index 2debd5f599..c7ab860ffb 100644 Binary files a/Items/Pets/StrangeOrb.png and b/Items/Pets/StrangeOrb.png differ diff --git a/Items/Placeables/Banners/AngryDogBanner.png b/Items/Placeables/Banners/AngryDogBanner.png index b8cfc63af3..5c1a18f578 100644 Binary files a/Items/Placeables/Banners/AngryDogBanner.png and b/Items/Placeables/Banners/AngryDogBanner.png differ diff --git a/Items/Placeables/Banners/ArmoredDiggerBanner.png b/Items/Placeables/Banners/ArmoredDiggerBanner.png index 4fd60a922f..b7b032ef0f 100644 Binary files a/Items/Placeables/Banners/ArmoredDiggerBanner.png and b/Items/Placeables/Banners/ArmoredDiggerBanner.png differ diff --git a/Items/Placeables/Banners/BOHLDOHRBanner.png b/Items/Placeables/Banners/BOHLDOHRBanner.png index 9cb09808a7..a02f92a9cd 100644 Binary files a/Items/Placeables/Banners/BOHLDOHRBanner.png and b/Items/Placeables/Banners/BOHLDOHRBanner.png differ diff --git a/Items/Placeables/Banners/BoxJellyfishBanner.png b/Items/Placeables/Banners/BoxJellyfishBanner.png index 1c9e780ef7..0dd5b68d94 100644 Binary files a/Items/Placeables/Banners/BoxJellyfishBanner.png and b/Items/Placeables/Banners/BoxJellyfishBanner.png differ diff --git a/Items/Placeables/Banners/ChaoticPufferBanner.png b/Items/Placeables/Banners/ChaoticPufferBanner.png index 88cc1605dd..a70e888557 100644 Binary files a/Items/Placeables/Banners/ChaoticPufferBanner.png and b/Items/Placeables/Banners/ChaoticPufferBanner.png differ diff --git a/Items/Placeables/Banners/DevilFishBanner.png b/Items/Placeables/Banners/DevilFishBanner.png index b4323b6d4c..d76eb7b755 100644 Binary files a/Items/Placeables/Banners/DevilFishBanner.png and b/Items/Placeables/Banners/DevilFishBanner.png differ diff --git a/Items/Placeables/Banners/EarthElementalBanner.png b/Items/Placeables/Banners/EarthElementalBanner.png index 75373670a4..81a0a659b6 100644 Binary files a/Items/Placeables/Banners/EarthElementalBanner.png and b/Items/Placeables/Banners/EarthElementalBanner.png differ diff --git a/Items/Placeables/Banners/EutrophicRayBanner.png b/Items/Placeables/Banners/EutrophicRayBanner.png index 29f9d317d9..64815b0761 100644 Binary files a/Items/Placeables/Banners/EutrophicRayBanner.png and b/Items/Placeables/Banners/EutrophicRayBanner.png differ diff --git a/Items/Placeables/Banners/HeatSpiritBanner.png b/Items/Placeables/Banners/HeatSpiritBanner.png index 5c92c8e3ab..0abe81d3e6 100644 Binary files a/Items/Placeables/Banners/HeatSpiritBanner.png and b/Items/Placeables/Banners/HeatSpiritBanner.png differ diff --git a/Items/Placeables/Banners/IceClasperBanner.png b/Items/Placeables/Banners/IceClasperBanner.png index f15f42d01b..ddccd21377 100644 Binary files a/Items/Placeables/Banners/IceClasperBanner.png and b/Items/Placeables/Banners/IceClasperBanner.png differ diff --git a/Items/Placeables/Banners/ImpiousImmolatorBanner.png b/Items/Placeables/Banners/ImpiousImmolatorBanner.png index c965cd5f5e..08b5ef3545 100644 Binary files a/Items/Placeables/Banners/ImpiousImmolatorBanner.png and b/Items/Placeables/Banners/ImpiousImmolatorBanner.png differ diff --git a/Items/Placeables/Banners/MorayEelBanner.png b/Items/Placeables/Banners/MorayEelBanner.png index 4035553cc5..bea97d3130 100644 Binary files a/Items/Placeables/Banners/MorayEelBanner.png and b/Items/Placeables/Banners/MorayEelBanner.png differ diff --git a/Items/Placeables/Banners/ParaseaBanner.png b/Items/Placeables/Banners/ParaseaBanner.png index aa91173ee8..e00c958787 100644 Binary files a/Items/Placeables/Banners/ParaseaBanner.png and b/Items/Placeables/Banners/ParaseaBanner.png differ diff --git a/Items/Placeables/Banners/ProfanedEnergyBanner.png b/Items/Placeables/Banners/ProfanedEnergyBanner.png index 09a757e069..86f88508c8 100644 Binary files a/Items/Placeables/Banners/ProfanedEnergyBanner.png and b/Items/Placeables/Banners/ProfanedEnergyBanner.png differ diff --git a/Items/Placeables/Banners/StormlionBanner.png b/Items/Placeables/Banners/StormlionBanner.png index 3e02a053f5..23afbabbfa 100644 Binary files a/Items/Placeables/Banners/StormlionBanner.png and b/Items/Placeables/Banners/StormlionBanner.png differ diff --git a/Items/Placeables/Banners/ViperfishBanner.png b/Items/Placeables/Banners/ViperfishBanner.png index 67337bf26b..e247f7fc38 100644 Binary files a/Items/Placeables/Banners/ViperfishBanner.png and b/Items/Placeables/Banners/ViperfishBanner.png differ diff --git a/Items/Placeables/Banners/WulfrumDroneBanner.png b/Items/Placeables/Banners/WulfrumDroneBanner.png index 42706a4b58..2bad292814 100644 Binary files a/Items/Placeables/Banners/WulfrumDroneBanner.png and b/Items/Placeables/Banners/WulfrumDroneBanner.png differ diff --git a/Items/Placeables/Banners/WulfrumGyratorBanner.cs b/Items/Placeables/Banners/WulfrumGyratorBanner.cs new file mode 100644 index 0000000000..b2e15cf919 --- /dev/null +++ b/Items/Placeables/Banners/WulfrumGyratorBanner.cs @@ -0,0 +1,26 @@ +using CalamityMod.Tiles; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.Banners +{ + public class WulfrumGyratorBanner : 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 = ItemUseStyleID.SwingThrow; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = ModContent.TileType(); + item.placeStyle = 123; + } + } +} diff --git a/Items/Placeables/Banners/WulfrumGyratorBanner.png b/Items/Placeables/Banners/WulfrumGyratorBanner.png new file mode 100644 index 0000000000..5e24c1fe4c Binary files /dev/null and b/Items/Placeables/Banners/WulfrumGyratorBanner.png differ diff --git a/Items/Placeables/Banners/WulfrumHovercraftBanner.cs b/Items/Placeables/Banners/WulfrumHovercraftBanner.cs new file mode 100644 index 0000000000..bef6437bbb --- /dev/null +++ b/Items/Placeables/Banners/WulfrumHovercraftBanner.cs @@ -0,0 +1,26 @@ +using CalamityMod.Tiles; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.Banners +{ + public class WulfrumHovercraftBanner : 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 = ItemUseStyleID.SwingThrow; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = ModContent.TileType(); + item.placeStyle = 124; + } + } +} diff --git a/Items/Placeables/Banners/WulfrumHovercraftBanner.png b/Items/Placeables/Banners/WulfrumHovercraftBanner.png new file mode 100644 index 0000000000..561441a62c Binary files /dev/null and b/Items/Placeables/Banners/WulfrumHovercraftBanner.png differ diff --git a/Items/Placeables/Banners/WulfrumPylonBanner.cs b/Items/Placeables/Banners/WulfrumPylonBanner.cs new file mode 100644 index 0000000000..eff89d3773 --- /dev/null +++ b/Items/Placeables/Banners/WulfrumPylonBanner.cs @@ -0,0 +1,26 @@ +using CalamityMod.Tiles; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.Banners +{ + public class WulfrumPylonBanner : 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 = ItemUseStyleID.SwingThrow; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = ModContent.TileType(); + item.placeStyle = 126; + } + } +} diff --git a/Items/Placeables/Banners/WulfrumPylonBanner.png b/Items/Placeables/Banners/WulfrumPylonBanner.png new file mode 100644 index 0000000000..6e547011a3 Binary files /dev/null and b/Items/Placeables/Banners/WulfrumPylonBanner.png differ diff --git a/Items/Placeables/Banners/WulfrumRoverBanner.cs b/Items/Placeables/Banners/WulfrumRoverBanner.cs new file mode 100644 index 0000000000..00af6ecb9c --- /dev/null +++ b/Items/Placeables/Banners/WulfrumRoverBanner.cs @@ -0,0 +1,26 @@ +using CalamityMod.Tiles; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.Banners +{ + public class WulfrumRoverBanner : 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 = ItemUseStyleID.SwingThrow; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = ModContent.TileType(); + item.placeStyle = 125; + } + } +} diff --git a/Items/Placeables/Banners/WulfrumRoverBanner.png b/Items/Placeables/Banners/WulfrumRoverBanner.png new file mode 100644 index 0000000000..3852b1568c Binary files /dev/null and b/Items/Placeables/Banners/WulfrumRoverBanner.png differ diff --git a/Items/Placeables/BrimstoneSlag.cs b/Items/Placeables/BrimstoneSlag.cs index 772a990283..fbaaaba216 100644 --- a/Items/Placeables/BrimstoneSlag.cs +++ b/Items/Placeables/BrimstoneSlag.cs @@ -1,5 +1,6 @@ -using Terraria.ModLoader; +using CalamityMod.Items.Placeables.Walls; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables { @@ -25,5 +26,14 @@ namespace CalamityMod.Items.Placeables item.value = 1000; item.rare = 3; } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 4); + recipe.AddTile(TileID.WorkBenches); + recipe.SetResult(this); + recipe.AddRecipe(); + } } } diff --git a/Items/Placeables/Cinderplate.png b/Items/Placeables/Cinderplate.png deleted file mode 100644 index 7cdf92d326..0000000000 Binary files a/Items/Placeables/Cinderplate.png and /dev/null differ diff --git a/Items/Placeables/DraedonStructures/HazardChevronPanels.cs b/Items/Placeables/DraedonStructures/HazardChevronPanels.cs new file mode 100644 index 0000000000..335d5d507e --- /dev/null +++ b/Items/Placeables/DraedonStructures/HazardChevronPanels.cs @@ -0,0 +1,42 @@ +using CalamityMod.Items.Placeables.Walls.DraedonStructures; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.DraedonStructures +{ + public class HazardChevronPanels : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = ItemUseStyleID.SwingThrow; + item.consumable = true; + item.createTile = ModContent.TileType(); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddIngredient(ItemID.YellowPaint); + recipe.AddIngredient(ItemID.BlackPaint); + recipe.SetResult(this, 10); + recipe.AddTile(TileID.WorkBenches); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 4); + recipe.SetResult(this, 1); + recipe.AddTile(TileID.WorkBenches); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Placeables/DraedonStructures/HazardChevronPanels.png b/Items/Placeables/DraedonStructures/HazardChevronPanels.png new file mode 100644 index 0000000000..4d1492148b Binary files /dev/null and b/Items/Placeables/DraedonStructures/HazardChevronPanels.png differ diff --git a/Items/Placeables/DraedonStructures/LaboratoryPanels.cs b/Items/Placeables/DraedonStructures/LaboratoryPanels.cs new file mode 100644 index 0000000000..cf90832ce3 --- /dev/null +++ b/Items/Placeables/DraedonStructures/LaboratoryPanels.cs @@ -0,0 +1,46 @@ +using CalamityMod.Items.Placeables.Walls.DraedonStructures; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.DraedonStructures +{ + public class LaboratoryPanels : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = ItemUseStyleID.SwingThrow; + item.consumable = true; + item.createTile = ModContent.TileType(); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.IronBar); + recipe.anyIronBar = true; + recipe.AddIngredient(ItemID.StoneBlock, 3); + recipe.SetResult(this, 3); + recipe.AddTile(TileID.HeavyWorkBench); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 2); + recipe.SetResult(this, 1); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 4); + recipe.SetResult(this, 1); + recipe.AddTile(TileID.WorkBenches); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Placeables/DraedonStructures/LaboratoryPanels.png b/Items/Placeables/DraedonStructures/LaboratoryPanels.png new file mode 100644 index 0000000000..a6e25fe5a4 Binary files /dev/null and b/Items/Placeables/DraedonStructures/LaboratoryPanels.png differ diff --git a/Items/Placeables/DraedonStructures/LaboratoryPipePlating.cs b/Items/Placeables/DraedonStructures/LaboratoryPipePlating.cs new file mode 100644 index 0000000000..9e5f49715c --- /dev/null +++ b/Items/Placeables/DraedonStructures/LaboratoryPipePlating.cs @@ -0,0 +1,35 @@ +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.DraedonStructures +{ + public class LaboratoryPipePlating : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = ItemUseStyleID.SwingThrow; + item.consumable = true; + item.createTile = ModContent.TileType(); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 1); + recipe.AddIngredient(ModContent.ItemType(), 1); + recipe.SetResult(this, 2); + recipe.AddTile(TileID.Anvils); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Placeables/DraedonStructures/LaboratoryPipePlating.png b/Items/Placeables/DraedonStructures/LaboratoryPipePlating.png new file mode 100644 index 0000000000..eccf01140e Binary files /dev/null and b/Items/Placeables/DraedonStructures/LaboratoryPipePlating.png differ diff --git a/Items/Placeables/DraedonStructures/LaboratoryPlating.cs b/Items/Placeables/DraedonStructures/LaboratoryPlating.cs new file mode 100644 index 0000000000..8f977a068a --- /dev/null +++ b/Items/Placeables/DraedonStructures/LaboratoryPlating.cs @@ -0,0 +1,57 @@ +using CalamityMod.Items.Placeables.Walls.DraedonStructures; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.DraedonStructures +{ + public class LaboratoryPlating : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = ItemUseStyleID.SwingThrow; + item.consumable = true; + item.createTile = ModContent.TileType(); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.IronBar); + recipe.anyIronBar = true; + recipe.AddIngredient(ItemID.StoneBlock, 3); + recipe.SetResult(this, 3); + recipe.AddTile(TileID.HeavyWorkBench); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 1); + recipe.SetResult(this, 1); + recipe.AddTile(TileID.Anvils); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 4); + recipe.SetResult(this, 1); + recipe.AddTile(TileID.WorkBenches); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 4); + recipe.SetResult(this, 1); + recipe.AddTile(TileID.WorkBenches); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 4); + recipe.SetResult(this, 1); + recipe.AddTile(TileID.WorkBenches); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Placeables/DraedonStructures/LaboratoryPlating.png b/Items/Placeables/DraedonStructures/LaboratoryPlating.png new file mode 100644 index 0000000000..128fb2992c Binary files /dev/null and b/Items/Placeables/DraedonStructures/LaboratoryPlating.png differ diff --git a/Items/Placeables/DraedonStructures/LaboratoryShelf.cs b/Items/Placeables/DraedonStructures/LaboratoryShelf.cs new file mode 100644 index 0000000000..d27a4cf6d9 --- /dev/null +++ b/Items/Placeables/DraedonStructures/LaboratoryShelf.cs @@ -0,0 +1,37 @@ +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.DraedonStructures +{ + public class LaboratoryShelf : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = ItemUseStyleID.SwingThrow; + item.consumable = true; + item.createTile = ModContent.TileType(); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 1); + recipe.SetResult(this, 2); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 1); + recipe.SetResult(this, 1); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Placeables/DraedonStructures/LaboratoryShelf.png b/Items/Placeables/DraedonStructures/LaboratoryShelf.png new file mode 100644 index 0000000000..b1bdf5ff8c Binary files /dev/null and b/Items/Placeables/DraedonStructures/LaboratoryShelf.png differ diff --git a/Items/Placeables/DraedonStructures/RustedPipes.cs b/Items/Placeables/DraedonStructures/RustedPipes.cs new file mode 100644 index 0000000000..ffba168da7 --- /dev/null +++ b/Items/Placeables/DraedonStructures/RustedPipes.cs @@ -0,0 +1,34 @@ +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.DraedonStructures +{ + public class RustedPipes : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = ItemUseStyleID.SwingThrow; + item.consumable = true; + item.createTile = ModContent.TileType(); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.IronBar, 1); + recipe.SetResult(this, 5); + recipe.AddTile(TileID.Anvils); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Placeables/DraedonStructures/RustedPipes.png b/Items/Placeables/DraedonStructures/RustedPipes.png new file mode 100644 index 0000000000..52b0438930 Binary files /dev/null and b/Items/Placeables/DraedonStructures/RustedPipes.png differ diff --git a/Items/Placeables/DraedonStructures/RustedPlating.cs b/Items/Placeables/DraedonStructures/RustedPlating.cs new file mode 100644 index 0000000000..d4f1c0d2f7 --- /dev/null +++ b/Items/Placeables/DraedonStructures/RustedPlating.cs @@ -0,0 +1,57 @@ +using CalamityMod.Items.Placeables.Walls.DraedonStructures; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.DraedonStructures +{ + public class RustedPlating : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = ItemUseStyleID.SwingThrow; + item.consumable = true; + item.createTile = ModContent.TileType(); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.IronBar); + recipe.anyIronBar = true; + recipe.AddIngredient(ItemID.StoneBlock, 3); + recipe.SetResult(this, 3); + recipe.AddTile(TileID.HeavyWorkBench); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 1); + recipe.SetResult(this, 1); + recipe.AddTile(TileID.Anvils); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 4); + recipe.SetResult(this, 1); + recipe.AddTile(TileID.WorkBenches); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 4); + recipe.SetResult(this, 1); + recipe.AddTile(TileID.WorkBenches); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 4); + recipe.SetResult(this, 1); + recipe.AddTile(TileID.WorkBenches); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Placeables/DraedonStructures/RustedPlating.png b/Items/Placeables/DraedonStructures/RustedPlating.png new file mode 100644 index 0000000000..3494044dd4 Binary files /dev/null and b/Items/Placeables/DraedonStructures/RustedPlating.png differ diff --git a/Items/Placeables/DraedonStructures/RustedShelf.cs b/Items/Placeables/DraedonStructures/RustedShelf.cs new file mode 100644 index 0000000000..71249075f8 --- /dev/null +++ b/Items/Placeables/DraedonStructures/RustedShelf.cs @@ -0,0 +1,37 @@ +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.DraedonStructures +{ + public class RustedShelf : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = ItemUseStyleID.SwingThrow; + item.consumable = true; + item.createTile = ModContent.TileType(); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 1); + recipe.SetResult(this, 2); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 1); + recipe.SetResult(this, 1); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Placeables/DraedonStructures/RustedShelf.png b/Items/Placeables/DraedonStructures/RustedShelf.png new file mode 100644 index 0000000000..5cc79a7c6a Binary files /dev/null and b/Items/Placeables/DraedonStructures/RustedShelf.png differ diff --git a/Items/Placeables/DraedonsChargingStation.cs b/Items/Placeables/DraedonsChargingStation.cs new file mode 100644 index 0000000000..3346d2aa33 --- /dev/null +++ b/Items/Placeables/DraedonsChargingStation.cs @@ -0,0 +1,33 @@ +using CalamityMod.Tiles; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class DraedonsChargingStation : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Draedon's Charging Station"); + Tooltip.SetDefault("Charges Draedon's weaponry using Power Cells"); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = item.useTime = 15; + item.useStyle = ItemUseStyleID.SwingThrow; + item.consumable = true; + item.createTile = ModContent.TileType(); + + item.rare = ItemRarityID.Red; + item.Calamity().customRarity = CalamityRarity.DraedonRust; + item.value = Item.buyPrice(gold: 50); + } + } +} diff --git a/Items/Placeables/DraedonsChargingStation.png b/Items/Placeables/DraedonsChargingStation.png new file mode 100644 index 0000000000..264d51d3a3 Binary files /dev/null and b/Items/Placeables/DraedonsChargingStation.png differ diff --git a/Items/Placeables/DraedonsFuelFactoryItem.cs b/Items/Placeables/DraedonsFuelFactoryItem.cs new file mode 100644 index 0000000000..a167ceacaf --- /dev/null +++ b/Items/Placeables/DraedonsFuelFactoryItem.cs @@ -0,0 +1,33 @@ +using CalamityMod.Tiles; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class DraedonsFuelFactoryItem : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Draedon's Fuel Factory"); + Tooltip.SetDefault("Produces Draedon Power Cells over time"); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = item.useTime = 15; + item.useStyle = ItemUseStyleID.SwingThrow; + item.consumable = true; + item.createTile = ModContent.TileType(); + + item.rare = ItemRarityID.Red; + item.Calamity().customRarity = CalamityRarity.DraedonRust; + item.value = Item.buyPrice(gold: 50); + } + } +} diff --git a/Items/Placeables/DraedonsFuelFactoryItem.png b/Items/Placeables/DraedonsFuelFactoryItem.png new file mode 100644 index 0000000000..ec1a0b7f9e Binary files /dev/null and b/Items/Placeables/DraedonsFuelFactoryItem.png differ diff --git a/Items/Placeables/Furniture/AgedSecurityChest.cs b/Items/Placeables/Furniture/AgedSecurityChest.cs new file mode 100644 index 0000000000..ffd6e29272 --- /dev/null +++ b/Items/Placeables/Furniture/AgedSecurityChest.cs @@ -0,0 +1,41 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Tiles; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.Furniture +{ + public class AgedSecurityChest : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aged Security Chest"); + } + + public override void SetDefaults() + { + item.width = 32; + item.height = 26; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 14; + item.rare = 2; + item.useStyle = ItemUseStyleID.SwingThrow; + item.consumable = true; + item.value = 500; + item.createTile = ModContent.TileType(); + } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 4); + recipe.AddIngredient(ModContent.ItemType(), 4); + recipe.AddIngredient(ItemID.IronBar, 4); + recipe.anyIronBar = true; + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Placeables/Furniture/AgedSecurityChest.png b/Items/Placeables/Furniture/AgedSecurityChest.png new file mode 100644 index 0000000000..7a7c493458 Binary files /dev/null and b/Items/Placeables/Furniture/AgedSecurityChest.png differ diff --git a/Items/Placeables/Furniture/AstralBeaconItem.cs b/Items/Placeables/Furniture/AstralBeaconItem.cs new file mode 100644 index 0000000000..841a78c277 --- /dev/null +++ b/Items/Placeables/Furniture/AstralBeaconItem.cs @@ -0,0 +1,42 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Items.Potions; +using CalamityMod.Tiles; +using CalamityMod.Tiles.Astral; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.Furniture +{ + public class AstralBeaconItem : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astral Beacon"); + Tooltip.SetDefault("Summons Astrum Deus in exchange for specific offerings"); + } + public override void SetDefaults() + { + item.width = 32; + item.height = 26; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 14; + item.rare = 9; + item.useStyle = ItemUseStyleID.SwingThrow; + item.consumable = true; + item.createTile = ModContent.TileType(); + } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddIngredient(ModContent.ItemType(), 20); + recipe.AddIngredient(ModContent.ItemType(), 30); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Placeables/Furniture/AstralBeaconItem.png b/Items/Placeables/Furniture/AstralBeaconItem.png new file mode 100644 index 0000000000..126f9f6736 Binary files /dev/null and b/Items/Placeables/Furniture/AstralBeaconItem.png differ diff --git a/Items/Placeables/Furniture/CraftingStations/BotanicPlanter.png b/Items/Placeables/Furniture/CraftingStations/BotanicPlanter.png index 8735c3d983..fc114a1b5d 100644 Binary files a/Items/Placeables/Furniture/CraftingStations/BotanicPlanter.png and b/Items/Placeables/Furniture/CraftingStations/BotanicPlanter.png differ diff --git a/Items/Placeables/Furniture/CraftingStations/SilvaBasin.png b/Items/Placeables/Furniture/CraftingStations/SilvaBasin.png index 84a2da8dfd..fe06bed067 100644 Binary files a/Items/Placeables/Furniture/CraftingStations/SilvaBasin.png and b/Items/Placeables/Furniture/CraftingStations/SilvaBasin.png differ diff --git a/Items/Placeables/Furniture/CraftingStations/StaticRefiner.cs b/Items/Placeables/Furniture/CraftingStations/StaticRefiner.cs index f955dca894..a3ff7895a2 100644 --- a/Items/Placeables/Furniture/CraftingStations/StaticRefiner.cs +++ b/Items/Placeables/Furniture/CraftingStations/StaticRefiner.cs @@ -1,3 +1,5 @@ +using CalamityMod.Items.Materials; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.CraftingStations @@ -22,5 +24,15 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations item.consumable = true; item.createTile = ModContent.TileType(); } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddIngredient(ItemID.Solidifier); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } } } diff --git a/Items/Placeables/Furniture/CraftingStations/StaticRefiner.png b/Items/Placeables/Furniture/CraftingStations/StaticRefiner.png index d4a0bad1c4..4d7e82cc00 100644 Binary files a/Items/Placeables/Furniture/CraftingStations/StaticRefiner.png and b/Items/Placeables/Furniture/CraftingStations/StaticRefiner.png differ diff --git a/Items/Placeables/Furniture/EffigyOfDecay.cs b/Items/Placeables/Furniture/EffigyOfDecay.cs index 5f3a3c6292..2104794598 100644 --- a/Items/Placeables/Furniture/EffigyOfDecay.cs +++ b/Items/Placeables/Furniture/EffigyOfDecay.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Placeables.Furniture public override void SetStaticDefaults() { DisplayName.SetDefault("Effigy of Decay"); - Tooltip.SetDefault("When placed down, nearby players can breath underwater\n" + + Tooltip.SetDefault("When placed down, nearby players can breathe underwater\n" + "This effect does not work in the abyss\n" + "Nearby players are also immune to the sulphuric poisoning"); } diff --git a/Items/Placeables/Furniture/HolographicDisplayBox.cs b/Items/Placeables/Furniture/HolographicDisplayBox.cs new file mode 100644 index 0000000000..406dd60c32 --- /dev/null +++ b/Items/Placeables/Furniture/HolographicDisplayBox.cs @@ -0,0 +1,31 @@ +using CalamityMod.Tiles; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Furniture +{ + public class HolographicDisplayBox : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Holographic Display Box"); + } + + public override void SetDefaults() + { + item.width = 22; + item.height = 32; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = ItemUseStyleID.SwingThrow; + item.consumable = true; + item.value = Item.buyPrice(0, 0, 0, 0); + item.rare = 3; + item.createTile = ModContent.TileType(); + } + } +} diff --git a/Items/Placeables/Furniture/HolographicDisplayBox.png b/Items/Placeables/Furniture/HolographicDisplayBox.png new file mode 100644 index 0000000000..2d02e4dcf3 Binary files /dev/null and b/Items/Placeables/Furniture/HolographicDisplayBox.png differ diff --git a/Items/Placeables/Furniture/SecurityChest.cs b/Items/Placeables/Furniture/SecurityChest.cs new file mode 100644 index 0000000000..a0ddc56b21 --- /dev/null +++ b/Items/Placeables/Furniture/SecurityChest.cs @@ -0,0 +1,39 @@ +using CalamityMod.Tiles; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.Furniture +{ + public class SecurityChest : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Security Chest"); + } + + public override void SetDefaults() + { + item.width = 32; + item.height = 26; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 14; + item.rare = 3; + item.useStyle = ItemUseStyleID.SwingThrow; + item.consumable = true; + item.value = 500; + item.createTile = ModContent.TileType(); + } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.IronBar, 10); + recipe.anyIronBar = true; + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Placeables/Furniture/SecurityChest.png b/Items/Placeables/Furniture/SecurityChest.png new file mode 100644 index 0000000000..43a639bd2f Binary files /dev/null and b/Items/Placeables/Furniture/SecurityChest.png differ diff --git a/Items/Placeables/Furniture/Trophies/AnahitaTrophy.cs b/Items/Placeables/Furniture/Trophies/AnahitaTrophy.cs new file mode 100644 index 0000000000..c2c772e9fc --- /dev/null +++ b/Items/Placeables/Furniture/Trophies/AnahitaTrophy.cs @@ -0,0 +1,30 @@ +using CalamityMod.Tiles.Furniture; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.Furniture.Trophies +{ + public class AnahitaTrophy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Anahita Trophy"); + } + + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = ItemUseStyleID.SwingThrow; + item.consumable = true; + item.value = 50000; + item.rare = 1; + item.createTile = ModContent.TileType(); + item.placeStyle = 27; + } + } +} diff --git a/Items/Placeables/Furniture/Trophies/AnahitaTrophy.png b/Items/Placeables/Furniture/Trophies/AnahitaTrophy.png new file mode 100644 index 0000000000..4edfaecab6 Binary files /dev/null and b/Items/Placeables/Furniture/Trophies/AnahitaTrophy.png differ diff --git a/Items/Placeables/Furniture/Trophies/LeviathanTrophy.png b/Items/Placeables/Furniture/Trophies/LeviathanTrophy.png index e9c5717b85..54e4ff532a 100644 Binary files a/Items/Placeables/Furniture/Trophies/LeviathanTrophy.png and b/Items/Placeables/Furniture/Trophies/LeviathanTrophy.png differ diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlate.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlate.cs index 3fa832fe50..817c688806 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlate.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlate.cs @@ -9,6 +9,7 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate { public override void SetStaticDefaults() { + DisplayName.SetDefault("Plagued Containment Brick"); } public override void SetDefaults() @@ -28,10 +29,10 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.IronBar, 1); + recipe.AddIngredient(ItemID.StoneBlock, 10); recipe.anyIronBar = true; - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.SetResult(this, 20); + recipe.AddIngredient(ModContent.ItemType(), 1); + recipe.SetResult(this, 10); recipe.AddTile(ModContent.TileType()); recipe.AddRecipe(); recipe = new ModRecipe(mod); diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateBasin.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateBasin.cs index d738005724..66f0ef310f 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateBasin.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateBasin.cs @@ -8,6 +8,7 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate { public override void SetStaticDefaults() { + DisplayName.SetDefault("Broken Plagued 'Bed'"); } public override void SetDefaults() diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateBathtub.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateBathtub.cs index 6fb05766d3..65b194e752 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateBathtub.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateBathtub.cs @@ -8,6 +8,7 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate { public override void SetStaticDefaults() { + DisplayName.SetDefault("Plagued Bathtub"); } public override void SetDefaults() diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateBed.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateBed.cs index baefc81006..132eae8818 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateBed.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateBed.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate { public override void SetStaticDefaults() { + DisplayName.SetDefault("Plagued 'Bed'"); + Tooltip.SetDefault("Counts as a bed"); } public override void SetDefaults() diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateBookcase.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateBookcase.cs index b44dea4c60..89be8e8ec3 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateBookcase.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateBookcase.cs @@ -8,6 +8,7 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate { public override void SetStaticDefaults() { + DisplayName.SetDefault("Plagued Bookcase"); } public override void SetDefaults() diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateCandelabra.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateCandelabra.cs index 92c34b5d57..71e19762f8 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateCandelabra.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateCandelabra.cs @@ -8,6 +8,7 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate { public override void SetStaticDefaults() { + DisplayName.SetDefault("Plagued Candelabra"); } public override void SetDefaults() diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateCandle.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateCandle.cs index 90d3ef179b..264761ec02 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateCandle.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateCandle.cs @@ -8,6 +8,7 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate { public override void SetStaticDefaults() { + DisplayName.SetDefault("Plagued Candle"); } public override void SetDefaults() diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateChair.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateChair.cs index 13b30935b0..df28250d21 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateChair.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateChair.cs @@ -8,6 +8,7 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate { public override void SetStaticDefaults() { + DisplayName.SetDefault("Plagued Chair"); } public override void SetDefaults() diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateChandelier.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateChandelier.cs index 1f3841292e..aa09e63626 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateChandelier.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateChandelier.cs @@ -8,6 +8,7 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate { public override void SetStaticDefaults() { + DisplayName.SetDefault("Plagued Chandelier"); } public override void SetDefaults() diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateChest.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateChest.cs index 1c85ac501c..49cd6aee4c 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateChest.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateChest.cs @@ -8,6 +8,7 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate { public override void SetStaticDefaults() { + DisplayName.SetDefault("Plagued Chest"); } public override void SetDefaults() diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateClock.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateClock.cs index e31efda4ca..7fe7bba469 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateClock.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateClock.cs @@ -8,6 +8,7 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate { public override void SetStaticDefaults() { + DisplayName.SetDefault("Plagued Clock"); } public override void SetDefaults() diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateDoor.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateDoor.cs index 16fd16674a..5a25c2d8c0 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateDoor.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateDoor.cs @@ -9,6 +9,7 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate { public override void SetStaticDefaults() { + DisplayName.SetDefault("Plagued Door"); } public override void SetDefaults() diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateDresser.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateDresser.cs index 55576a2823..1d60aed6c1 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateDresser.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateDresser.cs @@ -8,6 +8,7 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate { public override void SetStaticDefaults() { + DisplayName.SetDefault("Plagued Dresser"); } public override void SetDefaults() diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateLamp.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateLamp.cs index 40be02e85a..0460e4ff80 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateLamp.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateLamp.cs @@ -8,6 +8,7 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate { public override void SetStaticDefaults() { + DisplayName.SetDefault("Plagued Lamp"); } public override void SetDefaults() diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateLantern.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateLantern.cs index 20ef9cd14a..75cbe7350f 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateLantern.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateLantern.cs @@ -8,6 +8,7 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate { public override void SetStaticDefaults() { + DisplayName.SetDefault("Plagued Lantern"); } public override void SetDefaults() diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlatePiano.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlatePiano.cs index df9bb67e8b..d61adb766a 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlatePiano.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlatePiano.cs @@ -8,6 +8,7 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate { public override void SetStaticDefaults() { + DisplayName.SetDefault("Plagued Piano"); } public override void SetDefaults() diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlatePlatform.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlatePlatform.cs index bbb6bbbd1a..aab0b3074f 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlatePlatform.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlatePlatform.cs @@ -7,6 +7,7 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate { public override void SetStaticDefaults() { + DisplayName.SetDefault("Plagued Shelf"); } public override void SetDefaults() diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateSink.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateSink.cs index 88953f4751..80169a04ea 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateSink.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateSink.cs @@ -8,6 +8,7 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate { public override void SetStaticDefaults() { + DisplayName.SetDefault("Plagued Sink"); Tooltip.SetDefault("Counts as a water source"); } diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateSofa.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateSofa.cs index f4e30f2702..98500530b4 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateSofa.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateSofa.cs @@ -8,6 +8,7 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate { public override void SetStaticDefaults() { + DisplayName.SetDefault("Plagued Sofa"); } public override void SetDefaults() diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateTable.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateTable.cs index 5da9b7803f..82034950b7 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateTable.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateTable.cs @@ -8,6 +8,7 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate { public override void SetStaticDefaults() { + DisplayName.SetDefault("Plagued Table"); } public override void SetDefaults() diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateWorkbench.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateWorkbench.cs index 6d172e2e94..f15bc39e4d 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateWorkbench.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlateWorkbench.cs @@ -8,11 +8,11 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate { public override void SetStaticDefaults() { + DisplayName.SetDefault("Plagued Work Bench"); } public override void SetDefaults() { - item.SetNameOverride("Plagued Plate Work Bench"); item.width = 8; item.height = 10; item.maxStack = 999; diff --git a/Items/Placeables/Plates/Chaosplate.cs b/Items/Placeables/Plates/Chaosplate.cs new file mode 100644 index 0000000000..1ed58dbae8 --- /dev/null +++ b/Items/Placeables/Plates/Chaosplate.cs @@ -0,0 +1,48 @@ +using CalamityMod.Items.Placeables.Walls; +using CalamityMod.Items.Materials; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Plates +{ + public class Chaosplate : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Chaosplate"); + Tooltip.SetDefault("It resonates with otherworldly energy."); + } + + public override void SetDefaults() + { + item.createTile = ModContent.TileType(); + item.useStyle = ItemUseStyleID.SwingThrow; + item.useTurn = true; + item.useAnimation = 15; + item.useTime = 10; + item.autoReuse = true; + item.consumable = true; + item.width = 13; + item.height = 10; + item.maxStack = 999; + item.value = Item.sellPrice(silver: 3); + item.rare = 3; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 1); + recipe.AddIngredient(ItemID.Obsidian, 3); + recipe.SetResult(this, 3); + recipe.AddTile(TileID.Hellforge); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 4); + recipe.SetResult(this); + recipe.AddTile(TileID.WorkBenches); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Placeables/Plates/Chaosplate.png b/Items/Placeables/Plates/Chaosplate.png new file mode 100644 index 0000000000..f8d5dbd14c Binary files /dev/null and b/Items/Placeables/Plates/Chaosplate.png differ diff --git a/Items/Placeables/Cinderplate.cs b/Items/Placeables/Plates/Cinderplate.cs similarity index 76% rename from Items/Placeables/Cinderplate.cs rename to Items/Placeables/Plates/Cinderplate.cs index 0f5ebf5a9f..b289aac06d 100644 --- a/Items/Placeables/Cinderplate.cs +++ b/Items/Placeables/Plates/Cinderplate.cs @@ -1,9 +1,10 @@ using CalamityMod.Items.Placeables.Walls; +using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables +namespace CalamityMod.Items.Placeables.Plates { public class Cinderplate : ModItem { @@ -15,7 +16,7 @@ namespace CalamityMod.Items.Placeables public override void SetDefaults() { - item.createTile = ModContent.TileType(); + item.createTile = ModContent.TileType(); item.useStyle = ItemUseStyleID.SwingThrow; item.useTurn = true; item.useAnimation = 15; @@ -32,15 +33,15 @@ namespace CalamityMod.Items.Placeables public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Hellstone, 6); + recipe.AddIngredient(ModContent.ItemType(), 1); recipe.AddIngredient(ItemID.Obsidian, 3); - recipe.SetResult(this); - recipe.AddTile(TileID.Anvils); + recipe.SetResult(this, 3); + recipe.AddTile(TileID.Hellforge); recipe.AddRecipe(); recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 4); recipe.SetResult(this); - recipe.AddTile(TileID.Anvils); + recipe.AddTile(TileID.WorkBenches); recipe.AddRecipe(); } } diff --git a/Items/Placeables/Plates/Cinderplate.png b/Items/Placeables/Plates/Cinderplate.png new file mode 100644 index 0000000000..f6fa62777b Binary files /dev/null and b/Items/Placeables/Plates/Cinderplate.png differ diff --git a/Items/Placeables/Plates/Elumplate.cs b/Items/Placeables/Plates/Elumplate.cs new file mode 100644 index 0000000000..878d78364c --- /dev/null +++ b/Items/Placeables/Plates/Elumplate.cs @@ -0,0 +1,48 @@ +using CalamityMod.Items.Placeables.Walls; +using CalamityMod.Items.Materials; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Plates +{ + public class Elumplate : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Elumplate"); + Tooltip.SetDefault("It resonates with otherworldly energy."); + } + + public override void SetDefaults() + { + item.createTile = ModContent.TileType(); + item.useStyle = ItemUseStyleID.SwingThrow; + item.useTurn = true; + item.useAnimation = 15; + item.useTime = 10; + item.autoReuse = true; + item.consumable = true; + item.width = 13; + item.height = 10; + item.maxStack = 999; + item.value = Item.sellPrice(silver: 3); + item.rare = 3; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 1); + recipe.AddIngredient(ItemID.Obsidian, 3); + recipe.SetResult(this, 3); + recipe.AddTile(TileID.Hellforge); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 4); + recipe.SetResult(this); + recipe.AddTile(TileID.WorkBenches); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Placeables/Plates/Elumplate.png b/Items/Placeables/Plates/Elumplate.png new file mode 100644 index 0000000000..f4a86bca5d Binary files /dev/null and b/Items/Placeables/Plates/Elumplate.png differ diff --git a/Items/Placeables/Plates/Navyplate.cs b/Items/Placeables/Plates/Navyplate.cs new file mode 100644 index 0000000000..2879b31339 --- /dev/null +++ b/Items/Placeables/Plates/Navyplate.cs @@ -0,0 +1,47 @@ +using CalamityMod.Items.Placeables.Walls; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Plates +{ + public class Navyplate : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Navyplate"); + Tooltip.SetDefault("It resonates with otherworldly energy."); + } + + public override void SetDefaults() + { + item.createTile = ModContent.TileType(); + item.useStyle = ItemUseStyleID.SwingThrow; + item.useTurn = true; + item.useAnimation = 15; + item.useTime = 10; + item.autoReuse = true; + item.consumable = true; + item.width = 13; + item.height = 10; + item.maxStack = 999; + item.value = Item.sellPrice(silver: 3); + item.rare = 3; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 1); + recipe.AddIngredient(ItemID.Obsidian, 3); + recipe.SetResult(this, 3); + recipe.AddTile(TileID.Hellforge); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 4); + recipe.SetResult(this); + recipe.AddTile(TileID.WorkBenches); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Placeables/Plates/Navyplate.png b/Items/Placeables/Plates/Navyplate.png new file mode 100644 index 0000000000..9bf9b977d0 Binary files /dev/null and b/Items/Placeables/Plates/Navyplate.png differ diff --git a/Items/Placeables/Plates/PlagueContainmentCells.cs b/Items/Placeables/Plates/PlagueContainmentCells.cs new file mode 100644 index 0000000000..6f59c79fc4 --- /dev/null +++ b/Items/Placeables/Plates/PlagueContainmentCells.cs @@ -0,0 +1,48 @@ +using CalamityMod.Items.Placeables.Walls; +using CalamityMod.Items.Materials; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Plates +{ + public class PlagueContainmentCells : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Plagueplate"); + Tooltip.SetDefault("It resonates with otherworldly energy."); + } + + public override void SetDefaults() + { + item.createTile = ModContent.TileType(); + item.useStyle = ItemUseStyleID.SwingThrow; + item.useTurn = true; + item.useAnimation = 15; + item.useTime = 10; + item.autoReuse = true; + item.consumable = true; + item.width = 13; + item.height = 10; + item.maxStack = 999; + item.value = Item.sellPrice(silver: 3); + item.rare = 3; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 1); + recipe.AddIngredient(ItemID.Obsidian, 3); + recipe.SetResult(this, 3); + recipe.AddTile(TileID.Hellforge); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 4); + recipe.SetResult(this); + recipe.AddTile(TileID.WorkBenches); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Placeables/Plates/PlagueContainmentCells.png b/Items/Placeables/Plates/PlagueContainmentCells.png new file mode 100644 index 0000000000..8ca15bd563 Binary files /dev/null and b/Items/Placeables/Plates/PlagueContainmentCells.png differ diff --git a/Items/Placeables/Walls/ChaosplateWall.cs b/Items/Placeables/Walls/ChaosplateWall.cs new file mode 100644 index 0000000000..ca91319ed6 --- /dev/null +++ b/Items/Placeables/Walls/ChaosplateWall.cs @@ -0,0 +1,36 @@ +using Terraria.ModLoader; +using WallTiles = CalamityMod.Walls; +using Terraria.ID; + +namespace CalamityMod.Items.Placeables.Walls +{ + public class ChaosplateWall : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 7; + item.useStyle = ItemUseStyleID.SwingThrow; + item.consumable = true; + item.createWall = ModContent.WallType(); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType()); + recipe.SetResult(this, 4); + recipe.AddTile(TileID.WorkBenches); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Placeables/Walls/ChaosplateWall.png b/Items/Placeables/Walls/ChaosplateWall.png new file mode 100644 index 0000000000..6a4f81b66f Binary files /dev/null and b/Items/Placeables/Walls/ChaosplateWall.png differ diff --git a/Items/Placeables/Walls/CinderplateWall.cs b/Items/Placeables/Walls/CinderplateWall.cs index 33781b2a04..6b9f5e0c53 100644 --- a/Items/Placeables/Walls/CinderplateWall.cs +++ b/Items/Placeables/Walls/CinderplateWall.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Placeables.Walls public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType()); recipe.SetResult(this, 4); recipe.AddTile(18); recipe.AddRecipe(); diff --git a/Items/Placeables/Walls/CinderplateWall.png b/Items/Placeables/Walls/CinderplateWall.png index 03b3da1392..d617ebfb80 100644 Binary files a/Items/Placeables/Walls/CinderplateWall.png and b/Items/Placeables/Walls/CinderplateWall.png differ diff --git a/Items/Placeables/Walls/DraedonStructures/HazardChevronWall.cs b/Items/Placeables/Walls/DraedonStructures/HazardChevronWall.cs new file mode 100644 index 0000000000..994bf1420d --- /dev/null +++ b/Items/Placeables/Walls/DraedonStructures/HazardChevronWall.cs @@ -0,0 +1,37 @@ +using Terraria.ModLoader; +using WallTiles = CalamityMod.Walls.DraedonStructures; +using TileItems = CalamityMod.Items.Placeables.DraedonStructures; +using Terraria.ID; + +namespace CalamityMod.Items.Placeables.Walls.DraedonStructures +{ + public class HazardChevronWall : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 7; + item.useStyle = ItemUseStyleID.SwingThrow; + item.consumable = true; + item.createWall = ModContent.WallType(); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType()); + recipe.SetResult(this, 4); + recipe.AddTile(TileID.WorkBenches); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Placeables/Walls/DraedonStructures/HazardChevronWall.png b/Items/Placeables/Walls/DraedonStructures/HazardChevronWall.png new file mode 100644 index 0000000000..de85761283 Binary files /dev/null and b/Items/Placeables/Walls/DraedonStructures/HazardChevronWall.png differ diff --git a/Items/Placeables/Walls/DraedonStructures/LaboratoryPanelWall.cs b/Items/Placeables/Walls/DraedonStructures/LaboratoryPanelWall.cs new file mode 100644 index 0000000000..ba1bf5921a --- /dev/null +++ b/Items/Placeables/Walls/DraedonStructures/LaboratoryPanelWall.cs @@ -0,0 +1,37 @@ +using Terraria.ModLoader; +using WallTiles = CalamityMod.Walls.DraedonStructures; +using TileItems = CalamityMod.Items.Placeables.DraedonStructures; +using Terraria.ID; + +namespace CalamityMod.Items.Placeables.Walls.DraedonStructures +{ + public class LaboratoryPanelWall : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 7; + item.useStyle = ItemUseStyleID.SwingThrow; + item.consumable = true; + item.createWall = ModContent.WallType(); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType()); + recipe.SetResult(this, 4); + recipe.AddTile(TileID.WorkBenches); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Placeables/Walls/DraedonStructures/LaboratoryPanelWall.png b/Items/Placeables/Walls/DraedonStructures/LaboratoryPanelWall.png new file mode 100644 index 0000000000..da8a81fe73 Binary files /dev/null and b/Items/Placeables/Walls/DraedonStructures/LaboratoryPanelWall.png differ diff --git a/Items/Placeables/Walls/DraedonStructures/LaboratoryPlateBeam.cs b/Items/Placeables/Walls/DraedonStructures/LaboratoryPlateBeam.cs new file mode 100644 index 0000000000..686097e58c --- /dev/null +++ b/Items/Placeables/Walls/DraedonStructures/LaboratoryPlateBeam.cs @@ -0,0 +1,37 @@ +using Terraria.ModLoader; +using WallTiles = CalamityMod.Walls.DraedonStructures; +using TileItems = CalamityMod.Items.Placeables.DraedonStructures; +using Terraria.ID; + +namespace CalamityMod.Items.Placeables.Walls.DraedonStructures +{ + public class LaboratoryPlateBeam : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 7; + item.useStyle = ItemUseStyleID.SwingThrow; + item.consumable = true; + item.createWall = ModContent.WallType(); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType()); + recipe.SetResult(this, 4); + recipe.AddTile(TileID.WorkBenches); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Placeables/Walls/DraedonStructures/LaboratoryPlateBeam.png b/Items/Placeables/Walls/DraedonStructures/LaboratoryPlateBeam.png new file mode 100644 index 0000000000..559381b790 Binary files /dev/null and b/Items/Placeables/Walls/DraedonStructures/LaboratoryPlateBeam.png differ diff --git a/Items/Placeables/Walls/DraedonStructures/LaboratoryPlatePillar.cs b/Items/Placeables/Walls/DraedonStructures/LaboratoryPlatePillar.cs new file mode 100644 index 0000000000..1be0e218b0 --- /dev/null +++ b/Items/Placeables/Walls/DraedonStructures/LaboratoryPlatePillar.cs @@ -0,0 +1,37 @@ +using Terraria.ModLoader; +using WallTiles = CalamityMod.Walls.DraedonStructures; +using TileItems = CalamityMod.Items.Placeables.DraedonStructures; +using Terraria.ID; + +namespace CalamityMod.Items.Placeables.Walls.DraedonStructures +{ + public class LaboratoryPlatePillar : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 7; + item.useStyle = ItemUseStyleID.SwingThrow; + item.consumable = true; + item.createWall = ModContent.WallType(); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType()); + recipe.SetResult(this, 4); + recipe.AddTile(TileID.WorkBenches); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Placeables/Walls/DraedonStructures/LaboratoryPlatePillar.png b/Items/Placeables/Walls/DraedonStructures/LaboratoryPlatePillar.png new file mode 100644 index 0000000000..e08402e6c5 Binary files /dev/null and b/Items/Placeables/Walls/DraedonStructures/LaboratoryPlatePillar.png differ diff --git a/Items/Placeables/Walls/DraedonStructures/LaboratoryPlatingWall.cs b/Items/Placeables/Walls/DraedonStructures/LaboratoryPlatingWall.cs new file mode 100644 index 0000000000..2620e6c96c --- /dev/null +++ b/Items/Placeables/Walls/DraedonStructures/LaboratoryPlatingWall.cs @@ -0,0 +1,37 @@ +using Terraria.ModLoader; +using WallTiles = CalamityMod.Walls.DraedonStructures; +using TileItems = CalamityMod.Items.Placeables.DraedonStructures; +using Terraria.ID; + +namespace CalamityMod.Items.Placeables.Walls.DraedonStructures +{ + public class LaboratoryPlatingWall : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 7; + item.useStyle = ItemUseStyleID.SwingThrow; + item.consumable = true; + item.createWall = ModContent.WallType(); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType()); + recipe.SetResult(this, 4); + recipe.AddTile(TileID.WorkBenches); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Placeables/Walls/DraedonStructures/LaboratoryPlatingWall.png b/Items/Placeables/Walls/DraedonStructures/LaboratoryPlatingWall.png new file mode 100644 index 0000000000..a34a2b4244 Binary files /dev/null and b/Items/Placeables/Walls/DraedonStructures/LaboratoryPlatingWall.png differ diff --git a/Items/Placeables/Walls/DraedonStructures/RustedPlateBeam.cs b/Items/Placeables/Walls/DraedonStructures/RustedPlateBeam.cs new file mode 100644 index 0000000000..4b0b765206 --- /dev/null +++ b/Items/Placeables/Walls/DraedonStructures/RustedPlateBeam.cs @@ -0,0 +1,37 @@ +using Terraria.ModLoader; +using WallTiles = CalamityMod.Walls.DraedonStructures; +using TileItems = CalamityMod.Items.Placeables.DraedonStructures; +using Terraria.ID; + +namespace CalamityMod.Items.Placeables.Walls.DraedonStructures +{ + public class RustedPlateBeam : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 7; + item.useStyle = ItemUseStyleID.SwingThrow; + item.consumable = true; + item.createWall = ModContent.WallType(); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType()); + recipe.SetResult(this, 4); + recipe.AddTile(TileID.WorkBenches); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Placeables/Walls/DraedonStructures/RustedPlateBeam.png b/Items/Placeables/Walls/DraedonStructures/RustedPlateBeam.png new file mode 100644 index 0000000000..0a7fdd7b66 Binary files /dev/null and b/Items/Placeables/Walls/DraedonStructures/RustedPlateBeam.png differ diff --git a/Items/Placeables/Walls/DraedonStructures/RustedPlatePillar.cs b/Items/Placeables/Walls/DraedonStructures/RustedPlatePillar.cs new file mode 100644 index 0000000000..97cdcb63af --- /dev/null +++ b/Items/Placeables/Walls/DraedonStructures/RustedPlatePillar.cs @@ -0,0 +1,37 @@ +using Terraria.ModLoader; +using WallTiles = CalamityMod.Walls.DraedonStructures; +using TileItems = CalamityMod.Items.Placeables.DraedonStructures; +using Terraria.ID; + +namespace CalamityMod.Items.Placeables.Walls.DraedonStructures +{ + public class RustedPlatePillar : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 7; + item.useStyle = ItemUseStyleID.SwingThrow; + item.consumable = true; + item.createWall = ModContent.WallType(); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType()); + recipe.SetResult(this, 4); + recipe.AddTile(TileID.WorkBenches); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Placeables/Walls/DraedonStructures/RustedPlatePillar.png b/Items/Placeables/Walls/DraedonStructures/RustedPlatePillar.png new file mode 100644 index 0000000000..298df3d848 Binary files /dev/null and b/Items/Placeables/Walls/DraedonStructures/RustedPlatePillar.png differ diff --git a/Items/Placeables/Walls/DraedonStructures/RustedPlatingWall.cs b/Items/Placeables/Walls/DraedonStructures/RustedPlatingWall.cs new file mode 100644 index 0000000000..16cb93a1c1 --- /dev/null +++ b/Items/Placeables/Walls/DraedonStructures/RustedPlatingWall.cs @@ -0,0 +1,37 @@ +using Terraria.ModLoader; +using WallTiles = CalamityMod.Walls.DraedonStructures; +using TileItems = CalamityMod.Items.Placeables.DraedonStructures; +using Terraria.ID; + +namespace CalamityMod.Items.Placeables.Walls.DraedonStructures +{ + public class RustedPlatingWall : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 7; + item.useStyle = ItemUseStyleID.SwingThrow; + item.consumable = true; + item.createWall = ModContent.WallType(); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType()); + recipe.SetResult(this, 4); + recipe.AddTile(TileID.WorkBenches); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Placeables/Walls/DraedonStructures/RustedPlatingWall.png b/Items/Placeables/Walls/DraedonStructures/RustedPlatingWall.png new file mode 100644 index 0000000000..17a1cf0ffd Binary files /dev/null and b/Items/Placeables/Walls/DraedonStructures/RustedPlatingWall.png differ diff --git a/Items/Placeables/Walls/ElumplateWall.cs b/Items/Placeables/Walls/ElumplateWall.cs new file mode 100644 index 0000000000..3b66790a96 --- /dev/null +++ b/Items/Placeables/Walls/ElumplateWall.cs @@ -0,0 +1,36 @@ +using Terraria.ModLoader; +using WallTiles = CalamityMod.Walls; +using Terraria.ID; + +namespace CalamityMod.Items.Placeables.Walls +{ + public class ElumplateWall : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 7; + item.useStyle = ItemUseStyleID.SwingThrow; + item.consumable = true; + item.createWall = ModContent.WallType(); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType()); + recipe.SetResult(this, 4); + recipe.AddTile(TileID.WorkBenches); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Placeables/Walls/ElumplateWall.png b/Items/Placeables/Walls/ElumplateWall.png new file mode 100644 index 0000000000..2fa9c6fb24 Binary files /dev/null and b/Items/Placeables/Walls/ElumplateWall.png differ diff --git a/Items/Placeables/Walls/NavyplateWall.cs b/Items/Placeables/Walls/NavyplateWall.cs new file mode 100644 index 0000000000..dae894decd --- /dev/null +++ b/Items/Placeables/Walls/NavyplateWall.cs @@ -0,0 +1,36 @@ +using Terraria.ModLoader; +using WallTiles = CalamityMod.Walls; +using Terraria.ID; + +namespace CalamityMod.Items.Placeables.Walls +{ + public class NavyplateWall : ModItem + { + public override void SetStaticDefaults() + { + } + + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 7; + item.useStyle = ItemUseStyleID.SwingThrow; + item.consumable = true; + item.createWall = ModContent.WallType(); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType()); + recipe.SetResult(this, 4); + recipe.AddTile(TileID.WorkBenches); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Placeables/Walls/NavyplateWall.png b/Items/Placeables/Walls/NavyplateWall.png new file mode 100644 index 0000000000..34ce61a063 Binary files /dev/null and b/Items/Placeables/Walls/NavyplateWall.png differ diff --git a/Items/Placeables/Walls/PlagueContainmentCellsWall.cs b/Items/Placeables/Walls/PlagueContainmentCellsWall.cs new file mode 100644 index 0000000000..9198d675bc --- /dev/null +++ b/Items/Placeables/Walls/PlagueContainmentCellsWall.cs @@ -0,0 +1,37 @@ +using Terraria.ModLoader; +using WallTiles = CalamityMod.Walls; +using Terraria.ID; + +namespace CalamityMod.Items.Placeables.Walls +{ + public class PlagueContainmentCellsWall : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Plagueplate Wall"); + } + + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 7; + item.useStyle = ItemUseStyleID.SwingThrow; + item.consumable = true; + item.createWall = ModContent.WallType(); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType()); + recipe.SetResult(this, 4); + recipe.AddTile(TileID.WorkBenches); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Placeables/Walls/PlagueContainmentCellsWall.png b/Items/Placeables/Walls/PlagueContainmentCellsWall.png new file mode 100644 index 0000000000..3f9e074c76 Binary files /dev/null and b/Items/Placeables/Walls/PlagueContainmentCellsWall.png differ diff --git a/Items/Placeables/Walls/PlaguedPlateWall.cs b/Items/Placeables/Walls/PlaguedPlateWall.cs index 69a74e58bc..8543226234 100644 --- a/Items/Placeables/Walls/PlaguedPlateWall.cs +++ b/Items/Placeables/Walls/PlaguedPlateWall.cs @@ -9,6 +9,7 @@ namespace CalamityMod.Items.Placeables.Walls { public override void SetStaticDefaults() { + DisplayName.SetDefault("Plagued Containment Wall"); } public override void SetDefaults() diff --git a/Items/Potions/Alcohol/GrapeBeer.cs b/Items/Potions/Alcohol/GrapeBeer.cs index 68c3e97a5e..52875fb9ef 100644 --- a/Items/Potions/Alcohol/GrapeBeer.cs +++ b/Items/Potions/Alcohol/GrapeBeer.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.Alcohol; +using CalamityMod.World; using System.Collections.Generic; using Terraria; using Terraria.ID; @@ -40,7 +41,10 @@ Reduces defense by 2 and movement speed by 5%"); public override void OnConsumeItem(Player player) { - player.statLife += 100; + int healAmt = CalamityWorld.ironHeart ? 0 : 100; + if (player.Calamity().bloodPactBoost) + healAmt = (int)(healAmt * 1.5); + player.statLife += healAmt; player.statMana += 100; if (player.statLife > player.statLifeMax2) { @@ -53,7 +57,8 @@ Reduces defense by 2 and movement speed by 5%"); player.AddBuff(BuffID.ManaSickness, Player.manaSickTime, true); if (Main.myPlayer == player.whoAmI) { - player.HealEffect(100, true); + if (!CalamityWorld.ironHeart) + player.HealEffect(healAmt, true); player.ManaEffect(100); } player.AddBuff(ModContent.BuffType(), 3600); @@ -68,7 +73,10 @@ Reduces defense by 2 and movement speed by 5%"); // Forces the "Restores X life" tooltip to display the actual life restored instead of zero (due to the previous function). public override void ModifyTooltips(List tooltips) { - tooltips.Find(line => line.Name == "HealLife").text = "Restores " + item.healLife + " life"; + float healMult = 1f; + if (Main.player[Main.myPlayer].Calamity().bloodPactBoost) + healMult = 1.5f; + tooltips.Find(line => line.Name == "HealLife").text = "Restores " + (CalamityWorld.ironHeart ? 0 : (int)(item.healLife * healMult)) + " life"; } } } diff --git a/Items/Potions/Alcohol/Margarita.cs b/Items/Potions/Alcohol/Margarita.cs index 613329475c..a6c75e20a0 100644 --- a/Items/Potions/Alcohol/Margarita.cs +++ b/Items/Potions/Alcohol/Margarita.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.Alcohol; +using CalamityMod.World; using System.Collections.Generic; using Terraria; using Terraria.ID; @@ -43,7 +44,10 @@ Reduces defense by 6 and life regen by 1"); public override void OnConsumeItem(Player player) { - player.statLife += 200; + int healAmt = CalamityWorld.ironHeart ? 0 : 200; + if (player.Calamity().bloodPactBoost) + healAmt = (int)(healAmt * 1.5); + player.statLife += healAmt; player.statMana += 200; if (player.statLife > player.statLifeMax2) { @@ -56,7 +60,8 @@ Reduces defense by 6 and life regen by 1"); player.AddBuff(BuffID.ManaSickness, Player.manaSickTime, true); if (Main.myPlayer == player.whoAmI) { - player.HealEffect(200, true); + if (!CalamityWorld.ironHeart) + player.HealEffect(healAmt, true); player.ManaEffect(200); } player.AddBuff(ModContent.BuffType(), 10800); @@ -71,7 +76,10 @@ Reduces defense by 6 and life regen by 1"); // Forces the "Restores X life" tooltip to display the actual life restored instead of zero (due to the previous function). public override void ModifyTooltips(List tooltips) { - tooltips.Find(line => line.Name == "HealLife").text = "Restores " + item.healLife + " life"; + float healMult = 1f; + if (Main.player[Main.myPlayer].Calamity().bloodPactBoost) + healMult = 1.5f; + tooltips.Find(line => line.Name == "HealLife").text = "Restores " + (CalamityWorld.ironHeart ? 0 : (int)(item.healLife * healMult)) + " life"; } } } diff --git a/Items/Potions/Alcohol/RedWine.cs b/Items/Potions/Alcohol/RedWine.cs index 48facc24f6..d982e67b2d 100644 --- a/Items/Potions/Alcohol/RedWine.cs +++ b/Items/Potions/Alcohol/RedWine.cs @@ -34,33 +34,20 @@ Reduces life regen by 1"); public override bool CanUseItem(Player player) { - return player.FindBuffIndex(BuffID.PotionSickness) == -1; + if (player.Calamity().baguette) + { + item.healLife = 250; + } + else + { + item.healLife = 200; + } + return base.CanUseItem(player); } public override void OnConsumeItem(Player player) { - player.statLife += (player.Calamity().baguette ? 250 : 200); - if (player.statLife > player.statLifeMax2) - { - player.statLife = player.statLifeMax2; - } - if (Main.myPlayer == player.whoAmI) - { - player.HealEffect((player.Calamity().baguette ? 250 : 200), true); - } player.AddBuff(ModContent.BuffType(), 900); } - - // Zeroes out the hardcoded healing function from having a healLife value. The item still heals in the UseItem hook. - public override void GetHealLife(Player player, bool quickHeal, ref int healValue) - { - healValue = 0; - } - - // Forces the "Restores X life" tooltip to display the actual life restored instead of zero (due to the previous function). - public override void ModifyTooltips(List tooltips) - { - tooltips.Find(line => line.Name == "HealLife").text = "Restores " + item.healLife + " life"; - } } } \ No newline at end of file diff --git a/Items/Potions/Baguette.cs b/Items/Potions/Baguette.cs index 6c20b1b2b9..8236baf7bf 100644 --- a/Items/Potions/Baguette.cs +++ b/Items/Potions/Baguette.cs @@ -29,10 +29,17 @@ namespace CalamityMod.Items.Potions item.consumable = true; item.value = Item.buyPrice(0, 0, 50, 0); item.buffType = ModContent.BuffType(); - item.buffTime = 72000; + item.buffTime = CalamityUtils.SecondsToFrames(300f); item.Calamity().customRarity = CalamityRarity.Dedicated; } + public override void OnConsumeItem(Player player) + { + //5 minutes for both + player.AddBuff(ModContent.BuffType(), CalamityUtils.SecondsToFrames(300f)); + player.AddBuff(BuffID.WellFed, CalamityUtils.SecondsToFrames(300f)); + } + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); diff --git a/Items/Potions/BoundingPotion.cs b/Items/Potions/BoundingPotion.cs index 83c761a909..b5e6d45a15 100644 --- a/Items/Potions/BoundingPotion.cs +++ b/Items/Potions/BoundingPotion.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Potions public override void SetStaticDefaults() { DisplayName.SetDefault("Bounding Potion"); - Tooltip.SetDefault("Increases jump height, jump speed, and fall damage resistance"); + Tooltip.SetDefault("Grants 10% increased jump speed, 25 extra blocks of fall damage resistance, and increased jump height"); } public override void SetDefaults() diff --git a/Items/Potions/CadencePotion.cs b/Items/Potions/CadencePotion.cs index c02e28ba72..4211e098ae 100644 --- a/Items/Potions/CadencePotion.cs +++ b/Items/Potions/CadencePotion.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Potions public override void SetStaticDefaults() { DisplayName.SetDefault("Cadance Potion"); - Tooltip.SetDefault("Gives the cadance buff which reduces shop prices and enemy aggro\n" + + Tooltip.SetDefault("Gives the cadance buff which reduces enemy aggro\n" + "Increases life regen and increases max life by 25%\n" + "Increases heart pickup range\n" + "While this potion's buff is active, Regeneration Potion and Lifeforce Potion buffs are disabled"); diff --git a/Items/Potions/CalamitasBrew.cs b/Items/Potions/CalamitasBrew.cs index 72c46ae0f2..edca20e9b1 100644 --- a/Items/Potions/CalamitasBrew.cs +++ b/Items/Potions/CalamitasBrew.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.Potions; +using CalamityMod.Items.Fishing.BrimstoneCragCatches; using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; @@ -35,14 +36,16 @@ namespace CalamityMod.Items.Potions public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ItemID.BottledWater, 3); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType(), 3); recipe.AddTile(TileID.ImbuingStation); - recipe.SetResult(this); + recipe.SetResult(this, 3); recipe.AddRecipe(); recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.BottledWater); recipe.AddIngredient(ModContent.ItemType(), 20); + recipe.AddIngredient(ModContent.ItemType()); recipe.AddTile(TileID.ImbuingStation); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Potions/DraconicElixir.cs b/Items/Potions/DraconicElixir.cs index 9e9220bc65..435e5f5e3c 100644 --- a/Items/Potions/DraconicElixir.cs +++ b/Items/Potions/DraconicElixir.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Potions Tooltip.SetDefault("Greatly increases wing flight time and speed and increases defense by 16\n" + "God slayer revival heals you to half HP instead of 150 HP when triggered\n" + "Silva invincibility heals you to half HP when triggered\n" + - "If you trigger the above heals you cannot drink this potion again for 60 seconds"); + "If you trigger the above heals you cannot drink this potion again for 60 seconds and you gain 30 seconds of potion sickness"); } public override void SetDefaults() diff --git a/Items/Potions/SunkenStew.cs b/Items/Potions/SunkenStew.cs index 2376a0ab90..598a592537 100644 --- a/Items/Potions/SunkenStew.cs +++ b/Items/Potions/SunkenStew.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Placeables; using CalamityMod.Items.Fishing.BrimstoneCragCatches; +using CalamityMod.World; using System.Collections.Generic; using Terraria; using Terraria.ID; @@ -43,7 +44,10 @@ Grants Well Fed"); public override bool UseItem(Player player) { - player.statLife += 120; + int healAmt = CalamityWorld.ironHeart ? 0 : 120; + if (player.Calamity().bloodPactBoost) + healAmt = (int)(healAmt * 1.5); + player.statLife += healAmt; player.statMana += 150; if (player.statLife > player.statLifeMax2) { @@ -56,7 +60,8 @@ Grants Well Fed"); player.AddBuff(BuffID.ManaSickness, Player.manaSickTime, true); if (Main.myPlayer == player.whoAmI) { - player.HealEffect(120, true); + if (!CalamityWorld.ironHeart) + player.HealEffect(healAmt, true); player.ManaEffect(150); } @@ -76,7 +81,10 @@ Grants Well Fed"); // Forces the "Restores X life" tooltip to display the actual life restored instead of zero (due to the previous function). public override void ModifyTooltips(List tooltips) { - tooltips.Find(line => line.Name == "HealLife").text = "Restores " + item.healLife + " life"; + float healMult = 1f; + if (Main.player[Main.myPlayer].Calamity().bloodPactBoost) + healMult = 1.5f; + tooltips.Find(line => line.Name == "HealLife").text = "Restores " + (CalamityWorld.ironHeart ? 0 : (int)(item.healLife * healMult)) + " life"; } public override void AddRecipes() diff --git a/Items/Potions/TeslaPotion.cs b/Items/Potions/TeslaPotion.cs index db39cb952d..d920ef0e38 100644 --- a/Items/Potions/TeslaPotion.cs +++ b/Items/Potions/TeslaPotion.cs @@ -7,47 +7,48 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Potions { - public class TeslaPotion : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Tesla Potion"); - Tooltip.SetDefault("Summons an aura of electricity that electrifies and slows enemies\n" + - "Slowdown does not work on bosses"); - } + public class TeslaPotion : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Tesla Potion"); + Tooltip.SetDefault("Summons an aura of electricity that electrifies and slows enemies\n" + + "Slowdown does not work on bosses\n" + + "Reduces the duration of the Electrified debuff"); + } - public override void SetDefaults() - { - item.width = 24; - item.height = 26; - item.useTurn = true; - item.maxStack = 999; - item.rare = 3; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = ItemUseStyleID.EatingUsing; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = ModContent.BuffType(); - item.buffTime = 18000; - item.value = Item.buyPrice(0, 2, 0, 0); - } + public override void SetDefaults() + { + item.width = 24; + item.height = 26; + item.useTurn = true; + item.maxStack = 999; + item.rare = 3; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = ItemUseStyleID.EatingUsing; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.buffType = ModContent.BuffType(); + item.buffTime = 18000; + item.value = Item.buyPrice(0, 2, 0, 0); + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddRecipeGroup("AnyGoldOre", 2); - recipe.AddTile(TileID.Bottles); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddRecipeGroup("AnyGoldOre", 2); + recipe.AddTile(TileID.Bottles); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/PowerCell.cs b/Items/PowerCell.cs new file mode 100644 index 0000000000..470fb14122 --- /dev/null +++ b/Items/PowerCell.cs @@ -0,0 +1,56 @@ +using CalamityMod.Items.Materials; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items +{ + public class PowerCell : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Draedon Power Cell"); + Tooltip.SetDefault("Used to charge Draedon's weaponry at a charger\n" + + "Also can be processed by the Extractinator for spare parts"); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 14; + item.rare = ItemRarityID.Red; + item.Calamity().customRarity = CalamityRarity.DraedonRust; + item.maxStack = 999; + + ItemID.Sets.ExtractinatorMode[item.type] = item.type; + item.consumable = true; + item.useStyle = ItemUseStyleID.SwingThrow; + item.useAnimation = 15; + item.useTime = 10; + item.autoReuse = true; + item.useTurn = true; + } + + public override void ExtractinatorUse(ref int resultType, ref int resultStack) + { + float dropRand = Main.rand.NextFloat(); + resultStack = 1; + + // 2.5% chance for Mysterious Circuitry + // 2.5% chance for Dubious Plating + // 85% chance for 65-99 Copper Coins + // 10% chance for 1 Silver Coin + if (dropRand < 0.025f) + resultType = ModContent.ItemType(); + else if (dropRand < 0.05f) + resultType = ModContent.ItemType(); + else if (dropRand < 0.9f) + { + resultType = ItemID.CopperCoin; + resultStack = Main.rand.Next(65, 100); + } + else + resultType = ItemID.SilverCoin; + } + } +} diff --git a/Items/PowerCell.png b/Items/PowerCell.png new file mode 100644 index 0000000000..e99bf6d8d8 Binary files /dev/null and b/Items/PowerCell.png differ diff --git a/Items/SummonItems/Abomination.cs b/Items/SummonItems/Abomination.cs index 03d001e4a2..5a2117782e 100644 --- a/Items/SummonItems/Abomination.cs +++ b/Items/SummonItems/Abomination.cs @@ -35,8 +35,12 @@ namespace CalamityMod.Items.SummonItems public override bool UseItem(Player player) { - NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); - Main.PlaySound(SoundID.Roar, player.position, 0); + Main.PlaySound(SoundID.Roar, player.position, 0); + if (Main.netMode != NetmodeID.MultiplayerClient) + NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); + else + NetMessage.SendData(MessageID.SpawnBoss, -1, -1, null, player.whoAmI, ModContent.NPCType()); + return true; } diff --git a/Items/SummonItems/AncientMedallion.cs b/Items/SummonItems/AncientMedallion.cs index c4314e06b3..1301cdb8df 100644 --- a/Items/SummonItems/AncientMedallion.cs +++ b/Items/SummonItems/AncientMedallion.cs @@ -32,12 +32,17 @@ namespace CalamityMod.Items.SummonItems public override bool UseItem(Player player) { + Main.PlaySound(SoundID.Roar, player.position, 2); if (Main.netMode != NetmodeID.MultiplayerClient) { - NPC.NewNPC((int)(player.position.X + (float)Main.rand.Next(-100, 101)), (int)(player.position.Y - 250f), ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); - Main.PlaySound(SoundID.Roar, player.position, 2); + int npc = NPC.NewNPC((int)(player.position.X + Main.rand.Next(-100, 101)), (int)(player.position.Y - 350f), ModContent.NPCType(), 1); + Main.npc[npc].timeLeft *= 20; + CalamityUtils.BossAwakenMessage(npc); } - return true; + else + NetMessage.SendData(MessageID.SpawnBoss, -1, -1, null, player.whoAmI, ModContent.NPCType()); + + return true; } public override void AddRecipes() diff --git a/Items/SummonItems/AstralChunk.cs b/Items/SummonItems/AstralChunk.cs index d85d35d685..0c77219aaa 100644 --- a/Items/SummonItems/AstralChunk.cs +++ b/Items/SummonItems/AstralChunk.cs @@ -33,12 +33,17 @@ namespace CalamityMod.Items.SummonItems public override bool UseItem(Player player) { - if (Main.netMode != NetmodeID.MultiplayerClient) + Main.PlaySound(SoundID.Roar, player.position, 0); + if (Main.netMode != NetmodeID.MultiplayerClient) { - int num = NPC.NewNPC((int)(player.position.X + (float)Main.rand.Next(-50, 50)), (int)(player.position.Y - 150f), ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); - Main.PlaySound(SoundID.Roar, player.position, 0); + int npc = NPC.NewNPC((int)(player.position.X + Main.rand.Next(-50, 50)), (int)(player.position.Y - 150f), ModContent.NPCType(), 1); + Main.npc[npc].timeLeft *= 20; + CalamityUtils.BossAwakenMessage(npc); } - return true; + else + NetMessage.SendData(MessageID.SpawnBoss, -1, -1, null, player.whoAmI, ModContent.NPCType()); + + return true; } public override void AddRecipes() diff --git a/Items/SummonItems/BirbPheromones.cs b/Items/SummonItems/BirbPheromones.cs index 6f684c71dc..1d685c1228 100644 --- a/Items/SummonItems/BirbPheromones.cs +++ b/Items/SummonItems/BirbPheromones.cs @@ -31,8 +31,12 @@ namespace CalamityMod.Items.SummonItems public override bool UseItem(Player player) { - NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); - Main.PlaySound(SoundID.Roar, player.position, 0); + Main.PlaySound(SoundID.Roar, player.position, 0); + if (Main.netMode != NetmodeID.MultiplayerClient) + NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); + else + NetMessage.SendData(MessageID.SpawnBoss, -1, -1, null, player.whoAmI, ModContent.NPCType()); + return true; } diff --git a/Items/SummonItems/BlightedEyeball.cs b/Items/SummonItems/BlightedEyeball.cs index 24fd415b40..90f90a7f9c 100644 --- a/Items/SummonItems/BlightedEyeball.cs +++ b/Items/SummonItems/BlightedEyeball.cs @@ -34,9 +34,13 @@ namespace CalamityMod.Items.SummonItems public override bool UseItem(Player player) { - NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); Main.PlaySound(SoundID.Roar, player.position, 0); - return true; + if (Main.netMode != NetmodeID.MultiplayerClient) + NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); + else + NetMessage.SendData(MessageID.SpawnBoss, -1, -1, null, player.whoAmI, ModContent.NPCType()); + + return true; } public override void AddRecipes() diff --git a/Items/SummonItems/BloodyWormFood.cs b/Items/SummonItems/BloodyWormFood.cs index 0beb8fc5ef..a3ba4ac996 100644 --- a/Items/SummonItems/BloodyWormFood.cs +++ b/Items/SummonItems/BloodyWormFood.cs @@ -33,9 +33,13 @@ namespace CalamityMod.Items.SummonItems public override bool UseItem(Player player) { - NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); Main.PlaySound(SoundID.Roar, player.position, 0); - return true; + if (Main.netMode != NetmodeID.MultiplayerClient) + NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); + else + NetMessage.SendData(MessageID.SpawnBoss, -1, -1, null, player.whoAmI, ModContent.NPCType()); + + return true; } public override void AddRecipes() diff --git a/Items/SummonItems/BulbofDoom.cs b/Items/SummonItems/BulbofDoom.cs index 98c6b10c99..6652a650e7 100644 --- a/Items/SummonItems/BulbofDoom.cs +++ b/Items/SummonItems/BulbofDoom.cs @@ -32,9 +32,13 @@ namespace CalamityMod.Items.SummonItems public override bool UseItem(Player player) { - NPC.SpawnOnPlayer(player.whoAmI, NPCID.Plantera); Main.PlaySound(SoundID.Roar, player.position, 0); - return true; + if (Main.netMode != NetmodeID.MultiplayerClient) + NPC.SpawnOnPlayer(player.whoAmI, NPCID.Plantera); + else + NetMessage.SendData(MessageID.SpawnBoss, -1, -1, null, player.whoAmI, NPCID.Plantera); + + return true; } public override void AddRecipes() diff --git a/Items/SummonItems/CharredIdol.cs b/Items/SummonItems/CharredIdol.cs index dbe391ec18..90157e7442 100644 --- a/Items/SummonItems/CharredIdol.cs +++ b/Items/SummonItems/CharredIdol.cs @@ -37,9 +37,13 @@ namespace CalamityMod.Items.SummonItems public override bool UseItem(Player player) { - NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); Main.PlaySound(SoundID.Roar, player.position, 0); - return true; + if (Main.netMode != NetmodeID.MultiplayerClient) + NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); + else + NetMessage.SendData(MessageID.SpawnBoss, -1, -1, null, player.whoAmI, ModContent.NPCType()); + + return true; } public override void AddRecipes() diff --git a/Items/SummonItems/ChickenEgg.cs b/Items/SummonItems/ChickenEgg.cs index 2cefbdadc7..6b69a55354 100644 --- a/Items/SummonItems/ChickenEgg.cs +++ b/Items/SummonItems/ChickenEgg.cs @@ -35,9 +35,13 @@ namespace CalamityMod.Items.SummonItems public override bool UseItem(Player player) { - NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); Main.PlaySound(SoundID.Roar, player.position, 0); - return true; + if (Main.netMode != NetmodeID.MultiplayerClient) + NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); + else + NetMessage.SendData(MessageID.SpawnBoss, -1, -1, null, player.whoAmI, ModContent.NPCType()); + + return true; } public override void AddRecipes() diff --git a/Items/SummonItems/CosmicWorm.cs b/Items/SummonItems/CosmicWorm.cs index 895141107f..f264d3278c 100644 --- a/Items/SummonItems/CosmicWorm.cs +++ b/Items/SummonItems/CosmicWorm.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Materials; using CalamityMod.NPCs.DevourerofGods; using CalamityMod.World; using Microsoft.Xna.Framework; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.Localization; @@ -15,7 +16,8 @@ namespace CalamityMod.Items.SummonItems { DisplayName.SetDefault("Cosmic Worm"); Tooltip.SetDefault("Summons the Devourer of Gods\n" + - "Not consumable"); + "SENTINEL WARNING TOOLTIP LINE HERE\n" + + "Not consumable"); } public override void SetDefaults() @@ -29,7 +31,19 @@ namespace CalamityMod.Items.SummonItems item.Calamity().customRarity = CalamityRarity.PureGreen; } - public override bool CanUseItem(Player player) + public override void ModifyTooltips(List list) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip1") + { + bool sentinelsNotDefeated = !CalamityWorld.downedSentinel1 || !CalamityWorld.downedSentinel2 || !CalamityWorld.downedSentinel3; + line2.text = sentinelsNotDefeated ? "WARNING! Some sentinels have not been truly defeated yet and will spawn at full power during this fight!" : ""; + } + } + } + + public override bool CanUseItem(Player player) { return !NPC.AnyNPCs(ModContent.NPCType()) && !NPC.AnyNPCs(ModContent.NPCType()) && CalamityWorld.DoGSecondStageCountdown <= 0 && CalamityWorld.downedBossAny; } @@ -39,15 +53,16 @@ namespace CalamityMod.Items.SummonItems string key = "Mods.CalamityMod.EdgyBossText12"; Color messageColor = Color.Cyan; if (Main.netMode == NetmodeID.SinglePlayer) - { Main.NewText(Language.GetTextValue(key), messageColor); - } else if (Main.netMode == NetmodeID.Server) - { NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/DevourerSpawn"), (int)player.position.X, (int)player.position.Y); + if (Main.netMode != NetmodeID.MultiplayerClient) + NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); + else + NetMessage.SendData(MessageID.SpawnBoss, -1, -1, null, player.whoAmI, ModContent.NPCType()); + return true; } @@ -60,6 +75,17 @@ namespace CalamityMod.Items.SummonItems recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); recipe.AddRecipe(); - } + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.IronBar, 30); + recipe.anyIronBar = true; + recipe.AddIngredient(ItemID.LunarBar, 10); + recipe.AddIngredient(ModContent.ItemType(), 20); + recipe.AddIngredient(ItemID.SoulofLight, 20); + recipe.AddIngredient(ItemID.SoulofNight, 20); + recipe.AddIngredient(ModContent.ItemType(), 30); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } } } diff --git a/Items/SummonItems/CryoKey.cs b/Items/SummonItems/CryoKey.cs index d80959ea35..a5912cbbdc 100644 --- a/Items/SummonItems/CryoKey.cs +++ b/Items/SummonItems/CryoKey.cs @@ -34,9 +34,13 @@ namespace CalamityMod.Items.SummonItems public override bool UseItem(Player player) { - NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); Main.PlaySound(SoundID.Roar, player.position, 0); - return true; + if (Main.netMode != NetmodeID.MultiplayerClient) + NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); + else + NetMessage.SendData(MessageID.SpawnBoss, -1, -1, null, player.whoAmI, ModContent.NPCType()); + + return true; } public override void AddRecipes() diff --git a/Items/SummonItems/DecapoditaSprout.cs b/Items/SummonItems/DecapoditaSprout.cs index 90cb377169..44ae8f77dd 100644 --- a/Items/SummonItems/DecapoditaSprout.cs +++ b/Items/SummonItems/DecapoditaSprout.cs @@ -31,12 +31,17 @@ namespace CalamityMod.Items.SummonItems public override bool UseItem(Player player) { - if (Main.netMode != NetmodeID.MultiplayerClient) + Main.PlaySound(SoundID.Roar, player.position, 0); + if (Main.netMode != NetmodeID.MultiplayerClient) { - NPC.NewNPC((int)(player.position.X + Main.rand.Next(-50, 51)), (int)(player.position.Y - 50f), ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); - Main.PlaySound(SoundID.Roar, player.position, 0); + int npc = NPC.NewNPC((int)(player.position.X + Main.rand.Next(-50, 51)), (int)(player.position.Y - 50f), ModContent.NPCType(), 1); + Main.npc[npc].timeLeft *= 20; + CalamityUtils.BossAwakenMessage(npc); } - return true; + else + NetMessage.SendData(MessageID.SpawnBoss, -1, -1, null, player.whoAmI, ModContent.NPCType()); + + return true; } public override void AddRecipes() diff --git a/Items/SummonItems/DraedonsRemote.cs b/Items/SummonItems/DraedonsRemote.cs index 3173e489ea..f7a89a685d 100644 --- a/Items/SummonItems/DraedonsRemote.cs +++ b/Items/SummonItems/DraedonsRemote.cs @@ -34,12 +34,23 @@ namespace CalamityMod.Items.SummonItems { CalamityGlobalNPC.DraedonMayhem = true; CalamityMod.UpdateServerBoolean(); - NPC.SpawnOnPlayer(player.whoAmI, NPCID.TheDestroyer); - NPC.SpawnOnPlayer(player.whoAmI, NPCID.SkeletronPrime); - NPC.SpawnOnPlayer(player.whoAmI, NPCID.Spazmatism); - NPC.SpawnOnPlayer(player.whoAmI, NPCID.Retinazer); Main.PlaySound(SoundID.Roar, player.position, 0); - return true; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + NPC.SpawnOnPlayer(player.whoAmI, NPCID.TheDestroyer); + NPC.SpawnOnPlayer(player.whoAmI, NPCID.SkeletronPrime); + NPC.SpawnOnPlayer(player.whoAmI, NPCID.Spazmatism); + NPC.SpawnOnPlayer(player.whoAmI, NPCID.Retinazer); + } + else + { + NetMessage.SendData(MessageID.SpawnBoss, -1, -1, null, player.whoAmI, NPCID.TheDestroyer); + NetMessage.SendData(MessageID.SpawnBoss, -1, -1, null, player.whoAmI, NPCID.SkeletronPrime); + NetMessage.SendData(MessageID.SpawnBoss, -1, -1, null, player.whoAmI, NPCID.Spazmatism); + NetMessage.SendData(MessageID.SpawnBoss, -1, -1, null, player.whoAmI, NPCID.Retinazer); + } + + return true; } } } diff --git a/Items/SummonItems/DriedSeafood.cs b/Items/SummonItems/DriedSeafood.cs index 352677586b..4651c1264a 100644 --- a/Items/SummonItems/DriedSeafood.cs +++ b/Items/SummonItems/DriedSeafood.cs @@ -35,14 +35,26 @@ namespace CalamityMod.Items.SummonItems public override bool UseItem(Player player) { - NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); - if (CalamityWorld.revenge) - { - NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); - NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); - } Main.PlaySound(SoundID.Roar, player.position, 0); - return true; + if (Main.netMode != NetmodeID.MultiplayerClient) + NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); + else + NetMessage.SendData(MessageID.SpawnBoss, -1, -1, null, player.whoAmI, ModContent.NPCType()); + + if (CalamityWorld.revenge) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); + else + NetMessage.SendData(MessageID.SpawnBoss, -1, -1, null, player.whoAmI, ModContent.NPCType()); + + if (Main.netMode != NetmodeID.MultiplayerClient) + NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); + else + NetMessage.SendData(MessageID.SpawnBoss, -1, -1, null, player.whoAmI, ModContent.NPCType()); + } + + return true; } public override void AddRecipes() diff --git a/Items/SummonItems/EidolonTablet.cs b/Items/SummonItems/EidolonTablet.cs index 334dd3e834..6bf6978418 100644 --- a/Items/SummonItems/EidolonTablet.cs +++ b/Items/SummonItems/EidolonTablet.cs @@ -33,10 +33,15 @@ namespace CalamityMod.Items.SummonItems { if (Main.netMode != NetmodeID.MultiplayerClient) { - int num1302 = NPC.NewNPC((int)player.Center.X + 30, (int)player.Center.Y - 90, NPCID.CultistBoss, 0, 0f, 0f, 0f, 0f, 255); - Main.npc[num1302].direction = Main.npc[num1302].spriteDirection = Math.Sign(player.Center.X - (float)player.Center.X - 30f); - } - return true; + int npc = NPC.NewNPC((int)player.Center.X + 30, (int)player.Center.Y - 90, NPCID.CultistBoss, 1); + Main.npc[npc].direction = Main.npc[npc].spriteDirection = Math.Sign(player.Center.X - player.Center.X - 30f); + Main.npc[npc].timeLeft *= 20; + CalamityUtils.BossAwakenMessage(npc); + } + else + NetMessage.SendData(MessageID.SpawnBoss, -1, -1, null, player.whoAmI, NPCID.CultistBoss); + + return true; } } } diff --git a/Items/SummonItems/EyeofExtinction.cs b/Items/SummonItems/EyeofExtinction.cs index b2c3accc05..c17ae2bb50 100644 --- a/Items/SummonItems/EyeofExtinction.cs +++ b/Items/SummonItems/EyeofExtinction.cs @@ -62,9 +62,14 @@ namespace CalamityMod.Items.SummonItems } } } - NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); + Main.PlaySound(SoundID.Roar, player.position, 0); - return true; + if (Main.netMode != NetmodeID.MultiplayerClient) + NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); + else + NetMessage.SendData(MessageID.SpawnBoss, -1, -1, null, player.whoAmI, ModContent.NPCType()); + + return true; } public override void AddRecipes() diff --git a/Items/SummonItems/NecroplasmicBeacon.cs b/Items/SummonItems/NecroplasmicBeacon.cs index 7633d4bff0..aa35fff07c 100644 --- a/Items/SummonItems/NecroplasmicBeacon.cs +++ b/Items/SummonItems/NecroplasmicBeacon.cs @@ -43,9 +43,13 @@ namespace CalamityMod.Items.SummonItems public override bool UseItem(Player player) { - NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); Main.PlaySound(SoundID.Roar, player.position, 0); - return true; + if (Main.netMode != NetmodeID.MultiplayerClient) + NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); + else + NetMessage.SendData(MessageID.SpawnBoss, -1, -1, null, player.whoAmI, ModContent.NPCType()); + + return true; } public override void AddRecipes() diff --git a/Items/SummonItems/OldPowerCell.cs b/Items/SummonItems/OldPowerCell.cs index 7574bb43f2..d17556dbb5 100644 --- a/Items/SummonItems/OldPowerCell.cs +++ b/Items/SummonItems/OldPowerCell.cs @@ -43,9 +43,13 @@ namespace CalamityMod.Items.SummonItems public override bool UseItem(Player player) { - NPC.SpawnOnPlayer(player.whoAmI, NPCID.Golem); Main.PlaySound(SoundID.Roar, player.position, 0); - return true; + if (Main.netMode != NetmodeID.MultiplayerClient) + NPC.SpawnOnPlayer(player.whoAmI, NPCID.Golem); + else + NetMessage.SendData(MessageID.SpawnBoss, -1, -1, null, player.whoAmI, NPCID.Golem); + + return true; } public override void AddRecipes() diff --git a/Items/SummonItems/OverloadedSludge.cs b/Items/SummonItems/OverloadedSludge.cs index bba085c39b..2dbad29ffd 100644 --- a/Items/SummonItems/OverloadedSludge.cs +++ b/Items/SummonItems/OverloadedSludge.cs @@ -35,11 +35,21 @@ namespace CalamityMod.Items.SummonItems public override bool UseItem(Player player) { - NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); - NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); - NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); Main.PlaySound(SoundID.Roar, player.position, 0); - return true; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); + NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); + NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); + } + else + { + NetMessage.SendData(MessageID.SpawnBoss, -1, -1, null, player.whoAmI, ModContent.NPCType()); + NetMessage.SendData(MessageID.SpawnBoss, -1, -1, null, player.whoAmI, ModContent.NPCType()); + NetMessage.SendData(MessageID.SpawnBoss, -1, -1, null, player.whoAmI, ModContent.NPCType()); + } + + return true; } public override void AddRecipes() diff --git a/Items/SummonItems/ProfanedCore.cs b/Items/SummonItems/ProfanedCore.cs index 243e8ddb02..bafef3f868 100644 --- a/Items/SummonItems/ProfanedCore.cs +++ b/Items/SummonItems/ProfanedCore.cs @@ -36,11 +36,16 @@ namespace CalamityMod.Items.SummonItems public override bool UseItem(Player player) { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ProvidenceSpawn"), (int)player.position.X, (int)player.position.Y); if (Main.netMode != NetmodeID.MultiplayerClient) { - NPC.NewNPC((int)(player.position.X + Main.rand.Next(-500, 501)), (int)(player.position.Y - 250f), ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ProvidenceSpawn"), (int)player.position.X, (int)player.position.Y); + int npc = NPC.NewNPC((int)(player.position.X + Main.rand.Next(-500, 501)), (int)(player.position.Y - 250f), ModContent.NPCType(), 1); + Main.npc[npc].timeLeft *= 20; + CalamityUtils.BossAwakenMessage(npc); } + else + NetMessage.SendData(MessageID.SpawnBoss, -1, -1, null, player.whoAmI, ModContent.NPCType()); + return true; } } diff --git a/Items/SummonItems/ProfanedCoreUnlimited.cs b/Items/SummonItems/ProfanedCoreUnlimited.cs index 61ffe27608..c323f9b4f6 100644 --- a/Items/SummonItems/ProfanedCoreUnlimited.cs +++ b/Items/SummonItems/ProfanedCoreUnlimited.cs @@ -37,11 +37,16 @@ namespace CalamityMod.Items.SummonItems public override bool UseItem(Player player) { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ProvidenceSpawn"), (int)player.position.X, (int)player.position.Y); if (Main.netMode != NetmodeID.MultiplayerClient) { - NPC.NewNPC((int)(player.position.X + Main.rand.Next(-500, 501)), (int)(player.position.Y - 250f), ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ProvidenceSpawn"), (int)player.position.X, (int)player.position.Y); + int npc = NPC.NewNPC((int)(player.position.X + Main.rand.Next(-500, 501)), (int)(player.position.Y - 250f), ModContent.NPCType(), 1); + Main.npc[npc].timeLeft *= 20; + CalamityUtils.BossAwakenMessage(npc); } + else + NetMessage.SendData(MessageID.SpawnBoss, -1, -1, null, player.whoAmI, ModContent.NPCType()); + return true; } diff --git a/Items/SummonItems/ProfanedShard.cs b/Items/SummonItems/ProfanedShard.cs index 8cda5125b7..3b8115d4a6 100644 --- a/Items/SummonItems/ProfanedShard.cs +++ b/Items/SummonItems/ProfanedShard.cs @@ -35,9 +35,13 @@ namespace CalamityMod.Items.SummonItems public override bool UseItem(Player player) { - NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); Main.PlaySound(SoundID.Roar, player.position, 0); - return true; + if (Main.netMode != NetmodeID.MultiplayerClient) + NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); + else + NetMessage.SendData(MessageID.SpawnBoss, -1, -1, null, player.whoAmI, ModContent.NPCType()); + + return true; } public override void AddRecipes() diff --git a/Items/SummonItems/RuneofCos.cs b/Items/SummonItems/RuneofCos.cs index bf2fb5e08a..22e0631d31 100644 --- a/Items/SummonItems/RuneofCos.cs +++ b/Items/SummonItems/RuneofCos.cs @@ -42,11 +42,12 @@ namespace CalamityMod.Items.SummonItems public override bool UseItem(Player player) { - if (player.ZoneDungeon) + Main.PlaySound(SoundID.Roar, player.position, 0); + if (player.ZoneDungeon) { - NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); if (Main.netMode != NetmodeID.MultiplayerClient) { + NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); for (int num662 = 0; num662 < 2; num662++) { NPC.NewNPC((int)player.Center.X - 200, (int)player.Center.Y - 200, ModContent.NPCType()); @@ -54,16 +55,24 @@ namespace CalamityMod.Items.SummonItems NPC.NewNPC((int)player.Center.X, (int)player.Center.Y + 200, ModContent.NPCType()); } } + else + NetMessage.SendData(MessageID.SpawnBoss, -1, -1, null, player.whoAmI, ModContent.NPCType()); } else if (player.ZoneUnderworldHeight) { - NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); - } + if (Main.netMode != NetmodeID.MultiplayerClient) + NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); + else + NetMessage.SendData(MessageID.SpawnBoss, -1, -1, null, player.whoAmI, ModContent.NPCType()); + } else if (player.ZoneSkyHeight) { - NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); - } - Main.PlaySound(SoundID.Roar, player.position, 0); + if (Main.netMode != NetmodeID.MultiplayerClient) + NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); + else + NetMessage.SendData(MessageID.SpawnBoss, -1, -1, null, player.whoAmI, ModContent.NPCType()); + } + return true; } @@ -71,8 +80,8 @@ namespace CalamityMod.Items.SummonItems { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 40); - recipe.AddIngredient(ItemID.LunarBar, 10); - recipe.AddIngredient(ItemID.FragmentSolar, 5); + recipe.AddIngredient(ItemID.FragmentSolar, 5); + recipe.AddIngredient(ItemID.LunarBar, 3); recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/SummonItems/SandstormsCore.cs b/Items/SummonItems/SandstormsCore.cs index 82c6222426..54f8c4d04f 100644 --- a/Items/SummonItems/SandstormsCore.cs +++ b/Items/SummonItems/SandstormsCore.cs @@ -31,9 +31,13 @@ namespace CalamityMod.Items.SummonItems public override bool UseItem(Player player) { - NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); Main.PlaySound(SoundID.Roar, player.position, 0); - return true; + if (Main.netMode != NetmodeID.MultiplayerClient) + NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); + else + NetMessage.SendData(MessageID.SpawnBoss, -1, -1, null, player.whoAmI, ModContent.NPCType()); + + return true; } public override void AddRecipes() diff --git a/Items/SummonItems/Seafood.cs b/Items/SummonItems/Seafood.cs index 85fe14322d..0dd0a1f437 100644 --- a/Items/SummonItems/Seafood.cs +++ b/Items/SummonItems/Seafood.cs @@ -36,9 +36,13 @@ namespace CalamityMod.Items.SummonItems public override bool UseItem(Player player) { - NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); Main.PlaySound(SoundID.Roar, player.position, 0); - return true; + if (Main.netMode != NetmodeID.MultiplayerClient) + NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); + else + NetMessage.SendData(MessageID.SpawnBoss, -1, -1, null, player.whoAmI, ModContent.NPCType()); + + return true; } public override void AddRecipes() diff --git a/Items/SummonItems/Starcore.cs b/Items/SummonItems/Starcore.cs index 7034381069..5ff2b9863b 100644 --- a/Items/SummonItems/Starcore.cs +++ b/Items/SummonItems/Starcore.cs @@ -1,8 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; using CalamityMod.Items.Potions; -using CalamityMod.NPCs.AstrumDeus; -using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -14,8 +12,7 @@ namespace CalamityMod.Items.SummonItems { DisplayName.SetDefault("Starcore"); Tooltip.SetDefault("May the stars guide your way\n" + - "Summons Astrum Deus\n" + - "Not consumable"); + "Summons Astrum Deus at the Astral Beacon but is not consumed."); } public override void SetDefaults() @@ -23,22 +20,6 @@ namespace CalamityMod.Items.SummonItems item.width = 34; item.height = 40; item.rare = 9; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = ItemUseStyleID.HoldingUp; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return !Main.dayTime && player.Calamity().ZoneAstral && !NPC.AnyNPCs(ModContent.NPCType()); - } - - public override bool UseItem(Player player) - { - NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); - Main.PlaySound(SoundID.Roar, player.position, 0); - return true; } public override void AddRecipes() diff --git a/Items/SummonItems/Teratoma.cs b/Items/SummonItems/Teratoma.cs index 4b4c8aeba5..6fc0084733 100644 --- a/Items/SummonItems/Teratoma.cs +++ b/Items/SummonItems/Teratoma.cs @@ -33,12 +33,17 @@ namespace CalamityMod.Items.SummonItems public override bool UseItem(Player player) { - if (Main.netMode != NetmodeID.MultiplayerClient) + Main.PlaySound(SoundID.Roar, player.position, 0); + if (Main.netMode != NetmodeID.MultiplayerClient) { - int num = NPC.NewNPC((int)(player.position.X + (float)Main.rand.Next(-100, 100)), (int)(player.position.Y - 150f), ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); - Main.PlaySound(SoundID.Roar, player.position, 0); + int npc = NPC.NewNPC((int)(player.position.X + Main.rand.Next(-100, 100)), (int)(player.position.Y - 150f), ModContent.NPCType(), 1); + Main.npc[npc].timeLeft *= 20; + CalamityUtils.BossAwakenMessage(npc); } - return true; + else + NetMessage.SendData(MessageID.SpawnBoss, -1, -1, null, player.whoAmI, ModContent.NPCType()); + + return true; } public override void AddRecipes() diff --git a/Items/SuperDummy.cs b/Items/SuperDummy.cs index b8b41984d0..529903f6f9 100644 --- a/Items/SuperDummy.cs +++ b/Items/SuperDummy.cs @@ -5,80 +5,80 @@ using Terraria.ModLoader; namespace CalamityMod.Items { - public class SuperDummy : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Super Dummy"); - Tooltip.SetDefault("Creates a super dummy\n" + - "Regenerates 1 million life per second\n" + - "Will not die when taking damage over time from debuffs\n" + - "Right click to kill all super dummies"); - } + public class SuperDummy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Super Dummy"); + Tooltip.SetDefault("Creates a super dummy\n" + + "Regenerates 1 million life per second\n" + + "Will not die when taking damage over time from debuffs\n" + + "Right click to kill all super dummies"); + } - public override void SetDefaults() - { - item.damage = 0; - item.width = 20; - item.height = 30; - item.useTime = 15; - item.useAnimation = 15; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTurn = true; - item.value = 0; - item.rare = 1; - item.autoReuse = true; - } + public override void SetDefaults() + { + item.damage = 0; + item.width = 20; + item.height = 30; + item.useTime = 15; + item.useAnimation = 15; + item.useStyle = ItemUseStyleID.SwingThrow; + item.useTurn = true; + item.value = 0; + item.rare = 1; + item.autoReuse = true; + } - public override bool AltFunctionUse(Player player) - { - return true; - } + public override bool AltFunctionUse(Player player) + { + return true; + } - public override bool UseItem(Player player) - { - if (player.altFunctionUse == 2) - { - for (int i = 0; i < Main.maxNPCs; i++) - { - if (Main.npc[i].type == ModContent.NPCType()) - { - Main.npc[i].life = 0; - Main.npc[i].lifeRegen = 0; - Main.npc[i].checkDead(); - Main.npc[i].netUpdate = true; - } - } - } - else if (player.whoAmI == Main.myPlayer) - { - int x = (int)Main.MouseWorld.X - 9; - int y = (int)Main.MouseWorld.Y - 20; + public override bool UseItem(Player player) + { + if (player.altFunctionUse == 2) + { + for (int i = 0; i < Main.maxNPCs; i++) + { + NPC npc = Main.npc[i]; + if (npc.type == ModContent.NPCType() && npc.active) + { + npc.active = false; + npc.netUpdate = true; + Main.PlaySound(SoundID.NPCDeath2, npc.Center); + } + } + } + else if (player.whoAmI == Main.myPlayer) + { + int x = (int)Main.MouseWorld.X - 9; + int y = (int)Main.MouseWorld.Y - 20; - // In single player, just spawn the dummy. - if (Main.netMode == NetmodeID.SinglePlayer) - NPC.NewNPC(x, y, ModContent.NPCType()); + // In single player, just spawn the dummy. + if (Main.netMode == NetmodeID.SinglePlayer) + NPC.NewNPC(x, y, ModContent.NPCType()); - // Otherwise, send a message to the server indicating that a Super Dummy should be spawned at this position. - else - { - var netMessage = mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.SpawnSuperDummy); - netMessage.Write(x); - netMessage.Write(y); - netMessage.Send(); - } - } - return true; - } + // Otherwise, send a message to the server indicating that a Super Dummy should be spawned at this position. + else + { + var netMessage = mod.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.SpawnSuperDummy); + netMessage.Write(x); + netMessage.Write(y); + netMessage.Send(); + } + } + return true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.TargetDummy); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.TargetDummy); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Tools/ClimateChange/BloodIdol.png b/Items/Tools/ClimateChange/BloodIdol.png index 6fea635e5d..cdd73b1f65 100644 Binary files a/Items/Tools/ClimateChange/BloodIdol.png and b/Items/Tools/ClimateChange/BloodIdol.png differ diff --git a/Items/Tools/ClimateChange/Cosmolight.cs b/Items/Tools/ClimateChange/Cosmolight.cs index c372575163..681306c541 100644 --- a/Items/Tools/ClimateChange/Cosmolight.cs +++ b/Items/Tools/ClimateChange/Cosmolight.cs @@ -1,4 +1,4 @@ -using CalamityMod.NPCs; +using CalamityMod.CalPlayer; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Tools.ClimateChange public override bool CanUseItem(Player player) { - return !CalamityGlobalNPC.AnyBossNPCS(); + return !CalamityPlayer.areThereAnyDamnBosses; } public override bool UseItem(Player player) diff --git a/Items/Tools/ClimateChange/Daylight.cs b/Items/Tools/ClimateChange/Daylight.cs index 1d4e405fde..d9e280c78e 100644 --- a/Items/Tools/ClimateChange/Daylight.cs +++ b/Items/Tools/ClimateChange/Daylight.cs @@ -1,4 +1,4 @@ -using CalamityMod.NPCs; +using CalamityMod.CalPlayer; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Tools.ClimateChange public override bool CanUseItem(Player player) { - return !Main.dayTime && !CalamityGlobalNPC.AnyBossNPCS(); + return !Main.dayTime && !CalamityPlayer.areThereAnyDamnBosses; } public override bool UseItem(Player player) diff --git a/Items/Tools/ClimateChange/Moonlight.cs b/Items/Tools/ClimateChange/Moonlight.cs index 7ed05c712c..d5afd2cab2 100644 --- a/Items/Tools/ClimateChange/Moonlight.cs +++ b/Items/Tools/ClimateChange/Moonlight.cs @@ -1,5 +1,5 @@ using CalamityMod.Items.Materials; -using CalamityMod.NPCs; +using CalamityMod.CalPlayer; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Tools.ClimateChange public override bool CanUseItem(Player player) { - return Main.dayTime && !CalamityGlobalNPC.AnyBossNPCS(); + return Main.dayTime && !CalamityPlayer.areThereAnyDamnBosses; } public override bool UseItem(Player player) diff --git a/Items/Tools/CrystylCrusher.cs b/Items/Tools/CrystylCrusher.cs index 44febeec27..875f237fc3 100644 --- a/Items/Tools/CrystylCrusher.cs +++ b/Items/Tools/CrystylCrusher.cs @@ -31,8 +31,7 @@ namespace CalamityMod.Items.Tools item.crit += 25; item.width = 70; item.height = 70; - item.useTime = 20; - item.useAnimation = 20; + item.useTime = item.useAnimation = 2; item.useStyle = ItemUseStyleID.HoldingOut; item.knockBack = 9f; item.shootSpeed = 14f; @@ -50,10 +49,7 @@ namespace CalamityMod.Items.Tools return new Vector2(10, 10); } - public override bool AltFunctionUse(Player player) - { - return true; - } + public override bool AltFunctionUse(Player player) => true; public override bool CanUseItem(Player player) { @@ -62,11 +58,9 @@ namespace CalamityMod.Items.Tools item.pick = PickPower; item.shoot = ProjectileID.None; item.shootSpeed = 0f; - item.tileBoost += 50; + item.tileBoost = 50; item.UseSound = SoundID.Item1; item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 2; - item.useAnimation = 10; item.useTurn = true; item.autoReuse = true; item.noMelee = false; @@ -80,8 +74,6 @@ namespace CalamityMod.Items.Tools item.tileBoost = 0; item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/CrystylCharge"); item.useStyle = ItemUseStyleID.HoldingOut; - item.useTime = 20; - item.useAnimation = 20; item.useTurn = false; item.autoReuse = false; item.noMelee = true; @@ -92,22 +84,18 @@ namespace CalamityMod.Items.Tools public override void MeleeEffects(Player player, Rectangle hitbox) { + if (player.altFunctionUse == 2) + return; + if (Main.rand.NextBool(3)) { - int num307 = Main.rand.Next(3); - if (num307 == 0) + int dustType = Utils.SelectRandom(Main.rand, new int[] { - num307 = 173; - } - else if (num307 == 1) - { - num307 = 57; - } - else - { - num307 = 58; - } - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, num307); + 173, + 57, + 58 + }); + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, dustType); } } diff --git a/Items/Tools/GallantPickaxe.cs b/Items/Tools/GallantPickaxe.cs index b9d891f4f5..06659b65f8 100644 --- a/Items/Tools/GallantPickaxe.cs +++ b/Items/Tools/GallantPickaxe.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Tools { public override void SetStaticDefaults() { - DisplayName.SetDefault("Gallant Pickaxe"); + DisplayName.SetDefault("Genesis Pickaxe"); Tooltip.SetDefault("Can mine Uelibloom Ore"); } @@ -18,20 +18,19 @@ namespace CalamityMod.Items.Tools { item.damage = 80; item.melee = true; - item.width = 54; - item.height = 54; - item.useTime = 6; - item.useAnimation = 12; + item.width = 84; + item.height = 80; + item.useTime = 7; + item.useAnimation = 14; item.useTurn = true; item.pick = 225; item.useStyle = ItemUseStyleID.SwingThrow; item.knockBack = 5.5f; - item.value = Item.buyPrice(1, 20, 0, 0); + item.value = Item.buyPrice(1, 0, 0, 0); item.rare = 10; item.UseSound = SoundID.Item1; item.autoReuse = true; - item.tileBoost += 4; - item.Calamity().customRarity = CalamityRarity.Turquoise; + item.tileBoost += 6; item.useTurn = true; } @@ -50,7 +49,7 @@ namespace CalamityMod.Items.Tools { if (Main.rand.NextBool(5)) { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 58); + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 62); } } } diff --git a/Items/Tools/GallantPickaxe.png b/Items/Tools/GallantPickaxe.png index c61cc5f0ab..9937b7fc19 100644 Binary files a/Items/Tools/GallantPickaxe.png and b/Items/Tools/GallantPickaxe.png differ diff --git a/Items/Tools/Gelpick.cs b/Items/Tools/Gelpick.cs index c5770c628a..84dfda6bfa 100644 --- a/Items/Tools/Gelpick.cs +++ b/Items/Tools/Gelpick.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -37,7 +38,7 @@ namespace CalamityMod.Items.Tools recipe.AddIngredient(ModContent.ItemType(), 15); recipe.AddIngredient(ItemID.Gel, 30); recipe.AddIngredient(ItemID.HellstoneBar, 5); - recipe.AddTile(TileID.Anvils); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Tools/InfernaCutter.cs b/Items/Tools/InfernaCutter.cs index f908af4673..23ba9cc9b5 100644 --- a/Items/Tools/InfernaCutter.cs +++ b/Items/Tools/InfernaCutter.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Tools item.damage = 110; item.crit += 10; item.melee = true; - item.width = 60; + item.width = 62; item.height = 46; item.useTime = 8; item.useAnimation = 12; @@ -36,6 +36,11 @@ namespace CalamityMod.Items.Tools item.autoReuse = true; } + public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox) + { + hitbox = CalamityUtils.FixSwingHitbox(54, 54); + } + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); diff --git a/Items/Tools/InfernaCutter.png b/Items/Tools/InfernaCutter.png index 668df7465d..724433e9c9 100644 Binary files a/Items/Tools/InfernaCutter.png and b/Items/Tools/InfernaCutter.png differ diff --git a/Items/Tools/WulfrumAxe.cs b/Items/Tools/WulfrumAxe.cs index 457e96fb4f..0e2b0fa44c 100644 --- a/Items/Tools/WulfrumAxe.cs +++ b/Items/Tools/WulfrumAxe.cs @@ -16,8 +16,8 @@ namespace CalamityMod.Items.Tools { item.damage = 5; item.melee = true; - item.width = 62; - item.height = 58; + item.width = 30; + item.height = 38; item.useTime = 26; item.useAnimation = 26; item.useTurn = true; diff --git a/Items/Tools/WulfrumAxe.png b/Items/Tools/WulfrumAxe.png index edac3515c0..7bd72fbc30 100644 Binary files a/Items/Tools/WulfrumAxe.png and b/Items/Tools/WulfrumAxe.png differ diff --git a/Items/Tools/WulfrumHammer.cs b/Items/Tools/WulfrumHammer.cs index c4643b22ca..57a0d6a014 100644 --- a/Items/Tools/WulfrumHammer.cs +++ b/Items/Tools/WulfrumHammer.cs @@ -16,8 +16,8 @@ namespace CalamityMod.Items.Tools { item.damage = 7; item.melee = true; - item.width = 56; - item.height = 56; + item.width = 28; + item.height = 38; item.useTime = 29; item.useAnimation = 29; item.useTurn = true; diff --git a/Items/Tools/WulfrumHammer.png b/Items/Tools/WulfrumHammer.png index 030ee2396b..05741786eb 100644 Binary files a/Items/Tools/WulfrumHammer.png and b/Items/Tools/WulfrumHammer.png differ diff --git a/Items/Tools/WulfrumPickaxe.cs b/Items/Tools/WulfrumPickaxe.cs index 7c5faf290a..0d8c6a3592 100644 --- a/Items/Tools/WulfrumPickaxe.cs +++ b/Items/Tools/WulfrumPickaxe.cs @@ -16,8 +16,8 @@ namespace CalamityMod.Items.Tools { item.damage = 5; item.melee = true; - item.width = 48; - item.height = 48; + item.width = 46; + item.height = 38; item.useTime = 16; item.useAnimation = 16; item.useTurn = true; diff --git a/Items/Tools/WulfrumPickaxe.png b/Items/Tools/WulfrumPickaxe.png index dcb359dd90..2dc3379335 100644 Binary files a/Items/Tools/WulfrumPickaxe.png and b/Items/Tools/WulfrumPickaxe.png differ diff --git a/Items/TreasureBags/AstrumDeusBag.cs b/Items/TreasureBags/AstrumDeusBag.cs index 67c8777c76..528c3942da 100644 --- a/Items/TreasureBags/AstrumDeusBag.cs +++ b/Items/TreasureBags/AstrumDeusBag.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Accessories; using CalamityMod.Items.Armor.Vanity; using CalamityMod.Items.Materials; +using CalamityMod.Items.Pets; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Magic; @@ -33,10 +34,7 @@ namespace CalamityMod.Items.TreasureBags item.rare = 9; } - public override bool CanRightClick() - { - return true; - } + public override bool CanRightClick() => true; public override void PostUpdate() => CalamityUtils.ForceItemIntoWorld(item); @@ -58,6 +56,7 @@ namespace CalamityMod.Items.TreasureBags // Equipment DropHelper.DropItemRIV(player, ModContent.ItemType(), ModContent.ItemType(), 1f, DropHelper.RareVariantDropRateFloat); + DropHelper.DropItemChance(player, ModContent.ItemType(), 5); // Vanity DropHelper.DropItemChance(player, ModContent.ItemType(), 7); diff --git a/Items/TreasureBags/BumblebirbBag.cs b/Items/TreasureBags/BumblebirbBag.cs index 6b7dfd8bb8..76c64db0b3 100644 --- a/Items/TreasureBags/BumblebirbBag.cs +++ b/Items/TreasureBags/BumblebirbBag.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Items.TreasureBags player.TryGettingDevArmor(); // Materials - DropHelper.DropItem(player, ModContent.ItemType(), 9, 14); + DropHelper.DropItem(player, ModContent.ItemType(), 15, 21); // Weapons DropHelper.DropItemChance(player, ModContent.ItemType(), 3); diff --git a/Items/TreasureBags/LeviathanBag.cs b/Items/TreasureBags/LeviathanBag.cs index 1dc1bf6a76..72b97af33f 100644 --- a/Items/TreasureBags/LeviathanBag.cs +++ b/Items/TreasureBags/LeviathanBag.cs @@ -33,10 +33,7 @@ namespace CalamityMod.Items.TreasureBags item.expert = true; } - public override bool CanRightClick() - { - return true; - } + public override bool CanRightClick() => true; public override void PostUpdate() => CalamityUtils.ForceItemIntoWorld(item); @@ -63,6 +60,7 @@ namespace CalamityMod.Items.TreasureBags // Vanity DropHelper.DropItemChance(player, ModContent.ItemType(), 7); + DropHelper.DropItemChance(player, ModContent.ItemType(), 7); // Fishing DropHelper.DropItemChance(player, ItemID.HotlineFishingHook, 10); diff --git a/Items/TreasureBags/LeviathanBag.png b/Items/TreasureBags/LeviathanBag.png index 2928778427..23539eab22 100644 Binary files a/Items/TreasureBags/LeviathanBag.png and b/Items/TreasureBags/LeviathanBag.png differ diff --git a/Items/TreasureBags/SlimeGodBag.cs b/Items/TreasureBags/SlimeGodBag.cs index 267bdfc8e2..e467516e1c 100644 --- a/Items/TreasureBags/SlimeGodBag.cs +++ b/Items/TreasureBags/SlimeGodBag.cs @@ -2,7 +2,6 @@ using CalamityMod.Items.Accessories; using CalamityMod.Items.Armor.Vanity; using CalamityMod.Items.Materials; using CalamityMod.Items.PermanentBoosters; -using CalamityMod.Items.Placeables.Furniture.CraftingStations; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Summon; @@ -43,7 +42,7 @@ namespace CalamityMod.Items.TreasureBags { // Materials DropHelper.DropItem(player, ItemID.Gel, 30, 60); - DropHelper.DropItem(player, ModContent.ItemType(), 30, 50); + DropHelper.DropItem(player, ModContent.ItemType(), 35, 55); // Weapons DropHelper.DropItemChance(player, ModContent.ItemType(), 3); @@ -57,10 +56,9 @@ namespace CalamityMod.Items.TreasureBags DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.revenge && !player.Calamity().adrenalineBoostOne); // Vanity - DropHelper.DropItemFromSetChance(player, 7, ModContent.ItemType(), ModContent.ItemType()); + DropHelper.DropItemFromSetChance(player, 0.142857f, ModContent.ItemType(), ModContent.ItemType()); // Other - DropHelper.DropItem(player, ModContent.ItemType()); } } } diff --git a/Items/TreasureBags/YharonBag.cs b/Items/TreasureBags/YharonBag.cs index 46cf9622e8..6ff2fd0d13 100644 --- a/Items/TreasureBags/YharonBag.cs +++ b/Items/TreasureBags/YharonBag.cs @@ -42,8 +42,6 @@ namespace CalamityMod.Items.TreasureBags { player.TryGettingDevArmor(); - // Materials - // Weapons DropHelper.DropItemChance(player, ModContent.ItemType(), 3); DropHelper.DropItemChance(player, ModContent.ItemType(), 3); diff --git a/Items/Weapons/DraedonsArsenal/GatlingLaser.cs b/Items/Weapons/DraedonsArsenal/GatlingLaser.cs index d6d911a91a..826747b8bc 100644 --- a/Items/Weapons/DraedonsArsenal/GatlingLaser.cs +++ b/Items/Weapons/DraedonsArsenal/GatlingLaser.cs @@ -1,3 +1,4 @@ +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.DraedonsArsenal; using Microsoft.Xna.Framework; using Terraria; @@ -6,15 +7,13 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.DraedonsArsenal { - public class GatlingLaser : ModItem + public class GatlingLaser : ModItem { - private int BaseDamage = 430; - public override void SetStaticDefaults() { DisplayName.SetDefault("Gatling Laser"); Tooltip.SetDefault("Large laser cannon used primarily by Yharim's fleet and base defense force\n" + - "Highly accurate, but lacks the power to punch through defensive targets"); + "Highly accurate, but lacks the power to punch through defensive targets"); } public override void SetDefaults() @@ -22,7 +21,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal item.width = 58; item.height = 24; item.magic = true; - item.damage = BaseDamage; + item.damage = 54; item.knockBack = 1f; item.useTime = 2; item.useAnimation = 2; @@ -34,16 +33,18 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/GatlingLaserFireStart"); item.noMelee = true; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.RareVariant; + item.value = CalamityGlobalItem.Rarity8BuyPrice; + item.rare = ItemRarityID.Red; + item.Calamity().customRarity = CalamityRarity.DraedonRust; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 24f; - item.useAmmo = AmmoID.Bullet; + + item.Calamity().Chargeable = true; + item.Calamity().ChargeMax = 135; } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 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) { @@ -62,16 +63,17 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal return new Vector2(-20, 0); } - /*public override void AddRecipes() + public override void AddRecipes() { - ModRecipe r = new ModRecipe(mod); - r.AddIngredient(null, "CrownJewel"); - r.AddIngredient(null, "GalacticaSingularity", 5); - r.AddIngredient(null, "BarofLife", 10); - r.AddIngredient(null, "CosmiliteBar", 15); - r.AddTile(TileID.LunarCraftingStation); - r.SetResult(this); - r.AddRecipe(); - }*/ + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddIngredient(ModContent.ItemType(), 20); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddIngredient(ItemID.LaserMachinegun); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } } } diff --git a/Items/Weapons/DraedonsArsenal/GaussDagger.cs b/Items/Weapons/DraedonsArsenal/GaussDagger.cs new file mode 100644 index 0000000000..a32a6401cd --- /dev/null +++ b/Items/Weapons/DraedonsArsenal/GaussDagger.cs @@ -0,0 +1,66 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.DraedonsArsenal; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.DraedonsArsenal +{ + public class GaussDagger : ModItem + { + public const int HitsRequiredForFlux = 3; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Gauss Dagger"); + Tooltip.SetDefault("Repeat strikes envelop foes in magnetic flux"); + } + public override void SetDefaults() + { + item.damage = 30; + item.melee = true; + item.width = 26; + item.height = 26; + item.useTime = 24; + item.useAnimation = 24; + item.useStyle = ItemUseStyleID.SwingThrow; + item.useTurn = false; + item.knockBack = 7f; + + item.value = CalamityGlobalItem.Rarity3BuyPrice; + item.rare = ItemRarityID.Red; + item.Calamity().customRarity = CalamityRarity.DraedonRust; + + item.UseSound = SoundID.Item1; + item.autoReuse = true; + + item.Calamity().Chargeable = true; + item.Calamity().ChargeMax = 50; + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockBack, bool crit) + { + target.Calamity().GaussFluxTimer += 50; + if (target.Calamity().GaussFluxTimer >= 30 * HitsRequiredForFlux) + { + target.Calamity().GaussFluxTimer = 0; + if (player.whoAmI == Main.myPlayer) + { + Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, player.whoAmI, 0f, target.whoAmI); + } + } + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddIngredient(ModContent.ItemType(), 7); + recipe.AddIngredient(ModContent.ItemType(), 4); + recipe.AddIngredient(ItemID.MeteoriteBar, 4); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/DraedonsArsenal/GaussDagger.png b/Items/Weapons/DraedonsArsenal/GaussDagger.png new file mode 100644 index 0000000000..77ac1dfc11 Binary files /dev/null and b/Items/Weapons/DraedonsArsenal/GaussDagger.png differ diff --git a/Items/Weapons/DraedonsArsenal/GaussPistol.cs b/Items/Weapons/DraedonsArsenal/GaussPistol.cs new file mode 100644 index 0000000000..8d6245d72b --- /dev/null +++ b/Items/Weapons/DraedonsArsenal/GaussPistol.cs @@ -0,0 +1,54 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.DraedonsArsenal; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.DraedonsArsenal +{ + public class GaussPistol : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Gauss Pistol"); + Tooltip.SetDefault("Fires a devastating high velocity blast with extreme knockback"); + } + + public override void SetDefaults() + { + item.width = 40; + item.height = 22; + item.magic = true; + item.mana = 6; + item.damage = 70; + item.knockBack = 11f; + item.useTime = item.useAnimation = 20; + item.autoReuse = true; + + item.useStyle = ItemUseStyleID.HoldingOut; + item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/GaussWeaponFire"); + item.noMelee = true; + + item.value = CalamityGlobalItem.Rarity5BuyPrice; + item.rare = ItemRarityID.Red; + item.Calamity().customRarity = CalamityRarity.DraedonRust; + + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 14f; + + item.Calamity().ChargeMax = 85; + item.Calamity().Chargeable = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 12); + recipe.AddIngredient(ModContent.ItemType(), 8); + recipe.AddIngredient(ItemID.HallowedBar, 10); + recipe.AddIngredient(ItemID.SpaceGun); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/DraedonsArsenal/GaussPistol.png b/Items/Weapons/DraedonsArsenal/GaussPistol.png new file mode 100644 index 0000000000..d68e739419 Binary files /dev/null and b/Items/Weapons/DraedonsArsenal/GaussPistol.png differ diff --git a/Items/Weapons/DraedonsArsenal/GaussRifle.cs b/Items/Weapons/DraedonsArsenal/GaussRifle.cs new file mode 100644 index 0000000000..519060b14c --- /dev/null +++ b/Items/Weapons/DraedonsArsenal/GaussRifle.cs @@ -0,0 +1,63 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Projectiles.DraedonsArsenal; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.DraedonsArsenal +{ + public class GaussRifle : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Gauss Rifle"); + Tooltip.SetDefault("Fires a devastating high velocity blast with absurd knockback"); + } + + public override void SetDefaults() + { + item.width = 112; + item.height = 36; + item.ranged = true; + item.damage = 170; + item.knockBack = 30f; + item.useTime = item.useAnimation = 28; + item.autoReuse = true; + + item.useStyle = ItemUseStyleID.HoldingOut; + item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/GaussWeaponFire"); + item.noMelee = true; + + item.value = CalamityGlobalItem.Rarity8BuyPrice; + item.rare = ItemRarityID.Red; + item.Calamity().customRarity = CalamityRarity.DraedonRust; + + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 27f; + + item.Calamity().Chargeable = true; + item.Calamity().ChargeMax = 135; + } + + 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, knockBack, player.whoAmI, 0f, 0f); + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 18); + recipe.AddIngredient(ModContent.ItemType(), 12); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/DraedonsArsenal/GaussRifle.png b/Items/Weapons/DraedonsArsenal/GaussRifle.png new file mode 100644 index 0000000000..c89b03861e Binary files /dev/null and b/Items/Weapons/DraedonsArsenal/GaussRifle.png differ diff --git a/Items/Weapons/DraedonsArsenal/HydraulicVoltCrasher.cs b/Items/Weapons/DraedonsArsenal/HydraulicVoltCrasher.cs new file mode 100644 index 0000000000..2cdaa7ff59 --- /dev/null +++ b/Items/Weapons/DraedonsArsenal/HydraulicVoltCrasher.cs @@ -0,0 +1,55 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.DraedonsArsenal; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.DraedonsArsenal +{ + public class HydraulicVoltCrasher : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hydraulic Volt Crasher"); + Tooltip.SetDefault("An electrically charged jackhammer which shocks all nearby foes on hit"); + } + + public override void SetDefaults() + { + item.useStyle = ItemUseStyleID.HoldingOut; + item.useAnimation = 16; + item.useTime = 4; + item.shootSpeed = 46f; + item.knockBack = 12f; + item.width = 56; + item.height = 24; + item.damage = 99; + item.hammer = 230; + item.UseSound = SoundID.Item23; + + item.shoot = ModContent.ProjectileType(); + item.value = CalamityGlobalItem.Rarity5BuyPrice; + item.rare = ItemRarityID.Red; + item.Calamity().customRarity = CalamityRarity.DraedonRust; + + item.noMelee = true; + item.noUseGraphic = true; + item.melee = true; + item.channel = true; + + item.Calamity().Chargeable = true; + item.Calamity().ChargeMax = 85; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 8); + recipe.AddIngredient(ModContent.ItemType(), 12); + recipe.AddIngredient(ItemID.HallowedBar, 10); + recipe.AddIngredient(ItemID.SoulofMight, 20); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/DraedonsArsenal/HydraulicVoltCrasher.png b/Items/Weapons/DraedonsArsenal/HydraulicVoltCrasher.png new file mode 100644 index 0000000000..878fa7298b Binary files /dev/null and b/Items/Weapons/DraedonsArsenal/HydraulicVoltCrasher.png differ diff --git a/Items/Weapons/DraedonsArsenal/LaserRifle.cs b/Items/Weapons/DraedonsArsenal/LaserRifle.cs index 85850d92db..18a9b59409 100644 --- a/Items/Weapons/DraedonsArsenal/LaserRifle.cs +++ b/Items/Weapons/DraedonsArsenal/LaserRifle.cs @@ -1,3 +1,4 @@ +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.DraedonsArsenal; using Microsoft.Xna.Framework; using Terraria; @@ -8,8 +9,6 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal { public class LaserRifle : ModItem { - private int BaseDamage = 200; - public override void SetStaticDefaults() { DisplayName.SetDefault("Heavy Laser Rifle"); @@ -22,7 +21,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal item.width = 84; item.height = 28; item.ranged = true; - item.damage = BaseDamage; + item.damage = 270; item.knockBack = 4f; item.useTime = 25; item.useAnimation = 25; @@ -32,13 +31,15 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserRifleFire"); item.noMelee = true; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.RareVariant; + item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; + item.rare = ItemRarityID.Red; + item.Calamity().customRarity = CalamityRarity.DraedonRust; item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 1f; - item.useAmmo = AmmoID.Bullet; + item.shootSpeed = 5f; + + item.Calamity().Chargeable = true; + item.Calamity().ChargeMax = 190; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -49,21 +50,12 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal velocity.Normalize(); velocity *= 5f; } - - float SpeedX = velocity.X + (float)Main.rand.Next(-1, 2) * 0.05f; - float SpeedY = velocity.Y + (float)Main.rand.Next(-1, 2) * 0.05f; - - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); - - // Consume 4 ammo per shot - CalamityGlobalItem.ConsumeAdditionalAmmo(player, item, 4); - - return false; - } - - // Disable vanilla ammo consumption - public override bool ConsumeAmmo(Player player) - { + for (int i = 0; i < 2; i++) + { + float SpeedX = velocity.X + Main.rand.Next(-1, 2) * 0.05f; + float SpeedY = velocity.Y + Main.rand.Next(-1, 2) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, i, 0f); + } return false; } @@ -72,16 +64,17 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal return new Vector2(-20, 0); } - /*public override void AddRecipes() + public override void AddRecipes() { - ModRecipe r = new ModRecipe(mod); - r.AddIngredient(null, "CrownJewel"); - r.AddIngredient(null, "GalacticaSingularity", 5); - r.AddIngredient(null, "BarofLife", 10); - r.AddIngredient(null, "CosmiliteBar", 15); - r.AddTile(TileID.LunarCraftingStation); - r.SetResult(this); - r.AddRecipe(); - }*/ + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 15); + recipe.AddIngredient(ModContent.ItemType(), 15); + recipe.AddIngredient(ModContent.ItemType(), 8); + recipe.AddIngredient(ItemID.LunarBar, 4); + recipe.AddIngredient(ItemID.SniperRifle); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } } } diff --git a/Items/Weapons/DraedonsArsenal/MountedScanner.cs b/Items/Weapons/DraedonsArsenal/MountedScanner.cs new file mode 100644 index 0000000000..4007bf4985 --- /dev/null +++ b/Items/Weapons/DraedonsArsenal/MountedScanner.cs @@ -0,0 +1,90 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.DraedonsArsenal; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.DraedonsArsenal +{ + public class MountedScanner : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mounted Scanner"); + Tooltip.SetDefault("Summons a powerful weapon above your head that fires lasers at nearby enemies"); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.summon = true; + item.damage = 19; + item.knockBack = 2f; + item.mana = 10; + item.useTime = item.useAnimation = 25; + item.autoReuse = true; + + item.useStyle = ItemUseStyleID.HoldingUp; + item.UseSound = SoundID.Item15; + item.noMelee = true; + + item.value = CalamityGlobalItem.Rarity5BuyPrice; + item.rare = ItemRarityID.Red; + item.Calamity().customRarity = CalamityRarity.DraedonRust; + + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 1f; + } + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Projectile.NewProjectile(player.Center, Vector2.Zero, type, damage, knockBack, player.whoAmI); + int totalOwnedScanners = player.ownedProjectileCounts[type]; + int currentScannerIndex = 0; + foreach (Projectile projectile in Main.projectile) + { + if (!projectile.active) + continue; + if (projectile.type != type) + continue; + if (projectile.owner != player.whoAmI) + continue; + float completionRatio = currentScannerIndex / (float)totalOwnedScanners; + + // ai[0] is the angular offset relative to the projectile's owner. + // For the first 15 summons, wrap around the player angularly, but not at a perfect angle, a bit like the Dazzling Stabbers when idle. + // But once the total summon count is greater than 15, just create a perfect circle depending on the total amount of summons. + if (totalOwnedScanners <= 14) + { + projectile.ai[0] = Utils.AngleLerp(0f, MathHelper.Pi, currentScannerIndex / 15f); + if (currentScannerIndex % 2f == 1f) + projectile.ai[0] = -Utils.AngleLerp(0f, MathHelper.Pi, (currentScannerIndex + 1) / 15f); + } + else + { + projectile.ai[0] = MathHelper.TwoPi / totalOwnedScanners * currentScannerIndex; + } + + // Add a specific offset so that the scanners spawn above the player at first and not to the side. + projectile.ai[0] -= MathHelper.PiOver2; + projectile.netUpdate = true; + currentScannerIndex++; + } + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 15); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddIngredient(ItemID.HallowedBar, 10); + recipe.AddIngredient(ItemID.SoulofFright, 20); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/DraedonsArsenal/MountedScanner.png b/Items/Weapons/DraedonsArsenal/MountedScanner.png new file mode 100644 index 0000000000..e68fb56c81 Binary files /dev/null and b/Items/Weapons/DraedonsArsenal/MountedScanner.png differ diff --git a/Items/Weapons/DraedonsArsenal/Phaseslayer.cs b/Items/Weapons/DraedonsArsenal/Phaseslayer.cs new file mode 100644 index 0000000000..8b0da9e7cd --- /dev/null +++ b/Items/Weapons/DraedonsArsenal/Phaseslayer.cs @@ -0,0 +1,81 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.DraedonsArsenal; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.DraedonsArsenal +{ + public class Phaseslayer : ModItem + { + public const int Damage = 19000; + // When below this percentage of charge, the sword is small instead of big. + public const float SizeChargeThreshold = 0.33f; + public const float SmallDamageMultiplier = 0.66f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Phaseslayer"); + Tooltip.SetDefault("Wield a colossal laser blade which is controlled by the cursor\n" + + "Faster swings deal more damage and release sword beams\n" + + "When at low charge, the blade is smaller and weaker"); + } + public override void SetDefaults() + { + item.damage = Damage; + item.melee = true; + item.width = 26; + item.height = 26; + item.useTime = 24; + item.useAnimation = 24; + item.useStyle = ItemUseStyleID.HoldingOut; + item.useTurn = false; + item.knockBack = 7f; + + item.noUseGraphic = true; + + item.value = CalamityGlobalItem.RarityVioletBuyPrice; + item.rare = ItemRarityID.Red; + item.Calamity().customRarity = CalamityRarity.DraedonRust; + + item.UseSound = SoundID.Item1; + item.autoReuse = true; + + item.Calamity().Chargeable = true; + item.Calamity().ChargeMax = 250; + + item.shoot = ModContent.ProjectileType(); + item.channel = true; + } + + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Projectile blade = Projectile.NewProjectileDirect(position, Vector2.Zero, type, damage, knockBack, player.whoAmI); + blade.rotation = blade.AngleTo(Main.MouseWorld); + return false; + } + + public override void AddRecipes() + { + void AddIndividualRecipe(int saberID) + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 15); + recipe.AddIngredient(ModContent.ItemType(), 25); + recipe.AddIngredient(ModContent.ItemType(), 4); + recipe.AddIngredient(saberID); + recipe.AddTile(ModContent.TileType()); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + int[] phasesabers = { ItemID.WhitePhasesaber, ItemID.RedPhasesaber, ItemID.GreenPhasesaber, ItemID.BluePhasesaber, ItemID.PurplePhasesaber, ItemID.YellowPhasesaber }; + foreach (int id in phasesabers) + AddIndividualRecipe(id); + } + } +} diff --git a/Items/Weapons/DraedonsArsenal/Phaseslayer.png b/Items/Weapons/DraedonsArsenal/Phaseslayer.png new file mode 100644 index 0000000000..53f9fb432a Binary files /dev/null and b/Items/Weapons/DraedonsArsenal/Phaseslayer.png differ diff --git a/Items/Weapons/DraedonsArsenal/PlasmaCaster.cs b/Items/Weapons/DraedonsArsenal/PlasmaCaster.cs index ba26d956f9..c1ab052d43 100644 --- a/Items/Weapons/DraedonsArsenal/PlasmaCaster.cs +++ b/Items/Weapons/DraedonsArsenal/PlasmaCaster.cs @@ -1,3 +1,5 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Items.Weapons.Magic; using CalamityMod.Projectiles.DraedonsArsenal; using Microsoft.Xna.Framework; using Terraria; @@ -6,10 +8,9 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.DraedonsArsenal { - public class PlasmaCaster : ModItem + public class PlasmaCaster : ModItem { - private int BaseDamage = 2800; - + public const int BaseDamage = 1100; public override void SetStaticDefaults() { DisplayName.SetDefault("Plasma Caster"); @@ -33,37 +34,24 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaCasterFire"); item.noMelee = true; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.RareVariant; + item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; + item.rare = ItemRarityID.Red; + item.Calamity().customRarity = CalamityRarity.DraedonRust; item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 1f; - item.useAmmo = AmmoID.Bullet; + item.shootSpeed = 5f; + + item.Calamity().Chargeable = true; + item.Calamity().ChargeMax = 190; } - public override bool AltFunctionUse(Player player) - { - return true; - } + public override bool AltFunctionUse(Player player) => true; - public override bool CanUseItem(Player player) + public override float UseTimeMultiplier (Player player) { if (player.altFunctionUse == 2) - { - item.useAnimation = 15; - item.useTime = 15; - item.damage = BaseDamage / 3; - item.knockBack = 3f; - } - else - { - item.useAnimation = 45; - item.useTime = 45; - item.damage = BaseDamage; - item.knockBack = 7f; - } - return base.CanUseItem(player); + return 3f; + return 1f; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -75,27 +63,19 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal velocity *= 5f; } - int ammoConsumed = 20; float SpeedX = velocity.X + (float)Main.rand.Next(-3, 4) * 0.05f; float SpeedY = velocity.Y + (float)Main.rand.Next(-3, 4) * 0.05f; + float damageMult = 1f; + float kbMult = 1f; if (player.altFunctionUse == 2) { - ammoConsumed = 5; SpeedX = velocity.X + (float)Main.rand.Next(-15, 16) * 0.05f; SpeedY = velocity.Y + (float)Main.rand.Next(-15, 16) * 0.05f; + damageMult = 0.3333f; + kbMult = 3f / 7f; } - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); - - // Consume 20 or 5 ammo per shot - CalamityGlobalItem.ConsumeAdditionalAmmo(player, item, ammoConsumed); - - return false; - } - - // Disable vanilla ammo consumption - public override bool ConsumeAmmo(Player player) - { + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), (int)(damage * damageMult), knockBack * kbMult, player.whoAmI, 0f, 0f); return false; } @@ -104,16 +84,18 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal return new Vector2(-10, 0); } - /*public override void AddRecipes() + public override void AddRecipes() { - ModRecipe r = new ModRecipe(mod); - r.AddIngredient(null, "CrownJewel"); - r.AddIngredient(null, "GalacticaSingularity", 5); - r.AddIngredient(null, "BarofLife", 10); - r.AddIngredient(null, "CosmiliteBar", 15); - r.AddTile(TileID.LunarCraftingStation); - r.SetResult(this); - r.AddRecipe(); - }*/ + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 15); + recipe.AddIngredient(ModContent.ItemType(), 15); + recipe.AddIngredient(ModContent.ItemType(), 8); + recipe.AddIngredient(ItemID.LunarBar, 4); + // still awkward that the item called Plasma Rifle is the same class and exact same tier as this item + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } } } diff --git a/Items/Weapons/DraedonsArsenal/PlasmaGrenade.cs b/Items/Weapons/DraedonsArsenal/PlasmaGrenade.cs new file mode 100644 index 0000000000..cea18ca75e --- /dev/null +++ b/Items/Weapons/DraedonsArsenal/PlasmaGrenade.cs @@ -0,0 +1,63 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Projectiles.DraedonsArsenal; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.DraedonsArsenal +{ + public class PlasmaGrenade : RogueWeapon + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Plasma Grenade"); + Tooltip.SetDefault("Throws a grenade that explodes into plasma on collision\n" + + "Stealth strikes explode violently on collision into a vaporizing blast"); + } + + public override void SafeSetDefaults() + { + item.width = 22; + item.height = 28; + item.damage = 7143; + item.noMelee = true; + item.noUseGraphic = true; + item.consumable = true; + item.maxStack = 999; + item.useStyle = ItemUseStyleID.SwingThrow; + item.useAnimation = item.useTime = 22; + item.knockBack = 3f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + + item.value = Item.sellPrice(silver: 80); + item.rare = ItemRarityID.Red; + item.Calamity().customRarity = CalamityRarity.DraedonRust; + + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 19f; + 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) + { + Projectile grenade = Projectile.NewProjectileDirect(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + grenade.Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 1); + recipe.AddIngredient(ModContent.ItemType(), 1); + recipe.AddIngredient(ModContent.ItemType(), 1); + recipe.AddTile(ModContent.TileType()); + recipe.SetResult(this, 999); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/DraedonsArsenal/PlasmaGrenade.png b/Items/Weapons/DraedonsArsenal/PlasmaGrenade.png new file mode 100644 index 0000000000..f00d0b133f Binary files /dev/null and b/Items/Weapons/DraedonsArsenal/PlasmaGrenade.png differ diff --git a/Items/Weapons/DraedonsArsenal/PoleWarper.cs b/Items/Weapons/DraedonsArsenal/PoleWarper.cs new file mode 100644 index 0000000000..2b07e95aca --- /dev/null +++ b/Items/Weapons/DraedonsArsenal/PoleWarper.cs @@ -0,0 +1,88 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Projectiles.DraedonsArsenal; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.DraedonsArsenal +{ + public class PoleWarper : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Pole Warper"); + Tooltip.SetDefault("Summons two floating magnets that repel each other"); + } + + public override void SetDefaults() + { + item.shootSpeed = 10f; + item.damage = 700; + item.mana = 12; + item.width = 38; + item.height = 24; + item.useTime = item.useAnimation = 10; + item.useStyle = ItemUseStyleID.HoldingUp; + item.noMelee = true; + item.knockBack = 8f; + + item.value = CalamityGlobalItem.RarityVioletBuyPrice; + item.rare = ItemRarityID.Red; + item.Calamity().customRarity = CalamityRarity.DraedonRust; + + item.UseSound = SoundID.Item15; + 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 north = Projectile.NewProjectileDirect(Main.MouseWorld + Vector2.UnitY * 30f, Vector2.Zero, type, damage, knockBack, player.whoAmI); + Projectile south = Projectile.NewProjectileDirect(Main.MouseWorld - Vector2.UnitY * 30f, Vector2.Zero, type, damage, knockBack, player.whoAmI); + north.ai[1] = 1f; + south.ai[1] = 0f; + + float magnetCount = 0f; + + for (int i = 0; i < Main.projectile.Length; i++) + { + if (Main.projectile[i].type == type && Main.projectile[i].active && Main.projectile[i].owner == player.whoAmI) + { + magnetCount++; + } + } + + // Adjust the offset of all existing magnets such that they form a psuedo-circle. + // This offset is used when determining where a magnet should move to relative to its true destination (such as the player or an enemy). + int magnetIndex = 0; + for (int i = 0; i < Main.projectile.Length; i++) + { + if (Main.projectile[i].type == type && Main.projectile[i].active && Main.projectile[i].owner == player.whoAmI) + { + ((PoleWarperSummon)Main.projectile[i].modProjectile).Time = 0f; + ((PoleWarperSummon)Main.projectile[i].modProjectile).AngularOffset = MathHelper.TwoPi * magnetIndex / magnetCount; + magnetIndex++; + } + } + + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 25); + recipe.AddIngredient(ModContent.ItemType(), 15); + recipe.AddIngredient(ModContent.ItemType(), 4); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddTile(ModContent.TileType()); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/DraedonsArsenal/PoleWarper.png b/Items/Weapons/DraedonsArsenal/PoleWarper.png new file mode 100644 index 0000000000..9e847476cd Binary files /dev/null and b/Items/Weapons/DraedonsArsenal/PoleWarper.png differ diff --git a/Items/Weapons/DraedonsArsenal/PulsePistol.cs b/Items/Weapons/DraedonsArsenal/PulsePistol.cs new file mode 100644 index 0000000000..4920e17d76 --- /dev/null +++ b/Items/Weapons/DraedonsArsenal/PulsePistol.cs @@ -0,0 +1,65 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.DraedonsArsenal; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.DraedonsArsenal +{ + public class PulsePistol : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Pulse Pistol"); + Tooltip.SetDefault("Fires a pulse that arcs to a new target on enemy hits\n" + + "Inflicts more damage to inorganic targets"); + } + + public override void SetDefaults() + { + item.width = 62; + item.height = 22; + item.magic = true; + item.damage = 22; + item.knockBack = 0f; + item.useTime = item.useAnimation = 20; + item.autoReuse = true; + + item.useStyle = ItemUseStyleID.HoldingOut; + item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PulseRifleFire"); + item.noMelee = true; + + item.value = CalamityGlobalItem.Rarity3BuyPrice; + item.rare = ItemRarityID.Red; + item.Calamity().customRarity = CalamityRarity.DraedonRust; + + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 5.2f; // This may seem low but the shot has 10 extra updates. + + item.Calamity().Chargeable = true; + item.Calamity().ChargeMax = 50; + } + + 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, knockBack, player.whoAmI, 0f, 0f); + return false; + } + + public override Vector2? HoldoutOffset() => new Vector2(10f, 0f); + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddIngredient(ModContent.ItemType(), 7); + recipe.AddIngredient(ModContent.ItemType(), 4); + recipe.AddIngredient(ItemID.MeteoriteBar, 4); + recipe.AddIngredient(ItemID.FlintlockPistol); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/DraedonsArsenal/PulsePistol.png b/Items/Weapons/DraedonsArsenal/PulsePistol.png new file mode 100644 index 0000000000..f5ae99fd92 Binary files /dev/null and b/Items/Weapons/DraedonsArsenal/PulsePistol.png differ diff --git a/Items/Weapons/DraedonsArsenal/PulseRifle.cs b/Items/Weapons/DraedonsArsenal/PulseRifle.cs index e9551f42aa..d668d400c9 100644 --- a/Items/Weapons/DraedonsArsenal/PulseRifle.cs +++ b/Items/Weapons/DraedonsArsenal/PulseRifle.cs @@ -1,4 +1,6 @@ +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.DraedonsArsenal; +using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -8,11 +10,11 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal { public class PulseRifle : ModItem { - private int BaseDamage = 2500; + private int BaseDamage = 4500; public override void SetStaticDefaults() { - DisplayName.SetDefault("Draedon's Pulse Rifle"); + DisplayName.SetDefault("Pulse Rifle"); Tooltip.SetDefault("Draedon's high-efficiency electromagnetic pulse rifle\n" + "Incredibly accurate pulse weapon, crafted and wielded by Draedon to defend against his own creations\n" + "When the pulse hits a target it will arc to another nearby target\n" + @@ -34,13 +36,15 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PulseRifleFire"); item.noMelee = true; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.RareVariant; + item.value = CalamityGlobalItem.RarityVioletBuyPrice; + item.rare = ItemRarityID.Red; + item.Calamity().customRarity = CalamityRarity.DraedonRust; item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 1f; - item.useAmmo = AmmoID.Bullet; + item.shootSpeed = 5f; + + item.Calamity().Chargeable = true; + item.Calamity().ChargeMax = 250; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -56,34 +60,22 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal float SpeedY = velocity.Y + (float)Main.rand.Next(-1, 2) * 0.05f; Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); - - // Consume 6 ammo per shot - CalamityGlobalItem.ConsumeAdditionalAmmo(player, item, 6); - return false; } - // Disable vanilla ammo consumption - public override bool ConsumeAmmo(Player player) - { - return false; - } + public override Vector2? HoldoutOffset() => new Vector2(-10, 0); - public override Vector2? HoldoutOffset() + public override void AddRecipes() { - return new Vector2(-10, 0); + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 16); + recipe.AddIngredient(ModContent.ItemType(), 24); + recipe.AddIngredient(ModContent.ItemType(), 4); + // The only arsenal weapon that is an upgrade of another arsenal weapon (and it makes sense). + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddTile(ModContent.TileType()); + recipe.SetResult(this); + recipe.AddRecipe(); } - - /*public override void AddRecipes() - { - ModRecipe r = new ModRecipe(mod); - r.AddIngredient(null, "CrownJewel"); - r.AddIngredient(null, "GalacticaSingularity", 5); - r.AddIngredient(null, "BarofLife", 10); - r.AddIngredient(null, "CosmiliteBar", 15); - r.AddTile(TileID.LunarCraftingStation); - r.SetResult(this); - r.AddRecipe(); - }*/ } } diff --git a/Items/Weapons/DraedonsArsenal/PulseTurretRemote.cs b/Items/Weapons/DraedonsArsenal/PulseTurretRemote.cs new file mode 100644 index 0000000000..ea566a1b16 --- /dev/null +++ b/Items/Weapons/DraedonsArsenal/PulseTurretRemote.cs @@ -0,0 +1,80 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.DraedonsArsenal; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.DraedonsArsenal +{ + public class PulseTurretRemote : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Pulse Turret Remote"); + Tooltip.SetDefault("Summons a pulse turret which eradicates nearby foes with focused energy blasts\n" + + "Especially effective against inorganic targets"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 26; + item.summon = true; + item.sentry = true; + item.damage = 100; + item.knockBack = 0f; + item.mana = 10; + item.useTime = item.useAnimation = 25; + item.autoReuse = true; + + item.useStyle = ItemUseStyleID.HoldingUp; + item.UseSound = SoundID.Item15; + item.noMelee = true; + + item.value = CalamityGlobalItem.Rarity5BuyPrice; + item.rare = ItemRarityID.Red; + item.Calamity().customRarity = CalamityRarity.DraedonRust; + + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 1f; + } + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Point mouseTileCoords = Main.MouseWorld.ToTileCoordinates(); + if (!CalamityUtils.ParanoidTileRetrieval(mouseTileCoords.X, mouseTileCoords.Y).active()) + { + int existingTurrets = player.ownedProjectileCounts[type]; + if (existingTurrets > 0) + { + for (int i = 0; i < Main.projectile.Length || existingTurrets > 0; i++) + { + if (Main.projectile[i].type == type && + Main.projectile[i].owner == player.whoAmI && + Main.projectile[i].active) + { + Main.projectile[i].Kill(); + existingTurrets--; + } + } + } + Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, type, damage, knockBack, player.whoAmI); + //player.UpdateMaxTurrets(); + } + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 12); + recipe.AddIngredient(ModContent.ItemType(), 18); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/DraedonsArsenal/PulseTurretRemote.png b/Items/Weapons/DraedonsArsenal/PulseTurretRemote.png new file mode 100644 index 0000000000..aa11599fb8 Binary files /dev/null and b/Items/Weapons/DraedonsArsenal/PulseTurretRemote.png differ diff --git a/Items/Weapons/DraedonsArsenal/SnakeEyes.cs b/Items/Weapons/DraedonsArsenal/SnakeEyes.cs new file mode 100644 index 0000000000..394aa4adca --- /dev/null +++ b/Items/Weapons/DraedonsArsenal/SnakeEyes.cs @@ -0,0 +1,61 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Projectiles.DraedonsArsenal; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.DraedonsArsenal +{ + public class SnakeEyes : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Snake Eyes"); + Tooltip.SetDefault("Summons a mechanical watcher that zaps and flies around enemies."); + } + + public override void SetDefaults() + { + item.shootSpeed = 10f; + item.damage = 75; + item.mana = 12; + item.width = 38; + item.height = 24; + item.useTime = item.useAnimation = 15; + item.useStyle = ItemUseStyleID.HoldingUp; + item.noMelee = true; + item.knockBack = 3f; + + item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; + item.rare = ItemRarityID.Red; + item.Calamity().customRarity = CalamityRarity.DraedonRust; + + item.UseSound = SoundID.Item15; + 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 void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 15); + recipe.AddIngredient(ModContent.ItemType(), 15); + recipe.AddIngredient(ModContent.ItemType(), 8); + recipe.AddIngredient(ItemID.LunarBar, 4); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/DraedonsArsenal/SnakeEyes.png b/Items/Weapons/DraedonsArsenal/SnakeEyes.png new file mode 100644 index 0000000000..f4baccc8bc Binary files /dev/null and b/Items/Weapons/DraedonsArsenal/SnakeEyes.png differ diff --git a/Items/Weapons/DraedonsArsenal/StarSwallowerContainmentUnit.cs b/Items/Weapons/DraedonsArsenal/StarSwallowerContainmentUnit.cs new file mode 100644 index 0000000000..51dc6502a8 --- /dev/null +++ b/Items/Weapons/DraedonsArsenal/StarSwallowerContainmentUnit.cs @@ -0,0 +1,62 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.DraedonsArsenal; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.DraedonsArsenal +{ + public class StarSwallowerContainmentUnit : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Star Swallower Containment Unit"); + Tooltip.SetDefault("Summons a biomechanical frog that vomits plasma onto enemies"); + } + + public override void SetDefaults() + { + item.shootSpeed = 10f; + item.damage = 24; + item.mana = 10; + item.width = 18; + item.height = 28; + item.useTime = item.useAnimation = 30; + item.useStyle = ItemUseStyleID.HoldingUp; + item.noMelee = true; + item.knockBack = 2.25f; + item.value = CalamityGlobalItem.Rarity3BuyPrice; + item.rare = ItemRarityID.Red; + item.Calamity().customRarity = CalamityRarity.DraedonRust; + item.UseSound = SoundID.Item15; + 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) + { + Point mouseTileCoords = Main.MouseWorld.ToTileCoordinates(); + if (!CalamityUtils.ParanoidTileRetrieval(mouseTileCoords.X, mouseTileCoords.Y).active()) + { + Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, type, damage, knockBack, player.whoAmI); + } + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 8); + recipe.AddIngredient(ModContent.ItemType(), 4); + recipe.AddIngredient(ModContent.ItemType(), 4); + recipe.AddIngredient(ItemID.MeteoriteBar, 4); + recipe.AddIngredient(ItemID.Frog); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/DraedonsArsenal/StarSwallowerContainmentUnit.png b/Items/Weapons/DraedonsArsenal/StarSwallowerContainmentUnit.png new file mode 100644 index 0000000000..15df259eae Binary files /dev/null and b/Items/Weapons/DraedonsArsenal/StarSwallowerContainmentUnit.png differ diff --git a/Items/Weapons/DraedonsArsenal/TeslaCannon.cs b/Items/Weapons/DraedonsArsenal/TeslaCannon.cs index 2b326a4cae..a50368759e 100644 --- a/Items/Weapons/DraedonsArsenal/TeslaCannon.cs +++ b/Items/Weapons/DraedonsArsenal/TeslaCannon.cs @@ -1,4 +1,6 @@ +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.DraedonsArsenal; +using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -8,7 +10,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal { public class TeslaCannon : ModItem { - private int BaseDamage = 8000; + private int BaseDamage = 10000; public override void SetStaticDefaults() { @@ -33,13 +35,15 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/TeslaCannonFire"); item.noMelee = true; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.RareVariant; + item.value = CalamityGlobalItem.RarityVioletBuyPrice; + item.rare = ItemRarityID.Red; + item.Calamity().customRarity = CalamityRarity.DraedonRust; item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 1f; - item.useAmmo = AmmoID.Bullet; + item.shootSpeed = 5f; + + item.Calamity().Chargeable = true; + item.Calamity().ChargeMax = 250; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -55,34 +59,21 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal float SpeedY = velocity.Y + (float)Main.rand.Next(-1, 2) * 0.02f; Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); - - // Consume 30 ammo per shot - CalamityGlobalItem.ConsumeAdditionalAmmo(player, item, 30); - return false; } - // Disable vanilla ammo consumption - public override bool ConsumeAmmo(Player player) - { - return false; - } + public override Vector2? HoldoutOffset() => new Vector2(-20, 0); - public override Vector2? HoldoutOffset() + public override void AddRecipes() { - return new Vector2(-20, 0); + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 25); + recipe.AddIngredient(ModContent.ItemType(), 15); + recipe.AddIngredient(ModContent.ItemType(), 4); + recipe.AddIngredient(ItemID.ChargedBlasterCannon); + recipe.AddTile(ModContent.TileType()); + recipe.SetResult(this); + recipe.AddRecipe(); } - - /*public override void AddRecipes() - { - ModRecipe r = new ModRecipe(mod); - r.AddIngredient(null, "CrownJewel"); - r.AddIngredient(null, "GalacticaSingularity", 5); - r.AddIngredient(null, "BarofLife", 10); - r.AddIngredient(null, "CosmiliteBar", 15); - r.AddTile(TileID.LunarCraftingStation); - r.SetResult(this); - r.AddRecipe(); - }*/ } } diff --git a/Items/Weapons/Magic/AcidGun.cs b/Items/Weapons/Magic/AcidGun.cs index 21486d3c96..3c739f5a43 100644 --- a/Items/Weapons/Magic/AcidGun.cs +++ b/Items/Weapons/Magic/AcidGun.cs @@ -33,6 +33,9 @@ namespace CalamityMod.Items.Weapons.Magic item.shootSpeed = 14f; item.shoot = ModContent.ProjectileType(); } + + public override Vector2? HoldoutOffset() => 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) { for (int i = 0; i < 3; i++) @@ -42,6 +45,7 @@ namespace CalamityMod.Items.Weapons.Magic } return false; } + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); diff --git a/Items/Weapons/Magic/AlphaRay.cs b/Items/Weapons/Magic/AlphaRay.cs index ff2716da9e..10c235f734 100644 --- a/Items/Weapons/Magic/AlphaRay.cs +++ b/Items/Weapons/Magic/AlphaRay.cs @@ -67,7 +67,7 @@ namespace CalamityMod.Items.Weapons.Magic value9 -= vector7; } Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, type, (int)(damage * 0.8), knockBack, player.whoAmI, 0.0f, 0.0f); - int laser = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX * 2f, speedY * 2f, ProjectileID.LaserMachinegunLaser, (int)(damage * 0.4), knockBack, player.whoAmI, 0.0f, 0.0f); + int laser = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX * 2f, speedY * 2f, ProjectileID.LaserMachinegunLaser, (int)(damage * 0.4), knockBack, player.whoAmI, 0f, 0f); Main.projectile[laser].timeLeft = 120; Main.projectile[laser].tileCollide = false; } diff --git a/Items/Weapons/Magic/ApoctosisArray.cs b/Items/Weapons/Magic/ApoctosisArray.cs index 74cd462352..b91cc6fbd4 100644 --- a/Items/Weapons/Magic/ApoctosisArray.cs +++ b/Items/Weapons/Magic/ApoctosisArray.cs @@ -6,60 +6,60 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Magic { - public class ApoctosisArray : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Apoctosis Array"); - Tooltip.SetDefault("Fires ion blasts that speed up and then explode\n" + - "The higher your mana the more damage they will do\n" + + public class ApoctosisArray : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Apoctosis Array"); + Tooltip.SetDefault("Fires ion blasts that speed up and then explode\n" + + "The higher your mana the more damage they will do\n" + "Astral steroids can inhibit the potential of this weapon"); - } + } - public override void SetDefaults() - { - item.width = 98; - item.damage = 55; - item.magic = true; - item.mana = 12; - item.useAnimation = 7; - item.useTime = 7; - item.useStyle = ItemUseStyleID.HoldingOut; - item.knockBack = 6.75f; - item.UseSound = SoundID.Item91; - item.autoReuse = true; - item.noMelee = true; - item.height = 34; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 8f; - item.Calamity().customRarity = CalamityRarity.Turquoise; - } + public override void SetDefaults() + { + item.width = 98; + item.damage = 55; + item.magic = true; + item.mana = 12; + item.useAnimation = 7; + item.useTime = 7; + item.useStyle = ItemUseStyleID.HoldingOut; + item.knockBack = 6.75f; + item.UseSound = SoundID.Item91; + item.autoReuse = true; + item.noMelee = true; + item.height = 34; + item.value = Item.buyPrice(1, 20, 0, 0); + item.rare = 10; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 8f; + item.Calamity().customRarity = CalamityRarity.Turquoise; + } - public override Vector2? HoldoutOffset() - { - return new Vector2(-25, 0); - } + public override Vector2? HoldoutOffset() + { + return new Vector2(-25, 0); + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - float manaAmount = (float)player.statMana * 0.01f; - float damageMult = manaAmount; + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + float manaAmount = (float)player.statMana * 0.01f; + float damageMult = manaAmount; float injectionNerf = player.Calamity().astralInjection ? 0.6f : 1f; - int projectile = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, (int)(damage * damageMult * injectionNerf), knockBack, player.whoAmI, 0f, 0f); - Main.projectile[projectile].scale = manaAmount * 0.375f; - return false; - } + int projectile = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, (int)(damage * damageMult * injectionNerf), knockBack, player.whoAmI); + Main.projectile[projectile].scale = manaAmount * 0.375f; + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.LunarBar, 10); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ItemID.LunarBar, 5); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/Magic/Atlantis.png b/Items/Weapons/Magic/Atlantis.png index bb16c85109..327b9e0d5c 100644 Binary files a/Items/Weapons/Magic/Atlantis.png and b/Items/Weapons/Magic/Atlantis.png differ diff --git a/Items/Weapons/Magic/BelchingSaxophone.cs b/Items/Weapons/Magic/BelchingSaxophone.cs index 3477ef02db..8fc26474c8 100644 --- a/Items/Weapons/Magic/BelchingSaxophone.cs +++ b/Items/Weapons/Magic/BelchingSaxophone.cs @@ -42,8 +42,6 @@ namespace CalamityMod.Items.Weapons.Magic public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { counter++; - if (counter > 1) - counter = 0; if (Main.rand.NextBool(2)) { @@ -56,22 +54,16 @@ namespace CalamityMod.Items.Weapons.Magic speedX += Main.rand.Next(-40, 41) * 0.05f; speedY += Main.rand.Next(-40, 41) * 0.05f; - Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, counter == 1 ? 1f : 0f); + Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, counter % 2 == 0 ? 1f : 0f); if (Main.rand.NextBool(2)) { - int noteProj = ProjectileID.QuarterNote; - switch (Main.rand.Next(3)) + int noteProj = Utils.SelectRandom(Main.rand, new int[] { - case 0: - noteProj = ProjectileID.EighthNote; - break; - case 1: - noteProj = ProjectileID.TiedEighthNote; - break; - default: - break; - } + ProjectileID.QuarterNote, + ProjectileID.EighthNote, + ProjectileID.TiedEighthNote + }); int note = Projectile.NewProjectile(position.X, position.Y, speedX * 0.75f, speedY * 0.75f, noteProj, (int)(damage * 0.75), knockBack, player.whoAmI); Main.projectile[note].Calamity().forceMagic = true; //why are these notes also internally ranged Main.projectile[note].usesLocalNPCImmunity = true; @@ -80,9 +72,6 @@ namespace CalamityMod.Items.Weapons.Magic return false; } - public override Vector2? HoldoutOffset() - { - return new Vector2(0, 18); - } + public override Vector2? HoldoutOffset() => new Vector2(0, 18); } } diff --git a/Items/Weapons/Magic/BrimroseStaff.png b/Items/Weapons/Magic/BrimroseStaff.png index e6c093ff69..7436cd0e66 100644 Binary files a/Items/Weapons/Magic/BrimroseStaff.png and b/Items/Weapons/Magic/BrimroseStaff.png differ diff --git a/Items/Weapons/Magic/BurningSea.png b/Items/Weapons/Magic/BurningSea.png index 0107454fa0..da9ceb00f5 100644 Binary files a/Items/Weapons/Magic/BurningSea.png and b/Items/Weapons/Magic/BurningSea.png differ diff --git a/Items/Weapons/Magic/Climax.cs b/Items/Weapons/Magic/Climax.cs index 50b9d297db..83b316841c 100644 --- a/Items/Weapons/Magic/Climax.cs +++ b/Items/Weapons/Magic/Climax.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 80; + item.damage = 131; item.magic = true; item.mana = 30; item.width = 78; @@ -69,11 +69,10 @@ namespace CalamityMod.Items.Weapons.Magic double startAngle = Math.Atan2(speedX, speedY) - spread / 2; double deltaAngle = spread / 8f; double offsetAngle; - int i; - for (i = 0; i < 4; i++) + for (int i = 0; i < 4; i++) { offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(vector2.X, vector2.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), type, damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(vector2.X, vector2.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), type, damage, knockBack, player.whoAmI, 1f, 0f); Projectile.NewProjectile(vector2.X, vector2.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), type, damage, knockBack, player.whoAmI, 0f, 0f); } return false; diff --git a/Items/Weapons/Magic/DeathhailStaff.cs b/Items/Weapons/Magic/DeathhailStaff.cs index f65ded93fc..f0fca04e3a 100644 --- a/Items/Weapons/Magic/DeathhailStaff.cs +++ b/Items/Weapons/Magic/DeathhailStaff.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Weapons.Magic { DisplayName.SetDefault("Deathhail Staff"); Tooltip.SetDefault("Rain death upon your foes!\n" + - "Casts a storm of nebula shots from the sky"); + "Casts a storm of nebula lasers from the sky"); Item.staff[item.type] = true; } @@ -101,7 +101,7 @@ namespace CalamityMod.Items.Weapons.Magic num79 *= num80; float speedX4 = num78 + (float)Main.rand.Next(-50, 51) * 0.02f; float speedY5 = num79 + (float)Main.rand.Next(-50, 51) * 0.02f; - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, num73, num74, i, 0f, (float)Main.rand.Next(10)); + Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, num73, num74, i, 0f, 0f); } return false; } diff --git a/Items/Weapons/Magic/Effervescence.cs b/Items/Weapons/Magic/Effervescence.cs index cb97f27dda..cb8d9ce1e7 100644 --- a/Items/Weapons/Magic/Effervescence.cs +++ b/Items/Weapons/Magic/Effervescence.cs @@ -35,6 +35,8 @@ namespace CalamityMod.Items.Weapons.Magic item.Calamity().customRarity = CalamityRarity.Turquoise; } + public override Vector2? HoldoutOffset() => 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) { for (int randomBullets = 0; randomBullets <= 4; randomBullets++) diff --git a/Items/Weapons/Magic/EidolicWail.cs b/Items/Weapons/Magic/EidolicWail.cs index 5e8e12c6f3..619cbca78c 100644 --- a/Items/Weapons/Magic/EidolicWail.cs +++ b/Items/Weapons/Magic/EidolicWail.cs @@ -37,9 +37,6 @@ namespace CalamityMod.Items.Weapons.Magic item.Calamity().customRarity = CalamityRarity.PureGreen; } - public override Vector2? HoldoutOffset() - { - return new Vector2(-5, 0); - } + public override Vector2? HoldoutOffset() => new Vector2(-5, 0); } } diff --git a/Items/Weapons/Magic/Eternity.cs b/Items/Weapons/Magic/Eternity.cs index 7f47f1ba3e..5c34bfbbd5 100644 --- a/Items/Weapons/Magic/Eternity.cs +++ b/Items/Weapons/Magic/Eternity.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Weapons.Magic { public class Eternity : ModItem { - public const int BaseDamage = 6969; + public const int BaseDamage = 4200; public const int ExplosionDamage = 42000; public const int MaxHomers = 40; public const int dustID = 16; diff --git a/Items/Weapons/Magic/EventHorizon.cs b/Items/Weapons/Magic/EventHorizon.cs index cc8c8b10fe..bb5632a978 100644 --- a/Items/Weapons/Magic/EventHorizon.cs +++ b/Items/Weapons/Magic/EventHorizon.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Magic item.width = 28; item.height = 30; - item.damage = 231; + item.damage = 369; item.knockBack = 3.5f; item.noMelee = true; item.magic = true; diff --git a/Items/Weapons/Magic/Fabstaff.cs b/Items/Weapons/Magic/Fabstaff.cs index 1542e17e2d..a67186ab49 100644 --- a/Items/Weapons/Magic/Fabstaff.cs +++ b/Items/Weapons/Magic/Fabstaff.cs @@ -13,14 +13,13 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Fabstaff"); - Tooltip.SetDefault("Casts a bouncing beam that splits when enemies are near it\n" + - "The splitting can trigger long after the beam has vanished"); + Tooltip.SetDefault("Casts a bouncing beam that splits when enemies are near it"); Item.staff[item.type] = true; } public override void SetDefaults() { - item.damage = 800; + item.damage = 616; item.magic = true; item.mana = 50; item.width = 84; diff --git a/Items/Weapons/Magic/FaceMelter.cs b/Items/Weapons/Magic/FaceMelter.cs index 1a68bc48c9..156297cc71 100644 --- a/Items/Weapons/Magic/FaceMelter.cs +++ b/Items/Weapons/Magic/FaceMelter.cs @@ -39,10 +39,7 @@ namespace CalamityMod.Items.Weapons.Magic item.shootSpeed = 20f; } - public override Vector2? HoldoutOffset() - { - return new Vector2(-15, 0); - } + public override Vector2? HoldoutOffset() => new Vector2(-15, 0); public override void AddRecipes() { @@ -58,31 +55,33 @@ namespace CalamityMod.Items.Weapons.Magic recipe.AddRecipe(); } - public override bool AltFunctionUse(Player player) + public override bool AltFunctionUse(Player player) => true; + + public override bool CanUseItem(Player player) { - return true; + if (player.altFunctionUse == 2) + { + item.useTime = 20; + item.useAnimation = 20; + } + else + { + item.useTime = 5; + item.useAnimation = 10; + } + return base.CanUseItem(player); } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { if (player.altFunctionUse == 2) { - position = Main.MouseWorld; - speedX = 0; - speedY = 0; - item.useTime = 20; - item.useAnimation = 20; - item.reuseDelay = 0; - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); return false; } else { - item.useTime = 5; - item.useAnimation = 10; - float SpeedX = speedX; - float SpeedY = speedY; - int note = Main.rand.Next(0, 2); + int note = Main.rand.Next(2); if (note == 0) { damage = (int)(damage * 1.5f); @@ -90,11 +89,11 @@ namespace CalamityMod.Items.Weapons.Magic } else { - SpeedX *= 1.5f; - SpeedY *= 1.5f; + speedX *= 1.5f; + speedY *= 1.5f; type = ModContent.ProjectileType(); } - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); return false; } } diff --git a/Items/Weapons/Magic/HeliumFlash.cs b/Items/Weapons/Magic/HeliumFlash.cs index 93d52b70f6..2deb75603c 100644 --- a/Items/Weapons/Magic/HeliumFlash.cs +++ b/Items/Weapons/Magic/HeliumFlash.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Magic item.width = 76; item.height = 76; item.magic = true; - item.damage = 1110; + item.damage = 1111; item.knockBack = 9.5f; item.mana = 26; item.useAnimation = 37; diff --git a/Items/Weapons/Magic/HellwingStaff.cs b/Items/Weapons/Magic/HellwingStaff.cs index c114202dfb..630737529a 100644 --- a/Items/Weapons/Magic/HellwingStaff.cs +++ b/Items/Weapons/Magic/HellwingStaff.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Hellwing Staff"); - Tooltip.SetDefault("Casts pillars of flame"); + Tooltip.SetDefault("Casts flaming bats"); Item.staff[item.type] = true; } diff --git a/Items/Weapons/Magic/IonBlaster.cs b/Items/Weapons/Magic/IonBlaster.cs index fad71a3dc0..f85659f136 100644 --- a/Items/Weapons/Magic/IonBlaster.cs +++ b/Items/Weapons/Magic/IonBlaster.cs @@ -6,57 +6,59 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Magic { - public class IonBlaster : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ion Blaster"); - Tooltip.SetDefault("Fires ion blasts that speed up and then explode\n" + - "The higher your mana the more damage they will do"); - } + public class IonBlaster : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ion Blaster"); + Tooltip.SetDefault("Fires ion blasts that speed up and then explode\n" + + "The higher your mana the more damage they will do\n" + + "Astral steroids can inhibit the potential of this weapon"); + } - public override void SetDefaults() - { - item.width = 44; - item.damage = 30; - item.magic = true; - item.mana = 6; - item.useAnimation = 10; - item.useTime = 10; - item.useStyle = ItemUseStyleID.HoldingOut; - item.knockBack = 5.5f; - item.UseSound = SoundID.Item91; - item.autoReuse = true; - item.noMelee = true; - item.height = 28; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 3f; - } + public override void SetDefaults() + { + item.width = 44; + item.damage = 30; + item.magic = true; + item.mana = 6; + item.useAnimation = 10; + item.useTime = 10; + item.useStyle = ItemUseStyleID.HoldingOut; + item.knockBack = 5.5f; + item.UseSound = SoundID.Item91; + item.autoReuse = true; + item.noMelee = true; + item.height = 28; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 3f; + } - public override Vector2? HoldoutOffset() - { - return new Vector2(-5, 0); - } + public override Vector2? HoldoutOffset() + { + return new Vector2(-5, 0); + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - float manaAmount = (float)player.statMana * 0.01f; - float damageMult = manaAmount * 0.75f; - int projectile = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, (int)((double)damage * damageMult), knockBack, player.whoAmI, 0.0f, 0.0f); - Main.projectile[projectile].scale = manaAmount; - return false; - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + float manaAmount = (float)player.statMana * 0.01f; + float damageMult = manaAmount * 0.75f; + float injectionNerf = player.Calamity().astralInjection ? 0.6f : 1f; + int projectile = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, (int)(damage * damageMult * injectionNerf), knockBack, player.whoAmI); + Main.projectile[projectile].scale = manaAmount; + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SoulofFright, 10); - recipe.AddRecipeGroup("AnyAdamantiteBar", 7); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.SoulofFright, 10); + recipe.AddRecipeGroup("AnyAdamantiteBar", 7); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/Magic/Lazhar.cs b/Items/Weapons/Magic/Lazhar.cs index 4ed61c734a..e02e3b06f3 100644 --- a/Items/Weapons/Magic/Lazhar.cs +++ b/Items/Weapons/Magic/Lazhar.cs @@ -34,6 +34,8 @@ namespace CalamityMod.Items.Weapons.Magic item.shoot = ModContent.ProjectileType(); } + public override Vector2? HoldoutOffset() => new Vector2(-5, 0); + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { float SpeedX = speedX + (float)Main.rand.Next(-15, 16) * 0.05f; diff --git a/Items/Weapons/Magic/MagneticMeltdown.cs b/Items/Weapons/Magic/MagneticMeltdown.cs index 8cebeba233..86e69eadd3 100644 --- a/Items/Weapons/Magic/MagneticMeltdown.cs +++ b/Items/Weapons/Magic/MagneticMeltdown.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Items.Weapons.Magic { float SpeedX = speedX + (float)Main.rand.Next(-50, 51) * 0.05f; float SpeedY = speedY + (float)Main.rand.Next(-50, 51) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 1.0f, 0.0f); + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 1f, 0f); } return false; } diff --git a/Items/Weapons/Magic/PlasmaRifle.cs b/Items/Weapons/Magic/PlasmaRifle.cs index 29142fe633..8d356262df 100644 --- a/Items/Weapons/Magic/PlasmaRifle.cs +++ b/Items/Weapons/Magic/PlasmaRifle.cs @@ -23,8 +23,7 @@ namespace CalamityMod.Items.Weapons.Magic item.magic = true; item.width = 48; item.height = 22; - item.useTime = 40; - item.useAnimation = 40; + item.useTime = item.useAnimation = 8; item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 4f; @@ -51,21 +50,28 @@ namespace CalamityMod.Items.Weapons.Magic { if (player.altFunctionUse == 2) { - item.mana = 5; - item.useTime = 8; - item.useAnimation = 8; item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaBolt"); } else { - item.mana = 40; - item.useTime = 40; - item.useAnimation = 40; item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaBlast"); } return base.CanUseItem(player); } + public override void ModifyManaCost(Player player, ref float reduce, ref float mult) + { + if (player.altFunctionUse == 2) + mult *= 0.125f; + } + + public override float UseTimeMultiplier (Player player) + { + if (player.altFunctionUse == 2) + return 1f; + return 0.2f; + } + 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) diff --git a/Items/Weapons/Magic/RelicofRuin.cs b/Items/Weapons/Magic/RelicofRuin.cs index 30cfe57299..7f3204d7af 100644 --- a/Items/Weapons/Magic/RelicofRuin.cs +++ b/Items/Weapons/Magic/RelicofRuin.cs @@ -32,20 +32,17 @@ namespace CalamityMod.Items.Weapons.Magic item.UseSound = SoundID.Item84; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 30f; + item.shootSpeed = 5f; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - float spread = 22.5f * 0.01f * MathHelper.PiOver2; - double startAngle = Math.Atan2(speedX, speedY) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - for (int i = 0; i < 8; i++) + int totalProjectiles = 12; + float radians = MathHelper.TwoPi / totalProjectiles; + for (int i = 0; i < totalProjectiles; i++) { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(position.X, position.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), type, damage, knockBack, Main.myPlayer); - Projectile.NewProjectile(position.X, position.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), type, damage, knockBack, Main.myPlayer); + Vector2 vector = new Vector2(0f, -item.shootSpeed).RotatedBy(radians * i); + Projectile.NewProjectile(position, vector, type, damage, knockBack, Main.myPlayer); } return false; } diff --git a/Items/Weapons/Magic/SHPC.cs b/Items/Weapons/Magic/SHPC.cs index 8a3b91912c..6a6cdd625e 100644 --- a/Items/Weapons/Magic/SHPC.cs +++ b/Items/Weapons/Magic/SHPC.cs @@ -24,8 +24,7 @@ namespace CalamityMod.Items.Weapons.Magic item.mana = 20; item.width = 96; item.height = 34; - item.useTime = 50; - item.useAnimation = 50; + item.useTime = item.useAnimation = 7; item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 3.25f; @@ -52,21 +51,28 @@ namespace CalamityMod.Items.Weapons.Magic { if (player.altFunctionUse == 2) { - item.useTime = 7; - item.useAnimation = 7; - item.mana = 6; item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"); } else { - item.useTime = 50; - item.useAnimation = 50; - item.mana = 20; item.UseSound = SoundID.Item92; } return base.CanUseItem(player); } + public override void ModifyManaCost(Player player, ref float reduce, ref float mult) + { + if (player.altFunctionUse == 2) + mult *= 0.3f; + } + + public override float UseTimeMultiplier (Player player) + { + if (player.altFunctionUse == 2) + return 1f; + return 0.14f; + } + 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) @@ -75,7 +81,7 @@ namespace CalamityMod.Items.Weapons.Magic { float SpeedX = speedX + (float)Main.rand.Next(-20, 21) * 0.05f; float SpeedY = speedY + (float)Main.rand.Next(-20, 21) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockBack * 0.5f, player.whoAmI, 0.0f, 0.0f); + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockBack * 0.5f, player.whoAmI, 0f, 0f); } return false; } @@ -85,7 +91,7 @@ namespace CalamityMod.Items.Weapons.Magic { float SpeedX = speedX + (float)Main.rand.Next(-40, 41) * 0.05f; float SpeedY = speedY + (float)Main.rand.Next(-40, 41) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), (int)((double)damage * 1.1), knockBack, player.whoAmI, 0.0f, 0.0f); + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), (int)(damage * 1.1), knockBack, player.whoAmI, 0f, 0f); } return false; } diff --git a/Items/Weapons/Magic/ShiftingSands.cs b/Items/Weapons/Magic/ShiftingSands.cs index 7e69a5dbaa..e17a447727 100644 --- a/Items/Weapons/Magic/ShiftingSands.cs +++ b/Items/Weapons/Magic/ShiftingSands.cs @@ -6,45 +6,58 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Magic { - public class ShiftingSands : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Shifting Sands"); - Tooltip.SetDefault("Casts a sand shard that follows the mouse cursor"); - } + public class ShiftingSands : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shifting Sands"); + Tooltip.SetDefault("Casts a sand shard that follows the mouse cursor"); + } - public override void SetDefaults() - { - item.damage = 85; - item.magic = true; - item.channel = true; - item.mana = 20; - item.width = 58; - item.height = 58; - item.useTime = 30; - item.useAnimation = 30; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.knockBack = 5f; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; - item.UseSound = SoundID.Item20; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 7f; + public override void SetDefaults() + { + item.damage = 61; + item.knockBack = 5f; + item.useTime = item.useAnimation = 30; + item.mana = 20; + item.magic = true; + item.channel = true; item.autoReuse = true; - } + item.shootSpeed = 7f; + item.shoot = ModContent.ProjectileType(); - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.MagicMissile); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.AncientBattleArmorMaterial, 2); - recipe.AddIngredient(ItemID.SpectreBar, 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + item.width = item.height = 58; + item.useStyle = ItemUseStyleID.SwingThrow; + item.noMelee = true; + item.UseSound = SoundID.Item20; + item.value = Item.buyPrice(0, 60, 0, 0); + item.rare = 7; + } + + public override bool CanUseItem(Player player) + { + int projCount = 0; + for (int x = 0; x < Main.maxProjectiles; x++) + { + Projectile proj = Main.projectile[x]; + if (proj.active && proj.owner == player.whoAmI && proj.type == item.shoot && proj.ai[0] <= 0f) + { + projCount++; + } + } + return projCount <= 0; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.MagicMissile); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ItemID.AncientBattleArmorMaterial, 2); + recipe.AddIngredient(ItemID.SpectreBar, 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/Magic/SirensSong.png b/Items/Weapons/Magic/SirensSong.png index 5c53c88263..566bc3ee4c 100644 Binary files a/Items/Weapons/Magic/SirensSong.png and b/Items/Weapons/Magic/SirensSong.png differ diff --git a/Items/Weapons/Magic/TomeofFates.png b/Items/Weapons/Magic/TomeofFates.png index d33492dbf1..9ca9f148d3 100644 Binary files a/Items/Weapons/Magic/TomeofFates.png and b/Items/Weapons/Magic/TomeofFates.png differ diff --git a/Items/Weapons/Magic/UltraLiquidator.cs b/Items/Weapons/Magic/UltraLiquidator.cs index 7f3db174f7..b0b720d2ff 100644 --- a/Items/Weapons/Magic/UltraLiquidator.cs +++ b/Items/Weapons/Magic/UltraLiquidator.cs @@ -8,82 +8,77 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Magic { public class UltraLiquidator : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ultra Liquidator"); - Tooltip.SetDefault("Summons liquidation blades that summon more blades on enemy hits\n" + - "The blades inflict ichor, cursed inferno, on fire, and frostburn"); - Item.staff[item.type] = true; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ultra Liquidator"); + Tooltip.SetDefault("Summons liquidation blades that summon more blades on enemy hits\n" + + "The blades inflict ichor, cursed inferno, on fire, and frostburn"); + Item.staff[item.type] = true; + } - public override void SetDefaults() - { - item.damage = 145; - item.magic = true; - item.mana = 25; - item.width = 16; - item.height = 16; - item.useAnimation = 15; - item.useTime = 3; - item.reuseDelay = item.useAnimation; - item.crit = 30; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 7f; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item9; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 16f; - item.Calamity().customRarity = CalamityRarity.Turquoise; - } + public override void SetDefaults() + { + item.damage = 145; + item.crit = 30; + item.knockBack = 7f; + item.useTime = 3; + item.reuseDelay = item.useAnimation = 15; + item.mana = 25; + item.magic = true; + item.autoReuse = true; + item.shootSpeed = 16f; + item.shoot = ModContent.ProjectileType(); - public override Vector2? HoldoutOrigin() - { - return new Vector2(15, 15); - } + item.width = item.height = 16; + item.useStyle = ItemUseStyleID.HoldingOut; + item.noMelee = true; + item.UseSound = SoundID.Item9; + item.value = Item.buyPrice(1, 20, 0, 0); + item.rare = 10; + item.Calamity().customRarity = CalamityRarity.Turquoise; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.AquaScepter); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ItemID.LunarBar, 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } + public override Vector2? HoldoutOrigin() => new Vector2(15, 15); - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num72 = item.shootSpeed; - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - float f = Main.rand.NextFloat() * 6.28318548f; - float value12 = 20f; - float value13 = 60f; - Vector2 vector13 = vector2 + f.ToRotationVector2() * MathHelper.Lerp(value12, value13, Main.rand.NextFloat()); - for (int num202 = 0; num202 < 50; num202++) - { - vector13 = vector2 + f.ToRotationVector2() * MathHelper.Lerp(value12, value13, Main.rand.NextFloat()); - if (Collision.CanHit(vector2, 0, 0, vector13 + (vector13 - vector2).SafeNormalize(Vector2.UnitX) * 8f, 0, 0)) - { - break; - } - f = Main.rand.NextFloat() * 6.28318548f; - } - Vector2 mouseWorld = Main.MouseWorld; - Vector2 vector14 = mouseWorld - vector13; - Vector2 vector15 = new Vector2(num78, num79).SafeNormalize(Vector2.UnitY) * num72; - vector14 = vector14.SafeNormalize(vector15) * num72; - vector14 = Vector2.Lerp(vector14, vector15, 0.25f); - Projectile.NewProjectile(vector13, vector14, type, damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddRecipeGroup("CursedFlameIchor", 20); + recipe.AddIngredient(ItemID.AquaScepter); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddIngredient(ItemID.LunarBar, 5); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Vector2 playerPos = player.RotatedRelativePoint(player.MountedCenter, true); + float speed = item.shootSpeed; + float xVec = (float)Main.mouseX + Main.screenPosition.X - playerPos.X; + float yVec = (float)Main.mouseY + Main.screenPosition.Y - playerPos.Y; + float f = Main.rand.NextFloat() * MathHelper.TwoPi; + float lowerBoundOffset = 20f; + float upperBoundOffset = 60f; + Vector2 source = playerPos + f.ToRotationVector2() * MathHelper.Lerp(lowerBoundOffset, upperBoundOffset, Main.rand.NextFloat()); + for (int i = 0; i < 50; i++) + { + source = playerPos + f.ToRotationVector2() * MathHelper.Lerp(lowerBoundOffset, upperBoundOffset, Main.rand.NextFloat()); + if (Collision.CanHit(playerPos, 0, 0, source + (source - playerPos).SafeNormalize(Vector2.UnitX) * 8f, 0, 0)) + { + break; + } + f = Main.rand.NextFloat() * MathHelper.TwoPi; + } + Vector2 velocity = Main.MouseWorld - source; + Vector2 upperVelocityLimit = new Vector2(xVec, yVec).SafeNormalize(Vector2.UnitY) * speed; + velocity = velocity.SafeNormalize(upperVelocityLimit) * speed; + velocity = Vector2.Lerp(velocity, upperVelocityLimit, 0.25f); + Projectile.NewProjectile(source, velocity, type, damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + } } diff --git a/Items/Weapons/Magic/Vesuvius.cs b/Items/Weapons/Magic/Vesuvius.cs index 8f22d466d8..e277392e5b 100644 --- a/Items/Weapons/Magic/Vesuvius.cs +++ b/Items/Weapons/Magic/Vesuvius.cs @@ -26,8 +26,7 @@ namespace CalamityMod.Items.Weapons.Magic item.damage = 75; item.mana = 6; item.magic = true; - item.useAnimation = 20; - item.useTime = 20; + item.useAnimation = item.useTime = 15; item.noMelee = true; item.useStyle = ItemUseStyleID.HoldingOut; item.knockBack = 3f; @@ -53,21 +52,22 @@ namespace CalamityMod.Items.Weapons.Magic public override bool CanUseItem(Player player) { - if (player.altFunctionUse == 2) - { - item.mana = 9; - item.useTime = 20; - item.useAnimation = 20; - } - else - { - item.mana = 6; - item.useTime = 15; - item.useAnimation = 15; - } return base.CanUseItem(player); } + public override void ModifyManaCost(Player player, ref float reduce, ref float mult) + { + if (player.altFunctionUse == 2) + mult *= 1.5f; + } + + public override float UseTimeMultiplier (Player player) + { + if (player.altFunctionUse != 2) + return 1f; + return 0.75f; + } + 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) diff --git a/Items/Weapons/Magic/WrathoftheAncients.cs b/Items/Weapons/Magic/WrathoftheAncients.cs index d7aa63ac3d..de252ca89e 100644 --- a/Items/Weapons/Magic/WrathoftheAncients.cs +++ b/Items/Weapons/Magic/WrathoftheAncients.cs @@ -35,33 +35,7 @@ namespace CalamityMod.Items.Weapons.Magic public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - int i = Main.myPlayer; - float num72 = item.shootSpeed; - int num73 = damage; - float num74 = knockBack; - num74 = player.GetWeaponKnockback(item, num74); - player.itemTime = item.useTime; - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (player.gravDir == -1f) - { - num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; - } - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) - { - num78 = (float)player.direction; - } - else - { - num80 = num72 / num80; - } - num78 = 0f; - num79 = 0f; - vector2.X = (float)Main.mouseX + Main.screenPosition.X; - vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; - Projectile.NewProjectile(vector2.X, vector2.Y, num78, num79, ModContent.ProjectileType(), num73, num74, i, 0f, 0f); + Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, type, damage, knockBack, player.whoAmI, 0f, 0f); return false; } } diff --git a/Items/Weapons/Magic/WulfrumStaff.cs b/Items/Weapons/Magic/WulfrumStaff.cs index 9341c3853b..8f9810e226 100644 --- a/Items/Weapons/Magic/WulfrumStaff.cs +++ b/Items/Weapons/Magic/WulfrumStaff.cs @@ -7,47 +7,46 @@ using Microsoft.Xna.Framework; namespace CalamityMod.Items.Weapons.Magic { - public class WulfrumStaff : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Wulfrum Staff"); - Tooltip.SetDefault("Casts a wulfrum bolt"); - Item.staff[item.type] = true; - } + public class WulfrumStaff : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Wulfrum Staff"); + Tooltip.SetDefault("Casts a wulfrum bolt"); + //Item.staff[item.type] = true; + } - public override void SetDefaults() - { - item.damage = 12; - item.magic = true; - item.mana = 4; - item.width = 44; - item.height = 46; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 3; - item.value = Item.buyPrice(0, 1, 0, 0); - item.rare = 1; - item.UseSound = SoundID.Item43; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 9f; - } + public override void SetDefaults() + { + item.damage = 12; + item.magic = true; + item.mana = 4; + item.width = 44; + item.height = 46; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = ItemUseStyleID.HoldingOut; + item.noMelee = true; + item.knockBack = 3; + item.value = Item.buyPrice(0, 1, 0, 0); + item.rare = 1; + item.UseSound = SoundID.Item43; + item.autoReuse = true; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 9f; + } - public override Vector2? HoldoutOrigin() - { - return new Vector2(10, 25); - } + //public override Vector2? HoldoutOrigin() => new Vector2(8, 15); - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override Vector2? HoldoutOffset() => new Vector2(-3, 0); + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 12); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/Magic/WulfrumStaff.png b/Items/Weapons/Magic/WulfrumStaff.png index 6c20e25a5c..bd38ecf2cd 100644 Binary files a/Items/Weapons/Magic/WulfrumStaff.png and b/Items/Weapons/Magic/WulfrumStaff.png differ diff --git a/Items/Weapons/Melee/AbyssBlade.cs b/Items/Weapons/Melee/AbyssBlade.cs index 81e597cecb..895c05577b 100644 --- a/Items/Weapons/Melee/AbyssBlade.cs +++ b/Items/Weapons/Melee/AbyssBlade.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Melee { item.width = 74; item.height = 74; - item.damage = 110; + item.damage = 90; item.melee = true; item.useAnimation = 26; item.useTime = 26; @@ -38,6 +38,12 @@ namespace CalamityMod.Items.Weapons.Melee item.shootSpeed = 9f; } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, (int)(damage * 0.75), knockBack, player.whoAmI); + return false; + } + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); @@ -55,7 +61,7 @@ namespace CalamityMod.Items.Weapons.Melee { if (Main.rand.NextBool(3)) { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 33); + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 33); } } diff --git a/Items/Weapons/Melee/AegisBlade.cs b/Items/Weapons/Melee/AegisBlade.cs index 67d9db46ac..5419d91703 100644 --- a/Items/Weapons/Melee/AegisBlade.cs +++ b/Items/Weapons/Melee/AegisBlade.cs @@ -22,8 +22,7 @@ namespace CalamityMod.Items.Weapons.Melee item.width = 58; item.damage = 68; item.melee = true; - item.useAnimation = 20; - item.useTime = 20; + item.useAnimation = item.useTime = 15; item.useTurn = true; item.useStyle = ItemUseStyleID.SwingThrow; item.knockBack = 4.25f; @@ -46,22 +45,25 @@ namespace CalamityMod.Items.Weapons.Melee if (player.altFunctionUse == 2) { item.noMelee = true; - item.useTime = 20; - item.useAnimation = 20; item.UseSound = SoundID.Item73; item.shoot = ModContent.ProjectileType(); } else { item.noMelee = false; - item.useTime = 15; - item.useAnimation = 15; item.UseSound = SoundID.Item1; item.shoot = ProjectileID.None; } return base.CanUseItem(player); } + public override float UseTimeMultiplier (Player player) + { + if (player.altFunctionUse != 2) + return 1f; + return 0.75f; + } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), (int)(damage * 0.85), knockBack, player.whoAmI, 0f, 0f); diff --git a/Items/Weapons/Melee/AnarchyBlade.cs b/Items/Weapons/Melee/AnarchyBlade.cs index 3e5cd7ccca..c6dbbd8650 100644 --- a/Items/Weapons/Melee/AnarchyBlade.cs +++ b/Items/Weapons/Melee/AnarchyBlade.cs @@ -63,12 +63,12 @@ namespace CalamityMod.Items.Weapons.Melee public override void ModifyWeaponDamage(Player player, ref float add, ref float mult, ref float flat) { int lifeAmount = player.statLifeMax2 - player.statLife; - flat += lifeAmount * 0.1f * player.meleeDamage; + flat += lifeAmount * 0.1f * player.MeleeDamage(); } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f)), knockback, Main.myPlayer); + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage()), knockback, Main.myPlayer); target.AddBuff(ModContent.BuffType(), 300); if (player.statLife < (player.statLifeMax2 * 0.5f) && Main.rand.NextBool(5)) @@ -85,7 +85,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitPvp(Player player, Player target, int damage, bool crit) { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f)), item.knockBack, Main.myPlayer); + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage()), item.knockBack, Main.myPlayer); target.AddBuff(ModContent.BuffType(), 300); } } diff --git a/Items/Weapons/Melee/Animus.cs b/Items/Weapons/Melee/Animus.cs index a9a09b298b..217fda9a0d 100644 --- a/Items/Weapons/Melee/Animus.cs +++ b/Items/Weapons/Melee/Animus.cs @@ -43,63 +43,70 @@ namespace CalamityMod.Items.Weapons.Melee recipe.AddRecipe(); } + public override void ModifyWeaponDamage(Player player, ref float add, ref float mult, ref float flat) + { + float damageMult = player.Calamity().animusBoost; + damageMult -= 1f; + mult += damageMult; + } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 6000); - int damageRan = Main.rand.Next(195); //0 to 195 + int damageRan = Main.rand.Next(195); //0 to 194 if (damageRan >= 50 && damageRan <= 99) //25% { - item.damage = 6000; + player.Calamity().animusBoost = 1.5f; } else if (damageRan >= 100 && damageRan <= 139) //20% { - item.damage = 9000; + player.Calamity().animusBoost = 2.25f; } else if (damageRan >= 140 && damageRan <= 169) //15% { - item.damage = 15000; + player.Calamity().animusBoost = 3.75f; } else if (damageRan >= 170 && damageRan <= 189) //10% { - item.damage = 30000; + player.Calamity().animusBoost = 7.5f; } else if (damageRan >= 190 && damageRan <= 194) //5% { - item.damage = 50000; + player.Calamity().animusBoost = 12.5f; } else { - item.damage = 4000; + player.Calamity().animusBoost = 1f; } } public override void OnHitPvp(Player player, Player target, int damage, bool crit) { target.AddBuff(ModContent.BuffType(), 6000); - int damageRan = Main.rand.Next(195); //0 to 195 + int damageRan = Main.rand.Next(195); //0 to 194 if (damageRan >= 50 && damageRan <= 99) //25% { - item.damage = 6000; + player.Calamity().animusBoost = 1.5f; } else if (damageRan >= 100 && damageRan <= 139) //20% { - item.damage = 9000; + player.Calamity().animusBoost = 2.25f; } else if (damageRan >= 140 && damageRan <= 169) //15% { - item.damage = 15000; + player.Calamity().animusBoost = 3.75f; } else if (damageRan >= 170 && damageRan <= 189) //10% { - item.damage = 30000; + player.Calamity().animusBoost = 7.5f; } else if (damageRan >= 190 && damageRan <= 194) //5% { - item.damage = 50000; + player.Calamity().animusBoost = 12.5f; } else { - item.damage = 4000; + player.Calamity().animusBoost = 1f; } } } diff --git a/Items/Weapons/Melee/ArkoftheElements.cs b/Items/Weapons/Melee/ArkoftheElements.cs index 7a868328b0..d7a0142c89 100644 --- a/Items/Weapons/Melee/ArkoftheElements.cs +++ b/Items/Weapons/Melee/ArkoftheElements.cs @@ -104,8 +104,8 @@ namespace CalamityMod.Items.Weapons.Melee recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ItemID.LunarBar, 15); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddIngredient(ItemID.LunarBar, 5); recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Weapons/Melee/AstralBlade.cs b/Items/Weapons/Melee/AstralBlade.cs index 88b2b4cd31..b97cd7a446 100644 --- a/Items/Weapons/Melee/AstralBlade.cs +++ b/Items/Weapons/Melee/AstralBlade.cs @@ -2,6 +2,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Items.Placeables; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -12,11 +13,12 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Astral Blade"); - } + Tooltip.SetDefault("Deals more damage the more life an enemy has left"); + } public override void SetDefaults() { - item.damage = 135; + item.damage = 95; item.crit += 25; item.melee = true; item.width = 60; @@ -25,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Melee item.useAnimation = 9; item.useTurn = true; item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 5f; + item.knockBack = 4f; item.value = Item.buyPrice(0, 95, 0, 0); item.rare = 9; item.UseSound = SoundID.Item1; @@ -62,5 +64,34 @@ namespace CalamityMod.Items.Weapons.Melee } } } - } + + public override void ModifyHitNPC(Player player, NPC target, ref int damage, ref float knockBack, ref bool crit) + { + float lifeRatio = target.life / (float)target.lifeMax; + float multiplier = MathHelper.Lerp(1f, 2f, lifeRatio); + + damage = (int)(damage * multiplier); + knockBack *= multiplier; + + if (!crit) + crit = Main.rand.NextBool((int)MathHelper.Clamp((item.crit + player.meleeCrit) * multiplier, 0f, 99f), 100); + + if (multiplier > 1.5f) + { + Main.PlaySound(SoundID.Item105, Main.player[Main.myPlayer].position); + bool blue = Main.rand.NextBool(); + float angleStart = Main.rand.NextFloat(0f, MathHelper.TwoPi); + float var = 0.05f + (2f - multiplier); + for (float angle = 0f; angle < MathHelper.TwoPi; angle += var) + { + blue = !blue; + Vector2 velocity = angle.ToRotationVector2() * (2f + (float)(Math.Sin(angleStart + angle * 3f) + 1) * 2.5f) * Main.rand.NextFloat(0.95f, 1.05f); + Dust d = Dust.NewDustPerfect(target.Center, blue ? ModContent.DustType() : ModContent.DustType(), velocity); + d.customData = 0.025f; + d.scale = multiplier - 0.75f; + d.noLight = false; + } + } + } + } } diff --git a/Items/Weapons/Melee/BallOFugu.png b/Items/Weapons/Melee/BallOFugu.png index 8325b126c6..b3a2e690c6 100644 Binary files a/Items/Weapons/Melee/BallOFugu.png and b/Items/Weapons/Melee/BallOFugu.png differ diff --git a/Items/Weapons/Melee/BloodyEdge.png b/Items/Weapons/Melee/BloodyEdge.png index f90d25080e..0d1b712d56 100644 Binary files a/Items/Weapons/Melee/BloodyEdge.png and b/Items/Weapons/Melee/BloodyEdge.png differ diff --git a/Items/Weapons/Melee/Brimlash.cs b/Items/Weapons/Melee/Brimlash.cs index 161eb295ad..7f1a6bcc4b 100644 --- a/Items/Weapons/Melee/Brimlash.cs +++ b/Items/Weapons/Melee/Brimlash.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 50; + item.width = item.height = 54; item.damage = 64; item.melee = true; item.useAnimation = 25; @@ -29,7 +29,6 @@ namespace CalamityMod.Items.Weapons.Melee item.knockBack = 6f; item.UseSound = SoundID.Item1; item.autoReuse = true; - item.height = 50; item.value = Item.buyPrice(0, 60, 0, 0); item.rare = 7; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Melee/Brimlash.png b/Items/Weapons/Melee/Brimlash.png index f3544237e5..d05b7ca683 100644 Binary files a/Items/Weapons/Melee/Brimlash.png and b/Items/Weapons/Melee/Brimlash.png differ diff --git a/Items/Weapons/Melee/BrimlashBuster.cs b/Items/Weapons/Melee/BrimlashBuster.cs index f576976d36..aa700055ef 100644 --- a/Items/Weapons/Melee/BrimlashBuster.cs +++ b/Items/Weapons/Melee/BrimlashBuster.cs @@ -20,8 +20,8 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 68; - item.damage = 100; + item.width = item.height = 72; + item.damage = 126; item.melee = true; item.useAnimation = 25; item.useTime = 25; @@ -30,7 +30,6 @@ namespace CalamityMod.Items.Weapons.Melee item.knockBack = 8; item.UseSound = SoundID.Item1; item.autoReuse = true; - item.height = 68; item.value = Item.buyPrice(0, 95, 0, 0); item.rare = 9; item.shoot = ModContent.ProjectileType(); @@ -56,30 +55,24 @@ namespace CalamityMod.Items.Weapons.Melee } } + public override void ModifyWeaponDamage(Player player, ref float add, ref float mult, ref float flat) + { + float damageMult = 0f; + if (player.Calamity().brimlashBusterBoost) + damageMult = 2f; + mult += damageMult; + } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 300); - if (Main.rand.NextBool(3)) - { - item.damage = 378; - } - else - { - item.damage = 126; - } + player.Calamity().brimlashBusterBoost = Main.rand.NextBool(3); } public override void OnHitPvp(Player player, Player target, int damage, bool crit) { target.AddBuff(ModContent.BuffType(), 300); - if (Main.rand.NextBool(3)) - { - item.damage = 378; - } - else - { - item.damage = 126; - } + player.Calamity().brimlashBusterBoost = Main.rand.NextBool(3); } } } diff --git a/Items/Weapons/Melee/BrimlashBuster.png b/Items/Weapons/Melee/BrimlashBuster.png index 946e98b5da..c2440eeb9f 100644 Binary files a/Items/Weapons/Melee/BrimlashBuster.png and b/Items/Weapons/Melee/BrimlashBuster.png differ diff --git a/Items/Weapons/Melee/BrinyBaron.cs b/Items/Weapons/Melee/BrinyBaron.cs index a273951ccf..2660df2619 100644 --- a/Items/Weapons/Melee/BrinyBaron.cs +++ b/Items/Weapons/Melee/BrinyBaron.cs @@ -22,8 +22,7 @@ namespace CalamityMod.Items.Weapons.Melee item.width = 62; item.damage = 75; item.melee = true; - item.useAnimation = 20; - item.useTime = 20; + item.useAnimation = item.useTime = 15; item.useTurn = true; item.useStyle = ItemUseStyleID.SwingThrow; item.knockBack = 4f; @@ -47,8 +46,6 @@ namespace CalamityMod.Items.Weapons.Melee { item.noMelee = true; item.noUseGraphic = true; - item.useTime = 15; - item.useAnimation = 15; item.UseSound = SoundID.Item84; item.shoot = ModContent.ProjectileType(); } @@ -56,14 +53,19 @@ namespace CalamityMod.Items.Weapons.Melee { item.noMelee = false; item.noUseGraphic = false; - item.useTime = 20; - item.useAnimation = 20; item.UseSound = SoundID.Item1; item.shoot = ProjectileID.None; } return base.CanUseItem(player); } + public override float UseTimeMultiplier (Player player) + { + if (player.altFunctionUse == 2) + return 1f; + return 0.75f; + } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); @@ -80,12 +82,12 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f) * 0.5f), knockback, player.whoAmI); + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage() * 0.5f), knockback, player.whoAmI); } public override void OnHitPvp(Player player, Player target, int damage, bool crit) { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f) * 0.5f), item.knockBack, player.whoAmI); + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage() * 0.5f), item.knockBack, player.whoAmI); } } } diff --git a/Items/Weapons/Melee/CelestialClaymore.cs b/Items/Weapons/Melee/CelestialClaymore.cs index 775543a275..cae7e0a8f2 100644 --- a/Items/Weapons/Melee/CelestialClaymore.cs +++ b/Items/Weapons/Melee/CelestialClaymore.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 50; + item.width = item.height = 54; item.damage = 70; item.melee = true; item.useAnimation = 23; @@ -27,7 +27,6 @@ namespace CalamityMod.Items.Weapons.Melee item.knockBack = 5.25f; item.UseSound = SoundID.Item1; item.autoReuse = true; - item.height = 50; item.value = Item.buyPrice(0, 36, 0, 0); item.rare = 5; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Melee/CelestialClaymore.png b/Items/Weapons/Melee/CelestialClaymore.png index 83a7435b09..1790b44e60 100644 Binary files a/Items/Weapons/Melee/CelestialClaymore.png and b/Items/Weapons/Melee/CelestialClaymore.png differ diff --git a/Items/Weapons/Melee/ColdheartIcicle.png b/Items/Weapons/Melee/ColdheartIcicle.png index 2ef88afd9e..aba5085616 100644 Binary files a/Items/Weapons/Melee/ColdheartIcicle.png and b/Items/Weapons/Melee/ColdheartIcicle.png differ diff --git a/Items/Weapons/Melee/CorruptedCrusherBlade.cs b/Items/Weapons/Melee/CorruptedCrusherBlade.cs index 4bcc479fe3..202e3a532f 100644 --- a/Items/Weapons/Melee/CorruptedCrusherBlade.cs +++ b/Items/Weapons/Melee/CorruptedCrusherBlade.cs @@ -1,3 +1,4 @@ +using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; @@ -42,10 +43,10 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { target.AddBuff(BuffID.CursedInferno, 120); - if (target.defense > 0 && crit) + if (target.defense > 0 && crit && !CalamityPlayer.areThereAnyDamnBosses) { - target.defense -= 5; - } + target.defense = target.defDefense - 5; + } } public override void OnHitPvp(Player player, Player target, int damage, bool crit) diff --git a/Items/Weapons/Melee/CrimsonCrusherBlade.cs b/Items/Weapons/Melee/CrimsonCrusherBlade.cs index 501c2443e4..ac8381d7db 100644 --- a/Items/Weapons/Melee/CrimsonCrusherBlade.cs +++ b/Items/Weapons/Melee/CrimsonCrusherBlade.cs @@ -1,3 +1,4 @@ +using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; @@ -16,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.damage = 41; + item.damage = 38; item.melee = true; item.width = 70; item.height = 80; @@ -42,9 +43,11 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { target.AddBuff(BuffID.Ichor, 120); - if (target.damage > 0 && crit) + if (target.damage > 0 && crit && !CalamityPlayer.areThereAnyDamnBosses) { - target.damage -= 10; + target.damage = target.defDamage - 5; + if (target.damage < 1) + target.damage = 1; } } diff --git a/Items/Weapons/Melee/DraedonsExoblade.cs b/Items/Weapons/Melee/DraedonsExoblade.cs index 0abf7fbb2b..40e701a021 100644 --- a/Items/Weapons/Melee/DraedonsExoblade.cs +++ b/Items/Weapons/Melee/DraedonsExoblade.cs @@ -1,5 +1,3 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; using CalamityMod.Tiles.Furniture.CraftingStations; @@ -64,15 +62,7 @@ namespace CalamityMod.Items.Weapons.Melee { Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage()), knockback, Main.myPlayer); } - target.AddBuff(ModContent.BuffType(), 30); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.Ichor, 120); + target.ExoDebuffs(); Main.PlaySound(SoundID.Item88, player.Center); float xPos = player.position.X + 800 * Main.rand.NextBool(2).ToDirectionInt(); float yPos = player.position.Y + Main.rand.Next(-800, 801); @@ -106,15 +96,7 @@ namespace CalamityMod.Items.Weapons.Melee { Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage()), item.knockBack, Main.myPlayer); } - target.AddBuff(ModContent.BuffType(), 30); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.Ichor, 120); + target.ExoDebuffs(); Main.PlaySound(SoundID.Item88, player.Center); float xPos = player.position.X + 800 * Main.rand.NextBool(2).ToDirectionInt(); float yPos = player.position.Y + Main.rand.Next(-800, 801); diff --git a/Items/Weapons/Melee/ElementalShortsword.cs b/Items/Weapons/Melee/ElementalShortsword.cs index 98bc836fdb..229c8de2e5 100644 --- a/Items/Weapons/Melee/ElementalShortsword.cs +++ b/Items/Weapons/Melee/ElementalShortsword.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Melee { DisplayName.SetDefault("Elemental Shiv"); Tooltip.SetDefault("Don't underestimate the power of shivs\n" + - "Shoots a rainbow orb that spawns shivs at multiple locations"); + "Shoots a rainbow shiv that spawns additional shivs on hit"); } public override void SetDefaults() @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Melee item.useTime = 10; item.width = 44; item.height = 44; - item.damage = 180; + item.damage = 160; item.melee = true; item.knockBack = 8.5f; item.UseSound = SoundID.Item1; @@ -41,7 +41,7 @@ namespace CalamityMod.Items.Weapons.Melee public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - Projectile.NewProjectile(position.X, position.Y, item.shootSpeed * player.direction, 0f, type, damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position.X, position.Y, item.shootSpeed * player.direction, 0f, type, (int)(damage * 0.5), knockBack, player.whoAmI, 0f, 0f); return false; } diff --git a/Items/Weapons/Melee/EmpyreanKnives.cs b/Items/Weapons/Melee/EmpyreanKnives.cs index d2b4690363..5e65ceb85b 100644 --- a/Items/Weapons/Melee/EmpyreanKnives.cs +++ b/Items/Weapons/Melee/EmpyreanKnives.cs @@ -1,5 +1,5 @@ using CalamityMod.Items.Materials; -using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Projectiles.Hybrid; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; @@ -105,7 +105,7 @@ namespace CalamityMod.Items.Weapons.Melee recipe.AddIngredient(ItemID.VampireKnives); recipe.AddIngredient(ModContent.ItemType(), 10); recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType(), 999); recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Weapons/Melee/EvilSmasher.cs b/Items/Weapons/Melee/EvilSmasher.cs index 2617c8eca1..bb41ea3578 100644 --- a/Items/Weapons/Melee/EvilSmasher.cs +++ b/Items/Weapons/Melee/EvilSmasher.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Melee; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -18,9 +19,8 @@ namespace CalamityMod.Items.Weapons.Melee item.width = 62; item.damage = 55; item.melee = true; - item.useAnimation = 30; + item.useAnimation = item.useTime = 30; item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 30; item.useTurn = true; item.knockBack = 8f; item.UseSound = SoundID.Item1; @@ -31,42 +31,43 @@ namespace CalamityMod.Items.Weapons.Melee item.Calamity().customRarity = CalamityRarity.RareVariant; } + public override float UseTimeMultiplier (Player player) + { + if (player.Calamity().brimlashBusterBoost) + return 2f; + return 1f; + } + + public override void ModifyWeaponDamage(Player player, ref float add, ref float mult, ref float flat) + { + float damageMult = 0f; + if (player.Calamity().brimlashBusterBoost) + damageMult = 0.5f; + mult += damageMult; + } + + public override void GetWeaponKnockback(Player player, ref float knockback) + { + if (player.Calamity().brimlashBusterBoost) + { + knockback *= 1.75f; + } + } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f)), knockback, Main.myPlayer); - if (Main.rand.NextBool(3)) - { - item.damage = 82; - item.useAnimation = 15; - item.useTime = 15; - item.knockBack = 14f; - } - else - { - item.damage = 55; - item.useAnimation = 30; - item.useTime = 30; - item.knockBack = 8f; - } + OnHitEffect(target.Center, player, knockback); } public override void OnHitPvp(Player player, Player target, int damage, bool crit) { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f)), item.knockBack, Main.myPlayer); - if (Main.rand.NextBool(3)) - { - item.damage = 82; - item.useAnimation = 15; - item.useTime = 15; - item.knockBack = 14f; - } - else - { - item.damage = 55; - item.useAnimation = 30; - item.useTime = 30; - item.knockBack = 8f; - } + OnHitEffect(target.Center, player, item.knockBack); } + + private void OnHitEffect(Vector2 targetPos, Player player, float knockback) + { + Projectile.NewProjectile(targetPos, Vector2.Zero, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage()), knockback, Main.myPlayer); + player.Calamity().brimlashBusterBoost = Main.rand.NextBool(3); + } } } diff --git a/Items/Weapons/Melee/ExoGladius.cs b/Items/Weapons/Melee/ExoGladius.cs index 543f56e7e1..faa1fc4a1c 100644 --- a/Items/Weapons/Melee/ExoGladius.cs +++ b/Items/Weapons/Melee/ExoGladius.cs @@ -1,5 +1,3 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; using CalamityMod.Tiles.Furniture.CraftingStations; @@ -68,84 +66,36 @@ namespace CalamityMod.Items.Weapons.Melee } } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.ExoDebuffs(); + OnHitEffects(player); + } + + public override void OnHitPvp(Player player, Player target, int damage, bool crit) + { + target.ExoDebuffs(); + OnHitEffects(player); + } + + private void OnHitEffects(Player player) { if (!player.immune) { player.immune = true; - if (player.immuneTime < 10) - player.immuneTime = 10; - if (player.hurtCooldowns[0] < 10) - player.hurtCooldowns[0] = 10; - if (player.hurtCooldowns[1] < 10) - player.hurtCooldowns[1] = 10; + if (player.immuneTime < 10) + player.immuneTime = 10; + if (player.hurtCooldowns[0] < 10) + player.hurtCooldowns[0] = 10; + if (player.hurtCooldowns[1] < 10) + player.hurtCooldowns[1] = 10; } - target.AddBuff(ModContent.BuffType(), 30); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.Ichor, 120); - - float x = target.Center.X + (float)Main.rand.Next(-400, 400); - float y = target.Center.Y - (float)Main.rand.Next(500, 800); - Vector2 vector = new Vector2(x, y); - float num15 = target.Center.X + (float)(target.width / 2) - vector.X; - float num16 = target.Center.Y + (float)(target.height / 2) - vector.Y; - num15 += (float)Main.rand.Next(-100, 101); - int num17 = 25; - float num18 = (float)Math.Sqrt((double)(num15 * num15 + num16 * num16)); - num18 = (float)num17 / num18; - num15 *= num18; - num16 *= num18; if (player.whoAmI == Main.myPlayer) { - Projectile.NewProjectile(x, y, num15, num16, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage()), 15f, player.whoAmI, 0f, 0f); + int damage = player.GetWeaponDamage(player.ActiveItem()); + CalamityUtils.ProjectileRain(player.Center, 400f, 100f, 500f, 800f, 25f, ModContent.ProjectileType(), damage, 15f, player.whoAmI); } } - - public override void OnHitPvp(Player player, Player target, int damage, bool crit) - { - if (!player.immune) - { - player.immune = true; - if (player.immuneTime < 10) - player.immuneTime = 10; - if (player.hurtCooldowns[0] < 10) - player.hurtCooldowns[0] = 10; - if (player.hurtCooldowns[1] < 10) - player.hurtCooldowns[1] = 10; - } - - target.AddBuff(ModContent.BuffType(), 30); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.Ichor, 120); - - float x = target.Center.X + (float)Main.rand.Next(-400, 400); - float y = target.Center.Y - (float)Main.rand.Next(500, 800); - Vector2 vector = new Vector2(x, y); - float num15 = target.Center.X + (float)(target.width / 2) - vector.X; - float num16 = target.Center.Y + (float)(target.height / 2) - vector.Y; - num15 += (float)Main.rand.Next(-100, 101); - int num17 = 25; - float num18 = (float)Math.Sqrt((double)(num15 * num15 + num16 * num16)); - num18 = (float)num17 / num18; - num15 *= num18; - num16 *= num18; - if (player.whoAmI == Main.myPlayer) - { - Projectile.NewProjectile(x, y, num15, num16, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage()), 15f, player.whoAmI, 0f, 0f); - } - } - } + } } diff --git a/Items/Weapons/Melee/FlameScytheMelee.cs b/Items/Weapons/Melee/FlameScytheMelee.cs index e5abf72199..7d8d78e68c 100644 --- a/Items/Weapons/Melee/FlameScytheMelee.cs +++ b/Items/Weapons/Melee/FlameScytheMelee.cs @@ -21,9 +21,9 @@ namespace CalamityMod.Items.Weapons.Melee item.noMelee = true; item.noUseGraphic = true; item.autoReuse = true; - item.useAnimation = 19; + item.useAnimation = 20; item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 19; + item.useTime = 20; item.knockBack = 8.5f; item.UseSound = SoundID.Item1; item.melee = true; diff --git a/Items/Weapons/Melee/FlarefrostBlade.cs b/Items/Weapons/Melee/FlarefrostBlade.cs index f4060cc88d..cfa73f7874 100644 --- a/Items/Weapons/Melee/FlarefrostBlade.cs +++ b/Items/Weapons/Melee/FlarefrostBlade.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 66; + item.width = 64; item.damage = 65; item.melee = true; item.useAnimation = 24; diff --git a/Items/Weapons/Melee/FlarefrostBlade.png b/Items/Weapons/Melee/FlarefrostBlade.png index 84dec1cb86..dedd00ceb0 100644 Binary files a/Items/Weapons/Melee/FlarefrostBlade.png and b/Items/Weapons/Melee/FlarefrostBlade.png differ diff --git a/Items/Weapons/Melee/GaelsGreatsword.cs b/Items/Weapons/Melee/GaelsGreatsword.cs index b1e3f5aa89..245e107d74 100644 --- a/Items/Weapons/Melee/GaelsGreatsword.cs +++ b/Items/Weapons/Melee/GaelsGreatsword.cs @@ -51,8 +51,7 @@ namespace CalamityMod.Items.Weapons.Melee item.height = 84; item.damage = BaseDamage; item.melee = true; - item.useAnimation = 17; - item.useTime = 17; + item.useAnimation = item.useTime = 12; item.useTurn = true; item.knockBack = 9; item.UseSound = SoundID.Item1; @@ -70,20 +69,14 @@ namespace CalamityMod.Items.Weapons.Melee } public override bool AltFunctionUse(Player player) => true; public override Vector2? HoldoutOffset() => new Vector2(12, 12); - public override bool CanUseItem(Player player) - { - if (player.altFunctionUse == 2) - { - item.useAnimation = 46; - item.useTime = 46; - } - else - { - item.useAnimation = 12; - item.useTime = 12; - } - return true; - } + + public override float UseTimeMultiplier (Player player) + { + if (player.altFunctionUse == 2) + return (12f/46f); + return 1f; + } + public override void MeleeEffects(Player player, Rectangle hitbox) { if (CalamityUtils.CountProjectiles(ModContent.ProjectileType()) < 3 && diff --git a/Items/Weapons/Melee/GalileoGladius.cs b/Items/Weapons/Melee/GalileoGladius.cs index ac9aac6711..910ce6c587 100644 --- a/Items/Weapons/Melee/GalileoGladius.cs +++ b/Items/Weapons/Melee/GalileoGladius.cs @@ -10,112 +10,87 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Melee { - public class GalileoGladius : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Galileo Gladius"); - Tooltip.SetDefault("Don't underestimate the power of small space swords\n" + - "Shoots a homing crescent moon\n" + + public class GalileoGladius : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Galileo Gladius"); + Tooltip.SetDefault("Don't underestimate the power of small space swords\n" + + "Shoots a homing crescent moon\n" + "Spawns planetoids on enemy hits"); - } + } - public override void SetDefaults() - { - item.useStyle = ItemUseStyleID.Stabbing; - item.useTurn = false; - item.useAnimation = 10; - item.useTime = 10; - item.width = 44; - item.height = 44; - item.damage = 200; - item.melee = true; - item.knockBack = 10f; - item.UseSound = SoundID.Item1; - item.useTurn = true; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 14f; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.PureGreen; - } + public override void SetDefaults() + { + item.useStyle = ItemUseStyleID.Stabbing; + item.useTurn = false; + item.useAnimation = 10; + item.useTime = 10; + item.width = 44; + item.height = 44; + item.damage = 200; + item.melee = true; + item.knockBack = 10f; + item.UseSound = SoundID.Item1; + item.useTurn = true; + item.autoReuse = true; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 14f; + item.value = Item.buyPrice(1, 40, 0, 0); + item.rare = 10; + item.Calamity().customRarity = CalamityRarity.PureGreen; + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Projectile.NewProjectile(position.X, position.Y, item.shootSpeed * player.direction, 0f, type, damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Projectile.NewProjectile(position.X, position.Y, item.shootSpeed * player.direction, 0f, type, (int)(damage * 0.5), knockBack, player.whoAmI, 0f, 0f); + return false; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 8); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddIngredient(ModContent.ItemType(), 15); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(5)) - { - int num250 = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, (Main.rand.NextBool(2) ? 20 : 176), (float)(player.direction * 2), 0f, 150, default, 1.3f); - Main.dust[num250].velocity *= 0.2f; - Main.dust[num250].noGravity = true; - } - } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool(5)) + { + int num250 = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, (Main.rand.NextBool(2) ? 20 : 176), (float)(player.direction * 2), 0f, 150, default, 1.3f); + Main.dust[num250].velocity *= 0.2f; + Main.dust[num250].noGravity = true; + } + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 300); + SpawnMeteor(player); + } + + public override void OnHitPvp(Player player, Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 300); + SpawnMeteor(player); + } + + private void SpawnMeteor(Player player) { - target.AddBuff(ModContent.BuffType(), 300); - float x = player.position.X + (float)Main.rand.Next(-400, 400); - float y = player.position.Y - (float)Main.rand.Next(500, 800); - Vector2 vector = new Vector2(x, y); - float num15 = player.position.X + (float)(player.width / 2) - vector.X; - float num16 = player.position.Y + (float)(player.height / 2) - vector.Y; - num15 += (float)Main.rand.Next(-100, 101); - int num17 = 25; - float num18 = (float)Math.Sqrt((double)(num15 * num15 + num16 * num16)); - num18 = (float)num17 / num18; - num15 *= num18; - num16 *= num18; - if (player.whoAmI == Main.myPlayer) - { + if (player.whoAmI == Main.myPlayer) + { if (player.Calamity().galileoCooldown <= 0) - { - int num19 = Projectile.NewProjectile(x, y, num15, num16, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f) * 2f), 15f, player.whoAmI, 0f, 0f); - Main.projectile[num19].ai[1] = player.position.Y; - player.Calamity().galileoCooldown = 15; + { + int damage = player.GetWeaponDamage(player.ActiveItem()) * 2; + CalamityUtils.ProjectileRain(player.Center, 400f, 100f, 500f, 800f, 25f, ModContent.ProjectileType(), damage, 15f, player.whoAmI); + player.Calamity().galileoCooldown = 15; } - } - } - - public override void OnHitPvp(Player player, Player target, int damage, bool crit) - { - target.AddBuff(ModContent.BuffType(), 300); - float x = player.position.X + (float)Main.rand.Next(-400, 400); - float y = player.position.Y - (float)Main.rand.Next(500, 800); - Vector2 vector = new Vector2(x, y); - float num15 = player.position.X + (float)(player.width / 2) - vector.X; - float num16 = player.position.Y + (float)(player.height / 2) - vector.Y; - num15 += (float)Main.rand.Next(-100, 101); - int num17 = 25; - float num18 = (float)Math.Sqrt((double)(num15 * num15 + num16 * num16)); - num18 = (float)num17 / num18; - num15 *= num18; - num16 *= num18; - if (player.whoAmI == Main.myPlayer) - { - if (player.Calamity().galileoCooldown <= 0) - { - int num19 = Projectile.NewProjectile(x, y, num15, num16, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f) * 2f), 15f, player.whoAmI, 0f, 0f); - Main.projectile[num19].ai[1] = player.position.Y; - player.Calamity().galileoCooldown = 15; - } - } - } - } + } + } + } } diff --git a/Items/Weapons/Melee/GeliticBlade.cs b/Items/Weapons/Melee/GeliticBlade.cs index 0e6388920d..e6d3c7b60b 100644 --- a/Items/Weapons/Melee/GeliticBlade.cs +++ b/Items/Weapons/Melee/GeliticBlade.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Terraria; @@ -18,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 62; - item.damage = 33; + item.damage = 38; item.melee = true; item.useAnimation = 30; item.useTime = 30; @@ -40,7 +41,7 @@ namespace CalamityMod.Items.Weapons.Melee recipe.AddIngredient(ModContent.ItemType(), 30); recipe.AddIngredient(ItemID.Gel, 35); recipe.AddIngredient(ItemID.HellstoneBar, 10); - recipe.AddTile(TileID.Anvils); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Weapons/Melee/GreatswordofJudgement.cs b/Items/Weapons/Melee/GreatswordofJudgement.cs index 505cbe23f6..47c9bb69c6 100644 --- a/Items/Weapons/Melee/GreatswordofJudgement.cs +++ b/Items/Weapons/Melee/GreatswordofJudgement.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.LunarBar, 11); + recipe.AddIngredient(ItemID.LunarBar, 7); recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Weapons/Melee/Greentide.cs b/Items/Weapons/Melee/Greentide.cs index d2b8c3c049..05d1284942 100644 --- a/Items/Weapons/Melee/Greentide.cs +++ b/Items/Weapons/Melee/Greentide.cs @@ -19,8 +19,8 @@ namespace CalamityMod.Items.Weapons.Melee { item.damage = 95; item.melee = true; - item.width = 60; - item.height = 60; + item.width = 62; + item.height = 62; item.useTime = 24; item.useAnimation = 24; item.useTurn = true; diff --git a/Items/Weapons/Melee/Greentide.png b/Items/Weapons/Melee/Greentide.png index a3af9daf60..9ec5b48535 100644 Binary files a/Items/Weapons/Melee/Greentide.png and b/Items/Weapons/Melee/Greentide.png differ diff --git a/Items/Weapons/Melee/KelvinCatalystMelee.png b/Items/Weapons/Melee/KelvinCatalystMelee.png index 1d6c440160..86a074d801 100644 Binary files a/Items/Weapons/Melee/KelvinCatalystMelee.png and b/Items/Weapons/Melee/KelvinCatalystMelee.png differ diff --git a/Items/Weapons/Melee/MandibleClaws.cs b/Items/Weapons/Melee/MandibleClaws.cs index e321cb025a..4989c50ecb 100644 --- a/Items/Weapons/Melee/MandibleClaws.cs +++ b/Items/Weapons/Melee/MandibleClaws.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 22; + item.width = 26; item.damage = 14; item.melee = true; item.useAnimation = 6; diff --git a/Items/Weapons/Melee/MandibleClaws.png b/Items/Weapons/Melee/MandibleClaws.png index f860016731..f1142da58a 100644 Binary files a/Items/Weapons/Melee/MandibleClaws.png and b/Items/Weapons/Melee/MandibleClaws.png differ diff --git a/Items/Weapons/Melee/MantisClaws.cs b/Items/Weapons/Melee/MantisClaws.cs index a999aa626d..a2bd797c9e 100644 --- a/Items/Weapons/Melee/MantisClaws.cs +++ b/Items/Weapons/Melee/MantisClaws.cs @@ -19,9 +19,9 @@ namespace CalamityMod.Items.Weapons.Melee item.width = 26; item.damage = 120; item.melee = true; - item.useAnimation = 6; + item.useAnimation = 8; item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 6; + item.useTime = 8; item.useTurn = true; item.knockBack = 7f; item.UseSound = SoundID.Item1; diff --git a/Items/Weapons/Melee/Murasama.cs b/Items/Weapons/Melee/Murasama.cs index 96056ec929..0f73f79295 100644 --- a/Items/Weapons/Melee/Murasama.cs +++ b/Items/Weapons/Melee/Murasama.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Items.Weapons.Melee Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(5, 14)); } - internal Rectangle GetCurrentFrame() + internal Rectangle GetCurrentFrame(bool frameCounterUp = true) { //0 = 6 frames, 8 = 3 frames] int applicableCounter = frame == 0 ? 36 : frame == 8 ? 24 : 6; @@ -54,7 +54,8 @@ namespace CalamityMod.Items.Weapons.Melee frameCounter = -1; frame = frame == 13 ? 0 : frame + 1; } - frameCounter++; + if (frameCounterUp) + frameCounter++; return new Rectangle(0, item.height * frame, item.width, item.height); } @@ -68,10 +69,16 @@ namespace CalamityMod.Items.Weapons.Melee public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) { Texture2D texture = ModContent.GetTexture(Texture); - spriteBatch.Draw(texture, item.position - Main.screenPosition, GetCurrentFrame(), Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + spriteBatch.Draw(texture, item.position - Main.screenPosition, GetCurrentFrame(), lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); return false; } + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Melee/MurasamaGlow"); + spriteBatch.Draw(texture, item.position - Main.screenPosition, GetCurrentFrame(false), Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + } + public override bool CanUseItem(Player player) { if (player.ownedProjectileCounts[item.shoot] > 0) diff --git a/Items/Weapons/Melee/MurasamaGlow.png b/Items/Weapons/Melee/MurasamaGlow.png new file mode 100644 index 0000000000..33b3f5b00e Binary files /dev/null and b/Items/Weapons/Melee/MurasamaGlow.png differ diff --git a/Items/Weapons/Melee/NeptunesBounty.cs b/Items/Weapons/Melee/NeptunesBounty.cs index 12435c830a..e195edaca8 100644 --- a/Items/Weapons/Melee/NeptunesBounty.cs +++ b/Items/Weapons/Melee/NeptunesBounty.cs @@ -57,7 +57,7 @@ namespace CalamityMod.Items.Weapons.Melee { if (Main.rand.NextBool(3)) { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 33); + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 33); } } diff --git a/Items/Weapons/Melee/ProfanedSword.cs b/Items/Weapons/Melee/ProfanedSword.cs index 6ed2429af9..aceefd4f42 100644 --- a/Items/Weapons/Melee/ProfanedSword.cs +++ b/Items/Weapons/Melee/ProfanedSword.cs @@ -22,8 +22,7 @@ namespace CalamityMod.Items.Weapons.Melee { item.damage = 75; item.melee = true; - item.width = 42; - item.height = 50; + item.width = item.height = 52; item.useTime = 23; item.useAnimation = 23; item.useTurn = true; diff --git a/Items/Weapons/Melee/ProfanedSword.png b/Items/Weapons/Melee/ProfanedSword.png index 41758d95bf..36dfb30fbe 100644 Binary files a/Items/Weapons/Melee/ProfanedSword.png and b/Items/Weapons/Melee/ProfanedSword.png differ diff --git a/Items/Weapons/Melee/PwnagehammerMelee.cs b/Items/Weapons/Melee/PwnagehammerMelee.cs index 357ec3a8dc..d0bbda9e53 100644 --- a/Items/Weapons/Melee/PwnagehammerMelee.cs +++ b/Items/Weapons/Melee/PwnagehammerMelee.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Hybrid; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,19 +11,21 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Pwnagehammer"); - Tooltip.SetDefault("Throws an extremely fast hammer"); + Tooltip.SetDefault("Throws a heavy, gravity-affected hammer that creates a loud blast of hallowed energy when it hits something\n" + + "There is a 20 percent chance for the hammer to home in on a target\n" + + "Homing hammers summon an additional spectral hammer on hit and are guaranteed to land a critical hit"); } public override void SetDefaults() { item.width = 68; - item.damage = 90; + item.damage = 210; + item.crit = 10; item.noMelee = true; item.noUseGraphic = true; item.autoReuse = true; - item.useAnimation = 15; + item.useAnimation = item.useTime = 48; item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 15; item.knockBack = 10f; item.UseSound = SoundID.Item1; item.melee = true; @@ -30,7 +33,19 @@ namespace CalamityMod.Items.Weapons.Melee item.value = Item.buyPrice(0, 48, 0, 0); item.rare = 6; item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; + item.shootSpeed = 24.4f; + } + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Vector2 speed = new Vector2(speedX, speedY); + Vector2 yeetOffset = Vector2.Normalize(speed) * 40f; + if (Collision.CanHit(position, 0, 0, position + yeetOffset, 0, 0)) + { + position += yeetOffset; + } + Projectile.NewProjectile(position, speed, type, damage, knockBack, player.whoAmI, Main.rand.NextBool(5) ? 1f : 0f); + return false; } public override void AddRecipes() diff --git a/Items/Weapons/Melee/Roxcalibur.cs b/Items/Weapons/Melee/Roxcalibur.cs index 1956ae9588..a500f545bc 100644 --- a/Items/Weapons/Melee/Roxcalibur.cs +++ b/Items/Weapons/Melee/Roxcalibur.cs @@ -192,7 +192,8 @@ namespace CalamityMod.Items.Weapons.Melee } } // Makes the player forcefully dive down - player.velocity.Y = player.maxFallSpeed; + if (CalamityUtils.CountHookProj() <= 0) + player.velocity.Y = player.maxFallSpeed; //Rotates the sprite of the item on alt fire to have it point downwards player.itemRotation = player.direction * MathHelper.ToRadians(135f); //Dust trail @@ -212,7 +213,7 @@ namespace CalamityMod.Items.Weapons.Melee //Spawns a projectile on the tip of the sword in the alt fire float positionx; float positiony = position.Y + (item.height / 2) + 23; - ; + int cooldown = 0; //Check if the entire cooldown has passed if (Roxcooldown >= 600) @@ -228,7 +229,7 @@ namespace CalamityMod.Items.Weapons.Melee { positionx = position.X - 8; } - Projectile.NewProjectile(positionx, positiony, player.velocity.X, player.velocity.Y, ModContent.ProjectileType(), 0, 0, player.whoAmI, cooldown); + Projectile.NewProjectile(positionx, positiony - (player.height / 10f), player.velocity.X, player.velocity.Y, ModContent.ProjectileType(), 0, 0, player.whoAmI, cooldown); //Resets the cooldown after shooting if (Roxcooldown >= 600) { diff --git a/Items/Weapons/Melee/StellarContemptMelee.cs b/Items/Weapons/Melee/StellarContemptMelee.cs index cbaa7639c5..f9ca0abeda 100644 --- a/Items/Weapons/Melee/StellarContemptMelee.cs +++ b/Items/Weapons/Melee/StellarContemptMelee.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Items.Weapons.Melee ModRecipe r = new ModRecipe(mod); r.SetResult(this); r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ItemID.LunarBar, 10); + r.AddIngredient(ItemID.LunarBar, 5); r.AddIngredient(ItemID.FragmentSolar, 10); r.AddIngredient(ItemID.FragmentNebula, 10); r.AddTile(TileID.LunarCraftingStation); diff --git a/Items/Weapons/Melee/StellarStriker.cs b/Items/Weapons/Melee/StellarStriker.cs index aad8f52610..ecd72572cd 100644 --- a/Items/Weapons/Melee/StellarStriker.cs +++ b/Items/Weapons/Melee/StellarStriker.cs @@ -39,56 +39,17 @@ namespace CalamityMod.Items.Weapons.Melee { return; } - Main.PlaySound(SoundID.Item88, player.position); - int i = Main.myPlayer; - float num72 = item.shootSpeed; - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (player.gravDir == -1f) - { - num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; - } - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) - { - num78 = (float)player.direction; - num79 = 0f; - num80 = num72; - } - else - { - num80 = num72 / num80; - } - - int num112 = 2; - for (int num113 = 0; num113 < num112; num113++) - { - vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); - vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); - vector2.Y -= (float)(100 * num113); - num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X + (float)Main.rand.Next(-40, 41) * 0.03f; - num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (num79 < 0f) - { - num79 *= -1f; - } - if (num79 < 20f) - { - num79 = 20f; - } - num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - num80 = num72 / num80; - num78 *= num80; - num79 *= num80; - float num114 = num78; - float num115 = num79 + (float)Main.rand.Next(-80, 81) * 0.02f; - int proj = Projectile.NewProjectile(vector2.X, vector2.Y, num114, num115, ProjectileID.LunarFlare, (int)(item.damage * player.MeleeDamage() * 0.5), knockback, i, 0f, (float)Main.rand.Next(3)); - Main.projectile[proj].Calamity().forceMelee = true; - } + if (player.whoAmI == Main.myPlayer) + SpawnFlares(player, knockback); } public override void OnHitPvp(Player player, Player target, int damage, bool crit) + { + if (player.whoAmI == Main.myPlayer) + SpawnFlares(player, item.knockBack); + } + + private void SpawnFlares(Player player, float knockBack) { Main.PlaySound(SoundID.Item88, player.position); int i = Main.myPlayer; @@ -115,7 +76,7 @@ namespace CalamityMod.Items.Weapons.Melee int num112 = 2; for (int num113 = 0; num113 < num112; num113++) { - vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); + vector2 = new Vector2(player.Center.X + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); vector2.Y -= (float)(100 * num113); num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X + (float)Main.rand.Next(-40, 41) * 0.03f; @@ -134,7 +95,7 @@ namespace CalamityMod.Items.Weapons.Melee num79 *= num80; float num114 = num78; float num115 = num79 + (float)Main.rand.Next(-80, 81) * 0.02f; - int proj = Projectile.NewProjectile(vector2.X, vector2.Y, num114, num115, ProjectileID.LunarFlare, (int)(item.damage * player.MeleeDamage() * 0.5), item.knockBack, i, 0f, (float)Main.rand.Next(3)); + int proj = Projectile.NewProjectile(vector2.X, vector2.Y, num114, num115, ProjectileID.LunarFlare, (int)(item.damage * player.MeleeDamage() * 0.5), knockBack, i, 0f, (float)Main.rand.Next(3)); Main.projectile[proj].Calamity().forceMelee = true; } } @@ -151,7 +112,7 @@ namespace CalamityMod.Items.Weapons.Melee { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.LunarBar, 10); + recipe.AddIngredient(ItemID.LunarBar, 5); recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Weapons/Melee/Terratomere.cs b/Items/Weapons/Melee/Terratomere.cs index 8f60a38641..78b2011564 100644 --- a/Items/Weapons/Melee/Terratomere.cs +++ b/Items/Weapons/Melee/Terratomere.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Items.Weapons.Melee { float SpeedX = speedX + (float)Main.rand.Next(-40, 41) * 0.05f; float SpeedY = speedY + (float)Main.rand.Next(-40, 41) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, (int)((double)damage * 0.5), knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, (int)(damage * 0.5), knockBack, player.whoAmI, 0f, 0f); } return false; } @@ -52,7 +52,6 @@ namespace CalamityMod.Items.Weapons.Melee 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()); @@ -62,7 +61,6 @@ namespace CalamityMod.Items.Weapons.Melee recipe.SetResult(this); recipe.AddRecipe(); recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); diff --git a/Items/Weapons/Melee/TheGodsGambit.cs b/Items/Weapons/Melee/TheGodsGambit.cs index 2719abf18d..f997cf0ed5 100644 --- a/Items/Weapons/Melee/TheGodsGambit.cs +++ b/Items/Weapons/Melee/TheGodsGambit.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Projectiles.Melee.Yoyos; using Terraria; using Terraria.ID; @@ -22,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Melee item.width = 40; item.height = 26; item.melee = true; - item.damage = 28; + item.damage = 33; item.knockBack = 3.5f; item.useTime = 21; item.useAnimation = 21; @@ -45,7 +46,7 @@ namespace CalamityMod.Items.Weapons.Melee { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 30); - recipe.AddTile(TileID.Anvils); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Weapons/Melee/TheMutilator.cs b/Items/Weapons/Melee/TheMutilator.cs index 1d38a5308e..b0660650be 100644 --- a/Items/Weapons/Melee/TheMutilator.cs +++ b/Items/Weapons/Melee/TheMutilator.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -19,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Melee { item.width = 90; item.height = 90; - item.damage = 950; + item.damage = 700; item.melee = true; item.useAnimation = 18; item.useStyle = ItemUseStyleID.SwingThrow; @@ -38,16 +39,19 @@ namespace CalamityMod.Items.Weapons.Melee { if (target.life <= (target.lifeMax * 0.2f) && target.canGhostHeal) { - int heartDrop = Main.rand.Next(1, 3); - for (int i = 0; i < heartDrop; i++) - { - Item.NewItem((int)target.position.X, (int)target.position.Y, target.width, target.height, 58, 1, false, 0, false, false); - } + if (!CalamityPlayer.areThereAnyDamnBosses || Main.rand.NextBool(2)) + { + int heartDrop = CalamityPlayer.areThereAnyDamnBosses ? 1 : Main.rand.Next(1, 3); + for (int i = 0; i < heartDrop; i++) + { + Item.NewItem((int)target.position.X, (int)target.position.Y, target.width, target.height, 58, 1, false, 0, false, false); + } + } Main.PlaySound(SoundID.Item14, target.position); - target.position.X += (float)(target.width / 2); - target.position.Y += (float)(target.height / 2); - target.position.X -= (float)(target.width / 2); - target.position.Y -= (float)(target.height / 2); + target.position.X += target.width / 2; + target.position.Y += target.height / 2; + target.position.X -= target.width / 2; + target.position.Y -= target.height / 2; for (int num621 = 0; num621 < 30; num621++) { int num622 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 5, 0f, 0f, 100, default, 2f); @@ -55,7 +59,7 @@ namespace CalamityMod.Items.Weapons.Melee if (Main.rand.NextBool(2)) { Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } for (int num623 = 0; num623 < 50; num623++) diff --git a/Items/Weapons/Melee/TrueBloodyEdge.png b/Items/Weapons/Melee/TrueBloodyEdge.png index c83b981a18..f52b227e5a 100644 Binary files a/Items/Weapons/Melee/TrueBloodyEdge.png and b/Items/Weapons/Melee/TrueBloodyEdge.png differ diff --git a/Items/Weapons/Melee/TrueForbiddenOathblade.cs b/Items/Weapons/Melee/TrueForbiddenOathblade.cs index 97fcab0849..301bc8de9b 100644 --- a/Items/Weapons/Melee/TrueForbiddenOathblade.cs +++ b/Items/Weapons/Melee/TrueForbiddenOathblade.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -20,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Melee { item.width = 88; item.height = 88; - item.damage = 200; + item.damage = 150; item.melee = true; item.useAnimation = 23; item.useTime = 23; @@ -41,7 +42,7 @@ namespace CalamityMod.Items.Weapons.Melee for (int i = -index; i <= index; i += index) { Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.ToRadians(i)); - Projectile.NewProjectile(position.X, position.Y, perturbedSpeed.X, perturbedSpeed.Y, type, damage / 2, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position, perturbedSpeed, type, damage / 2, knockBack, player.whoAmI, 0f, 0f); } return false; } @@ -51,7 +52,7 @@ namespace CalamityMod.Items.Weapons.Melee ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddIngredient(ModContent.ItemType(), 3); + recipe.AddIngredient(ModContent.ItemType(), 3); recipe.AddIngredient(ItemID.BrokenHeroSword); recipe.AddTile(TileID.MythrilAnvil); recipe.SetResult(this); @@ -74,43 +75,40 @@ namespace CalamityMod.Items.Weapons.Melee { target.AddBuff(BuffID.ShadowFlame, 900); target.AddBuff(BuffID.OnFire, 900); - player.ApplyDamageToNPC(target, (int)(item.damage * (player.allDamage + player.meleeDamage - 1f)) * 3, 0f, 0, false); + player.ApplyDamageToNPC(target, player.GetWeaponDamage(player.ActiveItem()) * 2, 0f, 0, false); float num50 = 1.7f; float num51 = 0.8f; float num52 = 2f; - Vector2 value3 = (target.rotation - 1.57079637f).ToRotationVector2(); + Vector2 value3 = (target.rotation - MathHelper.PiOver2).ToRotationVector2(); Vector2 value4 = value3 * target.velocity.Length(); - Main.PlaySound(SoundID.Item14, target.position); - int num3; - for (int num53 = 0; num53 < 40; num53 = num3 + 1) + Main.PlaySound(SoundID.Item14, target.Center); + for (int num53 = 0; num53 < 40; num53++) { - int num54 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 173, 0f, 0f, 200, default, num50); + int num54 = Dust.NewDust(target.position, target.width, target.height, 173, 0f, 0f, 200, default, num50); Dust dust = Main.dust[num54]; - dust.position = target.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)target.width / 2f; + dust.position = target.Center + Vector2.UnitY.RotatedByRandom(Math.PI) * (float)Main.rand.NextDouble() * (float)target.width / 2f; dust.noGravity = true; dust.velocity.Y -= 4.5f; dust.velocity *= 3f; dust.velocity += value4 * Main.rand.NextFloat(); - num54 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 173, 0f, 0f, 100, default, num51); - dust.position = target.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)target.width / 2f; + num54 = Dust.NewDust(target.position, target.width, target.height, 173, 0f, 0f, 100, default, num51); + dust.position = target.Center + Vector2.UnitY.RotatedByRandom(Math.PI) * (float)Main.rand.NextDouble() * (float)target.width / 2f; dust.velocity.Y -= 3f; dust.velocity *= 2f; dust.noGravity = true; dust.fadeIn = 1f; dust.color = Color.Crimson * 0.5f; dust.velocity += value4 * Main.rand.NextFloat(); - num3 = num53; } - for (int num55 = 0; num55 < 20; num55 = num3 + 1) + for (int num55 = 0; num55 < 20; num55++) { - int num56 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 173, 0f, 0f, 0, default, num52); + int num56 = Dust.NewDust(target.position, target.width, target.height, 173, 0f, 0f, 0, default, num52); Dust dust = Main.dust[num56]; - dust.position = target.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)target.velocity.ToRotation(), default) * (float)target.width / 3f; + dust.position = target.Center + Vector2.UnitX.RotatedByRandom(Math.PI).RotatedBy((double)target.velocity.ToRotation(), default) * (float)target.width / 3f; dust.noGravity = true; dust.velocity.Y -= 1.5f; dust.velocity *= 0.5f; dust.velocity += value4 * (0.6f + 0.6f * Main.rand.NextFloat()); - num3 = num55; } } } diff --git a/Items/Weapons/Melee/TyphonsGreed.cs b/Items/Weapons/Melee/TyphonsGreed.cs index 402c10ed16..dc3b122407 100644 --- a/Items/Weapons/Melee/TyphonsGreed.cs +++ b/Items/Weapons/Melee/TyphonsGreed.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.damage = 75; + item.damage = 65; item.melee = true; item.width = 16; item.height = 16; diff --git a/Items/Weapons/Melee/VirulentKatana.cs b/Items/Weapons/Melee/VirulentKatana.cs index c1244aaa8b..4e7379b522 100644 --- a/Items/Weapons/Melee/VirulentKatana.cs +++ b/Items/Weapons/Melee/VirulentKatana.cs @@ -7,47 +7,47 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Melee { - public class VirulentKatana : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Virulence"); - Tooltip.SetDefault("Fires a plague cloud"); - } + public class VirulentKatana : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Virulence"); + Tooltip.SetDefault("Fires a plague cloud"); + } - public override void SetDefaults() - { - item.width = 48; - item.damage = 96; - item.melee = true; - item.useAnimation = 15; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 15; - item.useTurn = true; - item.knockBack = 5.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 62; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 9f; - } + public override void SetDefaults() + { + item.damage = 96; + item.knockBack = 5.5f; + item.useAnimation = item.useTime = 15; + item.melee = true; + item.useTurn = true; + item.autoReuse = true; + item.shootSpeed = 9f; + 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) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, (int)(damage * 0.85), knockBack, player.whoAmI, 0f, 0f); - return false; - } + item.width = 48; + item.height = 62; + item.useStyle = ItemUseStyleID.SwingThrow; + item.UseSound = SoundID.Item1; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 240); - } + 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), type, (int)(damage * 0.85), knockBack, player.whoAmI, 0f, 0f); + return false; + } - public override void OnHitPvp(Player player, Player target, int damage, bool crit) - { - target.AddBuff(ModContent.BuffType(), 240); - } - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 240); + } + + public override void OnHitPvp(Player player, Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 240); + } + } } diff --git a/Items/Weapons/Melee/WulfrumBlade.cs b/Items/Weapons/Melee/WulfrumBlade.cs index 7dbf7198ae..34b3bbbbb0 100644 --- a/Items/Weapons/Melee/WulfrumBlade.cs +++ b/Items/Weapons/Melee/WulfrumBlade.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -14,7 +15,8 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 46; + item.width = 32; + item.height = 46; item.damage = 12; item.melee = true; item.useAnimation = 20; @@ -24,11 +26,15 @@ namespace CalamityMod.Items.Weapons.Melee item.knockBack = 3.75f; item.UseSound = SoundID.Item1; item.autoReuse = true; - item.height = 54; item.value = Item.buyPrice(0, 1, 0, 0); item.rare = 1; } + public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox) + { + hitbox = CalamityUtils.FixSwingHitbox(39, 39); + } + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); diff --git a/Items/Weapons/Melee/WulfrumBlade.png b/Items/Weapons/Melee/WulfrumBlade.png index d607dcf424..121c4cfe6e 100644 Binary files a/Items/Weapons/Melee/WulfrumBlade.png and b/Items/Weapons/Melee/WulfrumBlade.png differ diff --git a/Items/Weapons/Melee/XerocsGreatsword.cs b/Items/Weapons/Melee/XerocsGreatsword.cs index 07a2e2b818..364fa0609a 100644 --- a/Items/Weapons/Melee/XerocsGreatsword.cs +++ b/Items/Weapons/Melee/XerocsGreatsword.cs @@ -11,13 +11,14 @@ namespace CalamityMod.Items.Weapons.Melee { public override void SetStaticDefaults() { - DisplayName.SetDefault("Xeroc Greatsword"); + DisplayName.SetDefault("Entropic Claymore"); Tooltip.SetDefault("Fires a spread of homing plasma balls"); } public override void SetDefaults() { - item.width = 66; + item.width = 130; + item.height = 106; item.damage = 90; item.melee = true; item.useAnimation = 26; @@ -27,13 +28,17 @@ namespace CalamityMod.Items.Weapons.Melee item.knockBack = 5.25f; item.UseSound = SoundID.Item1; item.autoReuse = true; - item.height = 66; item.value = Item.buyPrice(0, 95, 0, 0); item.rare = 9; - item.shoot = ModContent.ProjectileType(); + item.shoot = ModContent.ProjectileType(); item.shootSpeed = 12f; } + public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox) + { + hitbox = CalamityUtils.FixSwingHitbox(118, 118); + } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { int num6 = Main.rand.Next(4, 6); @@ -41,7 +46,24 @@ namespace CalamityMod.Items.Weapons.Melee { float SpeedX = speedX + (float)Main.rand.Next(-20, 21) * 0.05f; float SpeedY = speedY + (float)Main.rand.Next(-20, 21) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, (int)((double)damage * 0.75), knockBack, player.whoAmI, 0.0f, 0.0f); + float damageMult = 0.5f; + switch (index) + { + case 0: + type = ModContent.ProjectileType(); + break; + case 1: + type = ModContent.ProjectileType(); + damageMult = 0.65f; + break; + case 2: + type = ModContent.ProjectileType(); + damageMult = 0.8f; + break; + default: + break; + } + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, (int)(damage * damageMult), knockBack, player.whoAmI, 0f, 0f); } return false; } diff --git a/Items/Weapons/Melee/XerocsGreatsword.png b/Items/Weapons/Melee/XerocsGreatsword.png index 48fe75ebe6..ce89466c6c 100644 Binary files a/Items/Weapons/Melee/XerocsGreatsword.png and b/Items/Weapons/Melee/XerocsGreatsword.png differ diff --git a/Items/Weapons/Ranged/Alluvion.cs b/Items/Weapons/Ranged/Alluvion.cs index f35b97d54f..e817cc39e9 100644 --- a/Items/Weapons/Ranged/Alluvion.cs +++ b/Items/Weapons/Ranged/Alluvion.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Weapons.Ranged item.autoReuse = true; item.shoot = ProjectileID.WoodenArrowFriendly; item.shootSpeed = 17f; - item.useAmmo = 40; + item.useAmmo = AmmoID.Arrow; item.Calamity().customRarity = CalamityRarity.DarkBlue; } diff --git a/Items/Weapons/Ranged/AngelicShotgun.cs b/Items/Weapons/Ranged/AngelicShotgun.cs index 91cfeca001..eac6e4b69b 100644 --- a/Items/Weapons/Ranged/AngelicShotgun.cs +++ b/Items/Weapons/Ranged/AngelicShotgun.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Weapons.Ranged { public class AngelicShotgun : ModItem { - private static int BaseDamage = 90; + private static int BaseDamage = 100; private static float BulletSpeed = 12f; public override void SetStaticDefaults() @@ -31,8 +31,8 @@ Fighting 'til the war's won"); item.width = 44; item.height = 7; - item.useTime = 26; - item.useAnimation = 26; + item.useTime = 24; + item.useAnimation = 24; item.UseSound = SoundID.Item38; item.useStyle = ItemUseStyleID.HoldingOut; diff --git a/Items/Weapons/Ranged/Archerfish.png b/Items/Weapons/Ranged/Archerfish.png index ad368e2088..55448257d1 100644 Binary files a/Items/Weapons/Ranged/Archerfish.png and b/Items/Weapons/Ranged/Archerfish.png differ diff --git a/Items/Weapons/Ranged/ArterialAssault.cs b/Items/Weapons/Ranged/ArterialAssault.cs index 5e2db0fb4b..4d954653d1 100644 --- a/Items/Weapons/Ranged/ArterialAssault.cs +++ b/Items/Weapons/Ranged/ArterialAssault.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Weapons.Ranged { DisplayName.SetDefault("Arterial Assault"); Tooltip.SetDefault("Fires a chain of arrows from the sky\n" + - "Wooden arrows are converted to bloodfire arrows"); + "Wooden arrows are converted to homing bloodfire arrows"); } public override void SetDefaults() @@ -91,7 +91,7 @@ namespace CalamityMod.Items.Weapons.Ranged float speedY5 = num79; if (type == ProjectileID.WoodenArrowFriendly) { - int bloodfire = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(15)); + int bloodfire = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 80f); Main.projectile[bloodfire].tileCollide = false; } else diff --git a/Items/Weapons/Ranged/BlissfulBombardier.cs b/Items/Weapons/Ranged/BlissfulBombardier.cs index 6924c37d28..88d05dc3a7 100644 --- a/Items/Weapons/Ranged/BlissfulBombardier.cs +++ b/Items/Weapons/Ranged/BlissfulBombardier.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 62; + item.damage = 75; item.ranged = true; item.width = 76; item.height = 30; diff --git a/Items/Weapons/Ranged/BloodBoiler.cs b/Items/Weapons/Ranged/BloodBoiler.cs index 73d60211db..429d3b1ba1 100644 --- a/Items/Weapons/Ranged/BloodBoiler.cs +++ b/Items/Weapons/Ranged/BloodBoiler.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 400; + item.damage = 415; item.ranged = true; item.width = 60; item.height = 30; diff --git a/Items/Weapons/Ranged/BrimstoneFury.png b/Items/Weapons/Ranged/BrimstoneFury.png index 058b9539c3..fff257b092 100644 Binary files a/Items/Weapons/Ranged/BrimstoneFury.png and b/Items/Weapons/Ranged/BrimstoneFury.png differ diff --git a/Items/Weapons/Ranged/ClamorRifle.cs b/Items/Weapons/Ranged/ClamorRifle.cs index 5dd52eabfe..bc793a6355 100644 --- a/Items/Weapons/Ranged/ClamorRifle.cs +++ b/Items/Weapons/Ranged/ClamorRifle.cs @@ -3,7 +3,6 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using Terraria.ID; namespace CalamityMod.Items.Weapons.Ranged { diff --git a/Items/Weapons/Ranged/ClockworkBow.cs b/Items/Weapons/Ranged/ClockworkBow.cs index 773258218d..4dae2866d9 100644 --- a/Items/Weapons/Ranged/ClockworkBow.cs +++ b/Items/Weapons/Ranged/ClockworkBow.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Items.Weapons.Ranged { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.Cog, 50); - recipe.AddIngredient(ItemID.LunarBar, 15); + recipe.AddIngredient(ItemID.LunarBar, 5); recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Weapons/Ranged/ConferenceCall.png b/Items/Weapons/Ranged/ConferenceCall.png index 0a0e3263ae..9e1e6c5032 100644 Binary files a/Items/Weapons/Ranged/ConferenceCall.png and b/Items/Weapons/Ranged/ConferenceCall.png differ diff --git a/Items/Weapons/Ranged/Drataliornus.cs b/Items/Weapons/Ranged/Drataliornus.cs index b6f437caf7..885b7d96e6 100644 --- a/Items/Weapons/Ranged/Drataliornus.cs +++ b/Items/Weapons/Ranged/Drataliornus.cs @@ -28,9 +28,9 @@ Right click to fire two devastating barrages of five empowered fireballs. item.knockBack = 1f; item.shootSpeed = 18f; item.useStyle = ItemUseStyleID.HoldingOut; - item.useAnimation = 10; - item.useTime = 10; - item.reuseDelay = 0; + item.useAnimation = 24; + item.useTime = 12; + item.reuseDelay = 48; item.width = 64; item.height = 84; item.UseSound = SoundID.Item5; @@ -56,16 +56,10 @@ Right click to fire two devastating barrages of five empowered fireballs. { if (player.altFunctionUse == 2) { - item.useAnimation = 24; - item.useTime = 12; - item.reuseDelay = 48; item.noUseGraphic = false; } else { - item.useAnimation = 9; - item.useTime = 9; - item.reuseDelay = 0; item.noUseGraphic = true; if (player.ownedProjectileCounts[item.shoot] > 0) { @@ -88,7 +82,7 @@ Right click to fire two devastating barrages of five empowered fireballs. { float num8 = index1 - (num4 - 1) / 2; Vector2 vector2_5 = spinningpoint.RotatedBy(num3 * num8, new Vector2()); - Projectile.NewProjectile(position.X + vector2_5.X, position.Y + vector2_5.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 1f, 0f); + Projectile.NewProjectile(position.X + vector2_5.X, position.Y + vector2_5.Y, speedX, speedY, ModContent.ProjectileType(), (int)(damage * 0.69), knockBack, player.whoAmI, 1f, 0f); } } else diff --git a/Items/Weapons/Ranged/FirestormCannon.cs b/Items/Weapons/Ranged/FirestormCannon.cs index a70fae6475..858549f145 100644 --- a/Items/Weapons/Ranged/FirestormCannon.cs +++ b/Items/Weapons/Ranged/FirestormCannon.cs @@ -54,19 +54,16 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool CanUseItem(Player player) { - if (player.altFunctionUse == 2) - { - item.useTime = 27; - item.useAnimation = 27; - } - else - { - item.useTime = 9; - item.useAnimation = 9; - } return base.CanUseItem(player); } + public override float UseTimeMultiplier (Player player) + { + if (player.altFunctionUse == 2) + return 0.3333f; + return 1f; + } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { if (player.altFunctionUse == 2) diff --git a/Items/Weapons/Ranged/FirestormCannon.png b/Items/Weapons/Ranged/FirestormCannon.png index 6d93c984ae..2ce38cc65b 100644 Binary files a/Items/Weapons/Ranged/FirestormCannon.png and b/Items/Weapons/Ranged/FirestormCannon.png differ diff --git a/Items/Weapons/Ranged/Galeforce.cs b/Items/Weapons/Ranged/Galeforce.cs index 5a943c7e28..8036a8c90f 100644 --- a/Items/Weapons/Ranged/Galeforce.cs +++ b/Items/Weapons/Ranged/Galeforce.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 18; + item.damage = 16; item.ranged = true; item.width = 32; item.height = 52; @@ -30,9 +30,9 @@ namespace CalamityMod.Items.Weapons.Ranged item.rare = 3; item.UseSound = SoundID.Item5; item.autoReuse = true; - item.shoot = ProjectileID.PurificationPowder; + item.shoot = ProjectileID.WoodenArrowFriendly; item.shootSpeed = 20f; - item.useAmmo = 40; + 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) @@ -40,7 +40,7 @@ namespace CalamityMod.Items.Weapons.Ranged for (int i = -8; i <= 8; i += 8) { Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.ToRadians(i)); - Projectile.NewProjectile(position.X, position.Y, perturbedSpeed.X, perturbedSpeed.Y, ModContent.ProjectileType(), damage / 4, 0f, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position, perturbedSpeed, ModContent.ProjectileType(), damage / 4, 0f, player.whoAmI, 0f, 0f); } return true; } diff --git a/Items/Weapons/Ranged/Goobow.cs b/Items/Weapons/Ranged/Goobow.cs index c3d63b9085..171cd7082e 100644 --- a/Items/Weapons/Ranged/Goobow.cs +++ b/Items/Weapons/Ranged/Goobow.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -63,7 +64,7 @@ namespace CalamityMod.Items.Weapons.Ranged recipe.AddIngredient(ModContent.ItemType(), 18); recipe.AddIngredient(ItemID.Gel, 30); recipe.AddIngredient(ItemID.HellstoneBar, 5); - recipe.AddTile(TileID.Anvils); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Weapons/Ranged/GunkShot.cs b/Items/Weapons/Ranged/GunkShot.cs index f4f5f43a13..0f89a88cb3 100644 --- a/Items/Weapons/Ranged/GunkShot.cs +++ b/Items/Weapons/Ranged/GunkShot.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -57,7 +58,7 @@ namespace CalamityMod.Items.Weapons.Ranged recipe.AddIngredient(ModContent.ItemType(), 18); recipe.AddIngredient(ItemID.Gel, 15); recipe.AddIngredient(ItemID.HellstoneBar, 5); - recipe.AddTile(TileID.Anvils); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Weapons/Ranged/HalibutCannon.cs b/Items/Weapons/Ranged/HalibutCannon.cs index 464f2bcce8..6743f3464a 100644 --- a/Items/Weapons/Ranged/HalibutCannon.cs +++ b/Items/Weapons/Ranged/HalibutCannon.cs @@ -29,28 +29,31 @@ namespace CalamityMod.Items.Weapons.Ranged item.value = Item.buyPrice(1, 0, 0, 0); item.UseSound = SoundID.Item38; item.autoReuse = true; - item.shoot = ProjectileID.PurificationPowder; + item.shoot = ProjectileID.Bullet; item.shootSpeed = 12f; - item.useAmmo = 97; + item.useAmmo = AmmoID.Bullet; } - public override Vector2? HoldoutOffset() - { - return new Vector2(-15, 0); - } + public override Vector2? HoldoutOffset() => new Vector2(-15, 0); + + public override void ModifyWeaponDamage(Player player, ref float add, ref float mult, ref float flat) + { + float damageMult = 0f; + if (Main.hardMode) + damageMult = 1f; + if (NPC.downedMoonlord) + damageMult = 3f; + mult += damageMult; + } 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.hardMode) - { item.damage = 12; } - if (NPC.downedMoonlord) - { item.damage = 24; } - int num6 = Main.rand.Next(25, 36); - for (int index = 0; index < num6; ++index) + int bulletAmt = Main.rand.Next(25, 36); + for (int index = 0; index < bulletAmt; ++index) { float SpeedX = speedX + (float)Main.rand.Next(-10, 11) * 0.05f; float SpeedY = speedY + (float)Main.rand.Next(-10, 11) * 0.05f; - int shot = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + int shot = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); Main.projectile[shot].timeLeft = 180; } return false; diff --git a/Items/Weapons/Ranged/HalleysInferno.cs b/Items/Weapons/Ranged/HalleysInferno.cs index f313f0ea94..d30aae8053 100644 --- a/Items/Weapons/Ranged/HalleysInferno.cs +++ b/Items/Weapons/Ranged/HalleysInferno.cs @@ -8,53 +8,53 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Ranged { - public class HalleysInferno : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Halley's Inferno"); - Tooltip.SetDefault("Halley came sooner than expected\n" + - "Fires a flaming comet\n" + - "50% chance to not consume gel\n" + - "Right click to zoom out"); - } + public class HalleysInferno : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Halley's Inferno"); + Tooltip.SetDefault("Halley came sooner than expected\n" + + "Fires a flaming comet\n" + + "50% chance to not consume gel\n" + + "Right click to zoom out"); + } - public override void SetDefaults() - { - item.damage = 1666; - item.crit += 20; - item.ranged = true; - item.width = 84; - item.height = 34; - item.useTime = 30; - item.useAnimation = 30; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 5f; - item.UseSound = SoundID.Item34; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.PureGreen; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 14.6f; - item.useAmmo = 23; - } + public override void SetDefaults() + { + item.damage = 1666; + item.crit += 20; + item.knockBack = 5f; + item.ranged = true; + item.useTime = item.useAnimation = 30; + item.autoReuse = true; + item.useAmmo = AmmoID.Gel; + item.shootSpeed = 14.6f; + item.shoot = ModContent.ProjectileType(); - public override Vector2? HoldoutOffset() => new Vector2(-15, 0); + item.width = 84; + item.height = 34; + item.useStyle = ItemUseStyleID.HoldingOut; + item.noMelee = true; + item.UseSound = SoundID.Item34; + item.value = Item.buyPrice(1, 40, 0, 0); + item.rare = 10; + item.Calamity().customRarity = CalamityRarity.PureGreen; + } - public override bool ConsumeAmmo(Player player) => Main.rand.Next(100) >= 50; + public override Vector2? HoldoutOffset() => new Vector2(-15, 0); - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddIngredient(ItemID.SniperScope); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override bool ConsumeAmmo(Player player) => Main.rand.Next(100) >= 50; + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 6); + recipe.AddIngredient(ModContent.ItemType(), 4); + recipe.AddIngredient(ModContent.ItemType(), 12); + recipe.AddIngredient(ItemID.SniperScope); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/Ranged/HandheldTank.cs b/Items/Weapons/Ranged/HandheldTank.cs index a06e8e1fab..4d0ebd6e89 100644 --- a/Items/Weapons/Ranged/HandheldTank.cs +++ b/Items/Weapons/Ranged/HandheldTank.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Ranged item.width = 110; item.height = 46; item.ranged = true; - item.damage = 1850; + item.damage = 1000; item.crit += 15; item.knockBack = 16f; item.useTime = 71; diff --git a/Items/Weapons/Ranged/HeavenlyGale.cs b/Items/Weapons/Ranged/HeavenlyGale.cs index e9f0bb684b..9cd820a391 100644 --- a/Items/Weapons/Ranged/HeavenlyGale.cs +++ b/Items/Weapons/Ranged/HeavenlyGale.cs @@ -5,109 +5,105 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; namespace CalamityMod.Items.Weapons.Ranged { - public class HeavenlyGale : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Heavenly Gale"); - Tooltip.SetDefault("Fires a barrage of 5 random exo arrows\n" + - "Green exo arrows explode into a tornado on death\n" + - "Blue exo arrows cause a second group of arrows to fire on enemy hits\n" + - "Orange exo arrows cause explosions on death\n" + - "Teal exo arrows ignore enemy immunity frames\n" + - "66% chance to not consume ammo"); - } + public class HeavenlyGale : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Heavenly Gale"); + Tooltip.SetDefault("Fires a barrage of 5 random exo arrows\n" + + "Green exo arrows explode into a tornado on death\n" + + "Blue exo arrows cause a second group of arrows to fire on enemy hits\n" + + "Orange exo arrows cause explosions on death\n" + + "Teal exo arrows ignore enemy immunity frames\n" + + "66% chance to not consume ammo"); + } - public override void SetDefaults() - { - item.damage = 720; - item.ranged = true; - item.width = 44; - item.height = 58; - item.useTime = 11; - item.useAnimation = 22; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 4f; - item.value = Item.buyPrice(2, 50, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = ProjectileID.WoodenArrowFriendly; - item.shootSpeed = 17f; - item.useAmmo = 40; - item.Calamity().customRarity = CalamityRarity.Violet; - } + public override void SetDefaults() + { + item.damage = 600; + item.ranged = true; + item.width = 44; + item.height = 58; + item.useTime = 11; + item.useAnimation = 22; + item.useStyle = ItemUseStyleID.HoldingOut; + item.noMelee = true; + item.knockBack = 4f; + item.value = Item.buyPrice(2, 50, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item5; + item.autoReuse = true; + item.shoot = ProjectileID.WoodenArrowFriendly; + item.shootSpeed = 17f; + item.useAmmo = AmmoID.Arrow; + item.Calamity().customRarity = CalamityRarity.Violet; + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float dmg = 1f; - float num117 = 0.314159274f; - int num118 = 5; - Vector2 vector7 = new Vector2(speedX, speedY); - vector7.Normalize(); - vector7 *= 40f; - bool flag11 = Collision.CanHit(vector2, 0, 0, vector2 + vector7, 0, 0); - for (int num119 = 0; num119 < num118; num119++) - { - float num120 = (float)num119 - ((float)num118 - 1f) / 2f; - Vector2 value9 = vector7.RotatedBy((double)(num117 * num120), default); - if (!flag11) - { - value9 -= vector7; - } - switch (Main.rand.Next(10)) - { - case 0: - case 1: - case 2: - case 3: - type = ModContent.ProjectileType(); - dmg = 0.16f; - break; - case 4: - case 5: - case 6: - type = ModContent.ProjectileType(); - break; - case 7: - case 8: - type = ModContent.ProjectileType(); - break; - case 9: - type = ModContent.ProjectileType(); - dmg = 0.7f; - break; - } - Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, type, (int)(damage * dmg), knockBack, player.whoAmI, 0.0f, 0.0f); - } - return false; - } + 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 source = player.RotatedRelativePoint(player.MountedCenter, true); + float dmgMult = 1f; + float piOver10 = MathHelper.Pi * 0.1f; + int arrowAmt = 5; + Vector2 speed = new Vector2(speedX, speedY); + speed.Normalize(); + speed *= 40f; + bool canHit = Collision.CanHit(source, 0, 0, source + speed, 0, 0); + for (int i = 0; i < arrowAmt; i++) + { + float offsetAmt = i - (arrowAmt - 1f) / 2f; + Vector2 offset = speed.RotatedBy((double)(piOver10 * offsetAmt), default); + if (!canHit) + { + offset -= speed; + } + int arrow = Utils.SelectRandom(Main.rand, new int[] + { + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType() + }); + if (player.ownedProjectileCounts[ProjectileType()] + player.ownedProjectileCounts[ProjectileType()] > 5) + { + arrow = Utils.SelectRandom(Main.rand, new int[] + { + ProjectileType(), + ProjectileType(), + ProjectileType() + }); + } + if (arrow == ProjectileType()) + dmgMult = 0.5f; + Projectile.NewProjectile(source.X + offset.X, source.Y + offset.Y, speedX, speedY, arrow, (int)(damage * dmgMult), knockBack, player.whoAmI); + } + return false; + } - public override bool ConsumeAmmo(Player player) - { - if (Main.rand.Next(0, 100) < 66) - return false; - return true; - } + public override bool ConsumeAmmo(Player player) + { + if (Main.rand.Next(0, 100) < 66) + return false; + return true; + } - 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()); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemType()); + recipe.AddIngredient(ItemType()); + recipe.AddIngredient(ItemType()); + recipe.AddIngredient(ItemType()); + recipe.AddIngredient(ItemType()); + recipe.AddIngredient(ItemType()); + recipe.AddIngredient(ItemType(), 4); + recipe.AddTile(TileType()); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/Ranged/Interfacer.cs b/Items/Weapons/Ranged/Interfacer.cs index e2ca5b631a..6482e0ce7d 100644 --- a/Items/Weapons/Ranged/Interfacer.cs +++ b/Items/Weapons/Ranged/Interfacer.cs @@ -136,7 +136,7 @@ namespace CalamityMod.Items.Weapons.Ranged { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.LunarBar, 10); + recipe.AddIngredient(ItemID.LunarBar, 5); recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Weapons/Ranged/Leviatitan.png b/Items/Weapons/Ranged/Leviatitan.png index 89fe64b156..4b56fc017d 100644 Binary files a/Items/Weapons/Ranged/Leviatitan.png and b/Items/Weapons/Ranged/Leviatitan.png differ diff --git a/Items/Weapons/Ranged/LunarianBow.cs b/Items/Weapons/Ranged/LunarianBow.cs index 38a62c1498..a5656336c7 100644 --- a/Items/Weapons/Ranged/LunarianBow.cs +++ b/Items/Weapons/Ranged/LunarianBow.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 15; + item.damage = 29; item.ranged = true; item.width = 22; item.height = 62; @@ -46,15 +46,14 @@ namespace CalamityMod.Items.Weapons.Ranged bool flag11 = Collision.CanHit(vector2, 0, 0, vector2 + vector7, 0, 0); for (int num119 = 0; num119 < num118; num119++) { - float num120 = (float)num119 - ((float)num118 - 1f) / 2f; - Vector2 value9 = vector7.RotatedBy((double)(num117 * num120), default); + float num120 = num119 - (num118 - 1f) / 2f; + Vector2 value9 = vector7.RotatedBy(num117 * num120, default); if (!flag11) { value9 -= vector7; } - int num121 = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0.0f, 0.0f); - Main.projectile[num121].noDropItem = true; - } + Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + } return false; } diff --git a/Items/Weapons/Ranged/Megalodon.cs b/Items/Weapons/Ranged/Megalodon.cs index c97ada1a85..7d2f4d9b5e 100644 --- a/Items/Weapons/Ranged/Megalodon.cs +++ b/Items/Weapons/Ranged/Megalodon.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 28; + item.damage = 34; item.ranged = true; item.width = 72; item.height = 32; diff --git a/Items/Weapons/Ranged/Minigun.png b/Items/Weapons/Ranged/Minigun.png index e8b742b354..ecdd97bef4 100644 Binary files a/Items/Weapons/Ranged/Minigun.png and b/Items/Weapons/Ranged/Minigun.png differ diff --git a/Items/Weapons/Ranged/MolecularManipulator.cs b/Items/Weapons/Ranged/MolecularManipulator.cs index c1ca27efe4..2257236e07 100644 --- a/Items/Weapons/Ranged/MolecularManipulator.cs +++ b/Items/Weapons/Ranged/MolecularManipulator.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 700; + item.damage = 890; item.ranged = true; item.width = 60; item.height = 30; diff --git a/Items/Weapons/Ranged/NettlelineGreatbow.cs b/Items/Weapons/Ranged/NettlelineGreatbow.cs index 10efe736e6..b7fc40d441 100644 --- a/Items/Weapons/Ranged/NettlelineGreatbow.cs +++ b/Items/Weapons/Ranged/NettlelineGreatbow.cs @@ -17,12 +17,12 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 120; + item.damage = 115; item.ranged = true; item.width = 36; item.height = 64; - item.useTime = 17; - item.useAnimation = 17; + item.useTime = 18; + item.useAnimation = 18; item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 3f; diff --git a/Items/Weapons/Ranged/Norfleet.png b/Items/Weapons/Ranged/Norfleet.png index c38fd3b142..64cd96565e 100644 Binary files a/Items/Weapons/Ranged/Norfleet.png and b/Items/Weapons/Ranged/Norfleet.png differ diff --git a/Items/Weapons/Ranged/OnyxChainBlaster.png b/Items/Weapons/Ranged/OnyxChainBlaster.png index 638e54bc7d..61625b5b78 100644 Binary files a/Items/Weapons/Ranged/OnyxChainBlaster.png and b/Items/Weapons/Ranged/OnyxChainBlaster.png differ diff --git a/Items/Weapons/Ranged/Onyxia.png b/Items/Weapons/Ranged/Onyxia.png index 4834c9f936..d0f44c3a43 100644 Binary files a/Items/Weapons/Ranged/Onyxia.png and b/Items/Weapons/Ranged/Onyxia.png differ diff --git a/Items/Weapons/Ranged/PristineFury.cs b/Items/Weapons/Ranged/PristineFury.cs index 4976c299d0..d15fb38d28 100644 --- a/Items/Weapons/Ranged/PristineFury.cs +++ b/Items/Weapons/Ranged/PristineFury.cs @@ -1,5 +1,6 @@ using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,7 +9,9 @@ namespace CalamityMod.Items.Weapons.Ranged { public class PristineFury : ModItem { - public static int BaseDamage = 100; + private int frameCounter = 0; + private int frame = 0; + public static int BaseDamage = 140; public override void SetStaticDefaults() { @@ -23,8 +26,8 @@ namespace CalamityMod.Items.Weapons.Ranged { item.damage = BaseDamage; item.ranged = true; - item.width = 88; - item.height = 44; + item.width = 100; + item.height = 46; item.useTime = 3; item.useAnimation = 15; item.useStyle = ItemUseStyleID.HoldingOut; @@ -40,15 +43,9 @@ namespace CalamityMod.Items.Weapons.Ranged item.useAmmo = 23; } - public override Vector2? HoldoutOffset() - { - return new Vector2(-25, -10); - } + public override Vector2? HoldoutOffset() => new Vector2(-25, -10); - public override bool AltFunctionUse(Player player) - { - return true; - } + public override bool AltFunctionUse(Player player) => true; public override bool CanUseItem(Player player) { @@ -83,5 +80,38 @@ namespace CalamityMod.Items.Weapons.Ranged } return false; } + + internal Rectangle GetCurrentFrame(bool frameCounterUp = true) + { + int frameAmt = 4; + if (frameCounter >= 5) + { + frameCounter = -1; + frame = frame == frameAmt - 1 ? 0 : frame + 1; + } + if (frameCounterUp) + frameCounter++; + return new Rectangle(0, item.height * frame, item.width, item.height); + } + + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Ranged/PristineFury_Animated"); + spriteBatch.Draw(texture, position, GetCurrentFrame(), Color.White, 0f, origin, scale, SpriteEffects.None, 0); + return false; + } + + public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) + { + Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Ranged/PristineFury_Animated"); + spriteBatch.Draw(texture, item.position - Main.screenPosition, GetCurrentFrame(), lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + return false; + } + + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Ranged/PristineFuryGlow"); + spriteBatch.Draw(texture, item.position - Main.screenPosition, GetCurrentFrame(false), Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + } } } diff --git a/Items/Weapons/Ranged/PristineFuryGlow.png b/Items/Weapons/Ranged/PristineFuryGlow.png new file mode 100644 index 0000000000..d7e2dd7ea1 Binary files /dev/null and b/Items/Weapons/Ranged/PristineFuryGlow.png differ diff --git a/Items/Weapons/Ranged/PristineFury_Animated.png b/Items/Weapons/Ranged/PristineFury_Animated.png new file mode 100644 index 0000000000..f1e9271516 Binary files /dev/null and b/Items/Weapons/Ranged/PristineFury_Animated.png differ diff --git a/Items/Weapons/Ranged/Pumpler.cs b/Items/Weapons/Ranged/Pumpler.cs index 1ef6a68d5a..021cd8b2a9 100644 --- a/Items/Weapons/Ranged/Pumpler.cs +++ b/Items/Weapons/Ranged/Pumpler.cs @@ -48,19 +48,22 @@ namespace CalamityMod.Items.Weapons.Ranged { if (player.altFunctionUse == 2) { - item.useTime = 36; - item.useAnimation = 36; item.shootSpeed = 4f; } else { - item.useTime = 10; - item.useAnimation = 10; item.shootSpeed = 11f; } return base.CanUseItem(player); } + public override float UseTimeMultiplier (Player player) + { + if (player.altFunctionUse == 2) + return (5f/18f); + return 1f; + } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { if (player.altFunctionUse == 2) diff --git a/Items/Weapons/Ranged/Scorpion.cs b/Items/Weapons/Ranged/Scorpion.cs index 7febcd2dcb..ba3eb73002 100644 --- a/Items/Weapons/Ranged/Scorpion.cs +++ b/Items/Weapons/Ranged/Scorpion.cs @@ -21,8 +21,7 @@ namespace CalamityMod.Items.Weapons.Ranged item.ranged = true; item.width = 58; item.height = 26; - item.useTime = 14; - item.useAnimation = 14; + item.useTime = item.useAnimation = 13; item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 6.5f; @@ -47,24 +46,21 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool CanUseItem(Player player) { - if (player.altFunctionUse == 2) - { - item.useTime = 42; - item.useAnimation = 42; - } - else - { - item.useTime = 13; - item.useAnimation = 13; - } return base.CanUseItem(player); } + public override float UseTimeMultiplier (Player player) + { + if (player.altFunctionUse == 2) + return (13f/42f); + return 1f; + } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { if (player.altFunctionUse == 2) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), (int)((double)damage * 2.2999), knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), (int)(damage * 2.2999), knockBack, player.whoAmI, 0f, 0f); return false; } else diff --git a/Items/Weapons/Ranged/SparkSpreader.cs b/Items/Weapons/Ranged/SparkSpreader.cs index 5b9e319afc..449eae6502 100644 --- a/Items/Weapons/Ranged/SparkSpreader.cs +++ b/Items/Weapons/Ranged/SparkSpreader.cs @@ -6,55 +6,48 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Ranged { - public class SparkSpreader : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spark Spreader"); - Tooltip.SetDefault("20% chance to not consume gel"); - } + public class SparkSpreader : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spark Spreader"); + Tooltip.SetDefault("20% chance to not consume gel"); + } - public override void SetDefaults() - { - item.damage = 7; - item.ranged = true; - item.width = 52; - item.height = 20; - item.useTime = 10; - item.useAnimation = 30; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 1f; - item.UseSound = SoundID.Item34; - item.value = Item.buyPrice(0, 1, 0, 0); - item.rare = 1; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 5f; - item.useAmmo = 23; - } + public override void SetDefaults() + { + item.damage = 7; + item.knockBack = 1f; + item.ranged = true; + item.autoReuse = true; + item.useTime = 10; + item.useAnimation = 30; + item.useAmmo = AmmoID.Gel; + item.shootSpeed = 5f; + item.shoot = ModContent.ProjectileType(); - public override Vector2? HoldoutOffset() - { - return new Vector2(-4, 0); - } + item.width = 52; + item.height = 20; + item.useStyle = ItemUseStyleID.HoldingOut; + item.noMelee = true; + item.UseSound = SoundID.Item34; + item.value = Item.buyPrice(0, 1, 0, 0); + item.rare = 1; + } - public override bool ConsumeAmmo(Player player) - { - if (Main.rand.Next(0, 100) < 20) - return false; - return true; - } + public override Vector2? HoldoutOffset() => new Vector2(-4, 0); - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.FlareGun, 1); - recipe.AddIngredient(ItemID.Ruby, 1); - recipe.AddIngredient(ItemID.Gel, 12); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override bool ConsumeAmmo(Player player) => Main.rand.Next(100) >= 20; + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.FlareGun); + recipe.AddIngredient(ItemID.Ruby); + recipe.AddIngredient(ItemID.Gel, 12); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/Ranged/SpectralstormCannon.png b/Items/Weapons/Ranged/SpectralstormCannon.png index ac0bc7f5e9..2cc36fe326 100644 Binary files a/Items/Weapons/Ranged/SpectralstormCannon.png and b/Items/Weapons/Ranged/SpectralstormCannon.png differ diff --git a/Items/Weapons/Ranged/Spyker.cs b/Items/Weapons/Ranged/Spyker.cs index 63674d439d..834abf780c 100644 --- a/Items/Weapons/Ranged/Spyker.cs +++ b/Items/Weapons/Ranged/Spyker.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 250; + item.damage = 240; item.ranged = true; item.width = 44; item.height = 26; @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Ranged item.autoReuse = true; item.shootSpeed = 9f; item.shoot = ModContent.ProjectileType(); - item.useAmmo = 97; + item.useAmmo = AmmoID.Bullet; item.Calamity().customRarity = CalamityRarity.Turquoise; } diff --git a/Items/Weapons/Ranged/StormDragoon.cs b/Items/Weapons/Ranged/StormDragoon.cs index 9bca0f55a4..0b80a58e10 100644 --- a/Items/Weapons/Ranged/StormDragoon.cs +++ b/Items/Weapons/Ranged/StormDragoon.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 90; + item.damage = 94; item.ranged = true; item.width = 74; item.height = 34; diff --git a/Items/Weapons/Ranged/TheEmpyrean.cs b/Items/Weapons/Ranged/TheEmpyrean.cs index 0df599984b..e0221afb11 100644 --- a/Items/Weapons/Ranged/TheEmpyrean.cs +++ b/Items/Weapons/Ranged/TheEmpyrean.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Weapons.Ranged { public override void SetStaticDefaults() { - DisplayName.SetDefault("The Empyrean"); + DisplayName.SetDefault("God's Bellows"); Tooltip.SetDefault("70% chance to not consume gel"); } diff --git a/Items/Weapons/Ranged/TheEmpyrean.png b/Items/Weapons/Ranged/TheEmpyrean.png index 78910571a1..87df93208a 100644 Binary files a/Items/Weapons/Ranged/TheEmpyrean.png and b/Items/Weapons/Ranged/TheEmpyrean.png differ diff --git a/Items/Weapons/Ranged/TheStorm.cs b/Items/Weapons/Ranged/TheStorm.cs index edda608153..105bce9557 100644 --- a/Items/Weapons/Ranged/TheStorm.cs +++ b/Items/Weapons/Ranged/TheStorm.cs @@ -41,7 +41,6 @@ namespace CalamityMod.Items.Weapons.Ranged { int i = Main.myPlayer; float num72 = Main.rand.Next(25, 30); - int num73 = damage; float num74 = knockBack; num74 = player.GetWeaponKnockback(item, num74); player.itemTime = item.useTime; @@ -88,17 +87,17 @@ namespace CalamityMod.Items.Weapons.Ranged float speedY5 = num79 + (float)Main.rand.Next(-120, 121) * 0.02f; if (type == ProjectileID.WoodenArrowFriendly) { - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5 * 0.9f, ModContent.ProjectileType(), num73, num74, i, 0f, 0f); - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5 * 0.8f, ModContent.ProjectileType(), num73, num74, i, 0f, 0f); - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5 * 0.7f, ModContent.ProjectileType(), num73, num74, i, 0f, 0f); + Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5 * 0.9f, ModContent.ProjectileType(), damage, num74, i, 0f, 0f); + Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5 * 0.8f, ModContent.ProjectileType(), damage, num74, i, 0f, 0f); + Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5 * 0.7f, ModContent.ProjectileType(), damage, num74, i, 0f, 0f); } else { - int num121 = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5 * 0.9f, type, num73, num74, i, 0f, 0f); + int num121 = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5 * 0.9f, type, damage, num74, i, 0f, 0f); Main.projectile[num121].noDropItem = true; - int num122 = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5 * 0.8f, type, num73, num74, i, 0f, 0f); + int num122 = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5 * 0.8f, type, damage, num74, i, 0f, 0f); Main.projectile[num122].noDropItem = true; - int num123 = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5 * 0.7f, type, num73, num74, i, 0f, 0f); + int num123 = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5 * 0.7f, type, damage, num74, i, 0f, 0f); Main.projectile[num123].noDropItem = true; } } diff --git a/Items/Weapons/Ranged/TitaniumRailgun.cs b/Items/Weapons/Ranged/TitaniumRailgun.cs index 117e1ae47c..83d234f9ee 100644 --- a/Items/Weapons/Ranged/TitaniumRailgun.cs +++ b/Items/Weapons/Ranged/TitaniumRailgun.cs @@ -26,12 +26,12 @@ namespace CalamityMod.Items.Weapons.Ranged item.noMelee = true; item.knockBack = 3f; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.UseSound = SoundID.Item72; item.autoReuse = true; item.shootSpeed = 6f; item.shoot = ModContent.ProjectileType(); - item.useAmmo = 97; + item.useAmmo = AmmoID.Bullet; } public override Vector2? HoldoutOffset() @@ -41,7 +41,9 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + Vector2 velocity = Vector2.Normalize(new Vector2(speedX, speedY)); + velocity *= item.shootSpeed; + Projectile.NewProjectile(position, velocity, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); return false; } diff --git a/Items/Weapons/Ranged/Triploon.cs b/Items/Weapons/Ranged/Triploon.cs index 8b931de2b6..ccab6173d2 100644 --- a/Items/Weapons/Ranged/Triploon.cs +++ b/Items/Weapons/Ranged/Triploon.cs @@ -18,12 +18,12 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 80; + item.damage = 75; item.ranged = true; item.width = 46; item.height = 24; - item.useTime = 12; - item.useAnimation = 12; + item.useTime = 16; + item.useAnimation = 16; item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 7.5f; diff --git a/Items/Weapons/Ranged/Ultima.cs b/Items/Weapons/Ranged/Ultima.cs new file mode 100644 index 0000000000..4ac1d21e23 --- /dev/null +++ b/Items/Weapons/Ranged/Ultima.cs @@ -0,0 +1,70 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Ores; +using CalamityMod.Projectiles.Ranged; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Ranged +{ + public class Ultima : ModItem + { + public const float FullChargeTime = 420f; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ultima"); + Tooltip.SetDefault("Casts a continuous stream of plasma bolts\n" + + "Over time the bolts are replaced with powerful lasers\n" + + "Bolts power up into solid beams as you continue shooting\n" + + "90% chance to not consume ammo"); + } + + public override void SetDefaults() + { + item.damage = 119; + item.ranged = true; + item.width = 44; + item.height = 58; + item.useTime = item.useAnimation = 3; + item.useStyle = ItemUseStyleID.HoldingOut; + item.noMelee = true; + item.knockBack = 2f; + item.value = CalamityGlobalItem.RarityVioletBuyPrice; + item.rare = 10; + item.UseSound = SoundID.Item33; + item.autoReuse = true; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 18f; + item.useAmmo = AmmoID.Arrow; + item.channel = true; + item.useTurn = false; + item.autoReuse = true; + item.noUseGraphic = true; + item.Calamity().customRarity = CalamityRarity.Dedicated; + } + + 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).SafeNormalize(Vector2.UnitX * player.direction), ModContent.ProjectileType(), 0, 0f, player.whoAmI); + return false; + } + + public override bool ConsumeAmmo(Player player) => Main.rand.Next(0, 100) >= 90; + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.PulseBow); + recipe.AddIngredient(ItemID.LaserRifle); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddIngredient(ModContent.ItemType(), 15); + recipe.AddIngredient(ModContent.ItemType(), 15); + recipe.AddTile(ModContent.TileType()); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Ranged/Ultima.png b/Items/Weapons/Ranged/Ultima.png new file mode 100644 index 0000000000..bf77665303 Binary files /dev/null and b/Items/Weapons/Ranged/Ultima.png differ diff --git a/Items/Weapons/Ranged/WulfrumBow.cs b/Items/Weapons/Ranged/WulfrumBow.cs index 6462f3e949..0e94240971 100644 --- a/Items/Weapons/Ranged/WulfrumBow.cs +++ b/Items/Weapons/Ranged/WulfrumBow.cs @@ -17,8 +17,8 @@ namespace CalamityMod.Items.Weapons.Ranged { item.damage = 10; item.ranged = true; - item.width = 34; - item.height = 56; + item.width = 27; + item.height = 38; item.useTime = 25; item.useAnimation = 25; item.useStyle = ItemUseStyleID.HoldingOut; diff --git a/Items/Weapons/Ranged/WulfrumBow.png b/Items/Weapons/Ranged/WulfrumBow.png index 3cf54d70b3..ad309cc5e0 100644 Binary files a/Items/Weapons/Ranged/WulfrumBow.png and b/Items/Weapons/Ranged/WulfrumBow.png differ diff --git a/Items/Weapons/Rogue/BallisticPoisonBomb.cs b/Items/Weapons/Rogue/BallisticPoisonBomb.cs index 8753a50292..45d20c00b4 100644 --- a/Items/Weapons/Rogue/BallisticPoisonBomb.cs +++ b/Items/Weapons/Rogue/BallisticPoisonBomb.cs @@ -20,12 +20,12 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { item.width = 30; - item.damage = 55; + item.damage = 50; item.noMelee = true; item.noUseGraphic = true; - item.useAnimation = 22; + item.useAnimation = 26; item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 22; + item.useTime = 26; item.knockBack = 6.5f; item.UseSound = SoundID.Item1; item.autoReuse = true; diff --git a/Items/Weapons/Rogue/BloodsoakedCrasher.cs b/Items/Weapons/Rogue/BloodsoakedCrasher.cs index fc756358c2..55c542f890 100644 --- a/Items/Weapons/Rogue/BloodsoakedCrasher.cs +++ b/Items/Weapons/Rogue/BloodsoakedCrasher.cs @@ -7,56 +7,52 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class BloodsoakedCrasher : RogueWeapon //This weapon has been coded by Achilles|Termi|Ben + public class BloodsoakedCrasher : RogueWeapon //This weapon has been coded by Ben || Termi { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bloodsoaked Crasher"); - Tooltip.SetDefault("Slows down when hitting an enemy. Speeds up otherwise\n" + - "Heals on enemy hits\n" + - "Stealth strikes spawn homing blood on enemy hits"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bloodsoaked Crasher"); + Tooltip.SetDefault("Slows down when hitting an enemy. Speeds up otherwise\n" + + "Heals on enemy hits\n" + + "Stealth strikes spawn homing blood on enemy hits"); + } - public override void SafeSetDefaults() - { - item.width = 66; - item.damage = 300; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 18; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 18; - item.knockBack = 3f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 64; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.PureGreen; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 15f; - item.Calamity().rogue = true; - } + public override void SafeSetDefaults() + { + item.damage = 300; + item.knockBack = 3f; + item.autoReuse = true; + item.Calamity().rogue = true; + item.useAnimation = item.useTime = 18; + item.shootSpeed = 15f; + 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.Calamity().StealthStrikeAvailable()) //setting the stealth strike - { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 1f); - Main.projectile[stealth].Calamity().stealthStrike = true; - return false; - } - return true; - } + item.width = 66; + item.height = 64; + item.noMelee = true; + item.noUseGraphic = true; + item.useStyle = ItemUseStyleID.SwingThrow; + item.UseSound = SoundID.Item1; + item.value = Item.buyPrice(1, 40, 0, 0); + item.rare = 10; + item.Calamity().customRarity = CalamityRarity.PureGreen; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); //post-Prov rogue weapon - recipe.AddIngredient(ModContent.ItemType(), 1); - recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); //setting the stealth strike + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); //post-Prov rogue weapon + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType(), 12); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/Rogue/BrackishFlask.png b/Items/Weapons/Rogue/BrackishFlask.png index c0101e465c..0e5ad78a57 100644 Binary files a/Items/Weapons/Rogue/BrackishFlask.png and b/Items/Weapons/Rogue/BrackishFlask.png differ diff --git a/Items/Weapons/Rogue/Brimblade.png b/Items/Weapons/Rogue/Brimblade.png index d7de00d24b..0d93160ef8 100644 Binary files a/Items/Weapons/Rogue/Brimblade.png and b/Items/Weapons/Rogue/Brimblade.png differ diff --git a/Items/Weapons/Rogue/Celestus.cs b/Items/Weapons/Rogue/Celestus.cs index 75c4160d02..4db6dd2104 100644 --- a/Items/Weapons/Rogue/Celestus.cs +++ b/Items/Weapons/Rogue/Celestus.cs @@ -11,6 +11,7 @@ namespace CalamityMod.Items.Weapons.Rogue public class Celestus : RogueWeapon { private int counter = 0; + private bool stealthScythes = false; public override void SetStaticDefaults() { @@ -42,21 +43,26 @@ namespace CalamityMod.Items.Weapons.Rogue public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - counter++; - if (counter >= 3) - counter = 0; - if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage / 2, knockBack, player.whoAmI, 0f, 1f); - Main.projectile[stealth].Calamity().stealthStrike = true; - return false; - } - else if (counter == 1 || counter == 2) - { - return false; + stealthScythes = true; } - return true; + if (stealthScythes) + { + int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage / 2, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[stealth].Calamity().stealthStrike = true; + } + else if (counter == 0) + { + Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); + } + counter++; + if (counter >= 3) + { + stealthScythes = false; + counter = 0; + } + return false; } public override void AddRecipes() diff --git a/Items/Weapons/Rogue/CosmicKunai.cs b/Items/Weapons/Rogue/CosmicKunai.cs index 2f0e296443..d1bf2b054d 100644 --- a/Items/Weapons/Rogue/CosmicKunai.cs +++ b/Items/Weapons/Rogue/CosmicKunai.cs @@ -7,9 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { public class CosmicKunai : RogueWeapon - - - { + { public override void SetStaticDefaults() { DisplayName.SetDefault("Cosmic Kunai"); diff --git a/Items/Weapons/Rogue/EclipsesFall.cs b/Items/Weapons/Rogue/EclipsesFall.cs index 50ab8f9f39..8afad26224 100644 --- a/Items/Weapons/Rogue/EclipsesFall.cs +++ b/Items/Weapons/Rogue/EclipsesFall.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; +using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -7,60 +8,56 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class EclipsesFall : RogueWeapon - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Eclipse's Fall"); - Tooltip.SetDefault("When the sun goes dark, you will know judgment\n" + - "Summons spears from the sky on hit\n" + - "Stealth strikes impale enemies and summon a constant barrage of spears over time"); - } + public class EclipsesFall : RogueWeapon + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Eclipse's Fall"); + Tooltip.SetDefault("When the sun goes dark, you will know judgment\n" + + "Summons spears from the sky on hit\n" + + "Stealth strikes impale enemies and summon a constant barrage of spears over time"); + } - public override void SafeSetDefaults() - { - item.width = 72; - item.damage = 1060; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 21; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 21; - item.knockBack = 3.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 72; - item.value = Item.buyPrice(2, 50, 0, 0); - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.Violet; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 15f; - item.Calamity().rogue = true; - } + public override void SafeSetDefaults() + { + item.damage = 1060; + item.knockBack = 3.5f; + item.useAnimation = item.useTime = 21; + item.autoReuse = true; + item.Calamity().rogue = true; + item.shootSpeed = 15f; + 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.Calamity().StealthStrikeAvailable()) - { - int p = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[p].Calamity().stealthStrike = true; - } - else - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - } - return false; - } + item.useStyle = ItemUseStyleID.SwingThrow; + item.width = item.height = 72; + item.noMelee = true; + item.noUseGraphic = true; + item.UseSound = SoundID.Item1; + item.value = Item.buyPrice(2, 50, 0, 0); + item.rare = 10; + item.Calamity().customRarity = CalamityRarity.Violet; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 1); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (player.Calamity().StealthStrikeAvailable()) + { + type = ModContent.ProjectileType(); + } + int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType(), 15); + recipe.AddIngredient(ModContent.ItemType(), 6); + recipe.AddTile(ModContent.TileType()); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/Rogue/EmpyreanKnivesThrown.cs b/Items/Weapons/Rogue/EmpyreanKnivesThrown.cs index 9a3ad6e804..518361349f 100644 --- a/Items/Weapons/Rogue/EmpyreanKnivesThrown.cs +++ b/Items/Weapons/Rogue/EmpyreanKnivesThrown.cs @@ -1,5 +1,4 @@ using CalamityMod.Items.Materials; -using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Projectiles.Hybrid; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; @@ -106,7 +105,7 @@ namespace CalamityMod.Items.Weapons.Rogue recipe.AddIngredient(ItemID.VampireKnives); recipe.AddIngredient(ModContent.ItemType(), 10); recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType(), 999); recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Weapons/Rogue/FinalDawn.cs b/Items/Weapons/Rogue/FinalDawn.cs index 1b05b1c4e2..15c1c17a54 100644 --- a/Items/Weapons/Rogue/FinalDawn.cs +++ b/Items/Weapons/Rogue/FinalDawn.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Weapons.Rogue Tooltip.SetDefault("We shall ride into the sunrise once more\n" + "Attack enemies with a giant scythe swing to replenish stealth\n" + "Press up and attack to throw the scythe \n" + - "Stealth strikes perform a vertical swing that leaves a lingering fire aura\n" + + "Stealth strikes perform a horizontal swing that leaves a lingering fire aura\n" + "Stealth strikes performed while pressing up fling yourself at the enemy and slice through them, causing homing fireballs to emerge"); } public override void SafeSetDefaults() diff --git a/Items/Weapons/Rogue/FlameScythe.cs b/Items/Weapons/Rogue/FlameScythe.cs index d56eeac022..d301f2742d 100644 --- a/Items/Weapons/Rogue/FlameScythe.cs +++ b/Items/Weapons/Rogue/FlameScythe.cs @@ -24,8 +24,8 @@ namespace CalamityMod.Items.Weapons.Rogue item.noUseGraphic = true; item.autoReuse = true; item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 21; - item.useAnimation = 21; + item.useTime = 20; + item.useAnimation = 20; item.knockBack = 8.5f; item.UseSound = SoundID.Item1; item.value = Item.buyPrice(gold: 80); diff --git a/Items/Weapons/Rogue/HardenedHoneycomb.cs b/Items/Weapons/Rogue/HardenedHoneycomb.cs index 33c9bf8f2e..1838cbd016 100644 --- a/Items/Weapons/Rogue/HardenedHoneycomb.cs +++ b/Items/Weapons/Rogue/HardenedHoneycomb.cs @@ -57,7 +57,7 @@ Stealth strikes can bounce off walls and enemies"); recipe.AddIngredient(ItemID.CrispyHoneyBlock); recipe.AddIngredient(ItemID.BeeWax); recipe.AddTile(TileID.Anvils); - recipe.SetResult(this, 5); + recipe.SetResult(this, 10); recipe.AddRecipe(); } } diff --git a/Items/Weapons/Rogue/Hypothermia.cs b/Items/Weapons/Rogue/Hypothermia.cs index 889e1246ea..75a1075f72 100644 --- a/Items/Weapons/Rogue/Hypothermia.cs +++ b/Items/Weapons/Rogue/Hypothermia.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Weapons.Rogue public class Hypothermia : RogueWeapon { private int counter = 0; - private bool justStealthStriked = false; + private bool stealthChunks = false; public override void SetStaticDefaults() { @@ -46,38 +46,31 @@ namespace CalamityMod.Items.Weapons.Rogue public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - counter++; - if (counter >= 7) - counter = 0; - - if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike + if (player.Calamity().StealthStrikeAvailable()) //setting up the stealth strikes + { + stealthChunks = true; + } + if (stealthChunks) { int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); Main.projectile[stealth].Calamity().stealthStrike = true; - justStealthStriked = true; - return false; } - if (justStealthStriked == true) //this is Ben, no I don't know how what I did translates to what happened in game but we're rolling with it - { - if (counter == 1 || counter == 2 || counter == 3 || counter == 4 || counter == 5 || counter == 6) - { - if (counter == 6) - { - justStealthStriked = false; - } - return false; - } - } else { - int num6 = Main.rand.Next(1, 3); - for (int index = 0; index < num6; ++index) + int projAmt = Main.rand.Next(1, 3); + for (int index = 0; index < projAmt; ++index) { float SpeedX = speedX + (float)Main.rand.Next(-40, 41) * 0.05f; float SpeedY = speedY + (float)Main.rand.Next(-40, 41) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, Main.rand.Next(4), 0f); } - } + } + counter++; + if (counter >= 7) + { + counter = 0; + stealthChunks = false; + } return false; } diff --git a/Items/Weapons/Rogue/KelvinCatalyst.png b/Items/Weapons/Rogue/KelvinCatalyst.png index 1d6c440160..86a074d801 100644 Binary files a/Items/Weapons/Rogue/KelvinCatalyst.png and b/Items/Weapons/Rogue/KelvinCatalyst.png differ diff --git a/Items/Weapons/Rogue/LeonidProgenitor.cs b/Items/Weapons/Rogue/LeonidProgenitor.cs index 3155da29e8..fa62e10005 100644 --- a/Items/Weapons/Rogue/LeonidProgenitor.cs +++ b/Items/Weapons/Rogue/LeonidProgenitor.cs @@ -48,19 +48,24 @@ namespace CalamityMod.Items.Weapons.Rogue { if (player.Calamity().StealthStrikeAvailable() || player.altFunctionUse != 2) { - item.useTime = item.useAnimation = 15; item.UseSound = SoundID.Item61; item.shoot = ModContent.ProjectileType(); } else { - item.useTime = item.useAnimation = 20; item.UseSound = SoundID.Item88; item.shoot = ModContent.ProjectileType(); } return base.CanUseItem(player); } + public override float UseTimeMultiplier (Player player) + { + if (player.Calamity().StealthStrikeAvailable() || player.altFunctionUse != 2) + return 1f; + return 0.75f; + } + 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.Calamity().StealthStrikeAvailable() || player.altFunctionUse != 2) diff --git a/Items/Weapons/Rogue/Lionfish.png b/Items/Weapons/Rogue/Lionfish.png index 56025eca70..e97c12862e 100644 Binary files a/Items/Weapons/Rogue/Lionfish.png and b/Items/Weapons/Rogue/Lionfish.png differ diff --git a/Items/Weapons/Rogue/Malachite.cs b/Items/Weapons/Rogue/Malachite.cs index f4094c5815..9cf65f1c0e 100644 --- a/Items/Weapons/Rogue/Malachite.cs +++ b/Items/Weapons/Rogue/Malachite.cs @@ -24,8 +24,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.damage = 62; item.noMelee = true; item.noUseGraphic = true; - item.useTime = 10; - item.useAnimation = 10; + item.useTime = item.useAnimation = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.knockBack = 1.25f; item.UseSound = SoundID.Item1; @@ -45,25 +44,29 @@ namespace CalamityMod.Items.Weapons.Rogue { if (player.Calamity().StealthStrikeAvailable()) { - item.useTime = item.useAnimation = 10; item.UseSound = SoundID.Item109; item.shoot = ModContent.ProjectileType(); } else if (player.altFunctionUse == 2) { - item.useTime = item.useAnimation = 10; item.UseSound = SoundID.Item109; item.shoot = ModContent.ProjectileType(); } else { - item.useTime = item.useAnimation = 5; item.UseSound = SoundID.Item1; item.shoot = ModContent.ProjectileType(); } return base.CanUseItem(player); } + public override float UseTimeMultiplier (Player player) + { + if (player.Calamity().StealthStrikeAvailable() || player.altFunctionUse == 2) + return 1f; + return 2f; + } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { float dmgMult = 1f; diff --git a/Items/Weapons/Rogue/Prismalline.cs b/Items/Weapons/Rogue/Prismalline.cs index bb0c0bbc19..81ff9d8208 100644 --- a/Items/Weapons/Rogue/Prismalline.cs +++ b/Items/Weapons/Rogue/Prismalline.cs @@ -24,9 +24,9 @@ namespace CalamityMod.Items.Weapons.Rogue item.crit += 4; item.noMelee = true; item.noUseGraphic = true; - item.useAnimation = 14; + item.useAnimation = 16; item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 14; + item.useTime = 16; item.knockBack = 5f; item.UseSound = SoundID.Item1; item.autoReuse = true; diff --git a/Items/Weapons/Rogue/Pwnagehammer.cs b/Items/Weapons/Rogue/Pwnagehammer.cs index c3a55d46f6..c28f22cfaf 100644 --- a/Items/Weapons/Rogue/Pwnagehammer.cs +++ b/Items/Weapons/Rogue/Pwnagehammer.cs @@ -11,32 +11,40 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Pwnagehammer"); - Tooltip.SetDefault("Throws an extremely fast hammer"); + Tooltip.SetDefault("Throws a heavy, gravity-affected hammer that creates a loud blast of hallowed energy when it hits something\n" + + "There is a 20 percent chance for the hammer to home in on a target\n" + + "Homing hammers summon an additional spectral hammer on hit and are guaranteed to land a critical hit"); } public override void SafeSetDefaults() { item.width = 68; - item.damage = 90; + item.damage = 210; + item.crit = 10; item.noMelee = true; item.noUseGraphic = true; item.autoReuse = true; - item.useAnimation = 15; + item.useAnimation = item.useTime = 48; item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 15; item.knockBack = 10f; item.UseSound = SoundID.Item1; + item.Calamity().rogue = true; item.height = 68; item.value = Item.buyPrice(0, 48, 0, 0); item.rare = 6; item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; - item.Calamity().rogue = true; + item.shootSpeed = 24.4f; } 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 proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + Vector2 speed = new Vector2(speedX, speedY); + Vector2 yeetOffset = Vector2.Normalize(speed) * 40f; + if (Collision.CanHit(position, 0, 0, position + yeetOffset, 0, 0)) + { + position += yeetOffset; + } + int proj = Projectile.NewProjectile(position, speed, type, damage, knockBack, player.whoAmI, Main.rand.NextBool(5) ? 1f : 0f); Main.projectile[proj].Calamity().forceRogue = true; Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); return false; diff --git a/Items/Weapons/Rogue/RogueWeapon.cs b/Items/Weapons/Rogue/RogueWeapon.cs index e0bcb51f9a..c2fffcc0a7 100644 --- a/Items/Weapons/Rogue/RogueWeapon.cs +++ b/Items/Weapons/Rogue/RogueWeapon.cs @@ -1,22 +1,19 @@ -using CalamityMod.Items; using System; using System.Collections.Generic; -using System.IO; using System.Linq; using Terraria; -using Terraria.DataStructures; using Terraria.ModLoader; -using Terraria.ModLoader.IO; using Terraria.Utilities; + namespace CalamityMod.Items.Weapons.Rogue { - public abstract class RogueWeapon : ModItem - { - public virtual void SafeSetDefaults() - { - } + public abstract class RogueWeapon : ModItem + { + public virtual void SafeSetDefaults() + { + } - public float StealthStrikeDamage; + public float StealthStrikeDamage; public RogueWeapon() { @@ -58,56 +55,58 @@ namespace CalamityMod.Items.Weapons.Rogue return true; } - public sealed override void SetDefaults() - { - SafeSetDefaults(); - item.melee = false; - item.ranged = false; - item.magic = false; - item.thrown = true; - item.summon = false; - } + public sealed override void SetDefaults() + { + SafeSetDefaults(); + item.melee = false; + item.ranged = false; + item.magic = false; + item.thrown = true; + item.summon = false; + } - // Simply add the player's dedicated rogue damage. - // Rogue weapons are internally throwing so they already benefit from throwing damage boosts. - // 5E-06 to prevent downrounding is not needed anymore, added by TML itself - public override void ModifyWeaponDamage(Player player, ref float add, ref float mult, ref float flat) - { - add += player.Calamity().throwingDamage - 1f; + // Simply add the player's dedicated rogue damage. + // Rogue weapons are internally throwing so they already benefit from throwing damage boosts. + // 5E-06 to prevent downrounding is not needed anymore, added by TML itself + public override void ModifyWeaponDamage(Player player, ref float add, ref float mult, ref float flat) + { + add += player.Calamity().throwingDamage - 1f; //Boost (or lower) the weapon's damage if it has a stealth strike available and an associated prefix if (player.Calamity().StealthStrikeAvailable() && item.prefix > 0) { mult += StealthStrikeDamage - 1f; } - } + } - // Simply add the player's dedicated rogue crit chance. - // Rogue crit isn't boosted by Calamity universal crit boosts, so this won't double-add universal crit. - public override void GetWeaponCrit(Player player, ref int crit) - { - crit += player.Calamity().throwingCrit; - } + // Simply add the player's dedicated rogue crit chance. + // Rogue crit isn't boosted by Calamity universal crit boosts, so this won't double-add universal crit. + public override void GetWeaponCrit(Player player, ref int crit) + { + crit += player.Calamity().throwingCrit; + } - public override float UseTimeMultiplier(Player player) - { - float rogueAS = 1f; - if (player.Calamity().gloveOfPrecision) - rogueAS -= 0.2f; - if (player.Calamity().gloveOfRecklessness) - rogueAS += 0.2f; - return rogueAS; - } + public override float UseTimeMultiplier(Player player) + { + float rogueAS = 1f; + if (player.Calamity().gloveOfPrecision) + rogueAS -= 0.2f; + if (player.Calamity().gloveOfRecklessness) + rogueAS += 0.2f; + if (player.Calamity().titanHeartMantle) + rogueAS -= 0.15f; + return rogueAS; + } - public override void ModifyTooltips(List tooltips) - { - TooltipLine tt = tooltips.FirstOrDefault(x => x.Name == "Damage" && x.mod == "Terraria"); - if (tt != null) - { - string[] splitText = tt.text.Split(' '); - string damageValue = splitText.First(); - string damageWord = splitText.Last(); - tt.text = damageValue + " rogue " + damageWord; - } + public override void ModifyTooltips(List tooltips) + { + TooltipLine tt = tooltips.FirstOrDefault(x => x.Name == "Damage" && x.mod == "Terraria"); + if (tt != null) + { + string[] splitText = tt.text.Split(' '); + string damageValue = splitText.First(); + string damageWord = splitText.Last(); + tt.text = damageValue + " rogue " + damageWord; + } if (item.prefix > 0) { float ssDmgBoost = StealthStrikeDamage - 1f; @@ -129,26 +128,31 @@ namespace CalamityMod.Items.Weapons.Rogue tooltips.Add(StealthBonus); } } - } + } - public override bool ConsumeItem(Player player) - { - if (player.Calamity().throwingAmmoCost50) - { - if (Main.rand.Next(1, 101) > 50) - return false; - } - if (player.Calamity().throwingAmmoCost66) - { - if (Main.rand.Next(1, 101) > 66) - return false; - } - if (player.Calamity().throwingAmmoCost75) - { - if (Main.rand.Next(1, 101) > 75) - return false; - } - return true; - } - } + public override bool ConsumeItem(Player player) + { + if (player.Calamity().throwingAmmoCost50) + { + if (Main.rand.Next(1, 101) > 50) + return false; + } + if (player.Calamity().throwingAmmoCost55) + { + if (Main.rand.Next(1, 101) > 55) + return false; + } + if (player.Calamity().throwingAmmoCost66) + { + if (Main.rand.Next(1, 101) > 66) + return false; + } + if (player.Calamity().throwingAmmoCost75) + { + if (Main.rand.Next(1, 101) > 75) + return false; + } + return true; + } + } } diff --git a/Items/Weapons/Rogue/StarofDestruction.cs b/Items/Weapons/Rogue/StarofDestruction.cs index 98ac50f628..fb30175d44 100644 --- a/Items/Weapons/Rogue/StarofDestruction.cs +++ b/Items/Weapons/Rogue/StarofDestruction.cs @@ -19,8 +19,8 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 86; - item.damage = 175; + item.width = item.height = 94; + item.damage = 150; item.noMelee = true; item.noUseGraphic = true; item.useAnimation = 38; @@ -29,7 +29,6 @@ namespace CalamityMod.Items.Weapons.Rogue item.knockBack = 10f; item.UseSound = SoundID.Item1; item.autoReuse = true; - item.height = 86; item.value = Item.buyPrice(0, 95, 0, 0); item.rare = 9; item.shoot = ModContent.ProjectileType(); @@ -52,7 +51,6 @@ namespace CalamityMod.Items.Weapons.Rogue { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 30); recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Weapons/Rogue/StarofDestruction.png b/Items/Weapons/Rogue/StarofDestruction.png index 732056dac4..46c3428789 100644 Binary files a/Items/Weapons/Rogue/StarofDestruction.png and b/Items/Weapons/Rogue/StarofDestruction.png differ diff --git a/Items/Weapons/Rogue/StellarContemptRogue.cs b/Items/Weapons/Rogue/StellarContemptRogue.cs index 2e4725eb2f..711828c154 100644 --- a/Items/Weapons/Rogue/StellarContemptRogue.cs +++ b/Items/Weapons/Rogue/StellarContemptRogue.cs @@ -54,7 +54,7 @@ namespace CalamityMod.Items.Weapons.Rogue ModRecipe r = new ModRecipe(mod); r.SetResult(this); r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ItemID.LunarBar, 10); + r.AddIngredient(ItemID.LunarBar, 5); r.AddIngredient(ItemID.FragmentSolar, 10); r.AddIngredient(ItemID.FragmentNebula, 10); r.AddTile(TileID.LunarCraftingStation); diff --git a/Items/Weapons/Rogue/StellarKnife.cs b/Items/Weapons/Rogue/StellarKnife.cs index 1dce4dda87..ca67e08474 100644 --- a/Items/Weapons/Rogue/StellarKnife.cs +++ b/Items/Weapons/Rogue/StellarKnife.cs @@ -47,7 +47,7 @@ namespace CalamityMod.Items.Weapons.Rogue { speedX *= 0.9f; Vector2 perturbedspeed = new Vector2(speedX, speedY + Main.rand.Next(-3, 4)).RotatedBy(MathHelper.ToRadians(spread)); - Projectile.NewProjectile(position, perturbedspeed, type, damage, knockBack, player.whoAmI, 1f, i %5 == 0 ? 1f : 0f); + Projectile.NewProjectile(position, perturbedspeed, type, damage, knockBack, player.whoAmI, 1f, i % 5 == 0 ? 1f : 0f); spread -= Main.rand.Next(1, 3); } return false; diff --git a/Items/Weapons/Rogue/ToxicantTwister.cs b/Items/Weapons/Rogue/ToxicantTwister.cs index 2f3309268c..46c497b84d 100644 --- a/Items/Weapons/Rogue/ToxicantTwister.cs +++ b/Items/Weapons/Rogue/ToxicantTwister.cs @@ -8,12 +8,13 @@ namespace CalamityMod.Items.Weapons.Rogue { public class ToxicantTwister : RogueWeapon { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Toxicant Twister"); - Tooltip.SetDefault("Throws a speedy, homing boomerang\n" + - "Stealth strikes fire two boomerangs that go much faster and release sand rapidly"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Toxicant Twister"); + Tooltip.SetDefault("Throws a slow moving boomerang\n" + + "After a few moments, the boomerang chooses a target and rapidly homes in\n" + + "Stealth strikes home in faster and rapidly release sand"); + } public override void SafeSetDefaults() { @@ -37,28 +38,8 @@ namespace CalamityMod.Items.Weapons.Rogue 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.Calamity().StealthStrikeAvailable()) - { - float SpeedX = speedX + (float)Main.rand.Next(-20, 21) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-20, 21) * 0.05f; - int stealth = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[stealth].Calamity().stealthStrike = true; - Main.projectile[stealth].velocity *= 1.5f; - Main.projectile[stealth].timeLeft = 420; - Main.projectile[stealth].penetrate = -1; - Main.projectile[stealth].localNPCHitCooldown = 6; - - float SpeedX2 = speedX + (float)Main.rand.Next(-20, 21) * 0.05f; - float SpeedY2 = speedY + (float)Main.rand.Next(-20, 21) * 0.05f; - int stealth2 = Projectile.NewProjectile(position.X, position.Y, SpeedX2, SpeedY2, type, (int)(damage * 0.6f), knockBack, player.whoAmI, 0f, 0f); - Main.projectile[stealth2].Calamity().stealthStrike = true; - Main.projectile[stealth2].penetrate += 2; - Main.projectile[stealth2].localNPCHitCooldown = 8; - } - else - { - Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); - } + int boomer = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[boomer].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); return false; } } diff --git a/Items/Weapons/Rogue/UtensilPoker.cs b/Items/Weapons/Rogue/UtensilPoker.cs index 700cb0d61e..8b3b8241ab 100644 --- a/Items/Weapons/Rogue/UtensilPoker.cs +++ b/Items/Weapons/Rogue/UtensilPoker.cs @@ -8,13 +8,14 @@ namespace CalamityMod.Items.Weapons.Rogue { public class UtensilPoker : RogueWeapon { + private int counter = 0; public override void SetStaticDefaults() { DisplayName.SetDefault("Utensil Poker"); - Tooltip.SetDefault("Fires random utensils in bursts of three\n" + + Tooltip.SetDefault("Space chickens, that is all.\n" + + "Fires random utensils in bursts of three\n" + "Grants Well Fed on enemy hits\n" + - "Stealth strikes launch an additional butcher knife\n" + - "'Space chickens, that is all.'"); + "Stealth strikes launch an additional butcher knife"); } public override void SafeSetDefaults() @@ -41,9 +42,9 @@ namespace CalamityMod.Items.Weapons.Rogue 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.Calamity().StealthStrikeAvailable()) + if (player.Calamity().StealthStrikeAvailable() && counter == 0) { - int stealth = Projectile.NewProjectile(position.X, position.Y, speedX * 1.2f, speedY * 1.2f, ModContent.ProjectileType(), (int)(damage * 1.4), knockBack, Main.myPlayer); + int stealth = Projectile.NewProjectile(position.X, position.Y, speedX * 1.2f, speedY * 1.2f, ModContent.ProjectileType(), (int)(damage * 1.4), knockBack, player.whoAmI); Main.projectile[stealth].Calamity().stealthStrike = true; } int utensil = item.shoot; @@ -69,7 +70,11 @@ namespace CalamityMod.Items.Weapons.Rogue default: break; } - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, utensil, (int)(damage * dmgMult), knockBack * kbMult, Main.myPlayer); + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, utensil, (int)(damage * dmgMult), knockBack * kbMult, player.whoAmI); + + counter++; + if (counter >= 3) + counter = 0; return false; } } diff --git a/Items/Weapons/Rogue/WulfrumKnife.png b/Items/Weapons/Rogue/WulfrumKnife.png index aab1bf448c..94ca6dcea6 100644 Binary files a/Items/Weapons/Rogue/WulfrumKnife.png and b/Items/Weapons/Rogue/WulfrumKnife.png differ diff --git a/Items/Weapons/Rogue/XerocPitchfork.cs b/Items/Weapons/Rogue/XerocPitchfork.cs index a395ed989f..86bd16da89 100644 --- a/Items/Weapons/Rogue/XerocPitchfork.cs +++ b/Items/Weapons/Rogue/XerocPitchfork.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Weapons.Rogue { public override void SetStaticDefaults() { - DisplayName.SetDefault("Xeroc Pitchfork"); + DisplayName.SetDefault("Shard of Antumbra"); Tooltip.SetDefault("Stealth strikes leave homing stars in their wake"); } @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.maxStack = 999; item.value = 10000; item.rare = 9; - item.shoot = ModContent.ProjectileType(); + item.shoot = ModContent.ProjectileType(); item.shootSpeed = 16f; item.Calamity().rogue = true; } @@ -41,11 +41,10 @@ namespace CalamityMod.Items.Weapons.Rogue { if (player.Calamity().StealthStrikeAvailable()) { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); + int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); Main.projectile[stealth].Calamity().stealthStrike = true; - return false; } - return true; + return !player.Calamity().StealthStrikeAvailable(); } public override void AddRecipes() diff --git a/Items/Weapons/Rogue/XerocPitchfork.png b/Items/Weapons/Rogue/XerocPitchfork.png index 6b1f401a25..37d3d40f62 100644 Binary files a/Items/Weapons/Rogue/XerocPitchfork.png and b/Items/Weapons/Rogue/XerocPitchfork.png differ diff --git a/Items/Weapons/Summon/AbandonedSlimeStaff.cs b/Items/Weapons/Summon/AbandonedSlimeStaff.cs index fa629db71e..d6bd213542 100644 --- a/Items/Weapons/Summon/AbandonedSlimeStaff.cs +++ b/Items/Weapons/Summon/AbandonedSlimeStaff.cs @@ -1,6 +1,7 @@ using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using System; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -16,7 +17,8 @@ namespace CalamityMod.Items.Weapons.Summon Tooltip.SetDefault("Cast down from the heavens in disgust, this relic sings a song of quiet tragedy...\n" + "Consumes all of the remaining minion slots on use\n" + "Must be used from the hotbar\n" + - "Increased power and size based on the number of minion slots used"); + "Increased power and size based on the number of minion slots used\n" + + "Holding this weapon grants 20% increased jump speed"); } public override void SetDefaults() @@ -40,6 +42,19 @@ namespace CalamityMod.Items.Weapons.Summon item.Calamity().customRarity = CalamityRarity.Dedicated; //rarity 21 } + public override void ModifyTooltips(List list) + { + bool autoJump = Main.player[Main.myPlayer].autoJump; + string jumpAmt = autoJump ? "5" : "20"; + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip4") + { + line2.text = "Holding this weapon grants " + jumpAmt + "% increased jump speed"; + } + } + } + public override void HoldItem(Player player) { //same boost as Aero Stone diff --git a/Items/Weapons/Summon/AngryChickenStaff.cs b/Items/Weapons/Summon/AngryChickenStaff.cs index e54a19ad9f..5c6794a6f0 100644 --- a/Items/Weapons/Summon/AngryChickenStaff.cs +++ b/Items/Weapons/Summon/AngryChickenStaff.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { item.mana = 50; - item.damage = 160; + item.damage = 130; item.useStyle = ItemUseStyleID.SwingThrow; item.width = 32; item.height = 32; diff --git a/Items/Weapons/Summon/BensUmbrella.cs b/Items/Weapons/Summon/BensUmbrella.cs index d53d17fc6e..dd6ca111be 100644 --- a/Items/Weapons/Summon/BensUmbrella.cs +++ b/Items/Weapons/Summon/BensUmbrella.cs @@ -9,66 +9,65 @@ 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" + + { + 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"); - } + "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 = 963; - item.useStyle = ItemUseStyleID.SwingThrow; - item.width = 74; - item.height = 72; - item.useTime = item.useAnimation = 10; - item.noMelee = true; - item.knockBack = 1f; - item.value = Item.buyPrice(5, 0, 0, 0); - item.Calamity().customRarity = CalamityRarity.ItemSpecific; - item.rare = 10; - item.UseSound = SoundID.Item68; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.summon = true; - } + public override void SetDefaults() + { + item.damage = 963; + item.knockBack = 1f; + item.mana = 99; + item.useTime = item.useAnimation = 10; + item.summon = true; + item.shootSpeed = 0f; + item.shoot = ModContent.ProjectileType(); - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0 && player.maxMinions >= 5; + item.useStyle = ItemUseStyleID.SwingThrow; + item.width = 74; + item.height = 72; + item.noMelee = true; + item.UseSound = SoundID.Item68; + item.value = Item.buyPrice(5, 0, 0, 0); + item.rare = 10; + item.Calamity().customRarity = CalamityRarity.ItemSpecific; + } - public override bool Shoot(Player player, ref 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 bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0 && player.maxMinions >= 5; - 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); + 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.maxProjectiles; x++) + { + Projectile proj = Main.projectile[x]; + if (proj.active && proj.owner == player.whoAmI && proj.type == type) + { + proj.Kill(); + break; + } + } + Projectile.NewProjectile(position, Vector2.Zero, 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(); - } - } + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/Summon/BlightedEyeStaff.cs b/Items/Weapons/Summon/BlightedEyeStaff.cs index 85b17abb35..45094ef7de 100644 --- a/Items/Weapons/Summon/BlightedEyeStaff.cs +++ b/Items/Weapons/Summon/BlightedEyeStaff.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 35; + item.damage = 40; item.mana = 10; item.width = 62; item.height = 62; diff --git a/Items/Weapons/Summon/CadaverousCarrion.cs b/Items/Weapons/Summon/CadaverousCarrion.cs index 32a59de547..655a09d704 100644 --- a/Items/Weapons/Summon/CadaverousCarrion.cs +++ b/Items/Weapons/Summon/CadaverousCarrion.cs @@ -37,11 +37,10 @@ namespace CalamityMod.Items.Weapons.Summon { if (player.altFunctionUse != 2) { - position = Main.MouseWorld; - Point mouseTileCoords = position.ToTileCoordinates(); - if (WorldGen.SolidTile(mouseTileCoords.X, mouseTileCoords.Y)) + Point mouseTileCoords = Main.MouseWorld.ToTileCoordinates(); + if (CalamityUtils.ParanoidTileRetrieval(mouseTileCoords.X, mouseTileCoords.Y).active()) return false; - Projectile.NewProjectile(position, Vector2.Zero, type, damage, knockBack, player.whoAmI); + Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, type, damage, knockBack, player.whoAmI); player.UpdateMaxTurrets(); } return false; diff --git a/Items/Weapons/Summon/ColdDivinity.cs b/Items/Weapons/Summon/ColdDivinity.cs index 792e9fa1b0..629807bda4 100644 --- a/Items/Weapons/Summon/ColdDivinity.cs +++ b/Items/Weapons/Summon/ColdDivinity.cs @@ -1,6 +1,8 @@ using CalamityMod.Buffs.Summon; using CalamityMod.Projectiles.Summon; +using CalamityMod.World; using Microsoft.Xna.Framework; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -13,11 +15,12 @@ namespace CalamityMod.Items.Weapons.Summon { DisplayName.SetDefault("Cold Divinity"); Tooltip.SetDefault("Legendary Drop\n" + - "Summons the power of the ancient ice castle\n" + + "Summons the power of the ancient ice castle\n" + "For each minion slot used, you will gain an additional orbiting shield spike\n" + "These spikes accelerate rapidly towards a nearby enemy to inflict heavy damage\n" + "They take some time to regenerate after launching themselves at the target, however\n" + "On right click, summons a duplicate ring around the targeted enemy, which slowly converges before exploding\n" + + "Minion damage bonuses apply to this weapon twice for more damage\n" + "Revengeance Drop"); Item.staff[item.type] = true; } @@ -32,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Summon item.useStyle = ItemUseStyleID.HoldingUp; item.noMelee = true; item.knockBack = 4.5f; - item.value = Item.buyPrice(0, 48, 0, 0); + item.value = Item.buyPrice(0, 36, 0, 0); item.rare = 5; item.Calamity().customRarity = CalamityRarity.ItemSpecific; item.UseSound = SoundID.Item30; @@ -41,9 +44,30 @@ namespace CalamityMod.Items.Weapons.Summon item.shootSpeed = 10f; item.summon = true; } + + public override void ModifyTooltips(List list) + { + if (CalamityWorld.death) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip7") + { + line2.text = "Provides heat and cold protection in Death Mode when in use\n" + + "Revengeance Drop"; + } + } + } + } + + public override void ModifyWeaponDamage(Player player, ref float add, ref float mult, ref float flat) + { + mult += player.MinionDamage() - 1f; + } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - damage = (int)(damage * player.MinionDamage()); + //damage = (int)(damage * player.MinionDamage()); float totalMinionSlots = 0f; for (int i = 0; i < Main.projectile.Length; i++) { diff --git a/Items/Weapons/Summon/CorvidHarbringerStaff.cs b/Items/Weapons/Summon/CorvidHarbringerStaff.cs index 9087783edd..62e00f7e15 100644 --- a/Items/Weapons/Summon/CorvidHarbringerStaff.cs +++ b/Items/Weapons/Summon/CorvidHarbringerStaff.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Summon item.UseSound = SoundID.DD2_BetsyFlyingCircleAttack; item.summon = true; item.mana = 11; - item.damage = 275; + item.damage = 300; item.knockBack = 2f; item.autoReuse = true; item.useTime = item.useAnimation = 10; diff --git a/Items/Weapons/Summon/CosmicImmaterializer.cs b/Items/Weapons/Summon/CosmicImmaterializer.cs index a5fbf51a9a..a332199476 100644 --- a/Items/Weapons/Summon/CosmicImmaterializer.cs +++ b/Items/Weapons/Summon/CosmicImmaterializer.cs @@ -47,29 +47,7 @@ namespace CalamityMod.Items.Weapons.Summon { CalamityPlayer modPlayer = player.Calamity(); bool hasSummonerSet = modPlayer.tarraSummon || modPlayer.bloodflareSummon || modPlayer.godSlayerSummon || modPlayer.silvaSummon || modPlayer.dsSetBonus || modPlayer.omegaBlueSet || modPlayer.fearmongerSet; //demonshade included so summoner isn't forced to use auric for BR - player.itemTime = item.useTime; - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (player.gravDir == -1f) - { - num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; - } - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) - { - num78 = (float)player.direction; - num80 = item.shootSpeed; - } - else - { - num80 = item.shootSpeed / num80; - } - num78 = 0f; - num79 = 0f; - vector2.X = (float)Main.mouseX + Main.screenPosition.X; - vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; - Projectile.NewProjectile(vector2.X, vector2.Y, num78, num79, type, (int)((double)damage * (hasSummonerSet ? 1.0 : 0.66)), knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, type, (int)(damage * (hasSummonerSet ? 1 : 0.66)), knockBack, player.whoAmI, 0f, 0f); return false; } diff --git a/Items/Weapons/Summon/DeepseaStaff.cs b/Items/Weapons/Summon/DeepseaStaff.cs index 5b0e65337e..4e341143a6 100644 --- a/Items/Weapons/Summon/DeepseaStaff.cs +++ b/Items/Weapons/Summon/DeepseaStaff.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 48; + item.damage = 42; item.mana = 10; item.width = 46; item.height = 46; diff --git a/Items/Weapons/Summon/EndoHydraStaff.cs b/Items/Weapons/Summon/EndoHydraStaff.cs index 4363b83103..a5a5e746ea 100644 --- a/Items/Weapons/Summon/EndoHydraStaff.cs +++ b/Items/Weapons/Summon/EndoHydraStaff.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Summon item.UseSound = SoundID.Item60; item.summon = true; item.mana = 25; - item.damage = 400; + item.damage = 450; item.knockBack = 3f; item.autoReuse = true; item.useTime = item.useAnimation = 10; diff --git a/Items/Weapons/Summon/EnergyStaff.cs b/Items/Weapons/Summon/EnergyStaff.cs index 14e62b75f1..d297a1659f 100644 --- a/Items/Weapons/Summon/EnergyStaff.cs +++ b/Items/Weapons/Summon/EnergyStaff.cs @@ -36,11 +36,11 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - position = Main.MouseWorld; - speedX = 0; - speedY = 0; - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); - player.UpdateMaxTurrets(); + if (player.altFunctionUse != 2) + { + Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, type, damage, knockBack, player.whoAmI, 8f); + player.UpdateMaxTurrets(); + } return false; } } diff --git a/Items/Weapons/Summon/EnergyStaff.png b/Items/Weapons/Summon/EnergyStaff.png index 5d9f365fdc..b20ee775ee 100644 Binary files a/Items/Weapons/Summon/EnergyStaff.png and b/Items/Weapons/Summon/EnergyStaff.png differ diff --git a/Items/Weapons/Summon/HerringStaff.cs b/Items/Weapons/Summon/HerringStaff.cs index 82985b8340..70bc426e7c 100644 --- a/Items/Weapons/Summon/HerringStaff.cs +++ b/Items/Weapons/Summon/HerringStaff.cs @@ -19,8 +19,7 @@ namespace CalamityMod.Items.Weapons.Summon { item.damage = 20; item.mana = 10; - item.width = 46; - item.height = 46; + item.width = item.height = 48; item.useTime = item.useAnimation = 30; item.useStyle = ItemUseStyleID.SwingThrow; item.noMelee = true; diff --git a/Items/Weapons/Summon/HerringStaff.png b/Items/Weapons/Summon/HerringStaff.png index 00bcdf2e28..4668f74cf8 100644 Binary files a/Items/Weapons/Summon/HerringStaff.png and b/Items/Weapons/Summon/HerringStaff.png differ diff --git a/Items/Weapons/Summon/HivePod.cs b/Items/Weapons/Summon/HivePod.cs index 6b4c3d4bc5..e5046a6a05 100644 --- a/Items/Weapons/Summon/HivePod.cs +++ b/Items/Weapons/Summon/HivePod.cs @@ -36,10 +36,7 @@ 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); + Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, type, damage, knockBack, player.whoAmI); player.UpdateMaxTurrets(); } return false; diff --git a/Items/Weapons/Summon/MidnightSunBeacon.cs b/Items/Weapons/Summon/MidnightSunBeacon.cs index 19eeb8272e..bd4d3be5a7 100644 --- a/Items/Weapons/Summon/MidnightSunBeacon.cs +++ b/Items/Weapons/Summon/MidnightSunBeacon.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 260; + item.damage = 240; item.mana = 12; item.width = item.height = 32; item.useTime = item.useAnimation = 10; diff --git a/Items/Weapons/Summon/PlantationStaff.cs b/Items/Weapons/Summon/PlantationStaff.cs index e11daf2b26..a844859e51 100644 --- a/Items/Weapons/Summon/PlantationStaff.cs +++ b/Items/Weapons/Summon/PlantationStaff.cs @@ -9,84 +9,81 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Summon { public class PlantationStaff : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Plantation Staff"); - Tooltip.SetDefault("Summons a miniature plantera to protect you\n" + - "Fires seeds and spiky balls from afar to poison targets\n" + - "Enrages when you get under 50% health and begins ramming enemies\n" + - "Occupies 2 minion slots and there can only be one"); - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Plantation Staff"); + Tooltip.SetDefault("Summons a miniature plantera to protect you\n" + + "Fires seeds, spiky balls, and spore clouds from afar to poison targets\n" + + "Enrages when you get under 75% health and begins ramming enemies\n" + + "Occupies 3 minion slots and there can only be one"); + } - public override void SetDefaults() - { - item.damage = 70; - item.mana = 10; - item.width = 66; - item.height = 70; - item.useTime = item.useAnimation = 20; - item.useStyle = ItemUseStyleID.SwingThrow; - item.noMelee = true; - item.knockBack = 1f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.UseSound = SoundID.Item76; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.summon = true; - } + public override void SetDefaults() + { + item.damage = 55; + item.mana = 10; + item.width = 66; + item.height = 70; + item.useTime = item.useAnimation = 20; + item.useStyle = ItemUseStyleID.SwingThrow; + item.noMelee = true; + item.knockBack = 1f; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + item.UseSound = SoundID.Item76; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 10f; + item.summon = true; + } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0 && player.maxMinions >= 2; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0 && player.maxMinions >= 3; - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.OpticStaff); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ItemID.OpticStaff); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - if (player.altFunctionUse != 2) - { - int i = Main.myPlayer; - float num72 = item.shootSpeed; - float num74 = knockBack; - num74 = player.GetWeaponKnockback(item, num74); + { + if (player.altFunctionUse != 2) + { + float speed = item.shootSpeed; player.itemTime = item.useTime; - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + Vector2 playerPos = player.RotatedRelativePoint(player.MountedCenter, true); + float directionX = (float)Main.mouseX + Main.screenPosition.X - playerPos.X; + float directionY = (float)Main.mouseY + Main.screenPosition.Y - playerPos.Y; if (player.gravDir == -1f) { - num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; + directionY = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - playerPos.Y; } - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) + Vector2 spinningpoint = new Vector2(directionX, directionY); + float vectorDist = spinningpoint.Length(); + if ((float.IsNaN(spinningpoint.X) && float.IsNaN(spinningpoint.Y)) || (spinningpoint.X == 0f && spinningpoint.Y == 0f)) { - num78 = (float)player.direction; - num79 = 0f; - num80 = num72; + spinningpoint.X = (float)player.direction; + spinningpoint.Y = 0f; + vectorDist = speed; } else { - num80 = num72 / num80; + vectorDist = speed / vectorDist; } - num78 *= num80; - num79 *= num80; - vector2.X = (float)Main.mouseX + Main.screenPosition.X; - vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; - Vector2 spinningpoint = new Vector2(num78, num79); - spinningpoint = spinningpoint.RotatedBy(1.5707963705062866, default); - Projectile.NewProjectile(vector2.X + spinningpoint.X, vector2.Y + spinningpoint.Y, spinningpoint.X, spinningpoint.Y, type, damage, num74, i, 0f, 0f); + spinningpoint.X *= vectorDist; + spinningpoint.Y *= vectorDist; + playerPos.X = (float)Main.mouseX + Main.screenPosition.X; + playerPos.Y = (float)Main.mouseY + Main.screenPosition.Y; + spinningpoint = spinningpoint.RotatedBy(MathHelper.PiOver2, default); + Projectile.NewProjectile(playerPos + spinningpoint, spinningpoint, type, damage, knockBack, player.whoAmI, 0f, 0f); } return false; - } - } + } + } } diff --git a/Items/Weapons/Summon/PrototypeAndromechaRing.cs b/Items/Weapons/Summon/PrototypeAndromechaRing.cs index 54ee78dbdc..40e99b27d8 100644 --- a/Items/Weapons/Summon/PrototypeAndromechaRing.cs +++ b/Items/Weapons/Summon/PrototypeAndromechaRing.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 100); + recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddIngredient(ModContent.ItemType(), 4); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ItemID.WingsVortex); diff --git a/Items/Weapons/Summon/RustyBeaconPrototype.cs b/Items/Weapons/Summon/RustyBeaconPrototype.cs index 95760c4e02..86a81dc44f 100644 --- a/Items/Weapons/Summon/RustyBeaconPrototype.cs +++ b/Items/Weapons/Summon/RustyBeaconPrototype.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Weapons.Summon DisplayName.SetDefault("Rusty Beacon Prototype"); Tooltip.SetDefault("Summons a long-abandoned drone to support you\n" + "Clicking on an enemy gives them a tiny prick, causing them to become aggravated\n" + - "The drone hovers above nearby enemies and gives them various debuffs"); + "The drone hovers above nearby enemies and inflicts irradiated"); } public override void SetDefaults() diff --git a/Items/Weapons/Summon/SarosPossession.cs b/Items/Weapons/Summon/SarosPossession.cs index bd973983f8..afa9e2884b 100644 --- a/Items/Weapons/Summon/SarosPossession.cs +++ b/Items/Weapons/Summon/SarosPossession.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Summon item.summon = true; item.mana = 100; - item.damage = 681; + item.damage = 426; item.knockBack = 4f; item.useTime = item.useAnimation = 10; item.shoot = ModContent.ProjectileType(); @@ -47,10 +47,10 @@ namespace CalamityMod.Items.Weapons.Summon 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()) + Projectile proj = Main.projectile[j]; + if (proj.active && proj.owner == player.whoAmI && proj.minion && proj.type != item.shoot) { - minionCount += projectile.minionSlots; + minionCount += proj.minionSlots; } } radianceSlots = (int)(player.maxMinions - minionCount); @@ -65,16 +65,14 @@ namespace CalamityMod.Items.Weapons.Summon { 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 proj = Main.projectile[x]; + if (proj.active && proj.owner == player.whoAmI && proj.type == type) { - projectile.Kill(); + proj.Kill(); + break; } } - position = Main.MouseWorld; - speedX = 0; - speedY = 0; - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, radianceSlots); + Projectile.NewProjectile(position, Vector2.Zero, type, damage, knockBack, player.whoAmI, radianceSlots); return false; } diff --git a/Items/Weapons/Summon/ShellfishStaff.cs b/Items/Weapons/Summon/ShellfishStaff.cs index 5d703af829..e339fc04cb 100644 --- a/Items/Weapons/Summon/ShellfishStaff.cs +++ b/Items/Weapons/Summon/ShellfishStaff.cs @@ -38,10 +38,7 @@ 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); + Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, type, damage, knockBack, player.whoAmI); } return false; } diff --git a/Items/Weapons/Summon/Sirius.cs b/Items/Weapons/Summon/Sirius.cs index 37e60e7d4b..23f78749e8 100644 --- a/Items/Weapons/Summon/Sirius.cs +++ b/Items/Weapons/Summon/Sirius.cs @@ -46,13 +46,13 @@ namespace CalamityMod.Items.Weapons.Summon 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()) + Projectile proj = Main.projectile[j]; + if (proj.active && proj.owner == player.whoAmI && proj.minion && proj.type != item.shoot) { - minionCount += projectile.minionSlots; + minionCount += proj.minionSlots; } } - siriusSlots = (int)((double)player.maxMinions - minionCount); + siriusSlots = (int)(player.maxMinions - minionCount); } public override bool CanUseItem(Player player) @@ -64,16 +64,14 @@ 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() && projectile2.type != ModContent.ProjectileType()) + Projectile proj = Main.projectile[x]; + if (proj.active && proj.owner == player.whoAmI && proj.type == type) { - projectile2.Kill(); + proj.Kill(); + break; } } - position = Main.MouseWorld; - speedX = 0; - speedY = 0; - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, siriusSlots, 30f); + Projectile.NewProjectile(position, Vector2.Zero, type, damage, knockBack, player.whoAmI, siriusSlots, 30f); return false; } diff --git a/Items/Weapons/Summon/SpikecragStaff.cs b/Items/Weapons/Summon/SpikecragStaff.cs index 4e076e9e8b..59fe58d3b1 100644 --- a/Items/Weapons/Summon/SpikecragStaff.cs +++ b/Items/Weapons/Summon/SpikecragStaff.cs @@ -38,10 +38,10 @@ 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, 120f, 0f); + Point mouseTileCoords = Main.MouseWorld.ToTileCoordinates(); + if (CalamityUtils.ParanoidTileRetrieval(mouseTileCoords.X, mouseTileCoords.Y).active()) + return false; + Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, type, damage, knockBack, player.whoAmI, 120f, 0f); player.UpdateMaxTurrets(); } return false; diff --git a/Items/Weapons/Summon/StaffoftheMechworm.cs b/Items/Weapons/Summon/StaffoftheMechworm.cs index 36eaeb83f8..3a343e2281 100644 --- a/Items/Weapons/Summon/StaffoftheMechworm.cs +++ b/Items/Weapons/Summon/StaffoftheMechworm.cs @@ -63,7 +63,7 @@ namespace CalamityMod.Items.Weapons.Summon { maxMinionScale = 10; } - damage = (int)(damage * ((player.minionDamage * 5 / 3) + (player.minionDamage * 0.46f * (maxMinionScale - 1)))); + damage = (int)(damage * ((player.MinionDamage() * 5 / 3) + (player.MinionDamage() * 0.46f * (maxMinionScale - 1)))); int head = -1; int tail = -1; for (int num187 = 0; num187 < Main.projectile.Length; num187++) diff --git a/Items/Weapons/Summon/SunGodStaff.cs b/Items/Weapons/Summon/SunGodStaff.cs index 4da962d734..ebe9ce9e11 100644 --- a/Items/Weapons/Summon/SunGodStaff.cs +++ b/Items/Weapons/Summon/SunGodStaff.cs @@ -47,18 +47,16 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, ref 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.maxProjectiles; x++) { - Projectile projectile = Main.projectile[x]; - if (projectile.active && projectile.owner == player.whoAmI && projectile.type == ModContent.ProjectileType()) + Projectile proj = Main.projectile[x]; + if (proj.active && proj.owner == player.whoAmI && proj.type == type) { - projectile.Kill(); + proj.Kill(); + break; } } - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + Projectile.NewProjectile(position, Vector2.Zero, type, damage, knockBack, player.whoAmI); return false; } } diff --git a/Items/Weapons/Summon/SunSpiritStaff.cs b/Items/Weapons/Summon/SunSpiritStaff.cs index 00f9a88a12..e874d3e8cd 100644 --- a/Items/Weapons/Summon/SunSpiritStaff.cs +++ b/Items/Weapons/Summon/SunSpiritStaff.cs @@ -44,18 +44,16 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - position = Main.MouseWorld; - speedX = 0; - speedY = 0; - for (int x = 0; x < 1000; x++) + for (int x = 0; x < Main.maxProjectiles; x++) { - Projectile projectile = Main.projectile[x]; - if (projectile.active && projectile.owner == player.whoAmI && projectile.type == ModContent.ProjectileType()) + Projectile proj = Main.projectile[x]; + if (proj.active && proj.owner == player.whoAmI && proj.type == type) { - projectile.Kill(); + proj.Kill(); + break; } } - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + Projectile.NewProjectile(position, Vector2.Zero, type, damage, knockBack, player.whoAmI); return false; } } diff --git a/Items/Weapons/Summon/TacticalPlagueEngine.cs b/Items/Weapons/Summon/TacticalPlagueEngine.cs index fc425782b0..c96e44f729 100644 --- a/Items/Weapons/Summon/TacticalPlagueEngine.cs +++ b/Items/Weapons/Summon/TacticalPlagueEngine.cs @@ -54,7 +54,7 @@ namespace CalamityMod.Items.Weapons.Summon recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType(), 15); recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ItemID.LunarBar, 10); + recipe.AddIngredient(ItemID.LunarBar, 5); recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Weapons/Summon/WulfrumController.png b/Items/Weapons/Summon/WulfrumController.png index c419f9b6ac..7222b843e5 100644 Binary files a/Items/Weapons/Summon/WulfrumController.png and b/Items/Weapons/Summon/WulfrumController.png differ diff --git a/Items/Weapons/Typeless/AethersWhisper.cs b/Items/Weapons/Typeless/AethersWhisper.cs index b4dfa58729..1872f216d8 100644 --- a/Items/Weapons/Typeless/AethersWhisper.cs +++ b/Items/Weapons/Typeless/AethersWhisper.cs @@ -50,17 +50,21 @@ namespace CalamityMod.Items.Weapons.Typeless { item.ranged = true; item.magic = false; - item.mana = 0; } else { item.ranged = false; item.magic = true; - item.mana = 30; } return base.CanUseItem(player); } + public override void ModifyManaCost(Player player, ref float reduce, ref float mult) + { + if (player.altFunctionUse == 2) + mult *= 0f; + } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { float ai0 = player.altFunctionUse == 2 ? 1f : 0f; diff --git a/Items/Weapons/Typeless/FiniteUse/ElephantKiller.cs b/Items/Weapons/Typeless/FiniteUse/ElephantKiller.cs index 3069600ec9..b5dc650ec2 100644 --- a/Items/Weapons/Typeless/FiniteUse/ElephantKiller.cs +++ b/Items/Weapons/Typeless/FiniteUse/ElephantKiller.cs @@ -89,7 +89,7 @@ namespace CalamityMod.Items.Weapons.Typeless.FiniteUse { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.LunarBar, 30); + recipe.AddIngredient(ItemID.LunarBar, 15); recipe.AddIngredient(ItemID.IllegalGunParts); recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); diff --git a/Items/Weapons/Typeless/YanmeisKnife.cs b/Items/Weapons/Typeless/YanmeisKnife.cs new file mode 100644 index 0000000000..162fd7a9ad --- /dev/null +++ b/Items/Weapons/Typeless/YanmeisKnife.cs @@ -0,0 +1,67 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Typeless +{ + public class YanmeisKnife : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Yanmei's Knife"); + Tooltip.SetDefault("When hitting a boss or its minions, you gain various boosts and cripple the enemy hit\n" + + "A knife from an unknown world\n" + + "An owner whose heart is pure and free of taint\n" + + "A heart of iron and valor"); + } + + public override void SetDefaults() + { + item.height = 44; + item.width = 48; + item.damage = 8; + item.crit += 6; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = item.useTime = 32; + item.useStyle = ItemUseStyleID.HoldingOut; + item.knockBack = 4.5f; + item.autoReuse = false; + item.value = CalamityGlobalItem.Rarity8BuyPrice; + item.UseSound = SoundID.Item71; + item.rare = 8; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 24f; + item.Calamity().customRarity = CalamityRarity.Dedicated; + } + + public override bool CanUseItem(Player player) + { + if (player.Calamity().KameiBladeUseDelay > 0) + return false; + return base.CanUseItem(player); + } + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + player.Calamity().KameiBladeUseDelay = 180; + Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.PsychoKnife); + recipe.AddIngredient(ItemID.Obsidian, 10); + recipe.AddIngredient(ItemID.IronBar, 20); + recipe.AddIngredient(ModContent.ItemType(), 50); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Typeless/YanmeisKnife.png b/Items/Weapons/Typeless/YanmeisKnife.png new file mode 100644 index 0000000000..b7f214f8f4 Binary files /dev/null and b/Items/Weapons/Typeless/YanmeisKnife.png differ diff --git a/Localization/CalamityLocalization.cs b/Localization/CalamityLocalization.cs index 1d36e513ef..2c9dae7289 100644 --- a/Localization/CalamityLocalization.cs +++ b/Localization/CalamityLocalization.cs @@ -95,8 +95,7 @@ namespace CalamityMod.Localization new [] { "AureusBossText2", "A faint ethereal click can be heard from the dungeon." }, new [] { "AstralBossText", "The seal of the stars has been broken! You can now mine Astral Ore." }, new [] { "DeusText", "A star-spawned horror tunnels through the astral infection." }, - new [] { "DeusText2", "The astral infection trembles..." }, - new [] { "DeusText3", "The god of the stars draws near..." }, + new [] { "DeusAltarRejectNightText", "The god of the stars rejects your offering. The ritual can only be performed at night." }, new [] { "CalamitasBossText", "You underestimate my power..." }, new [] { "CalamitasBossText2", "The brothers have been reborn!" }, diff --git a/ModSupport/WeakReferenceSupport.cs b/ModSupport/WeakReferenceSupport.cs index 7d80fba05c..803fd95b5f 100644 --- a/ModSupport/WeakReferenceSupport.cs +++ b/ModSupport/WeakReferenceSupport.cs @@ -22,6 +22,7 @@ using CalamityMod.Items.SummonItems.Invasion; using CalamityMod.Items.Tools; using CalamityMod.Items.Tools.ClimateChange; using CalamityMod.Items.TreasureBags; +using CalamityMod.Items.Weapons.DraedonsArsenal; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; @@ -57,6 +58,7 @@ using CalamityMod.NPCs.SunkenSea; using CalamityMod.NPCs.SupremeCalamitas; using CalamityMod.NPCs.TownNPCs; using CalamityMod.NPCs.Yharon; +using CalamityMod.Projectiles.DraedonsArsenal; using CalamityMod.Projectiles.Summon; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -273,9 +275,9 @@ namespace CalamityMod 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() }; + List collection = new List() { 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)); + string despawn = CalamityUtils.ColorMessage("The gelatinous monstrosity achieved vengeance for its brethren.", new Color(0xBA, 0x55, 0x33)); AddBoss(bossChecklist, calamity, "Slime God", order, bosses, DownedSlimeGod, summon, loot, collection, instructions, despawn); } @@ -398,7 +400,7 @@ namespace CalamityMod List segments = new List() { NPCType(), NPCType(), NPCType() }; int summon = ItemType(); List loot = new List() { ItemType(), ItemType(), ItemID.FallenStar, 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() }; + List collection = new List() { ItemType(), 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"; @@ -523,7 +525,7 @@ namespace CalamityMod 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(), 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(), 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. @@ -812,61 +814,71 @@ namespace CalamityMod private static void SummonersAssociationSupport() { Mod sAssociation = ModLoader.GetMod("SummonersAssociation"); - if(sAssociation != null) + if (sAssociation is null) + return; + + void RegisterSummon(int summonItem, int summonBuff, int summonProjectile) { - 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(), 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() {1-(1f/3f), 2f/3f, 2f/3f}); - //Entropy's Vigil is a bruh moment - 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()}); - 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(), 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()); - sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), ProjectileType()); - sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), ProjectileType()); + sAssociation.Call("AddMinionInfo", summonItem, summonBuff, summonProjectile); } + RegisterSummon(ItemType(), BuffType(), ProjectileType()); + RegisterSummon(ItemType(), BuffType(), ProjectileType()); + RegisterSummon(ItemType(), BuffType(), ProjectileType()); + RegisterSummon(ItemType(), BuffType(), ProjectileType()); + RegisterSummon(ItemType(), BuffType(), ProjectileType()); + RegisterSummon(ItemType(), BuffType(), ProjectileType()); + RegisterSummon(ItemType(), BuffType(), ProjectileType()); + RegisterSummon(ItemType(), BuffType(), ProjectileType()); + RegisterSummon(ItemType(), BuffType(), ProjectileType()); + RegisterSummon(ItemType(), BuffType(), ProjectileType()); + RegisterSummon(ItemType(), BuffType(), ProjectileType()); + RegisterSummon(ItemType(), BuffType(), ProjectileType()); + RegisterSummon(ItemType(), BuffType(), ProjectileType()); + RegisterSummon(ItemType(), BuffType(), ProjectileType()); + RegisterSummon(ItemType(), BuffType(), ProjectileType()); + RegisterSummon(ItemType(), BuffType(), ProjectileType()); + RegisterSummon(ItemType(), BuffType(), ProjectileType()); + RegisterSummon(ItemType(), BuffType(), ProjectileType()); + RegisterSummon(ItemType(), BuffType(), ProjectileType()); + RegisterSummon(ItemType(), BuffType(), ProjectileType()); + RegisterSummon(ItemType(), BuffType(), ProjectileType()); + RegisterSummon(ItemType(), BuffType(), ProjectileType()); + RegisterSummon(ItemType(), BuffType(), ProjectileType()); + RegisterSummon(ItemType(), BuffType(), ProjectileType()); + RegisterSummon(ItemType(), BuffType(), ProjectileType()); + RegisterSummon(ItemType(), BuffType(), ProjectileType()); + RegisterSummon(ItemType(), BuffType(), ProjectileType()); + RegisterSummon(ItemType(), BuffType(), ProjectileType()); + RegisterSummon(ItemType(), BuffType(), ProjectileType()); + RegisterSummon(ItemType(), BuffType(), ProjectileType()); + RegisterSummon(ItemType(), BuffType(), ProjectileType()); + RegisterSummon(ItemType(), BuffType(), ProjectileType()); + RegisterSummon(ItemType(), BuffType(), ProjectileType()); + RegisterSummon(ItemType(), BuffType(), ProjectileType()); + RegisterSummon(ItemType(), BuffType(), ProjectileType()); + RegisterSummon(ItemType(), BuffType(), ProjectileType()); + RegisterSummon(ItemType(), BuffType(), ProjectileType()); + RegisterSummon(ItemType(), BuffType(), ProjectileType()); + RegisterSummon(ItemType(), BuffType(), ProjectileType()); + RegisterSummon(ItemType(), BuffType(), ProjectileType()); + RegisterSummon(ItemType(), BuffType(), ProjectileType()); + RegisterSummon(ItemType(), BuffType(), ProjectileType()); + RegisterSummon(ItemType(), BuffType(), ProjectileType()); + RegisterSummon(ItemType(), BuffType(), ProjectileType()); + RegisterSummon(ItemType(), BuffType(), ProjectileType()); + RegisterSummon(ItemType(), BuffType(), ProjectileType()); + RegisterSummon(ItemType(), BuffType(), ProjectileType()); + RegisterSummon(ItemType(), BuffType(), ProjectileType()); + RegisterSummon(ItemType(), BuffType(), ProjectileType()); + RegisterSummon(ItemType(), BuffType(), ProjectileType()); + RegisterSummon(ItemType(), BuffType(), ProjectileType()); + RegisterSummon(ItemType(), BuffType(), ProjectileType()); + RegisterSummon(ItemType(), BuffType(), ProjectileType()); + + sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), new List() { ProjectileType(), ProjectileType(), ProjectileType()}, new List() {1-(1f/3f), 2f/3f, 2f/3f}); + //Entropy's Vigil is a bruh moment + sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), new List() { ProjectileType(), ProjectileType()}); + sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), ProjectileType(), 1f); } } } diff --git a/NPCs/Abyss/BobbitWormHead.cs b/NPCs/Abyss/BobbitWormHead.cs index 9d64cbbeaf..54712c0335 100644 --- a/NPCs/Abyss/BobbitWormHead.cs +++ b/NPCs/Abyss/BobbitWormHead.cs @@ -253,13 +253,13 @@ namespace CalamityMod.NPCs.Abyss { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/BobbitWorm"), 1f); Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/BobbitWorm2"), 1f); diff --git a/NPCs/Abyss/BoxJellyfish.cs b/NPCs/Abyss/BoxJellyfish.cs index 9c1509965a..590f58e3c0 100644 --- a/NPCs/Abyss/BoxJellyfish.cs +++ b/NPCs/Abyss/BoxJellyfish.cs @@ -200,13 +200,13 @@ namespace CalamityMod.NPCs.Abyss { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 15; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/Abyss/ChaoticPuffer.cs b/NPCs/Abyss/ChaoticPuffer.cs index 56d54b9e29..3b89f4d891 100644 --- a/NPCs/Abyss/ChaoticPuffer.cs +++ b/NPCs/Abyss/ChaoticPuffer.cs @@ -240,7 +240,7 @@ namespace CalamityMod.NPCs.Abyss { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { @@ -248,7 +248,7 @@ namespace CalamityMod.NPCs.Abyss for (int k = 0; k < 15; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/Abyss/ColossalSquid.cs b/NPCs/Abyss/ColossalSquid.cs index 09ff55a9bb..a8c338cbc4 100644 --- a/NPCs/Abyss/ColossalSquid.cs +++ b/NPCs/Abyss/ColossalSquid.cs @@ -4,6 +4,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Projectiles.Enemy; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -43,7 +44,24 @@ namespace CalamityMod.NPCs.Abyss npc.buffImmune[k] = true; } npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; + npc.buffImmune[BuffID.Frostburn] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.buffImmune[BuffID.Daybreak] = false; + npc.buffImmune[BuffID.StardustMinionBleed] = false; + npc.buffImmune[BuffID.DryadsWardDebuff] = false; + npc.buffImmune[BuffID.Oiled] = false; + npc.buffImmune[BuffID.BetsysCurse] = false; + npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; npc.timeLeft = NPC.activeTime * 30; npc.value = Item.buyPrice(0, 25, 0, 0); npc.HitSound = SoundID.NPCHit20; @@ -395,7 +413,7 @@ namespace CalamityMod.NPCs.Abyss damage = 55; } Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 111); - Projectile.NewProjectile(npc.Center.X, npc.Center.Y + 60, 0f, 2f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(npc.Center.X, npc.Center.Y + 60, 0f, 2f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); } npc.rotation = npc.velocity.X * 0.05f; npc.velocity *= 0.975f; @@ -570,13 +588,13 @@ namespace CalamityMod.NPCs.Abyss { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 30; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ColossalSquid"), 1f); Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ColossalSquid2"), 1f); diff --git a/NPCs/Abyss/Cuttlefish.cs b/NPCs/Abyss/Cuttlefish.cs index 10a59dfb8d..1342017c68 100644 --- a/NPCs/Abyss/Cuttlefish.cs +++ b/NPCs/Abyss/Cuttlefish.cs @@ -402,13 +402,13 @@ namespace CalamityMod.NPCs.Abyss { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 15; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/Abyss/DevilFish.cs b/NPCs/Abyss/DevilFish.cs index ce796bb938..e078b35521 100644 --- a/NPCs/Abyss/DevilFish.cs +++ b/NPCs/Abyss/DevilFish.cs @@ -317,13 +317,13 @@ namespace CalamityMod.NPCs.Abyss { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 25; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } diff --git a/NPCs/Abyss/DevilFishAlt.cs b/NPCs/Abyss/DevilFishAlt.cs index d0bce64a95..93915248ee 100644 --- a/NPCs/Abyss/DevilFishAlt.cs +++ b/NPCs/Abyss/DevilFishAlt.cs @@ -317,13 +317,13 @@ namespace CalamityMod.NPCs.Abyss { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 25; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } diff --git a/NPCs/Abyss/EidolonWyrmHead.cs b/NPCs/Abyss/EidolonWyrmHead.cs index 0a043e6a15..65e9ff160c 100644 --- a/NPCs/Abyss/EidolonWyrmHead.cs +++ b/NPCs/Abyss/EidolonWyrmHead.cs @@ -19,6 +19,7 @@ namespace CalamityMod.NPCs.Abyss { public class EidolonWyrmHead : ModNPC { + private Vector2 patrolSpot = Vector2.Zero; public bool detectsPlayer = false; public const int minLength = 40; public const int maxLength = 41; @@ -61,19 +62,21 @@ namespace CalamityMod.NPCs.Abyss public override void SendExtraAI(BinaryWriter writer) { + writer.WriteVector2(patrolSpot); writer.Write(detectsPlayer); writer.Write(npc.chaseable); } public override void ReceiveExtraAI(BinaryReader reader) { + patrolSpot = reader.ReadVector2(); detectsPlayer = reader.ReadBoolean(); npc.chaseable = reader.ReadBoolean(); } public override void AI() { - if (npc.justHit || npc.life <= npc.lifeMax * 0.98 || Main.player[npc.target].chaosState) + if (npc.justHit || detectsPlayer || Main.player[npc.target].chaosState) { detectsPlayer = true; npc.damage = Main.expertMode ? 340 : 170; @@ -218,40 +221,59 @@ namespace CalamityMod.NPCs.Abyss { npc.spriteDirection = 1; } - if (Main.player[npc.target].dead) - { - npc.TargetClosest(false); - } - npc.alpha -= 42; + if (Main.player[npc.target].dead) + { + npc.TargetClosest(false); + + npc.velocity.Y += 3f; + if (npc.position.Y > Main.worldSurface * 16.0) + npc.velocity.Y += 3f; + + if (npc.position.Y > (Main.maxTilesY - 200) * 16.0) + { + for (int a = 0; a < Main.maxNPCs; a++) + { + if (Main.npc[a].type == npc.type || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType()) + Main.npc[a].active = false; + } + } + } + npc.alpha -= 42; if (npc.alpha < 0) { npc.alpha = 0; } - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 6400f || !NPC.AnyNPCs(ModContent.NPCType()) || !Main.player[npc.target].Calamity().ZoneAbyss) + if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 6400f || !NPC.AnyNPCs(ModContent.NPCType())) { npc.active = false; } + float num188 = speed; float num189 = turnSpeed; - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + Vector2 vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + + if (patrolSpot == Vector2.Zero) + patrolSpot = Main.player[npc.target].Center; + + float num191 = detectsPlayer ? Main.player[npc.target].Center.X : patrolSpot.X; + float num192 = detectsPlayer ? Main.player[npc.target].Center.Y : patrolSpot.Y; + if (!detectsPlayer) { num192 += 800; - if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) < 400f) //500 + if (Math.Abs(npc.Center.X - num191) < 400f) //500 { if (npc.velocity.X > 0f) { - num191 = Main.player[npc.target].Center.X + 500f; //600 + num191 += 500f; } else { - num191 = Main.player[npc.target].Center.X - 500f; //600 + num191 -= 500f; } } } - if (detectsPlayer) + else { num188 = 7.5f; num189 = 0.125f; diff --git a/NPCs/Abyss/EidolonWyrmHeadHuge.cs b/NPCs/Abyss/EidolonWyrmHeadHuge.cs index 95e026dfe2..91da677794 100644 --- a/NPCs/Abyss/EidolonWyrmHeadHuge.cs +++ b/NPCs/Abyss/EidolonWyrmHeadHuge.cs @@ -18,7 +18,8 @@ namespace CalamityMod.NPCs.Abyss { public class EidolonWyrmHeadHuge : ModNPC { - public bool detectsPlayer = false; + private Vector2 patrolSpot = Vector2.Zero; + public bool detectsPlayer = false; public const int minLength = 40; public const int maxLength = 41; public float speed = 7.5f; //10 @@ -59,13 +60,15 @@ namespace CalamityMod.NPCs.Abyss public override void SendExtraAI(BinaryWriter writer) { - writer.Write(detectsPlayer); + writer.WriteVector2(patrolSpot); + writer.Write(detectsPlayer); writer.Write(npc.chaseable); } public override void ReceiveExtraAI(BinaryReader reader) { - detectsPlayer = reader.ReadBoolean(); + patrolSpot = reader.ReadVector2(); + detectsPlayer = reader.ReadBoolean(); npc.chaseable = reader.ReadBoolean(); } @@ -75,7 +78,7 @@ namespace CalamityMod.NPCs.Abyss { npc.TargetClosest(true); } - if (npc.justHit || npc.life <= npc.lifeMax * 0.98 || Main.player[npc.target].chaosState) + if (npc.justHit || detectsPlayer || Main.player[npc.target].chaosState) { if (!detectsPlayer) { @@ -213,6 +216,7 @@ namespace CalamityMod.NPCs.Abyss } } } + if (npc.velocity.X < 0f) { npc.spriteDirection = -1; @@ -221,40 +225,62 @@ namespace CalamityMod.NPCs.Abyss { npc.spriteDirection = 1; } + if (Main.player[npc.target].dead) { npc.TargetClosest(false); - } + + npc.velocity.Y += 3f; + if (npc.position.Y > Main.worldSurface * 16.0) + npc.velocity.Y += 3f; + + if (npc.position.Y > (Main.maxTilesY - 200) * 16.0) + { + for (int a = 0; a < Main.maxNPCs; a++) + { + if (Main.npc[a].type == npc.type || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType()) + Main.npc[a].active = false; + } + } + } + npc.alpha -= 42; if (npc.alpha < 0) { npc.alpha = 0; } - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 6400f || !NPC.AnyNPCs(ModContent.NPCType())) + + if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 6400f || !NPC.AnyNPCs(ModContent.NPCType())) { npc.active = false; } + float num188 = speed; float num189 = turnSpeed; - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + + if (patrolSpot == Vector2.Zero) + patrolSpot = Main.player[npc.target].Center; + + float num191 = detectsPlayer ? Main.player[npc.target].Center.X : patrolSpot.X; + float num192 = detectsPlayer ? Main.player[npc.target].Center.Y : patrolSpot.Y; + if (!detectsPlayer) { num192 += 800; - if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) < 400f) //500 + if (Math.Abs(npc.Center.X - num191) < 400f) //500 { if (npc.velocity.X > 0f) { - num191 = Main.player[npc.target].Center.X + 500f; //600 + num191 += 500f; } else { - num191 = Main.player[npc.target].Center.X - 500f; //600 + num191 -= 500f; } } } - if (detectsPlayer) + else { num188 = 10f; num189 = 0.175f; diff --git a/NPCs/Abyss/GiantSquid.cs b/NPCs/Abyss/GiantSquid.cs index b87541b206..86679092d5 100644 --- a/NPCs/Abyss/GiantSquid.cs +++ b/NPCs/Abyss/GiantSquid.cs @@ -277,13 +277,13 @@ namespace CalamityMod.NPCs.Abyss { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 30; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/GiantSquid"), 1f); Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/GiantSquid2"), 1f); diff --git a/NPCs/Abyss/GulperEelBody.cs b/NPCs/Abyss/GulperEelBody.cs index 453fc7e2be..40c43a7968 100644 --- a/NPCs/Abyss/GulperEelBody.cs +++ b/NPCs/Abyss/GulperEelBody.cs @@ -151,13 +151,13 @@ namespace CalamityMod.NPCs.Abyss { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } Gore.NewGore(npc.Center, npc.velocity, mod.GetGoreSlot("Gores/GulperEel2"), 1f); Gore.NewGore(npc.Center, npc.velocity, mod.GetGoreSlot("Gores/GulperEel3"), 1f); diff --git a/NPCs/Abyss/GulperEelBodyAlt.cs b/NPCs/Abyss/GulperEelBodyAlt.cs index 4bfc45465d..d9e0a41b8e 100644 --- a/NPCs/Abyss/GulperEelBodyAlt.cs +++ b/NPCs/Abyss/GulperEelBodyAlt.cs @@ -151,13 +151,13 @@ namespace CalamityMod.NPCs.Abyss { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } Gore.NewGore(npc.Center, npc.velocity, mod.GetGoreSlot("Gores/GulperEel2"), 1f); Gore.NewGore(npc.Center, npc.velocity, mod.GetGoreSlot("Gores/GulperEel3"), 1f); diff --git a/NPCs/Abyss/GulperEelHead.cs b/NPCs/Abyss/GulperEelHead.cs index 1a43a13b37..82157438b9 100644 --- a/NPCs/Abyss/GulperEelHead.cs +++ b/NPCs/Abyss/GulperEelHead.cs @@ -16,7 +16,8 @@ namespace CalamityMod.NPCs.Abyss { public class GulperEelHead : ModNPC { - public bool detectsPlayer = false; + private Vector2 patrolSpot = Vector2.Zero; + public bool detectsPlayer = false; public const int minLength = 20; public const int maxLength = 21; public float speed = 5f; //10 @@ -55,13 +56,15 @@ namespace CalamityMod.NPCs.Abyss public override void SendExtraAI(BinaryWriter writer) { - writer.Write(detectsPlayer); + writer.WriteVector2(patrolSpot); + writer.Write(detectsPlayer); writer.Write(npc.chaseable); } public override void ReceiveExtraAI(BinaryReader reader) { - detectsPlayer = reader.ReadBoolean(); + patrolSpot = reader.ReadVector2(); + detectsPlayer = reader.ReadBoolean(); npc.chaseable = reader.ReadBoolean(); } @@ -138,23 +141,29 @@ namespace CalamityMod.NPCs.Abyss { npc.active = false; } + float num188 = speed; float num189 = turnSpeed; Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + + if (patrolSpot == Vector2.Zero) + patrolSpot = Main.player[npc.target].Center; + + float num191 = detectsPlayer ? Main.player[npc.target].Center.X : patrolSpot.X; + float num192 = detectsPlayer ? Main.player[npc.target].Center.Y : patrolSpot.Y; + if (!detectsPlayer) { num192 += 500; - if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) < 300f) + if (Math.Abs(npc.Center.X - num191) < 300f) //500 { if (npc.velocity.X > 0f) { - num191 = Main.player[npc.target].Center.X + 400f; + num191 += 400f; } else { - num191 = Main.player[npc.target].Center.X - 400f; + num191 -= 400f; } } } @@ -358,13 +367,13 @@ namespace CalamityMod.NPCs.Abyss { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 15; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/GulperEel"), 1f); } diff --git a/NPCs/Abyss/GulperEelTail.cs b/NPCs/Abyss/GulperEelTail.cs index ffa21aeb66..668c670a5a 100644 --- a/NPCs/Abyss/GulperEelTail.cs +++ b/NPCs/Abyss/GulperEelTail.cs @@ -151,13 +151,13 @@ namespace CalamityMod.NPCs.Abyss { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } Gore.NewGore(npc.Center, npc.velocity, mod.GetGoreSlot("Gores/GulperEel4"), 1f); } diff --git a/NPCs/Abyss/Laserfish.cs b/NPCs/Abyss/Laserfish.cs index 83f47b4147..3dd13f62f4 100644 --- a/NPCs/Abyss/Laserfish.cs +++ b/NPCs/Abyss/Laserfish.cs @@ -52,6 +52,9 @@ namespace CalamityMod.NPCs.Abyss public override void AI() { + // Setting this in SetDefaults will disable expert mode scaling, so put it here instead + npc.damage = 0; + CalamityAI.PassiveSwimmingAI(npc, mod, 0, Main.player[npc.target].Calamity().GetAbyssAggro(400f, 200f), 0.15f, 0.15f, 4f, 4f, 0.1f); } @@ -126,13 +129,13 @@ namespace CalamityMod.NPCs.Abyss { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 25; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Laserfish"), 1f); Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Laserfish2"), 1f); diff --git a/NPCs/Abyss/MirageJelly.cs b/NPCs/Abyss/MirageJelly.cs index 75c98426ea..656cd69964 100644 --- a/NPCs/Abyss/MirageJelly.cs +++ b/NPCs/Abyss/MirageJelly.cs @@ -213,7 +213,7 @@ namespace CalamityMod.NPCs.Abyss DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas && Main.expertMode, 2, 5, 7); DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 5 : 7); DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 5 : 7); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.hardMode, Main.expertMode ? 5 : 7, 1, 1); + DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 5 : 7); float necklaceDropRate = CalamityWorld.defiled ? DropHelper.DefiledDropRateFloat : 0.01f; DropHelper.DropItemChance(npc, ItemID.JellyfishNecklace, necklaceDropRate); } @@ -228,13 +228,13 @@ namespace CalamityMod.NPCs.Abyss { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 15; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/Abyss/MorayEel.cs b/NPCs/Abyss/MorayEel.cs index 2c184eece3..97d594c28d 100644 --- a/NPCs/Abyss/MorayEel.cs +++ b/NPCs/Abyss/MorayEel.cs @@ -97,13 +97,13 @@ namespace CalamityMod.NPCs.Abyss { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 25; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/Abyss/OarfishBody.cs b/NPCs/Abyss/OarfishBody.cs index 23560416c7..5daa4643a8 100644 --- a/NPCs/Abyss/OarfishBody.cs +++ b/NPCs/Abyss/OarfishBody.cs @@ -132,13 +132,13 @@ namespace CalamityMod.NPCs.Abyss { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/Abyss/OarfishHead.cs b/NPCs/Abyss/OarfishHead.cs index ff6e8c1e71..975bd8a055 100644 --- a/NPCs/Abyss/OarfishHead.cs +++ b/NPCs/Abyss/OarfishHead.cs @@ -14,6 +14,7 @@ namespace CalamityMod.NPCs.Abyss { public class OarfishHead : ModNPC { + private Vector2 patrolSpot = Vector2.Zero; public bool detectsPlayer = false; public const int minLength = 40; public const int maxLength = 41; @@ -53,12 +54,14 @@ namespace CalamityMod.NPCs.Abyss public override void SendExtraAI(BinaryWriter writer) { + writer.WriteVector2(patrolSpot); writer.Write(detectsPlayer); writer.Write(npc.chaseable); } public override void ReceiveExtraAI(BinaryReader reader) { + patrolSpot = reader.ReadVector2(); detectsPlayer = reader.ReadBoolean(); npc.chaseable = reader.ReadBoolean(); } @@ -127,23 +130,29 @@ namespace CalamityMod.NPCs.Abyss { npc.active = false; } + float num188 = speed; float num189 = turnSpeed; Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); - if (!detectsPlayer) + + if (patrolSpot == Vector2.Zero) + patrolSpot = Main.player[npc.target].Center; + + float num191 = detectsPlayer ? Main.player[npc.target].Center.X : patrolSpot.X; + float num192 = detectsPlayer ? Main.player[npc.target].Center.Y : patrolSpot.Y; + + if (!detectsPlayer) { - num192 += 300; - if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) < 250f) + num192 += 300; + if (Math.Abs(npc.Center.X - num191) < 250f) //500 { if (npc.velocity.X > 0f) { - num191 = Main.player[npc.target].Center.X + 300f; + num191 += 300f; } else { - num191 = Main.player[npc.target].Center.X - 300f; + num191 -= 300f; } } } @@ -322,13 +331,13 @@ namespace CalamityMod.NPCs.Abyss { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/Abyss/OarfishTail.cs b/NPCs/Abyss/OarfishTail.cs index 69628365d8..89a90fa4f0 100644 --- a/NPCs/Abyss/OarfishTail.cs +++ b/NPCs/Abyss/OarfishTail.cs @@ -133,13 +133,13 @@ namespace CalamityMod.NPCs.Abyss { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/Abyss/Reaper.cs b/NPCs/Abyss/Reaper.cs index 107942f748..0ab539d84a 100644 --- a/NPCs/Abyss/Reaper.cs +++ b/NPCs/Abyss/Reaper.cs @@ -44,7 +44,24 @@ namespace CalamityMod.NPCs.Abyss npc.buffImmune[k] = true; } npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; + npc.buffImmune[BuffID.Frostburn] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.buffImmune[BuffID.Daybreak] = false; + npc.buffImmune[BuffID.StardustMinionBleed] = false; + npc.buffImmune[BuffID.DryadsWardDebuff] = false; + npc.buffImmune[BuffID.Oiled] = false; + npc.buffImmune[BuffID.BetsysCurse] = false; + npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; npc.timeLeft = NPC.activeTime * 30; npc.value = Item.buyPrice(0, 25, 0, 0); npc.HitSound = SoundID.NPCHit56; @@ -675,13 +692,13 @@ namespace CalamityMod.NPCs.Abyss { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 40; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/Abyss/Viperfish.cs b/NPCs/Abyss/Viperfish.cs index 3103d0f344..d9340663aa 100644 --- a/NPCs/Abyss/Viperfish.cs +++ b/NPCs/Abyss/Viperfish.cs @@ -146,13 +146,13 @@ namespace CalamityMod.NPCs.Abyss { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 25; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ViperFish"), 1f); Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ViperFish2"), 1f); diff --git a/NPCs/AcidRain/AcidEel.cs b/NPCs/AcidRain/AcidEel.cs index 87ff598a0d..c64038ed8d 100644 --- a/NPCs/AcidRain/AcidEel.cs +++ b/NPCs/AcidRain/AcidEel.cs @@ -29,6 +29,7 @@ namespace CalamityMod.NPCs.AcidRain npc.damage = 20; npc.lifeMax = 100; npc.defense = 4; + npc.knockBackResist = 0.9f; if (CalamityWorld.downedPolterghast) { @@ -36,6 +37,7 @@ namespace CalamityMod.NPCs.AcidRain npc.damage = 120; npc.lifeMax = 5500; npc.defense = 45; + npc.knockBackResist = 0.7f; } else if (CalamityWorld.downedAquaticScourge) { @@ -43,7 +45,6 @@ namespace CalamityMod.NPCs.AcidRain npc.lifeMax = 705; } - npc.knockBackResist = 0f; npc.value = Item.buyPrice(0, 0, 3, 32); for (int k = 0; k < npc.buffImmune.Length; k++) { diff --git a/NPCs/AcidRain/FlakBaby.cs b/NPCs/AcidRain/FlakBaby.cs index 9328f77d17..c1726fb879 100644 --- a/NPCs/AcidRain/FlakBaby.cs +++ b/NPCs/AcidRain/FlakBaby.cs @@ -28,7 +28,6 @@ namespace CalamityMod.NPCs.AcidRain npc.lifeMax = 5; npc.defense = 5; - npc.knockBackResist = 0f; for (int k = 0; k < npc.buffImmune.Length; k++) { npc.buffImmune[k] = true; diff --git a/NPCs/AcidRain/FlakCrab.cs b/NPCs/AcidRain/FlakCrab.cs index 64a564d31d..c11372763b 100644 --- a/NPCs/AcidRain/FlakCrab.cs +++ b/NPCs/AcidRain/FlakCrab.cs @@ -81,6 +81,7 @@ namespace CalamityMod.NPCs.AcidRain if (npc.ai[0] < 300f) { npc.chaseable = false; + npc.knockBackResist = 0f; } if (Math.Abs(closest.Center.X - npc.Center.X) < 320f && closest.Center.Y - npc.Top.Y < -60f && @@ -103,8 +104,9 @@ namespace CalamityMod.NPCs.AcidRain npc.chaseable = true; if (npc.velocity.Y == 0f) { + npc.knockBackResist = 0.6f; npc.TargetClosest(true); - npc.velocity.X = npc.velocity.X * 0.85f; + npc.velocity.X *= 0.85f; npc.ai[2]++; float hopRate = 10f + 15f * (npc.life / (float)npc.lifeMax); float lungeForwardSpeed = 10f; @@ -129,7 +131,7 @@ namespace CalamityMod.NPCs.AcidRain } else { - npc.knockBackResist = 0f; + npc.knockBackResist = 0.2f; npc.velocity.X *= 0.995f; } } diff --git a/NPCs/AcidRain/GammaSlime.cs b/NPCs/AcidRain/GammaSlime.cs index ed361355c4..f5c6b234e3 100644 --- a/NPCs/AcidRain/GammaSlime.cs +++ b/NPCs/AcidRain/GammaSlime.cs @@ -41,7 +41,7 @@ namespace CalamityMod.NPCs.AcidRain npc.aiStyle = aiType = -1; npc.knockBackResist = 0f; - animationType = 81; + animationType = NPCID.CorruptSlime; for (int k = 0; k < npc.buffImmune.Length; k++) { npc.buffImmune[k] = true; @@ -76,7 +76,7 @@ namespace CalamityMod.NPCs.AcidRain Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.6f, 0.8f, 0.6f); npc.TargetClosest(false); Player player = Main.player[npc.target]; - if (npc.velocity.Y == 0f && npc.ai[3] <= 0f) + if (npc.velocity.Y == 0f && npc.ai[3] <= 0f && !player.npcTypeNoAggro[npc.type]) { npc.velocity.X *= 0.8f; if (npc.ai[0]++ >= 30f) @@ -164,7 +164,7 @@ namespace CalamityMod.NPCs.AcidRain if (Math.Abs(player.Center.X - npc.Center.X) < 250f && player.Center.X - npc.Center.X < 0f && npc.ai[3] == 0f && - Main.rand.NextBool(110)) + Main.rand.NextBool(110) && !player.npcTypeNoAggro[npc.type]) { npc.ai[3] = 600f; npc.netUpdate = true; diff --git a/NPCs/AcidRain/IrradiatedSlime.cs b/NPCs/AcidRain/IrradiatedSlime.cs index 82fc30c21d..2513fee920 100644 --- a/NPCs/AcidRain/IrradiatedSlime.cs +++ b/NPCs/AcidRain/IrradiatedSlime.cs @@ -29,7 +29,7 @@ namespace CalamityMod.NPCs.AcidRain npc.defense = 5; npc.knockBackResist = 0f; - animationType = 81; + animationType = NPCID.CorruptSlime; for (int k = 0; k < npc.buffImmune.Length; k++) { npc.buffImmune[k] = true; @@ -81,7 +81,7 @@ namespace CalamityMod.NPCs.AcidRain else { npc.aiStyle = 1; - aiType = 141; + aiType = NPCID.ToxicSludge; } } diff --git a/NPCs/AcidRain/NuclearToad.cs b/NPCs/AcidRain/NuclearToad.cs index c3c961341e..96de09bdc2 100644 --- a/NPCs/AcidRain/NuclearToad.cs +++ b/NPCs/AcidRain/NuclearToad.cs @@ -42,7 +42,7 @@ namespace CalamityMod.NPCs.AcidRain npc.lifeMax = 420; } - npc.knockBackResist = 0f; + npc.knockBackResist = 0.7f; npc.value = Item.buyPrice(0, 0, 5, 0); for (int k = 0; k < npc.buffImmune.Length; k++) { diff --git a/NPCs/AcidRain/Orthocera.cs b/NPCs/AcidRain/Orthocera.cs index 2a2d1b5c4b..a5667a3df9 100644 --- a/NPCs/AcidRain/Orthocera.cs +++ b/NPCs/AcidRain/Orthocera.cs @@ -39,7 +39,7 @@ namespace CalamityMod.NPCs.AcidRain npc.DR_NERD(0.35f); } - npc.knockBackResist = 0f; + npc.knockBackResist = 0.6f; for (int k = 0; k < npc.buffImmune.Length; k++) { npc.buffImmune[k] = true; @@ -192,7 +192,7 @@ namespace CalamityMod.NPCs.AcidRain 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); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/AcidRain/Skyfin.cs b/NPCs/AcidRain/Skyfin.cs index 8adcdb1bef..16f09e13ae 100644 --- a/NPCs/AcidRain/Skyfin.cs +++ b/NPCs/AcidRain/Skyfin.cs @@ -33,9 +33,11 @@ namespace CalamityMod.NPCs.AcidRain npc.damage = 12; npc.lifeMax = 150; npc.defense = 6; + npc.knockBackResist = 1f; if (CalamityWorld.downedPolterghast) { + npc.knockBackResist = 0.8f; npc.damage = 150; npc.lifeMax = 5001; npc.defense = 58; @@ -48,7 +50,6 @@ namespace CalamityMod.NPCs.AcidRain npc.DR_NERD(0.05f); } - npc.knockBackResist = 0f; npc.value = Item.buyPrice(0, 0, 3, 65); for (int k = 0; k < npc.buffImmune.Length; k++) { diff --git a/NPCs/AcidRain/SulfurousSkater.cs b/NPCs/AcidRain/SulfurousSkater.cs index 018bd4f27e..6698cbea48 100644 --- a/NPCs/AcidRain/SulfurousSkater.cs +++ b/NPCs/AcidRain/SulfurousSkater.cs @@ -47,10 +47,9 @@ namespace CalamityMod.NPCs.AcidRain npc.damage = 100; npc.lifeMax = 5000; npc.defense = 33; - npc.DR_NERD(0.15f); } - npc.knockBackResist = 0f; + npc.knockBackResist = 0.8f; npc.value = Item.buyPrice(0, 0, 5, 25); for (int k = 0; k < npc.buffImmune.Length; k++) { @@ -72,7 +71,8 @@ namespace CalamityMod.NPCs.AcidRain Player player = Main.player[npc.target]; if (!Flying) { - npc.Calamity().DR = 0.35f; + npc.knockBackResist = 0.8f; + npc.DR_NERD(0.35f); npc.noGravity = false; float minimumDistance = float.PositiveInfinity; Projectile closestBubble = null; @@ -149,7 +149,8 @@ namespace CalamityMod.NPCs.AcidRain } else { - npc.Calamity().DR = 0f; + npc.knockBackResist = 0.5f; + npc.DR_NERD(0f); float speed = CalamityWorld.downedPolterghast ? 17f : 14f; float inertia = CalamityWorld.downedPolterghast ? 20f : 24.5f; if (npc.Distance(player.Center) < 200f) diff --git a/NPCs/AcidRain/Trilobite.cs b/NPCs/AcidRain/Trilobite.cs index 5063cdb640..2a283f81c3 100644 --- a/NPCs/AcidRain/Trilobite.cs +++ b/NPCs/AcidRain/Trilobite.cs @@ -44,7 +44,7 @@ namespace CalamityMod.NPCs.AcidRain npc.DR_NERD(0.4f); } - npc.knockBackResist = 0f; + npc.knockBackResist = 0.2f; npc.value = Item.buyPrice(0, 0, 4, 0); for (int k = 0; k < npc.buffImmune.Length; k++) { diff --git a/NPCs/AcidRain/WaterLeech.cs b/NPCs/AcidRain/WaterLeech.cs index d11b3cd218..b993de950c 100644 --- a/NPCs/AcidRain/WaterLeech.cs +++ b/NPCs/AcidRain/WaterLeech.cs @@ -42,7 +42,6 @@ namespace CalamityMod.NPCs.AcidRain npc.lifeMax = 320; } - npc.knockBackResist = 0f; npc.value = Item.buyPrice(0, 0, 2, 5); for (int k = 0; k < npc.buffImmune.Length; k++) { diff --git a/NPCs/AquaticScourge/AquaticParasite.cs b/NPCs/AquaticScourge/AquaticParasite.cs index b2ea5db3d1..68d7d4ad19 100644 --- a/NPCs/AquaticScourge/AquaticParasite.cs +++ b/NPCs/AquaticScourge/AquaticParasite.cs @@ -204,13 +204,13 @@ namespace CalamityMod.NPCs.AquaticScourge { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 15; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } Gore.NewGore(npc.Center, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/AquaticParasite1"), 1f); Gore.NewGore(npc.Center, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/AquaticParasite2"), 1f); diff --git a/NPCs/AquaticScourge/AquaticScourgeBody.cs b/NPCs/AquaticScourge/AquaticScourgeBody.cs index 237bdcca83..57478d54b2 100644 --- a/NPCs/AquaticScourge/AquaticScourgeBody.cs +++ b/NPCs/AquaticScourge/AquaticScourgeBody.cs @@ -1,3 +1,4 @@ +using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -39,11 +40,14 @@ namespace CalamityMod.NPCs.AquaticScourge npc.dontCountMe = true; npc.chaseable = false; npc.canGhostHeal = false; - if (Main.expertMode) - { - npc.scale = 1.15f; - } - } + + if (CalamityWorld.death || CalamityWorld.bossRushActive) + npc.scale = 1.2f; + else if (CalamityWorld.revenge) + npc.scale = 1.15f; + else if (Main.expertMode) + npc.scale = 1.1f; + } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) { @@ -84,13 +88,13 @@ namespace CalamityMod.NPCs.AquaticScourge { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/ASBody"), 1f); Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/ASBody2"), 1f); diff --git a/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs b/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs index db1ce4db78..7c757d090d 100644 --- a/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs +++ b/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs @@ -1,3 +1,4 @@ +using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -39,11 +40,14 @@ namespace CalamityMod.NPCs.AquaticScourge npc.dontCountMe = true; npc.chaseable = false; npc.canGhostHeal = false; - if (Main.expertMode) - { - npc.scale = 1.15f; - } - } + + if (CalamityWorld.death || CalamityWorld.bossRushActive) + npc.scale = 1.2f; + else if (CalamityWorld.revenge) + npc.scale = 1.15f; + else if (Main.expertMode) + npc.scale = 1.1f; + } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) { @@ -84,13 +88,13 @@ namespace CalamityMod.NPCs.AquaticScourge { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/ASBodyAlt"), 1f); Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/ASBodyAlt2"), 1f); diff --git a/NPCs/AquaticScourge/AquaticScourgeHead.cs b/NPCs/AquaticScourge/AquaticScourgeHead.cs index 31c51f86e8..61f704b9e1 100644 --- a/NPCs/AquaticScourge/AquaticScourgeHead.cs +++ b/NPCs/AquaticScourge/AquaticScourgeHead.cs @@ -35,7 +35,7 @@ namespace CalamityMod.NPCs.AquaticScourge { npc.npcSlots = 16f; npc.damage = 80; - npc.width = 100; + npc.width = 90; npc.height = 90; npc.defense = 10; npc.DR_NERD(0.1f); @@ -57,10 +57,13 @@ namespace CalamityMod.NPCs.AquaticScourge npc.DeathSound = SoundID.NPCDeath1; npc.netAlways = true; bossBag = ModContent.ItemType(); - if (Main.expertMode) - { - npc.scale = 1.15f; - } + + if (CalamityWorld.death || CalamityWorld.bossRushActive) + npc.scale = 1.2f; + else if (CalamityWorld.revenge) + npc.scale = 1.15f; + else if (Main.expertMode) + npc.scale = 1.1f; } public override void SendExtraAI(BinaryWriter writer) @@ -233,13 +236,13 @@ namespace CalamityMod.NPCs.AquaticScourge { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 15; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/ASHead"), 1f); } @@ -251,22 +254,6 @@ namespace CalamityMod.NPCs.AquaticScourge { return false; } - if (npc.timeLeft <= 0 && Main.netMode != NetmodeID.MultiplayerClient) - { - for (int k = (int)npc.ai[0]; k > 0; k = (int)Main.npc[k].ai[0]) - { - if (Main.npc[k].active) - { - Main.npc[k].active = false; - if (Main.netMode == NetmodeID.Server) - { - Main.npc[k].life = 0; - Main.npc[k].netSkip = -1; - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, k, 0f, 0f, 0f, 0, 0, 0); - } - } - } - } return true; } diff --git a/NPCs/AquaticScourge/AquaticScourgeTail.cs b/NPCs/AquaticScourge/AquaticScourgeTail.cs index e391290aae..e7e675c560 100644 --- a/NPCs/AquaticScourge/AquaticScourgeTail.cs +++ b/NPCs/AquaticScourge/AquaticScourgeTail.cs @@ -1,3 +1,4 @@ +using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -15,8 +16,8 @@ namespace CalamityMod.NPCs.AquaticScourge public override void SetDefaults() { npc.damage = 45; - npc.width = 30; - npc.height = 50; + npc.width = 32; + npc.height = 32; npc.defense = 25; npc.DR_NERD(0.15f); npc.aiStyle = -1; @@ -39,11 +40,14 @@ namespace CalamityMod.NPCs.AquaticScourge npc.dontCountMe = true; npc.chaseable = false; npc.canGhostHeal = false; - if (Main.expertMode) - { - npc.scale = 1.15f; - } - } + + if (CalamityWorld.death || CalamityWorld.bossRushActive) + npc.scale = 1.2f; + else if (CalamityWorld.revenge) + npc.scale = 1.15f; + else if (Main.expertMode) + npc.scale = 1.1f; + } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) { @@ -84,13 +88,13 @@ namespace CalamityMod.NPCs.AquaticScourge { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/ASTail"), 1f); Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/ASTail2"), 1f); diff --git a/NPCs/AquaticScourge/AquaticScourgeTail.png b/NPCs/AquaticScourge/AquaticScourgeTail.png index 93fe7cd462..c6f723a2a0 100644 Binary files a/NPCs/AquaticScourge/AquaticScourgeTail.png and b/NPCs/AquaticScourge/AquaticScourgeTail.png differ diff --git a/NPCs/AquaticScourge/AquaticSeekerBody.cs b/NPCs/AquaticScourge/AquaticSeekerBody.cs index 35c59407be..54053ab9de 100644 --- a/NPCs/AquaticScourge/AquaticSeekerBody.cs +++ b/NPCs/AquaticScourge/AquaticSeekerBody.cs @@ -153,13 +153,13 @@ namespace CalamityMod.NPCs.AquaticScourge { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/AquaticSeekerBody"), 1f); } diff --git a/NPCs/AquaticScourge/AquaticSeekerHead.cs b/NPCs/AquaticScourge/AquaticSeekerHead.cs index 58d420a3d8..812a0741fe 100644 --- a/NPCs/AquaticScourge/AquaticSeekerHead.cs +++ b/NPCs/AquaticScourge/AquaticSeekerHead.cs @@ -272,13 +272,13 @@ namespace CalamityMod.NPCs.AquaticScourge { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/AquaticSeekerHead"), 1f); } diff --git a/NPCs/AquaticScourge/AquaticSeekerTail.cs b/NPCs/AquaticScourge/AquaticSeekerTail.cs index 5a18e0422a..cafbb6386b 100644 --- a/NPCs/AquaticScourge/AquaticSeekerTail.cs +++ b/NPCs/AquaticScourge/AquaticSeekerTail.cs @@ -153,13 +153,13 @@ namespace CalamityMod.NPCs.AquaticScourge { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/AquaticSeekerTail"), 1f); } diff --git a/NPCs/AquaticScourge/AquaticUrchin.cs b/NPCs/AquaticScourge/AquaticUrchin.cs index f301bfa362..a2adc34731 100644 --- a/NPCs/AquaticScourge/AquaticUrchin.cs +++ b/NPCs/AquaticScourge/AquaticUrchin.cs @@ -72,13 +72,13 @@ namespace CalamityMod.NPCs.AquaticScourge { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/AquaticUrchin"), 1f); Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/AquaticUrchin2"), 1f); diff --git a/NPCs/Astral/Aries.cs b/NPCs/Astral/Aries.cs index e27be4a2be..7411eedc31 100644 --- a/NPCs/Astral/Aries.cs +++ b/NPCs/Astral/Aries.cs @@ -102,7 +102,7 @@ namespace CalamityMod.NPCs.Astral public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.PillarZone()) + if (CalamityGlobalNPC.AnyEvents(spawnInfo.player)) { return 0f; } diff --git a/NPCs/Astral/AstralProbe.cs b/NPCs/Astral/AstralProbe.cs index e6f1003bd7..89cc96864f 100644 --- a/NPCs/Astral/AstralProbe.cs +++ b/NPCs/Astral/AstralProbe.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; using CalamityMod.World; @@ -47,7 +48,10 @@ namespace CalamityMod.NPCs.Astral public override void AI() { - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + // Setting this in SetDefaults will disable expert mode scaling, so put it here instead + npc.damage = 0; + + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) { npc.TargetClosest(true); } @@ -139,7 +143,7 @@ namespace CalamityMod.NPCs.Astral if (CalamityWorld.downedAstrageldon) num8 += 6; - int num9 = 84; + int num9 = ProjectileID.PinkLaser; Projectile.NewProjectile(vector.X, vector.Y, num4, num5, num9, num8, 0f, Main.myPlayer, 0f, 0f); } } @@ -250,59 +254,28 @@ namespace CalamityMod.NPCs.Astral if (npc.life <= 0) { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.width = 30; - npc.height = 30; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - for (int num621 = 0; num621 < 5; num621++) + npc.position = npc.Center; + npc.width = npc.height = 30; + npc.Center = npc.position; + for (int d = 0; d < 5; d++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int purple = Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); + Main.dust[purple].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; + Main.dust[purple].scale = 0.5f; + Main.dust[purple].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 10; num623++) + for (int d = 0; d < 10; d++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - for (int num625 = 0; num625 < 3; num625++) - { - float scaleFactor10 = 0.33f; - if (num625 == 1) - { - scaleFactor10 = 0.66f; - } - if (num625 == 2) - { - scaleFactor10 = 1f; - } - int num626 = Gore.NewGore(new Vector2(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.height / 2) - 24f), default, 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(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.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(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.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(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X -= 1f; - gore.velocity.Y -= 1f; + int cosmos = Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 3f); + Main.dust[cosmos].noGravity = true; + Main.dust[cosmos].velocity *= 5f; + cosmos = Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); + Main.dust[cosmos].velocity *= 2f; } + CalamityUtils.ExplosionGores(npc.Center, 3); } } @@ -320,7 +293,7 @@ namespace CalamityMod.NPCs.Astral public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.PillarZone()) + if (CalamityGlobalNPC.AnyEvents(spawnInfo.player)) { return 0f; } diff --git a/NPCs/Astral/AstralSlime.cs b/NPCs/Astral/AstralSlime.cs index 1dd8067b76..823eeb5d01 100644 --- a/NPCs/Astral/AstralSlime.cs +++ b/NPCs/Astral/AstralSlime.cs @@ -62,7 +62,7 @@ namespace CalamityMod.NPCs.Astral public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.PillarZone()) + if (CalamityGlobalNPC.AnyEvents(spawnInfo.player)) { return 0f; } diff --git a/NPCs/Astral/AstralachneaGround.cs b/NPCs/Astral/AstralachneaGround.cs index 3cea4ff667..caf087f35e 100644 --- a/NPCs/Astral/AstralachneaGround.cs +++ b/NPCs/Astral/AstralachneaGround.cs @@ -41,13 +41,13 @@ namespace CalamityMod.NPCs.Astral npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstralEnemyDeath"); npc.knockBackResist = 0.38f; npc.value = Item.buyPrice(0, 0, 20, 0); - npc.buffImmune[20] = true; - npc.buffImmune[31] = false; npc.timeLeft = NPC.activeTime * 2; animationType = NPCID.WallCreeper; banner = npc.type; bannerItem = ModContent.ItemType(); npc.buffImmune[ModContent.BuffType()] = true; + npc.buffImmune[BuffID.Poisoned] = true; + npc.buffImmune[BuffID.Confused] = false; if (CalamityWorld.downedAstrageldon) { npc.damage = 90; @@ -148,7 +148,7 @@ namespace CalamityMod.NPCs.Astral public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.PillarZone()) + if (CalamityGlobalNPC.AnyEvents(spawnInfo.player)) { return 0f; } diff --git a/NPCs/Astral/AstralachneaWall.cs b/NPCs/Astral/AstralachneaWall.cs index c3a3cb7d01..3984620567 100644 --- a/NPCs/Astral/AstralachneaWall.cs +++ b/NPCs/Astral/AstralachneaWall.cs @@ -42,8 +42,8 @@ namespace CalamityMod.NPCs.Astral npc.knockBackResist = 0f; npc.noGravity = true; npc.value = Item.buyPrice(0, 0, 20, 0); - npc.buffImmune[20] = true; - npc.buffImmune[31] = false; + npc.buffImmune[BuffID.Poisoned] = true; + npc.buffImmune[BuffID.Confused] = false; npc.timeLeft = NPC.activeTime * 2; animationType = NPCID.BlackRecluseWall; banner = ModContent.NPCType(); diff --git a/NPCs/Astral/Atlas.cs b/NPCs/Astral/Atlas.cs index 3ce951f053..4e58b5c791 100644 --- a/NPCs/Astral/Atlas.cs +++ b/NPCs/Astral/Atlas.cs @@ -610,7 +610,7 @@ namespace CalamityMod.NPCs.Astral public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.PillarZone()) + if (CalamityGlobalNPC.AnyEvents(spawnInfo.player)) { return 0f; } @@ -635,8 +635,9 @@ namespace CalamityMod.NPCs.Astral int minStardust = Main.expertMode ? 7 : 6; int maxStardust = Main.expertMode ? 9 : 8; DropHelper.DropItem(npc, ModContent.ItemType(), minStardust, maxStardust); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedAstrageldon, 7, 1, 1); - //not guarantee to prevent inventory spam + DropHelper.DropItem(npc, ModContent.ItemType()); } } } diff --git a/NPCs/Astral/BigSightseer.cs b/NPCs/Astral/BigSightseer.cs index 5c6552fa6c..918c76f0b6 100644 --- a/NPCs/Astral/BigSightseer.cs +++ b/NPCs/Astral/BigSightseer.cs @@ -147,8 +147,7 @@ namespace CalamityMod.NPCs.Astral public override float SpawnChance(NPCSpawnInfo spawnInfo) { - Tile tile = Main.tile[spawnInfo.spawnTileX, spawnInfo.spawnTileY]; - if (spawnInfo.player.PillarZone()) + if (CalamityGlobalNPC.AnyEvents(spawnInfo.player)) { return 0f; } diff --git a/NPCs/Astral/EnchantedNightcrawler.cs b/NPCs/Astral/EnchantedNightcrawler.cs index 944a68c4a8..99cb60152e 100644 --- a/NPCs/Astral/EnchantedNightcrawler.cs +++ b/NPCs/Astral/EnchantedNightcrawler.cs @@ -38,7 +38,7 @@ namespace CalamityMod.NPCs.Astral public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.PillarZone()) + if (CalamityGlobalNPC.AnyEvents(spawnInfo.player)) { return 0f; } diff --git a/NPCs/Astral/FusionFeeder.cs b/NPCs/Astral/FusionFeeder.cs index 1e7216d85b..0e724cb04e 100644 --- a/NPCs/Astral/FusionFeeder.cs +++ b/NPCs/Astral/FusionFeeder.cs @@ -109,7 +109,7 @@ namespace CalamityMod.NPCs.Astral public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.PillarZone()) + if (CalamityGlobalNPC.AnyEvents(spawnInfo.player)) { return 0f; } diff --git a/NPCs/Astral/Hadarian.cs b/NPCs/Astral/Hadarian.cs index 2cc7eb6e38..7e5b6ccbb6 100644 --- a/NPCs/Astral/Hadarian.cs +++ b/NPCs/Astral/Hadarian.cs @@ -183,7 +183,7 @@ namespace CalamityMod.NPCs.Astral public override float SpawnChance(NPCSpawnInfo spawnInfo) { Tile tile = Main.tile[spawnInfo.spawnTileX, spawnInfo.spawnTileY]; - if (spawnInfo.player.PillarZone()) + if (CalamityGlobalNPC.AnyEvents(spawnInfo.player)) { return 0f; } diff --git a/NPCs/Astral/Hive.cs b/NPCs/Astral/Hive.cs index c5566554ff..23fe7877e6 100644 --- a/NPCs/Astral/Hive.cs +++ b/NPCs/Astral/Hive.cs @@ -121,13 +121,7 @@ namespace CalamityMod.NPCs.Astral public override float SpawnChance(NPCSpawnInfo spawnInfo) { - //only 1 hive possible. - bool anyHives = NPC.CountNPCS(npc.type) > 0; - if (anyHives) - return 0f; - - Tile tile = Main.tile[spawnInfo.spawnTileX, spawnInfo.spawnTileY]; - if (spawnInfo.player.PillarZone()) + if (CalamityGlobalNPC.AnyEvents(spawnInfo.player) || NPC.AnyNPCs(npc.type)) { return 0f; } diff --git a/NPCs/Astral/Mantis.cs b/NPCs/Astral/Mantis.cs index 6a54edbd3c..ade6f8e031 100644 --- a/NPCs/Astral/Mantis.cs +++ b/NPCs/Astral/Mantis.cs @@ -64,39 +64,31 @@ namespace CalamityMod.NPCs.Astral { npc.velocity.X -= acceleration; if (npc.velocity.X > 0) - { npc.velocity.X -= acceleration; - } if (npc.velocity.X < -maxSpeed) - { npc.velocity.X = -maxSpeed; - } } else { npc.velocity.X += acceleration; if (npc.velocity.X < 0) - { npc.velocity.X += acceleration; - } if (npc.velocity.X > maxSpeed) - { npc.velocity.X = maxSpeed; - } } //if need to jump if (npc.velocity.Y == 0f && (HoleBelow() || (npc.collideX && npc.position.X == npc.oldPosition.X))) { - npc.velocity.Y = (CalamityWorld.death ? -7f : -5f); + npc.velocity.Y = CalamityWorld.death ? -7f : -5f; } //check if we can shoot at target. Vector2 vector = npc.Center - target.Center; - if (Math.Abs(vector.Y) < 64f && Math.Abs(vector.X) < 540f && Collision.CanHit(npc.position, npc.width, npc.height, target.position, target.width, target.height)) + if (vector.Length() < 480f && Collision.CanHit(npc.position, npc.width, npc.height, target.position, target.width, target.height)) { - npc.ai[1]++; - if (npc.ai[1] > (CalamityWorld.death ? 60f : 120f)) + npc.ai[1] += 1f; + if (npc.ai[1] >= (CalamityWorld.death ? 60f : 120f)) { //fire projectile npc.ai[0] = 1f; @@ -106,29 +98,24 @@ namespace CalamityMod.NPCs.Astral } } else - { npc.ai[1] -= 0.5f; - } if (npc.justHit) - { npc.ai[1] -= 60f; - } - if (npc.ai[1] < 0f) npc.ai[1] = 0f; } else { - npc.ai[2]++; + npc.ai[2] += 1f; npc.velocity.X *= 0.95f; - if (npc.ai[2] == 25f) + if (npc.ai[2] == 20f) //Don't do >= 20f or it'll cause a wave of scythes { Main.PlaySound(SoundID.Item71, npc.position); Vector2 vector = Main.player[npc.target].Center - npc.Center; vector.Normalize(); - int damage = CalamityWorld.downedAstrageldon ? 45 : 55; + int damage = CalamityWorld.downedAstrageldon ? 55 : 45; Projectile.NewProjectile(npc.Center + (npc.Center.X < target.Center.X ? -14f : 14f) * Vector2.UnitX, vector * 7f, ModContent.ProjectileType(), damage, 0f); } } @@ -230,7 +217,7 @@ namespace CalamityMod.NPCs.Astral public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.PillarZone()) + if (CalamityGlobalNPC.AnyEvents(spawnInfo.player)) { return 0f; } diff --git a/NPCs/Astral/Nova.cs b/NPCs/Astral/Nova.cs index 2cd1f5bd17..04ab9247a6 100644 --- a/NPCs/Astral/Nova.cs +++ b/NPCs/Astral/Nova.cs @@ -262,7 +262,7 @@ namespace CalamityMod.NPCs.Astral public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.PillarZone()) + if (CalamityGlobalNPC.AnyEvents(spawnInfo.player)) { return 0f; } diff --git a/NPCs/Astral/SmallSightseer.cs b/NPCs/Astral/SmallSightseer.cs index b16d5068ce..e8f6cfc624 100644 --- a/NPCs/Astral/SmallSightseer.cs +++ b/NPCs/Astral/SmallSightseer.cs @@ -114,8 +114,7 @@ namespace CalamityMod.NPCs.Astral public override float SpawnChance(NPCSpawnInfo spawnInfo) { - Tile tile = Main.tile[spawnInfo.spawnTileX, spawnInfo.spawnTileY]; - if (spawnInfo.player.PillarZone()) + if (CalamityGlobalNPC.AnyEvents(spawnInfo.player)) { return 0f; } diff --git a/NPCs/Astral/StellarCulex.cs b/NPCs/Astral/StellarCulex.cs index d2dd20c242..69e8bc6c7a 100644 --- a/NPCs/Astral/StellarCulex.cs +++ b/NPCs/Astral/StellarCulex.cs @@ -38,11 +38,11 @@ namespace CalamityMod.NPCs.Astral npc.lifeMax = 210; npc.value = Item.buyPrice(0, 0, 10, 0); npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstralEnemyDeath"); - npc.buffImmune[31] = false; animationType = NPCID.GiantFlyingFox; banner = npc.type; bannerItem = ModContent.ItemType(); npc.buffImmune[ModContent.BuffType()] = true; + npc.buffImmune[BuffID.Confused] = false; if (CalamityWorld.downedAstrageldon) { npc.damage = 90; @@ -102,7 +102,7 @@ namespace CalamityMod.NPCs.Astral public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.PillarZone()) + if (CalamityGlobalNPC.AnyEvents(spawnInfo.player)) { return 0f; } diff --git a/NPCs/Astral/Twinkler.cs b/NPCs/Astral/Twinkler.cs index 506f616ee7..1cc77dad77 100644 --- a/NPCs/Astral/Twinkler.cs +++ b/NPCs/Astral/Twinkler.cs @@ -27,7 +27,7 @@ namespace CalamityMod.NPCs.Astral npc.catchItem = (short)ModContent.ItemType(); npc.friendly = true; // prevents critter from getting slagged //banner = npc.type; - //bannerItem = ModContent.ItemType(); + //bannerItem = ModContent.ItemType(); } public override bool? CanBeHitByItem(Player player, Item item) => true; @@ -56,7 +56,7 @@ namespace CalamityMod.NPCs.Astral public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.PillarZone()) + if (CalamityGlobalNPC.AnyEvents(spawnInfo.player)) { return 0f; } diff --git a/NPCs/AstrumAureus/AstrumAureus.cs b/NPCs/AstrumAureus/AstrumAureus.cs index c306f05f51..5e04094fc7 100644 --- a/NPCs/AstrumAureus/AstrumAureus.cs +++ b/NPCs/AstrumAureus/AstrumAureus.cs @@ -74,6 +74,7 @@ namespace CalamityMod.NPCs.AstrumAureus npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; @@ -409,7 +410,7 @@ namespace CalamityMod.NPCs.AstrumAureus for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 173, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { @@ -421,7 +422,7 @@ namespace CalamityMod.NPCs.AstrumAureus npc.position.Y = npc.position.Y - (float)(npc.height / 2); for (int num621 = 0; num621 < 50; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { diff --git a/NPCs/AstrumDeus/AstrumDeusBodySpectral.cs b/NPCs/AstrumDeus/AstrumDeusBodySpectral.cs index b5359096a3..123179660e 100644 --- a/NPCs/AstrumDeus/AstrumDeusBodySpectral.cs +++ b/NPCs/AstrumDeus/AstrumDeusBodySpectral.cs @@ -170,7 +170,7 @@ namespace CalamityMod.NPCs.AstrumDeus npc.position.Y = npc.position.Y - (npc.height / 2); for (int num621 = 0; num621 < 5; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { diff --git a/NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs b/NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs index 027f0b42a3..0e01c811ab 100644 --- a/NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs +++ b/NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs @@ -4,6 +4,7 @@ using CalamityMod.Items.Accessories; using CalamityMod.Items.Armor.Vanity; using CalamityMod.Items.LoreItems; using CalamityMod.Items.Materials; +using CalamityMod.Items.Pets; using CalamityMod.Items.Placeables.Furniture.Trophies; using CalamityMod.Items.TreasureBags; using CalamityMod.Items.Weapons.Melee; @@ -165,7 +166,7 @@ namespace CalamityMod.NPCs.AstrumDeus npc.position.Y = npc.position.Y - (npc.height / 2); for (int num621 = 0; num621 < 5; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -186,12 +187,18 @@ namespace CalamityMod.NPCs.AstrumDeus public override void BossLoot(ref string name, ref int potionType) { + if (npc.Calamity().newAI[0] == 0f) + return; + potionType = ModContent.ItemType(); } public override bool SpecialNPCLoot() { - int closestSegmentID = DropHelper.FindClosestWormSegment(npc, + if (npc.Calamity().newAI[0] == 0f) + return false; + + int closestSegmentID = DropHelper.FindClosestWormSegment(npc, ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType()); @@ -201,7 +208,10 @@ namespace CalamityMod.NPCs.AstrumDeus public override void NPCLoot() { - DropHelper.DropBags(npc); + if (npc.Calamity().newAI[0] == 0f) + return; + + DropHelper.DropBags(npc); DropHelper.DropItem(npc, ItemID.GreaterHealingPotion, 8, 14); DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); @@ -233,6 +243,7 @@ namespace CalamityMod.NPCs.AstrumDeus // Equipment DropHelper.DropItemChance(npc, ModContent.ItemType(), DropHelper.RareVariantDropRateInt); + DropHelper.DropItemChance(npc, ModContent.ItemType(), 5); // Vanity DropHelper.DropItemChance(npc, ModContent.ItemType(), 7); diff --git a/NPCs/AstrumDeus/AstrumDeusTailSpectral.cs b/NPCs/AstrumDeus/AstrumDeusTailSpectral.cs index 0920f9585f..8b9ec2618a 100644 --- a/NPCs/AstrumDeus/AstrumDeusTailSpectral.cs +++ b/NPCs/AstrumDeus/AstrumDeusTailSpectral.cs @@ -147,7 +147,7 @@ namespace CalamityMod.NPCs.AstrumDeus npc.position.Y = npc.position.Y - (npc.height / 2); for (int num621 = 0; num621 < 5; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { diff --git a/NPCs/BrimstoneElemental/Brimling.cs b/NPCs/BrimstoneElemental/Brimling.cs index f3256cbe44..6393cead33 100644 --- a/NPCs/BrimstoneElemental/Brimling.cs +++ b/NPCs/BrimstoneElemental/Brimling.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -47,6 +48,7 @@ namespace CalamityMod.NPCs.BrimstoneElemental npc.buffImmune[BuffID.StardustMinionBleed] = false; npc.buffImmune[BuffID.DryadsWardDebuff] = false; npc.buffImmune[BuffID.Oiled] = false; + npc.buffImmune[BuffID.BoneJavelin] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; @@ -56,8 +58,10 @@ namespace CalamityMod.NPCs.BrimstoneElemental npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; npc.noGravity = true; npc.noTileCollide = true; npc.canGhostHeal = false; @@ -271,13 +275,13 @@ namespace CalamityMod.NPCs.BrimstoneElemental { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Brimstone, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 235, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Brimstone, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/BrimstoneElemental/BrimstoneElemental.cs b/NPCs/BrimstoneElemental/BrimstoneElemental.cs index 53fd072e5b..4e9be7f37f 100644 --- a/NPCs/BrimstoneElemental/BrimstoneElemental.cs +++ b/NPCs/BrimstoneElemental/BrimstoneElemental.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; using CalamityMod.Items.Accessories; using CalamityMod.Items.Armor.Vanity; using CalamityMod.Items.LoreItems; @@ -73,6 +74,7 @@ namespace CalamityMod.NPCs.BrimstoneElemental npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; @@ -239,7 +241,7 @@ namespace CalamityMod.NPCs.BrimstoneElemental npc.position.Y = npc.position.Y - (float)(npc.height / 2); for (int num621 = 0; num621 < 40; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -249,10 +251,10 @@ namespace CalamityMod.NPCs.BrimstoneElemental } for (int num623 = 0; num623 < 60; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } float randomSpread = (float)(Main.rand.Next(-200, 200) / 100); diff --git a/NPCs/Bumblebirb/Bumblefuck.cs b/NPCs/Bumblebirb/Bumblefuck.cs index bbbc92f96d..a4f9598b73 100644 --- a/NPCs/Bumblebirb/Bumblefuck.cs +++ b/NPCs/Bumblebirb/Bumblefuck.cs @@ -68,6 +68,7 @@ namespace CalamityMod.NPCs.Bumblebirb npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.boss = true; @@ -88,12 +89,18 @@ namespace CalamityMod.NPCs.Bumblebirb { writer.Write(npc.dontTakeDamage); writer.Write(npc.localAI[0]); + writer.Write(npc.localAI[1]); + writer.Write(npc.localAI[2]); + writer.Write(npc.localAI[3]); } public override void ReceiveExtraAI(BinaryReader reader) { npc.dontTakeDamage = reader.ReadBoolean(); npc.localAI[0] = reader.ReadSingle(); + npc.localAI[1] = reader.ReadSingle(); + npc.localAI[2] = reader.ReadSingle(); + npc.localAI[3] = reader.ReadSingle(); } public override void AI() @@ -115,21 +122,22 @@ namespace CalamityMod.NPCs.Bumblebirb bool death = CalamityWorld.death || CalamityWorld.bossRushActive; // Percent life remaining - float lifeRatio = (float)npc.life / (float)npc.lifeMax; + float lifeRatio = npc.life / (float)npc.lifeMax; // Phases bool phase2 = lifeRatio < (revenge ? 0.75f : 0.5f) || death; bool phase3 = lifeRatio < (death ? 0.4f : revenge ? 0.25f : 0.1f); + bool birbSpawn = npc.ai[0] == 4f && npc.ai[1] > 0f; float newPhaseTimer = 180f; bool phaseSwitchPhase = (phase2 && calamityGlobalNPC.newAI[0] < newPhaseTimer && calamityGlobalNPC.newAI[2] != 1f) || (phase3 && calamityGlobalNPC.newAI[1] < newPhaseTimer && calamityGlobalNPC.newAI[3] != 1f); - if (phaseSwitchPhase) + if (phaseSwitchPhase || birbSpawn) { - float frameGateValue = phase3 ? calamityGlobalNPC.newAI[1] : calamityGlobalNPC.newAI[0]; + float frameGateValue = birbSpawn ? npc.ai[1] : phase3 ? calamityGlobalNPC.newAI[1] : calamityGlobalNPC.newAI[0]; int num116 = 180; - if (frameGateValue < (float)(num116 - 60) || frameGateValue > (float)(num116 - 20)) + if (frameGateValue < (num116 - 60) || frameGateValue > (num116 - 20)) { npc.frameCounter += 1D; if (npc.frameCounter > 5D) @@ -145,7 +153,7 @@ namespace CalamityMod.NPCs.Bumblebirb else { npc.frame.Y = frameHeight * 4; - if (frameGateValue > (float)(num116 - 50) && frameGateValue < (float)(num116 - 25)) + if (frameGateValue > (num116 - 50) && frameGateValue < (num116 - 25)) { npc.frame.Y = frameHeight * 5; } @@ -154,7 +162,7 @@ namespace CalamityMod.NPCs.Bumblebirb else if (npc.ai[0] == 5f) { int num115 = 120; - if (npc.ai[1] < (float)(num115 - 50) || npc.ai[1] > (float)(num115 - 10)) + if (npc.ai[1] < (num115 - 50) || npc.ai[1] > (num115 - 10)) { npc.frameCounter += 1D; if (npc.frameCounter > 5D) @@ -170,7 +178,7 @@ namespace CalamityMod.NPCs.Bumblebirb else { npc.frame.Y = frameHeight * 4; - if (npc.ai[1] > (float)(num115 - 40) && npc.ai[1] < (float)(num115 - 15)) + if (npc.ai[1] > (num115 - 40) && npc.ai[1] < (num115 - 15)) { npc.frame.Y = frameHeight * 5; } @@ -415,7 +423,7 @@ namespace CalamityMod.NPCs.Bumblebirb if (!Main.expertMode) { // Materials - DropHelper.DropItemSpray(npc, ModContent.ItemType(), 6, 11); + DropHelper.DropItemSpray(npc, ModContent.ItemType(), 11, 17); // Weapons DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); @@ -456,7 +464,7 @@ namespace CalamityMod.NPCs.Bumblebirb for (int i = 0; i < 6; i++) // 1 head, 1 wing, 4 legs = 6. one wing due to them being chonky boyes now { string gore = "Gores/Bumble"; - float randomSpread = (float)(Main.rand.Next(-200, 200) / 100); + float randomSpread = Main.rand.Next(-200, 201) / 100f; gore += i == 0 ? "Head" : i > 1 ? "Leg" : "Wing"; Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot(gore), 1f); } diff --git a/NPCs/Bumblebirb/Bumblefuck2.cs b/NPCs/Bumblebirb/Bumblefuck2.cs index 5b55047eb6..b297c15e81 100644 --- a/NPCs/Bumblebirb/Bumblefuck2.cs +++ b/NPCs/Bumblebirb/Bumblefuck2.cs @@ -1,5 +1,7 @@ using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.CalPlayer; +using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -49,6 +51,7 @@ namespace CalamityMod.NPCs.Bumblebirb npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.lavaImmune = true; @@ -58,12 +61,23 @@ namespace CalamityMod.NPCs.Bumblebirb npc.DeathSound = SoundID.NPCDeath46; } - public override void AI() + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || !NPC.downedMoonlord || spawnInfo.player.Calamity().ZoneSunkenSea || NPC.AnyNPCs(npc.type)) + { + return 0f; + } + return SpawnCondition.SurfaceJungle.Chance * 0.09f; + } + + public override void AI() { Player player = Main.player[npc.target]; Vector2 vector = npc.Center; npc.damage = npc.defDamage; + bool increasedAggression = CalamityPlayer.areThereAnyDamnBosses; + float rotationMult = 4f; float rotationAmt = 0.04f; @@ -82,12 +96,12 @@ namespace CalamityMod.NPCs.Bumblebirb if (npc.ai[0] == 0f || npc.ai[0] == 1f) { - for (int num1376 = 0; num1376 < 200; num1376++) + for (int num1376 = 0; num1376 < Main.maxNPCs; num1376++) { if (num1376 != npc.whoAmI && Main.npc[num1376].active && Main.npc[num1376].type == npc.type) { Vector2 value42 = Main.npc[num1376].Center - npc.Center; - if (value42.Length() < (float)(npc.width + npc.height)) + if (value42.Length() < (npc.width + npc.height)) { value42.Normalize(); value42 *= -0.1f; @@ -103,7 +117,7 @@ namespace CalamityMod.NPCs.Bumblebirb { npc.TargetClosest(true); Vector2 vector240 = Main.player[npc.target].Center - npc.Center; - if (Main.player[npc.target].dead || vector240.Length() > 5600f) + if (Main.player[npc.target].dead || vector240.Length() > (increasedAggression ? 5600f : 2800f)) { npc.ai[0] = -1f; } @@ -164,7 +178,7 @@ namespace CalamityMod.NPCs.Bumblebirb } else if (value44.Length() > 400f) { - float scaleFactor20 = 9f + value44.Length() / 100f + npc.ai[1] / 15f; + float scaleFactor20 = (increasedAggression ? 9f : 7f) + value44.Length() / 100f + npc.ai[1] / 15f; float num1377 = 30f; value44.Normalize(); value44 *= scaleFactor20; @@ -179,7 +193,7 @@ namespace CalamityMod.NPCs.Bumblebirb npc.velocity *= 1.05f; } npc.ai[1] += 1f; - if (npc.ai[1] >= 90f) + if (npc.ai[1] >= (increasedAggression ? 90f : 105f)) { npc.ai[1] = 0f; npc.ai[0] = 2f; @@ -215,7 +229,7 @@ namespace CalamityMod.NPCs.Bumblebirb npc.ai[3] = 0f; } npc.ai[2] += 0.0166666675f; - float scaleFactor21 = 12f + npc.ai[2] + value45.Length() / 150f; + float scaleFactor21 = (increasedAggression ? 12f : 9f) + npc.ai[2] + value45.Length() / 150f; float num1378 = 25f; value45.Normalize(); value45 *= scaleFactor21; @@ -242,7 +256,7 @@ namespace CalamityMod.NPCs.Bumblebirb npc.noTileCollide = true; Vector2 vector242 = Main.player[npc.target].Center - npc.Center; vector242.Y -= 8f; - float scaleFactor22 = 18f; + float scaleFactor22 = increasedAggression ? 18f : 14f; float num1379 = 8f; vector242.Normalize(); vector242 *= scaleFactor22; @@ -274,7 +288,7 @@ namespace CalamityMod.NPCs.Bumblebirb } else if (npc.ai[0] == 2.1f) { - npc.damage = (int)(npc.defDamage * 1.5); + npc.damage = (int)(npc.defDamage * 1.3); if (npc.velocity.X < 0f) { npc.direction = -1; @@ -288,7 +302,7 @@ namespace CalamityMod.NPCs.Bumblebirb npc.noTileCollide = true; npc.ai[1] += 1f; int num1380 = 30; - if (npc.ai[1] > (float)num1380) + if (npc.ai[1] > num1380) { if (!Collision.SolidCollision(npc.position, npc.width, npc.height)) { @@ -297,7 +311,7 @@ namespace CalamityMod.NPCs.Bumblebirb npc.ai[2] = 0f; return; } - if (npc.ai[1] > (float)(num1380 * 2)) + if (npc.ai[1] > (num1380 * 2)) { npc.ai[0] = 1f; npc.ai[1] = 0f; @@ -308,14 +322,16 @@ namespace CalamityMod.NPCs.Bumblebirb } } - public override bool PreNPCLoot() - { - return false; - } + public override bool PreNPCLoot() => !CalamityPlayer.areThereAnyDamnBosses; - public override void FindFrame(int frameHeight) + public override void NPCLoot() + { + DropHelper.DropItemSpray(npc, ModContent.ItemType(), 2, 4); + } + + public override void FindFrame(int frameHeight) { - npc.frameCounter += (npc.ai[0] == 2.1f ? 1.5 : 1D); + npc.frameCounter += npc.ai[0] == 2.1f ? 1.5 : 1D; if (npc.frameCounter > 4D) //iban said the time between frames was 5 so using that as a base { npc.frameCounter = 0D; @@ -334,7 +350,7 @@ namespace CalamityMod.NPCs.Bumblebirb spriteEffects = SpriteEffects.FlipHorizontally; Texture2D texture2D15 = Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Vector2 vector11 = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2); Color color36 = Color.Gold; float amount9 = 0.5f; int num153 = npc.ai[0] == 2.1f ? 7 : 0; @@ -346,16 +362,16 @@ namespace CalamityMod.NPCs.Bumblebirb Color color38 = lightColor; color38 = Color.Lerp(color38, color36, amount9); color38 = npc.GetAlpha(color38); - color38 *= (float)(num153 - num155) / 15f; - Vector2 vector41 = npc.oldPos[num155] + new Vector2((float)npc.width, (float)npc.height) / 2f - Main.screenPosition; - vector41 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; + color38 *= (num153 - num155) / 15f; + Vector2 vector41 = npc.oldPos[num155] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; + vector41 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; vector41 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); spriteBatch.Draw(texture2D15, vector41, npc.frame, color38, npc.rotation, vector11, npc.scale, spriteEffects, 0f); } } Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; + vector43 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; vector43 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); diff --git a/NPCs/Calamitas/Calamitas.cs b/NPCs/Calamitas/Calamitas.cs index 2c9a25d28b..92af87c878 100644 --- a/NPCs/Calamitas/Calamitas.cs +++ b/NPCs/Calamitas/Calamitas.cs @@ -64,6 +64,7 @@ namespace CalamityMod.NPCs.Calamitas npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; diff --git a/NPCs/Calamitas/CalamitasRun.cs b/NPCs/Calamitas/CalamitasRun.cs index 1d1618fbdb..5676b4eff7 100644 --- a/NPCs/Calamitas/CalamitasRun.cs +++ b/NPCs/Calamitas/CalamitasRun.cs @@ -64,6 +64,7 @@ namespace CalamityMod.NPCs.Calamitas npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; diff --git a/NPCs/Calamitas/CalamitasRun2.cs b/NPCs/Calamitas/CalamitasRun2.cs index b3f99c1857..59f73007db 100644 --- a/NPCs/Calamitas/CalamitasRun2.cs +++ b/NPCs/Calamitas/CalamitasRun2.cs @@ -66,6 +66,7 @@ namespace CalamityMod.NPCs.Calamitas npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; diff --git a/NPCs/Calamitas/CalamitasRun3.cs b/NPCs/Calamitas/CalamitasRun3.cs index 84288a8487..4af93890b7 100644 --- a/NPCs/Calamitas/CalamitasRun3.cs +++ b/NPCs/Calamitas/CalamitasRun3.cs @@ -79,6 +79,7 @@ namespace CalamityMod.NPCs.Calamitas npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; diff --git a/NPCs/Calamitas/LifeSeeker.cs b/NPCs/Calamitas/LifeSeeker.cs index 88c1c5ea47..bd72406bfb 100644 --- a/NPCs/Calamitas/LifeSeeker.cs +++ b/NPCs/Calamitas/LifeSeeker.cs @@ -13,7 +13,7 @@ namespace CalamityMod.NPCs.Calamitas public override void SetStaticDefaults() { DisplayName.SetDefault("Life Seeker"); - Main.npcFrameCount[npc.type] = 2; + Main.npcFrameCount[npc.type] = 6; NPCID.Sets.TrailingMode[npc.type] = 1; } @@ -29,9 +29,8 @@ namespace CalamityMod.NPCs.Calamitas npc.lifeMax = 30000; } npc.aiStyle = 5; - aiType = 139; + aiType = NPCID.Probe; npc.knockBackResist = CalamityWorld.bossRushActive ? 0f : 0.25f; - animationType = 2; npc.noGravity = true; npc.noTileCollide = true; npc.canGhostHeal = false; @@ -40,14 +39,30 @@ namespace CalamityMod.NPCs.Calamitas npc.buffImmune[BuffID.OnFire] = true; } + public override bool PreAI() + { + // Setting this in SetDefaults will disable expert mode scaling, so put it here instead + npc.damage = 0; + + return true; + } + + public override void FindFrame(int frameHeight) + { + npc.frameCounter += 0.15f; + npc.frameCounter %= Main.npcFrameCount[npc.type]; + int frame = (int)npc.frameCounter; + npc.frame.Y = frame * frameHeight; + } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.None; if (npc.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Texture2D texture = Main.npcTexture[npc.type]; + Vector2 vector11 = new Vector2((float)(texture.Width / 2), (float)(texture.Height / Main.npcFrameCount[npc.type] / 2)); Color color36 = Color.White; float amount9 = 0.5f; int num153 = 5; @@ -61,18 +76,18 @@ namespace CalamityMod.NPCs.Calamitas color38 = npc.GetAlpha(color38); color38 *= (float)(num153 - num155) / 15f; Vector2 vector41 = npc.oldPos[num155] + new Vector2((float)npc.width, (float)npc.height) / 2f - Main.screenPosition; - vector41 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; + vector41 -= new Vector2((float)texture.Width, (float)(texture.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; vector41 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector41, npc.frame, color38, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, vector41, npc.frame, color38, npc.rotation, vector11, npc.scale, spriteEffects, 0f); } } Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; + vector43 -= new Vector2((float)texture.Width, (float)(texture.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; vector43 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); - texture2D15 = ModContent.GetTexture("CalamityMod/NPCs/Calamitas/LifeSeekerGlow"); + texture = ModContent.GetTexture("CalamityMod/NPCs/Calamitas/LifeSeekerGlow"); Color color37 = Color.Lerp(Color.White, Color.Red, 0.5f); if (CalamityConfig.Instance.Afterimages) @@ -83,13 +98,13 @@ namespace CalamityMod.NPCs.Calamitas color41 = Color.Lerp(color41, color36, amount9); color41 *= (float)(num153 - num163) / 15f; Vector2 vector44 = npc.oldPos[num163] + new Vector2((float)npc.width, (float)npc.height) / 2f - Main.screenPosition; - vector44 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; + vector44 -= new Vector2((float)texture.Width, (float)(texture.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; vector44 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector44, npc.frame, color41, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, vector44, npc.frame, color41, npc.rotation, vector11, npc.scale, spriteEffects, 0f); } } - spriteBatch.Draw(texture2D15, vector43, npc.frame, color37, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, vector43, npc.frame, color37, npc.rotation, vector11, npc.scale, spriteEffects, 0f); return false; } diff --git a/NPCs/Calamitas/LifeSeeker.png b/NPCs/Calamitas/LifeSeeker.png index ced67f60ae..5dea135f9f 100644 Binary files a/NPCs/Calamitas/LifeSeeker.png and b/NPCs/Calamitas/LifeSeeker.png differ diff --git a/NPCs/Calamitas/LifeSeekerGlow.png b/NPCs/Calamitas/LifeSeekerGlow.png index 36dee76491..d15b05bd68 100644 Binary files a/NPCs/Calamitas/LifeSeekerGlow.png and b/NPCs/Calamitas/LifeSeekerGlow.png differ diff --git a/NPCs/Calamitas/SoulSeeker.cs b/NPCs/Calamitas/SoulSeeker.cs index feeae155ec..f42c3741ef 100644 --- a/NPCs/Calamitas/SoulSeeker.cs +++ b/NPCs/Calamitas/SoulSeeker.cs @@ -63,6 +63,7 @@ namespace CalamityMod.NPCs.Calamitas npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; @@ -72,8 +73,10 @@ namespace CalamityMod.NPCs.Calamitas public override bool PreAI() { + // Setting this in SetDefaults will disable expert mode scaling, so put it here instead npc.damage = 0; - bool expertMode = Main.expertMode; + + bool expertMode = Main.expertMode; if (CalamityGlobalNPC.calamitas < 0 || !Main.npc[CalamityGlobalNPC.calamitas].active) { npc.active = false; @@ -101,8 +104,8 @@ namespace CalamityMod.NPCs.Calamitas { if (NPC.CountNPCS(ModContent.NPCType()) < 3) { - int x = (int)(npc.position.X + (float)Main.rand.Next(npc.width - 25)); - int y = (int)(npc.position.Y + (float)Main.rand.Next(npc.height - 25)); + int x = (int)(npc.position.X + Main.rand.Next(npc.width - 25)); + int y = (int)(npc.position.Y + Main.rand.Next(npc.height - 25)); int num663 = ModContent.NPCType(); int num664 = NPC.NewNPC(x, y, num663, 0, 0f, 0f, 0f, 0f, 255); } @@ -116,7 +119,7 @@ namespace CalamityMod.NPCs.Calamitas timer = 0; } NPC parent = Main.npc[NPC.FindFirstNPC(ModContent.NPCType())]; - double deg = (double)npc.ai[1]; + double deg = npc.ai[1]; double rad = deg * (Math.PI / 180); double dist = 150; npc.position.X = parent.Center.X - (int)(Math.Cos(rad) * dist) - npc.width / 2; diff --git a/NPCs/CalamityAI.cs b/NPCs/CalamityAI.cs index 50308e5617..c8eb02733f 100644 --- a/NPCs/CalamityAI.cs +++ b/NPCs/CalamityAI.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.CalPlayer; using CalamityMod.Dusts; using CalamityMod.Events; @@ -41,6 +42,10 @@ namespace CalamityMod.NPCs if (npc.justHit || npc.life <= npc.lifeMax * 0.99 || CalamityWorld.bossRushActive || Main.npc[(int)npc.ai[1]].life <= Main.npc[(int)npc.ai[1]].lifeMax * 0.99) { + // Kiss my motherfucking ass you piece of shit game + if (npc.damage == 0) + npc.timeLeft *= 20; + calamityGlobalNPC.newAI[0] = 1f; npc.damage = npc.defDamage; npc.boss = head; @@ -65,8 +70,6 @@ namespace CalamityMod.NPCs Player player = Main.player[npc.target]; - npc.velocity.Length(); - // Circular movement bool doSpiral = false; if (head && calamityGlobalNPC.newAI[0] == 1f && calamityGlobalNPC.newAI[2] == 1f && revenge) @@ -123,7 +126,7 @@ namespace CalamityMod.NPCs } } else - npc.localAI[1] = (npc.Center.X - player.Center.X < 0 ? 1f : -1f); + npc.localAI[1] = npc.Center.X - player.Center.X < 0 ? 1f : -1f; } if (Main.netMode != NetmodeID.MultiplayerClient) @@ -133,7 +136,7 @@ namespace CalamityMod.NPCs // Spawn segments if (calamityGlobalNPC.newAI[2] == 0f && npc.ai[0] == 0f) { - int maxLength = death ? 41 : 31; + int maxLength = death ? 50 : revenge ? 40 : expertMode ? 35 : 30; int Previous = npc.whoAmI; for (int num36 = 0; num36 < maxLength; num36++) { @@ -141,9 +144,9 @@ namespace CalamityMod.NPCs if (num36 >= 0 && num36 < maxLength - 1) { if (num36 % 2 == 0) - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType(), npc.whoAmI); - else lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType(), npc.whoAmI); + else + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType(), npc.whoAmI); } else lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType(), npc.whoAmI); @@ -187,7 +190,7 @@ namespace CalamityMod.NPCs if (Main.netMode != NetmodeID.MultiplayerClient) { - int damageBoom = expertMode ? 23 : 28; + int damageBoom = expertMode ? CalamityUtils.GetMasterModeProjectileDamage(23, 1.5) : 28; float velocity = revenge ? 7.5f : 6.5f; if (death) velocity += 2f; @@ -203,19 +206,19 @@ namespace CalamityMod.NPCs Projectile.NewProjectile(npc.Center, vector255, projectileType, damageBoom, 0f, Main.myPlayer, 0f, 0f); } - damageBoom = expertMode ? 28 : 33; + damageBoom = expertMode ? CalamityUtils.GetMasterModeProjectileDamage(28, 1.5) : 33; int num320 = expertMode ? 14 : 7; for (int num321 = 0; num321 < num320; num321++) { Vector2 vector15 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); vector15.Normalize(); - vector15 *= Main.rand.Next(50, 401); + vector15 *= Main.rand.Next(50, 401) * 0.01f; if (expertMode) - vector15 *= death ? 0.05f : 0.05f * (1f - lifeRatio); + vector15 *= 1f + (death ? 0.25f : 0.25f * (1f - lifeRatio)); if (CalamityWorld.bossRushActive) - vector15 *= 1.1f; + vector15 *= 1.25f; Projectile.NewProjectile(npc.Center, vector15, ModContent.ProjectileType(), damageBoom, 0f, Main.myPlayer, 0f, Main.rand.Next(-45, 1)); } @@ -246,7 +249,7 @@ namespace CalamityMod.NPCs float num943 = player.position.Y + player.height * 0.5f - vector104.Y; float num944 = (float)Math.Sqrt(num942 * num942 + num943 * num943); int projectileType = ModContent.ProjectileType(); - int damage = expertMode ? 25 : 30; + int damage = expertMode ? CalamityUtils.GetMasterModeProjectileDamage(25, 1.5) : 30; float num941 = CalamityWorld.bossRushActive ? 7.5f : 5f; num944 = num941 / num944; num942 *= num944; @@ -272,7 +275,7 @@ namespace CalamityMod.NPCs float num943 = player.position.Y + player.height * 0.5f - vector104.Y; float num944 = (float)Math.Sqrt(num942 * num942 + num943 * num943); int projectileType = ModContent.ProjectileType(); - int damage = expertMode ? 23 : 28; + int damage = expertMode ? CalamityUtils.GetMasterModeProjectileDamage(23, 1.5) : 28; float num941 = CalamityWorld.bossRushActive ? 12f : 8f; num944 = num941 / num944; num942 *= num944; @@ -314,9 +317,9 @@ namespace CalamityMod.NPCs } // Despawn - bool notOcean = player.position.Y < 800f || + bool notOcean = player.position.Y < 400f || player.position.Y > Main.worldSurface * 16.0 || - (player.position.X > 6400f && player.position.X < (Main.maxTilesX * 16 - 6400)); + (player.position.X > 7680f && player.position.X < (Main.maxTilesX * 16 - 7680)); if (player.dead || (notOcean && !CalamityWorld.bossRushActive && !player.Calamity().ZoneSulphur)) { @@ -382,26 +385,26 @@ namespace CalamityMod.NPCs { num188 = revenge ? 13f : 11f; num189 = revenge ? 0.14f : 0.12f; - if (notOcean) - { - num188 = 15f; - num189 = 0.15f; - } - if (player.gravDir == -1f && expertMode) - { - num188 = 20f; - num189 = 0.2f; - } - if (CalamityWorld.bossRushActive) - { - num188 = 22f; - num189 = 0.24f; - } if (expertMode) { num188 += death ? 4f : 4f * (1f - lifeRatio); num189 += death ? 0.04f : 0.04f * (1f - lifeRatio); } + if (notOcean) + { + num188 += 2f; + num189 += 0.02f; + } + if (player.gravDir == -1f && expertMode) + { + num188 = 21f; + num189 = 0.21f; + } + if (CalamityWorld.bossRushActive) + { + num188 = 25f; + num189 = 0.3f; + } } float num48 = num188 * 1.3f; @@ -727,7 +730,7 @@ namespace CalamityMod.NPCs { if (Main.netMode != NetmodeID.MultiplayerClient && NPC.CountNPCS(ModContent.NPCType()) < 2 && revenge) { - NPC.NewNPC((int)vectorCenter.X, (int)vectorCenter.Y, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); + NPC.NewNPC((int)vectorCenter.X, (int)vectorCenter.Y, ModContent.NPCType()); } Main.PlaySound(SoundID.Item8, vectorCenter); npc.alpha = 255; @@ -753,7 +756,7 @@ namespace CalamityMod.NPCs npc.alpha = 0; if (npc.ai[3] >= 2f || phase2) { - npc.ai[0] = (phase2 ? 5f : 3f); + npc.ai[0] = phase2 ? 5f : 3f; npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] = 0f; @@ -778,6 +781,7 @@ namespace CalamityMod.NPCs npc.ai[1] += 1f; float divisor = expertMode ? (death ? 30f : revenge ? 35f : 40f) - (float)Math.Ceiling(10f * (1f - lifeRatio)) : 45f; + float divisor2 = divisor * 2f; if (npc.ai[1] % divisor == divisor - 1f) { @@ -794,7 +798,7 @@ namespace CalamityMod.NPCs vectorCenter.X += num743 * 3f; vectorCenter.Y += num744 * 3f; - int damage = expertMode ? 25 : 30; + int damage = expertMode ? CalamityUtils.GetMasterModeProjectileDamage(25, 1.5) : 30; int numProj = 4; int spread = 45; float rotation = MathHelper.ToRadians(spread); @@ -803,10 +807,13 @@ namespace CalamityMod.NPCs double deltaAngle = rotation / numProj; double offsetAngle; - for (int i = 0; i < numProj; i++) + if (npc.ai[1] % divisor2 == divisor2 - 1f || !calamity) { - offsetAngle = startAngle + deltaAngle * i; - Projectile.NewProjectile(vectorCenter.X, vectorCenter.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), ModContent.ProjectileType(), damage + (provy ? 30 : 0), 0f, Main.myPlayer, 1f, 0f); + for (int i = 0; i < numProj; i++) + { + offsetAngle = startAngle + deltaAngle * i; + Projectile.NewProjectile(vectorCenter.X, vectorCenter.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), ModContent.ProjectileType(), damage + (provy ? 30 : 0), 0f, Main.myPlayer, 1f, 0f); + } } float projectileSpeed = CalamityWorld.bossRushActive ? 7f : 5f; @@ -829,7 +836,7 @@ namespace CalamityMod.NPCs relativeSpeedY *= totalRelativeSpeed; vectorCenter.X += relativeSpeedX * 3f; vectorCenter.Y += relativeSpeedY * 3f; - int projectileDamage = expertMode ? 28 : 35; + int projectileDamage = expertMode ? CalamityUtils.GetMasterModeProjectileDamage(28, 1.5) : 35; int projectileType = ModContent.ProjectileType(); int projectileShot = Projectile.NewProjectile(vectorCenter.X, vectorCenter.Y, relativeSpeedX, relativeSpeedY, projectileType, projectileDamage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); Main.projectile[projectileShot].timeLeft = 240; @@ -841,7 +848,7 @@ namespace CalamityMod.NPCs if (npc.velocity.Y > 0f) npc.velocity.Y *= 0.98f; - npc.velocity.Y -= (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + npc.velocity.Y -= CalamityWorld.bossRushActive ? 0.15f : 0.1f; if (npc.velocity.Y > 3f) npc.velocity.Y = 3f; @@ -851,7 +858,7 @@ namespace CalamityMod.NPCs if (npc.velocity.Y < 0f) npc.velocity.Y *= 0.98f; - npc.velocity.Y += (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + npc.velocity.Y += CalamityWorld.bossRushActive ? 0.15f : 0.1f; if (npc.velocity.Y < -3f) npc.velocity.Y = -3f; @@ -861,7 +868,7 @@ namespace CalamityMod.NPCs if (npc.velocity.X > 0f) npc.velocity.X *= 0.985f; - npc.velocity.X -= (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + npc.velocity.X -= CalamityWorld.bossRushActive ? 0.15f : 0.1f; if (npc.velocity.X > 8f) npc.velocity.X = 8f; @@ -871,13 +878,13 @@ namespace CalamityMod.NPCs if (npc.velocity.X < 0f) npc.velocity.X *= 0.985f; - npc.velocity.X += (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + npc.velocity.X += CalamityWorld.bossRushActive ? 0.15f : 0.1f; if (npc.velocity.X < -8f) npc.velocity.X = -8f; } - if (npc.ai[1] >= divisor * 6f) + if (npc.ai[1] >= divisor * 10f) { npc.TargetClosest(true); npc.ai[0] = 4f; @@ -897,12 +904,12 @@ namespace CalamityMod.NPCs { npc.localAI[0] += 1f; if (expertMode) - npc.localAI[0] += death ? 2f : 2f * (1f - lifeRatio); + npc.localAI[0] += death ? 1f : 1f * (1f - lifeRatio); if (calamityGlobalNPC.enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) npc.localAI[0] += 2f; - if (death || !calamity) - npc.localAI[0] += 1f; + if (!calamity) + npc.localAI[0] += 2f; if (npc.localAI[0] >= 120f) { @@ -912,14 +919,13 @@ namespace CalamityMod.NPCs if (CalamityWorld.bossRushActive) projectileSpeed = 12f; - int damage = expertMode ? 25 : 30; + int damage = expertMode ? CalamityUtils.GetMasterModeProjectileDamage(25, 1.5) : 30; vectorCenter = player.Center - vectorCenter; float radialOffset = 0.2f; float diameter = 80f; - vectorCenter.Y -= Math.Abs(vectorCenter.X) * radialOffset; vectorCenter = Vector2.Normalize(vectorCenter) * projectileSpeed; Vector2 velocity = vectorCenter; @@ -972,19 +978,7 @@ namespace CalamityMod.NPCs Vector2 source = new Vector2(vectorCenter.X + (npc.spriteDirection > 0 ? 34f : -34f), vectorCenter.Y - 74f); Vector2 aimAt = player.Center + player.velocity * 20f; - float aimResponsiveness = 0.4f; - - switch ((int)npc.ai[2]) - { - case 0: - break; - case 1: - aimResponsiveness = 0.25f; - break; - case 2: - aimResponsiveness = 0.1f; - break; - } + float aimResponsiveness = (npc.ai[2] == 1f || death) ? 0.1f : 0.25f; Vector2 aimVector = Vector2.Normalize(aimAt - source); if (aimVector.HasNaNs()) @@ -999,14 +993,17 @@ namespace CalamityMod.NPCs calamityGlobalNPC.newAI[1] = laserVelocity.X; calamityGlobalNPC.newAI[2] = laserVelocity.Y; + // Rev = 190 + 165 = 355 + // Death = 165 + npc.ai[1] += 1f; - if (npc.ai[1] >= 300f) + if (npc.ai[1] >= 240f) { npc.TargetClosest(true); npc.ai[2] += 1f; npc.localAI[0] = 0f; npc.localAI[1] = 0f; - if (npc.ai[2] >= 3f) + if (npc.ai[2] >= (death ? 1f : 2f)) { npc.ai[0] = 3f; npc.ai[1] = 0f; @@ -1026,31 +1023,33 @@ namespace CalamityMod.NPCs { if (npc.ai[1] == 180f) { - Main.PlaySound(29, (int)npc.position.X, (int)npc.position.Y, 104); + Main.PlaySound(SoundID.Item68, source); Vector2 laserVelocity2 = new Vector2(npc.localAI[0], npc.localAI[1]); laserVelocity2.Normalize(); - Projectile.NewProjectile(source, laserVelocity2, ModContent.ProjectileType(), 40 + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, npc.whoAmI); + Projectile.NewProjectile(source, laserVelocity2, ModContent.ProjectileType(), CalamityUtils.GetMasterModeProjectileDamage(40, 1.5) + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, npc.whoAmI); } } } else { - float playSoundTimer = 20f; + float playSoundTimer = 30f; if (npc.ai[1] < 150f) { switch ((int)npc.ai[2]) { case 0: + npc.ai[1] += 0.5f; break; case 1: - npc.ai[1] += 0.5f; - playSoundTimer = 30f; - break; - case 2: npc.ai[1] += 1f; playSoundTimer = 40f; break; } + if (death) + { + npc.ai[1] += 0.5f; + playSoundTimer += 10f; + } } if (npc.ai[1] % playSoundTimer == 0f) @@ -1092,7 +1091,7 @@ namespace CalamityMod.NPCs // Spawn phase 2 Cal if (lifeRatio <= 0.75f && Main.netMode != NetmodeID.MultiplayerClient && !phase2) { - NPC.NewNPC((int)npc.Center.X, (int)npc.position.Y + npc.height, ModContent.NPCType(), npc.whoAmI, 0f, 0f, 0f, 0f, 255); + NPC.NewNPC((int)npc.Center.X, (int)npc.position.Y + npc.height, ModContent.NPCType(), npc.whoAmI); string key = "Mods.CalamityMod.CalamitasBossText"; Color messageColor = Color.Orange; if (Main.netMode == NetmodeID.SinglePlayer) @@ -1161,8 +1160,8 @@ namespace CalamityMod.NPCs calamityGlobalNPC.newAI[0] = npc.life; if (calamityGlobalNPC.newAI[0] <= (float)npc.lifeMax * 0.1) { - NPC.NewNPC((int)npc.Center.X, (int)npc.position.Y + npc.height, ModContent.NPCType(), npc.whoAmI, 0f, 0f, 0f, 0f, 255); - NPC.NewNPC((int)npc.Center.X, (int)npc.position.Y + npc.height, ModContent.NPCType(), npc.whoAmI, 0f, 0f, 0f, 0f, 255); + NPC.NewNPC((int)npc.Center.X, (int)npc.position.Y + npc.height, ModContent.NPCType(), npc.whoAmI); + NPC.NewNPC((int)npc.Center.X, (int)npc.position.Y + npc.height, ModContent.NPCType(), npc.whoAmI); string key = "Mods.CalamityMod.CalamitasBossText2"; Color messageColor = Color.Orange; @@ -1172,9 +1171,9 @@ namespace CalamityMod.NPCs NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); } else if (calamityGlobalNPC.newAI[0] <= (float)npc.lifeMax * 0.4) - NPC.NewNPC((int)npc.Center.X, (int)npc.position.Y + npc.height, ModContent.NPCType(), npc.whoAmI, 0f, 0f, 0f, 0f, 255); + NPC.NewNPC((int)npc.Center.X, (int)npc.position.Y + npc.height, ModContent.NPCType(), npc.whoAmI); else - NPC.NewNPC((int)npc.Center.X, (int)npc.position.Y + npc.height, ModContent.NPCType(), npc.whoAmI, 0f, 0f, 0f, 0f, 255); + NPC.NewNPC((int)npc.Center.X, (int)npc.position.Y + npc.height, ModContent.NPCType(), npc.whoAmI); } } } @@ -1292,6 +1291,14 @@ namespace CalamityMod.NPCs num823 += 1f; num824 += 0.02f; } + + // Reduce acceleration if target is holding a true melee weapon + Item targetSelectedItem = player.inventory[player.selectedItem]; + if (targetSelectedItem.melee && (targetSelectedItem.shoot == 0 || CalamityMod.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) + { + num824 *= 0.5f; + } + if (provy) { num823 *= 1.25f; @@ -1368,7 +1375,7 @@ namespace CalamityMod.NPCs if (calamityGlobalNPC.enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) num828 += 5f; - int num829 = expertMode ? 34 : 42; + int num829 = expertMode ? CalamityUtils.GetMasterModeProjectileDamage(34, 1.5) : 42; int num830 = ModContent.ProjectileType(); num827 = (float)Math.Sqrt(num825 * num825 + num826 * num826); num827 = num828 / num827; @@ -1394,7 +1401,7 @@ namespace CalamityMod.NPCs { npc.localAI[1] = 0f; float num828 = CalamityWorld.bossRushActive ? 16f : (expertMode ? 13f : 10.5f); - int num829 = expertMode ? 28 : 35; + int num829 = expertMode ? CalamityUtils.GetMasterModeProjectileDamage(28, 1.5) : 35; int num830 = ModContent.ProjectileType(); num827 = (float)Math.Sqrt(num825 * num825 + num826 * num826); num827 = num828 / num827; @@ -1427,6 +1434,14 @@ namespace CalamityMod.NPCs num832 += 1f; num833 += 0.02f; } + + // Reduce acceleration if target is holding a true melee weapon + Item targetSelectedItem = player.inventory[player.selectedItem]; + if (targetSelectedItem.melee && (targetSelectedItem.shoot == 0 || CalamityMod.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) + { + num833 *= 0.5f; + } + if (provy) { num832 *= 1.25f; @@ -1493,7 +1508,7 @@ namespace CalamityMod.NPCs { npc.localAI[1] = 0f; float num837 = CalamityWorld.bossRushActive ? 15f : 11f; - int num838 = brotherAlive ? (expertMode ? 34 : 42) : (expertMode ? 28 : 35); + int num838 = brotherAlive ? (expertMode ? CalamityUtils.GetMasterModeProjectileDamage(34, 1.5) : 42) : (expertMode ? CalamityUtils.GetMasterModeProjectileDamage(28, 1.5) : 35); int num839 = brotherAlive ? ModContent.ProjectileType() : ModContent.ProjectileType(); num836 = (float)Math.Sqrt(num834 * num834 + num835 * num835); num836 = num837 / num836; @@ -1503,7 +1518,7 @@ namespace CalamityMod.NPCs vector83.Y += num835 * 12f; if (!Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) { - int proj = Projectile.NewProjectile(vector83.X, vector83.Y, num834, num835, ModContent.ProjectileType(), (expertMode ? 34 : 42) + (provy ? 30 : 0), 0f, Main.myPlayer, player.Center.X, player.Center.Y); + int proj = Projectile.NewProjectile(vector83.X, vector83.Y, num834, num835, ModContent.ProjectileType(), (expertMode ? CalamityUtils.GetMasterModeProjectileDamage(34, 1.5) : 42) + (provy ? 30 : 0), 0f, Main.myPlayer, player.Center.X, player.Center.Y); Main.projectile[proj].tileCollide = false; } else @@ -1519,7 +1534,7 @@ namespace CalamityMod.NPCs { npc.localAI[1] = 0f; float num837 = CalamityWorld.bossRushActive ? 14f : 10.5f; - int num838 = expertMode ? 20 : 24; + int num838 = expertMode ? CalamityUtils.GetMasterModeProjectileDamage(20, 1.5) : 24; int num839 = ModContent.ProjectileType(); num836 = (float)Math.Sqrt(num834 * num834 + num835 * num835); num836 = num837 / num836; @@ -1841,7 +1856,7 @@ namespace CalamityMod.NPCs { npc.localAI[1] = 0f; float num867 = CalamityWorld.bossRushActive ? 9f : 6f; - int num868 = expertMode ? 30 : 38; + int num868 = expertMode ? CalamityUtils.GetMasterModeProjectileDamage(30, 1.5) : 38; int num869 = ModContent.ProjectileType(); vector86 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); num864 = player.position.X + (player.width / 2) - vector86.X; @@ -2114,7 +2129,7 @@ namespace CalamityMod.NPCs { npc.localAI[1] = 0f; float num867 = CalamityWorld.bossRushActive ? 18f : 12f; - int num868 = expertMode ? 29 : 36; + int num868 = expertMode ? CalamityUtils.GetMasterModeProjectileDamage(29, 1.5) : 36; int num869 = ModContent.ProjectileType(); vector86 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); num864 = player.position.X + (player.width / 2) - vector86.X; @@ -2287,7 +2302,7 @@ namespace CalamityMod.NPCs { npc.localAI[0] = 0f; Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 33); - int laserDamage = expertMode ? 32 : 37; + int laserDamage = expertMode ? CalamityUtils.GetMasterModeProjectileDamage(32, 1.5) : 37; if (NPC.downedMoonlord && revenge && !CalamityWorld.bossRushActive) laserDamage *= 3; @@ -2340,8 +2355,8 @@ namespace CalamityMod.NPCs // Start up if (npc.ai[0] == 0f) { - // If hit or after two seconds start Idle phase - npc.ai[1] += 1f; + // If hit or after two seconds start Idle phase + npc.ai[1] += 1f; if (npc.justHit || npc.ai[1] >= 120f) { // Set AI to next phase (Idle) and reset other AI @@ -2349,13 +2364,15 @@ namespace CalamityMod.NPCs npc.ai[1] = 0f; npc.netUpdate = true; } - } + + CustomGravity(); + } // Idle else if (npc.ai[0] == 1f) { - // Decrease defense - npc.defense = 0; + // Decrease defense + npc.defense = 0; // Slow down npc.velocity.X *= 0.98f; @@ -2377,15 +2394,17 @@ namespace CalamityMod.NPCs npc.ai[1] = 0f; npc.netUpdate = true; } - } + + CustomGravity(); + } // Walk else if (npc.ai[0] == 2f) { // Set walking speed - float num823 = CalamityWorld.bossRushActive ? 8f : 5f; + float num823 = CalamityWorld.bossRushActive ? 9f : 6f; if (expertMode) - num823 += death ? 3f : 3f * (1f - lifeRatio); + num823 += death ? 2f : 2f * (1f - lifeRatio); if (revenge) num823 += Math.Abs(npc.Center.X - player.Center.X) * 0.0025f; @@ -2464,7 +2483,8 @@ namespace CalamityMod.NPCs // Jump else if (npc.ai[0] == 3f) { - npc.noTileCollide = false; + npc.noTileCollide = false; + if (npc.velocity.Y == 0f) { // Slow down @@ -2477,9 +2497,9 @@ namespace CalamityMod.NPCs else if (npc.ai[1] == -1f) { // Set jump velocity, reset and set AI to next phase (Stomp) - float velocityX = CalamityWorld.bossRushActive ? 9f : 6f; + float velocityX = CalamityWorld.bossRushActive ? 12f : 9f; if (expertMode) - velocityX += death ? 6f : 6f * (1f - lifeRatio); + velocityX += death ? 3f : 3f * (1f - lifeRatio); npc.velocity.X = velocityX * npc.direction; @@ -2487,8 +2507,6 @@ namespace CalamityMod.NPCs if (revenge) { - calamityGlobalNPC.newAI[0] = 0f; - if (distanceBelowTarget > 0f) calamityGlobalNPC.newAI[0] = 1f + distanceBelowTarget * 0.001f; @@ -2515,7 +2533,9 @@ namespace CalamityMod.NPCs npc.ai[1] = 0f; } } - } + + CustomGravity(); + } // Stomp else if (npc.ai[0] == 4f) @@ -2536,8 +2556,10 @@ namespace CalamityMod.NPCs else npc.ai[0] = 3f; - // Spawn dust for visual effect - for (int num622 = (int)npc.position.X - 20; num622 < (int)npc.position.X + npc.width + 40; num622 += 20) + calamityGlobalNPC.newAI[0] = 0f; + + // Spawn dust for visual effect + for (int num622 = (int)npc.position.X - 20; num622 < (int)npc.position.X + npc.width + 40; num622 += 20) { for (int num623 = 0; num623 < 4; num623++) { @@ -2564,9 +2586,9 @@ namespace CalamityMod.NPCs if (npc.Bottom.Y < player.position.Y) { - float fallSpeed = 0.8f; + float fallSpeed = 1.2f; if (expertMode) - fallSpeed += death ? 0.8f : 0.8f * (1f - lifeRatio); + fallSpeed += death ? 0.4f : 0.4f * (1f - lifeRatio); if (calamityGlobalNPC.newAI[0] > 1f) fallSpeed *= calamityGlobalNPC.newAI[0]; @@ -2576,14 +2598,16 @@ namespace CalamityMod.NPCs } else { - if (npc.direction < 0) - npc.velocity.X -= 0.2f; - else if (npc.direction > 0) - npc.velocity.X += 0.2f; + float velocityXChange = 0.02f + Math.Abs(npc.Center.X - player.Center.X) * 0.0005f; - float num626 = CalamityWorld.bossRushActive ? 12f : 9f; + if (npc.direction < 0) + npc.velocity.X -= velocityXChange; + else if (npc.direction > 0) + npc.velocity.X += velocityXChange; + + float num626 = CalamityWorld.bossRushActive ? 15f : 12f; if (expertMode) - num626 += death ? 6f : 6f * (1f - lifeRatio); + num626 += death ? 3f : 3f * (1f - lifeRatio); if (npc.velocity.X < -num626) npc.velocity.X = -num626; @@ -2591,29 +2615,7 @@ namespace CalamityMod.NPCs npc.velocity.X = num626; } - // Custom gravity - float gravity = 0.3f; - float maxFallSpeed = 10f; - if (npc.wet) - { - if (npc.honeyWet) - { - gravity *= 0.33f; - maxFallSpeed *= 0.4f; - } - else - { - gravity *= 0.66f; - maxFallSpeed *= 0.7f; - } - } - - if (calamityGlobalNPC.newAI[0] > 1f) - maxFallSpeed *= calamityGlobalNPC.newAI[0]; - - npc.velocity.Y += gravity; - if (npc.velocity.Y > maxFallSpeed) - npc.velocity.Y = maxFallSpeed; + CustomGravity(); } } @@ -2637,7 +2639,7 @@ namespace CalamityMod.NPCs if (NPC.CountNPCS(ModContent.NPCType()) > 1) spawnFlag = false; if (spawnFlag && Main.netMode != NetmodeID.MultiplayerClient) - NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y - 25, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); + NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y - 25, ModContent.NPCType()); // Reset localAI and find a teleport destination npc.TargetClosest(true); @@ -2721,7 +2723,7 @@ namespace CalamityMod.NPCs if (NPC.CountNPCS(ModContent.NPCType()) > 1) spawnFlag = false; if (spawnFlag && Main.netMode != NetmodeID.MultiplayerClient) - NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y - 25, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); + NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y - 25, ModContent.NPCType()); // Become vulnerable npc.chaseable = true; @@ -2749,6 +2751,32 @@ namespace CalamityMod.NPCs Main.dust[num244].velocity *= 0.5f; } } + + void CustomGravity() + { + float gravity = 0.3f; + float maxFallSpeed = 10f; + if (npc.wet) + { + if (npc.honeyWet) + { + gravity *= 0.33f; + maxFallSpeed *= 0.4f; + } + else + { + gravity *= 0.66f; + maxFallSpeed *= 0.7f; + } + } + + if (calamityGlobalNPC.newAI[0] > 1f) + maxFallSpeed *= calamityGlobalNPC.newAI[0]; + + npc.velocity.Y += gravity; + if (npc.velocity.Y > maxFallSpeed) + npc.velocity.Y = maxFallSpeed; + } } #endregion @@ -2769,8 +2797,8 @@ namespace CalamityMod.NPCs else npc.damage = npc.defDamage; - // 8 seconds of reistance to prevent spawn killing - if (calamityGlobalNPC.newAI[1] < 480f) + // 10 seconds of reistance to prevent spawn killing + if (calamityGlobalNPC.newAI[1] < 600f) calamityGlobalNPC.newAI[1] += 1f; // Get a target @@ -2779,6 +2807,16 @@ namespace CalamityMod.NPCs Player player = Main.player[npc.target]; + // Inflict Extreme Gravity to nearby players + if (revenge) + { + if (Main.netMode != NetmodeID.Server) + { + if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active && Vector2.Distance(Main.player[Main.myPlayer].Center, npc.Center) < 5600f) + Main.player[Main.myPlayer].AddBuff(ModContent.BuffType(), 2); + } + } + // Life float lifeRatio = npc.life / (float)npc.lifeMax; @@ -2810,6 +2848,11 @@ namespace CalamityMod.NPCs // Phase for flying at the player bool flyAtTarget = calamityGlobalNPC.newAI[3] >= (aiSwitchTimer * 0.5f) && startFlightPhase; + // Length of worms + int phase1Length = death ? 80 : revenge ? 70 : expertMode ? 60 : 50; + int phase2Length = phase1Length / 2; + int maxLength = doubleWormPhase ? phase2Length : phase1Length; + // Split into two worms if (head) { @@ -2830,26 +2873,40 @@ namespace CalamityMod.NPCs { if (Main.netMode != NetmodeID.MultiplayerClient) { - NPC.SpawnOnPlayer(npc.FindClosestPlayer(), npc.type); - NPC.SpawnOnPlayer(npc.FindClosestPlayer(), npc.type); - } - - for (int i = 0; i < Main.maxNPCs; i++) - { - if (Main.npc[i].Calamity().newAI[0] == 0f && Main.npc[i].type == npc.type && i != npc.whoAmI) + int startCount = npc.whoAmI + phase1Length + 1; + int npc2 = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, npc.type, startCount); + Main.npc[npc2].Calamity().newAI[0] = 1f; + Main.npc[npc2].velocity = Vector2.Normalize(player.Center - Main.npc[npc2].Center) * 16f; + Main.npc[npc2].timeLeft *= 20; + Main.npc[npc2].netUpdate = true; + if (Main.netMode == NetmodeID.Server) { - Main.npc[i].Calamity().newAI[0] = calamityGlobalNPC.newAI[0] + 1f; + var netMessage = mod.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.SyncCalamityNPCAIArray); + netMessage.Write((byte)npc2); + netMessage.Write(Main.npc[npc2].Calamity().newAI[0]); + netMessage.Write(Main.npc[npc2].Calamity().newAI[1]); + netMessage.Write(Main.npc[npc2].Calamity().newAI[2]); + netMessage.Write(Main.npc[npc2].Calamity().newAI[3]); + netMessage.Send(); + } - if (Main.npc[i].Calamity().newAI[0] == 2f) - Main.npc[i].Calamity().newAI[3] = 600f; - - Main.npc[i].velocity = Vector2.Normalize(player.Center - Main.npc[i].Center) * 16f; - - Main.npc[i].netUpdate = true; - - calamityGlobalNPC.newAI[0] += 1f; - if (calamityGlobalNPC.newAI[0] >= 2f) - break; + int npc3 = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, npc.type, startCount + phase2Length + 1); + Main.npc[npc3].Calamity().newAI[0] = 2f; + Main.npc[npc3].Calamity().newAI[3] = 600f; + Main.npc[npc3].velocity = Vector2.Normalize(player.Center - Main.npc[npc3].Center) * 16f; + Main.npc[npc3].timeLeft *= 20; + Main.npc[npc3].netUpdate = true; + if (Main.netMode == NetmodeID.Server) + { + var netMessage = mod.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.SyncCalamityNPCAIArray); + netMessage.Write((byte)npc3); + netMessage.Write(Main.npc[npc3].Calamity().newAI[0]); + netMessage.Write(Main.npc[npc3].Calamity().newAI[1]); + netMessage.Write(Main.npc[npc3].Calamity().newAI[2]); + netMessage.Write(Main.npc[npc3].Calamity().newAI[3]); + netMessage.Send(); } } } @@ -2857,7 +2914,7 @@ namespace CalamityMod.NPCs for (int i = 0; i < Main.maxNPCs; i++) { if (i == npc.whoAmI || Main.npc[i].type == ModContent.NPCType() || Main.npc[i].type == ModContent.NPCType()) - Main.npc[i].active = false; + Main.npc[i].life = 0; } return; @@ -2937,7 +2994,6 @@ namespace CalamityMod.NPCs { if (npc.ai[0] == 0f) { - int maxLength = doubleWormPhase ? 45 : 90; int Previous = npc.whoAmI; int bodyType = ModContent.NPCType(); int tailType = ModContent.NPCType(); @@ -2955,6 +3011,17 @@ namespace CalamityMod.NPCs Main.npc[lol].realLife = npc.whoAmI; Main.npc[lol].Calamity().newAI[0] = calamityGlobalNPC.newAI[0]; Main.npc[lol].Calamity().newAI[3] = calamityGlobalNPC.newAI[3]; + if (Main.netMode == NetmodeID.Server) + { + var netMessage = mod.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.SyncCalamityNPCAIArray); + netMessage.Write((byte)lol); + netMessage.Write(Main.npc[lol].Calamity().newAI[0]); + netMessage.Write(Main.npc[lol].Calamity().newAI[1]); + netMessage.Write(Main.npc[lol].Calamity().newAI[2]); + netMessage.Write(Main.npc[lol].Calamity().newAI[3]); + netMessage.Send(); + } Main.npc[lol].ai[2] = npc.whoAmI; Main.npc[lol].ai[1] = Previous; Main.npc[Previous].ai[0] = lol; @@ -3077,6 +3144,14 @@ namespace CalamityMod.NPCs speed *= speedMultiplier; } + if (revenge) + { + float revMultiplier = 1.1f; + speed *= revMultiplier; + turnSpeed *= revMultiplier; + fallSpeed *= revMultiplier; + } + if (CalamityWorld.bossRushActive) { speed *= 1.25f; @@ -3301,7 +3376,7 @@ namespace CalamityMod.NPCs num944 = num941 / num944; num942 *= num944; num943 *= num944; - int num945 = expertMode ? 38 : 45; + int num945 = expertMode ? CalamityUtils.GetMasterModeProjectileDamage(38, 1.5) : 45; int num946 = ModContent.ProjectileType(); vector104.X += num942 * 5f; vector104.Y += num943 * 5f; @@ -3314,7 +3389,7 @@ namespace CalamityMod.NPCs { if (npc.localAI[0] % divisor == 0f && npc.ai[0] % 2f == 0f) { - int num945 = expertMode ? 45 : 60; + int num945 = expertMode ? CalamityUtils.GetMasterModeProjectileDamage(45, 1.5) : 60; int num946 = ModContent.ProjectileType(); Projectile.NewProjectile(npc.Center, Vector2.Zero, num946, num945, 0f, Main.myPlayer, 0f, 0f); } @@ -3427,16 +3502,50 @@ namespace CalamityMod.NPCs else if (npc.timeLeft < 1800) npc.timeLeft = 1800; + // Detect active tiles around Void + int radius = 20; // 20 tile radius + int diameter = radius * 2; + int npcCenterX = (int)(npc.Center.X / 16f); + int npcCenterY = (int)(npc.Center.Y / 16f); + Rectangle area = new Rectangle(npcCenterX - radius, npcCenterY - radius, diameter, diameter); + int nearbyActiveTiles = 0; // 0 to 1600 + for (int x = area.Left; x < area.Right; x++) + { + for (int y = area.Top; y < area.Bottom; y++) + { + if (Main.tile[x, y] != null) + { + if (Main.tile[x, y].nactive() && Main.tileSolid[Main.tile[x, y].type] && !Main.tileSolidTop[Main.tile[x, y].type] && !TileID.Sets.Platforms[Main.tile[x, y].type]) + nearbyActiveTiles++; + } + } + } + + // Scale multiplier based on nearby active tiles + float tileEnrageMult = 1f; + if (nearbyActiveTiles < 800) + tileEnrageMult += (800 - nearbyActiveTiles) * 0.001f; // Ranges from 1f to 1.8f + + // Increase projectile fire rate based on number of nearby active tiles + float projectileFireRateMultiplier = MathHelper.Lerp(1f, 4f, 1f - ((tileEnrageMult - 1f) / 0.8f)); + + // Increase damage of projectiles and contact damage based on number of nearby active tiles + int damageIncrease = 0; + if (nearbyActiveTiles < 400) + damageIncrease += (400 - nearbyActiveTiles) / 20; // Ranges from 0 to 20 + + npc.damage = npc.defDamage + damageIncrease * 4; + if (lifePercentage < 90) { float num472 = npc.Center.X; float num473 = npc.Center.Y; - float num474 = (float)(500.0 * (1.0 - lifeRatio)); + float num474 = (death ? 275f : (float)(275D * (1D - lifeRatio))) * tileEnrageMult; if (!player.ZoneDungeon) num474 *= 1.25f; npc.ai[0] += 1f; - if (npc.ai[0] == 60f) + if (npc.ai[0] >= 45f * projectileFireRateMultiplier) { npc.ai[0] = 0f; @@ -3448,7 +3557,7 @@ namespace CalamityMod.NPCs for (int i = 0; i < numDust; i++) { dustOffset = dustOffset.RotatedBy(angleIncrement); - int dust = Dust.NewDust(npc.Center, 1, 1, 173); + int dust = Dust.NewDust(npc.Center, 1, 1, (int)CalamityDusts.PurpleCosmolite); Main.dust[dust].position = npc.Center + dustOffset; Main.dust[dust].noGravity = true; Main.dust[dust].fadeIn = 1f; @@ -3456,6 +3565,7 @@ namespace CalamityMod.NPCs Main.dust[dust].scale = 0.5f; } + float pullVelocity = (player.Calamity().gravityNormalizer ? 9f : 15f) * tileEnrageMult; for (int num475 = 0; num475 < Main.maxPlayers; num475++) { if (Collision.CanHit(npc.Center, 1, 1, Main.player[num475].Center, 1, 1)) @@ -3467,13 +3577,13 @@ namespace CalamityMod.NPCs if (num478 < num474) { if (Main.player[num475].position.X < num472) - Main.player[num475].velocity.X += 15f; + Main.player[num475].velocity.X += pullVelocity; else - Main.player[num475].velocity.X -= 15f; + Main.player[num475].velocity.X -= pullVelocity; if (Main.player[num475].position.Y < num473) - Main.player[num475].velocity.Y += 15f; + Main.player[num475].velocity.Y += pullVelocity; else - Main.player[num475].velocity.Y -= 15f; + Main.player[num475].velocity.Y -= pullVelocity; } } } @@ -3487,31 +3597,30 @@ namespace CalamityMod.NPCs if (calamityGlobalNPC.enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) calamityGlobalNPC.newAI[1] += 2f; - if (calamityGlobalNPC.newAI[1] >= 900f) + if (calamityGlobalNPC.newAI[1] >= 600f * projectileFireRateMultiplier) { calamityGlobalNPC.newAI[1] = 0f; + int damage = (expertMode ? CalamityUtils.GetMasterModeProjectileDamage(50, 1.5) : 60) + damageIncrease; if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) { - float num941 = 3f; + float num941 = 3f * tileEnrageMult; Vector2 vector104 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + (npc.height / 2)); - float num942 = player.position.X + player.width * 0.5f - vector104.X + Main.rand.Next(-20, 21); - float num943 = player.position.Y + player.height * 0.5f - vector104.Y + Main.rand.Next(-20, 21); + float num942 = player.position.X + player.width * 0.5f - vector104.X; + float num943 = player.position.Y + player.height * 0.5f - vector104.Y; float num944 = (float)Math.Sqrt(num942 * num942 + num943 * num943); num944 = num941 / num944; num942 *= num944; num943 *= num944; - int num945 = expertMode ? 50 : 60; int num946 = ModContent.ProjectileType(); vector104.X += num942 * 5f; vector104.Y += num943 * 5f; - int num947 = Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, num946, num945, 0f, Main.myPlayer, 0f, 0f); + int num947 = Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, num946, damage, 0f, Main.myPlayer, tileEnrageMult, 0f); Main.projectile[num947].timeLeft = 300; npc.netUpdate = true; } if (revenge) { - int damage = expertMode ? 50 : 60; if (lifePercentage < 50 || death || !player.ZoneDungeon) { for (int i = 0; i < 12; i++) @@ -3540,7 +3649,7 @@ namespace CalamityMod.NPCs } } - float num823 = expertMode ? 7.5f : 6f; + float num823 = (expertMode ? 7.5f : 6f) * tileEnrageMult; float num824 = expertMode ? 0.08f : 0.06f; if (!player.ZoneDungeon || CalamityWorld.bossRushActive) num823 = expertMode ? 25f : 20f; @@ -3591,9 +3700,12 @@ namespace CalamityMod.NPCs { calamityGlobalNPC.newAI[0] = npc.life; calamityGlobalNPC.newAI[2] += 1f; - int glob = expertMode ? 8 : 4; + + int glob = expertMode ? 6 : 4; if (calamityGlobalNPC.newAI[0] <= 0.5f) - glob = expertMode ? 16 : 8; + glob = expertMode ? 12 : 8; + + glob = (int)(glob * MathHelper.Clamp(tileEnrageMult * 0.85f, 1f, 1.5f)); for (int num662 = 0; num662 < glob; num662++) { @@ -3626,6 +3738,29 @@ namespace CalamityMod.NPCs bool death = CalamityWorld.death || CalamityWorld.bossRushActive; Vector2 vector = npc.Center; + // If target is outside the jungle for more than 3 seconds, enrage + if (!player.ZoneJungle) + { + if (npc.localAI[1] < 300f) + npc.localAI[1] += 1f; + } + else + { + if (npc.localAI[1] > 0f) + npc.localAI[1] -= 1f; + } + + // If dragonfolly is off screen, enrage for the next couple attacks + if (Vector2.Distance(player.Center, vector) > 960f) + npc.localAI[2] = 2f; + + // Enrage scale + int enrageScale = 1; + if (npc.localAI[1] >= 300f) + enrageScale += 1; + if (npc.localAI[2] > 0f) + enrageScale += 1; + // Despawn if (!player.active || player.dead || Vector2.Distance(player.Center, vector) > 5600f) { @@ -3669,13 +3804,14 @@ namespace CalamityMod.NPCs bool phase2 = lifeRatio < (revenge ? 0.75f : 0.5f) || death; bool phase3 = lifeRatio < (death ? 0.4f : revenge ? 0.25f : 0.1f) && expertMode; + float birbSpawnPhaseTimer = 180f; float newPhaseTimer = 180f; bool phaseSwitchPhase = (phase2 && calamityGlobalNPC.newAI[0] < newPhaseTimer && calamityGlobalNPC.newAI[2] != 1f) || (phase3 && calamityGlobalNPC.newAI[1] < newPhaseTimer && calamityGlobalNPC.newAI[3] != 1f); npc.dontTakeDamage = phaseSwitchPhase; - calamityGlobalNPC.DR = npc.ai[0] == 5f ? 0.75f : 0.1f; + calamityGlobalNPC.DR = (npc.ai[0] == 5f || enrageScale == 3) ? 0.75f : 0.1f; if (phaseSwitchPhase) { @@ -3755,9 +3891,7 @@ namespace CalamityMod.NPCs } // Max spawn amount - int num1305 = revenge ? 3 : 2; - if (phase2) - num1305 = death ? 2 : 1; + int maxBirbs = phase2 ? 1 : 2; // Variable for charging float chargeDistance = 600f; @@ -3765,6 +3899,7 @@ namespace CalamityMod.NPCs chargeDistance -= 50f; if (phase3) chargeDistance -= 50f; + chargeDistance -= (enrageScale - 1) * 100f; // Don't collide with tiles, disable gravity npc.noTileCollide = false; @@ -3788,7 +3923,7 @@ namespace CalamityMod.NPCs // Slow down if colliding with tiles if (npc.collideX) { - npc.velocity.X *= (-npc.oldVelocity.X * 0.5f); + npc.velocity.X *= -npc.oldVelocity.X * 0.5f; if (npc.velocity.X > 4f) npc.velocity.X = 4f; if (npc.velocity.X < -4f) @@ -3796,7 +3931,7 @@ namespace CalamityMod.NPCs } if (npc.collideY) { - npc.velocity.Y *= (-npc.oldVelocity.Y * 0.5f); + npc.velocity.Y *= -npc.oldVelocity.Y * 0.5f; if (npc.velocity.Y > 4f) npc.velocity.Y = 4f; if (npc.velocity.Y < -4f) @@ -3816,7 +3951,7 @@ namespace CalamityMod.NPCs } else if (value51.Length() > 240f) { - float scaleFactor15 = 12f; + float scaleFactor15 = 12f + (enrageScale - 1) * 6f; float num1306 = 30f; value51.Normalize(); value51 *= scaleFactor15; @@ -3847,6 +3982,14 @@ namespace CalamityMod.NPCs npc.TargetClosest(true); npc.ai[0] = 5f; npc.localAI[0] = 0f; + + // Decrease enraged attacks by 1 + if (npc.localAI[2] > 0f) + npc.localAI[2] -= 1f; + + // Decrease amount of attacks until able to spawn small birbs again + if (npc.localAI[3] > 0f) + npc.localAI[3] -= 1f; } else { @@ -3854,34 +3997,69 @@ namespace CalamityMod.NPCs if (phase3) num1307 = 1; - int damage = expertMode ? 50 : 60; + int damage = expertMode ? CalamityUtils.GetMasterModeProjectileDamage(50, 1.5) : 60; + float featherVelocity = 3f + (enrageScale - 1) * 1.5f; - if (num1307 == 0 && canHit) + if (num1307 == 0 && canHit && npc.localAI[3] == 0f) { npc.TargetClosest(true); npc.ai[0] = 2f; + + // Decrease enraged attacks by 1 + if (npc.localAI[2] > 0f) + npc.localAI[2] -= 1f; + + // Birb will do at least 1 different attack before entering this phase again + npc.localAI[3] = 1f; } else if (num1307 == 1) { npc.TargetClosest(true); npc.ai[0] = 3f; + + // Decrease enraged attacks by 1 + if (npc.localAI[2] > 0f) + npc.localAI[2] -= 1f; + + // Decrease amount of attacks until able to use other attacks again + if (npc.localAI[3] > 0f) + npc.localAI[3] -= 1f; + if (phase2) { - Main.PlaySound(SoundID.Item102, (int)npc.position.X, (int)npc.position.Y); - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, Main.rand.Next(-2, 3), -4f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Main.PlaySound(SoundID.Item102, (int)player.position.X, (int)player.position.Y); + int totalProjectiles = phase3 ? 5 : 3; + float radians = MathHelper.TwoPi / totalProjectiles; + int distance = 560; + for (int i = 0; i < totalProjectiles; i++) + { + Vector2 spawnVector = player.Center + Vector2.Normalize(new Vector2(0f, -featherVelocity).RotatedBy(radians * i)) * distance; + Vector2 velocity = Vector2.Normalize(player.Center - spawnVector) * featherVelocity; + Projectile.NewProjectile(spawnVector, velocity, ModContent.ProjectileType(), damage, 0f, Main.myPlayer); + } } } - else if (NPC.CountNPCS(ModContent.NPCType()) < num1305) + else if (NPC.CountNPCS(ModContent.NPCType()) < maxBirbs && npc.localAI[3] == 0f) { npc.TargetClosest(true); npc.ai[0] = 4f; - Main.PlaySound(SoundID.Item102, (int)npc.position.X, (int)npc.position.Y); - int featherAmt = phase2 ? 3 : 6; - if (death) - featherAmt *= 2; - for (int num186 = 0; num186 < featherAmt; num186++) + + // Birb will do at least 2 different attacks before entering this phase again + npc.localAI[3] = 2f; + + // Decrease enraged attacks by 1 + if (npc.localAI[2] > 0f) + npc.localAI[2] -= 1f; + + Main.PlaySound(SoundID.Item102, (int)player.position.X, (int)player.position.Y); + int totalProjectiles = phase2 ? 6 : 9; + float radians = MathHelper.TwoPi / totalProjectiles; + int distance = phase2 ? 720 : 880; + for (int i = 0; i < totalProjectiles; i++) { - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, Main.rand.Next(-4, 5), -3f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Vector2 spawnVector = player.Center + Vector2.Normalize(new Vector2(0f, -featherVelocity).RotatedBy(radians * i)) * distance; + Vector2 velocity = Vector2.Normalize(player.Center - spawnVector) * featherVelocity; + Projectile.NewProjectile(spawnVector, velocity, ModContent.ProjectileType(), damage, 0f, Main.myPlayer); } } } @@ -3914,7 +4092,8 @@ namespace CalamityMod.NPCs npc.ai[3] = 0f; } - float scaleFactor16 = 14f + value52.Length() / 100f; //7 + float velocity = 14f + (enrageScale - 1) * 4f; + float scaleFactor16 = velocity + value52.Length() / 100f; float num1308 = 25f; value52.Normalize(); value52 *= scaleFactor16; @@ -3948,7 +4127,7 @@ namespace CalamityMod.NPCs if (npc.collideX) { - npc.velocity.X *= (-npc.oldVelocity.X * 0.5f); + npc.velocity.X *= -npc.oldVelocity.X * 0.5f; if (npc.velocity.X > 4f) npc.velocity.X = 4f; if (npc.velocity.X < -4f) @@ -3956,7 +4135,7 @@ namespace CalamityMod.NPCs } if (npc.collideY) { - npc.velocity.Y *= (-npc.oldVelocity.Y * 0.5f); + npc.velocity.Y *= -npc.oldVelocity.Y * 0.5f; if (npc.velocity.Y > 4f) npc.velocity.Y = 4f; if (npc.velocity.Y < -4f) @@ -3969,7 +4148,8 @@ namespace CalamityMod.NPCs if (expertMode) npc.ai[2] += 0.0166666675f; - float scaleFactor17 = 8f + npc.ai[2] + value53.Length() / 120f; //4 + float velocity = 8f + (enrageScale - 1) * 2f; + float scaleFactor17 = velocity + npc.ai[2] + value53.Length() / 120f; float num1309 = 20f; value53.Normalize(); value53 *= scaleFactor17; @@ -4006,14 +4186,16 @@ namespace CalamityMod.NPCs else value54.X -= chargeDistance; - if (Math.Abs(npc.Center.X - player.Center.X) > chargeDistance - 50f && Math.Abs(npc.Center.Y - player.Center.Y) < (phase3 ? 100f : 20f)) + float verticalDistanceGateValue = (phase3 ? 100f : 20f) + (enrageScale - 1) * 20f; + if (Math.Abs(npc.Center.X - player.Center.X) > chargeDistance - 50f && Math.Abs(npc.Center.Y - player.Center.Y) < verticalDistanceGateValue) { npc.ai[0] = 3.1f; npc.ai[1] = 0f; } npc.ai[1] += 0.0333333351f; - float scaleFactor18 = 18f + npc.ai[1]; + float velocity = 16f + (enrageScale - 1) * 4f; + float scaleFactor18 = velocity + npc.ai[1]; float num1310 = 4f; value54.Normalize(); value54 *= scaleFactor18; @@ -4029,7 +4211,7 @@ namespace CalamityMod.NPCs Vector2 vector206 = player.Center - npc.Center; vector206.Y -= 12f; - float scaleFactor19 = 32f; //16 + float scaleFactor19 = 28f + (enrageScale - 1) * 4f; float num1311 = 8f; vector206.Normalize(); vector206 *= scaleFactor19; @@ -4061,14 +4243,15 @@ namespace CalamityMod.NPCs // Charge else if (npc.ai[0] == 3.2f) { - npc.damage = (int)(npc.defDamage * 1.5); + npc.damage = (int)(npc.defDamage * 1.3); npc.collideX = false; npc.collideY = false; npc.noTileCollide = true; npc.ai[2] += 0.0333333351f; - npc.velocity.X = (32f + npc.ai[2]) * npc.ai[1]; + float velocity = 28f + (enrageScale - 1) * 4f; + npc.velocity.X = (velocity + npc.ai[2]) * npc.ai[1]; if ((npc.ai[1] > 0f && npc.Center.X > player.Center.X + (chargeDistance - 140f)) || (npc.ai[1] < 0f && npc.Center.X < player.Center.X - (chargeDistance - 140f))) { @@ -4093,138 +4276,74 @@ namespace CalamityMod.NPCs npc.rotation = (npc.rotation * rotationMult * 0.5f + npc.velocity.X * rotationAmt * 0.85f) / 5f; } - // Find tile coordinates for birb spawn + // Birb spawn else if (npc.ai[0] == 4f) { - npc.ai[0] = 0f; - - if (Main.netMode != NetmodeID.MultiplayerClient) + if (npc.ai[1] == 0f) { - npc.ai[1] = -1f; - npc.ai[2] = -1f; + Vector2 destination2 = player.Center + new Vector2(0f, -200f); + Vector2 desiredVelocity2 = npc.DirectionTo(destination2) * 18f; + npc.SimpleFlyMovement(desiredVelocity2, 1.5f); - for (int num1312 = 0; num1312 < 1000; num1312++) + if (npc.velocity.X < 0f) + npc.direction = -1; + else + npc.direction = 1; + + npc.spriteDirection = npc.direction; + + npc.ai[2] += 1f; + if (npc.Distance(player.Center) < 600f || npc.ai[2] >= 180f) { - int num1313 = (int)player.Center.X / 16; - int num1314 = (int)player.Center.Y / 16; - - int num1315 = 30 + num1312 / 50; - int num1316 = 20 + num1312 / 75; - - num1313 += Main.rand.Next(-num1315, num1315 + 1); - num1314 += Main.rand.Next(-num1316, num1316 + 1); - - if (!WorldGen.SolidTile(num1313, num1314)) - { - while (!WorldGen.SolidTile(num1313, num1314) && num1314 < Main.worldSurface) - num1314++; - - if ((new Vector2(num1313 * 16 + 8, num1314 * 16 + 8) - player.Center).Length() < 1200f) - { - npc.ai[0] = 4.1f; - npc.ai[1] = num1313; - npc.ai[2] = num1314; - break; - } - } + npc.ai[1] = 1f; + npc.netUpdate = true; } } - - npc.netUpdate = true; - } - - // Move to birb spawn location - else if (npc.ai[0] == 4.1f) - { - if (npc.velocity.X < -2f) - npc.direction = -1; - else if (npc.velocity.X > 2f) - npc.direction = 1; - - npc.spriteDirection = npc.direction; - npc.rotation = (npc.rotation * rotationMult + npc.velocity.X * rotationAmt * 1.25f) / 10f; - - npc.noTileCollide = true; - - int num1317 = (int)npc.ai[1]; - int num1318 = (int)npc.ai[2]; - - float x2 = num1317 * 16 + 8; - float y2 = num1318 * 16 - 20; - - Vector2 vector207 = new Vector2(x2, y2); - vector207 -= npc.Center; - float num1319 = 12f + vector207.Length() / 150f; - if (num1319 > 20f) - num1319 = 20f; - - float num1320 = 10f; - if (vector207.Length() < 50f) - npc.ai[0] = 4.2f; - - vector207.Normalize(); - vector207 *= num1319; - npc.velocity = (npc.velocity * (num1320 - 1f) + vector207) / num1320; - } - - // Spawn birbs - else if (npc.ai[0] == 4.2f) - { - npc.rotation = (npc.rotation * rotationMult + npc.velocity.X * rotationAmt * 1.25f) / 10f; - - npc.noTileCollide = true; - - int num1321 = (int)npc.ai[1]; - int num1322 = (int)npc.ai[2]; - - float x3 = num1321 * 16 + 8; - float y3 = num1322 * 16 - 20; - - Vector2 vector208 = new Vector2(x3, y3); - vector208 -= npc.Center; - - float num1323 = 4f; //4 - float num1324 = 2f; //2 - - if (Main.netMode != NetmodeID.MultiplayerClient && vector208.Length() < 20f) + else { - int num1325 = 10; - if (expertMode) - num1325 = (int)(num1325 * 0.75); + if (npc.ai[1] < 90f) + npc.velocity *= 0.95f; + else + npc.velocity *= 0.98f; - npc.ai[3] += 1f; - if (npc.ai[3] == num1325) + if (npc.ai[1] == 90f) { - SoundEffectInstance sound = Main.PlaySound(SoundID.DD2_BetsySummon, (int)npc.position.X, (int)npc.position.Y); + if (npc.velocity.Y > 0f) + npc.velocity.Y /= 3f; + + npc.velocity.Y -= 3f; + } + + // Sound + if (npc.ai[1] == birbSpawnPhaseTimer - 60f) + { + SoundEffectInstance sound = Main.PlaySound(SoundID.DD2_BetsyScream, (int)npc.position.X, (int)npc.position.Y); if (sound != null) { sound.Pitch = 0.25f; } - - NPC.NewNPC(num1321 * 16 + 8, num1322 * 16, ModContent.NPCType(), npc.whoAmI, 0f, 0f, 0f, 0f, 255); } - else if (npc.ai[3] == num1325 * 2) + + if (Main.netMode != NetmodeID.MultiplayerClient) { - npc.TargetClosest(true); - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - - if (NPC.CountNPCS(ModContent.NPCType()) < num1305 && Main.rand.NextBool(2)) - npc.ai[0] = 4f; - else if (Collision.SolidCollision(npc.position, npc.width, npc.height)) - npc.ai[0] = 1f; + bool spawnFlag = NPC.CountNPCS(ModContent.NPCType()) < maxBirbs && (npc.ai[1] == 140f || npc.ai[1] == 170f); + if (spawnFlag) + { + Vector2 vector7 = npc.Center + (MathHelper.TwoPi * Main.rand.NextFloat()).ToRotationVector2() * new Vector2(2f, 1f) * 50f * (0.6f + Main.rand.NextFloat() * 0.4f); + if (Vector2.Distance(vector7, player.Center) > 150f) + NPC.NewNPC((int)vector7.X, (int)vector7.Y, ModContent.NPCType(), npc.whoAmI); + } } + + npc.ai[1] += 1f; } - if (vector208.Length() > num1323) + if (npc.ai[1] >= birbSpawnPhaseTimer) { - vector208.Normalize(); - vector208 *= num1323; + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; } - - npc.velocity = (npc.velocity * (num1324 - 1f) + vector208) / num1324; } // Spit homing aura sphere @@ -4243,7 +4362,8 @@ namespace CalamityMod.NPCs if (Main.netMode != NetmodeID.MultiplayerClient) { Vector2 vector7 = npc.rotation.ToRotationVector2() * (Vector2.UnitX * npc.direction) * (npc.width + 20) / 2f + vector; - Projectile.NewProjectile(vector7.X, vector7.Y, 0f, 0f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, phase3 ? 1f : 0f, npc.target + 1); + float ai0 = (phase3 ? 1f : 0f) + (enrageScale - 1); + Projectile.NewProjectile(vector7.X, vector7.Y, 0f, 0f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, ai0, npc.target + 1); } } @@ -4350,7 +4470,7 @@ namespace CalamityMod.NPCs if (CalamityWorld.bossRushActive) { - num2 = 45; + num2 = 35; num3 *= 1.1f; scaleFactor *= 1.15f; chargeTime -= 3; @@ -4361,18 +4481,18 @@ namespace CalamityMod.NPCs scaleFactor *= 0.25f; // Variables - int num6 = 120; - int num7 = 24; - float num8 = 0.3f; - float scaleFactor2 = 6f; + int num6 = CalamityWorld.bossRushActive ? 60 : 120; + int num7 = CalamityWorld.bossRushActive ? 12 : 24; + float num8 = CalamityWorld.bossRushActive ? 0.6f : 0.4f; + float scaleFactor2 = CalamityWorld.bossRushActive ? 10f : 7f; int num9 = 120; int num10 = 180; int num11 = 180; int num12 = 30; - int num13 = 120; - int num14 = 24; + int num13 = CalamityWorld.bossRushActive ? 60 : 120; + int num14 = CalamityWorld.bossRushActive ? 12 : 24; float spinTime = num13 / 2; - float scaleFactor3 = 9f; + float scaleFactor3 = CalamityWorld.bossRushActive ? 11f : 9f; float scaleFactor4 = 22f; float num15 = MathHelper.TwoPi / spinTime; int num16 = 75; @@ -4425,7 +4545,7 @@ namespace CalamityMod.NPCs // Enrage if (enrage) { - num2 = 40; + num2 = 30; npc.damage = npc.defDamage * 2; npc.defense = npc.defDefense * 2; npc.ai[3] = 0f; @@ -4574,30 +4694,7 @@ namespace CalamityMod.NPCs npc.ai[1] = 500 * Math.Sign((vector - player.Center).X); Vector2 vector3 = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -300f) - vector - npc.velocity) * scaleFactor; - if (npc.velocity.X < vector3.X) - { - npc.velocity.X += num3; - if (npc.velocity.X < 0f && vector3.X > 0f) - npc.velocity.X += num3; - } - else if (npc.velocity.X > vector3.X) - { - npc.velocity.X -= num3; - if (npc.velocity.X > 0f && vector3.X < 0f) - npc.velocity.X -= num3; - } - if (npc.velocity.Y < vector3.Y) - { - npc.velocity.Y += num3; - if (npc.velocity.Y < 0f && vector3.Y > 0f) - npc.velocity.Y += num3; - } - else if (npc.velocity.Y > vector3.Y) - { - npc.velocity.Y -= num3; - if (npc.velocity.Y > 0f && vector3.Y < 0f) - npc.velocity.Y -= num3; - } + npc.SimpleFlyMovement(vector3, num3); // Rotation and direction int num22 = Math.Sign(player.Center.X - vector.X); @@ -4736,30 +4833,7 @@ namespace CalamityMod.NPCs npc.ai[1] = 500 * Math.Sign((vector - player.Center).X); Vector2 vector5 = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -300f) - vector - npc.velocity) * scaleFactor2; - if (npc.velocity.X < vector5.X) - { - npc.velocity.X += num8; - if (npc.velocity.X < 0f && vector5.X > 0f) - npc.velocity.X += num8; - } - else if (npc.velocity.X > vector5.X) - { - npc.velocity.X -= num8; - if (npc.velocity.X > 0f && vector5.X < 0f) - npc.velocity.X -= num8; - } - if (npc.velocity.Y < vector5.Y) - { - npc.velocity.Y += num8; - if (npc.velocity.Y < 0f && vector5.Y > 0f) - npc.velocity.Y += num8; - } - else if (npc.velocity.Y > vector5.Y) - { - npc.velocity.Y -= num8; - if (npc.velocity.Y > 0f && vector5.Y < 0f) - npc.velocity.Y -= num8; - } + npc.SimpleFlyMovement(vector5, num8); // Play sounds and spawn Tooth Balls if (npc.ai[2] == 0f) @@ -4773,7 +4847,7 @@ namespace CalamityMod.NPCs if (Main.netMode != NetmodeID.MultiplayerClient) { Vector2 vector6 = Vector2.Normalize(player.Center - vector) * (npc.width + 20) / 2f + vector; - NPC.NewNPC((int)vector6.X, (int)vector6.Y + 45, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); + NPC.NewNPC((int)vector6.X, (int)vector6.Y + 45, ModContent.NPCType()); } } @@ -4874,30 +4948,7 @@ namespace CalamityMod.NPCs npc.ai[1] = 500 * Math.Sign((vector - player.Center).X); Vector2 vector8 = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -300f) - vector - npc.velocity) * scaleFactor; - if (npc.velocity.X < vector8.X) - { - npc.velocity.X += num3; - if (npc.velocity.X < 0f && vector8.X > 0f) - npc.velocity.X += num3; - } - else if (npc.velocity.X > vector8.X) - { - npc.velocity.X -= num3; - if (npc.velocity.X > 0f && vector8.X < 0f) - npc.velocity.X -= num3; - } - if (npc.velocity.Y < vector8.Y) - { - npc.velocity.Y += num3; - if (npc.velocity.Y < 0f && vector8.Y > 0f) - npc.velocity.Y += num3; - } - else if (npc.velocity.Y > vector8.Y) - { - npc.velocity.Y -= num3; - if (npc.velocity.Y > 0f && vector8.Y < 0f) - npc.velocity.Y -= num3; - } + npc.SimpleFlyMovement(vector8, num3); // Direction and rotation int num27 = Math.Sign(player.Center.X - vector.X); @@ -5048,7 +5099,7 @@ namespace CalamityMod.NPCs { Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/OldDukeRoar"), (int)npc.position.X, (int)npc.position.Y); - int damage = expertMode ? 100 : 140; + int damage = expertMode ? CalamityUtils.GetMasterModeProjectileDamage(100, 1.5) : 140; Vector2 vortexSpawn = vector + npc.velocity.RotatedBy(MathHelper.PiOver2 * -npc.direction) * spinTime / MathHelper.TwoPi; if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -5064,7 +5115,7 @@ namespace CalamityMod.NPCs if (Main.netMode != NetmodeID.MultiplayerClient) { Vector2 vector10 = Vector2.Normalize(npc.velocity) * (npc.width + 20) / 2f + vector; - int num31 = NPC.NewNPC((int)vector10.X, (int)vector10.Y + 45, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); + int num31 = NPC.NewNPC((int)vector10.X, (int)vector10.Y + 45, ModContent.NPCType()); Main.npc[num31].target = npc.target; Main.npc[num31].velocity = Vector2.Normalize(npc.velocity).RotatedBy(MathHelper.PiOver2 * npc.direction) * scaleFactor3; Main.npc[num31].netUpdate = true; @@ -5102,7 +5153,7 @@ namespace CalamityMod.NPCs if (Main.netMode != NetmodeID.MultiplayerClient) { Vector2 vector7 = npc.rotation.ToRotationVector2() * (Vector2.UnitX * npc.direction) * (npc.width + 20) / 2f + vector; - int damage = expertMode ? 55 : 70; + int damage = expertMode ? CalamityUtils.GetMasterModeProjectileDamage(55, 1.5) : 70; for (int i = 0; i < 20; i++) { float velocityX = npc.direction * 6 * (Main.rand.NextFloat() + 0.5f); @@ -5414,7 +5465,7 @@ namespace CalamityMod.NPCs if (Main.netMode != NetmodeID.MultiplayerClient) { Vector2 vector7 = npc.rotation.ToRotationVector2() * (Vector2.UnitX * npc.direction) * (npc.width + 20) / 2f + vector; - int damage = expertMode ? 55 : 70; + int damage = expertMode ? CalamityUtils.GetMasterModeProjectileDamage(55, 1.5) : 70; for (int i = 0; i < 20; i++) { float velocityX = npc.direction * 6 * (Main.rand.NextFloat() + 0.5f); @@ -5455,7 +5506,7 @@ namespace CalamityMod.NPCs { Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/OldDukeRoar"), (int)npc.position.X, (int)npc.position.Y); - int damage = expertMode ? 100 : 140; + int damage = expertMode ? CalamityUtils.GetMasterModeProjectileDamage(100, 1.5) : 140; Vector2 vortexSpawn = vector + npc.velocity.RotatedBy(MathHelper.PiOver2 * -npc.direction) * spinTime / MathHelper.TwoPi; if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -5470,8 +5521,8 @@ namespace CalamityMod.NPCs if (Main.netMode != NetmodeID.MultiplayerClient) { - Vector2 vector10 = Vector2.Normalize(npc.velocity) * (float)(npc.width + 20) / 2f + vector; - int num31 = NPC.NewNPC((int)vector10.X, (int)vector10.Y + 45, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); + Vector2 vector10 = Vector2.Normalize(npc.velocity) * (npc.width + 20) / 2f + vector; + int num31 = NPC.NewNPC((int)vector10.X, (int)vector10.Y + 45, ModContent.NPCType()); Main.npc[num31].target = npc.target; Main.npc[num31].velocity = Vector2.Normalize(npc.velocity).RotatedBy(MathHelper.PiOver2 * npc.direction) * scaleFactor3; Main.npc[num31].netUpdate = true; @@ -5726,7 +5777,7 @@ namespace CalamityMod.NPCs Vector2 targetVector = player.Center - vectorCenter; float offsetAngle = 0f; int totalProjectiles = 0; - int chains = 0; + //int chains = 0; // Parabolic Arcs if (npc.localAI[0] % 60f == 0f) @@ -6245,19 +6296,19 @@ namespace CalamityMod.NPCs { if (npc.position.X < Main.npc[i].position.X) { - npc.velocity.X = npc.velocity.X - 0.05f; + npc.velocity.X -= 0.05f; } else { - npc.velocity.X = npc.velocity.X + 0.05f; + npc.velocity.X += 0.05f; } if (npc.position.Y < Main.npc[i].position.Y) { - npc.velocity.Y = npc.velocity.Y - 0.05f; + npc.velocity.Y -= 0.05f; } else { - npc.velocity.Y = npc.velocity.Y + 0.05f; + npc.velocity.Y += 0.05f; } } } @@ -6362,7 +6413,7 @@ namespace CalamityMod.NPCs { if (Math.Sign(npc.velocity.X) != npc.direction && !DogPhase1) { - npc.velocity.X = npc.velocity.X * 0.92f; + npc.velocity.X *= 0.92f; } float num9 = MathHelper.Lerp(0.6f, 1f, Math.Abs(Main.windSpeedSet)) * (float)Math.Sign(Main.windSpeedSet); if (!Main.player[npc.target].ZoneSandstorm) diff --git a/NPCs/CalamityGlobalAI.cs b/NPCs/CalamityGlobalAI.cs index d54805a424..29210e7108 100644 --- a/NPCs/CalamityGlobalAI.cs +++ b/NPCs/CalamityGlobalAI.cs @@ -3,8 +3,6 @@ using CalamityMod.NPCs.Astral; using CalamityMod.NPCs.Crags; using CalamityMod.NPCs.NormalNPCs; using CalamityMod.Projectiles.Boss; -using CalamityMod.Items.LoreItems; -using CalamityMod.Tiles.Ores; using CalamityMod.World; using Microsoft.Xna.Framework; using System; @@ -12,7 +10,6 @@ using System.Collections.Generic; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Events; -using Terraria.Localization; using Terraria.ID; using Terraria.ModLoader; @@ -1389,13 +1386,17 @@ namespace CalamityMod.NPCs float totalSegments = GetEaterOfWorldsSegmentsCountRevDeath(); // Count segments remaining - float segmentCount = NPC.CountNPCS(NPCID.EaterofWorldsHead) + NPC.CountNPCS(NPCID.EaterofWorldsBody) + NPC.CountNPCS(NPCID.EaterofWorldsTail); // 2f to 65f + float segmentCount = NPC.CountNPCS(NPCID.EaterofWorldsHead) + NPC.CountNPCS(NPCID.EaterofWorldsBody) + NPC.CountNPCS(NPCID.EaterofWorldsTail); // Percent segments remaining, add two to total for head and tail float lifeRatio = segmentCount / (totalSegments + 2); - // Phases - bool phase2 = lifeRatio < 0.9f || death; + // 10 seconds of resistance to prevent spawn killing + if (calamityGlobalNPC.newAI[1] < 600f && CalamityWorld.bossRushActive) + calamityGlobalNPC.newAI[1] += 1f; + + // Phases + bool phase2 = lifeRatio < 0.9f || death; bool phase3 = lifeRatio < 0.75f || death; bool phase4 = lifeRatio < 0.4f || death; bool phase5 = lifeRatio < 0.1f || (death && lifeRatio < 0.33f); @@ -1460,8 +1461,14 @@ namespace CalamityMod.NPCs } } - // Worm variable - npc.realLife = -1; + // Set worm variable for worms + if (CalamityWorld.bossRushActive) + { + if (npc.ai[3] > 0f) + npc.realLife = (int)npc.ai[3]; + } + else + npc.realLife = -1; // Target if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead) @@ -1474,94 +1481,150 @@ namespace CalamityMod.NPCs npc.timeLeft = 300; } + if (CalamityWorld.bossRushActive) + { + // Check if other segments are still alive, if not, die + if (npc.type > NPCID.EaterofWorldsHead) + { + bool shouldDespawn = true; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == NPCID.EaterofWorldsHead) + shouldDespawn = false; + } + if (!shouldDespawn) + { + if (npc.ai[1] > 0f) + shouldDespawn = false; + else if (Main.npc[(int)npc.ai[1]].life > 0) + shouldDespawn = false; + } + if (shouldDespawn) + { + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.checkDead(); + npc.active = false; + } + } + } + // Spawn segments if (Main.netMode != NetmodeID.MultiplayerClient) { - if ((npc.type == NPCID.EaterofWorldsHead || npc.type == NPCID.EaterofWorldsBody) && npc.ai[0] == 0f) - { - // Spawn entire worm - if (npc.type == NPCID.EaterofWorldsHead) - { - // Length - npc.ai[2] = totalSegments; + if (CalamityWorld.bossRushActive) + { + // Spawn segments from head + if (npc.ai[0] == 0f && npc.type == NPCID.EaterofWorldsHead) + { + npc.ai[3] = npc.whoAmI; + npc.realLife = npc.whoAmI; + int index = npc.whoAmI; - // Body spawn - npc.ai[0] = NPC.NewNPC((int)(npc.position.X + (npc.width / 2)), (int)(npc.position.Y + npc.height), npc.type + 1, npc.whoAmI, 0f, 0f, 0f, 0f, 255); - } - else if (npc.type == NPCID.EaterofWorldsBody && npc.ai[2] > 0f) - { - // Body spawn - npc.ai[0] = NPC.NewNPC((int)(npc.position.X + (npc.width / 2)), (int)(npc.position.Y + npc.height), npc.type, npc.whoAmI, 0f, 0f, 0f, 0f, 255); - } - else - { - // Tail spawn - npc.ai[0] = NPC.NewNPC((int)(npc.position.X + (npc.width / 2)), (int)(npc.position.Y + npc.height), npc.type + 1, npc.whoAmI, 0f, 0f, 0f, 0f, 255); - } + for (int j = 0; j <= totalSegments; j++) + { + int type = NPCID.EaterofWorldsBody; + if (j == totalSegments) + type = NPCID.EaterofWorldsTail; - // Worm shit - Main.npc[(int)npc.ai[0]].ai[1] = npc.whoAmI; - Main.npc[(int)npc.ai[0]].ai[2] = npc.ai[2] - 1f; - npc.netUpdate = true; - } - - // Splitting effect - if (!Main.npc[(int)npc.ai[1]].active && !Main.npc[(int)npc.ai[0]].active) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - npc.active = false; - NetMessage.SendData(MessageID.StrikeNPC, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); - } - if (npc.type == NPCID.EaterofWorldsHead && !Main.npc[(int)npc.ai[0]].active) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - npc.active = false; - NetMessage.SendData(MessageID.StrikeNPC, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); - } - if (npc.type == NPCID.EaterofWorldsTail && !Main.npc[(int)npc.ai[1]].active) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - npc.active = false; - NetMessage.SendData(MessageID.StrikeNPC, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); - } - if (npc.type == NPCID.EaterofWorldsBody && (!Main.npc[(int)npc.ai[1]].active || Main.npc[(int)npc.ai[1]].aiStyle != npc.aiStyle)) - { - npc.type = NPCID.EaterofWorldsHead; - int whoAmI = npc.whoAmI; - float num25 = npc.life / (float)npc.lifeMax; - float num26 = npc.ai[0]; - int aiTimer = calamityGlobalNPC.AITimer; - npc.SetDefaultsKeepPlayerInteraction(npc.type); - npc.life = (int)(npc.lifeMax * num25); - npc.ai[0] = num26; - npc.TargetClosest(true); - npc.netUpdate = true; - npc.whoAmI = whoAmI; - calamityGlobalNPC.AITimer = aiTimer; - } - if (npc.type == NPCID.EaterofWorldsBody && (!Main.npc[(int)npc.ai[0]].active || Main.npc[(int)npc.ai[0]].aiStyle != npc.aiStyle)) - { - int whoAmI2 = npc.whoAmI; - float num27 = npc.life / (float)npc.lifeMax; - float num28 = npc.ai[1]; - int aiTimer = calamityGlobalNPC.AITimer; - npc.SetDefaultsKeepPlayerInteraction(npc.type); - npc.life = (int)(npc.lifeMax * num27); - npc.ai[1] = num28; - npc.TargetClosest(true); - npc.netUpdate = true; - npc.whoAmI = whoAmI2; - calamityGlobalNPC.AITimer = aiTimer; + int segment = NPC.NewNPC((int)(npc.position.X + (npc.width / 2)), (int)(npc.position.Y + npc.height), type, npc.whoAmI, 0f, 0f, 0f, 0f, 255); + Main.npc[segment].ai[3] = npc.whoAmI; + Main.npc[segment].realLife = npc.whoAmI; + Main.npc[segment].ai[1] = index; + Main.npc[index].ai[0] = segment; + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, segment, 0f, 0f, 0f, 0, 0, 0); + index = segment; + } + } } + else + { + if ((npc.type == NPCID.EaterofWorldsHead || npc.type == NPCID.EaterofWorldsBody) && npc.ai[0] == 0f) + { + // Spawn entire worm + if (npc.type == NPCID.EaterofWorldsHead) + { + // Length + npc.ai[2] = totalSegments; - if (!npc.active && Main.netMode == NetmodeID.Server) - NetMessage.SendData(MessageID.StrikeNPC, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); + // Body spawn + npc.ai[0] = NPC.NewNPC((int)(npc.position.X + (npc.width / 2)), (int)(npc.position.Y + npc.height), npc.type + 1, npc.whoAmI, 0f, 0f, 0f, 0f, 255); + } + else if (npc.type == NPCID.EaterofWorldsBody && npc.ai[2] > 0f) + { + // Body spawn + npc.ai[0] = NPC.NewNPC((int)(npc.position.X + (npc.width / 2)), (int)(npc.position.Y + npc.height), npc.type, npc.whoAmI, 0f, 0f, 0f, 0f, 255); + } + else + { + // Tail spawn + npc.ai[0] = NPC.NewNPC((int)(npc.position.X + (npc.width / 2)), (int)(npc.position.Y + npc.height), npc.type + 1, npc.whoAmI, 0f, 0f, 0f, 0f, 255); + } + + // Worm shit + Main.npc[(int)npc.ai[0]].ai[1] = npc.whoAmI; + Main.npc[(int)npc.ai[0]].ai[2] = npc.ai[2] - 1f; + npc.netUpdate = true; + } + + // Splitting effect + if (!Main.npc[(int)npc.ai[1]].active && !Main.npc[(int)npc.ai[0]].active) + { + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.checkDead(); + npc.active = false; + NetMessage.SendData(MessageID.StrikeNPC, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); + } + if (npc.type == NPCID.EaterofWorldsHead && !Main.npc[(int)npc.ai[0]].active) + { + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.checkDead(); + npc.active = false; + NetMessage.SendData(MessageID.StrikeNPC, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); + } + if (npc.type == NPCID.EaterofWorldsTail && !Main.npc[(int)npc.ai[1]].active) + { + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.checkDead(); + npc.active = false; + NetMessage.SendData(MessageID.StrikeNPC, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); + } + if (npc.type == NPCID.EaterofWorldsBody && (!Main.npc[(int)npc.ai[1]].active || Main.npc[(int)npc.ai[1]].aiStyle != npc.aiStyle)) + { + npc.type = NPCID.EaterofWorldsHead; + int whoAmI = npc.whoAmI; + float num25 = npc.life / (float)npc.lifeMax; + float num26 = npc.ai[0]; + int aiTimer = calamityGlobalNPC.AITimer; + npc.SetDefaultsKeepPlayerInteraction(npc.type); + npc.life = (int)(npc.lifeMax * num25); + npc.ai[0] = num26; + npc.TargetClosest(true); + npc.netUpdate = true; + npc.whoAmI = whoAmI; + calamityGlobalNPC.AITimer = aiTimer; + } + if (npc.type == NPCID.EaterofWorldsBody && (!Main.npc[(int)npc.ai[0]].active || Main.npc[(int)npc.ai[0]].aiStyle != npc.aiStyle)) + { + int whoAmI2 = npc.whoAmI; + float num27 = npc.life / (float)npc.lifeMax; + float num28 = npc.ai[1]; + int aiTimer = calamityGlobalNPC.AITimer; + npc.SetDefaultsKeepPlayerInteraction(npc.type); + npc.life = (int)(npc.lifeMax * num27); + npc.ai[1] = num28; + npc.TargetClosest(true); + npc.netUpdate = true; + npc.whoAmI = whoAmI2; + calamityGlobalNPC.AITimer = aiTimer; + } + + if (!npc.active && Main.netMode == NetmodeID.Server) + NetMessage.SendData(MessageID.StrikeNPC, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); + } } // Movement @@ -1748,7 +1811,7 @@ namespace CalamityMod.NPCs bool flag5 = true; for (int num58 = 0; num58 < Main.maxPlayers; num58++) { - if (Main.player[num58].active && !Main.player[num58].dead && Main.player[num58].ZoneCorrupt) + if (Main.player[num58].active && !Main.player[num58].dead && (Main.player[num58].ZoneCorrupt || Main.player[num58].ZoneCrimson)) flag5 = false; } @@ -1866,7 +1929,7 @@ namespace CalamityMod.NPCs public static int GetEaterOfWorldsSegmentsCountRevDeath() { - return CalamityWorld.death ? 80 : 75; + return (CalamityWorld.death || CalamityWorld.bossRushActive) ? 80 : 75; } #endregion @@ -2056,7 +2119,7 @@ namespace CalamityMod.NPCs // Velocity int var = 120; float velocity = MathHelper.TwoPi / (var * 0.75f); - npc.velocity = npc.velocity.RotatedBy(-(double)velocity * npc.ai[1], default); + npc.velocity = npc.velocity.RotatedBy(-(double)velocity * npc.ai[1]); npc.ai[2] += 1f; @@ -2083,7 +2146,7 @@ namespace CalamityMod.NPCs // Blood dust for (int num621 = 0; num621 < 6; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 5, 0f, 0f, 100, default, 1f); + int num622 = Dust.NewDust(npc.position, npc.width, npc.height, 5, 0f, 0f, 100, default, 1f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -2093,10 +2156,10 @@ namespace CalamityMod.NPCs } for (int num623 = 0; num623 < 12; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 5, 0f, 0f, 100, default, 1.5f); + int num624 = Dust.NewDust(npc.position, npc.width, npc.height, 5, 0f, 0f, 100, default, 1.5f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 5, 0f, 0f, 100, default, 1f); + num624 = Dust.NewDust(npc.position, npc.width, npc.height, 5, 0f, 0f, 100, default, 1f); Main.dust[num624].velocity *= 2f; } @@ -2522,7 +2585,7 @@ namespace CalamityMod.NPCs public static int GetBrainOfCthuluCreepersCountRevDeath() { - return CalamityWorld.death ? 30 : 25; + return (CalamityWorld.death || CalamityWorld.bossRushActive) ? 30 : 25; } private static float GetCrimsonBossKnockBack(NPC npc, int numPlayers, float lifeScale, float baseKnockBackResist) @@ -2559,8 +2622,8 @@ namespace CalamityMod.NPCs #region Buffed Queen Bee AI public static bool BuffedQueenBeeAI(NPC npc, Mod mod, bool chaos) - { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + { + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); bool death = CalamityWorld.death || CalamityWorld.bossRushActive; int enrageScale = 0; @@ -2585,9 +2648,9 @@ namespace CalamityMod.NPCs npc.damage = npc.defDamage + statBoost; } - // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(true); + // Get a target + if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) + npc.TargetClosest(true); // Despawn float num616 = Vector2.Distance(npc.Center, Main.player[npc.target].Center); @@ -2637,48 +2700,36 @@ namespace CalamityMod.NPCs // Pick a random phase else if (npc.ai[0] == -1f) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - float num617 = npc.ai[1]; + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { int num618; - do - { - num618 = Main.rand.Next(3); - switch (num618) - { - case 1: - num618 = 2; - break; - case 2: - num618 = 3; - break; - } - } - while ((float)num618 == num617); + do num618 = Main.rand.Next(4); + while (num618 == npc.ai[1] || num618 == 1); + npc.ai[0] = num618; npc.ai[1] = 0f; npc.ai[2] = 0f; } - } + } - // Charging phase - else if (npc.ai[0] == 0f) - { - // Number of charges - int chargeAmt = 2 + enrageScale; - if (npc.life < npc.lifeMax / 3 || death) - chargeAmt++; + // Charging phase + else if (npc.ai[0] == 0f) + { + // Number of charges + int chargeAmt = 2 + enrageScale; + if (npc.life < npc.lifeMax / 3 || death) + chargeAmt++; // Switch to a random phase if chargeAmt has been exceeded if (npc.ai[1] > (2 * chargeAmt) && npc.ai[1] % 2f == 0f) - { - npc.ai[0] = -1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - return false; - } + { + npc.ai[0] = -1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.netUpdate = true; + return false; + } // Charge velocity float speed = 16f; @@ -2696,41 +2747,41 @@ namespace CalamityMod.NPCs if (npc.life < npc.lifeMax * 0.1 || death) speed += 2f; - speed += 8f * (float)enrageScale; + speed += 8f * enrageScale; // Line up and initiate charge if (npc.ai[1] % 2f == 0f) - { - // Get target and initiate charge - npc.TargetClosest(true); + { + // Get target and initiate charge + npc.TargetClosest(true); float num620 = 20f; - num620 += (float)(20 * enrageScale); + num620 += 20 * enrageScale; if (Math.Abs(npc.position.Y + (npc.height / 2) - (Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2))) < num620) - { - // Set AI variables and speed - npc.localAI[0] = 1f; - npc.ai[1] += 1f; - npc.ai[2] = 0f; + { + // Set AI variables and speed + npc.localAI[0] = 1f; + npc.ai[1] += 1f; + npc.ai[2] = 0f; - // Get target location - Vector2 vector74 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num599 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector74.X; - float num600 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector74.Y; - float num601 = (float)Math.Sqrt(num599 * num599 + num600 * num600); - num601 = speed / num601; - npc.velocity.X = num599 * num601; - npc.velocity.Y = num600 * num601; + // Get target location + Vector2 vector74 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num599 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector74.X; + float num600 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector74.Y; + float num601 = (float)Math.Sqrt(num599 * num599 + num600 * num600); + num601 = speed / num601; + npc.velocity.X = num599 * num601; + npc.velocity.Y = num600 * num601; - // Face the correct direction and play charge sound - npc.spriteDirection = npc.direction; - Main.PlaySound(SoundID.Roar, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); - return false; - } + // Face the correct direction and play charge sound + npc.spriteDirection = npc.direction; + Main.PlaySound(SoundID.Roar, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); + return false; + } - // Velocity variables - npc.localAI[0] = 0f; - float num602 = 12f; - float num603 = 0.15f; + // Velocity variables + npc.localAI[0] = 0f; + float num602 = 12f; + float num603 = 0.15f; if (npc.life < npc.lifeMax * 0.75 || death) { num602 += 1f; @@ -2746,67 +2797,67 @@ namespace CalamityMod.NPCs num602 += 2f; num603 += 0.05f; } - if (npc.life < npc.lifeMax * 0.1 || death) - { - num602 += 2f; - num603 += 0.1f; - } - num602 += (float)(3 * enrageScale); - num603 += 0.5f * (float)enrageScale; + if (npc.life < npc.lifeMax * 0.1 || death) + { + num602 += 2f; + num603 += 0.1f; + } + num602 += 3 * enrageScale; + num603 += 0.5f * enrageScale; // Velocity calculations if (npc.position.Y + (npc.height / 2) < Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2)) - npc.velocity.Y += num603; - else - npc.velocity.Y -= num603; + npc.velocity.Y += num603; + else + npc.velocity.Y -= num603; - if (npc.velocity.Y < -num602) - npc.velocity.Y = -num602; - if (npc.velocity.Y > num602) - npc.velocity.Y = num602; + if (npc.velocity.Y < -num602) + npc.velocity.Y = -num602; + if (npc.velocity.Y > num602) + npc.velocity.Y = num602; - if (Math.Abs(npc.position.X + (npc.width / 2) - (Main.player[npc.target].position.X + (Main.player[npc.target].width / 2))) > 500f) - npc.velocity.X += num603 * npc.direction; - else if (Math.Abs(npc.position.X + (npc.width / 2) - (Main.player[npc.target].position.X + (Main.player[npc.target].width / 2))) < 300f) - npc.velocity.X -= num603 * npc.direction; - else - npc.velocity.X *= 0.8f; + if (Math.Abs(npc.position.X + (npc.width / 2) - (Main.player[npc.target].position.X + (Main.player[npc.target].width / 2))) > 500f) + npc.velocity.X += num603 * npc.direction; + else if (Math.Abs(npc.position.X + (npc.width / 2) - (Main.player[npc.target].position.X + (Main.player[npc.target].width / 2))) < 300f) + npc.velocity.X -= num603 * npc.direction; + else + npc.velocity.X *= 0.8f; - // Limit velocity - if (npc.velocity.X < -num602) - npc.velocity.X = -num602; - if (npc.velocity.X > num602) - npc.velocity.X = num602; + // Limit velocity + if (npc.velocity.X < -num602) + npc.velocity.X = -num602; + if (npc.velocity.X > num602) + npc.velocity.X = num602; - // Face the correct direction - npc.spriteDirection = npc.direction; + // Face the correct direction + npc.spriteDirection = npc.direction; npc.netUpdate = true; if (npc.netSpam > 10) npc.netSpam = 10; } - else - { - // Face the correct direction - if (npc.velocity.X < 0f) - npc.direction = -1; - else - npc.direction = 1; - npc.spriteDirection = npc.direction; + else + { + // Face the correct direction + if (npc.velocity.X < 0f) + npc.direction = -1; + else + npc.direction = 1; + npc.spriteDirection = npc.direction; - // Charging distance from player - int num604 = 500; - if (npc.life < npc.lifeMax * 0.33 || death) - num604 = 300; - else if (npc.life < npc.lifeMax * 0.66) - num604 = 450; + // Charging distance from player + int num604 = 500; + if (npc.life < npc.lifeMax * 0.33 || death) + num604 = 300; + else if (npc.life < npc.lifeMax * 0.66) + num604 = 450; num604 -= 100 * enrageScale; // Get which side of the player the boss is on int num605 = 1; - if (npc.position.X + (npc.width / 2) < Main.player[npc.target].position.X + (Main.player[npc.target].width / 2)) - num605 = -1; + if (npc.position.X + (npc.width / 2) < Main.player[npc.target].position.X + (Main.player[npc.target].width / 2)) + num605 = -1; // If boss is in correct position, slow down, if not, reset bool flag35 = false; @@ -2815,7 +2866,7 @@ namespace CalamityMod.NPCs npc.ai[2] = 1f; flag35 = true; } - if (Math.Abs(npc.Center.Y - Main.player[npc.target].Center.Y) > (float)num604 * 1.5f) + if (Math.Abs(npc.Center.Y - Main.player[npc.target].Center.Y) > num604 * 1.5f) { npc.ai[2] = 1f; flag35 = true; @@ -2825,7 +2876,7 @@ namespace CalamityMod.NPCs // Keep moving if (npc.ai[2] != 1f) - { + { // Velocity fix if Queen Bee is slowed if (npc.velocity.Length() < speed) npc.velocity.X = speed * npc.direction; @@ -2835,39 +2886,38 @@ namespace CalamityMod.NPCs npc.velocity.X *= 1.01f; npc.localAI[0] = 1f; - return false; - } + return false; + } - // Get target, face correct direction, and slow down - npc.TargetClosest(true); - npc.spriteDirection = npc.direction; - npc.localAI[0] = 0f; - npc.velocity *= 0.9f; - - float num606 = 0.1f; - if (npc.life < npc.lifeMax / 2 || death) - { - npc.velocity *= 0.9f; - num606 += 0.05f; - } - if (npc.life < npc.lifeMax / 3 || death) - { - npc.velocity *= 0.9f; - num606 += 0.05f; - } - if (npc.life < npc.lifeMax / 5 || death) - { - npc.velocity *= 0.9f; - num606 += 0.05f; - } + // Get target, face correct direction, and slow down + npc.TargetClosest(true); + npc.spriteDirection = npc.direction; + npc.localAI[0] = 0f; + npc.velocity *= 0.9f; + float num606 = 0.1f; + if (npc.life < npc.lifeMax / 2 || death) + { + npc.velocity *= 0.9f; + num606 += 0.05f; + } + if (npc.life < npc.lifeMax / 3 || death) + { + npc.velocity *= 0.9f; + num606 += 0.05f; + } + if (npc.life < npc.lifeMax / 5 || death) + { + npc.velocity *= 0.9f; + num606 += 0.05f; + } if (enrageScale > 0) npc.velocity *= 0.7f; if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < num606) - { - npc.ai[2] = 0f; - npc.ai[1] += 1f; + { + npc.ai[2] = 0f; + npc.ai[1] += 1f; calamityGlobalNPC.newAI[0] = 0f; } @@ -2876,74 +2926,74 @@ namespace CalamityMod.NPCs if (npc.netSpam > 10) npc.netSpam = 10; } - } + } - // Fly above target before bee spawning phase - else if (npc.ai[0] == 2f) - { - // Get target and face the correct direction - npc.TargetClosest(true); - npc.spriteDirection = npc.direction; + // Fly above target before bee spawning phase + else if (npc.ai[0] == 2f) + { + // Get target and face the correct direction + npc.TargetClosest(true); + npc.spriteDirection = npc.direction; - // Get target location - float num608 = 0.1f; - Vector2 vector75 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num609 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector75.X; - float num610 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - 200f - vector75.Y; + // Get target location + float num608 = 0.1f; + Vector2 vector75 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num609 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector75.X; + float num610 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - 200f - vector75.Y; float num611 = (float)Math.Sqrt(num609 * num609 + num610 * num610); - // Go to bee spawn phase - if (num611 < (death ? 400f : 300f)) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.netUpdate = true; - return false; - } + // Go to bee spawn phase + if (num611 < (death ? 400f : 300f)) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.netUpdate = true; + return false; + } - // Velocity calculations - if (npc.velocity.X < num609) - { - npc.velocity.X += num608; - if (npc.velocity.X < 0f && num609 > 0f) - npc.velocity.X += num608; - } - else if (npc.velocity.X > num609) - { - npc.velocity.X -= num608; - if (npc.velocity.X > 0f && num609 < 0f) - npc.velocity.X -= num608; - } - if (npc.velocity.Y < num610) - { - npc.velocity.Y += num608; - if (npc.velocity.Y < 0f && num610 > 0f) - npc.velocity.Y += num608; - } - else if (npc.velocity.Y > num610) - { - npc.velocity.Y -= num608; - if (npc.velocity.Y > 0f && num610 < 0f) - npc.velocity.Y -= num608; - } - } + // Velocity calculations + if (npc.velocity.X < num609) + { + npc.velocity.X += num608; + if (npc.velocity.X < 0f && num609 > 0f) + npc.velocity.X += num608; + } + else if (npc.velocity.X > num609) + { + npc.velocity.X -= num608; + if (npc.velocity.X > 0f && num609 < 0f) + npc.velocity.X -= num608; + } + if (npc.velocity.Y < num610) + { + npc.velocity.Y += num608; + if (npc.velocity.Y < 0f && num610 > 0f) + npc.velocity.Y += num608; + } + else if (npc.velocity.Y > num610) + { + npc.velocity.Y -= num608; + if (npc.velocity.Y > 0f && num610 < 0f) + npc.velocity.Y -= num608; + } + } - // Bee spawn phase - else if (npc.ai[0] == 1f) - { - // Reset localAI and get target - npc.localAI[0] = 0f; - npc.TargetClosest(true); + // Bee spawn phase + else if (npc.ai[0] == 1f) + { + // Reset localAI and get target + npc.localAI[0] = 0f; + npc.TargetClosest(true); - // Get target location and spawn bees from ass - Vector2 vector76 = new Vector2(npc.position.X + (npc.width / 2) + (Main.rand.Next(20) * npc.direction), npc.position.Y + npc.height * 0.8f); - Vector2 vector77 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num612 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector77.X; - float num613 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector77.Y; - float num614 = (float)Math.Sqrt(num612 * num612 + num613 * num613); + // Get target location and spawn bees from ass + Vector2 vector76 = new Vector2(npc.position.X + (npc.width / 2) + (Main.rand.Next(20) * npc.direction), npc.position.Y + npc.height * 0.8f); + Vector2 vector77 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num612 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector77.X; + float num613 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector77.Y; + float num614 = (float)Math.Sqrt(num612 * num612 + num613 * num613); - // Bee spawn timer - npc.ai[1] += 1f; + // Bee spawn timer + npc.ai[1] += 1f; int num638 = 0; for (int num639 = 0; num639 < 255; num639++) { @@ -2952,221 +3002,220 @@ namespace CalamityMod.NPCs } npc.ai[1] += num638 / 2; if (npc.life < npc.lifeMax * 0.75 || death) - npc.ai[1] += 0.25f; - if (npc.life < npc.lifeMax * 0.5 || death) - npc.ai[1] += 0.25f; - if (npc.life < npc.lifeMax * 0.25 || death) - npc.ai[1] += 0.25f; - if (npc.life < npc.lifeMax * 0.1 || death) - npc.ai[1] += 0.25f; + npc.ai[1] += 0.25f; + if (npc.life < npc.lifeMax * 0.5 || death) + npc.ai[1] += 0.25f; + if (npc.life < npc.lifeMax * 0.25 || death) + npc.ai[1] += 0.25f; + if (npc.life < npc.lifeMax * 0.1 || death) + npc.ai[1] += 0.25f; - bool spawnBee = false; + bool spawnBee = false; int num640 = 15 - 12 * enrageScale; if (npc.ai[1] > num640) - { - npc.ai[1] = 0f; - npc.ai[2] += 1f; - spawnBee = true; - } + { + npc.ai[1] = 0f; + npc.ai[2] += 1f; + spawnBee = true; + } - // Spawn bees or hornets - if (Collision.CanHit(vector76, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && spawnBee) - { - Main.PlaySound(SoundID.NPCHit1, (int)npc.position.X, (int)npc.position.Y); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int hornetAmt = CalamityMod.hornetList.Count; - int spawnType = Main.rand.Next(210, 212); - if (npc.life < npc.lifeMax * 0.66 || death) - spawnType = 210; + // Spawn bees or hornets + if (Collision.CanHit(vector76, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && spawnBee) + { + Main.PlaySound(SoundID.NPCHit1, (int)npc.position.X, (int)npc.position.Y); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int hornetAmt = CalamityMod.hornetList.Count; + int spawnType = Main.rand.Next(210, 212); + if (npc.life < npc.lifeMax * 0.66 || death) + spawnType = 210; - int random = death ? 5 : 6; - if (Main.rand.Next(random) == 0) - spawnType = CalamityMod.hornetList[Main.rand.Next(hornetAmt)]; + int random = death ? 5 : 6; + if (Main.rand.Next(random) == 0) + spawnType = CalamityMod.hornetList[Main.rand.Next(hornetAmt)]; - int spawn = NPC.NewNPC((int)vector76.X, (int)vector76.Y, spawnType, 0, 0f, 0f, 0f, 0f, 255); + int spawn = NPC.NewNPC((int)vector76.X, (int)vector76.Y, spawnType, 0, 0f, 0f, 0f, 0f, 255); Main.npc[spawn].velocity = Main.player[npc.target].Center - npc.Center; Main.npc[spawn].velocity.Normalize(); Main.npc[spawn].velocity *= 5f; if (!CalamityMod.hornetList.Contains(spawnType)) - Main.npc[spawn].localAI[0] = 60f; + Main.npc[spawn].localAI[0] = 60f; - Main.npc[spawn].netUpdate = true; - } - } + Main.npc[spawn].netUpdate = true; + } + } - // Velocity calculations if target is too far away - if (num614 > 400f || !Collision.CanHit(new Vector2(vector76.X, vector76.Y - 30f), 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - float num617 = 14f; - float num618 = 0.1f; - vector77 = vector76; - num612 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector77.X; - num613 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector77.Y; - num614 = (float)Math.Sqrt(num612 * num612 + num613 * num613); - num614 = num617 / num614; + // Velocity calculations if target is too far away + if (num614 > 400f || !Collision.CanHit(new Vector2(vector76.X, vector76.Y - 30f), 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + float num617 = 14f; + float num618 = 0.1f; + vector77 = vector76; + num612 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector77.X; + num613 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector77.Y; + num614 = (float)Math.Sqrt(num612 * num612 + num613 * num613); + num614 = num617 / num614; - if (npc.velocity.X < num612) - { - npc.velocity.X += num618; - if (npc.velocity.X < 0f && num612 > 0f) - npc.velocity.X += num618; - } - else if (npc.velocity.X > num612) - { - npc.velocity.X -= num618; - if (npc.velocity.X > 0f && num612 < 0f) - npc.velocity.X -= num618; - } - if (npc.velocity.Y < num613) - { - npc.velocity.Y += num618; - if (npc.velocity.Y < 0f && num613 > 0f) - npc.velocity.Y += num618; - } - else if (npc.velocity.Y > num613) - { - npc.velocity.Y -= num618; - if (npc.velocity.Y > 0f && num613 < 0f) - npc.velocity.Y -= num618; - } - } - else - npc.velocity *= 0.9f; + if (npc.velocity.X < num612) + { + npc.velocity.X += num618; + if (npc.velocity.X < 0f && num612 > 0f) + npc.velocity.X += num618; + } + else if (npc.velocity.X > num612) + { + npc.velocity.X -= num618; + if (npc.velocity.X > 0f && num612 < 0f) + npc.velocity.X -= num618; + } + if (npc.velocity.Y < num613) + { + npc.velocity.Y += num618; + if (npc.velocity.Y < 0f && num613 > 0f) + npc.velocity.Y += num618; + } + else if (npc.velocity.Y > num613) + { + npc.velocity.Y -= num618; + if (npc.velocity.Y > 0f && num613 < 0f) + npc.velocity.Y -= num618; + } + } + else + npc.velocity *= 0.9f; - // Face the correct direction - npc.spriteDirection = npc.direction; + // Face the correct direction + npc.spriteDirection = npc.direction; - // Go to a random phase - if (npc.ai[2] > 3f) - { - npc.ai[0] = -1f; - npc.ai[1] = 1f; - npc.netUpdate = true; - } - } + // Go to a random phase + if (npc.ai[2] > 3f) + { + npc.ai[0] = -1f; + npc.ai[1] = 2f; + npc.ai[2] = 0f; + npc.netUpdate = true; + } + } - // Stinger phase - else if (npc.ai[0] == 3f) - { - // Get target location and shoot from ass - Vector2 vector78 = new Vector2(npc.position.X + (npc.width / 2) + (Main.rand.Next(20) * npc.direction), npc.position.Y + npc.height * 0.8f); - Vector2 vector79 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num621 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector79.X; - float num622 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - 300f - vector79.Y; - float num623 = (float)Math.Sqrt(num621 * num621 + num622 * num622); + // Stinger phase + else if (npc.ai[0] == 3f) + { + // Get target location and shoot from ass + Vector2 vector78 = new Vector2(npc.position.X + (npc.width / 2) + (Main.rand.Next(20) * npc.direction), npc.position.Y + npc.height * 0.8f); + Vector2 vector79 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num621 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector79.X; + float num622 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - 300f - vector79.Y; + float num623 = (float)Math.Sqrt(num621 * num621 + num622 * num622); npc.ai[1] += 1f; - int num650 = ((npc.life < npc.lifeMax * 0.25) ? 15 : ((npc.life < npc.lifeMax * 0.5) ? 20 : ((npc.life < npc.lifeMax * 0.75) ? 25 : 30))); + int num650 = (npc.life < npc.lifeMax * 0.25) ? 15 : ((npc.life < npc.lifeMax * 0.5) ? 20 : ((npc.life < npc.lifeMax * 0.75) ? 25 : 30)); num650 -= 5 * enrageScale; - // Fire stingers - if (npc.ai[1] % (float)num650 == (float)(num650 - 1) && npc.position.Y + npc.height < Main.player[npc.target].position.Y && Collision.CanHit(vector78, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - Main.PlaySound(SoundID.Item17, npc.position); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - float num624 = CalamityWorld.bossRushActive ? 16f : 12f; - if (npc.life < npc.lifeMax * 0.33 || death) - num624 += 3f; - num624 += (float)(7 * enrageScale); + // Fire stingers + if (npc.ai[1] % num650 == (num650 - 1) && npc.position.Y + npc.height < Main.player[npc.target].position.Y && Collision.CanHit(vector78, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + Main.PlaySound(SoundID.Item17, npc.position); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float num624 = CalamityWorld.bossRushActive ? 16f : 12f; + if (npc.life < npc.lifeMax * 0.33 || death) + num624 += 3f; + num624 += 7 * enrageScale; float num625 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector78.X; - float num626 = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - vector78.Y; + float num626 = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - vector78.Y; float num627 = (float)Math.Sqrt(num625 * num625 + num626 * num626); - num627 = num624 / num627; - num625 *= num627; - num626 *= num627; + num627 = num624 / num627; + num625 *= num627; + num626 *= num627; - int damage = Main.player[npc.target].buffImmune[BuffID.Poisoned] ? 18 : 14; + int damage = Main.player[npc.target].buffImmune[BuffID.Poisoned] ? 18 : 14; if (death) damage += 2; - int type = ProjectileID.Stinger; - int projectile = Projectile.NewProjectile(vector78.X, vector78.Y, num625, num626, type, damage, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[projectile].timeLeft = 300; - } - } + int type = ProjectileID.Stinger; + int projectile = Projectile.NewProjectile(vector78.X, vector78.Y, num625, num626, type, damage, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[projectile].timeLeft = 300; + } + } - // Movement calculations - float num620 = CalamityWorld.bossRushActive ? 0.1f : 0.075f; - num620 += 0.2f * (float)enrageScale; + // Movement calculations + float num620 = CalamityWorld.bossRushActive ? 0.1f : 0.075f; + num620 += 0.2f * enrageScale; if (!Collision.CanHit(new Vector2(vector78.X, vector78.Y - 30f), 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - num620 = CalamityWorld.bossRushActive ? 0.125f : 0.1f; + { + num620 = CalamityWorld.bossRushActive ? 0.125f : 0.1f; if (enrageScale > 0) num620 = 0.5f; vector79 = vector78; - num621 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector79.X; - num622 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector79.Y; + num621 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector79.X; + num622 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector79.Y; - if (npc.velocity.X < num621) - { - npc.velocity.X += num620; - if (npc.velocity.X < 0f && num621 > 0f) - npc.velocity.X += num620; - } - else if (npc.velocity.X > num621) - { - npc.velocity.X -= num620; - if (npc.velocity.X > 0f && num621 < 0f) - npc.velocity.X -= num620; - } - if (npc.velocity.Y < num622) - { - npc.velocity.Y += num620; - if (npc.velocity.Y < 0f && num622 > 0f) - npc.velocity.Y += num620; - } - else if (npc.velocity.Y > num622) - { - npc.velocity.Y -= num620; - if (npc.velocity.Y > 0f && num622 < 0f) - npc.velocity.Y -= num620; - } - } - else if (num623 > 100f) - { - npc.TargetClosest(true); - npc.spriteDirection = npc.direction; - if (npc.velocity.X < num621) - { - npc.velocity.X += num620; - if (npc.velocity.X < 0f && num621 > 0f) - npc.velocity.X += num620 * 2f; - } - else if (npc.velocity.X > num621) - { - npc.velocity.X -= num620; - if (npc.velocity.X > 0f && num621 < 0f) - npc.velocity.X -= num620 * 2f; - } - if (npc.velocity.Y < num622) - { - npc.velocity.Y += num620; - if (npc.velocity.Y < 0f && num622 > 0f) - npc.velocity.Y += num620 * 2f; - } - else if (npc.velocity.Y > num622) - { - npc.velocity.Y -= num620; - if (npc.velocity.Y > 0f && num622 < 0f) - npc.velocity.Y -= num620 * 2f; - } - } + if (npc.velocity.X < num621) + { + npc.velocity.X += num620; + if (npc.velocity.X < 0f && num621 > 0f) + npc.velocity.X += num620; + } + else if (npc.velocity.X > num621) + { + npc.velocity.X -= num620; + if (npc.velocity.X > 0f && num621 < 0f) + npc.velocity.X -= num620; + } + if (npc.velocity.Y < num622) + { + npc.velocity.Y += num620; + if (npc.velocity.Y < 0f && num622 > 0f) + npc.velocity.Y += num620; + } + else if (npc.velocity.Y > num622) + { + npc.velocity.Y -= num620; + if (npc.velocity.Y > 0f && num622 < 0f) + npc.velocity.Y -= num620; + } + } + else if (num623 > 100f) + { + npc.TargetClosest(true); + npc.spriteDirection = npc.direction; + if (npc.velocity.X < num621) + { + npc.velocity.X += num620; + if (npc.velocity.X < 0f && num621 > 0f) + npc.velocity.X += num620 * 2f; + } + else if (npc.velocity.X > num621) + { + npc.velocity.X -= num620; + if (npc.velocity.X > 0f && num621 < 0f) + npc.velocity.X -= num620 * 2f; + } + if (npc.velocity.Y < num622) + { + npc.velocity.Y += num620; + if (npc.velocity.Y < 0f && num622 > 0f) + npc.velocity.Y += num620 * 2f; + } + else if (npc.velocity.Y > num622) + { + npc.velocity.Y -= num620; + if (npc.velocity.Y > 0f && num622 < 0f) + npc.velocity.Y -= num620 * 2f; + } + } // Go to a random phase - float num660 = 20f; - num660 -= (float)(5 * enrageScale); - if (npc.ai[1] > (float)num650 * num660) - { - npc.ai[0] = -1f; - npc.ai[1] = 3f; - npc.netUpdate = true; - } - } + if (npc.ai[1] > num650 * 15f) + { + npc.ai[0] = -1f; + npc.ai[1] = 3f; + npc.netUpdate = true; + } + } else if (npc.ai[0] == 4f) { @@ -3193,13 +3242,13 @@ namespace CalamityMod.NPCs } } - if (Main.netMode == NetmodeID.Server) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npc.whoAmI, 0f, 0f, 0f, 0, 0, 0); + if (Main.netMode == NetmodeID.Server) + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npc.whoAmI, 0f, 0f, 0f, 0, 0, 0); - npc.netSpam = 5; + npc.netSpam = 5; - return false; - } + return false; + } #endregion #region Buffed Skeletron AI @@ -4372,8 +4421,8 @@ namespace CalamityMod.NPCs bool configBossRushBoost = CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive; bool death = CalamityWorld.death || CalamityWorld.bossRushActive; - // 8 seconds of reistance to prevent spawn killing - if (calamityGlobalNPC.newAI[1] < 480f) + // 10 seconds of resistance to prevent spawn killing + if (calamityGlobalNPC.newAI[1] < 600f) calamityGlobalNPC.newAI[1] += 1f; // Percent life remaining @@ -4415,7 +4464,7 @@ namespace CalamityMod.NPCs { for (int i = 0; i < 2; i++) { - int num = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default, 2f); + int num = Dust.NewDust(npc.position, npc.width, npc.height, 182, 0f, 0f, 100, default, 2f); Main.dust[num].noGravity = true; Main.dust[num].noLight = true; } @@ -4481,22 +4530,22 @@ namespace CalamityMod.NPCs { npc.ai[3] = npc.whoAmI; npc.realLife = npc.whoAmI; - int num2 = npc.whoAmI; + int index = npc.whoAmI; - int num3 = 80; - for (int j = 0; j <= num3; j++) + int totalSegments = 80; + for (int j = 0; j <= totalSegments; j++) { - int num4 = NPCID.TheDestroyerBody; - if (j == num3) - num4 = NPCID.TheDestroyerTail; + int type = NPCID.TheDestroyerBody; + if (j == totalSegments) + type = NPCID.TheDestroyerTail; - int num5 = NPC.NewNPC((int)(npc.position.X + (npc.width / 2)), (int)(npc.position.Y + npc.height), num4, npc.whoAmI, 0f, 0f, 0f, 0f, 255); - Main.npc[num5].ai[3] = npc.whoAmI; - Main.npc[num5].realLife = npc.whoAmI; - Main.npc[num5].ai[1] = num2; - Main.npc[num2].ai[0] = num5; - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num5, 0f, 0f, 0f, 0, 0, 0); - num2 = num5; + int segment = NPC.NewNPC((int)(npc.position.X + (npc.width / 2)), (int)(npc.position.Y + npc.height), type, npc.whoAmI, 0f, 0f, 0f, 0f, 255); + Main.npc[segment].ai[3] = npc.whoAmI; + Main.npc[segment].realLife = npc.whoAmI; + Main.npc[segment].ai[1] = index; + Main.npc[index].ai[0] = segment; + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, segment, 0f, 0f, 0f, 0, 0, 0); + index = segment; } } @@ -4504,11 +4553,13 @@ namespace CalamityMod.NPCs if (npc.type == NPCID.TheDestroyerBody && Vector2.Distance(player.Center, npc.Center) > 80f && !flyAtTarget) { // Laser rate of fire - int shootTime = 2 + (int)Math.Ceiling(((enraged || configBossRushBoost) ? 5D : 2D) * (1f - lifeRatio)); + int shootTime = 4 + (death ? 2 : (int)Math.Ceiling(2f * (1f - lifeRatio))); if (CalamityWorld.bossRushActive) shootTime += 1; + if (enraged || configBossRushBoost) + shootTime += 2; - calamityGlobalNPC.newAI[0] += Main.rand.Next(shootTime); + calamityGlobalNPC.newAI[0] += Main.rand.Next(shootTime); int randomCount = death ? Main.rand.Next(1470, 27300) : Main.rand.Next(1330, 24700); if (calamityGlobalNPC.newAI[0] >= randomCount) @@ -4710,7 +4761,7 @@ namespace CalamityMod.NPCs if (flyAtTarget) { - float speedMultiplier = phase5 ? 1.5f : phase4 ? 1.3f : 1.2f; + float speedMultiplier = phase5 ? 2f : phase4 ? 1.7f : 1.5f; speed *= speedMultiplier; } @@ -4932,10 +4983,319 @@ namespace CalamityMod.NPCs return false; } - #endregion + #endregion - #region Buffed Twins AI - public static bool BuffedRetinazerAI(NPC npc, bool enraged, Mod mod, bool chaos) + // Only used for Normal and Expert Mode + #region True Melee Retinazer Phase 2 AI + public static bool TrueMeleeRetinazerPhase2AI(NPC npc) + { + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) + { + npc.TargetClosest(); + } + bool dead2 = Main.player[npc.target].dead; + float num399 = npc.position.X + (npc.width / 2) - Main.player[npc.target].position.X - (Main.player[npc.target].width / 2); + float num400 = npc.position.Y + npc.height - 59f - Main.player[npc.target].position.Y - (Main.player[npc.target].height / 2); + float num401 = (float)Math.Atan2(num400, num399) + 1.57f; + if (num401 < 0f) + { + num401 += MathHelper.TwoPi; + } + else if (num401 > MathHelper.TwoPi) + { + num401 -= MathHelper.TwoPi; + } + float num402 = 0.1f; + if (npc.rotation < num401) + { + if ((double)(num401 - npc.rotation) > MathHelper.Pi) + { + npc.rotation -= num402; + } + else + { + npc.rotation += num402; + } + } + else if (npc.rotation > num401) + { + if ((double)(npc.rotation - num401) > MathHelper.Pi) + { + npc.rotation += num402; + } + else + { + npc.rotation -= num402; + } + } + if (npc.rotation > num401 - num402 && npc.rotation < num401 + num402) + { + npc.rotation = num401; + } + if (npc.rotation < 0f) + { + npc.rotation += MathHelper.TwoPi; + } + else if (npc.rotation > MathHelper.TwoPi) + { + npc.rotation -= MathHelper.TwoPi; + } + if (npc.rotation > num401 - num402 && npc.rotation < num401 + num402) + { + npc.rotation = num401; + } + if (Main.rand.Next(5) == 0) + { + int num403 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + npc.height * 0.25f), npc.width, (int)(npc.height * 0.5f), 5, npc.velocity.X, 2f); + Main.dust[num403].velocity.X *= 0.5f; + Main.dust[num403].velocity.Y *= 0.1f; + } + if (Main.netMode != NetmodeID.MultiplayerClient && !Main.dayTime && !Main.player[npc.target].dead && npc.timeLeft < 10) + { + for (int num381 = 0; num381 < Main.maxNPCs; num381++) + { + if (num381 != npc.whoAmI && Main.npc[num381].active && (Main.npc[num381].type == NPCID.Retinazer || Main.npc[num381].type == NPCID.Spazmatism) && Main.npc[num381].timeLeft - 1 > npc.timeLeft) + npc.timeLeft = Main.npc[num381].timeLeft - 1; + + } + } + if (Main.dayTime | Main.player[npc.target].dead) + { + npc.velocity.Y -= 0.04f; + if (npc.timeLeft > 10) + npc.timeLeft = 10; + return false; + } + if (npc.ai[0] == 3f) + { + npc.damage = (int)(npc.defDamage * 1.5); + npc.defense = npc.defDefense + 10; + npc.HitSound = SoundID.NPCHit4; + Item targetSelectedItem = Main.player[npc.target].inventory[Main.player[npc.target].selectedItem]; + if (npc.ai[1] == 0f) + { + float num421 = 8f; + float num422 = 0.15f; + if (Main.expertMode) + { + num421 = 9.5f; + num422 = 0.175f; + } + // Reduce acceleration if target is holding a true melee weapon + if (targetSelectedItem.melee && (targetSelectedItem.shoot == 0 || CalamityMod.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) + { + num422 *= 0.5f; + } + Vector2 vector39 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num423 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector39.X; + float num424 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - 300f - vector39.Y; + float num425 = (float)Math.Sqrt(num423 * num423 + num424 * num424); + num425 = num421 / num425; + num423 *= num425; + num424 *= num425; + if (npc.velocity.X < num423) + { + npc.velocity.X += num422; + if (npc.velocity.X < 0f && num423 > 0f) + { + npc.velocity.X += num422; + } + } + else if (npc.velocity.X > num423) + { + npc.velocity.X -= num422; + if (npc.velocity.X > 0f && num423 < 0f) + { + npc.velocity.X -= num422; + } + } + if (npc.velocity.Y < num424) + { + npc.velocity.Y += num422; + if (npc.velocity.Y < 0f && num424 > 0f) + { + npc.velocity.Y += num422; + } + } + else if (npc.velocity.Y > num424) + { + npc.velocity.Y -= num422; + if (npc.velocity.Y > 0f && num424 < 0f) + { + npc.velocity.Y -= num422; + } + } + npc.ai[2] += 1f; + if (npc.ai[2] >= 300f) + { + npc.ai[1] = 1f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.TargetClosest(); + npc.netUpdate = true; + } + vector39 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + num423 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector39.X; + num424 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector39.Y; + npc.rotation = (float)Math.Atan2(num424, num423) - 1.57f; + if (Main.netMode == NetmodeID.MultiplayerClient) + { + return false; + } + npc.localAI[1] += 1f; + if (npc.life < npc.lifeMax * 0.75) + { + npc.localAI[1] += 1f; + } + if (npc.life < npc.lifeMax * 0.5) + { + npc.localAI[1] += 1f; + } + if (npc.life < npc.lifeMax * 0.25) + { + npc.localAI[1] += 1f; + } + if (npc.life < npc.lifeMax * 0.1) + { + npc.localAI[1] += 2f; + } + if (npc.localAI[1] > 180f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + npc.localAI[1] = 0f; + float num426 = 8.5f; + int attackDamage_ForProjectiles4 = Main.expertMode ? 23 : 25; + int num427 = 100; + if (Main.expertMode) + { + num426 = 10f; + } + num425 = (float)Math.Sqrt(num423 * num423 + num424 * num424); + num425 = num426 / num425; + num423 *= num425; + num424 *= num425; + vector39.X += num423 * 15f; + vector39.Y += num424 * 15f; + int num428 = Projectile.NewProjectile(vector39.X, vector39.Y, num423, num424, num427, attackDamage_ForProjectiles4, 0f, Main.myPlayer); + } + return false; + } + int num429 = 1; + if (npc.position.X + (npc.width / 2) < Main.player[npc.target].position.X + Main.player[npc.target].width) + { + num429 = -1; + } + float num430 = 8f; + float num431 = 0.2f; + if (Main.expertMode) + { + num430 = 9.5f; + num431 = 0.25f; + } + // Reduce acceleration if target is holding a true melee weapon + if (targetSelectedItem.melee && (targetSelectedItem.shoot == 0 || CalamityMod.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) + { + num431 *= 0.5f; + } + Vector2 vector40 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num432 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) + (num429 * 340) - vector40.X; + float num433 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector40.Y; + float num434 = (float)Math.Sqrt(num432 * num432 + num433 * num433); + num434 = num430 / num434; + num432 *= num434; + num433 *= num434; + if (npc.velocity.X < num432) + { + npc.velocity.X += num431; + if (npc.velocity.X < 0f && num432 > 0f) + { + npc.velocity.X += num431; + } + } + else if (npc.velocity.X > num432) + { + npc.velocity.X -= num431; + if (npc.velocity.X > 0f && num432 < 0f) + { + npc.velocity.X -= num431; + } + } + if (npc.velocity.Y < num433) + { + npc.velocity.Y += num431; + if (npc.velocity.Y < 0f && num433 > 0f) + { + npc.velocity.Y += num431; + } + } + else if (npc.velocity.Y > num433) + { + npc.velocity.Y -= num431; + if (npc.velocity.Y > 0f && num433 < 0f) + { + npc.velocity.Y -= num431; + } + } + vector40 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + num432 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector40.X; + num433 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector40.Y; + npc.rotation = (float)Math.Atan2(num433, num432) - 1.57f; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[1] += 1f; + if (npc.life < npc.lifeMax * 0.75) + { + npc.localAI[1] += 0.5f; + } + if (npc.life < npc.lifeMax * 0.5) + { + npc.localAI[1] += 0.75f; + } + if (npc.life < npc.lifeMax * 0.25) + { + npc.localAI[1] += 1f; + } + if (npc.life < npc.lifeMax * 0.1) + { + npc.localAI[1] += 1.5f; + } + if (Main.expertMode) + { + npc.localAI[1] += 1.5f; + } + if (npc.localAI[1] > 60f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + npc.localAI[1] = 0f; + float num435 = 9f; + int attackDamage_ForProjectiles5 = Main.expertMode ? 17 : 18; + int num436 = 100; + num434 = (float)Math.Sqrt(num432 * num432 + num433 * num433); + num434 = num435 / num434; + num432 *= num434; + num433 *= num434; + vector40.X += num432 * 15f; + vector40.Y += num433 * 15f; + int num437 = Projectile.NewProjectile(vector40.X, vector40.Y, num432, num433, num436, attackDamage_ForProjectiles5, 0f, Main.myPlayer); + } + } + npc.ai[2] += 1f; + if (npc.ai[2] >= 180f) + { + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.TargetClosest(); + npc.netUpdate = true; + } + + return false; + } + + return true; + } + #endregion + + #region Buffed Twins AI + public static bool BuffedRetinazerAI(NPC npc, bool enraged, Mod mod, bool chaos) { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); bool configBossRushBoost = CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive; @@ -5028,7 +5388,8 @@ namespace CalamityMod.NPCs { float num382 = 8.25f; float num383 = 0.115f; - if (CalamityWorld.bossRushActive) + + if (CalamityWorld.bossRushActive) { num382 *= 1.5f; num383 *= 1.5f; @@ -5250,7 +5611,15 @@ namespace CalamityMod.NPCs { float num399 = 9.5f; float num400 = 0.175f; - if (CalamityWorld.bossRushActive) + + // Reduce acceleration if target is holding a true melee weapon + Item targetSelectedItem = Main.player[npc.target].inventory[Main.player[npc.target].selectedItem]; + if (targetSelectedItem.melee && (targetSelectedItem.shoot == 0 || CalamityMod.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) + { + num400 *= 0.5f; + } + + if (CalamityWorld.bossRushActive) { num399 *= 1.5f; num400 *= 1.5f; @@ -5356,7 +5725,15 @@ namespace CalamityMod.NPCs float num409 = 9.5f; float num410 = 0.25f; - if (CalamityWorld.bossRushActive) + + // Reduce acceleration if target is holding a true melee weapon + Item targetSelectedItem = Main.player[npc.target].inventory[Main.player[npc.target].selectedItem]; + if (targetSelectedItem.melee && (targetSelectedItem.shoot == 0 || CalamityMod.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) + { + num410 *= 0.5f; + } + + if (CalamityWorld.bossRushActive) { num409 *= 1.5f; num410 *= 1.5f; @@ -5722,6 +6099,7 @@ namespace CalamityMod.NPCs // Velocity float num424 = 12f; float num425 = 0.4f; + if (CalamityWorld.bossRushActive) { num424 *= 1.5f; @@ -6833,37 +7211,32 @@ namespace CalamityMod.NPCs if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 64f) { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (NPC.CountNPCS(NPCID.Probe) < 6) - NPC.NewNPC((int)npc.Center.X, (int)(npc.Center.Y + 4f), NPCID.Probe); - else - { - Vector2 vector16 = npc.Center; - float num159 = CalamityWorld.bossRushActive ? 6f : 4f; - float num160 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector16.X + Main.rand.Next(-20, 21); - float num161 = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - vector16.Y + Main.rand.Next(-20, 21); - float num162 = (float)Math.Sqrt(num160 * num160 + num161 * num161); - num162 = num159 / num162; - num160 *= num162; - num161 *= num162; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Vector2 vector16 = npc.Center; + float num159 = CalamityWorld.bossRushActive ? 6f : 4f; + float num160 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector16.X + Main.rand.Next(-20, 21); + float num161 = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - vector16.Y + Main.rand.Next(-20, 21); + float num162 = (float)Math.Sqrt(num160 * num160 + num161 * num161); + num162 = num159 / num162; + num160 *= num162; + num161 *= num162; - Vector2 value = new Vector2(num160 * 1f + Main.rand.Next(-50, 51) * 0.01f, num161 * 1f + Main.rand.Next(-50, 51) * 0.01f); - value.Normalize(); - value *= num159; - num160 = value.X; - num161 = value.Y; + Vector2 value = new Vector2(num160 * 1f + Main.rand.Next(-50, 51) * 0.01f, num161 * 1f + Main.rand.Next(-50, 51) * 0.01f); + value.Normalize(); + value *= num159; + num160 = value.X; + num161 = value.Y; - int num163 = 28; - if (death) - num163 += 3; - int num164 = ProjectileID.Skull; - vector16 += value * 5f; - int num165 = Projectile.NewProjectile(vector16.X, vector16.Y, num160, num161, num164, num163, 0f, Main.myPlayer, -1f, 0f); - Main.projectile[num165].timeLeft = 180; - Main.projectile[num165].tileCollide = false; - } - } + int num163 = 28; + if (death) + num163 += 3; + int num164 = ProjectileID.Skull; + vector16 += value * 5f; + int num165 = Projectile.NewProjectile(vector16.X, vector16.Y, num160, num161, num164, num163, 0f, Main.myPlayer, -1f, 0f); + Main.projectile[num165].timeLeft = 180; + Main.projectile[num165].tileCollide = false; + } } // Go to floating phase, or spinning phase if in phase 2 @@ -6943,7 +7316,7 @@ namespace CalamityMod.NPCs if (Main.netMode != NetmodeID.MultiplayerClient) { Vector2 velocity = new Vector2(-1f * (float)Main.rand.NextDouble() * 3f, 1f); - velocity = velocity.RotatedBy((Main.rand.NextDouble() - 0.5) * MathHelper.PiOver4, default); + velocity = velocity.RotatedBy((Main.rand.NextDouble() - 0.5) * MathHelper.PiOver4); velocity *= CalamityWorld.bossRushActive ? 7.5f : 5f; int damage = 33; if (death) @@ -8066,10 +8439,11 @@ namespace CalamityMod.NPCs // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - // Phases based on HP + // Phases based on HP + bool phase1phase2 = lifeRatio < 0.75f; bool phase2 = lifeRatio <= 0.5f; - bool phase3 = lifeRatio < 0.25f || (death && phase2); - bool spawnMoreTentacles = lifeRatio < 0.1f; + bool phase3 = lifeRatio < 0.35f || (death && phase2); + bool phase4 = lifeRatio < 0.2f; // Variables and target bool enrage = false; @@ -8142,7 +8516,7 @@ namespace CalamityMod.NPCs { velocity = 10f; acceleration = 0.1f; - if (tentaclesDead || spawnMoreTentacles) + if (tentaclesDead || phase4) { velocity = 12f; acceleration = 0.12f; @@ -8216,6 +8590,9 @@ namespace CalamityMod.NPCs if (nearbyActiveTiles < 800) tileEnrageMult += (800 - nearbyActiveTiles) * 0.001f; // Ranges from 1f to 1.8f + // Let hooks and tentacles know how enraged plantera is + npc.ai[3] = tileEnrageMult; + // Movement relative to the target and hook positions Vector2 vector91 = new Vector2(num730, num731); float num736 = Main.player[npc.target].Center.X - vector91.X; @@ -8309,6 +8686,21 @@ namespace CalamityMod.NPCs // Phase 1 if (!phase2) { + if (phase1phase2 && Main.netMode != NetmodeID.MultiplayerClient) + { + if (npc.localAI[0] == 1f) + { + npc.localAI[0] = 2f; + int totalTentacles = (int)(6 * tileEnrageMult); + float radians = MathHelper.TwoPi / totalTentacles; + for (int i = 0; i < totalTentacles; i++) + { + Vector2 vector255 = new Vector2(0f, -65f * totalTentacles).RotatedBy(radians * i); + NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, NPCID.PlanterasTentacle, npc.whoAmI, vector255.X, vector255.Y, 1f, 0f, 255); + } + } + } + // Adjust stats npc.defense = 42; npc.damage = npc.defDamage; @@ -8402,7 +8794,8 @@ namespace CalamityMod.NPCs // Adjust stats npc.defense = 21; npc.damage = (int)(npc.defDamage * 1.4f); - if (enrage) + npc.chaseable = true; + if (enrage) { npc.defense *= 4; npc.damage *= 2; @@ -8411,29 +8804,35 @@ namespace CalamityMod.NPCs // Spawn tentacles if (Main.netMode != NetmodeID.MultiplayerClient) { - if (npc.localAI[0] == 1f) + if (npc.localAI[0] == 2f) { - npc.localAI[0] = 2f; - for (int num749 = 0; num749 < 8; num749++) + npc.localAI[0] = 3f; + int totalTentacles = (int)((10 - NPC.CountNPCS(NPCID.PlanterasTentacle)) * tileEnrageMult); + for (int i = 0; i < totalTentacles; i++) { - int num750 = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, NPCID.PlanterasTentacle, npc.whoAmI, 0f, 0f, 0f, 0f, 255); + NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, NPCID.PlanterasTentacle, npc.whoAmI, 0f, 0f, 0f, 0f, 255); } } - if (spawnMoreTentacles && npc.localAI[0] == 2f) + if (phase4 && npc.localAI[0] == 3f) { - npc.localAI[0] = 3f; - for (int num749 = 0; num749 < 8; num749++) + npc.localAI[0] = 4f; + int totalTentacles = (int)(8 * tileEnrageMult); + float radians = MathHelper.TwoPi / totalTentacles; + for (int i = 0; i < totalTentacles; i++) { - int num750 = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, NPCID.PlanterasTentacle, npc.whoAmI, 0f, 0f, 0f, 0f, 255); + Vector2 vector255 = new Vector2(0f, -65f * totalTentacles).RotatedBy(radians * i); + NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, NPCID.PlanterasTentacle, npc.whoAmI, vector255.X, vector255.Y, 2f, 0f, 255); } } } - // If tentacles are alive, gain high defense - if (!tentaclesDead) - npc.defense = spawnMoreTentacles ? 99 : 9999; - npc.chaseable = tentaclesDead; + // If tentacles are alive, gain high defense + if (!tentaclesDead && !phase4) + { + npc.defense = 99; + npc.chaseable = false; + } // Spawn gore if (npc.localAI[2] == 0f) @@ -8444,36 +8843,39 @@ namespace CalamityMod.NPCs npc.localAI[2] = 1f; } - // Spawn spores - float spawnBoost = death ? 4f : 8f * (0.5f - lifeRatio); - npc.localAI[1] += 1f + spawnBoost; - - if (npc.localAI[1] >= 360f) - { - float num757 = CalamityWorld.bossRushActive ? 12f : 8f; - Vector2 vector94 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num758 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector94.X + Main.rand.Next(-10, 11); - float num759 = Math.Abs(num758 * 0.2f); - - float num760 = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - vector94.Y + Main.rand.Next(-10, 11); - if (num760 > 0f) - num759 = 0f; - - num760 -= num759; - float num761 = (float)Math.Sqrt(num758 * num758 + num760 * num760); - num761 = num757 / num761; - num758 *= num761; - num760 *= num761; - - int num762 = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, NPCID.Spore, 0, 0f, 0f, 0f, 0f, 255); - Main.npc[num762].velocity.X = num758; - Main.npc[num762].velocity.Y = num760; - Main.npc[num762].netUpdate = true; - npc.localAI[1] = 0f; - } - if (Main.netMode != NetmodeID.MultiplayerClient) { + // Spawn spores + if (!phase4) + { + float spawnBoost = death ? 4f : 8f * (0.5f - lifeRatio); + npc.localAI[1] += 1f + spawnBoost; + + if (npc.localAI[1] >= 360f) + { + float num757 = CalamityWorld.bossRushActive ? 12f : 8f; + Vector2 vector94 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num758 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector94.X + Main.rand.Next(-10, 11); + float num759 = Math.Abs(num758 * 0.2f); + + float num760 = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - vector94.Y + Main.rand.Next(-10, 11); + if (num760 > 0f) + num759 = 0f; + + num760 -= num759; + float num761 = (float)Math.Sqrt(num758 * num758 + num760 * num760); + num761 = num757 / num761; + num758 *= num761; + num760 *= num761; + + int num762 = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, NPCID.Spore, 0, 0f, 0f, 0f, 0f, 255); + Main.npc[num762].velocity.X = num758; + Main.npc[num762].velocity.Y = num760; + Main.npc[num762].netUpdate = true; + npc.localAI[1] = 0f; + } + } + // Fire spread of poison seeds if (tentacleCount < 8) { @@ -8523,7 +8925,7 @@ namespace CalamityMod.NPCs } // Fire spread of spore clouds - if (tentaclesDead || spawnMoreTentacles) + if (tentaclesDead || phase4) { float shootBoost = death ? 1f : 2f * (0.5f - lifeRatio); calamityGlobalNPC.newAI[0] += 1f + shootBoost; @@ -8644,8 +9046,11 @@ namespace CalamityMod.NPCs if (Main.player[Main.npc[NPC.plantBoss].target].dead && !CalamityWorld.bossRushActive) despawn = true; - // Enrage if Plantera's target is on the surface - if (!CalamityWorld.bossRushActive && ((Main.player[Main.npc[NPC.plantBoss].target].position.Y < Main.worldSurface * 16.0 || Main.player[Main.npc[NPC.plantBoss].target].position.Y > ((Main.maxTilesY - 200) * 16)) | despawn)) + // Tile enrage + float tileEnrageMult = Main.npc[NPC.plantBoss].ai[3]; + + // Enrage if Plantera's target is on the surface + if (!CalamityWorld.bossRushActive && ((Main.player[Main.npc[NPC.plantBoss].target].position.Y < Main.worldSurface * 16.0 || Main.player[Main.npc[NPC.plantBoss].target].position.Y > ((Main.maxTilesY - 200) * 16)) | despawn)) { npc.localAI[0] -= 4f; enrage = true; @@ -8669,7 +9074,7 @@ namespace CalamityMod.NPCs // Timer dictating whether to pick a new location or not float moveBoost = death ? 2f : 2f * (1f - lifeRatio); - npc.localAI[0] -= (CalamityWorld.bossRushActive ? 4f : 1f) + moveBoost; + npc.localAI[0] -= ((CalamityWorld.bossRushActive ? 4f : 1f) + moveBoost) * tileEnrageMult; if (enrage) npc.localAI[0] -= 6f; @@ -8737,7 +9142,7 @@ namespace CalamityMod.NPCs { // Hook movement velocity float velocityBoost = death ? 3f : 3f * (1f - lifeRatio); - float velocity = (CalamityWorld.bossRushActive ? 10f : 7f) + velocityBoost; + float velocity = ((CalamityWorld.bossRushActive ? 10f : 7f) + velocityBoost) * tileEnrageMult; if (enrage) velocity *= 2f; if (despawn) @@ -8771,6 +9176,8 @@ namespace CalamityMod.NPCs public static bool BuffedPlanterasTentacleAI(NPC npc, Mod mod, bool chaos) { + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + bool death = CalamityWorld.death || CalamityWorld.bossRushActive; // Despawn if Plantera is gone @@ -8781,31 +9188,52 @@ namespace CalamityMod.NPCs return false; } - // Set Plantera to a variable - int num778 = NPC.plantBoss; + // 3 seconds of resistance and no damage to prevent spawn killing and unfair hits + if (calamityGlobalNPC.newAI[1] < 180f) + { + npc.damage = 0; + npc.defense = npc.defDefense + 999; + calamityGlobalNPC.newAI[1] += 1f; + } + else + { + npc.damage = npc.defDamage; + npc.defense = npc.defDefense; + } + + // Set Plantera to a variable + int num778 = NPC.plantBoss; if (npc.ai[3] > 0f) num778 = (int)npc.ai[3] - 1; - // Movement variables - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[0] -= 1f; - if (npc.localAI[0] <= 0f) - { - npc.localAI[0] = Main.rand.Next(120, 480); - npc.ai[0] = Main.rand.Next(-100, 101); - npc.ai[1] = Main.rand.Next(-100, 101); - npc.netUpdate = true; - } - } + // Tile enrage + float tileEnrageMult = Main.npc[NPC.plantBoss].ai[3]; + + // Movement variables + if (npc.ai[2] == 0f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[0] -= tileEnrageMult; + if (npc.localAI[0] <= 0f) + { + npc.localAI[0] = Main.rand.Next(120, 480); + npc.ai[0] = Main.rand.Next(-100, 101) * tileEnrageMult; + npc.ai[1] = Main.rand.Next(-100, 101) * tileEnrageMult; + npc.netUpdate = true; + } + } + } + else + npc.knockBackResist = 0.25f; // Target npc.TargetClosest(true); // Velocity and acceleration - float num779 = CalamityWorld.bossRushActive ? 1f : 0.5f; + float num779 = (CalamityWorld.bossRushActive ? 1f : 0.5f) * tileEnrageMult; float num781 = death ? 1f : 1f - npc.life / (float)npc.lifeMax; - float num780 = (CalamityWorld.bossRushActive ? 300f : 200f) + (num781 * 50f); + float num780 = ((CalamityWorld.bossRushActive ? 300f : 200f) + (num781 * 50f)) * tileEnrageMult; // Despawn if Plantera is gone if (!Main.npc[num778].active || NPC.plantBoss < 0) @@ -8850,14 +9278,16 @@ namespace CalamityMod.NPCs if (npc.velocity.Y > 0f && num787 < 0f) npc.velocity.Y *= 0.9f; } - if (npc.velocity.X > 8f) - npc.velocity.X = 8f; - if (npc.velocity.X < -8f) - npc.velocity.X = -8f; - if (npc.velocity.Y > 8f) - npc.velocity.Y = 8f; - if (npc.velocity.Y < -8f) - npc.velocity.Y = -8f; + + float velocityLimit = 8f * tileEnrageMult; + if (npc.velocity.X > velocityLimit) + npc.velocity.X = velocityLimit; + if (npc.velocity.X < -velocityLimit) + npc.velocity.X = -velocityLimit; + if (npc.velocity.Y > velocityLimit) + npc.velocity.Y = velocityLimit; + if (npc.velocity.Y < -velocityLimit) + npc.velocity.Y = -velocityLimit; // Direction and rotation if (num786 > 0f) @@ -9124,7 +9554,7 @@ namespace CalamityMod.NPCs { for (int num621 = 0; num621 < 10; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 6, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(npc.position, npc.width, npc.height, DustID.Fire, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity.Y *= 6f; Main.dust[num622].velocity.X *= 3f; if (Main.rand.Next(2) == 0) @@ -9135,10 +9565,10 @@ namespace CalamityMod.NPCs } for (int num623 = 0; num623 < 20; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 6, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(npc.position, npc.width, npc.height, DustID.Fire, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity.Y *= 10f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 6, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(npc.position, npc.width, npc.height, DustID.Fire, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity.X *= 2f; } @@ -9397,10 +9827,10 @@ namespace CalamityMod.NPCs { npc.ai[2] = 0f; - int num670 = 35; + int dmg = 35; if (death) - num670 += 3; - int num671 = ProjectileID.EyeBeam; + dmg += 3; + int projType = ProjectileID.EyeBeam; if (npc.localAI[1] == 0f) { @@ -9428,7 +9858,7 @@ namespace CalamityMod.NPCs if (Main.netMode != NetmodeID.MultiplayerClient) { - int num677 = Projectile.NewProjectile(vector82.X, vector82.Y, num674, num675, num671, num670, 0f, Main.myPlayer, 0f, 0f); + int num677 = Projectile.NewProjectile(vector82.X, vector82.Y, num674, num675, projType, dmg, 0f, Main.myPlayer, 0f, 0f); Main.projectile[num677].timeLeft = enrage ? 480 : 300; } } @@ -9457,7 +9887,7 @@ namespace CalamityMod.NPCs if (Main.netMode != NetmodeID.MultiplayerClient) { - int num682 = Projectile.NewProjectile(vector82.X, vector82.Y, num679, num680, num671, num670, 0f, Main.myPlayer, 0f, 0f); + int num682 = Projectile.NewProjectile(vector82.X, vector82.Y, num679, num680, projType, dmg, 0f, Main.myPlayer, 0f, 0f); Main.projectile[num682].timeLeft = enrage ? 480 : 300; } } @@ -9730,7 +10160,7 @@ namespace CalamityMod.NPCs if (!Collision.CanHit(Main.npc[NPC.golemBoss].Center, 1, 1, Main.player[npc.target].Center, 1, 1)) npc.ai[2] += 8f; - if (npc.ai[2] >= 150f && Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 160f) + if (npc.ai[2] >= 240f && Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 160f) { npc.ai[2] = 0f; @@ -9847,16 +10277,16 @@ namespace CalamityMod.NPCs // Variables int num6 = CalamityWorld.bossRushActive ? 40 : 80; - int num7 = 4; - float num8 = 0.3f; - float scaleFactor2 = 5f; + int num7 = CalamityWorld.bossRushActive ? 2 : 4; + float num8 = CalamityWorld.bossRushActive ? 0.5f : 0.3f; + float scaleFactor2 = CalamityWorld.bossRushActive ? 8f : 5f; int num9 = 90; int num10 = 180; int num11 = 180; int num12 = 30; int num13 = CalamityWorld.bossRushActive ? 60 : 120; - int num14 = 4; - float scaleFactor3 = 6f; + int num14 = CalamityWorld.bossRushActive ? 2 : 4; + float scaleFactor3 = CalamityWorld.bossRushActive ? 10f : 7f; float scaleFactor4 = 20f; float num15 = MathHelper.TwoPi / (num13 / 2); int num16 = 75; @@ -9942,53 +10372,20 @@ namespace CalamityMod.NPCs num17 += MathHelper.TwoPi; if (num17 > MathHelper.TwoPi) num17 -= MathHelper.TwoPi; - if (npc.ai[0] == -1f) - num17 = 0f; - if (npc.ai[0] == 3f) - num17 = 0f; - if (npc.ai[0] == 4f) - num17 = 0f; - if (npc.ai[0] == 8f) + if (npc.ai[0] == -1f || npc.ai[0] == 3f || npc.ai[0] == 4f || npc.ai[0] == 8f) num17 = 0f; float num18 = 0.04f; - if (npc.ai[0] == 1f || npc.ai[0] == 6f) + if (npc.ai[0] == 1f || npc.ai[0] == 6f || npc.ai[0] == 7f) num18 = 0f; - if (npc.ai[0] == 7f) - num18 = 0f; - if (npc.ai[0] == 3f) - num18 = 0.01f; - if (npc.ai[0] == 4f) - num18 = 0.01f; - if (npc.ai[0] == 8f) + if (npc.ai[0] == 3f || npc.ai[0] == 4f || npc.ai[0] == 8f) num18 = 0.01f; - if (npc.rotation < num17) - { - if ((num17 - npc.rotation) > MathHelper.Pi) - npc.rotation -= num18; - else - npc.rotation += num18; - } - if (npc.rotation > num17) - { - if ((npc.rotation - num17) > MathHelper.Pi) - npc.rotation += num18; - else - npc.rotation -= num18; - } + if (num18 != 0f) + npc.rotation = npc.rotation.AngleTowards(num17, num18); - if (npc.rotation > num17 - num18 && npc.rotation < num17 + num18) - npc.rotation = num17; - if (npc.rotation < 0f) - npc.rotation += MathHelper.TwoPi; - if (npc.rotation > MathHelper.TwoPi) - npc.rotation -= MathHelper.TwoPi; - if (npc.rotation > num17 - num18 && npc.rotation < num17 + num18) - npc.rotation = num17; - - // Alpha adjustments - if (npc.ai[0] != -1f && npc.ai[0] < 9f) + // Alpha adjustments + if (npc.ai[0] != -1f && npc.ai[0] < 9f) { if (Collision.SolidCollision(npc.position, npc.width, npc.height)) npc.alpha += 15; @@ -10035,7 +10432,7 @@ namespace CalamityMod.NPCs int num20 = 36; for (int i = 0; i < num20; i++) { - Vector2 dust = (Vector2.Normalize(npc.velocity) * new Vector2(npc.width / 2f, (float)npc.height) * 0.75f * 0.5f).RotatedBy((i - (num20 / 2 - 1)) * MathHelper.TwoPi / num20, default) + npc.Center; + Vector2 dust = (Vector2.Normalize(npc.velocity) * new Vector2(npc.width / 2f, npc.height) * 0.75f * 0.5f).RotatedBy((i - (num20 / 2 - 1)) * MathHelper.TwoPi / num20) + npc.Center; Vector2 vector2 = dust - npc.Center; int num21 = Dust.NewDust(dust + vector2, 0, 0, 172, vector2.X * 2f, vector2.Y * 2f, 100, default, 1.4f); Main.dust[num21].noGravity = true; @@ -10064,30 +10461,7 @@ namespace CalamityMod.NPCs npc.ai[1] = 300 * Math.Sign((vector - player.Center).X); Vector2 vector3 = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -200f) - vector - npc.velocity) * scaleFactor; - if (npc.velocity.X < vector3.X) - { - npc.velocity.X += num3; - if (npc.velocity.X < 0f && vector3.X > 0f) - npc.velocity.X += num3; - } - else if (npc.velocity.X > vector3.X) - { - npc.velocity.X -= num3; - if (npc.velocity.X > 0f && vector3.X < 0f) - npc.velocity.X -= num3; - } - if (npc.velocity.Y < vector3.Y) - { - npc.velocity.Y += num3; - if (npc.velocity.Y < 0f && vector3.Y > 0f) - npc.velocity.Y += num3; - } - else if (npc.velocity.Y > vector3.Y) - { - npc.velocity.Y -= num3; - if (npc.velocity.Y > 0f && vector3.Y < 0f) - npc.velocity.Y -= num3; - } + npc.SimpleFlyMovement(vector3, num3); // Rotation and direction int num22 = Math.Sign(player.Center.X - vector.X); @@ -10197,7 +10571,7 @@ namespace CalamityMod.NPCs int num24 = 7; for (int j = 0; j < num24; j++) { - Vector2 arg_E1C_0 = (Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f).RotatedBy((j - (num24 / 2 - 1)) * MathHelper.Pi / num24, default) + vector; + Vector2 arg_E1C_0 = (Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f).RotatedBy((j - (num24 / 2 - 1)) * MathHelper.Pi / num24) + vector; Vector2 vector4 = ((float)(Main.rand.NextDouble() * MathHelper.Pi) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); int num25 = Dust.NewDust(arg_E1C_0 + vector4, 0, 0, 172, vector4.X * 2f, vector4.Y * 2f, 100, default, 1.4f); Main.dust[num25].noGravity = true; @@ -10207,7 +10581,7 @@ namespace CalamityMod.NPCs } npc.ai[2] += 1f; - if (npc.ai[2] >= (float)chargeTime) + if (npc.ai[2] >= chargeTime) { npc.ai[0] = 0f; npc.ai[1] = 0f; @@ -10225,30 +10599,7 @@ namespace CalamityMod.NPCs npc.ai[1] = 300 * Math.Sign((vector - player.Center).X); Vector2 vector5 = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -200f) - vector - npc.velocity) * scaleFactor2; - if (npc.velocity.X < vector5.X) - { - npc.velocity.X += num8; - if (npc.velocity.X < 0f && vector5.X > 0f) - npc.velocity.X += num8; - } - else if (npc.velocity.X > vector5.X) - { - npc.velocity.X -= num8; - if (npc.velocity.X > 0f && vector5.X < 0f) - npc.velocity.X -= num8; - } - if (npc.velocity.Y < vector5.Y) - { - npc.velocity.Y += num8; - if (npc.velocity.Y < 0f && vector5.Y > 0f) - npc.velocity.Y += num8; - } - else if (npc.velocity.Y > vector5.Y) - { - npc.velocity.Y -= num8; - if (npc.velocity.Y > 0f && vector5.Y < 0f) - npc.velocity.Y -= num8; - } + npc.SimpleFlyMovement(vector5, num8); // Play sounds and spawn bubbles if (npc.ai[2] == 0f) @@ -10261,7 +10612,7 @@ namespace CalamityMod.NPCs if (Main.netMode != NetmodeID.MultiplayerClient) { Vector2 vector6 = Vector2.Normalize(player.Center - vector) * (npc.width + 20) / 2f + vector; - NPC.NewNPC((int)vector6.X, (int)vector6.Y + 45, NPCID.DetonatingBubble, 0, 0f, 0f, 0f, 0f, 255); + NPC.NewNPC((int)vector6.X, (int)vector6.Y + 45, NPCID.DetonatingBubble); } } @@ -10293,7 +10644,7 @@ namespace CalamityMod.NPCs npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); // Play sound and spawn sharknadoes - if (npc.ai[2] == (float)(num9 - 30)) + if (npc.ai[2] == (num9 - 30)) Main.PlaySound(SoundID.Zombie, (int)vector.X, (int)vector.Y, 9, 1f, 0f); if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == num9 - 30) @@ -10351,30 +10702,7 @@ namespace CalamityMod.NPCs npc.ai[1] = 300 * Math.Sign((vector - player.Center).X); Vector2 vector8 = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -200f) - vector - npc.velocity) * scaleFactor; - if (npc.velocity.X < vector8.X) - { - npc.velocity.X += num3; - if (npc.velocity.X < 0f && vector8.X > 0f) - npc.velocity.X += num3; - } - else if (npc.velocity.X > vector8.X) - { - npc.velocity.X -= num3; - if (npc.velocity.X > 0f && vector8.X < 0f) - npc.velocity.X -= num3; - } - if (npc.velocity.Y < vector8.Y) - { - npc.velocity.Y += num3; - if (npc.velocity.Y < 0f && vector8.Y > 0f) - npc.velocity.Y += num3; - } - else if (npc.velocity.Y > vector8.Y) - { - npc.velocity.Y -= num3; - if (npc.velocity.Y > 0f && vector8.Y < 0f) - npc.velocity.Y -= num3; - } + npc.SimpleFlyMovement(vector8, num3); // Direction and rotation int num27 = Math.Sign(player.Center.X - vector.X); @@ -10495,7 +10823,7 @@ namespace CalamityMod.NPCs int num29 = 7; for (int k = 0; k < num29; k++) { - Vector2 arg_1A97_0 = (Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f).RotatedBy((k - (num29 / 2 - 1)) * MathHelper.Pi / num29, default) + vector; + Vector2 arg_1A97_0 = (Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f).RotatedBy((k - (num29 / 2 - 1)) * MathHelper.Pi / num29) + vector; Vector2 vector9 = ((float)(Main.rand.NextDouble() * MathHelper.Pi) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); int num30 = Dust.NewDust(arg_1A97_0 + vector9, 0, 0, 172, vector9.X * 2f, vector9.Y * 2f, 100, default, 1.4f); Main.dust[num30].noGravity = true; @@ -10529,22 +10857,22 @@ namespace CalamityMod.NPCs if (Main.netMode != NetmodeID.MultiplayerClient) { Vector2 vector10 = Vector2.Normalize(npc.velocity) * (npc.width + 20) / 2f + vector; - int num31 = NPC.NewNPC((int)vector10.X, (int)vector10.Y + 45, NPCID.DetonatingBubble, 0, 0f, 0f, 0f, 0f, 255); + int num31 = NPC.NewNPC((int)vector10.X, (int)vector10.Y + 45, NPCID.DetonatingBubble); Main.npc[num31].target = npc.target; - Main.npc[num31].velocity = Vector2.Normalize(npc.velocity).RotatedBy(MathHelper.PiOver2 * npc.direction, default) * scaleFactor3; + Main.npc[num31].velocity = Vector2.Normalize(npc.velocity).RotatedBy(MathHelper.PiOver2 * npc.direction) * scaleFactor3; Main.npc[num31].netUpdate = true; Main.npc[num31].ai[3] = Main.rand.Next(80, 121) / 100f; if (npc.ai[2] % (num14 * 5) == 0f) { - int npc2 = NPC.NewNPC((int)vector10.X, (int)vector10.Y + 45, NPCID.Sharkron2, 0, 0f, 0f, 0f, 0f, 255); + int npc2 = NPC.NewNPC((int)vector10.X, (int)vector10.Y + 45, NPCID.Sharkron2); Main.npc[npc2].ai[1] = 89f; } } } // Velocity and rotation - npc.velocity = npc.velocity.RotatedBy(-(double)num15 * (float)npc.direction, default); + npc.velocity = npc.velocity.RotatedBy(-(double)num15 * (float)npc.direction); npc.rotation -= num15 * npc.direction; npc.ai[2] += 1f; @@ -10738,7 +11066,7 @@ namespace CalamityMod.NPCs int num34 = 7; for (int m = 0; m < num34; m++) { - Vector2 arg_2444_0 = (Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f).RotatedBy((m - (num34 / 2 - 1)) * MathHelper.Pi / num34, default) + vector; + Vector2 arg_2444_0 = (Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f).RotatedBy((m - (num34 / 2 - 1)) * MathHelper.Pi / num34) + vector; Vector2 vector11 = ((float)(Main.rand.NextDouble() * MathHelper.Pi) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); int num35 = Dust.NewDust(arg_2444_0 + vector11, 0, 0, 172, vector11.X * 2f, vector11.Y * 2f, 100, default, 1.4f); Main.dust[num35].noGravity = true; @@ -11214,7 +11542,7 @@ namespace CalamityMod.NPCs { num18 = 0f; } - Vector2 value = new Vector2(0f, -1f).RotatedBy(num18, default) * new Vector2(150f, 200f); + Vector2 value = new Vector2(0f, -1f).RotatedBy(num18) * new Vector2(150f, 200f); Vector2 value2 = player.Center + value - center2; nPC2.ai[0] = 1f; nPC2.ai[1] = num16; @@ -11510,7 +11838,7 @@ namespace CalamityMod.NPCs float[] array = new float[num31]; for (int num32 = 0; num32 < array.Length; num32++) { - array[num32] = Vector2.Distance(npc.Center + spinningpoint.RotatedBy(num32 * MathHelper.TwoPi / num31 - MathHelper.PiOver2, default), player.Center); + array[num32] = Vector2.Distance(npc.Center + spinningpoint.RotatedBy(num32 * MathHelper.TwoPi / num31 - MathHelper.PiOver2), player.Center); } int num33 = 0; for (int num34 = 1; num34 < array.Length; num34++) @@ -11533,7 +11861,7 @@ namespace CalamityMod.NPCs { if (num33 != num36) { - Vector2 vector11 = npc.Center + spinningpoint.RotatedBy(num36 * MathHelper.TwoPi / num31 - MathHelper.PiOver2, default); + Vector2 vector11 = npc.Center + spinningpoint.RotatedBy(num36 * MathHelper.TwoPi / num31 - MathHelper.PiOver2); if (num35-- > 0) { int num37 = NPC.NewNPC((int)vector11.X, (int)vector11.Y + npc.height / 2, NPCID.CultistBossClone, npc.whoAmI, 0f, 0f, 0f, 0f, 255); @@ -11550,7 +11878,7 @@ namespace CalamityMod.NPCs } } npc.ai[2] = Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0f, 0f, ProjectileID.CultistRitual, 0, 0f, Main.myPlayer, 0f, npc.whoAmI); - npc.Center += spinningpoint.RotatedBy(num33 * MathHelper.TwoPi / num31 - MathHelper.PiOver2, default); + npc.Center += spinningpoint.RotatedBy(num33 * MathHelper.TwoPi / num31 - MathHelper.PiOver2); npc.netUpdate = true; list6.Clear(); } @@ -11772,7 +12100,7 @@ namespace CalamityMod.NPCs while (num49 < 5f) { Vector2 vector19 = vec4 * scaleFactor; - vector19 = vector19.RotatedBy(num48 * num49 - (1.2566371f - num48) / 2f, default); + vector19 = vector19.RotatedBy(num48 * num49 - (1.2566371f - num48) / 2f); float ai = (Main.rand.NextFloat() - 0.5f) * 0.3f * MathHelper.TwoPi / 60f; int num50 = NPC.NewNPC((int)vector18.X, (int)vector18.Y + 7, NPCID.AncientLight, 0, 0f, ai, vector19.X, vector19.Y, 255); Main.npc[num50].velocity = vector19; @@ -11950,7 +12278,7 @@ namespace CalamityMod.NPCs npc.ai[0] += 1f; if (npc.ai[0] > 60f) { - npc.velocity = npc.velocity.RotatedBy(npc.ai[1], default); + npc.velocity = npc.velocity.RotatedBy(npc.ai[1]); } if (npc.ai[0] > 120f) { @@ -12007,7 +12335,7 @@ namespace CalamityMod.NPCs Dust dust17 = Main.dust[Dust.NewDust(npc.Center - spinningpoint4 * 20f, 0, 0, 27, 0f, 0f, 0, default, 1f)]; dust17.noGravity = true; dust17.position = npc.Center - spinningpoint4 * Main.rand.Next(10, 21) * npc.scale; - dust17.velocity = spinningpoint4.RotatedBy(MathHelper.PiOver2, default) * 4f; + dust17.velocity = spinningpoint4.RotatedBy(MathHelper.PiOver2) * 4f; dust17.scale = 0.5f + Main.rand.NextFloat(); dust17.fadeIn = 0.5f; } @@ -12017,7 +12345,7 @@ namespace CalamityMod.NPCs Dust dust18 = Main.dust[Dust.NewDust(npc.Center - spinningpoint5 * 30f, 0, 0, 240, 0f, 0f, 0, default, 1f)]; dust18.noGravity = true; dust18.position = npc.Center - spinningpoint5 * 20f * npc.scale; - dust18.velocity = spinningpoint5.RotatedBy(-MathHelper.PiOver2, default) * 2f; + dust18.velocity = spinningpoint5.RotatedBy(-MathHelper.PiOver2) * 2f; dust18.scale = 0.5f + Main.rand.NextFloat(); dust18.fadeIn = 0.5f; } @@ -12032,7 +12360,7 @@ namespace CalamityMod.NPCs dust19.noLight = true; } npc.localAI[0] += 0.05235988f; - npc.localAI[1] = 0.25f + Vector2.UnitY.RotatedBy(npc.ai[1] * MathHelper.TwoPi / 60f, default).Y * 0.25f; + npc.localAI[1] = 0.25f + Vector2.UnitY.RotatedBy(npc.ai[1] * MathHelper.TwoPi / 60f).Y * 0.25f; if (npc.ai[1] >= num1496) { int damage = 50; @@ -12044,7 +12372,7 @@ namespace CalamityMod.NPCs { for (int num1501 = 0; num1501 < 4; num1501++) { - Vector2 vector255 = new Vector2(0f, -num1499).RotatedBy(MathHelper.PiOver2 * num1501, default); + Vector2 vector255 = new Vector2(0f, -num1499).RotatedBy(MathHelper.PiOver2 * num1501); Projectile.NewProjectile(npc.Center.X, npc.Center.Y, vector255.X, vector255.Y, ProjectileID.AncientDoomProjectile, damage, 0f, Main.myPlayer, 0f, 0f); } } @@ -12326,18 +12654,18 @@ namespace CalamityMod.NPCs if (npc.ai[1] == 60f) { - for (int num1161 = 0; num1161 < Main.maxProjectiles; num1161++) + for (int i = 0; i < Main.maxProjectiles; i++) { - Projectile projectile = Main.projectile[num1161]; + Projectile projectile = Main.projectile[i]; if (projectile.active && (projectile.type == ProjectileID.MoonLeech || projectile.type == ProjectileID.PhantasmalBolt || projectile.type == ProjectileID.PhantasmalDeathray || projectile.type == ProjectileID.PhantasmalEye || projectile.type == ProjectileID.PhantasmalSphere)) projectile.Kill(); } - for (int num1162 = 0; num1162 < Main.maxNPCs; num1162++) + for (int j = 0; j < Main.maxNPCs; j++) { - NPC nPC3 = Main.npc[num1162]; + NPC nPC3 = Main.npc[j]; if (nPC3.active && nPC3.type == NPCID.MoonLordFreeEye) { nPC3.HitEffect(0, 9999.0); @@ -12362,7 +12690,7 @@ namespace CalamityMod.NPCs if (flag86 && WorldGen.SolidTile(point5.X, point5.Y)) flag86 = false; - float num1163 = (float)Main.rand.Next(6, 19); + float num1163 = Main.rand.Next(6, 19); float num1164 = MathHelper.TwoPi / num1163; float num1165 = MathHelper.TwoPi * Main.rand.NextFloat(); float scaleFactor8 = 1f + Main.rand.NextFloat() * 2f; @@ -12382,7 +12710,7 @@ namespace CalamityMod.NPCs Dust dust2 = Main.dust[Dust.NewDust(vector159, 0, 0, 229, 0f, 0f, 0, default, 1f)]; dust2.noGravity = true; dust2.position = vector159; - dust2.velocity = Vector2.UnitY.RotatedBy(num1165 + num1164 * num1168, default) * scaleFactor8 * (Main.rand.NextFloat() * 1.6f + 1.6f); + dust2.velocity = Vector2.UnitY.RotatedBy(num1165 + num1164 * num1168) * scaleFactor8 * (Main.rand.NextFloat() * 1.6f + 1.6f); dust2.fadeIn = fadeIn; dust2.scale = num1166; ai1 = num1168; @@ -12438,7 +12766,7 @@ namespace CalamityMod.NPCs if (flag88) { float num1170 = (Main.rand.Next(4) < 2).ToDirectionInt() * (0.3926991f + MathHelper.PiOver4 * Main.rand.NextFloat()); - Vector2 vector164 = new Vector2(0f, -Main.rand.NextFloat() * 0.5f - 0.5f).RotatedBy(num1170, default) * 6f; + Vector2 vector164 = new Vector2(0f, -Main.rand.NextFloat() * 0.5f - 0.5f).RotatedBy(num1170) * 6f; Projectile.NewProjectile(vector163.X, vector163.Y, vector164.X, vector164.Y, ProjectileID.BlowupSmokeMoonlord, 0, 0f, Main.myPlayer, 0f, 0f); } } @@ -12455,9 +12783,6 @@ namespace CalamityMod.NPCs npc.HitEffect(0, 1337.0); npc.checkDead(); - if (!CalamityWorld.bossRushActive) - MoonLordLoot(npc); - for (int num1174 = 0; num1174 < Main.maxNPCs; num1174++) { NPC nPC5 = Main.npc[num1174]; @@ -12832,7 +13157,7 @@ namespace CalamityMod.NPCs if (vector200.X < 0f) num1225 = 1f; - vector200 = vector200.RotatedBy(-(double)num1225 * MathHelper.TwoPi / 6f, default); + vector200 = vector200.RotatedBy(-(double)num1225 * MathHelper.TwoPi / 6f); Projectile.NewProjectile(npc.Center.X, npc.Center.Y, vector200.X, vector200.Y, projectileType, damage, 0f, Main.myPlayer, num1225 * MathHelper.TwoPi / calamityGlobalNPC.newAI[1], (float)npc.whoAmI); npc.ai[2] = (vector200.ToRotation() + MathHelper.Pi + MathHelper.TwoPi) * num1225; npc.netUpdate = true; @@ -13821,8 +14146,8 @@ namespace CalamityMod.NPCs } Vector2 spinningpoint2 = Vector2.UnitY * -30f; - Vector2 value25 = spinningpoint2.RotatedBy(num1250 * MathHelper.TwoPi / 6f, default); - Vector2 value26 = spinningpoint2.RotatedBy(num1251 * MathHelper.TwoPi / 6f, default); + Vector2 value25 = spinningpoint2.RotatedBy(num1250 * MathHelper.TwoPi / 6f); + Vector2 value26 = spinningpoint2.RotatedBy(num1251 * MathHelper.TwoPi / 6f); Vector2 vector216 = Vector2.Lerp(value25, value26, num1249 - (int)num1249); float value27 = vector216.Length() / 30f; @@ -14052,7 +14377,7 @@ namespace CalamityMod.NPCs if (vector222.X < 0f) num1262 = 1f; - vector222 = vector222.RotatedBy(-(double)num1262 * MathHelper.TwoPi / 6f, default); + vector222 = vector222.RotatedBy(-(double)num1262 * MathHelper.TwoPi / 6f); Projectile.NewProjectile(npc.Center.X, npc.Center.Y, vector222.X, vector222.Y, ProjectileID.PhantasmalDeathray, 50, 0f, Main.myPlayer, num1262 * MathHelper.TwoPi / calamityGlobalNPC.newAI[1], npc.whoAmI); npc.ai[2] = (vector222.ToRotation() + MathHelper.Pi + MathHelper.TwoPi) * num1262; npc.netUpdate = true; @@ -14204,7 +14529,7 @@ namespace CalamityMod.NPCs Vector2 spinningpoint3 = Vector2.UnitY * -npc.height / 2f; for (int num1286 = 0; num1286 < 6; num1286++) { - int num1287 = Dust.NewDust(npc.Center - Vector2.One * 4f + spinningpoint3.RotatedBy(num1286 * MathHelper.TwoPi / 6f, default), 0, 0, 229, 0f, 0f, 0, default, 1f); + int num1287 = Dust.NewDust(npc.Center - Vector2.One * 4f + spinningpoint3.RotatedBy(num1286 * MathHelper.TwoPi / 6f), 0, 0, 229, 0f, 0f, 0, default, 1f); Main.dust[num1287].velocity = -Vector2.UnitY; Main.dust[num1287].noGravity = true; Main.dust[num1287].scale = 0.7f; @@ -14214,7 +14539,7 @@ namespace CalamityMod.NPCs spinningpoint3 = Vector2.UnitY * -npc.height / 6f; for (int num1288 = 0; num1288 < 3; num1288++) { - int num1289 = Dust.NewDust(npc.Center - Vector2.One * 4f + spinningpoint3.RotatedBy(num1288 * MathHelper.TwoPi / 6f, default), 0, 0, 229, 0f, -2f, 0, default, 1f); + int num1289 = Dust.NewDust(npc.Center - Vector2.One * 4f + spinningpoint3.RotatedBy(num1288 * MathHelper.TwoPi / 6f), 0, 0, 229, 0f, -2f, 0, default, 1f); Main.dust[num1289].noGravity = true; Main.dust[num1289].scale = 1.5f; Main.dust[num1289].customData = npc; @@ -14222,98 +14547,6 @@ namespace CalamityMod.NPCs } return false; } - - #region Moon Lord Loot - private static void MoonLordLoot(NPC npc) - { - DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !NPC.downedMoonlord); - DropHelper.DropResidentEvilAmmo(npc, NPC.downedMoonlord, 5, 2, 1); - - string key = "Mods.CalamityMod.MoonBossText"; - Color messageColor = Color.Orange; - string key2 = "Mods.CalamityMod.MoonBossText2"; - Color messageColor2 = Color.Violet; - string key3 = "Mods.CalamityMod.MoonBossText3"; - Color messageColor3 = Color.Crimson; - string key4 = "Mods.CalamityMod.ProfanedBossText2"; - Color messageColor4 = Color.Cyan; - string key5 = "Mods.CalamityMod.FutureOreText"; - Color messageColor5 = Color.LightGray; - - // Spawn Exodium and send messages about Providence, Bloodstone, Phantoplasm, etc. if ML has not been killed yet - if (!NPC.downedMoonlord) - { - WorldGenerationMethods.SpawnOre(ModContent.TileType(), 12E-05, .01f, .07f); - - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - Main.NewText(Language.GetTextValue(key2), messageColor2); - Main.NewText(Language.GetTextValue(key3), messageColor3); - Main.NewText(Language.GetTextValue(key4), messageColor4); - Main.NewText(Language.GetTextValue(key5), messageColor5); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key2), messageColor2); - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key3), messageColor3); - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key4), messageColor4); - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key5), messageColor5); - } - } - - if (CalamityWorld.armageddon) - { - DropHelper.DropArmageddonBags(npc); - } - - if (Main.netMode != NetmodeID.Server) - { - if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active) - { - Main.player[Main.myPlayer].Calamity().adrenaline = 0; - } - } - - NPC.downedMoonlord = true; - NPC.LunarApocalypseIsUp = false; - - npc.DropBossBags(); - - if (Main.rand.NextBool(10)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, 3595, 1, false, 0, false, false); - } - - int stack = Main.rand.Next(5, 16); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, 499, stack, false, 0, false, false); - - int num70 = Main.rand.Next(5) + 5; - for (int num71 = 0; num71 < num70; num71++) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, 58, 1, false, 0, false, false); - } - - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue("Announcement.HasBeenDefeated_Single", Language.GetTextValue("Enemies.MoonLord")), 175, 75, 255, false); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey("Announcement.HasBeenDefeated_Single", new object[] - { - NetworkText.FromKey("Enemies.MoonLord", new object[0]) - }), new Color(175, 75, 255), -1); - } - - if (Main.netMode == NetmodeID.Server) - { - NetMessage.SendData(MessageID.WorldData, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - } - #endregion - #endregion #region Buffed Mothron AI @@ -14423,7 +14656,7 @@ namespace CalamityMod.NPCs npc.ai[0] = 2f; else if (num1355 == 1) npc.ai[0] = 3f; - else if (num1355 == 2 && NPC.CountNPCS(478) + NPC.CountNPCS(479) < 2) + else if (num1355 == 2 && NPC.CountNPCS(NPCID.MothronEgg) + NPC.CountNPCS(NPCID.MothronSpawn) < 2) npc.ai[0] = 4f; } } @@ -14790,7 +15023,7 @@ namespace CalamityMod.NPCs num858 *= num859; num857 *= 1f + (float)Main.rand.Next(-30, 31) * 0.01f; num858 *= 1f + (float)Main.rand.Next(-30, 31) * 0.01f; - Projectile.NewProjectile(vector109.X, vector109.Y, num857, num858, Main.rand.Next(326, 329), 60, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(vector109.X, vector109.Y, num857, num858, ProjectileID.GreekFire1 + Main.rand.Next(3), 60, 0f, Main.myPlayer, 0f, 0f); } } } @@ -14800,13 +15033,13 @@ namespace CalamityMod.NPCs npc.TargetClosest(true); npc.ai[0] = 1f; - int num861 = NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2)), (int)npc.position.Y + npc.height / 2, 328, npc.whoAmI, 0f, 0f, 0f, 0f, 255); + int num861 = NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2)), (int)npc.position.Y + npc.height / 2, NPCID.PumpkingBlade, npc.whoAmI, 0f, 0f, 0f, 0f, 255); Main.npc[num861].ai[0] = -1f; Main.npc[num861].ai[1] = (float)npc.whoAmI; Main.npc[num861].target = npc.target; Main.npc[num861].netUpdate = true; - num861 = NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2)), (int)npc.position.Y + npc.height / 2, 328, npc.whoAmI, 0f, 0f, 0f, 0f, 255); + num861 = NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2)), (int)npc.position.Y + npc.height / 2, NPCID.PumpkingBlade, npc.whoAmI, 0f, 0f, 0f, 0f, 255); Main.npc[num861].ai[0] = 1f; Main.npc[num861].ai[1] = (float)npc.whoAmI; Main.npc[num861].ai[3] = 150f; @@ -15358,43 +15591,44 @@ namespace CalamityMod.NPCs #region Revengeance Dungeon Guardian AI public static void RevengeanceDungeonGuardianAI(NPC npc, bool configBossRushBoost, bool enraged) { - Vector2 vector21 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num177 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector21.X; - float num178 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector21.Y; - float num179 = (float)Math.Sqrt(num177 * num177 + num178 * num178); - num179 = 12f / num179; - npc.velocity.X = num177 * num179; - npc.velocity.Y = num178 * num179; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[1] += 1f; - if (npc.localAI[1] >= 60f) - { - npc.localAI[1] = 0f; - Vector2 vector16 = npc.Center; - if (Collision.CanHit(vector16, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - float num159 = 5f; - float num160 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector16.X + Main.rand.Next(-20, 21); - float num161 = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - vector16.Y + Main.rand.Next(-20, 21); - float num162 = (float)Math.Sqrt(num160 * num160 + num161 * num161); - num162 = num159 / num162; - num160 *= num162; - num161 *= num162; - Vector2 value = new Vector2(num160 * 1f + Main.rand.Next(-50, 51) * 0.01f, num161 * 1f + Main.rand.Next(-50, 51) * 0.01f); - value.Normalize(); - value *= num159; - value += npc.velocity; - num160 = value.X; - num161 = value.Y; - int num163 = 2500; - int num164 = ProjectileID.Skull; - vector16 += value * 5f; - int num165 = Projectile.NewProjectile(vector16.X, vector16.Y, num160, num161, num164, num163, 0f, Main.myPlayer, -1f, 0f); - Main.projectile[num165].timeLeft = 300; - } - } - } + Player target = Main.player[npc.target]; + if (npc.ai[1] != 3f) + { + Vector2 targetVector = target.Center - npc.Center; + float targetDist = targetVector.Length(); + targetDist = 12f / targetDist; + npc.velocity.X = targetVector.X * targetDist; + npc.velocity.Y = targetVector.Y * targetDist; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (npc.localAI[1]++ % 60f == 59f) + { + Vector2 source = npc.Center; + if (Collision.CanHit(source, 1, 1, target.Center, target.width, target.height)) + { + float speed = 5f; + float xDist = target.Center.X - source.X + Main.rand.Next(-20, 21); + float yDist = target.Center.Y - source.Y + Main.rand.Next(-20, 21); + Vector2 velocity = new Vector2(xDist, yDist); + float distTarget = velocity.Length(); + distTarget = speed / distTarget; + velocity.X *= distTarget; + velocity.Y *= distTarget; + Vector2 offset = new Vector2(velocity.X * 1f + Main.rand.Next(-50, 51) * 0.01f, velocity.Y * 1f + Main.rand.Next(-50, 51) * 0.01f); + offset.Normalize(); + offset *= speed; + offset += npc.velocity; + velocity.X = offset.X; + velocity.Y = offset.Y; + int damage = 2500; + int projType = ProjectileID.Skull; + source += offset * 5f; + int skull = Projectile.NewProjectile(source, velocity, projType, damage, 0f, Main.myPlayer, -1f, 0f); + Main.projectile[skull].timeLeft = 300; + } + } + } + } } #endregion @@ -15675,7 +15909,7 @@ namespace CalamityMod.NPCs if (npc.type == NPCID.LavaSlime || npc.type == ModContent.NPCType()) { Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 1f, 0.3f, 0.1f); - int idx = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 6, npc.velocity.X * 0.2f, npc.velocity.Y * 0.2f, 100, default, 1.7f); + int idx = Dust.NewDust(npc.position, npc.width, npc.height, 6, npc.velocity.X * 0.2f, npc.velocity.Y * 0.2f, 100, default, 1.7f); Main.dust[idx].noGravity = true; } if (npc.ai[2] > 1f) @@ -16079,7 +16313,7 @@ namespace CalamityMod.NPCs DemonEyeBatMovement(npc, 8f, 3.5f, 0.12f, 0.12f, 0.25f, 0.06f, 0.07f, 0.2f); if (Main.rand.NextBool(40)) { - int idx = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + (float)npc.height * 0.25f), npc.width, (int)((float)npc.height * 0.5f), 5, npc.velocity.X, 2f, 0, default, 1f); + int idx = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + (float)npc.height * 0.25f), npc.width, (int)((float)npc.height * 0.5f), DustID.Blood, npc.velocity.X, 2f, 0, default, 1f); Dust dust = Main.dust[idx]; dust.velocity.X *= 0.5f; dust.velocity.Y *= 0.1f; @@ -16111,7 +16345,7 @@ namespace CalamityMod.NPCs (npc.type >= NPCID.CataractEye && npc.type <= NPCID.PurpleEye)) && Main.rand.NextBool(40)) { - int num4 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + (float)npc.height * 0.25f), npc.width, (int)((float)npc.height * 0.5f), 5, npc.velocity.X, 2f, 0, default(Color), 1f); + int num4 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + (float)npc.height * 0.25f), npc.width, (int)((float)npc.height * 0.5f), DustID.Blood, npc.velocity.X, 2f, 0, default(Color), 1f); Dust dust = Main.dust[num4]; dust.velocity.X *= 0.5f; dust.velocity.Y *= 0.1f; @@ -16629,7 +16863,7 @@ namespace CalamityMod.NPCs } if (((player.Center.X < npc.Center.X && npc.direction < 0 && player.direction > 0) || (player.Center.X > npc.Center.X && npc.direction > 0 && player.direction < 0)) && canTurnPlayerToStone && (Collision.CanHitLine(npc.Center, 1, 1, player.Center, 1, 1) || Collision.CanHitLine(npc.Center - Vector2.UnitY * 16f, 1, 1, player.Center, 1, 1) || Collision.CanHitLine(npc.Center + Vector2.UnitY * 8f, 1, 1, player.Center, 1, 1))) { - player.AddBuff(156, debuffTime + (int)npc.ai[2] * -1, true); + player.AddBuff(BuffID.Stoned, debuffTime + (int)npc.ai[2] * -1, true); } } } @@ -17123,7 +17357,7 @@ namespace CalamityMod.NPCs // This variable seems to have a lot of purposes. // I wasn't sure what I could name it that isn't very vague int aiGateValue = 60; - if (npcType == NPCID.ChaosElemental) + if (npcType == NPCID.ChaosElemental || npcType == ModContent.NPCType()) { aiGateValue = 180; if (npc.ai[3] == -30f) @@ -17155,7 +17389,7 @@ namespace CalamityMod.NPCs } bool canIncrementAI3 = false; bool reset = true; - if (npcType == NPCID.Yeti || npcType == NPCID.CorruptBunny || npcType == NPCID.Crab || npcType == NPCID.Clown || npcType == NPCID.SkeletonArcher || npcType == NPCID.GoblinArcher || npcType == NPCID.ChaosElemental + if (npcType == NPCID.Yeti || npcType == NPCID.CorruptBunny || npcType == NPCID.Crab || npcType == NPCID.Clown || npcType == NPCID.SkeletonArcher || npcType == NPCID.GoblinArcher || npcType == NPCID.ChaosElemental || npcType == ModContent.NPCType() || npcType == NPCID.BlackRecluse || npcType == NPCID.WallCreeper || npcType == NPCID.BloodCrawler || npcType == NPCID.CorruptPenguin || npcType == NPCID.LihzahrdCrawler || npcType == NPCID.IcyMerman || npcType == NPCID.PirateDeadeye || npcType == NPCID.PirateCrossbower || npcType == NPCID.PirateCaptain || npcType == NPCID.CochinealBeetle || npcType == NPCID.CyanBeetle || npcType == NPCID.LacBeetle || npcType == NPCID.SeaSnail || npcType == NPCID.FlyingSnake || npcType == NPCID.IceGolem || npcType == NPCID.Eyezor || npcType == NPCID.AnomuraFungus || npcType == NPCID.MushiLadybug || npcType == NPCID.Paladin || npcType == NPCID.SkeletonSniper || npcType == NPCID.TacticalSkeleton @@ -17209,7 +17443,7 @@ namespace CalamityMod.NPCs goto PrepareToShoot; } } - else if (npcType - 498 > 8 && npcType != 520) + else if (npcType - 498 > 8 && npcType != NPCID.MartianWalker) { goto PrepareToShoot; } @@ -17399,7 +17633,7 @@ namespace CalamityMod.NPCs } } } - if (npc.ai[3] < (float)aiGateValue && (Main.eclipse || !Main.dayTime || (double)npc.position.Y > Main.worldSurface * 16.0 || (Main.invasionType == 1 && (npcType == NPCID.Yeti || npcType == NPCID.ElfArcher)) || (Main.invasionType == 1 && (npcType == NPCID.GoblinPeon || npcType == NPCID.GoblinThief || npcType == NPCID.GoblinWarrior || npcType == NPCID.GoblinArcher || npcType == NPCID.GoblinSummoner)) || (npcType == NPCID.GoblinScout || (Main.invasionType == 3 && npcType >= 212 && npcType <= 216)) || (Main.invasionType == 4 && (npcType == NPCID.BrainScrambler || npcType == NPCID.RayGunner || npcType == NPCID.MartianOfficer || npcType == NPCID.GrayGrunt || npcType == NPCID.MartianEngineer || npcType == NPCID.GigaZapper || npcType == NPCID.Scutlix || npcType == NPCID.MartianWalker)) || (npcType == NPCID.AngryBones || npcType == NPCID.AngryBonesBig || npcType == NPCID.AngryBonesBigMuscle || npcType == NPCID.AngryBonesBigHelmet || npcType == NPCID.CorruptBunny || npcType == NPCID.Crab || npcType == NPCID.ArmoredSkeleton || npcType == NPCID.Mummy || npcType == NPCID.DarkMummy || npcType == NPCID.LightMummy || npcType == NPCID.SkeletonArcher || npcType == NPCID.ChaosElemental || npcType == NPCID.CorruptPenguin || npcType == NPCID.FaceMonster || npcType == NPCID.SnowFlinx || npcType == NPCID.Lihzahrd || npcType == NPCID.LihzahrdCrawler || npcType == NPCID.IcyMerman || npcType == NPCID.CochinealBeetle || npcType == NPCID.CyanBeetle || npcType == NPCID.LacBeetle || npcType == NPCID.SeaSnail || npcType == NPCID.BloodCrawler || npcType == NPCID.IceGolem || npcType == NPCID.ZombieMushroom || npcType == NPCID.ZombieMushroomHat || npcType == NPCID.AnomuraFungus || npcType == NPCID.MushiLadybug || npcType == NPCID.SkeletonSniper || npcType == NPCID.TacticalSkeleton || npcType == NPCID.SkeletonCommando || npcType == NPCID.CultistArcherBlue || npcType == NPCID.CultistArcherWhite || npcType == NPCID.CrimsonBunny || npcType == NPCID.CrimsonPenguin || npcType == NPCID.NebulaSoldier || (npcType == NPCID.StardustSoldier && (npc.ai[1] >= 180f || npc.ai[1] < 90f))) || (npcType == NPCID.StardustSpiderBig || npcType == NPCID.VortexRifleman || npcType == NPCID.VortexSoldier || npcType == NPCID.VortexHornet || npcType == NPCID.VortexLarva || npcType == NPCID.WalkingAntlion || npcType == NPCID.SolarDrakomire || npcType == NPCID.SolarSolenian || (npcType >= 524 && npcType <= 527)) || npcType == NPCID.DesertLamiaLight || npcType == NPCID.DesertLamiaDark || npcType == NPCID.DesertScorpionWalk || npcType == NPCID.DesertBeast)) + if (npc.ai[3] < (float)aiGateValue && (Main.eclipse || !Main.dayTime || (double)npc.position.Y > Main.worldSurface * 16.0 || (Main.invasionType == InvasionID.GoblinArmy && (npcType == NPCID.Yeti || npcType == NPCID.ElfArcher)) || (Main.invasionType == InvasionID.GoblinArmy && (npcType == NPCID.GoblinPeon || npcType == NPCID.GoblinThief || npcType == NPCID.GoblinWarrior || npcType == NPCID.GoblinArcher || npcType == NPCID.GoblinSummoner)) || (npcType == NPCID.GoblinScout || (Main.invasionType == InvasionID.PirateInvasion && npcType >= 212 && npcType <= 216)) || (Main.invasionType == InvasionID.MartianMadness && (npcType == NPCID.BrainScrambler || npcType == NPCID.RayGunner || npcType == NPCID.MartianOfficer || npcType == NPCID.GrayGrunt || npcType == NPCID.MartianEngineer || npcType == NPCID.GigaZapper || npcType == NPCID.Scutlix || npcType == NPCID.MartianWalker)) || (npcType == NPCID.AngryBones || npcType == NPCID.AngryBonesBig || npcType == NPCID.AngryBonesBigMuscle || npcType == NPCID.AngryBonesBigHelmet || npcType == NPCID.CorruptBunny || npcType == NPCID.Crab || npcType == NPCID.ArmoredSkeleton || npcType == NPCID.Mummy || npcType == NPCID.DarkMummy || npcType == NPCID.LightMummy || npcType == NPCID.SkeletonArcher || npcType == NPCID.ChaosElemental || npcType == ModContent.NPCType() || npcType == NPCID.CorruptPenguin || npcType == NPCID.FaceMonster || npcType == NPCID.SnowFlinx || npcType == NPCID.Lihzahrd || npcType == NPCID.LihzahrdCrawler || npcType == NPCID.IcyMerman || npcType == NPCID.CochinealBeetle || npcType == NPCID.CyanBeetle || npcType == NPCID.LacBeetle || npcType == NPCID.SeaSnail || npcType == NPCID.BloodCrawler || npcType == NPCID.IceGolem || npcType == NPCID.ZombieMushroom || npcType == NPCID.ZombieMushroomHat || npcType == NPCID.AnomuraFungus || npcType == NPCID.MushiLadybug || npcType == NPCID.SkeletonSniper || npcType == NPCID.TacticalSkeleton || npcType == NPCID.SkeletonCommando || npcType == NPCID.CultistArcherBlue || npcType == NPCID.CultistArcherWhite || npcType == NPCID.CrimsonBunny || npcType == NPCID.CrimsonPenguin || npcType == NPCID.NebulaSoldier || (npcType == NPCID.StardustSoldier && (npc.ai[1] >= 180f || npc.ai[1] < 90f))) || (npcType == NPCID.StardustSpiderBig || npcType == NPCID.VortexRifleman || npcType == NPCID.VortexSoldier || npcType == NPCID.VortexHornet || npcType == NPCID.VortexLarva || npcType == NPCID.WalkingAntlion || npcType == NPCID.SolarDrakomire || npcType == NPCID.SolarSolenian || (npcType >= 524 && npcType <= 527)) || npcType == NPCID.DesertLamiaLight || npcType == NPCID.DesertLamiaDark || npcType == NPCID.DesertScorpionWalk || npcType == NPCID.DesertBeast)) { if ((npcType == NPCID.Zombie || npcType == NPCID.ZombieXmas || npcType == NPCID.ZombieSweater || npcType == NPCID.Skeleton || (npcType >= NPCID.BoneThrowingSkeleton && npcType <= NPCID.BoneThrowingSkeleton4) || npcType == NPCID.AngryBones || npcType == NPCID.AngryBonesBig || npcType == NPCID.AngryBonesBigHelmet || npcType == NPCID.AngryBonesBigMuscle || npcType == NPCID.ArmoredSkeleton || npcType == NPCID.SkeletonArcher || npcType == NPCID.BaldZombie || npcType == NPCID.UndeadViking || npcType == NPCID.ZombieEskimo || npcType == NPCID.Frankenstein || npcType == NPCID.PincushionZombie || npcType == NPCID.SlimedZombie || npcType == NPCID.SwampZombie || npcType == NPCID.TwiggyZombie || npcType == NPCID.ArmoredViking || npcType == NPCID.FemaleZombie || npcType == NPCID.HeadacheSkeleton || npcType == NPCID.MisassembledSkeleton || npcType == NPCID.PantlessSkeleton || npcType == NPCID.ZombieRaincoat || npcType == NPCID.SkeletonSniper || npcType == NPCID.TacticalSkeleton || npcType == NPCID.SkeletonCommando || npcType == NPCID.ZombieSuperman || npcType == NPCID.ZombiePixie || npcType == NPCID.ZombieDoctor || npcType == NPCID.GreekSkeleton) && Main.rand.Next(1000) == 0) { @@ -17475,10 +17709,7 @@ namespace CalamityMod.NPCs { npc.direction *= -1; - if (npcType == ModContent.NPCType()) - npc.spriteDirection = (npc.direction > 0) ? 1 : -1; - else - npc.spriteDirection = npc.direction; + npc.spriteDirection = npc.direction; npc.ai[0] = 0f; } @@ -17535,7 +17766,7 @@ namespace CalamityMod.NPCs { FighterRunningAI(npc, 6f, 0.12f, 0.8f, true, 0.8f); } - else if (npcType == NPCID.ChaosElemental || npcType == NPCID.SwampThing || npcType == NPCID.PirateCorsair || npcType == NPCID.MushiLadybug || npcType == NPCID.DesertLamiaLight || npcType == NPCID.DesertLamiaDark) + else if (npcType == NPCID.ChaosElemental || npcType == ModContent.NPCType() || npcType == NPCID.SwampThing || npcType == NPCID.PirateCorsair || npcType == NPCID.MushiLadybug || npcType == NPCID.DesertLamiaLight || npcType == NPCID.DesertLamiaDark) { FighterRunningAI(npc, 4f, 0.09f, 0.8f, true, 0.8f); } @@ -18849,34 +19080,20 @@ namespace CalamityMod.NPCs distX *= magnitude; distY *= magnitude; int damage = 35; - int projectileType = 82; - if (npcType == NPCID.GoblinArcher) - { - damage = 11; - } - if (npcType == NPCID.IcyMerman) - { - damage = 37; - } - if (npcType == NPCID.CultistArcherBlue || npcType == NPCID.CultistArcherWhite) - { - damage = 40; - } + int projectileType = ProjectileID.FlamingArrow; if (npcType == NPCID.ElfArcher) { damage = 45; } - if (npcType == NPCID.DrManFly) - { - damage = 50; - } if (npcType == NPCID.GoblinArcher) { projectileType = ProjectileID.WoodenArrowHostile; + damage = 11; } if (npcType == NPCID.CultistArcherBlue || npcType == NPCID.CultistArcherWhite) { projectileType = ProjectileID.WoodenArrowHostile; + damage = 40; } if (npcType == NPCID.BrainScrambler) { @@ -18911,10 +19128,12 @@ namespace CalamityMod.NPCs if (npcType == NPCID.IcyMerman) { projectileType = ProjectileID.IcewaterSpit; + damage = 37; } if (npcType == NPCID.DrManFly) { projectileType = ProjectileID.DrManFlyFlask; + damage = 50; } if (npcType == NPCID.StardustSoldier) { @@ -19012,7 +19231,7 @@ namespace CalamityMod.NPCs } else if (npcType == NPCID.StardustSpiderBig) { - int idx = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, 410, npc.whoAmI, 0f, 0f, 0f, 0f, 255); + int idx = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, NPCID.StardustSpiderSmall, npc.whoAmI, 0f, 0f, 0f, 0f, 255); Main.npc[idx].velocity = new Vector2(distX, -6f + distY); } else @@ -19477,7 +19696,7 @@ namespace CalamityMod.NPCs else { int alteredDirection = npc.spriteDirection; - if (npcType == NPCID.VortexRifleman || npcType == ModContent.NPCType()) + if (npcType == NPCID.VortexRifleman) { alteredDirection *= -1; } @@ -19536,7 +19755,7 @@ namespace CalamityMod.NPCs npc.velocity.Y = -5f; npc.netUpdate = true; } - if (npcType == NPCID.ChaosElemental && npc.velocity.Y < 0f) + if ((npcType == NPCID.ChaosElemental || npcType == ModContent.NPCType()) && npc.velocity.Y < 0f) { npc.velocity.Y *= 1.1f; } @@ -19564,7 +19783,7 @@ namespace CalamityMod.NPCs npc.ai[2] = 0f; } // Teleport (Chaos elementals) - if (Main.netMode != NetmodeID.MultiplayerClient && npcType == NPCID.ChaosElemental && npc.ai[3] >= (float)aiGateValue) + if (Main.netMode != NetmodeID.MultiplayerClient && (npcType == NPCID.ChaosElemental || npcType == ModContent.NPCType()) && npc.ai[3] >= (float)aiGateValue) { int tileCoordsX = (int)Main.player[npc.target].position.X / 16; int tileCoordsY = (int)Main.player[npc.target].position.Y / 16; @@ -19589,7 +19808,7 @@ namespace CalamityMod.NPCs bool foundGoodTeleport = true; // I don't understand why the hell this exists if it's only for Chaos Elementals, but I suppose I'll // Leave it here - if (npcType == NPCID.DarkCaster && Main.tile[randX, num181 - 1].wall == 0) + if (npcType == NPCID.DarkCaster && Main.tile[randX, num181 - 1].wall == WallID.None) { foundGoodTeleport = false; } @@ -20852,7 +21071,7 @@ namespace CalamityMod.NPCs { if (npc.type == NPCID.GoblinSorcerer || npc.type == NPCID.Tim) { - int num69 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 27, 0f, 0f, 100, default(Color), (float)Main.rand.Next(1, 3)); + int num69 = Dust.NewDust(npc.position, npc.width, npc.height, 27, 0f, 0f, 100, default(Color), (float)Main.rand.Next(1, 3)); Dust dust = Main.dust[num69]; dust.velocity *= 3f; if (Main.dust[num69].scale > 1f) @@ -20862,35 +21081,35 @@ namespace CalamityMod.NPCs } else if (npc.type == NPCID.DarkCaster) { - int num70 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 172, 0f, 0f, 100, default(Color), 1.5f); + int num70 = Dust.NewDust(npc.position, npc.width, npc.height, 172, 0f, 0f, 100, default(Color), 1.5f); Dust dust = Main.dust[num70]; dust.velocity *= 3f; Main.dust[num70].noGravity = true; } else if (npc.type == NPCID.Necromancer || npc.type == NPCID.NecromancerArmored) { - int num71 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 0, default(Color), 1f); + int num71 = Dust.NewDust(npc.position, npc.width, npc.height, 173, 0f, 0f, 0, default(Color), 1f); Dust dust = Main.dust[num71]; dust.velocity *= 2f; Main.dust[num71].scale = 1.4f; } else if (npc.type == NPCID.DiabolistRed || npc.type == NPCID.DiabolistWhite) { - int num72 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 174, 0f, 0f, 100, default(Color), 1.5f); + int num72 = Dust.NewDust(npc.position, npc.width, npc.height, 174, 0f, 0f, 100, default(Color), 1.5f); Dust dust = Main.dust[num72]; dust.velocity *= 3f; Main.dust[num72].noGravity = true; } else if (npc.type == NPCID.RaggedCaster || npc.type == NPCID.RaggedCasterOpenCoat) { - int num73 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 175, 0f, 0f, 100, default(Color), 1.5f); + int num73 = Dust.NewDust(npc.position, npc.width, npc.height, 175, 0f, 0f, 100, default(Color), 1.5f); Dust dust = Main.dust[num73]; dust.velocity *= 3f; Main.dust[num73].noGravity = true; } else if (npc.type == NPCID.RuneWizard) { - int num74 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 106, 0f, 0f, 100, default(Color), 2.5f); + int num74 = Dust.NewDust(npc.position, npc.width, npc.height, 106, 0f, 0f, 100, default(Color), 2.5f); Dust dust = Main.dust[num74]; dust.velocity *= 3f; Main.dust[num74].noGravity = true; @@ -20904,7 +21123,7 @@ namespace CalamityMod.NPCs } else { - int num76 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 6, 0f, 0f, 100, default(Color), 2.5f); + int num76 = Dust.NewDust(npc.position, npc.width, npc.height, 6, 0f, 0f, 100, default(Color), 2.5f); Dust dust = Main.dust[num76]; dust.velocity *= 3f; Main.dust[num76].noGravity = true; @@ -20922,7 +21141,7 @@ namespace CalamityMod.NPCs { if (npc.type == NPCID.GoblinSorcerer || npc.type == NPCID.Tim) { - int num78 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 27, 0f, 0f, 100, default(Color), (float)Main.rand.Next(1, 3)); + int num78 = Dust.NewDust(npc.position, npc.width, npc.height, 27, 0f, 0f, 100, default(Color), (float)Main.rand.Next(1, 3)); Dust dust = Main.dust[num78]; dust.velocity *= 3f; if (Main.dust[num78].scale > 1f) @@ -20932,35 +21151,35 @@ namespace CalamityMod.NPCs } else if (npc.type == NPCID.DarkCaster) { - int num79 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 172, 0f, 0f, 100, default(Color), 1.5f); + int num79 = Dust.NewDust(npc.position, npc.width, npc.height, 172, 0f, 0f, 100, default(Color), 1.5f); Dust dust = Main.dust[num79]; dust.velocity *= 3f; Main.dust[num79].noGravity = true; } else if (npc.type == NPCID.RuneWizard) { - int num80 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 106, 0f, 0f, 100, default(Color), 2.5f); + int num80 = Dust.NewDust(npc.position, npc.width, npc.height, 106, 0f, 0f, 100, default(Color), 2.5f); Dust dust = Main.dust[num80]; dust.velocity *= 3f; Main.dust[num80].noGravity = true; } else if (npc.type == NPCID.Necromancer || npc.type == NPCID.NecromancerArmored) { - int num81 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 0, default(Color), 1f); + int num81 = Dust.NewDust(npc.position, npc.width, npc.height, 173, 0f, 0f, 0, default(Color), 1f); Dust dust = Main.dust[num81]; dust.velocity *= 2f; Main.dust[num81].scale = 1.4f; } else if (npc.type == NPCID.DiabolistRed || npc.type == NPCID.DiabolistWhite) { - int num82 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 174, 0f, 0f, 100, default(Color), 1.5f); + int num82 = Dust.NewDust(npc.position, npc.width, npc.height, 174, 0f, 0f, 100, default(Color), 1.5f); Dust dust = Main.dust[num82]; dust.velocity *= 3f; Main.dust[num82].noGravity = true; } else if (npc.type == NPCID.RaggedCaster || npc.type == NPCID.RaggedCasterOpenCoat) { - int num83 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 175, 0f, 0f, 100, default(Color), 1.5f); + int num83 = Dust.NewDust(npc.position, npc.width, npc.height, 175, 0f, 0f, 100, default(Color), 1.5f); Dust dust = Main.dust[num83]; dust.velocity *= 3f; Main.dust[num83].noGravity = true; @@ -20974,7 +21193,7 @@ namespace CalamityMod.NPCs } else { - int num85 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 6, 0f, 0f, 100, default(Color), 2.5f); + int num85 = Dust.NewDust(npc.position, npc.width, npc.height, 6, 0f, 0f, 100, default(Color), 2.5f); Dust dust = Main.dust[num85]; dust.velocity *= 3f; Main.dust[num85].noGravity = true; @@ -21159,21 +21378,21 @@ namespace CalamityMod.NPCs num105 = num102 / num105; num103 *= num105; num104 *= num105; - int num106 = 16; - int num107 = 290; + int damage = 16; + int projType = ProjectileID.ShadowBeamHostile; if (npc.type == NPCID.DiabolistRed || npc.type == NPCID.DiabolistWhite) { - num107 = 291; - num106 = 32; + projType = ProjectileID.InfernoHostileBolt; + damage = 32; } if (npc.type == NPCID.RaggedCaster || npc.type == NPCID.RaggedCasterOpenCoat) { - num107 = 293; - num106 = 32; + projType = ProjectileID.LostSoulHostile; + damage = 32; } - int num108 = Projectile.NewProjectile(vector13.X, vector13.Y, num103, num104, num107, num106, 0f, Main.myPlayer, 0f, 0f); + int num108 = Projectile.NewProjectile(vector13.X, vector13.Y, num103, num104, projType, damage, 0f, Main.myPlayer, 0f, 0f); Main.projectile[num108].timeLeft = 300; - if (num107 == 291) + if (projType == ProjectileID.InfernoHostileBolt) { Main.projectile[num108].ai[0] = Main.player[npc.target].Center.X; Main.projectile[num108].ai[1] = Main.player[npc.target].Center.Y; @@ -21524,12 +21743,12 @@ namespace CalamityMod.NPCs { if (npc.type == NPCID.Hellbat || npc.type == NPCID.Lavabat) { - int num203 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 6, npc.velocity.X * 0.2f, npc.velocity.Y * 0.2f, 100, default(Color), 2f); + int num203 = Dust.NewDust(npc.position, npc.width, npc.height, 6, npc.velocity.X * 0.2f, npc.velocity.Y * 0.2f, 100, default(Color), 2f); Main.dust[num203].noGravity = true; } if (npc.type == NPCID.IceBat && Main.rand.Next(10) == 0) { - int num204 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 67, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default(Color), 1.5f); + int num204 = Dust.NewDust(npc.position, npc.width, npc.height, 67, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default(Color), 1.5f); Main.dust[num204].noGravity = true; Dust dust = Main.dust[num204]; dust.velocity *= 0.2f; @@ -21631,7 +21850,8 @@ namespace CalamityMod.NPCs npc.type == NPCID.IlluminantBat || npc.type == NPCID.IceBat || npc.type == NPCID.Lavabat || - npc.type == NPCID.GiantFlyingFox) + npc.type == NPCID.GiantFlyingFox || + npc.type == ModContent.NPCType()) { maxSpeedX = 6f; maxSpeedY = 2.5f; @@ -22279,132 +22499,149 @@ namespace CalamityMod.NPCs } #endregion - #region Antlion AI - public static bool BuffedAntlionAI(NPC npc, Mod mod) - { - npc.TargetClosest(true); + #region Antlion AI + public static bool BuffedAntlionAI(NPC npc, Mod mod) + { + npc.TargetClosest(true); - float num270 = 12f; - Vector2 vector32 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num271 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector32.X; - float num272 = Main.player[npc.target].position.Y - vector32.Y; - float num273 = (float)Math.Sqrt((double)(num271 * num271 + num272 * num272)); + //Calculate speed and velocity of the sand balls + float speed = 12f; + float xVel = Main.player[npc.target].Center.X - npc.Center.X; + float yVel = Main.player[npc.target].position.Y - npc.Center.Y; + Vector2 velocity = new Vector2(xVel, yVel); + float targetDist = velocity.Length(); - num273 = num270 / num273; - num271 *= num273; - num272 *= num273; + targetDist = speed / targetDist; + velocity.X *= targetDist; + velocity.Y *= targetDist; - bool flag17 = false; - if (npc.directionY < 0) - { - npc.rotation = (float)(Math.Atan2((double)num272, (double)num271) + MathHelper.PiOver2); - flag17 = ((double)npc.rotation >= -1.2 && (double)npc.rotation <= 1.2); - if ((double)npc.rotation < -0.8) - { - npc.rotation = -0.8f; - } - else if ((double)npc.rotation > 0.8) - { - npc.rotation = 0.8f; - } - if (npc.velocity.X != 0f) - { - npc.velocity.X = npc.velocity.X * 0.9f; - if ((double)npc.velocity.X > -0.1 || (double)npc.velocity.X < 0.1) - { - npc.netUpdate = true; - npc.velocity.X = 0f; - } - } - } + //Adjust rotation and velocity + bool canShoot = false; + if (npc.directionY < 0) + { + //Set rotation based on the target location + npc.rotation = velocity.ToRotation() + MathHelper.PiOver2; + //Antlions can only shoot if rotated between a certain cone of spread based on the target location + canShoot = Math.Abs(npc.rotation) <= 1.2f; - if (npc.ai[0] > 0f) - { - if (npc.ai[0] == 200f) - { - Main.PlaySound(SoundID.NPCDeath13, npc.position); - } - npc.ai[0] -= 1f; - } + //Hardcap rotation so it doesn't look weird, but since the above calculation happens first, it ignores this cap + if (npc.rotation < -0.8f) + { + npc.rotation = -0.8f; + } + else if (npc.rotation > 0.8f) + { + npc.rotation = 0.8f; + } - if (Main.netMode != NetmodeID.MultiplayerClient && flag17 && npc.ai[0] == 0f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - npc.ai[0] = 200f; - int num274 = 10; - int num275 = 31; + //Antlions generally don't move horizontally so prevent that as needed + if (npc.velocity.X != 0f) + { + npc.velocity.X *= 0.9f; + if (Math.Abs(npc.velocity.X) < 0.1f) + { + npc.netUpdate = true; + npc.velocity.X = 0f; + } + } + } - int projAmt = Main.rand.Next(8, 14); - if (Main.rand.NextBool(1000)) - projAmt = Main.rand.Next(80, 131); + //Decrement the firing cooldown, play a sound if at full meaning it just fired + if (npc.ai[0] > 0f) + { + if (npc.ai[0] == 200f) + { + Main.PlaySound(SoundID.NPCDeath13, npc.position); + } + npc.ai[0] -= 1f; + } - for (int i = 0; i < projAmt; i++) - { - num271 += (float)Main.rand.Next(-30, 31) * 0.05f; - num272 += (float)Main.rand.Next(-30, 31) * 0.05f; - int num276 = Projectile.NewProjectile(vector32.X, vector32.Y, num271, num272, num275, num274, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[num276].ai[0] = 2f; - Main.projectile[num276].timeLeft = 300; - Main.projectile[num276].friendly = false; - NetMessage.SendData(MessageID.SyncProjectile, -1, -1, null, num276, 0f, 0f, 0f, 0, 0, 0); - } - npc.netUpdate = true; - } + //Antlions should only fire if the target is in the shooting cone and has a line of sight as well as not being on cooldown. + bool lineofSight = Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); + if (Main.netMode != NetmodeID.MultiplayerClient && canShoot && npc.ai[0] == 0f && lineofSight) + { + //Reset the firing cooldown to 3.3333 seconds + npc.ai[0] = 200f; - try - { - int num277 = (int)npc.position.X / 16; - int num278 = (int)(npc.position.X + (float)(npc.width / 2)) / 16; - int num279 = (int)(npc.position.X + (float)npc.width) / 16; - int num280 = (int)(npc.position.Y + (float)npc.height) / 16; - bool flag18 = false; - if (Main.tile[num277, num280] == null) - { - Main.tile[num277, num280] = new Tile(); - } - if (Main.tile[num278, num280] == null) - { - Main.tile[num277, num280] = new Tile(); - } - if (Main.tile[num279, num280] == null) - { - Main.tile[num277, num280] = new Tile(); - } - if ((Main.tile[num277, num280].nactive() && Main.tileSolid[(int)Main.tile[num277, num280].type]) || (Main.tile[num278, num280].nactive() && Main.tileSolid[(int)Main.tile[num278, num280].type]) || (Main.tile[num279, num280].nactive() && Main.tileSolid[(int)Main.tile[num279, num280].type])) - { - flag18 = true; - } - if (flag18) - { - npc.noGravity = true; - npc.noTileCollide = true; - npc.velocity.Y = -0.2f; - } - else - { - npc.noGravity = false; - npc.noTileCollide = false; - if (Main.rand.Next(2) == 0) - { - int num281 = Dust.NewDust(new Vector2(npc.position.X - 4f, npc.position.Y + (float)npc.height - 8f), npc.width + 8, 24, 32, 0f, npc.velocity.Y / 2f, 0, default(Color), 1f); - Dust var_9_DC3B_cp_0_cp_0 = Main.dust[num281]; - var_9_DC3B_cp_0_cp_0.velocity.X = var_9_DC3B_cp_0_cp_0.velocity.X * 0.4f; - Dust var_9_DC5F_cp_0_cp_0 = Main.dust[num281]; - var_9_DC5F_cp_0_cp_0.velocity.Y = var_9_DC5F_cp_0_cp_0.velocity.Y * -1f; - if (Main.rand.Next(2) == 0) - { - Main.dust[num281].noGravity = true; - Dust dust = Main.dust[num281]; - dust.scale += 0.2f; - } - } - } - } - catch - { - } - return false; - } - #endregion + //With the Rev and Death damage calculations, this becomes 56 damage. + int damage = 10; + + int projType = ProjectileID.SandBallFalling; + int projAmt = Main.rand.Next(8, 14); + if (Main.rand.NextBool(1000)) + projAmt = Main.rand.Next(80, 131); + + for (int i = 0; i < projAmt; i++) + { + //Adjust the velocity to make it a shotgun-like spread + velocity.X += (float)Main.rand.Next(-30, 31) * 0.05f; + velocity.Y += (float)Main.rand.Next(-30, 31) * 0.05f; + + int sandBall = Projectile.NewProjectile(npc.Center, velocity, projType, damage, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[sandBall].ai[0] = 2f; + Main.projectile[sandBall].timeLeft = 300; + Main.projectile[sandBall].friendly = false; + NetMessage.SendData(MessageID.SyncProjectile, -1, -1, null, sandBall, 0f, 0f, 0f, 0, 0, 0); + } + npc.netUpdate = true; + } + + try + { + //This tile checking behavior is used for when Antlions cover themselves in sand and need to rise upward to get to the surface + int xLeft = (int)npc.position.X / 16; + int xCenter = (int)npc.Center.X / 16; + int xRight = (int)(npc.position.X + (float)npc.width) / 16; + int y = (int)(npc.position.Y + (float)npc.height) / 16; + bool tileClimbing = false; + if (Main.tile[xLeft, y] is null) + { + Main.tile[xLeft, y] = new Tile(); + } + if (Main.tile[xCenter, y] is null) + { + Main.tile[xLeft, y] = new Tile(); + } + if (Main.tile[xRight, y] is null) + { + Main.tile[xLeft, y] = new Tile(); + } + if ((Main.tile[xLeft, y].nactive() && Main.tileSolid[(int)Main.tile[xLeft, y].type]) || (Main.tile[xCenter, y].nactive() && Main.tileSolid[(int)Main.tile[xCenter, y].type]) || (Main.tile[xRight, y].nactive() && Main.tileSolid[(int)Main.tile[xRight, y].type])) + { + tileClimbing = true; + } + if (tileClimbing) + { + npc.noGravity = true; + npc.noTileCollide = true; + npc.velocity.Y = -0.2f; + } + + //If not rising up through tiles, occasionally spawn some dust + else + { + npc.noGravity = false; + npc.noTileCollide = false; + if (Main.rand.NextBool(2)) + { + int sand = Dust.NewDust(new Vector2(npc.position.X - 4f, npc.position.Y + (float)npc.height - 8f), npc.width + 8, 24, 32, 0f, npc.velocity.Y / 2f, 0, default(Color), 1f); + Dust dust = Main.dust[sand]; + dust.velocity.X *= 0.4f; + dust.velocity.Y *= -1f; + if (Main.rand.NextBool(2)) + { + dust.noGravity = true; + dust.scale += 0.2f; + } + } + } + } + catch + { + } + return false; + } + #endregion #region Spike Ball AI public static bool BuffedSpikeBallAI(NPC npc, Mod mod) @@ -22548,10 +22785,11 @@ namespace CalamityMod.NPCs npc.localAI[0] = 0f; for (int num1501 = 0; num1501 < 4; num1501++) { - Vector2 vector255 = new Vector2(0f, -5f).RotatedBy((double)(MathHelper.PiOver2 * (float)num1501), default); + Vector2 vector255 = new Vector2(0f, -5f).RotatedBy((double)(MathHelper.PiOver2 * (float)num1501)); int proj = Projectile.NewProjectile(npc.Center.X, npc.Center.Y, vector255.X, vector255.Y, ProjectileID.FlamesTrap, 20, 0f, Main.myPlayer, 0f, 0f); Main.projectile[proj].tileCollide = false; Main.projectile[proj].friendly = false; + Main.projectile[proj].trap = false; } } } @@ -22659,9 +22897,9 @@ namespace CalamityMod.NPCs if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[3] == 32f && !Main.player[npc.target].npcTypeNoAggro[npc.type]) { - int num295 = 25; - int num296 = 84; - int num297 = Projectile.NewProjectile(vector33.X, vector33.Y, num292, num293, num296, num295, 0f, Main.myPlayer, 0f, 0f); + int damage = 25; + int projType = ProjectileID.PinkLaser; + int num297 = Projectile.NewProjectile(vector33.X, vector33.Y, num292, num293, projType, damage, 0f, Main.myPlayer, 0f, 0f); } num290 = 12; @@ -22748,9 +22986,9 @@ namespace CalamityMod.NPCs if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[3] == 16f) { - int num304 = 45; - int num305 = 128; - int num306 = Projectile.NewProjectile(vector34.X, vector34.Y, num301, num302, num305, num304, 0f, Main.myPlayer, 0f, 0f); + int dmg = 45; + int projType = ProjectileID.FrostBlastHostile; + int num306 = Projectile.NewProjectile(vector34.X, vector34.Y, num301, num302, projType, dmg, 0f, Main.myPlayer, 0f, 0f); } num290 = 15; @@ -22805,9 +23043,9 @@ namespace CalamityMod.NPCs num311 = num307 / num311; num308 *= num311; num310 *= num311; - int num312 = 40; - int num313 = 288; - int num314 = Projectile.NewProjectile(vector35.X, vector35.Y, num308, num310, num313, num312, 0f, Main.myPlayer, 0f, 0f); + int dmg = 40; + int projType = ProjectileID.GoldenShowerHostile; + int num314 = Projectile.NewProjectile(vector35.X, vector35.Y, num308, num310, projType, dmg, 0f, Main.myPlayer, 0f, 0f); } } } @@ -23321,22 +23559,22 @@ namespace CalamityMod.NPCs { if (i != npc.whoAmI && Main.npc[i].active && Main.npc[i].type == npc.type && Math.Abs(npc.position.X - Main.npc[i].position.X) + Math.Abs(npc.position.Y - Main.npc[i].position.Y) < (float)npc.width) { - if (npc.position.X < Main.npc[i].position.X) - { - npc.velocity.X = npc.velocity.X - 0.05f; - } - else - { - npc.velocity.X = npc.velocity.X + 0.05f; - } - if (npc.position.Y < Main.npc[i].position.Y) - { - npc.velocity.Y = npc.velocity.Y - 0.05f; - } - else - { - npc.velocity.Y = npc.velocity.Y + 0.05f; - } + if (npc.position.X < Main.npc[i].position.X) + { + npc.velocity.X -= 0.05f; + } + else + { + npc.velocity.X += 0.05f; + } + if (npc.position.Y < Main.npc[i].position.Y) + { + npc.velocity.Y -= 0.05f; + } + else + { + npc.velocity.Y += 0.05f; + } } } if (flag4) @@ -23472,16 +23710,16 @@ namespace CalamityMod.NPCs } } } - else if (npc.type == NPCID.Wolf || npc.type == NPCID.Hellhound) + else if (npc.type == NPCID.Wolf || npc.type == NPCID.Hellhound || npc.type == ModContent.NPCType()) { if (npc.velocity.Y == 0f && num4 < 100f && Math.Abs(npc.velocity.X) > 3f && ((npc.position.X + (float)(npc.width / 2) < Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) && npc.velocity.X > 0f) || (npc.position.X + (float)(npc.width / 2) > Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) && npc.velocity.X < 0f))) { - npc.velocity.Y = npc.velocity.Y - 6f; + npc.velocity.Y -= 6f; } } else if (npc.type == NPCID.Tumbleweed && npc.velocity.Y == 0f && Math.Abs(npc.velocity.X) > 3f && ((npc.Center.X < Main.player[npc.target].Center.X && npc.velocity.X > 0f) || (npc.Center.X > Main.player[npc.target].Center.X && npc.velocity.X < 0f))) { - npc.velocity.Y = npc.velocity.Y - 6f; + npc.velocity.Y -= 6f; Main.PlaySound(SoundID.NPCHit, npc.Center, 11); } @@ -23529,45 +23767,45 @@ namespace CalamityMod.NPCs float num7 = 0.1f; if (!flag && (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction < 0) || (npc.velocity.X >= 0f && npc.direction > 0))) { - if (npc.type == NPCID.Wolf) + if (npc.type == NPCID.Wolf || npc.type == ModContent.NPCType()) { if (npc.velocity.X > 0f && npc.direction < 0) { - npc.velocity.X = npc.velocity.X * 0.9f; + npc.velocity.X *= 0.9f; } if (npc.velocity.X < 0f && npc.direction > 0) { - npc.velocity.X = npc.velocity.X * 0.9f; + npc.velocity.X *= 0.9f; } } else if (npc.type == NPCID.Hellhound) { if (npc.velocity.X > 0f && npc.direction < 0) { - npc.velocity.X = npc.velocity.X * 0.8f; + npc.velocity.X *= 0.8f; } if (npc.velocity.X < 0f && npc.direction > 0) { - npc.velocity.X = npc.velocity.X * 0.8f; + npc.velocity.X *= 0.8f; } if (npc.direction > 0 && npc.velocity.X < 3f) { - npc.velocity.X = npc.velocity.X + 0.15f; + npc.velocity.X += 0.15f; } if (npc.direction < 0 && npc.velocity.X > -3f) { - npc.velocity.X = npc.velocity.X - 0.15f; + npc.velocity.X -= 0.15f; } } else if (npc.type == NPCID.HeadlessHorseman) { if (npc.velocity.X > 0f && npc.direction < 0) { - npc.velocity.X = npc.velocity.X * 0.9f; + npc.velocity.X *= 0.9f; } if (npc.velocity.X < 0f && npc.direction > 0) { - npc.velocity.X = npc.velocity.X * 0.9f; + npc.velocity.X *= 0.9f; } if (npc.velocity.X < -num6 || npc.velocity.X > num6) { @@ -23578,7 +23816,7 @@ namespace CalamityMod.NPCs } else if (npc.velocity.X < num6 && npc.direction == 1) { - npc.velocity.X = npc.velocity.X + 0.1f; + npc.velocity.X += 0.1f; if (npc.velocity.X > num6) { npc.velocity.X = num6; @@ -23586,7 +23824,7 @@ namespace CalamityMod.NPCs } else if (npc.velocity.X > -num6 && npc.direction == -1) { - npc.velocity.X = npc.velocity.X - 0.1f; + npc.velocity.X -= 0.1f; if (npc.velocity.X < -num6) { npc.velocity.X = -num6; @@ -23597,7 +23835,7 @@ namespace CalamityMod.NPCs { if (Math.Sign(npc.velocity.X) != npc.direction) { - npc.velocity.X = npc.velocity.X * 0.8f; + npc.velocity.X *= 0.8f; } num7 = 0.2f; } @@ -23605,7 +23843,7 @@ namespace CalamityMod.NPCs { if (Math.Sign(npc.velocity.X) != npc.direction) { - npc.velocity.X = npc.velocity.X * 0.8f; + npc.velocity.X *= 0.8f; } num6 = 12f; num7 = 0.2f; @@ -23614,7 +23852,7 @@ namespace CalamityMod.NPCs { if (Math.Sign(npc.velocity.X) != npc.direction) { - npc.velocity.X = npc.velocity.X * 0.9f; + npc.velocity.X *= 0.9f; } float num8 = MathHelper.Lerp(0.6f, 1f, Math.Abs(Main.windSpeedSet)) * (float)Math.Sign(Main.windSpeedSet); if (!Main.player[npc.target].ZoneSandstorm) @@ -23883,7 +24121,7 @@ namespace CalamityMod.NPCs if (npc.type == NPCID.IceTortoise && Main.rand.Next(10) == 0) { - int num537 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 67, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default(Color), 1.5f); + int num537 = Dust.NewDust(npc.position, npc.width, npc.height, 67, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default(Color), 1.5f); Main.dust[num537].noGravity = true; Dust dust = Main.dust[num537]; dust.velocity *= 0.2f; @@ -24111,7 +24349,7 @@ namespace CalamityMod.NPCs { if (npc.type == NPCID.IceTortoise && Main.rand.Next(3) < 2) { - int num549 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 67, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default(Color), 1.5f); + int num549 = Dust.NewDust(npc.position, npc.width, npc.height, 67, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default(Color), 1.5f); Main.dust[num549].noGravity = true; Dust dust = Main.dust[num549]; dust.velocity *= 0.2f; @@ -24392,239 +24630,243 @@ namespace CalamityMod.NPCs } #endregion - #region Spider AI - public static bool BuffedSpiderAI(NPC npc, Mod mod) - { - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead) - { - npc.TargetClosest(true); - } - float num567 = 3f; - float num568 = 0.12f; - if (npc.type == NPCID.DesertScorpionWall) - { - num567 = 6f; - num568 = 0.24f; - } - Vector2 vector70 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num569 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num570 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); - num569 = (float)((int)(num569 / 8f) * 8); - num570 = (float)((int)(num570 / 8f) * 8); - vector70.X = (float)((int)(vector70.X / 8f) * 8); - vector70.Y = (float)((int)(vector70.Y / 8f) * 8); - num569 -= vector70.X; - num570 -= vector70.Y; - float num571 = (float)Math.Sqrt((double)(num569 * num569 + num570 * num570)); - if (num571 == 0f) - { - num569 = npc.velocity.X; - num570 = npc.velocity.Y; - } - else - { - num571 = num567 / num571; - num569 *= num571; - num570 *= num571; - } - if (Main.player[npc.target].dead) - { - num569 = (float)npc.direction * num567 / 2f; - num570 = -num567 / 2f; - } - npc.spriteDirection = -1; - if (!Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - npc.ai[0] += 1f; - if (npc.ai[0] > 0f) - { - npc.velocity.Y = npc.velocity.Y + 0.023f; - } - else - { - npc.velocity.Y = npc.velocity.Y - 0.023f; - } - if (npc.ai[0] < -100f || npc.ai[0] > 100f) - { - npc.velocity.X = npc.velocity.X + 0.023f; - } - else - { - npc.velocity.X = npc.velocity.X - 0.023f; - } - if (npc.ai[0] > 200f) - { - npc.ai[0] = -200f; - } - npc.velocity.X = npc.velocity.X + num569 * 0.009f; - npc.velocity.Y = npc.velocity.Y + num570 * 0.009f; - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); - if ((double)npc.velocity.X > 2.5) - { - npc.velocity.X = npc.velocity.X * 0.9f; - } - if ((double)npc.velocity.X < -2.5) - { - npc.velocity.X = npc.velocity.X * 0.9f; - } - if ((double)npc.velocity.Y > 2.5) - { - npc.velocity.Y = npc.velocity.Y * 0.9f; - } - if ((double)npc.velocity.Y < -2.5) - { - npc.velocity.Y = npc.velocity.Y * 0.9f; - } - if (npc.velocity.X > 4f) - { - npc.velocity.X = 4f; - } - if (npc.velocity.X < -4f) - { - npc.velocity.X = -4f; - } - if (npc.velocity.Y > 4f) - { - npc.velocity.Y = 4f; - } - if (npc.velocity.Y < -4f) - { - npc.velocity.Y = -4f; - } - } - else - { - if (npc.velocity.X < num569) - { - npc.velocity.X = npc.velocity.X + num568; - if (npc.velocity.X < 0f && num569 > 0f) - { - npc.velocity.X = npc.velocity.X + num568; - } - } - else if (npc.velocity.X > num569) - { - npc.velocity.X = npc.velocity.X - num568; - if (npc.velocity.X > 0f && num569 < 0f) - { - npc.velocity.X = npc.velocity.X - num568; - } - } - if (npc.velocity.Y < num570) - { - npc.velocity.Y = npc.velocity.Y + num568; - if (npc.velocity.Y < 0f && num570 > 0f) - { - npc.velocity.Y = npc.velocity.Y + num568; - } - } - else if (npc.velocity.Y > num570) - { - npc.velocity.Y = npc.velocity.Y - num568; - if (npc.velocity.Y > 0f && num570 < 0f) - { - npc.velocity.Y = npc.velocity.Y - num568; - } - } - npc.rotation = (float)Math.Atan2((double)num570, (double)num569); - } - if (npc.type == NPCID.DesertScorpionWall) - { - npc.rotation += MathHelper.PiOver2; - } - float num572 = 0.5f; - if (npc.collideX) - { - npc.netUpdate = true; - npc.velocity.X = npc.oldVelocity.X * -num572; - if (npc.direction == -1 && npc.velocity.X > 0f && npc.velocity.X < 2f) - { - npc.velocity.X = 2f; - } - if (npc.direction == 1 && npc.velocity.X < 0f && npc.velocity.X > -2f) - { - npc.velocity.X = -2f; - } - } - if (npc.collideY) - { - npc.netUpdate = true; - npc.velocity.Y = npc.oldVelocity.Y * -num572; - if (npc.velocity.Y > 0f && (double)npc.velocity.Y < 1.5) - { - npc.velocity.Y = 2f; - } - if (npc.velocity.Y < 0f && (double)npc.velocity.Y > -1.5) - { - npc.velocity.Y = -2f; - } - } - if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) - { - npc.netUpdate = true; - } - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (Main.netMode != NetmodeID.MultiplayerClient && npc.target >= 0 && (npc.type == NPCID.BlackRecluse || npc.type == NPCID.BlackRecluseWall) && Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) - { - npc.localAI[0] += 1f; - if (npc.localAI[0] > (float)Main.rand.Next(180, 600)) - { - npc.localAI[0] = 0f; - Vector2 vector71 = Main.player[npc.target].Center - npc.Center; - vector71.Normalize(); - vector71 *= 8f; - int num573 = Projectile.NewProjectile(npc.Center.X, npc.Center.Y, vector71.X, vector71.Y, ProjectileID.WebSpit, 18, 0f, Main.myPlayer, 0f, 0f); - } - } - int num574 = (int)npc.Center.X / 16; - int num575 = (int)npc.Center.Y / 16; - bool flag36 = false; - int num; - for (int num576 = num574 - 1; num576 <= num574 + 1; num576 = num + 1) - { - for (int num577 = num575 - 1; num577 <= num575 + 1; num577 = num + 1) - { - if (Main.tile[num576, num577] == null) - { - return false; - } - if (Main.tile[num576, num577].wall > 0) - { - flag36 = true; - } - num = num577; - } - num = num576; - } - if (!flag36) - { - if (npc.type == NPCID.JungleCreeperWall) - { - npc.Transform(NPCID.JungleCreeper); - return false; - } - if (npc.type == NPCID.BlackRecluseWall) - { - npc.Transform(NPCID.BlackRecluse); - return false; - } - if (npc.type == NPCID.BloodCrawlerWall) - { - npc.Transform(NPCID.BloodCrawler); - return false; - } - if (npc.type == NPCID.DesertScorpionWall) - { - npc.Transform(NPCID.DesertScorpionWalk); - return false; - } - npc.Transform(NPCID.WallCreeper); - } - } - return false; - } - #endregion + #region Spider AI + public static bool BuffedSpiderAI(NPC npc, Mod mod) + { + //Find a target + if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead) + { + npc.TargetClosest(true); + } + + float speed = 3f; + float mvtAdjust = 0.12f; + if (npc.type == NPCID.DesertScorpionWall) + { + speed = 6f; + mvtAdjust = 0.24f; + } + + //Calculate how to reach the target + Vector2 npcPos = npc.Center; + Vector2 targetPos = Main.player[npc.target].Center; + targetPos.X = (float)((int)(targetPos.X / 8f) * 8); + targetPos.Y = (float)((int)(targetPos.Y / 8f) * 8); + npcPos.X = (float)((int)(npcPos.X / 8f) * 8); + npcPos.Y = (float)((int)(npcPos.Y / 8f) * 8); + targetPos.X -= npcPos.X; + targetPos.Y -= npcPos.Y; + float targetDist = targetPos.Length(); + if (targetDist == 0f) + { + targetPos.X = npc.velocity.X; + targetPos.Y = npc.velocity.Y; + } + else + { + targetDist = speed / targetDist; + targetPos.X *= targetDist; + targetPos.Y *= targetDist; + } + + //If the target is dead, nobody cares + if (Main.player[npc.target].dead) + { + targetPos.X = (float)npc.direction * speed / 2f; + targetPos.Y = -speed / 2f; + } + + //Sprite direction + npc.spriteDirection = -1; + + //If you can't see the target, wander around + if (!Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + npc.ai[0] += 1f; + if (npc.ai[0] > 0f) + { + npc.velocity.Y += 0.023f; + } + else + { + npc.velocity.Y -= 0.023f; + } + if (npc.ai[0] < -100f || npc.ai[0] > 100f) + { + npc.velocity.X += 0.023f; + } + else + { + npc.velocity.X -= 0.023f; + } + if (npc.ai[0] > 200f) + { + npc.ai[0] = -200f; + } + npc.velocity.X += targetPos.X * 0.009f; + npc.velocity.Y += targetPos.Y * 0.009f; + npc.rotation = npc.velocity.ToRotation(); + if (npc.velocity.X > 2.5f) + { + npc.velocity.X *= 0.9f; + } + if (npc.velocity.X < -2.5f) + { + npc.velocity.X *= 0.9f; + } + if (npc.velocity.Y > 2.5f) + { + npc.velocity.Y *= 0.9f; + } + if (npc.velocity.Y < -2.5f) + { + npc.velocity.Y *= 0.9f; + } + npc.velocity.X = MathHelper.Clamp(npc.velocity.X, -4f, 4f); + npc.velocity.Y = MathHelper.Clamp(npc.velocity.Y, -4f, 4f); + } + //If target is in sight, move toward target + else + { + if (npc.velocity.X < targetPos.X) + { + npc.velocity.X += mvtAdjust; + if (npc.velocity.X < 0f && targetPos.X > 0f) + { + npc.velocity.X += mvtAdjust; + } + } + else if (npc.velocity.X > targetPos.X) + { + npc.velocity.X -= mvtAdjust; + if (npc.velocity.X > 0f && targetPos.X < 0f) + { + npc.velocity.X -= mvtAdjust; + } + } + if (npc.velocity.Y < targetPos.Y) + { + npc.velocity.Y += mvtAdjust; + if (npc.velocity.Y < 0f && targetPos.Y > 0f) + { + npc.velocity.Y += mvtAdjust; + } + } + else if (npc.velocity.Y > targetPos.Y) + { + npc.velocity.Y -= mvtAdjust; + if (npc.velocity.Y > 0f && targetPos.Y < 0f) + { + npc.velocity.Y -= mvtAdjust; + } + } + npc.rotation = targetPos.ToRotation(); + } + + //Desert Scorpion has a different sprite orientation + if (npc.type == NPCID.DesertScorpionWall) + { + npc.rotation += MathHelper.PiOver2; + } + + //Wall collision behavior? + float half = 0.5f; + if (npc.collideX) + { + npc.netUpdate = true; + npc.velocity.X = npc.oldVelocity.X * -half; + if (npc.direction == -1 && npc.velocity.X > 0f && npc.velocity.X < 2f) + { + npc.velocity.X = 2f; + } + if (npc.direction == 1 && npc.velocity.X < 0f && npc.velocity.X > -2f) + { + npc.velocity.X = -2f; + } + } + if (npc.collideY) + { + npc.netUpdate = true; + npc.velocity.Y = npc.oldVelocity.Y * -half; + if (npc.velocity.Y > 0f && npc.velocity.Y < 1.5f) + { + npc.velocity.Y = 2f; + } + if (npc.velocity.Y < 0f && npc.velocity.Y > -1.5f) + { + npc.velocity.Y = -2f; + } + } + + //Net update for changing directions + if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) + { + npc.netUpdate = true; + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + //Black Recluses shoot Web Spit + if (Main.netMode != NetmodeID.MultiplayerClient && npc.target >= 0 && (npc.type == NPCID.BlackRecluse || npc.type == NPCID.BlackRecluseWall) && Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) + { + npc.localAI[0] += 1f; + if (npc.localAI[0] > (float)Main.rand.Next(180, 600)) + { + npc.localAI[0] = 0f; + Vector2 velocity = Main.player[npc.target].Center - npc.Center; + velocity.Normalize(); + velocity *= 8f; + Projectile.NewProjectile(npc.Center, velocity, ProjectileID.WebSpit, 18, 0f, Main.myPlayer, 0f, 0f); + } + } + + //Check for walls + int npcX = (int)npc.Center.X / 16; + int npcY = (int)npc.Center.Y / 16; + bool climbingWall = false; + for (int i = npcX - 1; i <= npcX + 1; i++) + { + for (int j = npcY - 1; j <= npcY + 1; j++) + { + if (Main.tile[i, j] is null) + { + return false; + } + if (Main.tile[i, j].wall > 0) + { + climbingWall = true; + } + } + } + //If not on a wall, transform to fighter form + if (!climbingWall) + { + if (npc.type == NPCID.JungleCreeperWall) + { + npc.Transform(NPCID.JungleCreeper); + return false; + } + if (npc.type == NPCID.BlackRecluseWall) + { + npc.Transform(NPCID.BlackRecluse); + return false; + } + if (npc.type == NPCID.BloodCrawlerWall) + { + npc.Transform(NPCID.BloodCrawler); + return false; + } + if (npc.type == NPCID.DesertScorpionWall) + { + npc.Transform(NPCID.DesertScorpionWalk); + return false; + } + npc.Transform(NPCID.WallCreeper); + } + } + return false; + } + #endregion #region Herpling AI public static bool BuffedHerplingAI(NPC npc, Mod mod) @@ -25174,7 +25416,7 @@ namespace CalamityMod.NPCs // Circular dust float angularRatio = npc.ai[1] / alphaFadeinTime; - Vector2 spinningpoint = new Vector2(0f, -30f).RotatedBy(angularRatio * 1.5f * MathHelper.TwoPi, default) * new Vector2(1f, 0.4f); + Vector2 spinningpoint = new Vector2(0f, -30f).RotatedBy(angularRatio * 1.5f * MathHelper.TwoPi) * new Vector2(1f, 0.4f); for (int i = 0; i < 4; i++) { @@ -25336,7 +25578,7 @@ namespace CalamityMod.NPCs rotationVector.X *= -1f; } - rotationVector = rotationVector.RotatedBy(npc.rotation, default); + rotationVector = rotationVector.RotatedBy(npc.rotation); Main.dust[idx].position = npc.Center + rotationVector; } @@ -25741,7 +25983,7 @@ namespace CalamityMod.NPCs npc.noGravity = true; npc.noTileCollide = false; npc.defense = npc.defDefense; - if (npc.justHit && Main.netMode != NetmodeID.MultiplayerClient && Main.rand.Next(10) == 0) + if (npc.justHit && Main.netMode != NetmodeID.MultiplayerClient && Main.rand.NextBool(10)) { npc.netUpdate = true; npc.ai[0] = -1f; @@ -25751,7 +25993,7 @@ namespace CalamityMod.NPCs { npc.defense = npc.defDefense + 10; npc.noGravity = false; - npc.velocity.X = npc.velocity.X * 0.98f; + npc.velocity.X *= 0.98f; npc.ai[1] += 1f; if (npc.ai[1] >= 120f) { diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index c7acc6cc8d..2a361ea638 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -17,7 +17,6 @@ using CalamityMod.Items.SummonItems; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; -using CalamityMod.Items.Weapons.Typeless; using CalamityMod.NPCs.Abyss; using CalamityMod.NPCs.AcidRain; using CalamityMod.NPCs.AquaticScourge; @@ -36,6 +35,7 @@ using CalamityMod.NPCs.DevourerofGods; using CalamityMod.NPCs.HiveMind; using CalamityMod.NPCs.Leviathan; using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.NPCs.OldDuke; using CalamityMod.NPCs.Perforator; using CalamityMod.NPCs.PlaguebringerGoliath; using CalamityMod.NPCs.Polterghast; @@ -49,6 +49,8 @@ using CalamityMod.NPCs.SulphurousSea; using CalamityMod.NPCs.SupremeCalamitas; using CalamityMod.NPCs.TownNPCs; using CalamityMod.NPCs.Yharon; +using CalamityMod.Projectiles.Boss; +using CalamityMod.Projectiles.DraedonsArsenal; using CalamityMod.Projectiles.Magic; using CalamityMod.Projectiles.Melee; using CalamityMod.Projectiles.Ranged; @@ -91,9 +93,6 @@ namespace CalamityMod.NPCs public Dictionary flatDRReductions = new Dictionary(); public Dictionary multDRReductions = new Dictionary(); - // Iron Heart (currently unimplemented) - // private int ironHeartDamage = 0; - // Max velocity used in contact damage scaling public float maxVelocity = 0f; @@ -147,8 +146,10 @@ namespace CalamityMod.NPCs public int clamDebuff = 0; public int sulphurPoison = 0; public int ladHearts = 0; + public int kamiFlu = 0; public int relicOfResilienceCooldown = 0; public int relicOfResilienceWeakness = 0; + public int GaussFluxTimer = 0; // whoAmI Variables public static int[] bobbitWormBottom = new int[5]; @@ -222,9 +223,9 @@ namespace CalamityMod.NPCs { NPCID.GolemFistLeft, 250000 }, { NPCID.GolemFistRight, 250000 }, - { NPCID.EaterofWorldsHead, 2500000 }, // 30 seconds - { NPCID.EaterofWorldsBody, 2500000 }, - { NPCID.EaterofWorldsTail, 2500000 }, + { NPCID.EaterofWorldsHead, 15000000 }, // 30 seconds + { NPCID.EaterofWorldsBody, 15000000 }, + { NPCID.EaterofWorldsTail, 15000000 }, // Tier 2 { NPCID.TheDestroyer, 2500000 }, // 30 seconds + immunity timer at start @@ -285,6 +286,13 @@ namespace CalamityMod.NPCs NPCType() }; + public static List CosmicGuardianIDs = new List + { + NPCType(), + NPCType(), + NPCType() + }; + public static List AquaticScourgeIDs = new List { NPCType(), @@ -354,6 +362,49 @@ namespace CalamityMod.NPCs ProjectileID.GiantBee //ProjectileID.ScarabBomb }; + + public static List ZeroContactDamageNPCList = new List + { + NPCID.DarkCaster, + NPCID.FireImp, + NPCID.Tim, + NPCID.CultistArcherBlue, + NPCID.DesertDjinn, + NPCID.DiabolistRed, + NPCID.DiabolistWhite, + NPCID.Gastropod, + NPCID.IceElemental, + NPCID.IchorSticker, + NPCID.Necromancer, + NPCID.NecromancerArmored, + NPCID.RaggedCaster, + NPCID.RaggedCasterOpenCoat, + NPCID.RuneWizard, + NPCID.SkeletonArcher, + NPCID.SkeletonCommando, + NPCID.SkeletonSniper, + NPCID.TacticalSkeleton, + NPCID.Clown, + NPCID.GoblinArcher, + NPCID.GoblinSorcerer, + NPCID.GoblinSummoner, + NPCID.PirateCrossbower, + NPCID.PirateDeadeye, + NPCID.PirateCaptain, + NPCID.DrManFly, + NPCID.MartianWalker, + NPCID.MartianTurret, + NPCID.ElfCopter, + NPCID.ElfArcher, + NPCID.NebulaBrain, + NPCID.StardustJellyfishBig, + NPCID.PirateShipCannon, + NPCID.MartianSaucer, + NPCID.MartianSaucerCannon, + NPCID.MartianSaucerCore, + NPCID.MartianSaucerTurret, + NPCID.Probe + }; #endregion #region Instance Per Entity @@ -420,6 +471,33 @@ namespace CalamityMod.NPCs ResetSavedIndex(ref SCalCatastrophe, NPCType()); ResetSavedIndex(ref SCal, NPCType()); ResetSavedIndex(ref SCalWorm, NPCType()); + + if (NPC.FindFirstNPC(NPCID.Guide) == -1) + CalamityWorld.guideName = false; + if (NPC.FindFirstNPC(NPCID.Wizard) == -1) + CalamityWorld.wizardName = false; + if (NPC.FindFirstNPC(NPCID.Steampunker) == -1) + CalamityWorld.steampunkerName = false; + if (NPC.FindFirstNPC(NPCID.Stylist) == -1) + CalamityWorld.stylistName = false; + if (NPC.FindFirstNPC(NPCID.WitchDoctor) == -1) + CalamityWorld.witchDoctorName = false; + if (NPC.FindFirstNPC(NPCID.TaxCollector) == -1) + CalamityWorld.taxCollectorName = false; + if (NPC.FindFirstNPC(NPCID.Pirate) == -1) + CalamityWorld.pirateName = false; + if (NPC.FindFirstNPC(NPCID.Mechanic) == -1) + CalamityWorld.mechanicName = false; + if (NPC.FindFirstNPC(NPCID.ArmsDealer) == -1) + CalamityWorld.armsDealerName = false; + if (NPC.FindFirstNPC(NPCID.Dryad) == -1) + CalamityWorld.dryadName = false; + if (NPC.FindFirstNPC(NPCID.Nurse) == -1) + CalamityWorld.nurseName = false; + if (NPC.FindFirstNPC(NPCID.Angler) == -1) + CalamityWorld.anglerName = false; + if (NPC.FindFirstNPC(NPCID.Clothier) == -1) + CalamityWorld.clothierName = false; } #endregion @@ -682,6 +760,7 @@ namespace CalamityMod.NPCs ApplyDPSDebuff(nightwither, 200, 40, ref npc.lifeRegen, ref damage); ApplyDPSDebuff(dFlames, 2500, 500, ref npc.lifeRegen, ref damage); ApplyDPSDebuff(bBlood, 50, 10, ref npc.lifeRegen, ref damage); + ApplyDPSDebuff(kamiFlu, 250, 25, ref npc.lifeRegen, ref damage); ApplyDPSDebuff(sulphurPoison, 180, 36, ref npc.lifeRegen, ref damage); if (npc.velocity.X == 0) ApplyDPSDebuff(electrified, 10, 2, ref npc.lifeRegen, ref damage); @@ -772,11 +851,6 @@ namespace CalamityMod.NPCs } OtherStatChanges(npc); - - if (CalamityWorld.ironHeart) - { - IronHeartChanges(npc); - } } #endregion @@ -795,7 +869,7 @@ namespace CalamityMod.NPCs npc.buffImmune[BuffID.Slow] = true; } - if (DestroyerIDs.Contains(npc.type) || npc.type == NPCID.DD2EterniaCrystal || npc.townNPC) + if (DestroyerIDs.Contains(npc.type) || (EaterofWorldsIDs.Contains(npc.type) && CalamityWorld.bossRushActive) || npc.type == NPCID.DD2EterniaCrystal || npc.townNPC) { for (int k = 0; k < npc.buffImmune.Length; k++) { @@ -816,6 +890,8 @@ namespace CalamityMod.NPCs npc.buffImmune[BuffType()] = false; } + if (YanmeisKnifeSlash.CanRecieveCoolEffectsFrom(npc)) + npc.buffImmune[BuffType()] = false; npc.buffImmune[BuffType()] = false; } #endregion @@ -1069,6 +1145,14 @@ namespace CalamityMod.NPCs npc.lifeMax = (int)(npc.lifeMax * 0.6); } + if (npc.type == NPCID.GreenJellyfish && !Main.hardMode) + { + npc.damage = 40; + npc.defDamage = npc.damage; + npc.defense = 4; + npc.defDefense = npc.defense; + } + if (Main.bloodMoon && NPC.downedMoonlord && !npc.boss && !npc.friendly && !npc.dontTakeDamage && npc.lifeMax <= 2000 && npc.damage > 0) { npc.lifeMax = (int)(npc.lifeMax * 3.5); @@ -1219,15 +1303,6 @@ namespace CalamityMod.NPCs } #endregion - // TODO -- Change Iron Heart damage in here for Iron Heart mode - #region Iron Heart Changes - private void IronHeartChanges(NPC npc) - { - // Iron Heart damage variable will scale with npc.damage - // ironHeartDamage = 0; - } - #endregion - #region Scale Expert Multiplayer Stats public override void ScaleExpertStats(NPC npc, int numPlayers, float bossLifeScale) { @@ -1407,51 +1482,17 @@ namespace CalamityMod.NPCs } #endregion - #region Modify Hit Player - public override void ModifyHitPlayer(NPC npc, Player target, ref int damage, ref bool crit) - { - CalamityPlayer modTarget = target.Calamity(); - if (tSad > 0) - { - damage /= 2; - } - - if (relicOfResilienceWeakness > 0) - { - damage = (int)(damage * (1f - RelicOfResilience.WeaknessDR)); - relicOfResilienceWeakness = 0; - } - - if (modTarget.beeResist) - { - if (CalamityMod.beeEnemyList.Contains(npc.type)) - { - damage = (int)(damage * 0.75); - } - } - - if (modTarget.eskimoSet) - { - if (npc.coldDamage) - { - damage = (int)(damage * 0.9); - } - } - } - #endregion - #region Strike NPC public override bool StrikeNPC(NPC npc, ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) { // Damage reduction on spawn - if (CalamityWorld.revenge || CalamityWorld.bossRushActive) + bool destroyerResist = DestroyerIDs.Contains(npc.type) && (CalamityWorld.revenge || CalamityWorld.bossRushActive); + bool eaterofWorldsResist = EaterofWorldsIDs.Contains(npc.type) && CalamityWorld.bossRushActive; + if (destroyerResist || eaterofWorldsResist || AstrumDeusIDs.Contains(npc.type)) { - if (DestroyerIDs.Contains(npc.type) || AstrumDeusIDs.Contains(npc.type)) + if (newAI[1] < 600f || (newAI[2] > 0f && DestroyerIDs.Contains(npc.type))) { - if (newAI[1] < 480f || (newAI[2] > 0f && DestroyerIDs.Contains(npc.type))) - { - damage *= 0.01; - } + damage *= 0.01; } } @@ -1576,6 +1617,8 @@ namespace CalamityMod.NPCs calcDR *= 0.66f; if (wCleave > 0) calcDR *= 0.75f; + if (npc.Calamity().kamiFlu > 0) + calcDR *= KamiDebuff.MultiplicativeDamageReduction; if (npc.onFire2) calcDR *= 0.8f; @@ -1680,10 +1723,12 @@ namespace CalamityMod.NPCs npc.dontTakeDamage = CalamityPlayer.areThereAnyDamnBosses; } + // Setting this in SetDefaults will disable expert mode scaling, so put it here instead + if (ZeroContactDamageNPCList.Contains(npc.type)) + npc.damage = 0; + if (DestroyerIDs.Contains(npc.type) || EaterofWorldsIDs.Contains(npc.type)) - { npc.buffImmune[BuffType()] = false; - } if (npc.type == NPCID.Bee || npc.type == NPCID.BeeSmall || npc.type == NPCID.Hornet || npc.type == NPCID.HornetFatty || npc.type == NPCID.HornetHoney || npc.type == NPCID.HornetLeafy || npc.type == NPCID.HornetSpikey || npc.type == NPCID.HornetStingy || npc.type == NPCID.BigHornetStingy || npc.type == NPCID.LittleHornetStingy || @@ -1698,9 +1743,7 @@ namespace CalamityMod.NPCs } if (CalamityWorld.bossRushActive && !npc.friendly && !npc.townNPC) - { BossRushForceDespawnOtherNPCs(npc, mod); - } if (CalamityWorld.revenge || CalamityWorld.bossRushActive) { @@ -1827,6 +1870,10 @@ namespace CalamityMod.NPCs break; } } + else if (npc.type == NPCID.Retinazer) + { + return CalamityGlobalAI.TrueMeleeRetinazerPhase2AI(npc); + } if (CalamityWorld.death) { @@ -1897,8 +1944,8 @@ namespace CalamityMod.NPCs } break; case 3: - if (npc.type == NPCType() || npc.type == NPCType() || - npc.type == NPCType()) + if (npc.type == NPCType() || + npc.type == NPCType() || npc.type == NPCType()) { return CalamityGlobalAI.BuffedFighterAI(npc, mod); } @@ -2174,7 +2221,7 @@ namespace CalamityMod.NPCs } break; case 14: - if (npc.type == NPCType()) + if (npc.type == NPCType() || npc.type == NPCType() || npc.type == NPCType() || npc.type == NPCType()) { return CalamityGlobalAI.BuffedBatAI(npc, mod); } @@ -2281,27 +2328,41 @@ namespace CalamityMod.NPCs } break; case 26: - switch (npc.type) + if (npc.type == NPCType()) { - case NPCID.Unicorn: - case NPCID.Wolf: - case NPCID.HeadlessHorseman: - case NPCID.Hellhound: - case NPCID.StardustSpiderSmall: - case NPCID.NebulaBeast: - case NPCID.Tumbleweed: - return CalamityGlobalAI.BuffedUnicornAI(npc, mod); + return CalamityGlobalAI.BuffedUnicornAI(npc, mod); + } + else + { + switch (npc.type) + { + case NPCID.Unicorn: + case NPCID.Wolf: + case NPCID.HeadlessHorseman: + case NPCID.Hellhound: + case NPCID.StardustSpiderSmall: + case NPCID.NebulaBeast: + case NPCID.Tumbleweed: + return CalamityGlobalAI.BuffedUnicornAI(npc, mod); + } } break; case 39: - switch (npc.type) + if (npc.type == NPCType() || npc.type == NPCType()) { - case NPCID.GiantTortoise: - case NPCID.IceTortoise: - case NPCID.GiantShelly: - case NPCID.GiantShelly2: - case NPCID.SolarSroller: - return CalamityGlobalAI.BuffedTortoiseAI(npc, mod); + return CalamityGlobalAI.BuffedTortoiseAI(npc, mod); + } + else + { + switch (npc.type) + { + case NPCID.GiantTortoise: + case NPCID.IceTortoise: + case NPCID.GiantShelly: + case NPCID.GiantShelly2: + case NPCID.SolarSroller: + return CalamityGlobalAI.BuffedTortoiseAI(npc, mod); + } } break; case 40: @@ -2316,11 +2377,18 @@ namespace CalamityMod.NPCs } break; case 41: - switch (npc.type) + if (npc.type == NPCType()) { - case NPCID.Herpling: - case NPCID.Derpling: - return CalamityGlobalAI.BuffedHerplingAI(npc, mod); + return CalamityGlobalAI.BuffedHerplingAI(npc, mod); + } + else + { + switch (npc.type) + { + case NPCID.Herpling: + case NPCID.Derpling: + return CalamityGlobalAI.BuffedHerplingAI(npc, mod); + } } break; case 44: @@ -2412,205 +2480,266 @@ namespace CalamityMod.NPCs switch (npc.type) { case NPCID.Guide: + if (CalamityWorld.guideName) + break; switch (Main.rand.Next(38)) // 34 guide names { case 0: npc.GivenName = "Lapp"; + CalamityWorld.guideName = true; break; case 1: npc.GivenName = "Ben Shapiro"; + CalamityWorld.guideName = true; break; case 2: npc.GivenName = "StreakistYT"; + CalamityWorld.guideName = true; break; case 3: npc.GivenName = "Neoplasmatic"; + CalamityWorld.guideName = true; break; default: + CalamityWorld.guideName = true; break; } break; case NPCID.Wizard: + if (CalamityWorld.wizardName) + break; switch (Main.rand.Next(26)) // 23 wizard names { case 0: npc.GivenName = "Mage One-Trick"; + CalamityWorld.wizardName = true; break; case 1: npc.GivenName = "Inorim, son of Ivukey"; + CalamityWorld.wizardName = true; break; case 2: npc.GivenName = "Jensen"; + CalamityWorld.wizardName = true; break; default: + CalamityWorld.wizardName = true; break; } break; case NPCID.Steampunker: + if (CalamityWorld.steampunkerName) + break; switch (Main.rand.Next(23)) // 21 steampunker names { case 0: npc.GivenName = "Vorbis"; + CalamityWorld.steampunkerName = true; break; case 1: npc.GivenName = "Angel"; + CalamityWorld.steampunkerName = true; break; default: + CalamityWorld.steampunkerName = true; break; } break; case NPCID.Stylist: + if (CalamityWorld.stylistName) + break; switch (Main.rand.Next(21)) // 20 stylist names { case 0: npc.GivenName = "Amber"; + CalamityWorld.stylistName = true; break; default: + CalamityWorld.stylistName = true; break; } break; case NPCID.WitchDoctor: + if (CalamityWorld.witchDoctorName) + break; switch (Main.rand.Next(11)) // 10 witch doctor names { case 0: npc.GivenName = "Sok'ar"; + CalamityWorld.witchDoctorName = true; break; default: + CalamityWorld.witchDoctorName = true; break; } break; case NPCID.TaxCollector: + if (CalamityWorld.taxCollectorName) + break; switch (Main.rand.Next(21)) // 20 tax collector names { case 0: npc.GivenName = "Emmett"; + CalamityWorld.taxCollectorName = true; break; default: + CalamityWorld.taxCollectorName = true; break; } break; case NPCID.Pirate: + if (CalamityWorld.pirateName) + break; switch (Main.rand.Next(12)) // 11 pirate names { case 0: npc.GivenName = "Tyler Van Hook"; + CalamityWorld.pirateName = true; break; default: + CalamityWorld.pirateName = true; break; } break; case NPCID.Mechanic: + if (CalamityWorld.mechanicName) + break; switch (Main.rand.Next(26)) // 24 mechanic names { case 0: npc.GivenName = "Lilly"; + CalamityWorld.mechanicName = true; break; case 1: npc.GivenName = "Daawn"; + CalamityWorld.mechanicName = true; break; default: + CalamityWorld.mechanicName = true; break; } break; case NPCID.ArmsDealer: + if (CalamityWorld.armsDealerName) + break; switch (Main.rand.Next(26)) // 24 arms dealer names { case 0: npc.GivenName = "Drifter"; + CalamityWorld.armsDealerName = true; break; case 1: npc.GivenName = "Finchi"; + CalamityWorld.armsDealerName = true; break; default: + CalamityWorld.armsDealerName = true; break; } break; case NPCID.Dryad: + if (CalamityWorld.dryadName) + break; switch (Main.rand.Next(23)) // 21 Dryad names { case 0: npc.GivenName = "Rythmi"; + CalamityWorld.dryadName = true; break; case 1: - npc.GivenName = "Izuna"; + npc.GivenName = "Izuna"; + CalamityWorld.dryadName = true; break; default: + CalamityWorld.dryadName = true; break; } break; case NPCID.Nurse: + if (CalamityWorld.nurseName) + break; switch (Main.rand.Next(25)) // 24 nurse names { case 0: npc.GivenName = "Farsni"; + CalamityWorld.nurseName = true; break; default: + CalamityWorld.nurseName = true; break; } break; case NPCID.Angler: + if (CalamityWorld.anglerName) + break; switch (Main.rand.Next(23)) // 22 angler names { case 0: npc.GivenName = "Dazren"; + CalamityWorld.anglerName = true; break; default: + CalamityWorld.anglerName = true; break; } break; case NPCID.Clothier: + if (CalamityWorld.clothierName) + break; switch (Main.rand.Next(26)) // 25 clothier names { case 0: npc.GivenName = "Joeseph Jostar"; + CalamityWorld.clothierName = true; break; default: + CalamityWorld.clothierName = true; break; } @@ -2972,7 +3101,7 @@ namespace CalamityMod.NPCs case 33: if (npc.type != NPCType() && npc.type != NPCType() && npc.type != NPCType() && npc.type != NPCType() && - npc.type != NPCType() && npc.type != NPCType()) + npc.type != NPCType() && npc.type != NPCID.DetonatingBubble) { npc.active = false; npc.netUpdate = true; @@ -2980,7 +3109,17 @@ namespace CalamityMod.NPCs break; - case 34: + case 34: + if (npc.type != NPCType() && npc.type != NPCType() && + npc.type != NPCType()) + { + npc.active = false; + npc.netUpdate = true; + } + + break; + + case 35: if (npc.type != NPCType() && npc.type != NPCType() && npc.type != NPCType() && npc.type != NPCType() && npc.type != NPCType() && npc.type != NPCType() && @@ -2993,7 +3132,7 @@ namespace CalamityMod.NPCs break; - case 35: + case 36: if (npc.type != NPCType() && npc.type != NPCType() && npc.type != NPCType() && npc.type != NPCType()) { @@ -3003,7 +3142,7 @@ namespace CalamityMod.NPCs break; - case 36: + case 37: if (npc.type != NPCType() && npc.type != NPCType() && npc.type != NPCType() && npc.type != NPCType() && npc.type != NPCType() && npc.type != NPCType() && @@ -3016,7 +3155,7 @@ namespace CalamityMod.NPCs break; - case 37: + case 38: if (npc.type != NPCType() && npc.type != NPCType() && npc.type != NPCType()) { @@ -3026,7 +3165,7 @@ namespace CalamityMod.NPCs break; - case 38: + case 39: if (npc.type != NPCType() && npc.type != NPCType() && npc.type != NPCType()) { @@ -3142,10 +3281,14 @@ namespace CalamityMod.NPCs clamDebuff--; if (sulphurPoison > 0) sulphurPoison--; + if (kamiFlu > 0) + kamiFlu--; if (relicOfResilienceCooldown > 0) relicOfResilienceCooldown--; if (relicOfResilienceWeakness > 0) relicOfResilienceWeakness--; + if (GaussFluxTimer > 0) + GaussFluxTimer--; if (ladHearts > 0) ladHearts--; @@ -3153,6 +3296,11 @@ namespace CalamityMod.NPCs if (npc.boss || CalamityMod.movementImpairImmuneList.Contains(npc.type)) return; + if (kamiFlu > 0) + { + npc.velocity = Vector2.Clamp(npc.velocity, new Vector2(-KamiDebuff.MaxNPCSpeed), new Vector2(KamiDebuff.MaxNPCSpeed)); + } + if (!CalamityPlayer.areThereAnyDamnBosses) { if (pearlAura > 0) @@ -3523,7 +3671,7 @@ namespace CalamityMod.NPCs if (modPlayer.nucleogenesis) { - if ((projectile.minion || projectile.sentry || ProjectileID.Sets.MinionShot[projectile.type] || ProjectileID.Sets.SentryShot[projectile.type] || CalamityMod.projectileMinionList.Contains(projectile.type)) && ShouldAffectNPC(npc) && Main.rand.NextBool(15)) + if (projectile.IsSummon()) { damage = npc.lifeMax * 3; } @@ -3563,19 +3711,24 @@ namespace CalamityMod.NPCs { damage = (int)(damage * 0.2); } - else if (ProjectileID.Sets.StardustDragon[projectile.type] || projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileID.Electrosphere) + else if (ProjectileID.Sets.StardustDragon[projectile.type] || projectile.type == ProjectileType() || projectile.type == ProjectileType()) { - damage = (int)(damage * 0.4); + damage = (int)(damage * 0.25); } - else if (projectile.type == ProjectileType()) + else if (projectile.type == ProjectileID.DD2BetsyArrow || projectile.type == ProjectileType() || projectile.type == ProjectileType()) { damage = (int)(damage * 0.5); } - else if (projectile.type == ProjectileType() || projectile.type == ProjectileID.DD2BetsyArrow || projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileID.ChargedBlasterLaser) + else if (projectile.type == ProjectileType() || projectile.type == ProjectileID.InfernoFriendlyBolt || projectile.type == ProjectileID.InfernoFriendlyBlast || projectile.type == ProjectileID.RainbowFront || projectile.type == ProjectileID.RainbowBack || projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileID.ChargedBlasterLaser || projectile.type == ProjectileID.Electrosphere) { damage = (int)(damage * 0.75); } } + else if (CosmicGuardianIDs.Contains(npc.type)) + { + GrenadeResist(projectile, ref damage); + PierceResistGlobal(projectile, ref damage); + } else if (StormWeaverIDs.Contains(npc.type)) { GrenadeResist(projectile, ref damage); @@ -3591,6 +3744,10 @@ namespace CalamityMod.NPCs projectile.penetrate = projectile.Calamity().stealthStrike ? 6 : 9; damage = (int)(damage * 0.75); } + else if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) + { + damage = (int)(damage * 0.5); + } else if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) { damage = (int)(damage * 0.5); @@ -3631,7 +3788,7 @@ namespace CalamityMod.NPCs { damage = (int)(damage * 0.9); } - if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) + if (projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType()) { damage = (int)(damage * 0.5); } @@ -3673,7 +3830,7 @@ namespace CalamityMod.NPCs { damage = (int)(damage * 0.2); } - else if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) + else if (projectile.type == ProjectileType()) { damage = (int)(damage * 0.5); } @@ -3721,7 +3878,7 @@ namespace CalamityMod.NPCs private void PierceResistGlobal(Projectile projectile, ref int damage) { - if (projectile.minion) + if (projectile.IsSummon()) return; if (projectile.penetrate == -1) @@ -3758,7 +3915,7 @@ namespace CalamityMod.NPCs Player player = Main.player[projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - bool isSummon = projectile.minion || projectile.sentry || CalamityMod.projectileMinionList.Contains(projectile.type) || ProjectileID.Sets.MinionShot[projectile.type] || ProjectileID.Sets.SentryShot[projectile.type]; + bool isSummon = projectile.IsSummon(); if (modPlayer.sGenerator) { @@ -3822,28 +3979,13 @@ namespace CalamityMod.NPCs if (Main.rand.NextBool(maxValue) && Main.wallDungeon[Main.tile[(int)npc.Center.X / 16, (int)npc.Center.Y / 16].wall]) { - int randomType = Main.rand.Next(4); - switch (randomType) - { - case 0: - randomType = NPCType(); - break; - - case 1: - randomType = NPCType(); - break; - - case 2: - randomType = NPCType(); - break; - - case 3: - randomType = NPCType(); - break; - - default: - break; - } + int randomType = Utils.SelectRandom(Main.rand, new int[] + { + NPCType(), + NPCType(), + NPCType(), + NPCType() + }); NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, randomType, 0, 0f, 0f, 0f, 0f, 255); } @@ -3865,25 +4007,22 @@ namespace CalamityMod.NPCs { if (Main.netMode != NetmodeID.MultiplayerClient) { - int num261 = Main.rand.Next(2) + 2; - int num; - for (int num262 = 0; num262 < num261; num262 = num + 1) + int slimeAmt = Main.rand.Next(2) + 2; //2 to 3 extra + for (int s = 0; s < slimeAmt; s++) { - int num263 = NPC.NewNPC((int)(npc.position.X + npc.width / 2), (int)(npc.position.Y + npc.height), 1, 0, 0f, 0f, 0f, 0f, 255); - NPC npc2 = Main.npc[num263]; - npc2.SetDefaults(-5, -1f); + int slime = NPC.NewNPC((int)npc.Center.X, (int)(npc.position.Y + npc.height), NPCID.BlueSlime, 0, 0f, 0f, 0f, 0f, 255); + NPC npc2 = Main.npc[slime]; + npc2.SetDefaults(NPCID.BabySlime); npc2.velocity.X = npc.velocity.X * 2f; npc2.velocity.Y = npc.velocity.Y; - npc2.velocity.X += Main.rand.Next(-20, 20) * 0.1f + num262 * npc.direction * 0.3f; - npc2.velocity.Y -= Main.rand.Next(0, 10) * 0.1f + num262; + npc2.velocity.X += Main.rand.Next(-20, 20) * 0.1f + s * npc.direction * 0.3f; + npc2.velocity.Y -= Main.rand.Next(0, 10) * 0.1f + s; npc2.ai[0] = -1000 * Main.rand.Next(3); - if (Main.netMode == NetmodeID.Server && num263 < 200) + if (Main.netMode == NetmodeID.Server && slime < Main.maxNPCs) { - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num263, 0f, 0f, 0f, 0, 0, 0); + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, slime, 0f, 0f, 0f, 0, 0, 0); } - - num = num262; } } } @@ -4069,7 +4208,7 @@ namespace CalamityMod.NPCs spawnRate = (int)(spawnRate * 2.5); maxSpawns = (int)(maxSpawns * 0.3f); } - if (player.Calamity().bossZen || CalamityWorld.DoGSecondStageCountdown > 0) + if ((player.Calamity().bossZen || CalamityWorld.DoGSecondStageCountdown > 0) && CalamityConfig.Instance.BossZen) { spawnRate *= 5; maxSpawns = (int)(maxSpawns * 0.001f); @@ -4091,7 +4230,23 @@ namespace CalamityMod.NPCs #region Edit Spawn Pool public override void EditSpawnPool(IDictionary pool, NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.Calamity().ZoneAbyss || + // Spawn Green Jellyfish in prehm and Blue Jellyfish in hardmode + if (spawnInfo.player.ZoneRockLayerHeight && spawnInfo.water) + { + if (!Main.hardMode) + pool[NPCID.GreenJellyfish] = SpawnCondition.CaveJellyfish.Chance * 0.5f; + else + pool[NPCID.BlueJellyfish] = SpawnCondition.CaveJellyfish.Chance; + } + + // Add Truffle Worm spawns to surface mushroom biome + if (spawnInfo.player.ZoneGlowshroom && Main.hardMode && (spawnInfo.player.ZoneOverworldHeight || spawnInfo.player.ZoneSkyHeight)) + { + if (NPC.CountNPCS(NPCID.TruffleWorm) < 2) + pool[NPCID.TruffleWorm] = SpawnCondition.OverworldMushroom.Chance * 0.5f; + } + + if (spawnInfo.player.Calamity().ZoneAbyss || spawnInfo.player.Calamity().ZoneCalamity || spawnInfo.player.Calamity().ZoneSulphur || spawnInfo.player.Calamity().ZoneSunkenSea || @@ -4099,15 +4254,12 @@ namespace CalamityMod.NPCs { pool[0] = 0f; } - if (spawnInfo.player.Calamity().underworldLore) - { - pool[NPCID.VoodooDemon] = 0f; - } + if (spawnInfo.player.Calamity().ZoneSulphur && !spawnInfo.player.Calamity().ZoneAbyss && CalamityWorld.rainingAcid) { pool.Clear(); - if (!(CalamityWorld.downedPolterghast && CalamityWorld.acidRainPoints == 2)) + if (!(CalamityWorld.downedPolterghast && CalamityWorld.acidRainPoints == 1)) { Dictionary PossibleEnemies = AcidRainEvent.PossibleEnemiesPreHM; Dictionary PossibleMinibosses = new Dictionary(); @@ -4169,6 +4321,10 @@ namespace CalamityMod.NPCs } } } + if (NPC.CountNPCS(NPCType()) >= AcidRainEvent.MaxNuclearToadCount) + { + pool.Remove(NPCType()); + } } } } @@ -4320,7 +4476,7 @@ namespace CalamityMod.NPCs { if (Main.rand.Next(5) < 4) { - int dust = Dust.NewDust(npc.position - new Vector2(2f, 2f), npc.width + 4, npc.height + 4, 173, npc.velocity.X * 0.4f, npc.velocity.Y * 0.4f, 100, default, 1.5f); + int dust = Dust.NewDust(npc.position - new Vector2(2f, 2f), npc.width + 4, npc.height + 4, (int)CalamityDusts.PurpleCosmolite, npc.velocity.X * 0.4f, npc.velocity.Y * 0.4f, 100, default, 1.5f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 1.2f; Main.dust[dust].velocity.Y -= 0.15f; @@ -4358,7 +4514,7 @@ namespace CalamityMod.NPCs { int num3 = Utils.SelectRandom(Main.rand, new int[] { - 173, + (int)CalamityDusts.PurpleCosmolite, 27, 234 }); @@ -4369,7 +4525,6 @@ namespace CalamityMod.NPCs dust.alpha = 200; dust.velocity.Y -= 0.2f; dust.velocity *= 1.2f; - dust = Main.dust[num4]; dust.scale += Main.rand.NextFloat(); } } @@ -4394,7 +4549,7 @@ namespace CalamityMod.NPCs { if (Main.rand.Next(5) < 4) { - int dust = Dust.NewDust(npc.position - new Vector2(2f, 2f), npc.width + 4, npc.height + 4, 173, npc.velocity.X * 0.4f, npc.velocity.Y * 0.4f, 100, default, 1.5f); + int dust = Dust.NewDust(npc.position - new Vector2(2f, 2f), npc.width + 4, npc.height + 4, (int)CalamityDusts.PurpleCosmolite, npc.velocity.X * 0.4f, npc.velocity.Y * 0.4f, 100, default, 1.5f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 1.2f; Main.dust[dust].velocity.Y -= 0.15f; @@ -4471,10 +4626,8 @@ namespace CalamityMod.NPCs { if (Main.rand.NextBool(5)) { - Vector2 vector2_2 = new Vector2((float)Main.rand.Next(-10, 11), (float)Main.rand.Next(-10, 11)); - vector2_2.Normalize(); - vector2_2.X *= 0.66f; - int heart = Gore.NewGore(npc.position + new Vector2((float)Main.rand.Next(npc.width + 1), (float)Main.rand.Next(npc.height + 1)), vector2_2 * (float)Main.rand.Next(3, 6) * 0.33f, 331, (float)Main.rand.Next(40, 121) * 0.01f); + Vector2 velocity = CalamityUtils.RandomVelocity(10f, 1f, 1f, 0.66f); + int heart = Gore.NewGore(npc.position + new Vector2(Main.rand.Next(npc.width + 1), Main.rand.Next(npc.height + 1)), velocity * Main.rand.Next(3, 6) * 0.33f, 331, Main.rand.Next(40, 121) * 0.01f); Main.gore[heart].sticky = false; Main.gore[heart].velocity *= 0.4f; Main.gore[heart].velocity.Y -= 0.6f; @@ -4514,6 +4667,11 @@ namespace CalamityMod.NPCs return new Color(200, 50, 50, npc.alpha); } + if (npc.Calamity().kamiFlu > 0) + { + return new Color(51, 197, 108, npc.alpha); + } + return null; } @@ -4521,7 +4679,7 @@ namespace CalamityMod.NPCs { if (npc.type != NPCID.BrainofCthulhu && (npc.type != NPCID.DukeFishron || npc.ai[0] <= 9f)) { - if (CalamityConfig.Instance.DebuffDisplay && (npc.boss || BossHealthBarManager.MinibossHPBarList.Contains(npc.type) || BossHealthBarManager.OneToMany.ContainsKey(npc.type))) + if (CalamityConfig.Instance.DebuffDisplay && (npc.boss || BossHealthBarManager.MinibossHPBarList.Contains(npc.type) || BossHealthBarManager.OneToMany.ContainsKey(npc.type) || CalamityMod.needsDebuffIconDisplayList.Contains(npc.type))) { List buffTextureList = new List(); @@ -5297,7 +5455,7 @@ namespace CalamityMod.NPCs break; case NPCID.GoblinTinkerer: - if (Main.rand.NextBool(3) && thief != -1 && Main.LocalPlayer.Calamity().reforges >= 10) + if (Main.rand.NextBool(3) && thief != -1 && CalamityWorld.Reforges >= 1) { chat = $"Hey, is it just me or have my pockets gotten lighter ever since " + Main.npc[thief].GivenName + " arrived?"; } @@ -5581,20 +5739,56 @@ namespace CalamityMod.NPCs break; } } - #endregion + #endregion - #region Shop Stuff - public override void SetupShop(int type, Chest shop, ref int nextSlot) + #region Buff Town NPC + public override void BuffTownNPC(ref float damageMult, ref int defense) + { + if (NPC.downedMoonlord) + { + damageMult += 0.6f; + defense += 20; + } + if (CalamityWorld.downedProvidence) + { + damageMult += 0.2f; + defense += 12; + } + if (CalamityWorld.downedPolterghast) + { + damageMult += 0.2f; + defense += 12; + } + if (CalamityWorld.downedDoG) + { + damageMult += 0.2f; + defense += 12; + } + if (CalamityWorld.downedYharon) + { + damageMult += 0.2f; + defense += 12; + } + if (CalamityWorld.downedSCal) + { + damageMult += 0.6f; + defense += 20; + } + } + #endregion + + #region Shop Stuff + public override void SetupShop(int type, Chest shop, ref int nextSlot) { if (type == NPCID.Merchant) { SetShopItem(ref shop, ref nextSlot, ItemID.Flare, (Main.LocalPlayer.HasItem(ItemType()) || Main.LocalPlayer.HasItem(ItemType())) && !Main.LocalPlayer.HasItem(ItemID.FlareGun)); SetShopItem(ref shop, ref nextSlot, ItemID.BlueFlare, (Main.LocalPlayer.HasItem(ItemType()) || Main.LocalPlayer.HasItem(ItemType())) && !Main.LocalPlayer.HasItem(ItemID.FlareGun)); SetShopItem(ref shop, ref nextSlot, ItemID.ApprenticeBait, NPC.downedBoss1); - SetShopItem(ref shop, ref nextSlot, ItemID.JourneymanBait, NPC.downedBoss2); + SetShopItem(ref shop, ref nextSlot, ItemID.JourneymanBait, NPC.downedBoss3); SetShopItem(ref shop, ref nextSlot, WorldGen.crimson ? ItemID.Vilethorn : ItemID.CrimsonRod, WorldGen.shadowOrbSmashed || NPC.downedBoss2); SetShopItem(ref shop, ref nextSlot, WorldGen.crimson ? ItemID.BallOHurt : ItemID.TheRottedFork, WorldGen.shadowOrbSmashed || NPC.downedBoss2); - SetShopItem(ref shop, ref nextSlot, ItemID.MasterBait, NPC.downedBoss3); + SetShopItem(ref shop, ref nextSlot, ItemID.MasterBait, NPC.downedPlantBoss); SetShopItem(ref shop, ref nextSlot, ItemID.AngelStatue, NPC.FindFirstNPC(NPCType()) != -1, Item.buyPrice(0, 5)); SetShopItem(ref shop, ref nextSlot, ItemID.UltrabrightTorch, CalamityWorld.death); } @@ -5856,14 +6050,14 @@ namespace CalamityMod.NPCs return true; } } - return false; + return CalamityUtils.FindFirstProjectile(ProjectileType()) != -1; } #endregion #region Any Events public static bool AnyEvents(Player player) { - if (Main.invasionType > 0) + if (Main.invasionType > InvasionID.None) return true; if (player.PillarZone()) return true; @@ -6061,7 +6255,7 @@ namespace CalamityMod.NPCs } int players = 0; - for (int i = 0; i < 255; i++) + for (int i = 0; i < Main.maxPlayers; i++) { if (Main.player[i] != null && Main.player[i].active) { @@ -6075,8 +6269,10 @@ namespace CalamityMod.NPCs #region Should Affect NPC public static bool ShouldAffectNPC(NPC target) { + if (EaterofWorldsIDs.Contains(target.type) || DestroyerIDs.Contains(target.type)) + return false; + if (target.damage > 0 && !target.boss && !target.friendly && !target.dontTakeDamage && - target.type != NPCID.TheDestroyerBody && target.type != NPCID.TheDestroyerTail && target.type != NPCID.MourningWood && target.type != NPCID.Everscream && target.type != NPCID.SantaNK1 && target.type != NPCType() && target.type != NPCType() && target.type != NPCType() && target.type != NPCType() && target.type != NPCType() && target.type != NPCID.DD2Betsy && !CalamityMod.enemyImmunityList.Contains(target.type) && !AcidRainEvent.AllMinibosses.Contains(target.type)) @@ -6105,14 +6301,14 @@ namespace CalamityMod.NPCs { if (plr == Main.myPlayer && projectile.ai[0] == 0f) { - for (int num13 = 0; num13 < Main.maxInventory; num13++) + for (int item = 0; item < Main.maxInventory; item++) { - if (player.inventory[num13].type == baitType) + if (player.inventory[item].type == baitType) { - player.inventory[num13].stack--; - if (player.inventory[num13].stack <= 0) + player.inventory[item].stack--; + if (player.inventory[item].stack <= 0) { - player.inventory[num13].SetDefaults(0, false); + player.inventory[item].SetDefaults(0, false); } break; } @@ -6123,23 +6319,8 @@ namespace CalamityMod.NPCs if (Main.netMode != NetmodeID.MultiplayerClient) { - int num8 = NPC.NewNPC((int)projectile.Center.X, (int)projectile.Center.Y + 100, type); - string typeName2 = Main.npc[num8].TypeName; - - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue("Announcement.HasAwoken", typeName2), new Color(175, 75, 255)); - return; - } - - if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey("Announcement.HasAwoken", new object[] - { - Main.npc[num8].GetTypeNetName() - }), new Color(175, 75, 255)); - return; - } + int boss = NPC.NewNPC((int)projectile.Center.X, (int)projectile.Center.Y + 100, type); + CalamityUtils.BossAwakenMessage(boss); } else { diff --git a/NPCs/CalamityGlobalNPCLoot.cs b/NPCs/CalamityGlobalNPCLoot.cs index 0addaf402a..21628206d0 100644 --- a/NPCs/CalamityGlobalNPCLoot.cs +++ b/NPCs/CalamityGlobalNPCLoot.cs @@ -91,7 +91,7 @@ namespace CalamityMod.NPCs if (CalamityWorld.revenge) { - if (npc.type == NPCID.Probe || npc.type == NPCID.ServantofCthulhu || npc.type == NPCID.MoonLordCore) + if (npc.type == NPCID.Probe || npc.type == NPCID.ServantofCthulhu) { return false; } @@ -174,22 +174,22 @@ namespace CalamityMod.NPCs // First kill text (this is not a loot function) if (!Main.hardMode) - { - string key2 = "Mods.CalamityMod.UglyBossText"; //Sunken Sea buff - string key = "Mods.CalamityMod.SteelSkullBossText"; //clone can now be fought - Color messageColor2 = Color.Aquamarine; - Color messageColor = Color.Crimson; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key2), messageColor2); - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key2), messageColor2); - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - } + { + string key2 = "Mods.CalamityMod.UglyBossText"; //Sunken Sea buff + //string key = "Mods.CalamityMod.SteelSkullBossText"; //clone can now be fought + Color messageColor2 = Color.Aquamarine; + //Color messageColor = Color.Crimson; + if (Main.netMode == NetmodeID.SinglePlayer) + { + Main.NewText(Language.GetTextValue(key2), messageColor2); + // Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == NetmodeID.Server) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key2), messageColor2); + //NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + } } else if (lastTwinStanding) { @@ -380,6 +380,21 @@ namespace CalamityMod.NPCs } } } + //Since Calamity makes it spawn in pre-hardmode, don't want to cause other mods to freak out if they use it as a tier gate (like a new weapon or something) + else if (npc.type == NPCID.GreenJellyfish && !Main.hardMode) + { + DropHelper.DropItem(npc, ItemID.Glowstick, 1, 4); + DropHelper.DropItemChance(npc, ItemID.JellyfishNecklace, 0.1f); + DropHelper.DropItemChance(npc, ItemID.Megaphone, Main.expertMode ? 0.2f : 0.1f); + DropHelper.DropItemCondition(npc, ItemID.JellyfishNecklace, CalamityWorld.defiled, DropHelper.DefiledDropRateFloat); + DropHelper.DropItemCondition(npc, ItemID.Megaphone, CalamityWorld.defiled, DropHelper.DefiledDropRateFloat); + DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 5 : 7); + return false; + } + else if (npc.type == NPCID.VoodooDemon && Main.player[npc.target].Calamity().underworldLore) + { + NPCLoader.blockLoot.Add(ItemID.GuideVoodooDoll); + } return true; } @@ -392,109 +407,109 @@ namespace CalamityMod.NPCs { CalamityWorld.bossRushStage = 7; CalamityUtils.KillAllHostileProjectiles(); - } - else if (npc.type == NPCID.EaterofWorldsHead || npc.type == NPCID.EaterofWorldsBody || npc.type == NPCID.EaterofWorldsTail) - { - int count = 0; - for (int j = 0; j < Main.maxNPCs; j++) - { - if (Main.npc[j].active && (Main.npc[j].type == NPCID.EaterofWorldsHead || Main.npc[j].type == NPCID.EaterofWorldsBody || Main.npc[j].type == NPCID.EaterofWorldsTail)) - { - count++; - break; - } - } - - if (count < 4) - { - CalamityWorld.bossRushStage = 8; - CalamityUtils.KillAllHostileProjectiles(); - } + CalamityWorld.bossRushHostileProjKillCounter = 3; } else if (npc.type == ModContent.NPCType()) { CalamityWorld.bossRushStage = 9; CalamityUtils.KillAllHostileProjectiles(); + CalamityWorld.bossRushHostileProjKillCounter = 3; } else if (npc.type == ModContent.NPCType()) { CalamityWorld.bossRushStage = 12; CalamityUtils.KillAllHostileProjectiles(); + CalamityWorld.bossRushHostileProjKillCounter = 3; } else if (npc.type == ModContent.NPCType()) { CalamityWorld.bossRushStage = 14; CalamityUtils.KillAllHostileProjectiles(); + CalamityWorld.bossRushHostileProjKillCounter = 3; } else if (npc.type == ModContent.NPCType()) { CalamityWorld.bossRushStage = 16; CalamityUtils.KillAllHostileProjectiles(); + CalamityWorld.bossRushHostileProjKillCounter = 3; } else if (npc.type == ModContent.NPCType()) { CalamityWorld.bossRushStage = 17; CalamityUtils.KillAllHostileProjectiles(); + CalamityWorld.bossRushHostileProjKillCounter = 3; } else if (npc.type == ModContent.NPCType()) { CalamityWorld.bossRushStage = 18; CalamityUtils.KillAllHostileProjectiles(); + CalamityWorld.bossRushHostileProjKillCounter = 3; } else if (npc.type == ModContent.NPCType()) { CalamityWorld.bossRushStage = 20; CalamityUtils.KillAllHostileProjectiles(); + CalamityWorld.bossRushHostileProjKillCounter = 3; } else if (npc.type == ModContent.NPCType()) { CalamityWorld.bossRushStage = 22; CalamityUtils.KillAllHostileProjectiles(); + CalamityWorld.bossRushHostileProjKillCounter = 3; } else if (npc.type == ModContent.NPCType()) { CalamityWorld.bossRushStage = 23; CalamityUtils.KillAllHostileProjectiles(); + CalamityWorld.bossRushHostileProjKillCounter = 3; } else if (npc.type == ModContent.NPCType()) { CalamityWorld.bossRushStage = 24; CalamityUtils.KillAllHostileProjectiles(); + CalamityWorld.bossRushHostileProjKillCounter = 3; } else if (npc.type == ModContent.NPCType()) { CalamityWorld.bossRushStage = 25; CalamityUtils.KillAllHostileProjectiles(); + CalamityWorld.bossRushHostileProjKillCounter = 3; } else if (npc.type == ModContent.NPCType()) { CalamityWorld.bossRushStage = 26; CalamityUtils.KillAllHostileProjectiles(); + CalamityWorld.bossRushHostileProjKillCounter = 3; } else if (npc.type == ModContent.NPCType()) { CalamityWorld.bossRushStage = 27; CalamityUtils.KillAllHostileProjectiles(); + CalamityWorld.bossRushHostileProjKillCounter = 3; } else if (npc.type == ModContent.NPCType()) { CalamityWorld.bossRushStage = 30; CalamityUtils.KillAllHostileProjectiles(); + CalamityWorld.bossRushHostileProjKillCounter = 3; } else if (npc.type == ModContent.NPCType()) { CalamityWorld.bossRushStage = 31; CalamityUtils.KillAllHostileProjectiles(); + CalamityWorld.bossRushHostileProjKillCounter = 3; } else if (npc.type == ModContent.NPCType()) { CalamityWorld.bossRushStage = 32; CalamityUtils.KillAllHostileProjectiles(); + CalamityWorld.bossRushHostileProjKillCounter = 3; } else if (npc.type == ModContent.NPCType()) { CalamityWorld.bossRushStage = 33; CalamityUtils.KillAllHostileProjectiles(); + CalamityWorld.bossRushHostileProjKillCounter = 3; } else if (npc.type == ModContent.NPCType() || npc.type == ModContent.NPCType()) { @@ -503,33 +518,44 @@ namespace CalamityMod.NPCs { CalamityWorld.bossRushStage = 34; CalamityUtils.KillAllHostileProjectiles(); + CalamityWorld.bossRushHostileProjKillCounter = 3; } } - else if (npc.type == ModContent.NPCType() || npc.type == ModContent.NPCType() || npc.type == ModContent.NPCType()) + else if (npc.type == ModContent.NPCType()) + { + CalamityWorld.bossRushStage = 35; + CalamityUtils.KillAllHostileProjectiles(); + CalamityWorld.bossRushHostileProjKillCounter = 3; + } + else if (npc.type == ModContent.NPCType() || npc.type == ModContent.NPCType() || npc.type == ModContent.NPCType()) { if (npc.type == ModContent.NPCType() && !NPC.AnyNPCs(ModContent.NPCType()) && !NPC.AnyNPCs(ModContent.NPCType()) && !NPC.AnyNPCs(ModContent.NPCType()) && !NPC.AnyNPCs(ModContent.NPCType())) { - CalamityWorld.bossRushStage = 35; + CalamityWorld.bossRushStage = 36; CalamityUtils.KillAllHostileProjectiles(); + CalamityWorld.bossRushHostileProjKillCounter = 3; } else if (npc.type == ModContent.NPCType() && !NPC.AnyNPCs(ModContent.NPCType()) && !NPC.AnyNPCs(ModContent.NPCType()) && NPC.CountNPCS(ModContent.NPCType()) < 2 && !NPC.AnyNPCs(ModContent.NPCType())) { - CalamityWorld.bossRushStage = 35; + CalamityWorld.bossRushStage = 36; CalamityUtils.KillAllHostileProjectiles(); + CalamityWorld.bossRushHostileProjKillCounter = 3; } else if (npc.type == ModContent.NPCType() && !NPC.AnyNPCs(ModContent.NPCType()) && !NPC.AnyNPCs(ModContent.NPCType()) && NPC.CountNPCS(ModContent.NPCType()) < 2 && !NPC.AnyNPCs(ModContent.NPCType())) { - CalamityWorld.bossRushStage = 35; + CalamityWorld.bossRushStage = 36; CalamityUtils.KillAllHostileProjectiles(); + CalamityWorld.bossRushHostileProjKillCounter = 3; } } else if (npc.type == ModContent.NPCType()) { - CalamityWorld.bossRushStage = 36; + CalamityWorld.bossRushStage = 37; CalamityUtils.KillAllHostileProjectiles(); + CalamityWorld.bossRushHostileProjKillCounter = 3; string key = "Mods.CalamityMod.BossRushTierFourEndText"; Color messageColor = Color.LightCoral; @@ -544,19 +570,22 @@ namespace CalamityMod.NPCs } else if (npc.type == ModContent.NPCType()) { - CalamityWorld.bossRushStage = 37; + CalamityWorld.bossRushStage = 38; CalamityUtils.KillAllHostileProjectiles(); + CalamityWorld.bossRushHostileProjKillCounter = 3; } else if (npc.type == ModContent.NPCType()) { - CalamityWorld.bossRushStage = 38; + CalamityWorld.bossRushStage = 39; CalamityUtils.KillAllHostileProjectiles(); + CalamityWorld.bossRushHostileProjKillCounter = 3; } else if (npc.type == ModContent.NPCType()) { DropHelper.DropItem(npc, ModContent.ItemType(), true); CalamityWorld.bossRushStage = 0; CalamityUtils.KillAllHostileProjectiles(); + CalamityWorld.bossRushHostileProjKillCounter = 3; CalamityWorld.bossRushActive = false; CalamityMod.UpdateServerBoolean(); @@ -587,36 +616,51 @@ namespace CalamityMod.NPCs case NPCID.QueenBee: CalamityWorld.bossRushStage = 1; CalamityUtils.KillAllHostileProjectiles(); + CalamityWorld.bossRushHostileProjKillCounter = 3; break; case NPCID.BrainofCthulhu: CalamityWorld.bossRushStage = 2; CalamityUtils.KillAllHostileProjectiles(); + CalamityWorld.bossRushHostileProjKillCounter = 3; break; case NPCID.KingSlime: CalamityWorld.bossRushStage = 3; CalamityUtils.KillAllHostileProjectiles(); + CalamityWorld.bossRushHostileProjKillCounter = 3; break; case NPCID.EyeofCthulhu: CalamityWorld.bossRushStage = 4; CalamityUtils.KillAllHostileProjectiles(); + CalamityWorld.bossRushHostileProjKillCounter = 3; break; case NPCID.SkeletronPrime: CalamityWorld.bossRushStage = 5; CalamityUtils.KillAllHostileProjectiles(); + CalamityWorld.bossRushHostileProjKillCounter = 3; break; case NPCID.Golem: CalamityWorld.bossRushStage = 6; CalamityUtils.KillAllHostileProjectiles(); + CalamityWorld.bossRushHostileProjKillCounter = 3; break; - case NPCID.TheDestroyer: + case NPCID.EaterofWorldsHead: + case NPCID.EaterofWorldsBody: + case NPCID.EaterofWorldsTail: + CalamityWorld.bossRushStage = 8; + CalamityUtils.KillAllHostileProjectiles(); + CalamityWorld.bossRushHostileProjKillCounter = 3; + break; + + case NPCID.TheDestroyer: CalamityWorld.bossRushStage = 10; CalamityUtils.KillAllHostileProjectiles(); + CalamityWorld.bossRushHostileProjKillCounter = 3; string key = "Mods.CalamityMod.BossRushTierOneEndText"; Color messageColor = Color.LightCoral; @@ -634,26 +678,31 @@ namespace CalamityMod.NPCs case NPCID.Spazmatism: CalamityWorld.bossRushStage = 11; CalamityUtils.KillAllHostileProjectiles(); + CalamityWorld.bossRushHostileProjKillCounter = 3; break; case NPCID.Retinazer: CalamityWorld.bossRushStage = 11; CalamityUtils.KillAllHostileProjectiles(); + CalamityWorld.bossRushHostileProjKillCounter = 3; break; case NPCID.WallofFlesh: CalamityWorld.bossRushStage = 13; CalamityUtils.KillAllHostileProjectiles(); + CalamityWorld.bossRushHostileProjKillCounter = 3; break; case NPCID.SkeletronHead: CalamityWorld.bossRushStage = 15; CalamityUtils.KillAllHostileProjectiles(); + CalamityWorld.bossRushHostileProjKillCounter = 3; break; case NPCID.CultistBoss: CalamityWorld.bossRushStage = 19; CalamityUtils.KillAllHostileProjectiles(); + CalamityWorld.bossRushHostileProjKillCounter = 3; string key2 = "Mods.CalamityMod.BossRushTierTwoEndText"; Color messageColor2 = Color.LightCoral; @@ -671,11 +720,13 @@ namespace CalamityMod.NPCs case NPCID.Plantera: CalamityWorld.bossRushStage = 21; CalamityUtils.KillAllHostileProjectiles(); + CalamityWorld.bossRushHostileProjKillCounter = 3; break; case NPCID.DukeFishron: CalamityWorld.bossRushStage = 28; CalamityUtils.KillAllHostileProjectiles(); + CalamityWorld.bossRushHostileProjKillCounter = 3; string key3 = "Mods.CalamityMod.BossRushTierThreeEndText"; Color messageColor3 = Color.LightCoral; @@ -693,6 +744,7 @@ namespace CalamityMod.NPCs case NPCID.MoonLordCore: CalamityWorld.bossRushStage = 29; CalamityUtils.KillAllHostileProjectiles(); + CalamityWorld.bossRushHostileProjKillCounter = 3; break; default: @@ -705,6 +757,10 @@ namespace CalamityMod.NPCs netMessage.Write((byte)CalamityModMessageType.BossRushStage); netMessage.Write(CalamityWorld.bossRushStage); netMessage.Send(); + var netMessage2 = mod.GetPacket(); + netMessage2.Write((byte)CalamityModMessageType.BRHostileProjKillSync); + netMessage2.Write(CalamityWorld.bossRushHostileProjKillCounter); + netMessage2.Send(); } return false; @@ -802,7 +858,7 @@ namespace CalamityMod.NPCs RareVariants(npc); CommonLoot(npc); TownNPCLoot(npc); - BossLoot(npc); + EventEnemyLoot(npc, Main.pumpkinMoon, Main.snowMoon, Main.eclipse); } #endregion @@ -825,6 +881,7 @@ namespace CalamityMod.NPCs break; case NPCID.ArmoredSkeleton: + case NPCID.HeavySkeleton: DropHelper.DropItemChance(npc, ItemID.BeamSword, DropHelper.DefiledDropRateInt); DropHelper.DropItemChance(npc, ItemID.ArmorPolish, DropHelper.DefiledDropRateInt); break; @@ -1076,7 +1133,7 @@ namespace CalamityMod.NPCs } // Every type of Skeleton counts for the Bone Sword - if (CalamityMod.skeletonList.Contains(npc.type) && npc.type != NPCID.ArmoredSkeleton && npc.type != NPCID.SkeletonArcher && npc.type != NPCID.GreekSkeleton) + if (CalamityMod.skeletonList.Contains(npc.type) && npc.type != NPCID.ArmoredSkeleton && npc.type != NPCID.HeavySkeleton && npc.type != NPCID.SkeletonArcher && npc.type != NPCID.GreekSkeleton) { DropHelper.DropItemChance(npc, ItemID.BoneSword, DropHelper.DefiledDropRateInt); } @@ -1295,55 +1352,6 @@ namespace CalamityMod.NPCs } } } - - if (NPC.downedAncientCultist && !CalamityWorld.downedStarGod && npc.type == ModContent.NPCType() && !NPC.AnyNPCs(ModContent.NPCType())) - { - CalamityMod.astralKillCount++; - if (CalamityMod.astralKillCount == 1) - { - string key = "Mods.CalamityMod.DeusText2"; - Color messageColor = Color.Gold; - - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - } - else if (CalamityMod.astralKillCount == 2) - { - string key = "Mods.CalamityMod.DeusText3"; - Color messageColor = Color.Gold; - - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - } - if (CalamityMod.astralKillCount >= 3 && Main.netMode != NetmodeID.MultiplayerClient) - { - int lastPlayer = npc.lastInteraction; - - if (!Main.player[lastPlayer].active || Main.player[lastPlayer].dead) - { - lastPlayer = npc.FindClosestPlayer(); - } - - if (lastPlayer >= 0) - { - CalamityWorld.ChangeTime(false); - NPC.SpawnOnPlayer(lastPlayer, ModContent.NPCType()); - CalamityMod.astralKillCount = 0; - } - } - } } #endregion @@ -1362,7 +1370,7 @@ namespace CalamityMod.NPCs // Blood Orb drops: Valid enemy during a blood moon on the Surface if (!npc.SpawnedFromStatue && (npc.damage > 5 || npc.boss) && Main.bloodMoon && npc.HasPlayerTarget && npc.position.Y / 16D < Main.worldSurface) { - if (Main.player[Player.FindClosest(npc.position, npc.width, npc.height)].Calamity().bloodflareSet) + if (Main.player[Player.FindClosest(npc.Center, npc.width, npc.height)].Calamity().bloodflareSet) { DropHelper.DropItemChance(npc, ModContent.ItemType(), 2); // 50% chance of 1 orb with Bloodflare } @@ -1427,7 +1435,7 @@ namespace CalamityMod.NPCs break; case NPCID.PinkJellyfish: - DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 5 : 7); + DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 20 : 25); break; case NPCID.BlueJellyfish: @@ -1675,6 +1683,7 @@ namespace CalamityMod.NPCs case NPCID.IcyMerman: case NPCID.IceTortoise: + case NPCID.IceElemental: DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 2 : 3); break; @@ -1693,6 +1702,7 @@ namespace CalamityMod.NPCs case NPCID.SolarDrakomireRider: case NPCID.SolarDrakomire: case NPCID.SolarCrawltipedeHead: + DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 4 : 5); DropHelper.DropItemChance(npc, ItemID.FragmentSolar, Main.expertMode ? 4 : 5); break; @@ -1701,6 +1711,7 @@ namespace CalamityMod.NPCs case NPCID.VortexHornet: //Alien Hornet case NPCID.VortexHornetQueen: //Alien Queen case NPCID.VortexRifleman: //Storm Diver + DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 4 : 5); DropHelper.DropItemChance(npc, ItemID.FragmentVortex, Main.expertMode ? 4 : 5); break; @@ -1708,7 +1719,7 @@ namespace CalamityMod.NPCs case NPCID.NebulaSoldier: //Predictor case NPCID.NebulaHeadcrab: //Brain Suckler case NPCID.NebulaBeast: //Evolution Beast - DropHelper.DropItemChance(npc, ModContent.ItemType(), 4, Main.expertMode ? 2 : 1, Main.expertMode ? 3 : 2); + DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 4 : 5); DropHelper.DropItemChance(npc, ItemID.FragmentNebula, Main.expertMode ? 4 : 5); break; @@ -1717,6 +1728,7 @@ namespace CalamityMod.NPCs case NPCID.StardustJellyfishBig: //Flow Invader case NPCID.StardustCellBig: //Star Cell case NPCID.StardustWormHead: //Milkyway Weaver + DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 4 : 5); DropHelper.DropItemChance(npc, ItemID.FragmentStardust, Main.expertMode ? 4 : 5); break; @@ -1760,6 +1772,8 @@ namespace CalamityMod.NPCs case NPCID.MotherSlime: case NPCID.CorruptSlime: case NPCID.Crimslime: + case NPCID.BigCrimslime: + case NPCID.LittleCrimslime: DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 3 : 4); break; @@ -1778,8 +1792,8 @@ namespace CalamityMod.NPCs case NPCID.Reaper: case NPCID.Psycho: - DropHelper.DropItemCondition(npc, ModContent.ItemType(), (CalamityWorld.downedCalamitas || NPC.downedPlantBoss), Main.expertMode ? 0.75f : 0.5f, 1, 4); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedBuffedMothron, Main.expertMode ? 0.06f : 0.04f, 1, 1); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas || NPC.downedPlantBoss, Main.expertMode ? 0.75f : 0.5f, 1, 4); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.buffedEclipse, Main.expertMode ? 0.06f : 0.04f, 1, 1); break; //other solar eclipse creatures @@ -1795,7 +1809,7 @@ namespace CalamityMod.NPCs case NPCID.DeadlySphere: case NPCID.DrManFly: case NPCID.Nailhead: - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedBuffedMothron, Main.expertMode ? 0.06f : 0.04f, 1, 1); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.buffedEclipse, Main.expertMode ? 0.06f : 0.04f, 1, 1); break; case NPCID.MartianOfficer: @@ -1858,36 +1872,87 @@ namespace CalamityMod.NPCs DropHelper.DropItemCondition(npc, ItemID.GoldenFishingRod, Main.hardMode, 12, 1, 1); } } - #endregion + #endregion - #region Boss Loot - private void BossLoot(NPC npc) - { - // Not really loot code, but NPCLoot is the only death hook - if (npc.boss && !CalamityWorld.downedBossAny) - { - CalamityWorld.downedBossAny = true; - CalamityMod.UpdateServerBoolean(); - } + #region Boss Loot + private void EventEnemyLoot(NPC npc, bool pumpkin, bool frost, bool eclipse) + { + // Not really loot code, but NPCLoot is the only death hook + if (npc.boss && !CalamityWorld.downedBossAny) + { + CalamityWorld.downedBossAny = true; + CalamityMod.UpdateServerBoolean(); + } - // Nightmare Fuel, Endothermic Energy and Darksun Fragments - if (npc.type == NPCID.Pumpking) - { - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedDoG, 10, 20); - } - else if (npc.type == NPCID.IceQueen) - { - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedDoG, 20, 40); - } - else if (npc.type == NPCID.Mothron && CalamityWorld.buffedEclipse) - { - DropHelper.DropItem(npc, ModContent.ItemType(), 10, 20); + // Nightmare Fuel, Endothermic Energy and Darksun Fragments + if (!CalamityWorld.downedDoG) + { + return; + } - // Mark a buffed Mothron as killed (allowing access to Yharon P2) - CalamityWorld.downedBuffedMothron = true; - CalamityMod.UpdateServerBoolean(); - } - } + if (frost) + { + switch (npc.type) + { + case NPCID.Nutcracker: + case NPCID.NutcrackerSpinning: + case NPCID.ElfCopter: + case NPCID.Flocko: + DropHelper.DropItemChance(npc, ModContent.ItemType(), 2); + break; + case NPCID.Krampus: + case NPCID.Yeti: + case NPCID.PresentMimic: + DropHelper.DropItemChance(npc, ModContent.ItemType(), 2, 1, 2); + break; + case NPCID.Everscream: + DropHelper.DropItem(npc, ModContent.ItemType(), 3, 5); + break; + case NPCID.SantaNK1: + DropHelper.DropItem(npc, ModContent.ItemType(), 5, 10); + break; + case NPCID.IceQueen: + DropHelper.DropItem(npc, ModContent.ItemType(), 10, 20); + break; + } + } + else if (pumpkin) + { + switch (npc.type) + { + case NPCID.Splinterling: + DropHelper.DropItemChance(npc, ModContent.ItemType(), 2); + break; + case NPCID.Hellhound: + case NPCID.Poltergeist: + DropHelper.DropItemChance(npc, ModContent.ItemType(), 2, 1, 2); + break; + case NPCID.HeadlessHorseman: + DropHelper.DropItem(npc, ModContent.ItemType(), 3, 5); + break; + case NPCID.MourningWood: + DropHelper.DropItem(npc, ModContent.ItemType(), 5, 10); + break; + case NPCID.Pumpking: + DropHelper.DropItem(npc, ModContent.ItemType(), 10, 20); + break; + } + } + + if (!CalamityWorld.buffedEclipse) + { + return; + } + + if (npc.type == NPCID.Mothron) + { + DropHelper.DropItem(npc, ModContent.ItemType(), 10, 20); + + // Mark a buffed Mothron as killed (allowing access to Yharon P2) + CalamityWorld.downedBuffedMothron = true; + CalamityMod.UpdateServerBoolean(); + } + } #endregion } } diff --git a/NPCs/CeaselessVoid/CeaselessVoid.cs b/NPCs/CeaselessVoid/CeaselessVoid.cs index 63f055e6b2..f36190247b 100644 --- a/NPCs/CeaselessVoid/CeaselessVoid.cs +++ b/NPCs/CeaselessVoid/CeaselessVoid.cs @@ -1,3 +1,4 @@ +using CalamityMod.Dusts; using CalamityMod.Items.Accessories; using CalamityMod.Items.Armor.Vanity; using CalamityMod.Items.LoreItems; @@ -170,9 +171,12 @@ namespace CalamityMod.NPCs.CeaselessVoid } } - // Mark Ceaseless Void as dead - CalamityWorld.downedSentinel1 = true; - CalamityMod.UpdateServerBoolean(); + // Mark Ceaseless Void as dead + if (CalamityWorld.DoGSecondStageCountdown <= 0) + { + CalamityWorld.downedSentinel1 = true; + CalamityMod.UpdateServerBoolean(); + } } public override void BossLoot(ref string name, ref int potionType) @@ -189,7 +193,7 @@ namespace CalamityMod.NPCs.CeaselessVoid } for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 173, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { @@ -201,7 +205,7 @@ namespace CalamityMod.NPCs.CeaselessVoid npc.position.Y = npc.position.Y - (float)(npc.height / 2); for (int num621 = 0; num621 < 40; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -211,10 +215,10 @@ namespace CalamityMod.NPCs.CeaselessVoid } for (int num623 = 0; num623 < 70; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } float randomSpread = (float)(Main.rand.Next(-200, 200) / 100); diff --git a/NPCs/CeaselessVoid/DarkEnergy.cs b/NPCs/CeaselessVoid/DarkEnergy.cs index 14eee1caa6..7ec96a7a02 100644 --- a/NPCs/CeaselessVoid/DarkEnergy.cs +++ b/NPCs/CeaselessVoid/DarkEnergy.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; using CalamityMod.Projectiles.Rogue; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -30,7 +31,7 @@ namespace CalamityMod.NPCs.CeaselessVoid npc.height = 80; npc.defense = 50; npc.lifeMax = 6000; - if (CalamityWorld.DoGSecondStageCountdown <= 0) + if (CalamityWorld.DoGSecondStageCountdown <= 0 || !CalamityWorld.downedSentinel1) { npc.lifeMax = 24000; } @@ -38,8 +39,8 @@ namespace CalamityMod.NPCs.CeaselessVoid { npc.lifeMax = 44000; } - double HPBoost = (double)CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.knockBackResist = 0.25f; npc.noGravity = true; npc.noTileCollide = true; @@ -267,10 +268,10 @@ namespace CalamityMod.NPCs.CeaselessVoid public override void OnHitByProjectile(Projectile projectile, int damage, float knockback, bool crit) { - if (CalamityWorld.DoGSecondStageCountdown <= 0) + if (CalamityWorld.DoGSecondStageCountdown <= 0 || !CalamityWorld.downedSentinel1) { if (projectile.type == ModContent.ProjectileType()) - damage = (int)((double)damage * 0.9); + damage = (int)(damage * 0.9); } } @@ -280,7 +281,8 @@ namespace CalamityMod.NPCs.CeaselessVoid { player.AddBuff(ModContent.BuffType(), 300, true); } - } + player.AddBuff(BuffID.VortexDebuff, 60, true); + } public override bool CanHitPlayer(Player target, ref int cooldownSlot) { @@ -294,7 +296,7 @@ namespace CalamityMod.NPCs.CeaselessVoid { for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 173, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/CeaselessVoid/DarkEnergy2.cs b/NPCs/CeaselessVoid/DarkEnergy2.cs index e8acaae714..0621a40eb1 100644 --- a/NPCs/CeaselessVoid/DarkEnergy2.cs +++ b/NPCs/CeaselessVoid/DarkEnergy2.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; using CalamityMod.Projectiles.Rogue; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -30,7 +31,7 @@ namespace CalamityMod.NPCs.CeaselessVoid npc.height = 80; npc.defense = 50; npc.lifeMax = 6000; - if (CalamityWorld.DoGSecondStageCountdown <= 0) + if (CalamityWorld.DoGSecondStageCountdown <= 0 || !CalamityWorld.downedSentinel1) { npc.lifeMax = 24000; } @@ -38,8 +39,8 @@ namespace CalamityMod.NPCs.CeaselessVoid { npc.lifeMax = 44000; } - double HPBoost = (double)CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.knockBackResist = 0.1f; npc.noGravity = true; npc.noTileCollide = true; @@ -224,10 +225,10 @@ namespace CalamityMod.NPCs.CeaselessVoid public override void OnHitByProjectile(Projectile projectile, int damage, float knockback, bool crit) { - if (CalamityWorld.DoGSecondStageCountdown <= 0) + if (CalamityWorld.DoGSecondStageCountdown <= 0 || !CalamityWorld.downedSentinel1) { if (projectile.type == ModContent.ProjectileType()) - damage = (int)((double)damage * 0.9); + damage = (int)(damage * 0.9); } } @@ -237,7 +238,8 @@ namespace CalamityMod.NPCs.CeaselessVoid { player.AddBuff(ModContent.BuffType(), 300, true); } - } + player.AddBuff(BuffID.VortexDebuff, 60, true); + } public override bool CanHitPlayer(Player target, ref int cooldownSlot) { @@ -251,7 +253,7 @@ namespace CalamityMod.NPCs.CeaselessVoid { for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 173, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/CeaselessVoid/DarkEnergy3.cs b/NPCs/CeaselessVoid/DarkEnergy3.cs index 08f2f50d4f..84352e1b56 100644 --- a/NPCs/CeaselessVoid/DarkEnergy3.cs +++ b/NPCs/CeaselessVoid/DarkEnergy3.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; using CalamityMod.Projectiles.Rogue; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -30,7 +31,7 @@ namespace CalamityMod.NPCs.CeaselessVoid npc.height = 80; npc.defense = 50; npc.lifeMax = 6000; - if (CalamityWorld.DoGSecondStageCountdown <= 0) + if (CalamityWorld.DoGSecondStageCountdown <= 0 || !CalamityWorld.downedSentinel1) { npc.lifeMax = 24000; } @@ -38,8 +39,8 @@ namespace CalamityMod.NPCs.CeaselessVoid { npc.lifeMax = 44000; } - double HPBoost = (double)CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0.3f; @@ -252,10 +253,10 @@ namespace CalamityMod.NPCs.CeaselessVoid public override void OnHitByProjectile(Projectile projectile, int damage, float knockback, bool crit) { - if (CalamityWorld.DoGSecondStageCountdown <= 0) + if (CalamityWorld.DoGSecondStageCountdown <= 0 || !CalamityWorld.downedSentinel1) { if (projectile.type == ModContent.ProjectileType()) - damage = (int)((double)damage * 0.9); + damage = (int)(damage * 0.9); } } @@ -265,7 +266,8 @@ namespace CalamityMod.NPCs.CeaselessVoid { player.AddBuff(ModContent.BuffType(), 300, true); } - } + player.AddBuff(BuffID.VortexDebuff, 60, true); + } public override bool CanHitPlayer(Player target, ref int cooldownSlot) { @@ -279,7 +281,7 @@ namespace CalamityMod.NPCs.CeaselessVoid { for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 173, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/Crags/CalamityEye.cs b/NPCs/Crags/CalamityEye.cs index c362fd2c33..bebda2e086 100644 --- a/NPCs/Crags/CalamityEye.cs +++ b/NPCs/Crags/CalamityEye.cs @@ -27,7 +27,7 @@ namespace CalamityMod.NPCs.Crags npc.defense = 12; npc.lifeMax = 140; npc.knockBackResist = 0f; - animationType = 2; + animationType = NPCID.DemonEye; npc.value = Item.buyPrice(0, 0, 5, 0); npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath1; @@ -40,56 +40,57 @@ namespace CalamityMod.NPCs.Crags } banner = npc.type; bannerItem = ModContent.ItemType(); + npc.buffImmune[BuffID.Confused] = false; } public override void AI() { if ((double) npc.life < (double) npc.lifeMax * 0.5) { - if (npc.direction == -1 && (double) npc.velocity.X > -6.0) + if (npc.direction == -1 && npc.velocity.X > -6f) { npc.velocity.X -= 0.1f; - if ((double) npc.velocity.X > 6.0) + if (npc.velocity.X > 6f) npc.velocity.X -= 0.1f; - else if ((double) npc.velocity.X > 0.0) + else if (npc.velocity.X > 0f) npc.velocity.X += 0.05f; - if ((double) npc.velocity.X < -6.0) + if (npc.velocity.X < -6f) npc.velocity.X = -6f; } - else if (npc.direction == 1 && (double) npc.velocity.X < 6.0) + else if (npc.direction == 1 && npc.velocity.X < 6f) { npc.velocity.X += 0.1f; - if ((double) npc.velocity.X < -6.0) + if (npc.velocity.X < -6f) npc.velocity.X += 0.1f; - else if ((double) npc.velocity.X < 0.0) + else if (npc.velocity.X < 0f) npc.velocity.X -= 0.05f; - if ((double) npc.velocity.X > 6.0) + if (npc.velocity.X > 6f) npc.velocity.X = 6f; } - if (npc.directionY == -1 && (double) npc.velocity.Y > -4.0) + if (npc.directionY == -1 && npc.velocity.Y > -4f) { npc.velocity.Y -= 0.1f; - if ((double) npc.velocity.Y > 4.0) + if (npc.velocity.Y > 4f) npc.velocity.Y -= 0.1f; - else if ((double) npc.velocity.Y > 0.0) + else if (npc.velocity.Y > 0f) npc.velocity.Y += 0.05f; - if ((double) npc.velocity.Y < -4.0) + if (npc.velocity.Y < -4f) npc.velocity.Y = -4f; } - else if (npc.directionY == 1 && (double) npc.velocity.Y < 4.0) + else if (npc.directionY == 1 && npc.velocity.Y < 4f) { npc.velocity.Y += 0.1f; - if ((double) npc.velocity.Y < -4.0) + if (npc.velocity.Y < -4f) npc.velocity.Y += 0.1f; - else if ((double) npc.velocity.Y < 0.0) + else if (npc.velocity.Y < 0f) npc.velocity.Y -= 0.05f; - if ((double) npc.velocity.Y > 4.0) + if (npc.velocity.Y > 4f) npc.velocity.Y = 4f; } } if (Main.rand.NextBool(40)) { - int index = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + (float) npc.height * 0.25f), npc.width, (int) ((double) npc.height * 0.5), 5, npc.velocity.X, 2f, 0, new Color(), 1f); + int index = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + npc.height * 0.25f), npc.width, (int)(npc.height * 0.5), DustID.Blood, npc.velocity.X, 2f, 0, new Color(), 1f); Main.dust[index].velocity.X *= 0.5f; Main.dust[index].velocity.Y *= 0.1f; } @@ -99,13 +100,13 @@ namespace CalamityMod.NPCs.Crags { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/Crags/CharredSlime.cs b/NPCs/Crags/CharredSlime.cs index 58a3c729ea..526bcf8c21 100644 --- a/NPCs/Crags/CharredSlime.cs +++ b/NPCs/Crags/CharredSlime.cs @@ -20,14 +20,14 @@ namespace CalamityMod.NPCs.Crags public override void SetDefaults() { npc.aiStyle = 1; - aiType = 59; + aiType = NPCID.LavaSlime; npc.damage = 40; npc.width = 40; npc.height = 30; npc.defense = 10; npc.lifeMax = 250; npc.knockBackResist = 0f; - animationType = 81; + animationType = NPCID.CorruptSlime; npc.value = Item.buyPrice(0, 0, 5, 0); npc.alpha = 50; npc.lavaImmune = true; diff --git a/NPCs/Crags/CultistAssassin.cs b/NPCs/Crags/CultistAssassin.cs index 724a9d55a8..24c7f826ca 100644 --- a/NPCs/Crags/CultistAssassin.cs +++ b/NPCs/Crags/CultistAssassin.cs @@ -25,7 +25,7 @@ namespace CalamityMod.NPCs.Crags npc.defense = 25; npc.lifeMax = 80; npc.knockBackResist = 0.5f; - animationType = 331; + animationType = NPCID.ZombieXmas; aiType = NPCID.ChaosElemental; npc.value = Item.buyPrice(0, 0, 2, 0); npc.HitSound = SoundID.NPCHit1; @@ -39,6 +39,7 @@ namespace CalamityMod.NPCs.Crags } banner = npc.type; bannerItem = ModContent.ItemType(); + npc.buffImmune[BuffID.Confused] = false; } public override float SpawnChance(NPCSpawnInfo spawnInfo) @@ -50,13 +51,13 @@ namespace CalamityMod.NPCs.Crags { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/Crags/DespairStone.cs b/NPCs/Crags/DespairStone.cs index 35905612e1..251247e904 100644 --- a/NPCs/Crags/DespairStone.cs +++ b/NPCs/Crags/DespairStone.cs @@ -40,11 +40,12 @@ namespace CalamityMod.NPCs.Crags } banner = npc.type; bannerItem = ModContent.ItemType(); + npc.buffImmune[BuffID.Confused] = false; } public override void AI() { - CalamityAI.UnicornAI(npc, mod, true, 4f, 5f, 0.2f); + CalamityAI.UnicornAI(npc, mod, true, CalamityWorld.death ? 6f : 4f, 5f, 0.2f); } public override void OnHitPlayer(Player player, int damage, bool crit) diff --git a/NPCs/Crags/Scryllar.cs b/NPCs/Crags/Scryllar.cs index e626cc9ebf..91305387a5 100644 --- a/NPCs/Crags/Scryllar.cs +++ b/NPCs/Crags/Scryllar.cs @@ -42,6 +42,7 @@ namespace CalamityMod.NPCs.Crags } banner = npc.type; bannerItem = ModContent.ItemType(); + npc.buffImmune[BuffID.Confused] = false; } public override void AI() diff --git a/NPCs/Crags/ScryllarRage.cs b/NPCs/Crags/ScryllarRage.cs index 2728702026..f7a841f738 100644 --- a/NPCs/Crags/ScryllarRage.cs +++ b/NPCs/Crags/ScryllarRage.cs @@ -42,6 +42,7 @@ namespace CalamityMod.NPCs.Crags } banner = ModContent.NPCType(); bannerItem = ModContent.ItemType(); + npc.buffImmune[BuffID.Confused] = false; } public override void AI() diff --git a/NPCs/Cryogen/Cryogen.cs b/NPCs/Cryogen/Cryogen.cs index f717acd207..cf93d7848a 100644 --- a/NPCs/Cryogen/Cryogen.cs +++ b/NPCs/Cryogen/Cryogen.cs @@ -68,6 +68,7 @@ namespace CalamityMod.NPCs.Cryogen npc.buffImmune[BuffID.DryadsWardDebuff] = false; npc.buffImmune[BuffID.Oiled] = false; npc.buffImmune[BuffID.BoneJavelin] = false; + npc.buffImmune[BuffID.ShadowFlame] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; @@ -78,6 +79,7 @@ namespace CalamityMod.NPCs.Cryogen npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; diff --git a/NPCs/DesertScourge/DesertScourgeBody.cs b/NPCs/DesertScourge/DesertScourgeBody.cs index e20eb2e1ba..8cedfd6327 100644 --- a/NPCs/DesertScourge/DesertScourgeBody.cs +++ b/NPCs/DesertScourge/DesertScourgeBody.cs @@ -155,7 +155,7 @@ namespace CalamityMod.NPCs.DesertScourge } for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { @@ -165,7 +165,7 @@ namespace CalamityMod.NPCs.DesertScourge Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/ScourgeBody3"), 1f); for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/DesertScourge/DesertScourgeBodySmall.cs b/NPCs/DesertScourge/DesertScourgeBodySmall.cs index 1982f7c16b..7bef5630c7 100644 --- a/NPCs/DesertScourge/DesertScourgeBodySmall.cs +++ b/NPCs/DesertScourge/DesertScourgeBodySmall.cs @@ -75,7 +75,7 @@ namespace CalamityMod.NPCs.DesertScourge { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { @@ -85,7 +85,7 @@ namespace CalamityMod.NPCs.DesertScourge Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/ScourgeBody3"), 0.65f); for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/DesertScourge/DesertScourgeHead.cs b/NPCs/DesertScourge/DesertScourgeHead.cs index 5d5c267d9e..61d0ad9f40 100644 --- a/NPCs/DesertScourge/DesertScourgeHead.cs +++ b/NPCs/DesertScourge/DesertScourgeHead.cs @@ -24,8 +24,6 @@ namespace CalamityMod.NPCs.DesertScourge public class DesertScourgeHead : ModNPC { private bool flies = false; - private float speed = 8f; - private float turnSpeed = 0.08f; private bool TailSpawned = false; public override void SetStaticDefaults() @@ -88,6 +86,9 @@ namespace CalamityMod.NPCs.DesertScourge // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; + float speed = 8f; + float turnSpeed = 0.08f; + if (expertMode) { speed += death ? 6f : 6f * (1f - lifeRatio); @@ -549,7 +550,7 @@ namespace CalamityMod.NPCs.DesertScourge { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { @@ -557,7 +558,7 @@ namespace CalamityMod.NPCs.DesertScourge Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScourgeHead2"), 1f); for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/DesertScourge/DesertScourgeHeadSmall.cs b/NPCs/DesertScourge/DesertScourgeHeadSmall.cs index aa8e5e76d0..25528fcf66 100644 --- a/NPCs/DesertScourge/DesertScourgeHeadSmall.cs +++ b/NPCs/DesertScourge/DesertScourgeHeadSmall.cs @@ -384,7 +384,7 @@ namespace CalamityMod.NPCs.DesertScourge { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { @@ -392,7 +392,7 @@ namespace CalamityMod.NPCs.DesertScourge Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScourgeHead2"), 0.65f); for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/DesertScourge/DesertScourgeTail.cs b/NPCs/DesertScourge/DesertScourgeTail.cs index 84063668b7..f338fd7bbc 100644 --- a/NPCs/DesertScourge/DesertScourgeTail.cs +++ b/NPCs/DesertScourge/DesertScourgeTail.cs @@ -97,14 +97,14 @@ namespace CalamityMod.NPCs.DesertScourge { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScourgeTail"), 1f); for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/DesertScourge/DesertScourgeTailSmall.cs b/NPCs/DesertScourge/DesertScourgeTailSmall.cs index 9fd5a57d92..2a6e06b42f 100644 --- a/NPCs/DesertScourge/DesertScourgeTailSmall.cs +++ b/NPCs/DesertScourge/DesertScourgeTailSmall.cs @@ -65,14 +65,14 @@ namespace CalamityMod.NPCs.DesertScourge { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScourgeTail"), 0.65f); for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/DesertScourge/DriedSeekerBody.cs b/NPCs/DesertScourge/DriedSeekerBody.cs index e9e86211b6..620dcce6b3 100644 --- a/NPCs/DesertScourge/DriedSeekerBody.cs +++ b/NPCs/DesertScourge/DriedSeekerBody.cs @@ -62,13 +62,13 @@ namespace CalamityMod.NPCs.DesertScourge { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/DesertScourge/DriedSeekerHead.cs b/NPCs/DesertScourge/DriedSeekerHead.cs index 27683c9688..0ec7821427 100644 --- a/NPCs/DesertScourge/DriedSeekerHead.cs +++ b/NPCs/DesertScourge/DriedSeekerHead.cs @@ -86,13 +86,13 @@ namespace CalamityMod.NPCs.DesertScourge { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/DesertScourge/DriedSeekerTail.cs b/NPCs/DesertScourge/DriedSeekerTail.cs index e457c5fbc6..95d0b199ce 100644 --- a/NPCs/DesertScourge/DriedSeekerTail.cs +++ b/NPCs/DesertScourge/DriedSeekerTail.cs @@ -57,13 +57,13 @@ namespace CalamityMod.NPCs.DesertScourge { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/DevourerofGods/DevourerofGodsBody.cs b/NPCs/DevourerofGods/DevourerofGodsBody.cs index 53d65a157f..98b47a838e 100644 --- a/NPCs/DevourerofGods/DevourerofGodsBody.cs +++ b/NPCs/DevourerofGods/DevourerofGodsBody.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -266,7 +267,7 @@ namespace CalamityMod.NPCs.DevourerofGods npc.position.Y = npc.position.Y - (float)(npc.height / 2); for (int num621 = 0; num621 < 10; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -276,10 +277,10 @@ namespace CalamityMod.NPCs.DevourerofGods } for (int num623 = 0; num623 < 20; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } diff --git a/NPCs/DevourerofGods/DevourerofGodsBody2.cs b/NPCs/DevourerofGods/DevourerofGodsBody2.cs index 49e7842aff..412d3e4725 100644 --- a/NPCs/DevourerofGods/DevourerofGodsBody2.cs +++ b/NPCs/DevourerofGods/DevourerofGodsBody2.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System.IO; @@ -202,7 +203,7 @@ namespace CalamityMod.NPCs.DevourerofGods npc.position.Y = npc.position.Y - (float)(npc.height / 2); for (int num621 = 0; num621 < 10; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -212,10 +213,10 @@ namespace CalamityMod.NPCs.DevourerofGods } for (int num623 = 0; num623 < 20; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } diff --git a/NPCs/DevourerofGods/DevourerofGodsBodyS.cs b/NPCs/DevourerofGods/DevourerofGodsBodyS.cs index 310a107306..a79f6498cc 100644 --- a/NPCs/DevourerofGods/DevourerofGodsBodyS.cs +++ b/NPCs/DevourerofGods/DevourerofGodsBodyS.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -259,7 +260,7 @@ namespace CalamityMod.NPCs.DevourerofGods npc.position.Y = npc.position.Y - (float)(npc.height / 2); for (int num621 = 0; num621 < 10; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -269,10 +270,10 @@ namespace CalamityMod.NPCs.DevourerofGods } for (int num623 = 0; num623 < 20; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } diff --git a/NPCs/DevourerofGods/DevourerofGodsHead.cs b/NPCs/DevourerofGods/DevourerofGodsHead.cs index 2d3962f967..8ddb2ed5a5 100644 --- a/NPCs/DevourerofGods/DevourerofGodsHead.cs +++ b/NPCs/DevourerofGods/DevourerofGodsHead.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -94,11 +95,11 @@ namespace CalamityMod.NPCs.DevourerofGods bool revenge = CalamityWorld.revenge; bool death = CalamityWorld.death; - // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; + // Percent life remaining + float lifeRatio = npc.life / (float)npc.lifeMax; // Light - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); + Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); // Worm variable if (npc.ai[3] > 0f) @@ -132,7 +133,7 @@ namespace CalamityMod.NPCs.DevourerofGods spawnDoGCountdown--; if (spawnDoGCountdown == 0 && Main.netMode != NetmodeID.MultiplayerClient) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/DevourerSpawn"), (int)player.position.X, (int)player.position.Y); + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/DevourerAttack"), (int)player.position.X, (int)player.position.Y); for (int i = 0; i < 2; i++) NPC.SpawnOnPlayer(npc.FindClosestPlayer(), ModContent.NPCType()); @@ -152,16 +153,13 @@ namespace CalamityMod.NPCs.DevourerofGods { spawnDoGCountdown--; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/DevourerSpawn"), (int)player.position.X, (int)player.position.Y); + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/DevourerAttack"), (int)player.position.X, (int)player.position.Y); if (spawnDoGCountdown == 0 && Main.netMode != NetmodeID.MultiplayerClient) NPC.SpawnOnPlayer(npc.FindClosestPlayer(), ModContent.NPCType()); } } - // Velocity - npc.velocity.Length(); - // Spawn dust if (npc.alpha != 0) { @@ -193,9 +191,9 @@ namespace CalamityMod.NPCs.DevourerofGods segment = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType(), npc.whoAmI); Main.npc[segment].realLife = npc.whoAmI; - Main.npc[segment].ai[2] = (float)npc.whoAmI; - Main.npc[segment].ai[1] = (float)Previous; - Main.npc[Previous].ai[0] = (float)segment; + Main.npc[segment].ai[2] = npc.whoAmI; + Main.npc[segment].ai[1] = Previous; + Main.npc[Previous].ai[0] = segment; NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, segment, 0f, 0f, 0f, 0); Previous = segment; } @@ -225,9 +223,9 @@ namespace CalamityMod.NPCs.DevourerofGods // Movement int num180 = (int)(npc.position.X / 16f) - 1; - int num181 = (int)((npc.position.X + (float)npc.width) / 16f) + 2; + int num181 = (int)((npc.position.X + npc.width) / 16f) + 2; int num182 = (int)(npc.position.Y / 16f) - 1; - int num183 = (int)((npc.position.Y + (float)npc.height) / 16f) + 2; + int num183 = (int)((npc.position.Y + npc.height) / 16f) + 2; if (num180 < 0) num180 = 0; @@ -278,9 +276,9 @@ namespace CalamityMod.NPCs.DevourerofGods float num188 = speed; float num189 = turnSpeed; - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = player.position.X + (float)(player.width / 2); - float num192 = player.position.Y + (float)(player.height / 2); + Vector2 vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num191 = player.position.X + (player.width / 2); + float num192 = player.position.Y + (player.height / 2); int num42 = -1; int num43 = (int)(player.Center.X / 16f); int num44 = (int)(player.Center.Y / 16f); @@ -302,7 +300,7 @@ namespace CalamityMod.NPCs.DevourerofGods if (num42 > 0) { num42 *= 16; - float num47 = (float)(num42 - 800); + float num47 = num42 - 800; if (player.position.Y > num47) { num192 = num47; @@ -321,6 +319,12 @@ namespace CalamityMod.NPCs.DevourerofGods num189 = homingTurnSpeed; } + if (revenge) + { + num188 += Vector2.Distance(player.Center, npc.Center) * 0.005f * (1f - lifeRatio); + num189 += Vector2.Distance(player.Center, npc.Center) * 0.0001f * (1f - lifeRatio); + } + float num48 = num188 * 1.3f; float num49 = num188 * 0.7f; float num50 = npc.velocity.Length(); @@ -338,50 +342,15 @@ namespace CalamityMod.NPCs.DevourerofGods } } - if (num42 > 0) - { - for (int num51 = 0; num51 < 200; num51++) - { - if (Main.npc[num51].active && Main.npc[num51].type == npc.type && num51 != npc.whoAmI) - { - Vector2 vector3 = Main.npc[num51].Center - npc.Center; - if (vector3.Length() < 400f) - { - vector3.Normalize(); - vector3 *= 1000f; - num191 -= vector3.X; - num192 -= vector3.Y; - } - } - } - } - else - { - for (int num52 = 0; num52 < 200; num52++) - { - if (Main.npc[num52].active && Main.npc[num52].type == npc.type && num52 != npc.whoAmI) - { - Vector2 vector4 = Main.npc[num52].Center - npc.Center; - if (vector4.Length() < 60f) - { - vector4.Normalize(); - vector4 *= 200f; - num191 -= vector4.X; - num192 -= vector4.Y; - } - } - } - } - - num191 = (float)((int)(num191 / 16f) * 16); - num192 = (float)((int)(num192 / 16f) * 16); - vector18.X = (float)((int)(vector18.X / 16f) * 16); - vector18.Y = (float)((int)(vector18.Y / 16f) * 16); + num191 = (int)(num191 / 16f) * 16; + num192 = (int)(num192 / 16f) * 16; + vector18.X = (int)(vector18.X / 16f) * 16; + vector18.Y = (int)(vector18.Y / 16f) * 16; num191 -= vector18.X; num192 -= vector18.Y; - float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - float num196 = System.Math.Abs(num191); - float num197 = System.Math.Abs(num192); + float num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192); + float num196 = Math.Abs(num191); + float num197 = Math.Abs(num192); float num198 = num188 / num193; num191 *= num198; num192 *= num198; @@ -404,7 +373,7 @@ namespace CalamityMod.NPCs.DevourerofGods npc.velocity.Y -= num189; } - if ((double)System.Math.Abs(num192) < (double)num188 * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) + if (Math.Abs(num192) < num188 * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) { if (npc.velocity.Y > 0f) npc.velocity.Y += num189 * 2f; @@ -412,7 +381,7 @@ namespace CalamityMod.NPCs.DevourerofGods npc.velocity.Y -= num189 * 2f; } - if ((double)System.Math.Abs(num191) < (double)num188 * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) + if (Math.Abs(num191) < num188 * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) { if (npc.velocity.X > 0f) npc.velocity.X += num189 * 2f; @@ -429,7 +398,7 @@ namespace CalamityMod.NPCs.DevourerofGods else if (npc.velocity.X > num191) npc.velocity.X -= num189 * 1.1f; - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) + if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < num188 * 0.5) { if (npc.velocity.Y > 0f) npc.velocity.Y += num189; @@ -444,7 +413,7 @@ namespace CalamityMod.NPCs.DevourerofGods else if (npc.velocity.Y > num192) npc.velocity.Y -= num189 * 1.1f; - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) + if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < num188 * 0.5) { if (npc.velocity.X > 0f) npc.velocity.X += num189; @@ -454,7 +423,7 @@ namespace CalamityMod.NPCs.DevourerofGods } } - npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) + MathHelper.PiOver2; if (calamityGlobalNPC.newAI[2] > 900f) { @@ -486,7 +455,13 @@ namespace CalamityMod.NPCs.DevourerofGods turnSpeed += 0.12f * (1f - lifeRatio); } - bool increaseSpeed = Vector2.Distance(player.Center, vector) > 3200f; + if (revenge) + { + speed += Vector2.Distance(player.Center, npc.Center) * 0.00005f * (1f - lifeRatio); + turnSpeed += Vector2.Distance(player.Center, npc.Center) * 0.00005f * (1f - lifeRatio); + } + + bool increaseSpeed = Vector2.Distance(player.Center, vector) > 3200f; // Enrage if (Vector2.Distance(player.Center, vector) > 5600f) @@ -506,12 +481,12 @@ namespace CalamityMod.NPCs.DevourerofGods { for (int num953 = num182; num953 < num183; num953++) { - if (Main.tile[num952, num953] != null && ((Main.tile[num952, num953].nactive() && (Main.tileSolid[(int)Main.tile[num952, num953].type] || (Main.tileSolidTop[(int)Main.tile[num952, num953].type] && Main.tile[num952, num953].frameY == 0))) || Main.tile[num952, num953].liquid > 64)) + if (Main.tile[num952, num953] != null && ((Main.tile[num952, num953].nactive() && (Main.tileSolid[Main.tile[num952, num953].type] || (Main.tileSolidTop[Main.tile[num952, num953].type] && Main.tile[num952, num953].frameY == 0))) || Main.tile[num952, num953].liquid > 64)) { Vector2 vector105; - vector105.X = (float)(num952 * 16); - vector105.Y = (float)(num953 * 16); - if (npc.position.X + (float)npc.width > vector105.X && npc.position.X < vector105.X + 16f && npc.position.Y + (float)npc.height > vector105.Y && npc.position.Y < vector105.Y + 16f) + vector105.X = num952 * 16; + vector105.Y = num953 * 16; + if (npc.position.X + npc.width > vector105.X && npc.position.X < vector105.X + 16f && npc.position.Y + npc.height > vector105.Y && npc.position.Y < vector105.Y + 16f) { flies = true; break; @@ -548,16 +523,16 @@ namespace CalamityMod.NPCs.DevourerofGods else npc.localAI[1] = 0f; - Vector2 vector3 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num20 = player.position.X + (float)(player.width / 2); - float num21 = player.position.Y + (float)(player.height / 2); - num20 = (float)((int)(num20 / 16f) * 16); - num21 = (float)((int)(num21 / 16f) * 16); - vector3.X = (float)((int)(vector3.X / 16f) * 16); - vector3.Y = (float)((int)(vector3.Y / 16f) * 16); + Vector2 vector3 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num20 = player.position.X + (player.width / 2); + float num21 = player.position.Y + (player.height / 2); + num20 = (int)(num20 / 16f) * 16; + num21 = (int)(num21 / 16f) * 16; + vector3.X = (int)(vector3.X / 16f) * 16; + vector3.Y = (int)(vector3.Y / 16f) * 16; num20 -= vector3.X; num21 -= vector3.Y; - float num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); + float num22 = (float)Math.Sqrt(num20 * num20 + num21 * num21); if (!flies) { @@ -567,7 +542,7 @@ namespace CalamityMod.NPCs.DevourerofGods if (npc.velocity.Y > fallSpeed) npc.velocity.Y = fallSpeed; - if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)fallSpeed * 1.8) + if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < fallSpeed * 1.8) { if (npc.velocity.X < 0f) npc.velocity.X -= speed * 1.1f; @@ -685,7 +660,7 @@ namespace CalamityMod.NPCs.DevourerofGods } } - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) + 1.57f; + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) + MathHelper.PiOver2; if (flies) { @@ -750,7 +725,7 @@ namespace CalamityMod.NPCs.DevourerofGods public override void NPCLoot() { // Skip the sentinel phase entirely if DoG has already been killed - CalamityWorld.DoGSecondStageCountdown = CalamityWorld.downedDoG ? 600 : 21600; + CalamityWorld.DoGSecondStageCountdown = (CalamityWorld.downedDoG || CalamityWorld.downedSecondSentinels) ? 600 : 21600; if (Main.netMode == NetmodeID.Server) { @@ -811,7 +786,7 @@ namespace CalamityMod.NPCs.DevourerofGods npc.position.Y = npc.position.Y - (float)(npc.height / 2); for (int num621 = 0; num621 < 15; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -821,10 +796,10 @@ namespace CalamityMod.NPCs.DevourerofGods } for (int num623 = 0; num623 < 30; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } @@ -845,41 +820,21 @@ namespace CalamityMod.NPCs.DevourerofGods player.KillMe(PlayerDeathReason.ByCustomReason(player.name + "'s essence was consumed by the devourer."), 1000.0, 0, false); } - // TODO: don't talk if the player has iframes - if (player.immuneTime > 0 || player.immune) - return; - - int num = Main.rand.Next(5); - string key = "Mods.CalamityMod.EdgyBossText3"; - if (num == 0) - { - key = "Mods.CalamityMod.EdgyBossText3"; - } - else if (num == 1) - { - key = "Mods.CalamityMod.EdgyBossText4"; - } - else if (num == 2) - { - key = "Mods.CalamityMod.EdgyBossText5"; - } - else if (num == 3) - { - key = "Mods.CalamityMod.EdgyBossText6"; - } - else if (num == 4) - { - key = "Mods.CalamityMod.EdgyBossText7"; - } - Color messageColor = Color.Cyan; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } + if (player.Calamity().dogTextCooldown <= 0) + { + string text = Utils.SelectRandom(Main.rand, new string[] + { + "Mods.CalamityMod.EdgyBossText3", + "Mods.CalamityMod.EdgyBossText4", + "Mods.CalamityMod.EdgyBossText5", + "Mods.CalamityMod.EdgyBossText6", + "Mods.CalamityMod.EdgyBossText7" + }); + Color messageColor = Color.Cyan; + Rectangle location = new Microsoft.Xna.Framework.Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); + CombatText.NewText(location, messageColor, Language.GetTextValue(text), true); + player.Calamity().dogTextCooldown = 60; + } } } } diff --git a/NPCs/DevourerofGods/DevourerofGodsHead2.cs b/NPCs/DevourerofGods/DevourerofGodsHead2.cs index fdc938723f..441976927f 100644 --- a/NPCs/DevourerofGods/DevourerofGodsHead2.cs +++ b/NPCs/DevourerofGods/DevourerofGodsHead2.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -131,30 +132,19 @@ namespace CalamityMod.NPCs.DevourerofGods } } - if (CalamityGlobalNPC.DoGHead < 0 || !Main.npc[CalamityGlobalNPC.DoGHead].active) - { - for (int num569 = 0; num569 < Main.maxNPCs; num569++) - { - if (Main.npc[num569].active && (Main.npc[num569].type == ModContent.NPCType() || Main.npc[num569].type == ModContent.NPCType() || Main.npc[num569].type == ModContent.NPCType())) - { - Main.npc[num569].active = false; - } - } - } - - if (player.dead) + if (player.dead || CalamityGlobalNPC.DoGHead < 0 || !Main.npc[CalamityGlobalNPC.DoGHead].active) { npc.TargetClosest(false); - npc.velocity.Y = npc.velocity.Y - 3f; + npc.velocity.Y -= 3f; if ((double)npc.position.Y < Main.topWorld + 16f) { - npc.velocity.Y = npc.velocity.Y - 3f; + npc.velocity.Y -= 3f; } if ((double)npc.position.Y < Main.topWorld + 16f) { for (int a = 0; a < Main.maxNPCs; a++) { - if (Main.npc[a].aiStyle == npc.aiStyle) + if (Main.npc[a].type == npc.type || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType()) { Main.npc[a].active = false; } @@ -377,7 +367,7 @@ namespace CalamityMod.NPCs.DevourerofGods npc.position.Y = npc.position.Y - (float)(npc.height / 2); for (int num621 = 0; num621 < 15; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -387,10 +377,10 @@ namespace CalamityMod.NPCs.DevourerofGods } for (int num623 = 0; num623 < 30; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } diff --git a/NPCs/DevourerofGods/DevourerofGodsHeadS.cs b/NPCs/DevourerofGods/DevourerofGodsHeadS.cs index 77b64b28d0..3cfde01c12 100644 --- a/NPCs/DevourerofGods/DevourerofGodsHeadS.cs +++ b/NPCs/DevourerofGods/DevourerofGodsHeadS.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; using CalamityMod.Items.Armor.Vanity; using CalamityMod.Items.LoreItems; using CalamityMod.Items.Materials; @@ -41,6 +42,7 @@ namespace CalamityMod.NPCs.DevourerofGods private int idleCounter = idleCounterMax; public int laserWallPhase = 0; private int postTeleportTimer = 0; + private int laserWallType = 0; public override void SetStaticDefaults() { @@ -92,7 +94,8 @@ namespace CalamityMod.NPCs.DevourerofGods writer.Write(idleCounter); writer.Write(laserWallPhase); writer.Write(postTeleportTimer); - } + writer.Write(laserWallType); + } public override void ReceiveExtraAI(BinaryReader reader) { @@ -105,7 +108,8 @@ namespace CalamityMod.NPCs.DevourerofGods idleCounter = reader.ReadInt32(); laserWallPhase = reader.ReadInt32(); postTeleportTimer = reader.ReadInt32(); - } + laserWallType = reader.ReadInt32(); + } public override void BossHeadRotation(ref float rotation) { @@ -128,9 +132,9 @@ namespace CalamityMod.NPCs.DevourerofGods bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; bool death = CalamityWorld.death || CalamityWorld.bossRushActive; - bool speedBoost = lifeRatio < 0.6 || (death && lifeRatio < 0.9); - bool speedBoost2 = lifeRatio < 0.2; - bool breathFireMore = lifeRatio < 0.15 || death; + bool speedBoost = lifeRatio < 0.75f || (death && lifeRatio < 0.9f); + bool speedBoost2 = lifeRatio < 0.3f; + bool breathFireMore = lifeRatio < 0.15f || death; // Light Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); @@ -222,14 +226,22 @@ namespace CalamityMod.NPCs.DevourerofGods // Anger message if (speedBoost2) { - if (!halfLife) - { - string key = "Mods.CalamityMod.EdgyBossText11"; - Color messageColor = Color.Cyan; - if (Main.netMode == NetmodeID.SinglePlayer) - Main.NewText(Language.GetTextValue(key), messageColor); - else if (Main.netMode == NetmodeID.Server) - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + if (!halfLife) + { + string key = "Mods.CalamityMod.EdgyBossText11"; + Color messageColor = Color.Cyan; + if (Main.netMode == NetmodeID.SinglePlayer) + Main.NewText(Language.GetTextValue(key), messageColor); + else if (Main.netMode == NetmodeID.Server) + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/DevourerAttack"), (int)player.position.X, (int)player.position.Y); + + for (int i = 0; i < 3; i++) + NPC.SpawnOnPlayer(npc.FindClosestPlayer(), ModContent.NPCType()); + } halfLife = true; } @@ -297,66 +309,77 @@ namespace CalamityMod.NPCs.DevourerofGods { calamityGlobalNPC.newAI[1] += 1f; - float speed = 4f; + float speed = 12f; + float spawnOffset = 1500f; float divisor = 120f; if (calamityGlobalNPC.newAI[1] % divisor == 0f) { - if (calamityGlobalNPC.newAI[1] % idleCounterMax == 0f) + Main.PlaySound(SoundID.Item12, player.position); + + // Side walls + float targetPosY = player.position.Y; + switch (laserWallType) { - int cosmicGuardianCount = NPC.CountNPCS(ModContent.NPCType()); - if (cosmicGuardianCount < 2) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/DevourerSpawn"), (int)player.position.X, (int)player.position.Y); + case 0: - int spawnAmt = cosmicGuardianCount == 0 ? 2 : 1; + for (int x = 0; x < totalShots; x++) + { + Projectile.NewProjectile(player.position.X + spawnOffset, targetPosY + shotSpacing[0], -speed, 0f, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X - spawnOffset, targetPosY + shotSpacing[0], speed, 0f, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 0f, 0f); + shotSpacing[0] -= spacingVar; + } + laserWallType = 1; + break; - for (int i = 0; i < spawnAmt; i++) - NPC.SpawnOnPlayer(npc.FindClosestPlayer(), ModContent.NPCType()); - } - } - else - { - Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 12); + case 1: - float targetPosY = player.position.Y + (Main.rand.NextBool(2) ? 50f : 0f); + targetPosY += 50f; + for (int x = 0; x < totalShots; x++) + { + Projectile.NewProjectile(player.position.X + spawnOffset, targetPosY + shotSpacing[0], -speed, 0f, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X - spawnOffset, targetPosY + shotSpacing[0], speed, 0f, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 0f, 0f); + shotSpacing[0] -= spacingVar; + } + laserWallType = revenge ? 2 : 0; + break; - // Side walls - for (int x = 0; x < totalShots; x++) - { - Projectile.NewProjectile(player.position.X + 1000f, targetPosY + shotSpacing[0], -speed, 0f, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(player.position.X - 1000f, targetPosY + shotSpacing[0], speed, 0f, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 0f, 0f); - shotSpacing[0] -= spacingVar; - } + case 2: - if (Main.rand.NextBool(2) && revenge) - { + for (int x = 0; x < totalShots; x++) + { + Projectile.NewProjectile(player.position.X + spawnOffset, targetPosY + shotSpacing[0], -speed, 0f, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X - spawnOffset, targetPosY + shotSpacing[0], speed, 0f, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 0f, 0f); + shotSpacing[0] -= spacingVar; + } for (int x = 0; x < 10; x++) { - Projectile.NewProjectile(player.position.X + 1000f, targetPosY + shotSpacing[3], -speed, 0f, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(player.position.X - 1000f, targetPosY + shotSpacing[3], speed, 0f, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + spawnOffset, targetPosY + shotSpacing[3], -speed, 0f, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X - spawnOffset, targetPosY + shotSpacing[3], speed, 0f, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 0f, 0f); shotSpacing[3] -= Main.rand.NextBool(2) ? 180 : 200; } shotSpacing[3] = 1050; - } - shotSpacing[0] = 1050; - - // Lower wall - for (int x = 0; x < totalShots; x++) - { - Projectile.NewProjectile(player.position.X + shotSpacing[1], player.position.Y + 1000f, 0f, -speed, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 0f, 0f); - shotSpacing[1] -= spacingVar; - } - shotSpacing[1] = 1050; - - // Upper wall - for (int x = 0; x < totalShots; x++) - { - Projectile.NewProjectile(player.position.X + shotSpacing[2], player.position.Y - 1000f, 0f, speed, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 0f, 0f); - shotSpacing[2] -= spacingVar; - } - shotSpacing[2] = 1050; + laserWallType = 0; + break; } + shotSpacing[0] = 1050; + + // Lower wall + for (int x = 0; x < totalShots; x++) + { + Projectile.NewProjectile(player.position.X + shotSpacing[1], player.position.Y + spawnOffset, 0f, -speed, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 0f, 0f); + shotSpacing[1] -= spacingVar; + } + shotSpacing[1] = 1050; + + // Upper wall + for (int x = 0; x < totalShots; x++) + { + Projectile.NewProjectile(player.position.X + shotSpacing[2], player.position.Y - spawnOffset, 0f, speed, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 0f, 0f); + shotSpacing[2] -= spacingVar; + } + shotSpacing[2] = 1050; + } } } @@ -502,7 +525,13 @@ namespace CalamityMod.NPCs.DevourerofGods num189 = homingTurnSpeed; } - float num48 = num188 * 1.3f; + if (revenge) + { + num188 += Vector2.Distance(player.Center, npc.Center) * 0.005f * (1f - lifeRatio); + num189 += Vector2.Distance(player.Center, npc.Center) * 0.0001f * (1f - lifeRatio); + } + + float num48 = num188 * 1.3f; float num49 = num188 * 0.7f; float num50 = npc.velocity.Length(); if (num50 > 0f) @@ -626,7 +655,10 @@ namespace CalamityMod.NPCs.DevourerofGods if (expertMode) turnSpeed += 0.12f * (1f - lifeRatio); - bool increaseSpeed = distanceFromTarget > 3200f; + if (revenge) + turnSpeed += Vector2.Distance(player.Center, npc.Center) * 0.00005f * (1f - lifeRatio); + + bool increaseSpeed = distanceFromTarget > 3200f; // Enrage if (tooFarAway) @@ -871,51 +903,18 @@ namespace CalamityMod.NPCs.DevourerofGods postTeleportTimer = 255; npc.alpha = postTeleportTimer; - int playerWidth = player.width / 2; - int playerHeight = player.height / 2; + int randomRange = 48; + float distance = 640f; + Vector2 targetVector = player.Center + player.velocity.SafeNormalize(Vector2.UnitX) * distance + new Vector2(Main.rand.Next(-randomRange, randomRange + 1), Main.rand.Next(-randomRange, randomRange + 1)); - float playerVelocityX = player.velocity.X; - float playerVelocityY = player.velocity.Y; - - int x = (int)player.position.X + playerWidth - 25; - int y = (int)player.position.Y + playerHeight - 25; - - float velocityThreshold = 0.05f; - int vectorAdjustment = 500; - if (playerVelocityX >= velocityThreshold) - { - x += vectorAdjustment; - yAdjustment(); - } - else if (playerVelocityX <= -velocityThreshold) - { - x -= vectorAdjustment; - yAdjustment(); - } - - void yAdjustment() - { - if (playerVelocityY >= velocityThreshold) - y += vectorAdjustment; - else if (playerVelocityY <= -velocityThreshold) - y -= vectorAdjustment; - } - - int x2 = x + 50; - int y2 = y + 50; - - float locationX = Main.rand.Next(x, x2); - float locationY = Main.rand.Next(y, y2); - Vector2 teleportLocation = new Vector2(locationX, locationY); - - npc.position = teleportLocation; + npc.position = targetVector; npc.netUpdate = true; - for (int i = 0; i < 200; i++) + for (int i = 0; i < Main.maxNPCs; i++) { if (Main.npc[i].active && (Main.npc[i].type == ModContent.NPCType() || Main.npc[i].type == ModContent.NPCType())) { - Main.npc[i].position = teleportLocation; + Main.npc[i].position = targetVector; if (Main.npc[i].type == ModContent.NPCType()) { ((DevourerofGodsTailS)Main.npc[i].modNPC).setInvulTime(720); @@ -924,8 +923,7 @@ namespace CalamityMod.NPCs.DevourerofGods } } - Vector2 npcCenter = new Vector2(npc.position.X + (npc.width / 2), npc.position.Y + (npc.height / 2)); - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LargeMechGaussRifle"), (int)npcCenter.X, (int)npcCenter.Y); + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/DevourerAttack"), (int)player.position.X, (int)player.position.Y); int dustAmt = 50; int random = 5; @@ -935,8 +933,8 @@ namespace CalamityMod.NPCs.DevourerofGods random += j * 2; int dustAmtSpawned = 0; int scale = random * 13; - float dustPositionX = npcCenter.X - (scale / 2); - float dustPositionY = npcCenter.Y - (scale / 2); + float dustPositionX = npc.Center.X - (scale / 2); + float dustPositionY = npc.Center.Y - (scale / 2); while (dustAmtSpawned < dustAmt) { float dustVelocityX = Main.rand.Next(-random, random); @@ -946,10 +944,10 @@ namespace CalamityMod.NPCs.DevourerofGods dustVelocity = dustVelocityScalar / dustVelocity; dustVelocityX *= dustVelocity; dustVelocityY *= dustVelocity; - int dust = Dust.NewDust(new Vector2(dustPositionX, dustPositionY), scale, scale, 173, 0f, 0f, 100, default, 5f); + int dust = Dust.NewDust(new Vector2(dustPositionX, dustPositionY), scale, scale, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 5f); Main.dust[dust].noGravity = true; - Main.dust[dust].position.X = teleportLocation.X; - Main.dust[dust].position.Y = teleportLocation.Y; + Main.dust[dust].position.X = targetVector.X; + Main.dust[dust].position.Y = targetVector.Y; Main.dust[dust].position.X += Main.rand.Next(-10, 11); Main.dust[dust].position.Y += Main.rand.Next(-10, 11); Main.dust[dust].velocity.X = dustVelocityX; @@ -1011,7 +1009,7 @@ namespace CalamityMod.NPCs.DevourerofGods DropHelper.DropBags(npc); - DropHelper.DropItem(npc, ModContent.ItemType(), 8, 14); + DropHelper.DropItem(npc, ModContent.ItemType(), 5, 15); DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !CalamityWorld.downedDoG); DropHelper.DropResidentEvilAmmo(npc, CalamityWorld.downedDoG, 6, 3, 2); @@ -1169,7 +1167,7 @@ namespace CalamityMod.NPCs.DevourerofGods npc.position.Y = npc.position.Y - (npc.height / 2); for (int num621 = 0; num621 < 15; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -1179,10 +1177,10 @@ namespace CalamityMod.NPCs.DevourerofGods } for (int num623 = 0; num623 < 30; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } @@ -1203,41 +1201,21 @@ namespace CalamityMod.NPCs.DevourerofGods player.KillMe(PlayerDeathReason.ByCustomReason(player.name + "'s essence was consumed by the devourer."), 1000.0, 0, false); } - // TODO: don't talk if the player has iframes - if (player.immuneTime > 0 || player.immune) - return; - - int num = Main.rand.Next(5); - string key = "Mods.CalamityMod.EdgyBossText3"; - if (num == 0) - { - key = "Mods.CalamityMod.EdgyBossText3"; - } - else if (num == 1) - { - key = "Mods.CalamityMod.EdgyBossText4"; - } - else if (num == 2) - { - key = "Mods.CalamityMod.EdgyBossText5"; - } - else if (num == 3) - { - key = "Mods.CalamityMod.EdgyBossText6"; - } - else if (num == 4) - { - key = "Mods.CalamityMod.EdgyBossText7"; - } - Color messageColor = Color.Cyan; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } + if (player.Calamity().dogTextCooldown <= 0) + { + string text = Utils.SelectRandom(Main.rand, new string[] + { + "Mods.CalamityMod.EdgyBossText3", + "Mods.CalamityMod.EdgyBossText4", + "Mods.CalamityMod.EdgyBossText5", + "Mods.CalamityMod.EdgyBossText6", + "Mods.CalamityMod.EdgyBossText7" + }); + Color messageColor = Color.Cyan; + Rectangle location = new Microsoft.Xna.Framework.Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); + CombatText.NewText(location, messageColor, Language.GetTextValue(text), true); + player.Calamity().dogTextCooldown = 60; + } } } } diff --git a/NPCs/DevourerofGods/DevourerofGodsTail.cs b/NPCs/DevourerofGods/DevourerofGodsTail.cs index d6706e9658..ec3715cd16 100644 --- a/NPCs/DevourerofGods/DevourerofGodsTail.cs +++ b/NPCs/DevourerofGods/DevourerofGodsTail.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -206,7 +207,7 @@ namespace CalamityMod.NPCs.DevourerofGods npc.position.Y = npc.position.Y - (float)(npc.height / 2); for (int num621 = 0; num621 < 10; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -216,10 +217,10 @@ namespace CalamityMod.NPCs.DevourerofGods } for (int num623 = 0; num623 < 20; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } @@ -252,29 +253,18 @@ namespace CalamityMod.NPCs.DevourerofGods player.AddBuff(ModContent.BuffType(), 240, true); player.AddBuff(BuffID.Frostburn, 180, true); - // TODO: don't talk if the player has iframes - if (player.immuneTime > 0 || player.immune) - return; - - int num = Main.rand.Next(2); - string key = "Mods.CalamityMod.EdgyBossText8"; - if (num == 0) - { - key = "Mods.CalamityMod.EdgyBossText8"; - } - else if (num == 1) - { - key = "Mods.CalamityMod.EdgyBossText9"; - } - Color messageColor = Color.Cyan; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } + if (player.Calamity().dogTextCooldown <= 0) + { + string text = Utils.SelectRandom(Main.rand, new string[] + { + "Mods.CalamityMod.EdgyBossText8", + "Mods.CalamityMod.EdgyBossText9" + }); + Color messageColor = Color.Cyan; + Rectangle location = new Microsoft.Xna.Framework.Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); + CombatText.NewText(location, messageColor, Language.GetTextValue(text), true); + player.Calamity().dogTextCooldown = 60; + } } } } diff --git a/NPCs/DevourerofGods/DevourerofGodsTail2.cs b/NPCs/DevourerofGods/DevourerofGodsTail2.cs index b30a865677..7f29baaf87 100644 --- a/NPCs/DevourerofGods/DevourerofGodsTail2.cs +++ b/NPCs/DevourerofGods/DevourerofGodsTail2.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System.IO; @@ -189,7 +190,7 @@ namespace CalamityMod.NPCs.DevourerofGods npc.position.Y = npc.position.Y - (float)(npc.height / 2); for (int num621 = 0; num621 < 10; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -199,10 +200,10 @@ namespace CalamityMod.NPCs.DevourerofGods } for (int num623 = 0; num623 < 20; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } diff --git a/NPCs/DevourerofGods/DevourerofGodsTailS.cs b/NPCs/DevourerofGods/DevourerofGodsTailS.cs index 0efaec6923..7bbc4a6bd5 100644 --- a/NPCs/DevourerofGods/DevourerofGodsTailS.cs +++ b/NPCs/DevourerofGods/DevourerofGodsTailS.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System.IO; @@ -286,7 +287,7 @@ namespace CalamityMod.NPCs.DevourerofGods npc.position.Y = npc.position.Y - (float)(npc.height / 2); for (int num621 = 0; num621 < 10; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -296,10 +297,10 @@ namespace CalamityMod.NPCs.DevourerofGods } for (int num623 = 0; num623 < 20; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } @@ -332,29 +333,18 @@ namespace CalamityMod.NPCs.DevourerofGods player.AddBuff(ModContent.BuffType(), 240, true); player.AddBuff(BuffID.Frostburn, 180, true); - // TODO: don't talk if the player has iframes - if (player.immune || player.immuneTime > 0) - return; - - int num = Main.rand.Next(2); - string key = "Mods.CalamityMod.EdgyBossText8"; - if (num == 0) - { - key = "Mods.CalamityMod.EdgyBossText8"; - } - else if (num == 1) - { - key = "Mods.CalamityMod.EdgyBossText9"; - } - Color messageColor = Color.Cyan; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } + if (player.Calamity().dogTextCooldown <= 0) + { + string text = Utils.SelectRandom(Main.rand, new string[] + { + "Mods.CalamityMod.EdgyBossText8", + "Mods.CalamityMod.EdgyBossText9" + }); + Color messageColor = Color.Cyan; + Rectangle location = new Microsoft.Xna.Framework.Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); + CombatText.NewText(location, messageColor, Language.GetTextValue(text), true); + player.Calamity().dogTextCooldown = 60; + } } } } diff --git a/NPCs/GreatSandShark/GreatSandShark.cs b/NPCs/GreatSandShark/GreatSandShark.cs index 2f9341f382..ebc05a0905 100644 --- a/NPCs/GreatSandShark/GreatSandShark.cs +++ b/NPCs/GreatSandShark/GreatSandShark.cs @@ -53,6 +53,7 @@ namespace CalamityMod.NPCs.GreatSandShark npc.buffImmune[BuffID.StardustMinionBleed] = false; npc.buffImmune[BuffID.DryadsWardDebuff] = false; npc.buffImmune[BuffID.Oiled] = false; + npc.buffImmune[BuffID.BetsysCurse] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; @@ -62,6 +63,7 @@ namespace CalamityMod.NPCs.GreatSandShark npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.behindTiles = true; @@ -627,7 +629,7 @@ namespace CalamityMod.NPCs.GreatSandShark { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { diff --git a/NPCs/HiveMind/DankCreeper.cs b/NPCs/HiveMind/DankCreeper.cs index 07f0ca0afc..6a31dc6592 100644 --- a/NPCs/HiveMind/DankCreeper.cs +++ b/NPCs/HiveMind/DankCreeper.cs @@ -28,7 +28,6 @@ namespace CalamityMod.NPCs.HiveMind } npc.aiStyle = -1; aiType = -1; - animationType = 10; npc.knockBackResist = CalamityWorld.bossRushActive ? 0f : 0.3f; npc.noGravity = true; npc.noTileCollide = true; diff --git a/NPCs/Leviathan/AquaticAberration.cs b/NPCs/Leviathan/AquaticAberration.cs index 9418c4ebbb..538e54ae82 100644 --- a/NPCs/Leviathan/AquaticAberration.cs +++ b/NPCs/Leviathan/AquaticAberration.cs @@ -20,8 +20,8 @@ namespace CalamityMod.NPCs.Leviathan { npc.aiStyle = -1; npc.damage = 55; - npc.width = 70; - npc.height = 40; + npc.width = 50; + npc.height = 50; npc.defense = 14; npc.lifeMax = 1600; if (CalamityWorld.bossRushActive) @@ -184,13 +184,13 @@ namespace CalamityMod.NPCs.Leviathan { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/Leviathan/LevSky.cs b/NPCs/Leviathan/LevSky.cs index be25f20171..f75b1fddb7 100644 --- a/NPCs/Leviathan/LevSky.cs +++ b/NPCs/Leviathan/LevSky.cs @@ -26,21 +26,27 @@ namespace CalamityMod.NPCs.Leviathan private float GetIntensity() { - if (this.UpdateLIndex()) + if (UpdateLIndex()) { float x = 0f; - if (this.LevIndex != -1) + if (LevIndex != -1) { - x = Vector2.Distance(Main.player[Main.myPlayer].Center, Main.npc[this.LevIndex].Center); + x = Vector2.Distance(Main.player[Main.myPlayer].Center, Main.npc[LevIndex].Center); } - return 1f - Utils.SmoothStep(3000f, 6000f, x); + + float spawnAnimationTimer = 180f; + float intensityScalar = 1f; + if (Main.npc[CalamityGlobalNPC.leviathan].Calamity().newAI[3] < spawnAnimationTimer) + intensityScalar = MathHelper.Lerp(0f, intensityScalar, Main.npc[CalamityGlobalNPC.leviathan].Calamity().newAI[3] / spawnAnimationTimer); + + return (1f - Utils.SmoothStep(3000f, 6000f, x)) * intensityScalar; } return 0f; } public override Color OnTileColor(Color inColor) { - float intensity = this.GetIntensity(); + float intensity = GetIntensity(); return new Color(Vector4.Lerp(new Vector4(0.5f, 0.8f, 1f, 1f), inColor.ToVector4(), 1f - intensity)); } @@ -60,7 +66,6 @@ namespace CalamityMod.NPCs.Leviathan break; } } - //this.DoGIndex = DoGIndex; return LevIndex != -1; } @@ -68,7 +73,7 @@ namespace CalamityMod.NPCs.Leviathan { if (maxDepth >= 0 && minDepth < 0) { - float intensity = this.GetIntensity(); + float intensity = GetIntensity(); spriteBatch.Draw(Main.blackTileTexture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), new Color(0, 0, 15) * intensity); } } diff --git a/NPCs/Leviathan/Leviathan.cs b/NPCs/Leviathan/Leviathan.cs index 3fd0f5cfe7..3922b8cd9f 100644 --- a/NPCs/Leviathan/Leviathan.cs +++ b/NPCs/Leviathan/Leviathan.cs @@ -23,20 +23,21 @@ namespace CalamityMod.NPCs.Leviathan [AutoloadBossHead] public class Leviathan : ModNPC { - private bool altTextureSwap = false; + int counter = 0; + bool initialised = false; public override void SetStaticDefaults() { DisplayName.SetDefault("The Leviathan"); - Main.npcFrameCount[npc.type] = 3; + Main.npcFrameCount[npc.type] = 6; } public override void SetDefaults() { npc.npcSlots = 20f; npc.damage = 90; - npc.width = 850; - npc.height = 450; + npc.width = 650; + npc.height = 300; npc.defense = 40; npc.DR_NERD(0.35f); npc.LifeMaxNERB(69000, 90700, 7000000); @@ -45,7 +46,8 @@ namespace CalamityMod.NPCs.Leviathan npc.knockBackResist = 0f; npc.aiStyle = -1; aiType = -1; - npc.value = Item.buyPrice(0, 15, 0, 0); + npc.Opacity = 0f; + npc.value = Item.buyPrice(0, 15, 0, 0); for (int k = 0; k < npc.buffImmune.Length; k++) { npc.buffImmune[k] = true; @@ -68,6 +70,7 @@ namespace CalamityMod.NPCs.Leviathan npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; @@ -87,18 +90,22 @@ namespace CalamityMod.NPCs.Leviathan public override void SendExtraAI(BinaryWriter writer) { - writer.Write(altTextureSwap); writer.Write(npc.dontTakeDamage); + writer.Write(counter); + writer.Write(initialised); } public override void ReceiveExtraAI(BinaryReader reader) { - altTextureSwap = reader.ReadBoolean(); npc.dontTakeDamage = reader.ReadBoolean(); + counter = reader.ReadInt32(); + initialised = reader.ReadBoolean(); } public override void AI() { + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + CalamityGlobalNPC.leviathan = npc.whoAmI; bool death = CalamityWorld.death || CalamityWorld.bossRushActive; @@ -106,47 +113,58 @@ namespace CalamityMod.NPCs.Leviathan bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; Vector2 vector = npc.Center; + // Is in spawning animation + float spawnAnimationTime = 180f; + bool spawnAnimation = calamityGlobalNPC.newAI[3] < spawnAnimationTime; + + // Don't do damage during spawn animation + npc.damage = npc.defDamage; + if (spawnAnimation) + npc.damage = 0; + // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; // Phases - bool phase2 = (lifeRatio < 0.5f && expertMode) || death; + bool phase2 = (lifeRatio < 0.7f && expertMode) || death; + bool phase3 = lifeRatio < 0.4f; + bool phase4 = lifeRatio < 0.2f; npc.spriteDirection = (npc.direction > 0) ? 1 : -1; bool sirenAlive = false; if (CalamityGlobalNPC.siren != -1) - { sirenAlive = Main.npc[CalamityGlobalNPC.siren].active; - } - int soundChoice = Main.rand.Next(3); - int soundChoiceRage = 92; - if (soundChoice == 0) - { - soundChoice = 38; - } - else if (soundChoice == 1) - { - soundChoice = 39; - } - else - { - soundChoice = 40; - } - if (Main.rand.NextBool(600)) - { - Main.PlaySound(29, (int)npc.position.X, (int)npc.position.Y, (sirenAlive && !death) ? soundChoice : soundChoiceRage); - } + if (CalamityGlobalNPC.siren != -1) + { + if (Main.npc[CalamityGlobalNPC.siren].active) + { + if (Main.npc[CalamityGlobalNPC.siren].damage == 0) + { + sirenAlive = false; + } + } + } + + int soundChoiceRage = 92; + int soundChoice = Utils.SelectRandom(Main.rand, new int[] + { + 38, + 39, + 40 + }); + + if (Main.rand.NextBool(600) && !spawnAnimation) + Main.PlaySound(SoundID.Zombie, (int)npc.Center.X, (int)npc.Center.Y, (sirenAlive && !death) ? soundChoice : soundChoiceRage); if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) - { npc.TargetClosest(true); - } + Player player = Main.player[npc.target]; bool flag6 = player.position.Y < 800f || player.position.Y > Main.worldSurface * 16.0 || (player.position.X > 6400f && player.position.X < (Main.maxTilesX * 16 - 6400)); - npc.dontTakeDamage = flag6 && !CalamityWorld.bossRushActive; + npc.dontTakeDamage = (flag6 && !CalamityWorld.bossRushActive) || spawnAnimation; if (!player.active || player.dead || Vector2.Distance(player.Center, vector) > 5600f) { @@ -181,17 +199,36 @@ namespace CalamityMod.NPCs.Leviathan npc.ai[2] = 0f; npc.netUpdate = true; } + return; } } else { - if (npc.ai[0] == 0f) + // Slowly drift up when spawning + if (spawnAnimation) + { + float minSpawnVelocity = 0.4f; + float maxSpawnVelocity = 4f; + float velocityY = maxSpawnVelocity - MathHelper.Lerp(minSpawnVelocity, maxSpawnVelocity, calamityGlobalNPC.newAI[3] / spawnAnimationTime); + npc.velocity = new Vector2(0f, -velocityY); + + if (calamityGlobalNPC.newAI[3] == 10f) + Main.PlaySound(SoundID.Zombie, (int)npc.Center.X, (int)npc.Center.Y, soundChoiceRage); + + npc.Opacity = MathHelper.Clamp(calamityGlobalNPC.newAI[3] / spawnAnimationTime, 0f, 1f); + + calamityGlobalNPC.newAI[3] += 1f; + + return; + } + + if (npc.ai[0] == 0f) { npc.TargetClosest(true); - float num412 = sirenAlive ? 3.5f : 7f; - float num413 = sirenAlive ? 0.1f : 0.2f; - if (expertMode && !sirenAlive) + float num412 = (sirenAlive && !phase4) ? 3.5f : 7f; + float num413 = (sirenAlive && !phase4) ? 0.1f : 0.2f; + if (expertMode && (!sirenAlive || phase4)) { num412 += death ? 3.5f : 3.5f * (1f - lifeRatio); num413 += death ? 0.1f : 0.1f * (1f - lifeRatio); @@ -204,12 +241,10 @@ namespace CalamityMod.NPCs.Leviathan int num414 = 1; if (npc.position.X + (npc.width / 2) < player.position.X + player.width) - { num414 = -1; - } Vector2 vector40 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num415 = player.position.X + (player.width / 2) + (num414 * 800) - vector40.X; + float num415 = player.position.X + (player.width / 2) + (num414 * ((sirenAlive && !phase4) ? 1000f : 800f)) - vector40.X; float num416 = player.position.Y + (player.height / 2) - vector40.Y; float num417 = (float)Math.Sqrt(num415 * num415 + num416 * num416); num417 = num412 / num417; @@ -250,7 +285,11 @@ namespace CalamityMod.NPCs.Leviathan } npc.ai[1] += 1f; - if (npc.ai[1] >= 240f) + float phaseTimer = 240f; + if (!sirenAlive || phase4) + phaseTimer -= 120f * (1f - lifeRatio); + + if (npc.ai[1] >= phaseTimer) { npc.ai[0] = 1f; npc.ai[1] = 0f; @@ -263,35 +302,40 @@ namespace CalamityMod.NPCs.Leviathan if (!player.dead) { npc.ai[2] += 1f; - if (!sirenAlive || death) + if (!sirenAlive || death || phase4) npc.ai[2] += 2f; } if (npc.ai[2] >= 75f) { npc.ai[2] = 0f; - vector40 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f + 160f); + vector40 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f + 20f); num415 = player.position.X + (player.width / 2) - vector40.X; num416 = player.position.Y + (player.height / 2) - vector40.Y; if (Main.netMode != NetmodeID.MultiplayerClient) { - float num418 = (sirenAlive && !death) ? 13.5f : 16f; + float num418 = (sirenAlive && !phase4 && !death) ? 13.5f : 16f; int num419 = 40; int num420 = ModContent.ProjectileType(); + if (expertMode) { - num418 = (sirenAlive && !death) ? 14f : 17f; - num419 = 33; + num418 = (sirenAlive && !phase4 && !death) ? 14f : 17f; + num419 = 33; } + if (npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { num418 = 22f; - } - if (CalamityWorld.bossRushActive) - { + + if (!sirenAlive || phase4) + { + num418 += 3f * (1f - lifeRatio); + num419 += expertMode ? 3 : 4; + } + + if (CalamityWorld.bossRushActive) num418 *= 1.5f; - } num417 = (float)Math.Sqrt(num415 * num415 + num416 * num416); num417 = num418 / num417; @@ -308,45 +352,52 @@ namespace CalamityMod.NPCs.Leviathan { npc.TargetClosest(true); - Vector2 vector119 = new Vector2(npc.position.X + (npc.width / 2) + (Main.rand.Next(20) * npc.direction), npc.position.Y + npc.height * 0.8f); + Vector2 vector119 = new Vector2(npc.position.X + (npc.width / 2), npc.position.Y + npc.height * 0.8f); Vector2 vector120 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); float num1058 = player.position.X + (player.width / 2) - vector120.X; float num1059 = player.position.Y + (player.height / 2) - vector120.Y; float num1060 = (float)Math.Sqrt(num1058 * num1058 + num1059 * num1059); - npc.ai[1] += revenge ? 2f : 1f; - if (!sirenAlive || death) - { - npc.ai[1] += 2.5f; - } + npc.ai[1] += 1f; + int num638 = 0; + for (int num639 = 0; num639 < 255; num639++) + { + if (Main.player[num639].active && !Main.player[num639].dead && (vector - Main.player[num639].Center).Length() < 1000f) + num638++; + } + npc.ai[1] += num638 / 2; bool flag103 = false; - if (npc.ai[1] > 80f) + float num640 = 60f; + if (!sirenAlive || phase4) + num640 -= 40f * (1f - lifeRatio); + + if (npc.ai[1] > num640) { npc.ai[1] = 0f; npc.ai[2] += 1f; flag103 = true; } - int spawnLimit = sirenAlive ? 2 : 4; + int spawnLimit = (sirenAlive && !phase4) ? 2 : 4; bool spawnParasea = NPC.CountNPCS(ModContent.NPCType()) < spawnLimit; - bool spawnAberration = !sirenAlive && !NPC.AnyNPCs(ModContent.NPCType()); + bool spawnAberration = (!sirenAlive || phase4) && !NPC.AnyNPCs(ModContent.NPCType()); if (flag103 && (spawnParasea || spawnAberration)) { - Main.PlaySound(29, (int)npc.position.X, (int)npc.position.Y, soundChoice); + Main.PlaySound(SoundID.Zombie, (int)npc.Center.X, (int)npc.Center.Y, soundChoice); if (Main.netMode != NetmodeID.MultiplayerClient) { int type = spawnAberration ? ModContent.NPCType() : ModContent.NPCType(); - NPC.NewNPC((int)vector119.X, (int)vector119.Y, type, 0, 0f, 0f, 0f, 0f, 255); + NPC.NewNPC((int)vector119.X, (int)vector119.Y, type); } } - if (num1060 > 1200f) + if (num1060 > ((sirenAlive && !phase4) ? 1000f : 800f)) { - float num1063 = sirenAlive ? 7f : 8f; - float num1064 = sirenAlive ? 0.05f : 0.065f; - if (expertMode && !sirenAlive) + float num1063 = (sirenAlive && !phase4) ? 7f : 8f; + float num1064 = (sirenAlive && !phase4) ? 0.05f : 0.065f; + if (expertMode && (!sirenAlive || phase4)) { num1063 += death ? 4f : 4f * (1f - lifeRatio); num1064 += death ? 0.03f : 0.03f * (1f - lifeRatio); @@ -367,45 +418,35 @@ namespace CalamityMod.NPCs.Leviathan { npc.velocity.X += num1064; if (npc.velocity.X < 0f && num1058 > 0f) - { npc.velocity.X += num1064; - } } else if (npc.velocity.X > num1058) { npc.velocity.X -= num1064; if (npc.velocity.X > 0f && num1058 < 0f) - { npc.velocity.X -= num1064; - } } if (npc.velocity.Y < num1059) { npc.velocity.Y += num1064; if (npc.velocity.Y < 0f && num1059 > 0f) - { npc.velocity.Y += num1064; - } } else if (npc.velocity.Y > num1059) { npc.velocity.Y -= num1064; if (npc.velocity.Y > 0f && num1059 < 0f) - { npc.velocity.Y -= num1064; - } } } else - { npc.velocity *= 0.9f; - } npc.spriteDirection = npc.direction; - if (npc.ai[2] > (sirenAlive ? 2f : 3f)) + if (npc.ai[2] > ((sirenAlive && !phase4) ? 2f : 3f)) { - npc.ai[0] = phase2 ? 2f : 0f; + npc.ai[0] = (((phase2 || phase3) && !sirenAlive) || phase4) ? 2f : 0f; npc.ai[1] = 0f; npc.ai[2] = 0f; npc.netUpdate = true; @@ -423,14 +464,17 @@ namespace CalamityMod.NPCs.Leviathan return; } - float chargeDistance = sirenAlive ? 1100f : 900f; + float chargeDistance = (sirenAlive && !phase4) ? 1100f : 900f; + if (!sirenAlive || phase4) + chargeDistance -= 250f * (1f - lifeRatio); + if (npc.ai[1] % 2f == 0f) { int num24 = 7; for (int j = 0; j < num24; j++) { - Vector2 arg_E1C_0 = (Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f).RotatedBy((j - (num24 / 2 - 1)) * 3.1415926535897931 / (float)num24, default) + vector; - Vector2 vector4 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * Main.rand.Next(3, 8); + Vector2 arg_E1C_0 = (Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f).RotatedBy((j - (num24 / 2 - 1)) * MathHelper.Pi / num24) + vector; + Vector2 vector4 = ((float)(Main.rand.NextDouble() * MathHelper.Pi) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); int num25 = Dust.NewDust(arg_E1C_0 + vector4, 0, 0, 172, vector4.X * 2f, vector4.Y * 2f, 100, default, 1.4f); Main.dust[num25].noGravity = true; Main.dust[num25].noLight = true; @@ -444,19 +488,17 @@ namespace CalamityMod.NPCs.Leviathan { npc.ai[1] += 1f; npc.ai[2] = 0f; + float num1044 = revenge ? 20f : 18f; - if (revenge && !sirenAlive) - { - num1044 += death ? 4f : 4f * (1f - lifeRatio); - } + + if (revenge && (!sirenAlive || phase4)) + num1044 += death ? 6f : 6f * (1f - lifeRatio); + if (npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { num1044 += 4f; - } + if (CalamityWorld.bossRushActive) - { num1044 *= 1.25f; - } Vector2 vector117 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); float num1045 = player.position.X + (player.width / 2) - vector117.X; @@ -466,13 +508,13 @@ namespace CalamityMod.NPCs.Leviathan npc.velocity.X = num1045 * num1047; npc.velocity.Y = num1046 * num1047; npc.spriteDirection = npc.direction; - Main.PlaySound(29, (int)npc.position.X, (int)npc.position.Y, soundChoiceRage); + Main.PlaySound(SoundID.Zombie, (int)npc.Center.X, (int)npc.Center.Y, soundChoiceRage); return; } float num1048 = revenge ? 7.5f : 6.5f; float num1049 = revenge ? 0.12f : 0.11f; - if (revenge && !sirenAlive) + if (revenge && (!sirenAlive || phase4)) { num1048 += death ? 6f : 6f * (1f - lifeRatio); num1049 += death ? 0.1f : 0.1f * (1f - lifeRatio); @@ -537,7 +579,7 @@ namespace CalamityMod.NPCs.Leviathan npc.velocity *= 0.9f; float num1052 = revenge ? 0.11f : 0.1f; - if (revenge && !sirenAlive) + if (revenge && (!sirenAlive || phase4)) { npc.velocity *= death ? 0.81f : MathHelper.Lerp(0.81f, 1f, lifeRatio); num1052 += death ? 0.1f : 0.1f * (1f - lifeRatio); @@ -557,36 +599,37 @@ namespace CalamityMod.NPCs.Leviathan { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); + npc.position.X = npc.position.X + (npc.width / 2); + npc.position.Y = npc.position.Y + (npc.height / 2); + npc.position.X = npc.position.X - (npc.width / 2); + npc.position.Y = npc.position.Y - (npc.height / 2); for (int num621 = 0; num621 < 40; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 5, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, DustID.Blood, 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; + Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } for (int num623 = 0; num623 < 70; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 5, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, DustID.Blood, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 5, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, DustID.Blood, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - float randomSpread = (float)(Main.rand.Next(-200, 200) / 100); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Leviathangib1"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Leviathangib2"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Leviathangib3"), 1f); + float randomSpread = Main.rand.Next(-200, 200) / 100; + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/LeviathanGores/LeviGore"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/LeviathanGores/LeviGore2"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/LeviathanGores/LeviGore3"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/LeviathanGores/LeviGore4"), 1f); } } @@ -598,6 +641,9 @@ namespace CalamityMod.NPCs.Leviathan // The Leviathan runs the same loot code as Anahita, but only if she dies last. public override void NPCLoot() { + //Trophy dropped regardless of Anahita, precedent of Twins + DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); + if (!NPC.AnyNPCs(ModContent.NPCType())) DropSirenLeviLoot(npc); } @@ -607,7 +653,6 @@ namespace CalamityMod.NPCs.Leviathan { DropHelper.DropBags(npc); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !CalamityWorld.downedLeviathan); DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !CalamityWorld.downedLeviathan); DropHelper.DropResidentEvilAmmo(npc, CalamityWorld.downedLeviathan, 4, 2, 1); @@ -628,6 +673,7 @@ namespace CalamityMod.NPCs.Leviathan // Vanity DropHelper.DropItemChance(npc, ModContent.ItemType(), 7); + DropHelper.DropItemChance(npc, ModContent.ItemType(), 7); // Fishing DropHelper.DropItemChance(npc, ItemID.HotlineFishingHook, 10); @@ -656,46 +702,64 @@ namespace CalamityMod.NPCs.Leviathan public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) { Texture2D texture = Main.npcTexture[npc.type]; - Texture2D texture2 = ModContent.GetTexture("CalamityMod/NPCs/Leviathan/LeviathanTexTwo"); - Texture2D texture3 = ModContent.GetTexture("CalamityMod/NPCs/Leviathan/LeviathanAltTexOne"); - Texture2D texture4 = ModContent.GetTexture("CalamityMod/NPCs/Leviathan/LeviathanAltTexTwo"); - if (npc.ai[0] == 1f) + if (npc.ai[0] == 1f || npc.Calamity().newAI[3] < 180f) { - if (!altTextureSwap) - { - CalamityMod.DrawTexture(spriteBatch, texture, 0, npc, drawColor, true); - } - else - { - CalamityMod.DrawTexture(spriteBatch, texture2, 0, npc, drawColor, true); - } + texture = Main.npcTexture[npc.type]; } else { - if (!altTextureSwap) - { - CalamityMod.DrawTexture(spriteBatch, texture3, 0, npc, drawColor, true); - } - else - { - CalamityMod.DrawTexture(spriteBatch, texture4, 0, npc, drawColor, true); - } + texture = ModContent.GetTexture("CalamityMod/NPCs/Leviathan/LeviathanAttack"); } + int verticalFrameCount = 3; + int horizontalFrameCount = 2; + int height = texture.Height / verticalFrameCount; + int width = texture.Width / horizontalFrameCount; + SpriteEffects spriteEffects = SpriteEffects.FlipHorizontally; + float xOffset = -50f; + if (npc.spriteDirection == -1) + { + spriteEffects = SpriteEffects.None; + xOffset *= -1f; + } + Main.spriteBatch.Draw(texture, npc.Center - Main.screenPosition + new Vector2(xOffset, npc.gfxOffY), npc.frame, npc.GetAlpha(drawColor), npc.rotation, new Vector2(width / 2f, height / 2f), npc.scale, spriteEffects, 0f); return false; } public override void FindFrame(int frameHeight) { - npc.frameCounter += 1.0; - if (npc.frameCounter > 6.0) + Texture2D texture = Main.npcTexture[npc.type]; + int verticalFrameCount = 3; + int horizontalFrameCount = 2; + int height = texture.Height / verticalFrameCount; + int width = texture.Width / horizontalFrameCount; + int timeBetweenFrames = 8; + + if (!initialised) { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; + counter = verticalFrameCount; + npc.frameCounter = timeBetweenFrames; + initialised = true; } - if (npc.frame.Y >= frameHeight * 3) + + // Ensure width and height are set. + npc.frame.Width = width; + npc.frame.Height = height; + npc.frameCounter++; + if (npc.frameCounter >= timeBetweenFrames) { + npc.frame.X = counter >= verticalFrameCount ? width + 3 : 0; + if (counter == verticalFrameCount) + npc.frame.Y = 0; + else + npc.frame.Y += height; + npc.frameCounter = 0; + counter++; + } + if (counter == Main.npcFrameCount[npc.type]) + { + counter = 1; npc.frame.Y = 0; - altTextureSwap = !altTextureSwap; + npc.frame.X = 0; } } diff --git a/NPCs/Leviathan/Leviathan.png b/NPCs/Leviathan/Leviathan.png index 5bd4cf58e8..6bd923b971 100644 Binary files a/NPCs/Leviathan/Leviathan.png and b/NPCs/Leviathan/Leviathan.png differ diff --git a/NPCs/Leviathan/LeviathanAltTexOne.png b/NPCs/Leviathan/LeviathanAltTexOne.png deleted file mode 100644 index 9f98f74ae9..0000000000 Binary files a/NPCs/Leviathan/LeviathanAltTexOne.png and /dev/null differ diff --git a/NPCs/Leviathan/LeviathanAltTexTwo.png b/NPCs/Leviathan/LeviathanAltTexTwo.png deleted file mode 100644 index 1c8019853c..0000000000 Binary files a/NPCs/Leviathan/LeviathanAltTexTwo.png and /dev/null differ diff --git a/NPCs/Leviathan/LeviathanAttack.png b/NPCs/Leviathan/LeviathanAttack.png new file mode 100644 index 0000000000..650e015b7a Binary files /dev/null and b/NPCs/Leviathan/LeviathanAttack.png differ diff --git a/NPCs/Leviathan/LeviathanOpenMouth_UNUSED.png b/NPCs/Leviathan/LeviathanOpenMouth_UNUSED.png new file mode 100644 index 0000000000..34c3c55b6a Binary files /dev/null and b/NPCs/Leviathan/LeviathanOpenMouth_UNUSED.png differ diff --git a/NPCs/Leviathan/LeviathanStart.cs b/NPCs/Leviathan/LeviathanStart.cs index 794bd507c7..d0414e331f 100644 --- a/NPCs/Leviathan/LeviathanStart.cs +++ b/NPCs/Leviathan/LeviathanStart.cs @@ -1,5 +1,9 @@ +using CalamityMod.CalPlayer; using CalamityMod.Items.Accessories; using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -18,21 +22,34 @@ namespace CalamityMod.NPCs.Leviathan npc.aiStyle = -1; aiType = -1; npc.damage = 0; - npc.width = 70; //324 - npc.height = 70; //216 + npc.width = 100; + npc.height = 100; npc.defense = 0; - npc.lifeMax = 3000; + npc.lifeMax = 1000; npc.knockBackResist = 0f; + npc.Opacity = 0f; npc.noGravity = true; + npc.dontTakeDamage = true; npc.chaseable = false; npc.HitSound = SoundID.NPCHit1; - npc.rarity = 2; + npc.DeathSound = null; + npc.rarity = 2; Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); if (calamityModMusic != null) music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/SirenLure"); } - public override void FindFrame(int frameHeight) + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(npc.dontTakeDamage); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + npc.dontTakeDamage = reader.ReadBoolean(); + } + + public override void FindFrame(int frameHeight) { npc.frameCounter += 0.1f; npc.frameCounter %= Main.npcFrameCount[npc.type]; @@ -43,21 +60,55 @@ namespace CalamityMod.NPCs.Leviathan public override void AI() { npc.TargetClosest(true); - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.55f, 0.25f, 0f); - for (int num569 = 0; num569 < 200; num569++) - { - if (Main.npc[num569].active && Main.npc[num569].boss) - { - npc.active = false; - } - } + + float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; + npc.direction = playerLocation < 0f ? 1 : -1; + npc.spriteDirection = npc.direction; + + if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) < 560f) + { + if (npc.ai[0] < 90f) + npc.ai[0] += 1f; + } + else if (npc.ai[0] > 0f) + npc.ai[0] -= 1f; + + npc.dontTakeDamage = npc.ai[0] != 90f; + + npc.Opacity = MathHelper.Clamp(npc.ai[0] / 90f, 0f, 1f); + + Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 0f, 0f, 0.8f * npc.Opacity); + + if (CalamityPlayer.areThereAnyDamnBosses) + npc.active = false; } - public override float SpawnChance(NPCSpawnInfo spawnInfo) + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (npc.spriteDirection == 1) + spriteEffects = SpriteEffects.FlipHorizontally; + + Texture2D texture2D15 = Main.npcTexture[npc.type]; + Vector2 vector11 = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / 2); + + Vector2 vector43 = npc.Center - Main.screenPosition; + vector43 -= new Vector2(texture2D15.Width, texture2D15.Height) * npc.scale / 2f; + vector43 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); + spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); + + texture2D15 = ModContent.GetTexture("CalamityMod/NPCs/Leviathan/LeviathanStartGlow"); + + spriteBatch.Draw(texture2D15, vector43, npc.frame, Color.White, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + + return false; + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) { if (spawnInfo.playerSafe || NPC.AnyNPCs(NPCID.DukeFishron) || - NPC.AnyNPCs(ModContent.NPCType()) || + NPC.AnyNPCs(npc.type) || NPC.AnyNPCs(ModContent.NPCType()) || NPC.AnyNPCs(ModContent.NPCType()) || spawnInfo.player.Calamity().ZoneSulphur || @@ -76,17 +127,11 @@ namespace CalamityMod.NPCs.Leviathan return SpawnCondition.OceanMonster.Chance * 0.4f; } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = 3000; - npc.damage = 0; - } - public override void NPCLoot() { if (CalamityWorld.revenge && Main.rand.NextBool(4)) { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, Main.rand.NextBool(2) ? ModContent.ItemType() : ModContent.ItemType()); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType()); } } @@ -96,18 +141,15 @@ namespace CalamityMod.NPCs.Leviathan { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } else { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 67, hitDirection, -1f, 0, default, 1f); - } if (Main.netMode != NetmodeID.MultiplayerClient) { - NPC.NewNPC((int)npc.Center.X, (int)npc.position.Y + npc.height, ModContent.NPCType(), npc.whoAmI, 0f, 0f, 0f, 0f, 255); + int siren = NPC.NewNPC((int)npc.Center.X, (int)npc.position.Y + npc.height, ModContent.NPCType(), npc.whoAmI); + CalamityUtils.BossAwakenMessage(siren); } } } diff --git a/NPCs/Leviathan/LeviathanStart.png b/NPCs/Leviathan/LeviathanStart.png index 996cec6e05..4cd243b11c 100644 Binary files a/NPCs/Leviathan/LeviathanStart.png and b/NPCs/Leviathan/LeviathanStart.png differ diff --git a/NPCs/Leviathan/LeviathanStartGlow.png b/NPCs/Leviathan/LeviathanStartGlow.png new file mode 100644 index 0000000000..3415ec0eb2 Binary files /dev/null and b/NPCs/Leviathan/LeviathanStartGlow.png differ diff --git a/NPCs/Leviathan/LeviathanTexTwo.png b/NPCs/Leviathan/LeviathanTexTwo.png deleted file mode 100644 index 23779c9d83..0000000000 Binary files a/NPCs/Leviathan/LeviathanTexTwo.png and /dev/null differ diff --git a/NPCs/Leviathan/Leviathan_Head_Boss.png b/NPCs/Leviathan/Leviathan_Head_Boss.png index f8b1338143..640bfa01d0 100644 Binary files a/NPCs/Leviathan/Leviathan_Head_Boss.png and b/NPCs/Leviathan/Leviathan_Head_Boss.png differ diff --git a/NPCs/Leviathan/Parasea.cs b/NPCs/Leviathan/Parasea.cs index cccfd93c34..9611a5fd0b 100644 --- a/NPCs/Leviathan/Parasea.cs +++ b/NPCs/Leviathan/Parasea.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Placeables.Banners; using CalamityMod.World; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -22,8 +23,7 @@ namespace CalamityMod.NPCs.Leviathan npc.noTileCollide = true; npc.canGhostHeal = false; npc.damage = 50; - npc.width = 90; - npc.height = 20; + npc.width = npc.height = 30; npc.defense = 8; npc.lifeMax = 650; if (CalamityWorld.bossRushActive) @@ -63,6 +63,18 @@ namespace CalamityMod.NPCs.Leviathan npc.frame.Y = frame * frameHeight; } + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + Texture2D texture = Main.npcTexture[npc.type]; + int height = texture.Height / Main.npcFrameCount[npc.type]; + int width = texture.Width; + SpriteEffects spriteEffects = SpriteEffects.FlipHorizontally; + if (npc.spriteDirection == -1) + spriteEffects = SpriteEffects.None; + Main.spriteBatch.Draw(texture, npc.Center - Main.screenPosition + new Vector2(0f, npc.gfxOffY), npc.frame, npc.GetAlpha(drawColor), npc.rotation, new Vector2((float)width / 2f, (float)height / 2f), npc.scale, spriteEffects, 0f); + return false; + } + public override void OnHitPlayer(Player player, int damage, bool crit) { player.AddBuff(BuffID.Wet, 60, true); @@ -72,13 +84,13 @@ namespace CalamityMod.NPCs.Leviathan { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/Leviathan/Siren.cs b/NPCs/Leviathan/Siren.cs index d04dc1678d..8bc68e7645 100644 --- a/NPCs/Leviathan/Siren.cs +++ b/NPCs/Leviathan/Siren.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Items.Placeables.Furniture.Trophies; using CalamityMod.Items.TreasureBags; using CalamityMod.Projectiles.Boss; using CalamityMod.World; @@ -16,13 +17,15 @@ namespace CalamityMod.NPCs.Leviathan public class Siren : ModNPC { private bool spawnedLevi = false; - private bool secondClone = false; private bool forceChargeFrames = false; private int frameUsed = 0; + private static Texture2D sirenStabTexture = ModContent.GetTexture("CalamityMod/NPCs/Leviathan/SirenStabbing"); + + //IMPORTANT: Do NOT remove the empty space on the sprites. This is intentional for framing. The sprite is centered and hitbox is fine already. public override void SetStaticDefaults() { - DisplayName.SetDefault("The Siren"); + DisplayName.SetDefault("Anahita"); Main.npcFrameCount[npc.type] = 6; } @@ -33,7 +36,7 @@ namespace CalamityMod.NPCs.Leviathan npc.width = 100; npc.height = 100; npc.defense = 20; - npc.DR_NERD(0.05f); + npc.DR_NERD(0.2f); npc.LifeMaxNERB(27400, 41600, 2600000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); @@ -65,6 +68,7 @@ namespace CalamityMod.NPCs.Leviathan npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; @@ -83,20 +87,22 @@ namespace CalamityMod.NPCs.Leviathan public override void SendExtraAI(BinaryWriter writer) { writer.Write(spawnedLevi); - writer.Write(secondClone); writer.Write(forceChargeFrames); writer.Write(npc.localAI[0]); - writer.Write(frameUsed); + writer.Write(npc.localAI[2]); + writer.Write(npc.localAI[3]); + writer.Write(frameUsed); writer.Write(npc.dontTakeDamage); } public override void ReceiveExtraAI(BinaryReader reader) { spawnedLevi = reader.ReadBoolean(); - secondClone = reader.ReadBoolean(); forceChargeFrames = reader.ReadBoolean(); npc.localAI[0] = reader.ReadSingle(); - frameUsed = reader.ReadInt32(); + npc.localAI[2] = reader.ReadSingle(); + npc.localAI[3] = reader.ReadSingle(); + frameUsed = reader.ReadInt32(); npc.dontTakeDamage = reader.ReadBoolean(); } @@ -106,92 +112,150 @@ namespace CalamityMod.NPCs.Leviathan CalamityGlobalNPC.siren = npc.whoAmI; // Light - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0f, 0.5f, 0.3f); + Lighting.AddLight((int)(npc.Center.X / 16f), (int)(npc.Center.Y / 16f), 0f, 0.5f, 0.3f); // Target if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) npc.TargetClosest(true); + // Check for Leviathan + bool leviAlive = false; + if (CalamityGlobalNPC.leviathan != -1) + leviAlive = Main.npc[CalamityGlobalNPC.leviathan].active; + // Variables Player player = Main.player[npc.target]; bool death = CalamityWorld.death || CalamityWorld.bossRushActive; bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; - Vector2 vector = npc.Center; - Vector2 spawnAt = vector + new Vector2(0f, npc.height / 2f); - bool isNotOcean = player.position.Y < 800f || player.position.Y > Main.worldSurface * 16.0 || (player.position.X > 6400f && player.position.X < (Main.maxTilesX * 16 - 6400)); + bool isNotOcean = player.position.Y < 800f || player.position.Y > Main.worldSurface * 16.0 || (player.position.X > 6400f && player.position.X < (Main.maxTilesX * 16 - 6400)); + float lifeRatio = npc.life / (float)npc.lifeMax; + float bubbleVelocity = CalamityWorld.bossRushActive ? 10f : 5f; + if (!leviAlive) + bubbleVelocity += 1.5f * (1f - lifeRatio); - // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; + npc.damage = npc.defDamage; - // Phases - bool phase2 = lifeRatio < 0.66f || death; - bool phase3 = lifeRatio < 0.33f || (death && lifeRatio < 0.66f); + Vector2 vector = npc.Center; - // Check for Leviathan - bool leviAlive = false; - if (CalamityGlobalNPC.leviathan != -1) - leviAlive = Main.npc[CalamityGlobalNPC.leviathan].active; + // Phases + bool phase2 = lifeRatio < 0.7f; + bool phase3 = lifeRatio < 0.4f; + bool phase4 = lifeRatio < 0.2f; // Spawn Leviathan and Clones, change music if (Main.netMode != NetmodeID.MultiplayerClient) { - if (phase2 || death) + if (phase3) { if (!spawnedLevi) { - if (revenge) - NPC.NewNPC((int)spawnAt.X, (int)spawnAt.Y - 200, ModContent.NPCType()); - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); if (calamityModMusic != null) music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/LeviathanAndSiren"); else music = MusicID.Boss3; - NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); - spawnedLevi = true; - } - } - - // Spawn Clone - if (phase3 && revenge) - { - if (!secondClone) - { - NPC.NewNPC((int)spawnAt.X, (int)spawnAt.Y - 200, ModContent.NPCType()); - secondClone = true; + int levi = NPC.NewNPC((int)vector.X, (int)vector.Y + 480, ModContent.NPCType(), 1); + CalamityUtils.BossAwakenMessage(levi); + spawnedLevi = true; } } } - // Ice Shield - if (npc.ai[3] == 0f && npc.localAI[1] == 0f && Main.netMode != NetmodeID.MultiplayerClient) - { - int num6 = NPC.NewNPC((int)vector.X, (int)vector.Y, ModContent.NPCType(), npc.whoAmI); - npc.ai[3] = num6 + 1; - npc.localAI[1] = -1f; - npc.netUpdate = true; - Main.npc[num6].ai[0] = npc.whoAmI; - Main.npc[num6].netUpdate = true; - } + // Ice Shield + if (npc.localAI[2] < 3f) + { + if (npc.ai[3] == 0f && npc.localAI[1] == 0f && Main.netMode != NetmodeID.MultiplayerClient) + { + int num6 = NPC.NewNPC((int)vector.X, (int)vector.Y, ModContent.NPCType(), npc.whoAmI); + npc.ai[3] = num6 + 1; + npc.localAI[1] = -1f; + npc.localAI[2] += 1f; + npc.netUpdate = true; + Main.npc[num6].ai[0] = npc.whoAmI; + Main.npc[num6].netUpdate = true; + } - int num7 = (int)npc.ai[3] - 1; - if (num7 != -1 && Main.npc[num7].active && Main.npc[num7].type == ModContent.NPCType()) - npc.dontTakeDamage = true; - else - { - npc.dontTakeDamage = isNotOcean && !CalamityWorld.bossRushActive; - npc.ai[3] = 0f; + int num7 = (int)npc.ai[3] - 1; + if (num7 != -1 && Main.npc[num7].active && Main.npc[num7].type == ModContent.NPCType()) + npc.dontTakeDamage = true; + else + { + npc.dontTakeDamage = isNotOcean && !CalamityWorld.bossRushActive; + npc.ai[3] = 0f; - if (npc.localAI[1] == -1f) - npc.localAI[1] = revenge ? 600f : 1200f; - if (npc.localAI[1] > 0f) - npc.localAI[1] -= 1f; - } + if (npc.localAI[1] == -1f) + npc.localAI[1] = 1f; + else + { + switch ((int)npc.localAI[2]) + { + case 1: + if (phase2) + npc.localAI[1] = 0f; + break; + case 2: + if (phase3) + npc.localAI[1] = 0f; + break; + } + } + } + } + else + { + npc.dontTakeDamage = isNotOcean && !CalamityWorld.bossRushActive; - // Alpha - if (isNotOcean) + int num7 = (int)npc.ai[3] - 1; + if (num7 != -1 && Main.npc[num7].active && Main.npc[num7].type == ModContent.NPCType()) + npc.dontTakeDamage = true; + } + + if (phase3) + { + if (CalamityGlobalNPC.leviathan != -1) + { + if (Main.npc[CalamityGlobalNPC.leviathan].active) + { + if (Main.npc[CalamityGlobalNPC.leviathan].life / (float)Main.npc[CalamityGlobalNPC.leviathan].lifeMax >= 0.4f) + { + ChargeRotation(player, vector); + ChargeLocation(player, vector, false, true); + + npc.alpha += 3; + if (npc.alpha >= 255) + npc.alpha = 255; + else + { + for (int k = 0; k < 3; k++) + { + int dust = Dust.NewDust(npc.position, npc.width, npc.height, 172, 0f, 0f, 100, default, 2f); + Main.dust[dust].noGravity = true; + Main.dust[dust].noLight = true; + } + } + + npc.dontTakeDamage = true; + npc.damage = 0; + + if (npc.ai[0] != -1f) + { + npc.ai[0] = -1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.localAI[0] = 0f; + npc.netUpdate = true; + } + + return; + } + } + } + } + + // Alpha + if (isNotOcean) { npc.alpha += 3; if (npc.alpha >= 150) @@ -249,6 +313,7 @@ namespace CalamityMod.NPCs.Leviathan npc.localAI[0] = 0f; npc.netUpdate = true; } + return; } } @@ -260,17 +325,12 @@ namespace CalamityMod.NPCs.Leviathan // Phase switch if (npc.ai[0] == -1f) { - int random = (phase2 && expertMode) ? 3 : 2; - int num871 = Main.rand.Next(random); + int random = (((phase2 || death) && expertMode && !leviAlive) || phase4) ? 4 : 3; + int num618; + do num618 = Main.rand.Next(random); + while (num618 == npc.ai[1] || num618 == 1); - if (num871 == 0) - num871 = phase3 ? 3 : 0; - else if (num871 == 1) - num871 = 2; - else - num871 = 3; - - npc.ai[0] = num871; + npc.ai[0] = num618; if (npc.ai[0] != 3f) { @@ -346,20 +406,27 @@ namespace CalamityMod.NPCs.Leviathan npc.rotation = npc.velocity.X * 0.02f; npc.TargetClosest(true); - Vector2 vector119 = new Vector2(npc.position.X + (npc.width / 2) + (Main.rand.Next(20) * npc.direction), npc.position.Y + npc.height * 0.8f); + Vector2 vector119 = new Vector2(npc.position.X + (npc.width / 2) + (15 * npc.direction), npc.position.Y + 30); Vector2 vector120 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); float num1058 = player.position.X + (player.width / 2) - vector120.X; float num1059 = player.position.Y + (player.height / 2) - vector120.Y; float num1060 = (float)Math.Sqrt(num1058 * num1058 + num1059 * num1059); npc.ai[1] += 1f; - if (phase2) - npc.ai[1] += 0.25f; - if (phase3) - npc.ai[1] += 0.25f; + int num638 = 0; + for (int num639 = 0; num639 < 255; num639++) + { + if (Main.player[num639].active && !Main.player[num639].dead && (vector - Main.player[num639].Center).Length() < 1000f) + num638++; + } + npc.ai[1] += num638 / 2; bool flag103 = false; - if (npc.ai[1] > 20f) + float num640 = 20f; + if (!leviAlive || phase4) + num640 -= 12f * (1f - lifeRatio); + + if (npc.ai[1] > num640) { npc.ai[1] = 0f; npc.ai[2] += 1f; @@ -371,13 +438,14 @@ namespace CalamityMod.NPCs.Leviathan Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 85); if (Main.netMode != NetmodeID.MultiplayerClient) { - int num1061 = 371; - int num1062 = NPC.NewNPC((int)vector119.X, (int)vector119.Y - 30, num1061, 0, 0f, 0f, 0f, 0f, 255); - Main.npc[num1062].velocity.X = Main.rand.Next(-200, 201) * (CalamityWorld.bossRushActive ? 0.02f : 0.01f); - Main.npc[num1062].velocity.Y = Main.rand.Next(-200, 201) * (CalamityWorld.bossRushActive ? 0.02f : 0.01f); - Main.npc[num1062].localAI[0] = 60f; - Main.npc[num1062].netUpdate = true; - } + int spawn = NPC.NewNPC((int)vector119.X, (int)vector119.Y, NPCID.DetonatingBubble); + Main.npc[spawn].target = npc.target; + Main.npc[spawn].velocity = player.Center - vector119; + Main.npc[spawn].velocity.Normalize(); + Main.npc[spawn].velocity *= bubbleVelocity; + Main.npc[spawn].netUpdate = true; + Main.npc[spawn].ai[3] = Main.rand.Next(80, 121) / 100f; + } } if (num1060 > 600f) @@ -429,125 +497,88 @@ namespace CalamityMod.NPCs.Leviathan } } - // Float around and fire projectiles + // Fly near target and summon bullet hells else if (npc.ai[0] == 2f) { npc.rotation = npc.velocity.X * 0.02f; - Vector2 vector121 = new Vector2(npc.position.X + (npc.width / 2), npc.position.Y + (npc.height / 2)); - npc.ai[1] += 1f; - bool flag104 = false; - if (npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) + Vector2 targetVector = player.Center + new Vector2(0f, -350f); + Vector2 vector3 = Vector2.Normalize(targetVector - vector - npc.velocity) * (CalamityWorld.bossRushActive ? 18f : 12f); + float acceleration = CalamityWorld.bossRushActive ? 0.5f : 0.25f; + + if (Math.Abs(npc.Center.Y - targetVector.Y) > 50f || Math.Abs(npc.Center.X - player.Center.X) > 350f) + npc.SimpleFlyMovement(vector3, acceleration); + + npc.ai[1] += 1f; + + float divisor = 140f; + if (!leviAlive || phase4) + divisor -= (float)Math.Ceiling(50f * (1f - lifeRatio)); + + bool shootProjectiles = npc.ai[1] % divisor == 0f; + if (Main.netMode != NetmodeID.MultiplayerClient && shootProjectiles) { - if (npc.ai[1] % 10f == 9f) - flag104 = true; + int projectileDamage = expertMode ? 26 : 32; + float projectileVelocity = expertMode ? 3f : 2f; + + if (!leviAlive || phase4) + { + projectileDamage += expertMode ? 3 : 4; + projectileVelocity += 2f * (1f - lifeRatio); + } + + int totalProjectiles = 8; + int projectileDistance = 600; + int projectileType = ModContent.ProjectileType(); + switch ((int)npc.localAI[3]) + { + case 0: + Main.PlaySound(SoundID.Item21, player.position); + break; + case 1: + totalProjectiles = 3; + projectileType = ModContent.ProjectileType(); + Main.PlaySound(SoundID.Item30, player.position); + break; + case 2: + totalProjectiles = 6; + projectileType = ModContent.ProjectileType(); + float soundPitch = (Main.rand.NextFloat() - 0.5f) * 0.5f; + Main.harpNote = soundPitch; + Main.PlaySound(SoundID.Item26, player.position); + break; + } + npc.localAI[3] += 1f; + if (npc.localAI[3] > 2f) + npc.localAI[3] = 0f; + + if (((phase2 || death) && !leviAlive) || phase4) + totalProjectiles += totalProjectiles / 2; + + float radians = MathHelper.TwoPi / totalProjectiles; + for (int i = 0; i < totalProjectiles; i++) + { + Vector2 spawnVector = player.Center + Vector2.Normalize(new Vector2(0f, -projectileVelocity).RotatedBy(radians * i)) * projectileDistance; + Vector2 velocity = Vector2.Normalize(player.Center - spawnVector) * projectileVelocity; + Projectile.NewProjectile(spawnVector, velocity, projectileType, projectileDamage, 0f, Main.myPlayer); + } } - else if (expertMode) + + if (Math.Abs(npc.Center.X - player.Center.X) > 10f) { - if ((phase3 && !leviAlive) || CalamityWorld.bossRushActive) - { - if (npc.ai[1] % 15f == 14f) - flag104 = true; - } - else if (phase2) - { - if (npc.ai[1] % 20f == 19f) - flag104 = true; - } - else if (npc.ai[1] % 25f == 24f) - flag104 = true; + float playerLocation = vector.X - player.Center.X; + npc.direction = playerLocation < 0f ? 1 : -1; + npc.spriteDirection = npc.direction; } - else if (npc.ai[1] % 30f == 29f) - flag104 = true; - if (flag104 && (npc.position.Y + npc.height < player.position.Y || (!leviAlive && phase2)) && Collision.CanHit(vector121, 1, 1, player.position, player.width, player.height)) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - float num1070 = revenge ? 15f : 13f; - if (npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) - num1070 = 24f; - else if (isNotOcean || (!leviAlive && phase2) || death) - num1070 = revenge ? 17f : 16f; - else - { - if (phase3) - num1070 += 2f; - } + float phaseTimer = 300f; + if (!leviAlive || phase4) + phaseTimer -= 150f * (1f - lifeRatio); - float num1071 = player.position.X + player.width * 0.5f - vector121.X; - float num1072 = player.position.Y + player.height * 0.5f - vector121.Y; - float num1073 = (float)Math.Sqrt(num1071 * num1071 + num1072 * num1072); - num1073 = num1070 / num1073; - num1071 *= num1073; - num1072 *= num1073; - - int num1074 = expertMode ? 26 : 32; - int num1075 = ModContent.ProjectileType(); - switch (Main.rand.Next(6)) - { - case 0: - num1075 = ModContent.ProjectileType(); - break; - case 1: - num1075 = ModContent.ProjectileType(); - break; - case 2: - case 3: - case 4: - case 5: - num1075 = ModContent.ProjectileType(); - break; - } - if (isNotOcean) - num1074 *= 2; - - float ai0 = (!leviAlive && num1075 == ModContent.ProjectileType()) ? 1f : 0f; - Projectile.NewProjectile(vector121.X, vector121.Y, num1071, num1072, num1075, num1074, 0f, Main.myPlayer, ai0, 0f); - } - } - - if (npc.position.Y > player.position.Y - 300f) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= 0.98f; - npc.velocity.Y -= CalamityWorld.bossRushActive ? 0.15f : 0.1f; - if (npc.velocity.Y > 4f) - npc.velocity.Y = 4f; - } - else if (npc.position.Y < player.position.Y - 500f) - { - if (npc.velocity.Y < 0f) - npc.velocity.Y *= 0.98f; - npc.velocity.Y += CalamityWorld.bossRushActive ? 0.15f : 0.1f; - if (npc.velocity.Y < -4f) - npc.velocity.Y = -4f; - } - if (npc.position.X + (npc.width / 2) > player.position.X + (player.width / 2) + 100f) - { - if (npc.velocity.X > 0f) - npc.velocity.X *= 0.98f; - npc.velocity.X -= CalamityWorld.bossRushActive ? 0.15f : 0.1f; - if (npc.velocity.X > 8f) - npc.velocity.X = 8f; - } - if (npc.position.X + (npc.width / 2) < player.position.X + (player.width / 2) - 100f) - { - if (npc.velocity.X < 0f) - npc.velocity.X *= 0.98f; - npc.velocity.X += CalamityWorld.bossRushActive ? 0.15f : 0.1f; - if (npc.velocity.X < -8f) - npc.velocity.X = -8f; - } - - float playerLocation = vector.X - player.Center.X; - npc.direction = playerLocation < 0f ? 1 : -1; - npc.spriteDirection = npc.direction; - - if (npc.ai[1] >= 300f) + if (npc.ai[1] >= phaseTimer) { npc.ai[0] = -1f; - npc.ai[1] = 0f; + npc.ai[1] = 2f; npc.netUpdate = true; } } @@ -555,26 +586,24 @@ namespace CalamityMod.NPCs.Leviathan // Set up charge else if (npc.ai[0] == 3f) { - ChargeLocation(player, vector, leviAlive, revenge); + ChargeLocation(player, vector, leviAlive && !phase4, revenge); npc.ai[1] += 1f; - if (npc.ai[1] >= (revenge ? 40f : 60f)) + if (npc.ai[1] >= (revenge ? 45f : 60f)) { forceChargeFrames = true; - npc.ai[0] = npc.ai[2] >= (leviAlive ? 2f : 3f) ? -1f : 4f; - npc.ai[1] = 0f; + float aiInterval = (leviAlive && !phase4) ? 2f : 3f; + npc.ai[0] = (npc.ai[2] >= aiInterval) ? -1f : 4f; + npc.ai[1] = (npc.ai[2] >= aiInterval) ? 3f : 0f; npc.localAI[0] = 0f; // Velocity and rotation - float chargeVelocity = leviAlive ? 16f : 21f; + float chargeVelocity = CalamityWorld.bossRushActive ? 31f : (leviAlive && !phase4) ? 21f : 26f; if (revenge) chargeVelocity += 2f + (death ? 4f : 4f * (1f - lifeRatio)); - if (CalamityWorld.bossRushActive) - chargeVelocity = 26f; - npc.velocity = Vector2.Normalize(player.Center - vector) * chargeVelocity; npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); @@ -585,7 +614,7 @@ namespace CalamityMod.NPCs.Leviathan npc.direction = num22; if (npc.spriteDirection == 1) - npc.rotation += 3.14159274f; + npc.rotation += MathHelper.Pi; npc.spriteDirection = -npc.direction; } @@ -595,12 +624,14 @@ namespace CalamityMod.NPCs.Leviathan // Charge else if (npc.ai[0] == 4f) { - // Spawn dust - int num24 = 7; + npc.damage = (int)(npc.defDamage * 1.5); + + // Spawn dust + int num24 = 7; for (int j = 0; j < num24; j++) { - Vector2 arg_E1C_0 = (Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f).RotatedBy((j - (num24 / 2 - 1)) * 3.1415926535897931 / (float)num24, default) + vector; - Vector2 vector4 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * Main.rand.Next(3, 8); + Vector2 arg_E1C_0 = (Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f).RotatedBy((j - (num24 / 2 - 1)) * MathHelper.Pi / num24) + vector; + Vector2 vector4 = ((float)(Main.rand.NextDouble() * MathHelper.Pi) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); int num25 = Dust.NewDust(arg_E1C_0 + vector4, 0, 0, 172, vector4.X * 2f, vector4.Y * 2f, 100, default, 1.4f); Main.dust[num25].noGravity = true; Main.dust[num25].noLight = true; @@ -609,7 +640,7 @@ namespace CalamityMod.NPCs.Leviathan } npc.ai[1] += 1f; - if (npc.ai[1] >= (leviAlive ? 45f : 35f)) + if (npc.ai[1] >= ((leviAlive && !phase4) ? 50f : 35f)) { npc.ai[0] = 3f; npc.ai[1] = 0f; @@ -624,91 +655,44 @@ namespace CalamityMod.NPCs.Leviathan { float num17 = (float)Math.Atan2(player.Center.Y - vector.Y, player.Center.X - vector.X); if (npc.spriteDirection == 1) - num17 += 3.14159274f; + num17 += MathHelper.Pi; if (num17 < 0f) - num17 += 6.28318548f; - if (num17 > 6.28318548f) - num17 -= 6.28318548f; + num17 += MathHelper.TwoPi; + if (num17 > MathHelper.TwoPi) + num17 -= MathHelper.TwoPi; float num18 = 0.04f; if (npc.ai[0] == 4f) num18 = 0f; - if (npc.rotation < num17) - { - if ((num17 - npc.rotation) > 3.1415926535897931) - npc.rotation -= num18; - else - npc.rotation += num18; - } - if (npc.rotation > num17) - { - if ((npc.rotation - num17) > 3.1415926535897931) - npc.rotation += num18; - else - npc.rotation -= num18; - } - - if (npc.rotation > num17 - num18 && npc.rotation < num17 + num18) - npc.rotation = num17; - if (npc.rotation < 0f) - npc.rotation += 6.28318548f; - if (npc.rotation > 6.28318548f) - npc.rotation -= 6.28318548f; - if (npc.rotation > num17 - num18 && npc.rotation < num17 + num18) - npc.rotation = num17; - } + if (num18 != 0f) + npc.rotation = npc.rotation.AngleTowards(num17, num18); + } // Move to charge location private void ChargeLocation(Player player, Vector2 vector, bool leviAlive, bool revenge) { - float distance = leviAlive ? 400f : 350f; + float distance = leviAlive ? 600f : 500f; // Velocity if (npc.localAI[0] == 0f) npc.localAI[0] = (int)distance * Math.Sign((vector - player.Center).X); - Vector2 vector3 = Vector2.Normalize(player.Center + new Vector2(npc.localAI[0], -distance) - vector - npc.velocity) * 9f; - float acceleration = revenge ? 0.75f : 0.5f; - if (CalamityWorld.bossRushActive) - acceleration = 1f; + Vector2 vector3 = Vector2.Normalize(player.Center + new Vector2(npc.localAI[0], -distance) - vector - npc.velocity) * 12f; + float acceleration = CalamityWorld.bossRushActive ? 1f : revenge ? 0.75f : 0.5f; + npc.SimpleFlyMovement(vector3, acceleration); - if (npc.velocity.X < vector3.X) - { - npc.velocity.X += acceleration; - if (npc.velocity.X < 0f && vector3.X > 0f) - npc.velocity.X += acceleration; - } - else if (npc.velocity.X > vector3.X) - { - npc.velocity.X -= acceleration; - if (npc.velocity.X > 0f && vector3.X < 0f) - npc.velocity.X -= acceleration; - } - if (npc.velocity.Y < vector3.Y) - { - npc.velocity.Y += acceleration; - if (npc.velocity.Y < 0f && vector3.Y > 0f) - npc.velocity.Y += acceleration; - } - else if (npc.velocity.Y > vector3.Y) - { - npc.velocity.Y -= acceleration; - if (npc.velocity.Y > 0f && vector3.Y < 0f) - npc.velocity.Y -= acceleration; - } - - // Rotation - int num22 = Math.Sign(player.Center.X - vector.X); + // Rotation + int num22 = Math.Sign(player.Center.X - vector.X); if (num22 != 0) { if (npc.ai[1] == 0f && num22 != npc.direction) - npc.rotation += 3.14159274f; + npc.rotation += MathHelper.Pi; npc.direction = num22; if (npc.spriteDirection != -npc.direction) - npc.rotation += 3.14159274f; + npc.rotation += MathHelper.Pi; npc.spriteDirection = -npc.direction; } @@ -717,123 +701,62 @@ namespace CalamityMod.NPCs.Leviathan public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 3; k++) - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, 187, hitDirection, -1f, 0, default, 1f); if (npc.life <= 0) { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SirenGores/Siren"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SirenGores/Siren2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SirenGores/Siren3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SirenGores/Siren4"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SirenGores/Siren5"), 1f); - for (int k = 0; k < 50; k++) - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, 187, hitDirection, -1f, 0, default, 1f); } } - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) // 2 total states (ice shield or no ice shield) + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) { Texture2D texture = Main.npcTexture[npc.type]; - if (npc.dontTakeDamage) - { - switch (frameUsed) - { - case 0: - texture = ModContent.GetTexture("CalamityMod/NPCs/Leviathan/SirenAlt"); - break; - case 1: - texture = ModContent.GetTexture("CalamityMod/NPCs/Leviathan/SirenAltSinging"); - break; - case 2: - texture = ModContent.GetTexture("CalamityMod/NPCs/Leviathan/SirenAltStabbing"); - break; - } - } - else - { - switch (frameUsed) - { - case 0: - texture = Main.npcTexture[npc.type]; - break; - case 1: - texture = ModContent.GetTexture("CalamityMod/NPCs/Leviathan/SirenSinging"); - break; - case 2: - texture = ModContent.GetTexture("CalamityMod/NPCs/Leviathan/SirenStabbing"); - break; - } - } + switch (frameUsed) + { + case 0: + texture = Main.npcTexture[npc.type]; + break; + case 1: + texture = sirenStabTexture; + break; + } - SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) - spriteEffects = SpriteEffects.FlipHorizontally; - - if (npc.ai[0] > 2f || forceChargeFrames) - { - int width = 106; - Vector2 vector = new Vector2((float)(width / 2), (float)(texture.Height / Main.npcFrameCount[npc.type] / 2)); - Rectangle frame = new Rectangle(0, 0, width, texture.Height / Main.npcFrameCount[npc.type]); - frame.Y = 146 * (int)(npc.frameCounter / 12.0); // 1 to 6 - if (frame.Y >= 146 * 6 || npc.ai[0] == 4f) - frame.Y = 0; - - Main.spriteBatch.Draw(texture, - new Vector2(npc.position.X - Main.screenPosition.X + (float)(npc.width / 2) - (float)width * npc.scale / 2f + vector.X * npc.scale, - npc.position.Y - Main.screenPosition.Y + (float)npc.height - (float)texture.Height * npc.scale / (float)Main.npcFrameCount[npc.type] + 4f + vector.Y * npc.scale + 0f + npc.gfxOffY), - new Microsoft.Xna.Framework.Rectangle?(frame), - npc.GetAlpha(drawColor), - npc.rotation, - vector, - npc.scale, - spriteEffects, - 0f); - return false; - } - - Rectangle frame2 = npc.frame; - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); - Main.spriteBatch.Draw(texture, - new Vector2(npc.position.X - Main.screenPosition.X + (float)(npc.width / 2) - (float)Main.npcTexture[npc.type].Width * npc.scale / 2f + vector11.X * npc.scale, - npc.position.Y - Main.screenPosition.Y + (float)npc.height - (float)Main.npcTexture[npc.type].Height * npc.scale / (float)Main.npcFrameCount[npc.type] + 4f + vector11.Y * npc.scale + 0f + npc.gfxOffY), - new Microsoft.Xna.Framework.Rectangle?(frame2), - npc.GetAlpha(drawColor), - npc.rotation, - vector11, - npc.scale, - spriteEffects, - 0f); + bool charging = npc.ai[0] > 2f || forceChargeFrames; + int height = texture.Height / Main.npcFrameCount[npc.type]; + int width = texture.Width; + SpriteEffects spriteEffects = charging ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + if (npc.spriteDirection == -1) + spriteEffects = charging ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Main.spriteBatch.Draw(texture, npc.Center - Main.screenPosition + new Vector2(0f, npc.gfxOffY), npc.frame, npc.GetAlpha(drawColor), npc.rotation, new Vector2((float)width / 2f, (float)height / 2f), npc.scale, spriteEffects, 0f); return false; } - public override void FindFrame(int frameHeight) // 6 total frames, 3 total texture types + public override void FindFrame(int frameHeight) { - if (forceChargeFrames) - frameUsed = 2; - else if (npc.ai[0] == 2f) - frameUsed = 0; - else if (npc.ai[0] <= 1f) + Texture2D texture = Main.npcTexture[npc.type]; + if (npc.ai[0] > 2f || forceChargeFrames) + { frameUsed = 1; + } else - frameUsed = 2; + { + frameUsed = 0; + } + int frameY = texture.Height / Main.npcFrameCount[npc.type]; + int timeBetweenFrames = 8; - npc.frameCounter += 1.0; - if (npc.ai[0] == 3f || forceChargeFrames) - { - if (npc.frameCounter > 72.0) - npc.frameCounter = 0.0; - } - else if (npc.ai[0] != 4f) - { - int frameY = 146; - if (npc.frameCounter > 72.0) - npc.frameCounter = 0.0; + npc.frameCounter++; + if (npc.frameCounter > timeBetweenFrames * Main.npcFrameCount[npc.type]) + npc.frameCounter = 0; - npc.frame.Y = frameY * (int)(npc.frameCounter / 12.0); - if (npc.frame.Y >= frameHeight * 6) - npc.frame.Y = 0; - } + npc.frame.Y = frameY * (int)(npc.frameCounter / timeBetweenFrames); + if (npc.frame.Y >= frameHeight * Main.npcFrameCount[npc.type]) + npc.frame.Y = 0; + + //100x1140 + //200x636 } public override void BossLoot(ref string name, ref int potionType) @@ -844,6 +767,9 @@ namespace CalamityMod.NPCs.Leviathan // Anahita runs the same loot code as the Leviathan, but only if she dies last. public override void NPCLoot() { + //Trophy dropped regardless of Levi, precedent of Twins + DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); + if (!NPC.AnyNPCs(ModContent.NPCType())) Leviathan.DropSirenLeviLoot(npc); } diff --git a/NPCs/Leviathan/Siren.png b/NPCs/Leviathan/Siren.png index 56d3a69d45..4be01908da 100644 Binary files a/NPCs/Leviathan/Siren.png and b/NPCs/Leviathan/Siren.png differ diff --git a/NPCs/Leviathan/SirenAlt.png b/NPCs/Leviathan/SirenAlt.png deleted file mode 100644 index 793607a326..0000000000 Binary files a/NPCs/Leviathan/SirenAlt.png and /dev/null differ diff --git a/NPCs/Leviathan/SirenAltSinging.png b/NPCs/Leviathan/SirenAltSinging.png deleted file mode 100644 index 365c439126..0000000000 Binary files a/NPCs/Leviathan/SirenAltSinging.png and /dev/null differ diff --git a/NPCs/Leviathan/SirenAltStabbing.png b/NPCs/Leviathan/SirenAltStabbing.png deleted file mode 100644 index cf57a094f5..0000000000 Binary files a/NPCs/Leviathan/SirenAltStabbing.png and /dev/null differ diff --git a/NPCs/Leviathan/SirenClone.cs b/NPCs/Leviathan/SirenClone.cs deleted file mode 100644 index 4a891a1c89..0000000000 --- a/NPCs/Leviathan/SirenClone.cs +++ /dev/null @@ -1,104 +0,0 @@ -using CalamityMod.Projectiles.Boss; -using CalamityMod.World; -using Microsoft.Xna.Framework; -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.NPCs.Leviathan -{ - public class SirenClone : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Siren Clone"); - Main.npcFrameCount[npc.type] = 6; - } - - public override void SetDefaults() - { - npc.aiStyle = -1; - aiType = -1; - npc.damage = 0; - npc.width = 70; - npc.height = 120; - npc.lifeMax = 3000; - npc.knockBackResist = 0f; - npc.noGravity = true; - npc.chaseable = false; - npc.dontTakeDamage = true; - npc.HitSound = SoundID.NPCHit1; - npc.alpha = 255; - } - - public override void FindFrame(int frameHeight) - { - npc.frameCounter += 0.1f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; - } - - public override void AI() - { - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0f, 0.5f, 0.3f); - if (CalamityGlobalNPC.siren < 0 || !Main.npc[CalamityGlobalNPC.siren].active) - { - npc.active = false; - npc.netUpdate = true; - return; - } - if (npc.alpha > 50) - { - npc.alpha -= 5; - } - npc.TargetClosest(true); - Vector2 center = npc.Center; - int num14 = Math.Sign(Main.player[npc.target].Center.X - center.X); - if (num14 != 0) - { - npc.direction = npc.spriteDirection = num14; - } - Vector2 direction = Main.player[npc.target].Center - center; - direction.Normalize(); - direction *= CalamityWorld.bossRushActive ? 16f : 11f; - npc.ai[0] += 1f; - if (npc.ai[0] > 45f) - { - npc.ai[0] = 0f; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int damage = Main.expertMode ? 26 : 32; - Projectile.NewProjectile(center.X, center.Y, direction.X, direction.Y, ModContent.ProjectileType(), damage, 0f, npc.target); - } - } - } - - public override bool CheckActive() - { - return false; - } - - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = 3000; - npc.damage = 0; - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 67, hitDirection, -1f, 0, default, 1f); - } - } - } - } -} diff --git a/NPCs/Leviathan/SirenClone.png b/NPCs/Leviathan/SirenClone.png deleted file mode 100644 index 83c221cda3..0000000000 Binary files a/NPCs/Leviathan/SirenClone.png and /dev/null differ diff --git a/NPCs/Leviathan/SirenIce.cs b/NPCs/Leviathan/SirenIce.cs index 2237dcf9b5..f4eb31ce47 100644 --- a/NPCs/Leviathan/SirenIce.cs +++ b/NPCs/Leviathan/SirenIce.cs @@ -1,5 +1,6 @@ using CalamityMod.World; using Microsoft.Xna.Framework; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -34,26 +35,45 @@ namespace CalamityMod.NPCs.Leviathan npc.DeathSound = SoundID.NPCDeath7; } - public override void AI() + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(npc.dontTakeDamage); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + npc.dontTakeDamage = reader.ReadBoolean(); + } + + public override void AI() { - if (npc.alpha > 100) + int num989 = (int)npc.ai[0]; + if (Main.npc[num989].active && Main.npc[num989].type == ModContent.NPCType()) { - npc.alpha -= 2; - } - Player player = Main.player[npc.target]; - int num989 = (int)npc.ai[0]; - if (Main.npc[num989].active && Main.npc[num989].type == ModContent.NPCType()) - { - npc.rotation = Main.npc[num989].rotation; + if (npc.alpha > 100 && npc.ai[1] == 0f) + npc.alpha -= 2; + + if (Main.npc[num989].damage == 0) + npc.ai[1] = 1f; + else + npc.ai[1] = 0f; + + if (npc.ai[1] == 1f) + npc.alpha = Main.npc[num989].alpha; + + npc.dontTakeDamage = Main.npc[num989].damage == 0; + npc.rotation = Main.npc[num989].rotation; npc.spriteDirection = Main.npc[num989].direction; npc.velocity = Vector2.Zero; npc.position = Main.npc[num989].Center; - npc.position.X = npc.position.X - (float)(npc.width / 2) + ((npc.spriteDirection == 1) ? -20f : 20f); - npc.position.Y = npc.position.Y - (float)(npc.height / 2) - 30; + npc.position.X = npc.position.X - (npc.width / 2) + ((npc.spriteDirection == 1) ? -20f : 20f); + npc.position.Y = npc.position.Y - (npc.height / 2) - 30; npc.gfxOffY = Main.npc[num989].gfxOffY; Lighting.AddLight((int)npc.Center.X / 16, (int)npc.Center.Y / 16, 0f, 0.8f, 1.1f); return; } + + npc.dontTakeDamage = false; npc.life = 0; npc.HitEffect(0, 10.0); npc.active = false; @@ -74,14 +94,22 @@ namespace CalamityMod.NPCs.Leviathan } } - public override Color? GetAlpha(Color drawColor) + public override bool CanHitPlayer(Player target, ref int cooldownSlot) => npc.ai[1] == 0f; + + public override Color? GetAlpha(Color drawColor) { - return new Color(200, 200, 200, npc.alpha); + if (npc.ai[1] == 1f) + return Color.Transparent; + + return new Color(200, 200, 200, npc.alpha); } public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Frostburn, 240, true); + if (npc.ai[1] == 1f) + return; + + player.AddBuff(BuffID.Frostburn, 240, true); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/Leviathan/SirenSinging.png b/NPCs/Leviathan/SirenSinging.png deleted file mode 100644 index 064adc1694..0000000000 Binary files a/NPCs/Leviathan/SirenSinging.png and /dev/null differ diff --git a/NPCs/Leviathan/SirenStabbing.png b/NPCs/Leviathan/SirenStabbing.png index 8d69d7de7b..36d13de7dc 100644 Binary files a/NPCs/Leviathan/SirenStabbing.png and b/NPCs/Leviathan/SirenStabbing.png differ diff --git a/NPCs/Leviathan/Siren_Head_Boss.png b/NPCs/Leviathan/Siren_Head_Boss.png index 6c4a70aad2..20f6e2deaf 100644 Binary files a/NPCs/Leviathan/Siren_Head_Boss.png and b/NPCs/Leviathan/Siren_Head_Boss.png differ diff --git a/NPCs/Leviathan/SirenandLevi_BossChecklist.png b/NPCs/Leviathan/SirenandLevi_BossChecklist.png index 047c54cff8..c59d4c2139 100644 Binary files a/NPCs/Leviathan/SirenandLevi_BossChecklist.png and b/NPCs/Leviathan/SirenandLevi_BossChecklist.png differ diff --git a/NPCs/NormalNPCs/AeroSlime.cs b/NPCs/NormalNPCs/AeroSlime.cs index 11e8df88bc..7735463328 100644 --- a/NPCs/NormalNPCs/AeroSlime.cs +++ b/NPCs/NormalNPCs/AeroSlime.cs @@ -23,7 +23,7 @@ namespace CalamityMod.NPCs.NormalNPCs npc.defense = 6; npc.lifeMax = 50; npc.knockBackResist = 0f; - animationType = 121; + animationType = NPCID.Slimer; npc.value = Item.buyPrice(0, 0, 1, 0); npc.alpha = 50; npc.lavaImmune = false; @@ -33,6 +33,7 @@ namespace CalamityMod.NPCs.NormalNPCs npc.DeathSound = SoundID.NPCDeath1; banner = npc.type; bannerItem = ModContent.ItemType(); + npc.buffImmune[BuffID.Confused] = false; } public override float SpawnChance(NPCSpawnInfo spawnInfo) diff --git a/NPCs/NormalNPCs/AngryDog.cs b/NPCs/NormalNPCs/AngryDog.cs index a2c220b9b6..7ba85e8ff2 100644 --- a/NPCs/NormalNPCs/AngryDog.cs +++ b/NPCs/NormalNPCs/AngryDog.cs @@ -33,7 +33,7 @@ namespace CalamityMod.NPCs.NormalNPCs npc.lifeMax = 1000; } npc.knockBackResist = 0.3f; - animationType = 329; + animationType = NPCID.Hellhound; aiType = -1; npc.value = Item.buyPrice(0, 0, 3, 0); npc.HitSound = mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AngryDogHit"); @@ -41,6 +41,7 @@ namespace CalamityMod.NPCs.NormalNPCs banner = npc.type; bannerItem = ModContent.ItemType(); npc.coldDamage = true; + npc.buffImmune[BuffID.Confused] = false; } public override void SendExtraAI(BinaryWriter writer) @@ -73,10 +74,10 @@ namespace CalamityMod.NPCs.NormalNPCs { npc.ai[1] += 1f; } - CalamityAI.UnicornAI(npc, mod, true, 4f, 5f, 0.2f); + CalamityAI.UnicornAI(npc, mod, true, CalamityWorld.death ? 6f : 4f, 5f, 0.2f); return; } - CalamityAI.UnicornAI(npc, mod, false, 4f, 6f, 0.07f); + CalamityAI.UnicornAI(npc, mod, false, CalamityWorld.death ? 6f : 4f, 6f, CalamityWorld.death ? 0.1f : 0.07f); } public override void FindFrame(int frameHeight) @@ -132,13 +133,13 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/NormalNPCs/ArmoredDiggerBody.cs b/NPCs/NormalNPCs/ArmoredDiggerBody.cs index 9b6eb621cc..7feddec199 100644 --- a/NPCs/NormalNPCs/ArmoredDiggerBody.cs +++ b/NPCs/NormalNPCs/ArmoredDiggerBody.cs @@ -134,13 +134,13 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 6, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Fire, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 6, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Fire, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/NormalNPCs/ArmoredDiggerHead.cs b/NPCs/NormalNPCs/ArmoredDiggerHead.cs index 1a9c9fcad1..2d4385f171 100644 --- a/NPCs/NormalNPCs/ArmoredDiggerHead.cs +++ b/NPCs/NormalNPCs/ArmoredDiggerHead.cs @@ -399,13 +399,13 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 6, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Fire, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 6, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Fire, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/NormalNPCs/ArmoredDiggerTail.cs b/NPCs/NormalNPCs/ArmoredDiggerTail.cs index d2b51d0fc9..2dd4a7fdb8 100644 --- a/NPCs/NormalNPCs/ArmoredDiggerTail.cs +++ b/NPCs/NormalNPCs/ArmoredDiggerTail.cs @@ -123,13 +123,13 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 6, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Fire, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 6, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Fire, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/NormalNPCs/BlightedEye.cs b/NPCs/NormalNPCs/BlightedEye.cs index eba03f078a..0cd9c5ef53 100644 --- a/NPCs/NormalNPCs/BlightedEye.cs +++ b/NPCs/NormalNPCs/BlightedEye.cs @@ -16,32 +16,33 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetDefaults() { npc.aiStyle = 2; - aiType = 116; + aiType = NPCID.TheHungryII; npc.damage = 32; npc.width = 30; npc.height = 32; npc.defense = 8; npc.lifeMax = 120; npc.knockBackResist = 0.6f; - animationType = 2; + animationType = NPCID.DemonEye; npc.value = Item.buyPrice(0, 0, 2, 0); npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath1; banner = npc.type; bannerItem = ModContent.ItemType(); + npc.buffImmune[BuffID.Confused] = false; } public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/NormalNPCs/BloomSlime.cs b/NPCs/NormalNPCs/BloomSlime.cs index 6e13b87c8f..ac35a6f3c6 100644 --- a/NPCs/NormalNPCs/BloomSlime.cs +++ b/NPCs/NormalNPCs/BloomSlime.cs @@ -18,14 +18,14 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetDefaults() { npc.aiStyle = 1; - aiType = 141; + aiType = NPCID.ToxicSludge; npc.damage = 80; npc.width = 40; npc.height = 30; npc.defense = 25; npc.lifeMax = 1000; npc.knockBackResist = 0f; - animationType = 81; + animationType = NPCID.CorruptSlime; npc.value = Item.buyPrice(0, 0, 25, 0); npc.alpha = 50; npc.lavaImmune = false; @@ -35,6 +35,7 @@ namespace CalamityMod.NPCs.NormalNPCs npc.DeathSound = SoundID.NPCDeath1; banner = npc.type; bannerItem = ModContent.ItemType(); + npc.buffImmune[BuffID.Confused] = false; } public override float SpawnChance(NPCSpawnInfo spawnInfo) diff --git a/NPCs/NormalNPCs/Bohldohr.cs b/NPCs/NormalNPCs/Bohldohr.cs index 28c66dc461..41b76c135b 100644 --- a/NPCs/NormalNPCs/Bohldohr.cs +++ b/NPCs/NormalNPCs/Bohldohr.cs @@ -28,11 +28,12 @@ namespace CalamityMod.NPCs.NormalNPCs npc.behindTiles = true; banner = npc.type; bannerItem = ModContent.ItemType(); + npc.buffImmune[BuffID.Confused] = false; } public override void AI() { - CalamityAI.UnicornAI(npc, mod, true, 4f, 5f, 0.2f); + CalamityAI.UnicornAI(npc, mod, true, CalamityWorld.death ? 6f : 4f, 5f, 0.2f); } public override float SpawnChance(NPCSpawnInfo spawnInfo) diff --git a/NPCs/NormalNPCs/Cnidrion.cs b/NPCs/NormalNPCs/Cnidrion.cs index 37a74c4614..49274cd525 100644 --- a/NPCs/NormalNPCs/Cnidrion.cs +++ b/NPCs/NormalNPCs/Cnidrion.cs @@ -282,7 +282,7 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { diff --git a/NPCs/NormalNPCs/CosmicElemental.cs b/NPCs/NormalNPCs/CosmicElemental.cs index 6cee0687c6..5c8e4973b7 100644 --- a/NPCs/NormalNPCs/CosmicElemental.cs +++ b/NPCs/NormalNPCs/CosmicElemental.cs @@ -1,6 +1,8 @@ using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Placeables.Banners; using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,7 +13,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { DisplayName.SetDefault("Cosmic Elemental"); - Main.npcFrameCount[npc.type] = 22; + Main.npcFrameCount[npc.type] = 11; } public override void SetDefaults() @@ -19,17 +21,54 @@ namespace CalamityMod.NPCs.NormalNPCs npc.npcSlots = 0.5f; npc.aiStyle = 91; npc.damage = 20; - npc.width = 20; - npc.height = 30; + npc.width = npc.height = 30; npc.defense = 10; npc.lifeMax = 25; npc.knockBackResist = 0.5f; - animationType = 483; npc.value = Item.buyPrice(0, 0, 3, 0); npc.HitSound = SoundID.NPCHit7; npc.DeathSound = SoundID.NPCDeath6; banner = npc.type; bannerItem = ModContent.ItemType(); + npc.buffImmune[BuffID.Confused] = false; + } + + public override void FindFrame(int frameHeight) + { + npc.frameCounter++; + if (npc.frameCounter > 6) + { + npc.frame.Y += frameHeight; + npc.frameCounter = 0; + } + if (npc.ai[0] == -1f) + { + if (npc.frame.Y >= frameHeight * 11) + npc.frame.Y = frameHeight * 10; + else if (npc.frame.Y <= frameHeight * 5) + npc.frame.Y = frameHeight * 6; + npc.rotation += npc.velocity.X * 0.2f; + } + else + { + if (npc.frame.Y >= frameHeight * 6) + npc.frame.Y = 0; + npc.rotation = npc.velocity.X * 0.1f; + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + Texture2D texture = Main.npcTexture[npc.type]; + int height = texture.Height / Main.npcFrameCount[npc.type]; + int width = texture.Width; + SpriteEffects spriteEffects = SpriteEffects.None; + if (npc.spriteDirection == -1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Main.spriteBatch.Draw(texture, npc.Center - Main.screenPosition + new Vector2(0f, npc.gfxOffY), npc.frame, npc.GetAlpha(drawColor), npc.rotation, new Vector2(width / 2f, height / 2f), npc.scale, spriteEffects, 0f); + return false; } public override float SpawnChance(NPCSpawnInfo spawnInfo) @@ -67,37 +106,10 @@ namespace CalamityMod.NPCs.NormalNPCs public override void NPCLoot() { - if (Main.rand.NextBool(10)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.BoneSword); - } - if (Main.rand.NextBool(50)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Starfury); - } - if (Main.rand.NextBool(100)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.EnchantedSword); - } - if (Main.rand.NextBool(1000)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Arkhalis); - } - if (CalamityWorld.defiled) - { - if (Main.rand.NextBool(20)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Starfury); - } - if (Main.rand.NextBool(20)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.EnchantedSword); - } - if (Main.rand.NextBool(20)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Arkhalis); - } - } + DropHelper.DropItemChance(npc, ItemID.BoneSword, 10); + DropHelper.DropItemChance(npc, ItemID.Starfury, CalamityWorld.defiled ? DropHelper.DefiledDropRateInt : 50); + DropHelper.DropItemChance(npc, ItemID.EnchantedSword, CalamityWorld.defiled ? DropHelper.DefiledDropRateInt : 100); + DropHelper.DropItemChance(npc, ItemID.Arkhalis, CalamityWorld.defiled ? DropHelper.DefiledDropRateInt : 1000); } } } diff --git a/NPCs/NormalNPCs/CosmicElemental.png b/NPCs/NormalNPCs/CosmicElemental.png index 8612372af5..c783c33ce8 100644 Binary files a/NPCs/NormalNPCs/CosmicElemental.png and b/NPCs/NormalNPCs/CosmicElemental.png differ diff --git a/NPCs/NormalNPCs/CrimulanBlightSlime.cs b/NPCs/NormalNPCs/CrimulanBlightSlime.cs index be666662c0..da8584888f 100644 --- a/NPCs/NormalNPCs/CrimulanBlightSlime.cs +++ b/NPCs/NormalNPCs/CrimulanBlightSlime.cs @@ -1,6 +1,8 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Weapons.Melee; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -17,14 +19,14 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetDefaults() { npc.aiStyle = 1; - aiType = 71; + aiType = NPCID.DungeonSlime; npc.damage = 30; npc.width = 60; npc.height = 42; npc.defense = 8; npc.lifeMax = 130; npc.knockBackResist = 0.3f; - animationType = 244; + animationType = NPCID.RainbowSlime; npc.value = Item.buyPrice(0, 0, 2, 0); npc.alpha = 105; npc.lavaImmune = false; @@ -33,6 +35,7 @@ namespace CalamityMod.NPCs.NormalNPCs npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath1; npc.buffImmune[BuffID.OnFire] = true; + npc.buffImmune[BuffID.Confused] = false; banner = npc.type; bannerItem = ModContent.ItemType(); } @@ -50,13 +53,13 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 40; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } } @@ -69,7 +72,10 @@ namespace CalamityMod.NPCs.NormalNPCs public override void NPCLoot() { - DropHelper.DropItem(npc, ModContent.ItemType(), 15, 16); + int item = Item.NewItem(npc.Center, npc.Size, ModContent.ItemType(), Main.rand.Next(15, 21), false, 0, false, false); + Main.item[item].color = new Color(250, 50, 50, 255); + NetMessage.SendData(88, -1, -1, null, item, 1f, 0f, 0f, 0, 0, 0); + DropHelper.DropItem(npc, ItemID.Gel, 10, 14); DropHelper.DropItemCondition(npc, ModContent.ItemType(), NPC.downedBoss3, 0.01f, 1, 1); } diff --git a/NPCs/NormalNPCs/CryoSlime.cs b/NPCs/NormalNPCs/CryoSlime.cs index f280c59aaf..143f6375f2 100644 --- a/NPCs/NormalNPCs/CryoSlime.cs +++ b/NPCs/NormalNPCs/CryoSlime.cs @@ -17,14 +17,14 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetDefaults() { npc.aiStyle = 1; - aiType = 71; + aiType = NPCID.DungeonSlime; npc.damage = 30; npc.width = 40; npc.height = 30; npc.defense = 8; npc.lifeMax = 120; npc.knockBackResist = 0f; - animationType = 81; + animationType = NPCID.CorruptSlime; npc.value = Item.buyPrice(0, 0, 5, 0); npc.alpha = 50; npc.lavaImmune = false; @@ -34,6 +34,7 @@ namespace CalamityMod.NPCs.NormalNPCs npc.DeathSound = SoundID.NPCDeath1; banner = npc.type; bannerItem = ModContent.ItemType(); + npc.buffImmune[BuffID.Confused] = false; } public override float SpawnChance(NPCSpawnInfo spawnInfo) diff --git a/NPCs/NormalNPCs/Cryon.cs b/NPCs/NormalNPCs/Cryon.cs index 1a31a56967..0c1faa63a0 100644 --- a/NPCs/NormalNPCs/Cryon.cs +++ b/NPCs/NormalNPCs/Cryon.cs @@ -1,6 +1,7 @@ using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; +using CalamityMod.World; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -31,11 +32,12 @@ namespace CalamityMod.NPCs.NormalNPCs banner = npc.type; bannerItem = ModContent.ItemType(); npc.coldDamage = true; + npc.buffImmune[BuffID.Confused] = false; } public override void AI() { - CalamityAI.UnicornAI(npc, mod, false, 4f, 5f, 0.1f); + CalamityAI.UnicornAI(npc, mod, false, CalamityWorld.death ? 6f : 4f, 5f, CalamityWorld.death ? 0.15f : 0.1f); } public override void FindFrame(int frameHeight) diff --git a/NPCs/NormalNPCs/EbonianBlightSlime.cs b/NPCs/NormalNPCs/EbonianBlightSlime.cs index d297573336..60c5b8402d 100644 --- a/NPCs/NormalNPCs/EbonianBlightSlime.cs +++ b/NPCs/NormalNPCs/EbonianBlightSlime.cs @@ -16,14 +16,14 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetDefaults() { npc.aiStyle = 1; - aiType = 71; + aiType = NPCID.DungeonSlime; npc.damage = 30; npc.width = 60; npc.height = 42; npc.defense = 8; npc.lifeMax = 130; npc.knockBackResist = 0.3f; - animationType = 244; + animationType = NPCID.RainbowSlime; npc.value = Item.buyPrice(0, 0, 2, 0); npc.alpha = 105; npc.lavaImmune = false; @@ -32,6 +32,7 @@ namespace CalamityMod.NPCs.NormalNPCs npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath1; npc.buffImmune[BuffID.OnFire] = true; + npc.buffImmune[BuffID.Confused] = false; banner = npc.type; bannerItem = ModContent.ItemType(); } @@ -68,7 +69,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void NPCLoot() { - DropHelper.DropItem(npc, ModContent.ItemType(), 15, 16); + DropHelper.DropItem(npc, ModContent.ItemType(), 15, 20); DropHelper.DropItem(npc, ItemID.Gel, 10, 14); } } diff --git a/NPCs/NormalNPCs/FearlessGoldfishWarrior.cs b/NPCs/NormalNPCs/FearlessGoldfishWarrior.cs index 9c066e63d5..5569956ce5 100644 --- a/NPCs/NormalNPCs/FearlessGoldfishWarrior.cs +++ b/NPCs/NormalNPCs/FearlessGoldfishWarrior.cs @@ -22,7 +22,7 @@ namespace CalamityMod.NPCs.NormalNPCs { npc.aiStyle = -1; aiType = -1; - npc.damage = Main.hardMode ? 120 : 30; + npc.damage = Main.hardMode ? 100 : 30; npc.width = 36; npc.height = 32; npc.defense = Main.hardMode ? 10 : 2; @@ -33,6 +33,7 @@ namespace CalamityMod.NPCs.NormalNPCs npc.DeathSound = SoundID.NPCDeath1; banner = npc.type; bannerItem = ModContent.ItemType(); + npc.buffImmune[BuffID.Confused] = false; } public override void AI() @@ -426,13 +427,13 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 15; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/NormalNPCs/Frogfish.cs b/NPCs/NormalNPCs/Frogfish.cs index 7e5361b647..1cd38c0b95 100644 --- a/NPCs/NormalNPCs/Frogfish.cs +++ b/NPCs/NormalNPCs/Frogfish.cs @@ -116,13 +116,13 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 25; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/NormalNPCs/HeatSpirit.cs b/NPCs/NormalNPCs/HeatSpirit.cs index 4564954fe6..b2f8bc4b9a 100644 --- a/NPCs/NormalNPCs/HeatSpirit.cs +++ b/NPCs/NormalNPCs/HeatSpirit.cs @@ -30,6 +30,7 @@ namespace CalamityMod.NPCs.NormalNPCs npc.DeathSound = SoundID.NPCDeath55; banner = npc.type; bannerItem = ModContent.ItemType(); + npc.buffImmune[BuffID.Confused] = false; } public override float SpawnChance(NPCSpawnInfo spawnInfo) diff --git a/NPCs/NormalNPCs/Horse.cs b/NPCs/NormalNPCs/Horse.cs index 2d08d1d703..8c4860a721 100644 --- a/NPCs/NormalNPCs/Horse.cs +++ b/NPCs/NormalNPCs/Horse.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Tools.ClimateChange; @@ -40,7 +41,26 @@ namespace CalamityMod.NPCs.NormalNPCs npc.buffImmune[k] = true; } npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; + npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[BuffID.Frostburn] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.buffImmune[BuffID.Daybreak] = false; + npc.buffImmune[BuffID.StardustMinionBleed] = false; + npc.buffImmune[BuffID.DryadsWardDebuff] = false; + npc.buffImmune[BuffID.Oiled] = false; + npc.buffImmune[BuffID.BetsysCurse] = false; + npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; npc.knockBackResist = 0f; npc.value = Item.buyPrice(0, 1, 50, 0); npc.noGravity = true; @@ -130,41 +150,13 @@ namespace CalamityMod.NPCs.NormalNPCs } for (int num623 = 0; num623 < 70; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 6, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, DustID.Fire, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 6, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, DustID.Fire, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - for (int num625 = 0; num625 < 3; num625++) - { - float scaleFactor10 = 0.33f; - if (num625 == 1) - { - scaleFactor10 = 0.66f; - } - if (num625 == 2) - { - scaleFactor10 = 1f; - } - int num626 = Gore.NewGore(new Vector2(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.height / 2) - 24f), default, 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(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.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(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.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(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - gore.velocity *= scaleFactor10; - gore.velocity.X -= 1f; - gore.velocity.Y -= 1f; - } + CalamityUtils.ExplosionGores(npc.Center, 3); } } diff --git a/NPCs/NormalNPCs/ImpiousImmolator.cs b/NPCs/NormalNPCs/ImpiousImmolator.cs index 220d8c8551..5def4150d7 100644 --- a/NPCs/NormalNPCs/ImpiousImmolator.cs +++ b/NPCs/NormalNPCs/ImpiousImmolator.cs @@ -1,3 +1,6 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Weapons.Summon; @@ -38,6 +41,18 @@ namespace CalamityMod.NPCs.NormalNPCs } npc.buffImmune[BuffID.Ichor] = false; npc.buffImmune[BuffID.CursedInferno] = false; + npc.buffImmune[BuffID.StardustMinionBleed] = false; + npc.buffImmune[BuffID.BetsysCurse] = false; + npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; npc.value = Item.buyPrice(0, 0, 50, 0); npc.HitSound = SoundID.NPCHit5; npc.DeathSound = SoundID.NPCDeath7; @@ -275,13 +290,13 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.ProfanedFire, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 25; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.ProfanedFire, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/NormalNPCs/MantisShrimp.cs b/NPCs/NormalNPCs/MantisShrimp.cs index 37796796aa..12c9971693 100644 --- a/NPCs/NormalNPCs/MantisShrimp.cs +++ b/NPCs/NormalNPCs/MantisShrimp.cs @@ -24,11 +24,12 @@ namespace CalamityMod.NPCs.NormalNPCs npc.DR_NERD(0.1f); npc.lifeMax = 30; npc.aiStyle = 3; - aiType = 67; + aiType = NPCID.Crab; npc.value = Item.buyPrice(0, 0, 1, 0); npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath1; - npc.buffImmune[189] = true; + npc.buffImmune[BuffID.Daybreak] = true; + npc.buffImmune[BuffID.Confused] = false; banner = npc.type; bannerItem = ModContent.ItemType(); } @@ -114,13 +115,13 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 15; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/NormalNPCs/OverloadedSoldier.cs b/NPCs/NormalNPCs/OverloadedSoldier.cs index 2653eca75d..ccd11d6933 100644 --- a/NPCs/NormalNPCs/OverloadedSoldier.cs +++ b/NPCs/NormalNPCs/OverloadedSoldier.cs @@ -1,6 +1,7 @@ using System; using Microsoft.Xna.Framework; using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; using CalamityMod.World; @@ -34,6 +35,7 @@ namespace CalamityMod.NPCs.NormalNPCs npc.DeathSound = SoundID.NPCDeath2; banner = npc.type; bannerItem = ModContent.ItemType(); + npc.buffImmune[BuffID.Confused] = false; } public override void FindFrame(int frameHeight) @@ -420,13 +422,13 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 60, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Phantoplasm, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 15; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 60, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Phantoplasm, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/NormalNPCs/PerennialSlime.cs b/NPCs/NormalNPCs/PerennialSlime.cs index 529ea759e7..a0d29f1d89 100644 --- a/NPCs/NormalNPCs/PerennialSlime.cs +++ b/NPCs/NormalNPCs/PerennialSlime.cs @@ -16,14 +16,14 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetDefaults() { npc.aiStyle = 1; - aiType = 141; + aiType = NPCID.ToxicSludge; npc.damage = 35; npc.width = 40; npc.height = 30; npc.defense = 12; npc.lifeMax = 150; npc.knockBackResist = 0f; - animationType = 81; + animationType = NPCID.CorruptSlime; npc.value = Item.buyPrice(0, 0, 10, 0); npc.alpha = 50; npc.lavaImmune = false; @@ -33,6 +33,7 @@ namespace CalamityMod.NPCs.NormalNPCs npc.DeathSound = SoundID.NPCDeath1; banner = npc.type; bannerItem = ModContent.ItemType(); + npc.buffImmune[BuffID.Confused] = false; } public override float SpawnChance(NPCSpawnInfo spawnInfo) diff --git a/NPCs/NormalNPCs/PhantomDebris.cs b/NPCs/NormalNPCs/PhantomDebris.cs index 09743b48e9..307a98e315 100644 --- a/NPCs/NormalNPCs/PhantomDebris.cs +++ b/NPCs/NormalNPCs/PhantomDebris.cs @@ -1,6 +1,7 @@ using System; using Microsoft.Xna.Framework; using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; using CalamityMod.World; @@ -34,6 +35,7 @@ namespace CalamityMod.NPCs.NormalNPCs npc.DeathSound = SoundID.NPCDeath36; banner = npc.type; bannerItem = ModContent.ItemType(); + npc.buffImmune[BuffID.Confused] = false; } public override void FindFrame(int frameHeight) @@ -414,13 +416,13 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 60, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Phantoplasm, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 15; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 60, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Phantoplasm, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/NormalNPCs/PhantomSpirit.cs b/NPCs/NormalNPCs/PhantomSpirit.cs index 73dd268e20..1a237a85a5 100644 --- a/NPCs/NormalNPCs/PhantomSpirit.cs +++ b/NPCs/NormalNPCs/PhantomSpirit.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; using CalamityMod.World; @@ -25,7 +26,7 @@ namespace CalamityMod.NPCs.NormalNPCs npc.defense = 10; npc.lifeMax = 1000; npc.knockBackResist = 0.1f; - animationType = 288; + animationType = NPCID.DungeonSpirit; aiType = -1; npc.value = Item.buyPrice(0, 0, 20, 0); npc.HitSound = SoundID.NPCHit36; @@ -40,7 +41,7 @@ namespace CalamityMod.NPCs.NormalNPCs { float speed = CalamityWorld.death ? 22f : 17f; CalamityAI.DungeonSpiritAI(npc, mod, speed, -MathHelper.PiOver2); - int num822 = Dust.NewDust(npc.position, npc.width, npc.height, 60, 0f, 0f, 0, default, 1f); + int num822 = Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Phantoplasm, 0f, 0f, 0, default, 1f); Dust dust = Main.dust[num822]; dust.velocity *= 0.1f; dust.scale = 1.3f; @@ -59,13 +60,13 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 60, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Phantoplasm, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int num288 = 0; num288 < 50; num288++) { - int num289 = Dust.NewDust(npc.position, npc.width, npc.height, 60, npc.velocity.X, npc.velocity.Y, 0, default, 1f); + int num289 = Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Phantoplasm, npc.velocity.X, npc.velocity.Y, 0, default, 1f); Dust dust = Main.dust[num289]; dust.velocity *= 2f; dust.noGravity = true; diff --git a/NPCs/NormalNPCs/PhantomSpiritL.cs b/NPCs/NormalNPCs/PhantomSpiritL.cs index fbff645d43..bed39fe1d6 100644 --- a/NPCs/NormalNPCs/PhantomSpiritL.cs +++ b/NPCs/NormalNPCs/PhantomSpiritL.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Projectiles.Boss; @@ -50,7 +51,7 @@ namespace CalamityMod.NPCs.NormalNPCs { float speed = CalamityWorld.death ? 16f : 12f; CalamityAI.DungeonSpiritAI(npc, mod, speed, -MathHelper.PiOver2); - int num822 = Dust.NewDust(npc.position, npc.width, npc.height, 60, 0f, 0f, 0, default, 1f); + int num822 = Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Phantoplasm, 0f, 0f, 0, default, 1f); Dust dust = Main.dust[num822]; dust.velocity *= 0.1f; dust.scale = 1.3f; @@ -86,7 +87,7 @@ namespace CalamityMod.NPCs.NormalNPCs { float num151 = 5f; int num152 = Main.expertMode ? 53 : 65; - int num153 = ModContent.ProjectileType(); + int num153 = ModContent.ProjectileType(); num149 = num151 / num149; num147 *= num149; num148 *= num149; @@ -107,13 +108,13 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 60, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Phantoplasm, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int num288 = 0; num288 < 50; num288++) { - int num289 = Dust.NewDust(npc.position, npc.width, npc.height, 60, npc.velocity.X, npc.velocity.Y, 0, default, 1f); + int num289 = Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Phantoplasm, npc.velocity.X, npc.velocity.Y, 0, default, 1f); Dust dust = Main.dust[num289]; dust.velocity *= 2f; dust.noGravity = true; diff --git a/NPCs/NormalNPCs/PhantomSpiritM.cs b/NPCs/NormalNPCs/PhantomSpiritM.cs index 956c2a36fa..ec683308b2 100644 --- a/NPCs/NormalNPCs/PhantomSpiritM.cs +++ b/NPCs/NormalNPCs/PhantomSpiritM.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; using CalamityMod.World; @@ -48,7 +49,7 @@ namespace CalamityMod.NPCs.NormalNPCs { float speed = CalamityWorld.death ? 18f : 13.5f; CalamityAI.DungeonSpiritAI(npc, mod, speed, -MathHelper.PiOver2); - int num822 = Dust.NewDust(npc.position, npc.width, npc.height, 60, 0f, 0f, 0, default, 1f); + int num822 = Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Phantoplasm, 0f, 0f, 0, default, 1f); Dust dust = Main.dust[num822]; dust.velocity *= 0.1f; dust.scale = 1.3f; @@ -68,13 +69,13 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 60, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Phantoplasm, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int num288 = 0; num288 < 50; num288++) { - int num289 = Dust.NewDust(npc.position, npc.width, npc.height, 60, npc.velocity.X, npc.velocity.Y, 0, default, 1f); + int num289 = Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Phantoplasm, npc.velocity.X, npc.velocity.Y, 0, default, 1f); Dust dust = Main.dust[num289]; dust.velocity *= 2f; dust.noGravity = true; diff --git a/NPCs/NormalNPCs/PhantomSpiritS.cs b/NPCs/NormalNPCs/PhantomSpiritS.cs index 94b477f755..27d89ddb87 100644 --- a/NPCs/NormalNPCs/PhantomSpiritS.cs +++ b/NPCs/NormalNPCs/PhantomSpiritS.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; using CalamityMod.World; @@ -47,7 +48,7 @@ namespace CalamityMod.NPCs.NormalNPCs { float speed = CalamityWorld.death ? 20f : 15f; CalamityAI.DungeonSpiritAI(npc, mod, speed, -MathHelper.PiOver2); - int num822 = Dust.NewDust(npc.position, npc.width, npc.height, 60, 0f, 0f, 0, default, 1f); + int num822 = Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Phantoplasm, 0f, 0f, 0, default, 1f); Dust dust = Main.dust[num822]; dust.velocity *= 0.1f; dust.scale = 1.3f; @@ -66,13 +67,13 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 60, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Phantoplasm, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int num288 = 0; num288 < 50; num288++) { - int num289 = Dust.NewDust(npc.position, npc.width, npc.height, 60, npc.velocity.X, npc.velocity.Y, 0, default, 1f); + int num289 = Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Phantoplasm, npc.velocity.X, npc.velocity.Y, 0, default, 1f); Dust dust = Main.dust[num289]; dust.velocity *= 2f; dust.noGravity = true; diff --git a/NPCs/NormalNPCs/Piggy.cs b/NPCs/NormalNPCs/Piggy.cs index 6fd3803528..c0b7ad111f 100644 --- a/NPCs/NormalNPCs/Piggy.cs +++ b/NPCs/NormalNPCs/Piggy.cs @@ -18,13 +18,12 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetDefaults() { npc.chaseable = false; - npc.aiStyle = 26; npc.damage = 0; npc.width = 26; npc.height = 26; npc.lifeMax = 2000; npc.aiStyle = 7; - aiType = 299; + aiType = NPCID.Squirrel; npc.knockBackResist = 0.99f; npc.value = Item.buyPrice(0, 10, 0, 0); npc.HitSound = SoundID.NPCHit1; @@ -89,13 +88,13 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 15; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/NormalNPCs/Pitbull.cs b/NPCs/NormalNPCs/Pitbull.cs index e2a2fba6a4..304f6eef89 100644 --- a/NPCs/NormalNPCs/Pitbull.cs +++ b/NPCs/NormalNPCs/Pitbull.cs @@ -22,13 +22,14 @@ namespace CalamityMod.NPCs.NormalNPCs npc.defense = 4; npc.lifeMax = 60; npc.knockBackResist = 0.3f; - animationType = 329; + animationType = NPCID.Hellhound; aiType = NPCID.Wolf; npc.value = Item.buyPrice(0, 0, 2, 0); npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath5; banner = npc.type; bannerItem = ModContent.ItemType(); + npc.buffImmune[BuffID.Confused] = false; } public override float SpawnChance(NPCSpawnInfo spawnInfo) @@ -49,13 +50,13 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/NormalNPCs/PlagueBee.cs b/NPCs/NormalNPCs/PlagueBee.cs index dedb958099..51b21d9229 100644 --- a/NPCs/NormalNPCs/PlagueBee.cs +++ b/NPCs/NormalNPCs/PlagueBee.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; using Microsoft.Xna.Framework; @@ -27,9 +28,9 @@ namespace CalamityMod.NPCs.NormalNPCs npc.scale = 0.5f; npc.lifeMax = 200; npc.aiStyle = 5; - aiType = 210; + aiType = NPCID.Bee; npc.knockBackResist = 0f; - animationType = 210; + animationType = NPCID.Bee; npc.value = Item.buyPrice(0, 0, 5, 0); npc.HitSound = SoundID.NPCHit4; npc.DeathSound = SoundID.NPCDeath14; @@ -123,13 +124,13 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Plague, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Plague, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/NormalNPCs/PlagueBeeLarge.cs b/NPCs/NormalNPCs/PlagueBeeLarge.cs index 0a5279d8b1..0ce7d36fcb 100644 --- a/NPCs/NormalNPCs/PlagueBeeLarge.cs +++ b/NPCs/NormalNPCs/PlagueBeeLarge.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; using Microsoft.Xna.Framework; @@ -26,9 +27,9 @@ namespace CalamityMod.NPCs.NormalNPCs npc.scale = 0.75f; npc.lifeMax = 300; npc.aiStyle = 5; - aiType = 210; + aiType = NPCID.Bee; npc.knockBackResist = 0f; - animationType = 210; + animationType = NPCID.Bee; npc.value = Item.buyPrice(0, 0, 10, 0); npc.HitSound = SoundID.NPCHit4; npc.DeathSound = SoundID.NPCDeath14; @@ -122,13 +123,13 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Plague, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Plague, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/NormalNPCs/PlaguedDerpling.cs b/NPCs/NormalNPCs/PlaguedDerpling.cs index 4d1bf5158c..a10ac307c4 100644 --- a/NPCs/NormalNPCs/PlaguedDerpling.cs +++ b/NPCs/NormalNPCs/PlaguedDerpling.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; using CalamityMod.World; @@ -146,11 +147,10 @@ namespace CalamityMod.NPCs.NormalNPCs npc.netUpdate = true; } int num13 = Dust.NewDust(new Vector2(npc.position.X - npc.velocity.X, npc.position.Y - npc.velocity.Y), npc.width, npc.height, 46, npc.velocity.X * 0.2f, npc.velocity.Y * 0.2f, 100, default, 2f); - Main.dust[num13].noGravity = true; - Dust expr_F26_cp_0 = Main.dust[num13]; - expr_F26_cp_0.velocity.X *= 0.3f; - Dust expr_F44_cp_0 = Main.dust[num13]; - expr_F44_cp_0.velocity.Y *= 0.3f; + Dust dust = Main.dust[num13]; + dust.noGravity = true; + dust.velocity.X *= 0.3f; + dust.velocity.Y *= 0.3f; } public override float SpawnChance(NPCSpawnInfo spawnInfo) @@ -171,13 +171,13 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Plague, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Plague, hitDirection, -1f, 0, default, 1f); } Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Viruling"), 1f); Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Viruling2"), 1f); diff --git a/NPCs/NormalNPCs/PlaguedFlyingFox.cs b/NPCs/NormalNPCs/PlaguedFlyingFox.cs index 0e6c836e9d..3f15f43f35 100644 --- a/NPCs/NormalNPCs/PlaguedFlyingFox.cs +++ b/NPCs/NormalNPCs/PlaguedFlyingFox.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; using Terraria; @@ -18,8 +19,8 @@ namespace CalamityMod.NPCs.NormalNPCs { npc.npcSlots = 0.5f; npc.aiStyle = 14; - aiType = 152; - animationType = 152; + aiType = NPCID.GiantFlyingFox; + animationType = NPCID.GiantFlyingFox; npc.damage = 55; npc.width = 38; npc.height = 34; @@ -57,13 +58,13 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Plague, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Plague, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/NormalNPCs/PlaguedJungleSlime.cs b/NPCs/NormalNPCs/PlaguedJungleSlime.cs index 1708341dfa..22513e92ce 100644 --- a/NPCs/NormalNPCs/PlaguedJungleSlime.cs +++ b/NPCs/NormalNPCs/PlaguedJungleSlime.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Projectiles.Boss; @@ -28,7 +29,7 @@ namespace CalamityMod.NPCs.NormalNPCs npc.defense = 12; npc.lifeMax = 350; npc.knockBackResist = 0f; - animationType = 81; + animationType = NPCID.CorruptSlime; npc.value = Item.buyPrice(0, 0, 10, 0); npc.alpha = 60; npc.lavaImmune = false; @@ -52,7 +53,7 @@ namespace CalamityMod.NPCs.NormalNPCs { spikeTimer -= 1f; } - if (!npc.wet && !Main.player[npc.target].Calamity().royalGel) + if (!npc.wet && !Main.player[npc.target].npcTypeNoAggro[npc.type]) { Vector2 vector3 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); float num14 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector3.X; @@ -115,13 +116,13 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Plague, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Plague, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/NormalNPCs/PlaguedTortoise.cs b/NPCs/NormalNPCs/PlaguedTortoise.cs index d4cadecabf..ae45c380f3 100644 --- a/NPCs/NormalNPCs/PlaguedTortoise.cs +++ b/NPCs/NormalNPCs/PlaguedTortoise.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; using Terraria; @@ -24,20 +25,16 @@ namespace CalamityMod.NPCs.NormalNPCs npc.defense = 32; npc.lifeMax = 800; npc.knockBackResist = 0.2f; - animationType = 153; + animationType = NPCID.GiantTortoise; npc.value = Item.buyPrice(0, 0, 20, 0); npc.HitSound = SoundID.NPCHit24; npc.DeathSound = SoundID.NPCDeath27; npc.noGravity = false; - npc.buffImmune[189] = true; - npc.buffImmune[153] = true; - npc.buffImmune[70] = true; - npc.buffImmune[69] = true; - npc.buffImmune[39] = true; - npc.buffImmune[24] = true; - npc.buffImmune[20] = true; + npc.buffImmune[BuffID.ShadowFlame] = true; + npc.buffImmune[BuffID.Venom] = true; + npc.buffImmune[BuffID.OnFire] = true; + npc.buffImmune[BuffID.Poisoned] = true; npc.buffImmune[ModContent.BuffType()] = true; - npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[ModContent.BuffType()] = true; banner = npc.type; bannerItem = ModContent.ItemType(); @@ -47,13 +44,13 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Plague, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Plague, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/NormalNPCs/ProfanedEnergyBody.cs b/NPCs/NormalNPCs/ProfanedEnergyBody.cs index 79c8c213ed..8593724ceb 100644 --- a/NPCs/NormalNPCs/ProfanedEnergyBody.cs +++ b/NPCs/NormalNPCs/ProfanedEnergyBody.cs @@ -1,3 +1,4 @@ +using CalamityMod.Dusts; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; using Terraria; @@ -66,13 +67,13 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.ProfanedFire, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 50; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.ProfanedFire, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/NormalNPCs/ProfanedEnergyLantern.cs b/NPCs/NormalNPCs/ProfanedEnergyLantern.cs index d4cc3fcc53..ed4f99cf74 100644 --- a/NPCs/NormalNPCs/ProfanedEnergyLantern.cs +++ b/NPCs/NormalNPCs/ProfanedEnergyLantern.cs @@ -1,3 +1,4 @@ +using CalamityMod.Dusts; using CalamityMod.Projectiles.Boss; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -227,7 +228,7 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 50; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.ProfanedFire, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/NormalNPCs/SandTortoise.cs b/NPCs/NormalNPCs/SandTortoise.cs index 1f08cf8a7a..7ec3232751 100644 --- a/NPCs/NormalNPCs/SandTortoise.cs +++ b/NPCs/NormalNPCs/SandTortoise.cs @@ -24,26 +24,27 @@ namespace CalamityMod.NPCs.NormalNPCs npc.scale = 1.5f; npc.lifeMax = 580; npc.knockBackResist = 0.2f; - animationType = 153; + animationType = NPCID.GiantTortoise; npc.value = Item.buyPrice(0, 0, 15, 0); npc.HitSound = SoundID.NPCHit24; npc.DeathSound = SoundID.NPCDeath27; npc.noGravity = false; banner = npc.type; bannerItem = ModContent.ItemType(); + npc.buffImmune[BuffID.Confused] = false; } public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/NormalNPCs/ScornEater.cs b/NPCs/NormalNPCs/ScornEater.cs index d5cd1f51e2..885319a7fe 100644 --- a/NPCs/NormalNPCs/ScornEater.cs +++ b/NPCs/NormalNPCs/ScornEater.cs @@ -1,3 +1,6 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; using CalamityMod.World; @@ -33,6 +36,18 @@ namespace CalamityMod.NPCs.NormalNPCs } npc.buffImmune[BuffID.Ichor] = false; npc.buffImmune[BuffID.CursedInferno] = false; + npc.buffImmune[BuffID.StardustMinionBleed] = false; + npc.buffImmune[BuffID.BetsysCurse] = false; + npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; npc.lavaImmune = true; npc.value = Item.buyPrice(0, 0, 50, 0); npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/ScornDeath"); @@ -170,13 +185,13 @@ namespace CalamityMod.NPCs.NormalNPCs } for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.ProfanedFire, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 50; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.ProfanedFire, hitDirection, -1f, 0, default, 1f); } Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScornEater"), 1f); Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScornEater2"), 1f); diff --git a/NPCs/NormalNPCs/SeaUrchin.cs b/NPCs/NormalNPCs/SeaUrchin.cs index 81f65f4314..c4cc6ec4ce 100644 --- a/NPCs/NormalNPCs/SeaUrchin.cs +++ b/NPCs/NormalNPCs/SeaUrchin.cs @@ -29,6 +29,7 @@ namespace CalamityMod.NPCs.NormalNPCs npc.behindTiles = true; banner = npc.type; bannerItem = ModContent.ItemType(); + npc.buffImmune[BuffID.Confused] = false; } public override void AI() @@ -59,13 +60,13 @@ namespace CalamityMod.NPCs.NormalNPCs { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/NormalNPCs/ShockstormShuttle.cs b/NPCs/NormalNPCs/ShockstormShuttle.cs index 48df531d90..3fa97855bb 100644 --- a/NPCs/NormalNPCs/ShockstormShuttle.cs +++ b/NPCs/NormalNPCs/ShockstormShuttle.cs @@ -7,570 +7,568 @@ using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.NPCs.NormalNPCs { - public class ShockstormShuttle : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Shockstorm Shuttle"); - } + public class ShockstormShuttle : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shockstorm Shuttle"); + Main.npcFrameCount[npc.type] = 4; + } - public override void SetDefaults() - { - npc.npcSlots = 3f; - npc.damage = 30; - npc.width = 64; - npc.height = 38; - npc.defense = 15; + public override void SetDefaults() + { + npc.npcSlots = 3f; + npc.damage = 30; + npc.width = 64; + npc.height = 38; + npc.defense = 15; npc.DR_NERD(0.15f); - npc.lifeMax = 150; - npc.aiStyle = -1; - aiType = -1; - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 0, 5, 0); - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.noGravity = true; - npc.noTileCollide = true; - banner = npc.type; - bannerItem = ModContent.ItemType(); - } + npc.lifeMax = 150; + npc.aiStyle = -1; + aiType = -1; + npc.knockBackResist = 0f; + npc.value = Item.buyPrice(0, 0, 5, 0); + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + npc.noGravity = true; + npc.noTileCollide = true; + banner = npc.type; + bannerItem = ModContent.ItemType(); + } - public override void AI() - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[0] += (float)Main.rand.Next(4); //adds to localAI to fire projectiles at random times - if (npc.localAI[0] >= (float)Main.rand.Next(100, 120)) //rate at which projectiles are shot - { - npc.localAI[0] = 0f; - npc.TargetClosest(true); - if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - float num179 = 12f; //speed of projectile - Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num180 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - value9.X; - float num181 = Math.Abs(num180) * 0.1f; - float num182 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - value9.Y - num181; - float num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); - npc.netUpdate = true; - num183 = num179 / num183; - num180 *= num183; - num182 *= num183; - int num184 = 30; //projectile damage - if (Main.expertMode) - { - num184 = 22; - } - int num185 = ProjectileID.MartianTurretBolt; //projectile ID - if (Main.rand.NextBool(8)) - { - num185 = ProjectileID.SaucerLaser; //more powerful projectile ID - } - value9.X += num180; - value9.Y += num182; - for (int num186 = 0; num186 < 2; num186++) //shoots two projectiles by looping twice - { - num180 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - value9.X; - num182 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - value9.Y; - num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); - num183 = 12f / num183; - num180 += (float)Main.rand.Next(-20, 21); //projectile spreadX - num182 += (float)Main.rand.Next(-20, 21); //projectile spreadY - num180 *= num183; - num182 *= num183; - Projectile.NewProjectile(value9.X, value9.Y, num180, num182, num185, num184, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - if (npc.localAI[3] == 0f && Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[3] = 1f; - } - Vector2 center16 = npc.Center; - Player player8 = Main.player[npc.target]; - if (npc.target < 0 || npc.target == 255 || player8.dead || !player8.active) - { - npc.TargetClosest(true); - player8 = Main.player[npc.target]; - npc.netUpdate = true; - } - if ((player8.dead || Vector2.Distance(player8.Center, center16) > 3200f) && npc.ai[0] != 1f) - { - if (npc.ai[0] == 0f) - { - npc.ai[0] = -1f; - } - if (npc.ai[0] == 2f) - { - npc.ai[0] = -2f; - } - npc.netUpdate = true; - } - if (npc.ai[0] == -1f || npc.ai[0] == -2f) - { - npc.velocity.Y = npc.velocity.Y - 0.4f; - if (npc.timeLeft > 10) - { - npc.timeLeft = 10; - } - if (!player8.dead) - { - npc.timeLeft = 300; - if (npc.ai[0] == -2f) - { - npc.ai[0] = 2f; - } - if (npc.ai[0] == 0f) - { - npc.ai[0] = 0f; - } - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - return; - } - } - else if (npc.ai[0] == 0f) - { - int num1580 = 0; - if (npc.ai[3] >= 580f) - { - num1580 = 0; - } - else if (npc.ai[3] >= 440f) - { - num1580 = 5; - } - else if (npc.ai[3] >= 420f) - { - num1580 = 4; - } - else if (npc.ai[3] >= 280f) - { - num1580 = 3; - } - else if (npc.ai[3] >= 260f) - { - num1580 = 2; - } - else if (npc.ai[3] >= 20f) - { - num1580 = 1; - } - npc.ai[3] += 1f; - if (npc.ai[3] >= 600f) - { - npc.ai[3] = 0f; - } - int num1581 = num1580; - if (npc.ai[3] >= 580f) - { - num1580 = 0; - } - else if (npc.ai[3] >= 440f) - { - num1580 = 5; - } - else if (npc.ai[3] >= 420f) - { - num1580 = 4; - } - else if (npc.ai[3] >= 280f) - { - num1580 = 3; - } - else if (npc.ai[3] >= 260f) - { - num1580 = 2; - } - else if (npc.ai[3] >= 20f) - { - num1580 = 1; - } - if (num1580 != num1581) - { - if (num1580 == 0) - { - npc.ai[2] = 0f; - } - if (num1580 == 1) - { - npc.ai[2] = (float)((Math.Sign((player8.Center - center16).X) == 1) ? 1 : -1); - } - if (num1580 == 2) - { - npc.ai[2] = 0f; - } - npc.netUpdate = true; - } - if (num1580 == 0) - { - if (npc.ai[2] == 0f) - { - npc.ai[2] = (float)(-600 * Math.Sign((center16 - player8.Center).X)); - } - Vector2 vector196 = player8.Center + new Vector2(npc.ai[2], -250f) - center16; - if (vector196.Length() < 50f) - { - npc.ai[3] = 19f; - } - else - { - vector196.Normalize(); - npc.velocity = Vector2.Lerp(npc.velocity, vector196 * 16f, 0.1f); - } - } - if (num1580 == 1) - { - int num1582 = (int)npc.Center.X / 16; - int num1583 = (int)(npc.position.Y + (float)npc.height) / 16; - int num1584 = 0; - bool flag149 = Main.tile[num1582, num1583].nactive() && Main.tileSolid[(int)Main.tile[num1582, num1583].type] && !Main.tileSolidTop[(int)Main.tile[num1582, num1583].type]; - if (flag149) - { - num1584 = 1; - } - else - { - while (num1584 < 150 && num1583 + num1584 < Main.maxTilesY) - { - int num1585 = num1583 + num1584; - bool flag150 = Main.tile[num1582, num1585].nactive() && Main.tileSolid[(int)Main.tile[num1582, num1585].type] && !Main.tileSolidTop[(int)Main.tile[num1582, num1585].type]; - if (flag150) - { - num1584--; - break; - } - num1584++; - } - } - float num1586 = (float)(num1584 * 16); - float num1587 = 250f; - if (num1586 < num1587) - { - float num1588 = -4f; - if (-num1588 > num1586) - { - num1588 = -num1586; - } - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, num1588, 0.05f); - } - else - { - npc.velocity.Y = npc.velocity.Y * 0.95f; - } - npc.velocity.X = 3.5f * npc.ai[2]; - } - if (num1580 == 2) - { - if (npc.ai[2] == 0f) - { - npc.ai[2] = (float)(300 * Math.Sign((center16 - player8.Center).X)); - } - Vector2 vector197 = player8.Center + new Vector2(npc.ai[2], -170f) - center16; - int num1589 = (int)npc.Center.X / 16; - int num1590 = (int)(npc.position.Y + (float)npc.height) / 16; - int num1591 = 0; - bool flag151 = Main.tile[num1589, num1590].nactive() && Main.tileSolid[(int)Main.tile[num1589, num1590].type] && !Main.tileSolidTop[(int)Main.tile[num1589, num1590].type]; - if (flag151) - { - num1591 = 1; - } - else - { - while (num1591 < 150 && num1590 + num1591 < Main.maxTilesY) - { - int num1592 = num1590 + num1591; - bool flag152 = Main.tile[num1589, num1592].nactive() && Main.tileSolid[(int)Main.tile[num1589, num1592].type] && !Main.tileSolidTop[(int)Main.tile[num1589, num1592].type]; - if (flag152) - { - num1591--; - break; - } - num1591++; - } - } - float num1593 = (float)(num1591 * 16); - float num1594 = 170f; - if (num1593 < num1594) - { - vector197.Y -= num1594 - num1593; - } - if (vector197.Length() < 70f) - { - npc.ai[3] = 279f; - } - else - { - vector197.Normalize(); - npc.velocity = Vector2.Lerp(npc.velocity, vector197 * 20f, 0.1f); - } - } - else if (num1580 == 3) - { - float num1595 = 0.85f; - int num1596 = (int)npc.Center.X / 16; - int num1597 = (int)(npc.position.Y + (float)npc.height) / 16; - int num1598 = 0; - bool flag153 = Main.tile[num1596, num1597].nactive() && Main.tileSolid[(int)Main.tile[num1596, num1597].type] && !Main.tileSolidTop[(int)Main.tile[num1596, num1597].type]; - if (flag153) - { - num1598 = 1; - } - else - { - while (num1598 < 150 && num1597 + num1598 < Main.maxTilesY) - { - int num1599 = num1597 + num1598; - bool flag154 = Main.tile[num1596, num1599].nactive() && Main.tileSolid[(int)Main.tile[num1596, num1599].type] && !Main.tileSolidTop[(int)Main.tile[num1596, num1599].type]; - if (flag154) - { - num1598--; - break; - } - num1598++; - } - } - float num1600 = (float)(num1598 * 16); - float num1601 = 170f; - if (num1600 < num1601) - { - float num1602 = -4f; - if (-num1602 > num1600) - { - num1602 = -num1600; - } - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, num1602, 0.05f); - } - else - { - npc.velocity.Y = npc.velocity.Y * num1595; - } - npc.velocity.X = npc.velocity.X * num1595; - } - if (num1580 == 4) - { - Vector2 vector198 = player8.Center + new Vector2(0f, -250f) - center16; - if (vector198.Length() < 50f) - { - npc.ai[3] = 439f; - return; - } - vector198.Normalize(); - npc.velocity = Vector2.Lerp(npc.velocity, vector198 * 16f, 0.1f); - return; - } - else if (num1580 == 5) - { - npc.velocity *= 0.85f; - return; - } - } - else if (npc.ai[0] == 1f) - { - npc.velocity *= 0.96f; - float num1603 = 150f; - npc.ai[1] += 1f; - if (npc.ai[1] >= num1603) - { - npc.ai[0] = 2f; - npc.ai[1] = 0f; - npc.rotation = 0f; - npc.netUpdate = true; - return; - } - if (npc.ai[1] < 40f) - { - npc.rotation = Vector2.UnitY.RotatedBy((double)(npc.ai[1] / 40f * 6.28318548f), default).Y * 0.2f; - return; - } - if (npc.ai[1] < 80f) - { - npc.rotation = Vector2.UnitY.RotatedBy((double)(npc.ai[1] / 20f * 6.28318548f), default).Y * 0.3f; - return; - } - if (npc.ai[1] < 120f) - { - npc.rotation = Vector2.UnitY.RotatedBy((double)(npc.ai[1] / 10f * 6.28318548f), default).Y * 0.4f; - return; - } - npc.rotation = (npc.ai[1] - 120f) / 30f * 6.28318548f; - return; - } - else if (npc.ai[0] == 2f) - { - float num1605 = 3600f; - float num1606 = 120f; - float num1607 = 60f; - int num1608 = 0; - if (npc.ai[3] % num1606 >= num1607) - { - num1608 = 1; - } - int num1609 = num1608; - num1608 = 0; - npc.ai[3] += 1f; - if (npc.ai[3] % num1606 >= num1607) - { - num1608 = 1; - } - if (num1608 != num1609) - { - if (num1608 == 1) - { - npc.ai[2] = (float)((Math.Sign((player8.Center - center16).X) == 1) ? 1 : -1); - if (Main.netMode != NetmodeID.MultiplayerClient) //second projectile being shot. Didn't use this - { - npc.localAI[0] += (float)Main.rand.Next(4); - if (npc.localAI[0] >= (float)Main.rand.Next(50, 100)) - { - npc.localAI[0] = 0f; - npc.TargetClosest(true); - if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - float num179 = 11f; - Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num180 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - value9.X; - float num181 = Math.Abs(num180) * 0.1f; - float num182 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - value9.Y - num181; - float num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); - npc.netUpdate = true; - num183 = num179 / num183; - num180 *= num183; - num182 *= num183; - int num184 = 50; - if (Main.expertMode) - { - num184 = 28; - } - if (Main.hardMode) - { - num184 = 40; - if (NPC.downedMoonlord) - { - num184 = 80; - if (Main.expertMode) - { - num184 = 45; - } - } - } - int num185 = ProjectileID.SaucerLaser; - value9.X += num180; - value9.Y += num182; - for (int num186 = 0; num186 < 2; num186++) - { - num180 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - value9.X; - num182 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - value9.Y; - num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); - num183 = 12f / num183; - num180 += (float)Main.rand.Next(-20, 21); - num182 += (float)Main.rand.Next(-20, 21); - num180 *= num183; - num182 *= num183; - Projectile.NewProjectile(value9.X, value9.Y, num180, num182, num185, num184, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - Main.PlaySound(SoundID.Item12, npc.position); - } - npc.netUpdate = true; - } - if (npc.ai[3] >= num1605) - { - npc.ai[0] = 2f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - else if (num1608 == 0) - { - Vector2 vector199 = player8.Center + new Vector2(npc.ai[2] * 350f, -250f) - center16; - vector199.Normalize(); - npc.velocity = Vector2.Lerp(npc.velocity, vector199 * 16f, 0.1f); - } - else - { - int num1610 = (int)npc.Center.X / 16; - int num1611 = (int)(npc.position.Y + (float)npc.height) / 16; - int num1612 = 0; - bool flag155 = Main.tile[num1610, num1611].nactive() && Main.tileSolid[(int)Main.tile[num1610, num1611].type] && !Main.tileSolidTop[(int)Main.tile[num1610, num1611].type]; - if (flag155) - { - num1612 = 1; - } - else - { - while (num1612 < 150 && num1611 + num1612 < Main.maxTilesY) - { - int num1613 = num1611 + num1612; - bool flag156 = Main.tile[num1610, num1613].nactive() && Main.tileSolid[(int)Main.tile[num1610, num1613].type] && !Main.tileSolidTop[(int)Main.tile[num1610, num1613].type]; - if (flag156) - { - num1612--; - break; - } - num1612++; - } - } - float num1614 = (float)(num1612 * 16); - float num1615 = 250f; - if (num1614 < num1615) - { - float num1616 = -4f; - if (-num1616 > num1614) - { - num1616 = -num1614; - } - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, num1616, 0.05f); - } - else - { - npc.velocity.Y = npc.velocity.Y * 0.95f; - } - npc.velocity.X = 8f * npc.ai[2]; - } - npc.rotation = 0f; - } - } + public override void AI() + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[0] += (float)Main.rand.Next(4); //adds to localAI to fire projectiles at random times + if (npc.localAI[0] >= (float)Main.rand.Next(100, 120)) //rate at which projectiles are shot + { + npc.localAI[0] = 0f; + npc.TargetClosest(true); + if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + float projSpeed = 12f; //speed of projectile + Vector2 npcPos = npc.Center; + float targetX = Main.player[npc.target].Center.X - npcPos.X; + float YAdjust = Math.Abs(targetX) * 0.1f; + float targetY = Main.player[npc.target].Center.Y - npcPos.Y - YAdjust; + Vector2 velocity = new Vector2(targetX, targetY); + float targetDist = velocity.Length(); + npc.netUpdate = true; + targetDist = projSpeed / targetDist; + velocity.X *= targetDist; + velocity.Y *= targetDist; + int projDmg = 30; //projectile damage + if (Main.expertMode) + { + projDmg = 22; + } + int projType = ProjectileID.MartianTurretBolt; //projectile ID + if (Main.rand.NextBool(8)) + { + projType = ProjectileID.SaucerLaser; //more powerful projectile ID + } + npcPos.X += velocity.X; + npcPos.Y += velocity.Y; + for (int num186 = 0; num186 < 2; num186++) //shoots two projectiles by looping twice + { + velocity = Main.player[npc.target].Center - npcPos; + targetDist = velocity.Length(); + targetDist = projSpeed / targetDist; + velocity.X += (float)Main.rand.Next(-20, 21); //projectile spreadX + velocity.Y += (float)Main.rand.Next(-20, 21); //projectile spreadY + velocity.X *= targetDist; + velocity.Y *= targetDist; + Projectile.NewProjectile(npcPos, velocity, projType, projDmg, 0f, Main.myPlayer, 0f, 0f); + } + } + } + } + if (npc.localAI[3] == 0f && Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[3] = 1f; + } + Vector2 center16 = npc.Center; + Player player8 = Main.player[npc.target]; + if (npc.target < 0 || npc.target == Main.maxPlayers || player8.dead || !player8.active) + { + npc.TargetClosest(true); + player8 = Main.player[npc.target]; + npc.netUpdate = true; + } + if ((player8.dead || Vector2.Distance(player8.Center, center16) > 3200f) && npc.ai[0] != 1f) + { + if (npc.ai[0] == 0f) + { + npc.ai[0] = -1f; + } + if (npc.ai[0] == 2f) + { + npc.ai[0] = -2f; + } + npc.netUpdate = true; + } + if (npc.ai[0] == -1f || npc.ai[0] == -2f) + { + npc.velocity.Y = npc.velocity.Y - 0.4f; + if (npc.timeLeft > 10) + { + npc.timeLeft = 10; + } + if (!player8.dead) + { + npc.timeLeft = 300; + if (npc.ai[0] == -2f) + { + npc.ai[0] = 2f; + } + if (npc.ai[0] == 0f) + { + npc.ai[0] = 0f; + } + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + return; + } + } + else if (npc.ai[0] == 0f) + { + int num1580 = 0; + if (npc.ai[3] >= 580f) + { + num1580 = 0; + } + else if (npc.ai[3] >= 440f) + { + num1580 = 5; + } + else if (npc.ai[3] >= 420f) + { + num1580 = 4; + } + else if (npc.ai[3] >= 280f) + { + num1580 = 3; + } + else if (npc.ai[3] >= 260f) + { + num1580 = 2; + } + else if (npc.ai[3] >= 20f) + { + num1580 = 1; + } + npc.ai[3] += 1f; + if (npc.ai[3] >= 600f) + { + npc.ai[3] = 0f; + } + int num1581 = num1580; + if (npc.ai[3] >= 580f) + { + num1580 = 0; + } + else if (npc.ai[3] >= 440f) + { + num1580 = 5; + } + else if (npc.ai[3] >= 420f) + { + num1580 = 4; + } + else if (npc.ai[3] >= 280f) + { + num1580 = 3; + } + else if (npc.ai[3] >= 260f) + { + num1580 = 2; + } + else if (npc.ai[3] >= 20f) + { + num1580 = 1; + } + if (num1580 != num1581) + { + if (num1580 == 0) + { + npc.ai[2] = 0f; + } + if (num1580 == 1) + { + npc.ai[2] = (float)((Math.Sign((player8.Center - center16).X) == 1) ? 1 : -1); + } + if (num1580 == 2) + { + npc.ai[2] = 0f; + } + npc.netUpdate = true; + } + if (num1580 == 0) + { + if (npc.ai[2] == 0f) + { + npc.ai[2] = (float)(-600 * Math.Sign((center16 - player8.Center).X)); + } + Vector2 vector196 = player8.Center + new Vector2(npc.ai[2], -250f) - center16; + if (vector196.Length() < 50f) + { + npc.ai[3] = 19f; + } + else + { + vector196.Normalize(); + npc.velocity = Vector2.Lerp(npc.velocity, vector196 * 16f, 0.1f); + } + } + if (num1580 == 1) + { + int num1582 = (int)npc.Center.X / 16; + int num1583 = (int)(npc.position.Y + (float)npc.height) / 16; + int num1584 = 0; + bool flag149 = Main.tile[num1582, num1583].nactive() && Main.tileSolid[(int)Main.tile[num1582, num1583].type] && !Main.tileSolidTop[(int)Main.tile[num1582, num1583].type]; + if (flag149) + { + num1584 = 1; + } + else + { + while (num1584 < 150 && num1583 + num1584 < Main.maxTilesY) + { + int num1585 = num1583 + num1584; + bool flag150 = Main.tile[num1582, num1585].nactive() && Main.tileSolid[(int)Main.tile[num1582, num1585].type] && !Main.tileSolidTop[(int)Main.tile[num1582, num1585].type]; + if (flag150) + { + num1584--; + break; + } + num1584++; + } + } + float num1586 = (float)(num1584 * 16); + float num1587 = 250f; + if (num1586 < num1587) + { + float num1588 = -4f; + if (-num1588 > num1586) + { + num1588 = -num1586; + } + npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, num1588, 0.05f); + } + else + { + npc.velocity.Y = npc.velocity.Y * 0.95f; + } + npc.velocity.X = 3.5f * npc.ai[2]; + } + if (num1580 == 2) + { + if (npc.ai[2] == 0f) + { + npc.ai[2] = (float)(300 * Math.Sign((center16 - player8.Center).X)); + } + Vector2 vector197 = player8.Center + new Vector2(npc.ai[2], -170f) - center16; + int num1589 = (int)npc.Center.X / 16; + int num1590 = (int)(npc.position.Y + (float)npc.height) / 16; + int num1591 = 0; + bool flag151 = Main.tile[num1589, num1590].nactive() && Main.tileSolid[(int)Main.tile[num1589, num1590].type] && !Main.tileSolidTop[(int)Main.tile[num1589, num1590].type]; + if (flag151) + { + num1591 = 1; + } + else + { + while (num1591 < 150 && num1590 + num1591 < Main.maxTilesY) + { + int num1592 = num1590 + num1591; + bool flag152 = Main.tile[num1589, num1592].nactive() && Main.tileSolid[(int)Main.tile[num1589, num1592].type] && !Main.tileSolidTop[(int)Main.tile[num1589, num1592].type]; + if (flag152) + { + num1591--; + break; + } + num1591++; + } + } + float num1593 = (float)(num1591 * 16); + float num1594 = 170f; + if (num1593 < num1594) + { + vector197.Y -= num1594 - num1593; + } + if (vector197.Length() < 70f) + { + npc.ai[3] = 279f; + } + else + { + vector197.Normalize(); + npc.velocity = Vector2.Lerp(npc.velocity, vector197 * 20f, 0.1f); + } + } + else if (num1580 == 3) + { + float num1595 = 0.85f; + int num1596 = (int)npc.Center.X / 16; + int num1597 = (int)(npc.position.Y + (float)npc.height) / 16; + int num1598 = 0; + bool flag153 = Main.tile[num1596, num1597].nactive() && Main.tileSolid[(int)Main.tile[num1596, num1597].type] && !Main.tileSolidTop[(int)Main.tile[num1596, num1597].type]; + if (flag153) + { + num1598 = 1; + } + else + { + while (num1598 < 150 && num1597 + num1598 < Main.maxTilesY) + { + int num1599 = num1597 + num1598; + bool flag154 = Main.tile[num1596, num1599].nactive() && Main.tileSolid[(int)Main.tile[num1596, num1599].type] && !Main.tileSolidTop[(int)Main.tile[num1596, num1599].type]; + if (flag154) + { + num1598--; + break; + } + num1598++; + } + } + float num1600 = (float)(num1598 * 16); + float num1601 = 170f; + if (num1600 < num1601) + { + float num1602 = -4f; + if (-num1602 > num1600) + { + num1602 = -num1600; + } + npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, num1602, 0.05f); + } + else + { + npc.velocity.Y = npc.velocity.Y * num1595; + } + npc.velocity.X = npc.velocity.X * num1595; + } + if (num1580 == 4) + { + Vector2 vector198 = player8.Center + new Vector2(0f, -250f) - center16; + if (vector198.Length() < 50f) + { + npc.ai[3] = 439f; + return; + } + vector198.Normalize(); + npc.velocity = Vector2.Lerp(npc.velocity, vector198 * 16f, 0.1f); + return; + } + else if (num1580 == 5) + { + npc.velocity *= 0.85f; + return; + } + } + else if (npc.ai[0] == 1f) + { + npc.velocity *= 0.96f; + float num1603 = 150f; + npc.ai[1] += 1f; + if (npc.ai[1] >= num1603) + { + npc.ai[0] = 2f; + npc.ai[1] = 0f; + npc.rotation = 0f; + npc.netUpdate = true; + return; + } + if (npc.ai[1] < 40f) + { + npc.rotation = Vector2.UnitY.RotatedBy((double)(npc.ai[1] / 40f * MathHelper.TwoPi), default).Y * 0.2f; + return; + } + if (npc.ai[1] < 80f) + { + npc.rotation = Vector2.UnitY.RotatedBy((double)(npc.ai[1] / 20f * MathHelper.TwoPi), default).Y * 0.3f; + return; + } + if (npc.ai[1] < 120f) + { + npc.rotation = Vector2.UnitY.RotatedBy((double)(npc.ai[1] / 10f * MathHelper.TwoPi), default).Y * 0.4f; + return; + } + npc.rotation = (npc.ai[1] - 120f) / 30f * MathHelper.TwoPi; + return; + } + else if (npc.ai[0] == 2f) + { + float num1605 = 3600f; + float num1606 = 120f; + float num1607 = 60f; + int num1608 = 0; + if (npc.ai[3] % num1606 >= num1607) + { + num1608 = 1; + } + int num1609 = num1608; + num1608 = 0; + npc.ai[3] += 1f; + if (npc.ai[3] % num1606 >= num1607) + { + num1608 = 1; + } + if (num1608 != num1609) + { + if (num1608 == 1) + { + npc.ai[2] = (float)((Math.Sign((player8.Center - center16).X) == 1) ? 1 : -1); + if (Main.netMode != NetmodeID.MultiplayerClient) //second projectile being shot. Didn't use this + { + npc.localAI[0] += (float)Main.rand.Next(4); + if (npc.localAI[0] >= (float)Main.rand.Next(50, 100)) + { + npc.localAI[0] = 0f; + npc.TargetClosest(true); + if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + float projSpeed = 11f; + Vector2 npcPos = npc.Center; + float targetX = Main.player[npc.target].Center.X - npcPos.X; + float YAdjust = Math.Abs(targetX) * 0.1f; + float targetY = Main.player[npc.target].Center.Y - npcPos.Y - YAdjust; + Vector2 velocity = new Vector2(targetX, targetY); + float targetDist = velocity.Length(); + npc.netUpdate = true; + targetDist = projSpeed / targetDist; + velocity.X *= targetDist; + velocity.Y *= targetDist; + int projDmg = 50; + if (Main.expertMode) + { + projDmg = 28; + } + int projType = ProjectileID.SaucerLaser; + npcPos.X += velocity.X; + npcPos.Y += velocity.Y; + for (int num186 = 0; num186 < 2; num186++) + { + velocity.X = Main.player[npc.target].Center.X - npcPos.X; + velocity.Y = Main.player[npc.target].Center.Y - npcPos.Y; + targetDist = velocity.Length(); + targetDist = projSpeed / targetDist; + velocity.X += (float)Main.rand.Next(-20, 21); + velocity.Y += (float)Main.rand.Next(-20, 21); + velocity.X *= targetDist; + velocity.Y *= targetDist; + Projectile.NewProjectile(npcPos, velocity, projType, projDmg, 0f, Main.myPlayer, 0f, 0f); + } + } + } + } + Main.PlaySound(SoundID.Item12, npc.position); + } + npc.netUpdate = true; + } + if (npc.ai[3] >= num1605) + { + npc.ai[0] = 2f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + } + else if (num1608 == 0) + { + Vector2 vector199 = player8.Center + new Vector2(npc.ai[2] * 350f, -250f) - center16; + vector199.Normalize(); + npc.velocity = Vector2.Lerp(npc.velocity, vector199 * 16f, 0.1f); + } + else + { + int num1610 = (int)npc.Center.X / 16; + int num1611 = (int)(npc.position.Y + (float)npc.height) / 16; + int num1612 = 0; + bool flag155 = Main.tile[num1610, num1611].nactive() && Main.tileSolid[(int)Main.tile[num1610, num1611].type] && !Main.tileSolidTop[(int)Main.tile[num1610, num1611].type]; + if (flag155) + { + num1612 = 1; + } + else + { + while (num1612 < 150 && num1611 + num1612 < Main.maxTilesY) + { + int num1613 = num1611 + num1612; + bool flag156 = Main.tile[num1610, num1613].nactive() && Main.tileSolid[(int)Main.tile[num1610, num1613].type] && !Main.tileSolidTop[(int)Main.tile[num1610, num1613].type]; + if (flag156) + { + num1612--; + break; + } + num1612++; + } + } + float num1614 = (float)(num1612 * 16); + float num1615 = 250f; + if (num1614 < num1615) + { + float num1616 = -4f; + if (-num1616 > num1614) + { + num1616 = -num1614; + } + npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, num1616, 0.05f); + } + else + { + npc.velocity.Y = npc.velocity.Y * 0.95f; + } + npc.velocity.X = 8f * npc.ai[2]; + } + npc.rotation = 0f; + } + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 234, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 234, hitDirection, -1f, 0, default, 1f); - } - } - } + public override void FindFrame(int frameHeight) + { + npc.frameCounter += 0.15f; + npc.frameCounter %= Main.npcFrameCount[npc.type]; + int frame = (int)npc.frameCounter; + npc.frame.Y = frame * frameHeight; + } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || !Main.hardMode) - { - return 0f; - } - return SpawnCondition.Sky.Chance * 0.1f; - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 234, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 234, hitDirection, -1f, 0, default, 1f); + } + } + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Electrified, 120, true); - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || !Main.hardMode) + { + return 0f; + } + return SpawnCondition.Sky.Chance * 0.1f; + } - public override void NPCLoot() - { - DropHelper.DropItemCondition(npc, ItemID.MartianConduitPlating, NPC.downedGolemBoss, 1, 10, 30); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 3); - } - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Electrified, 120, true); + } + + public override void NPCLoot() + { + DropHelper.DropItemCondition(npc, ItemID.MartianConduitPlating, NPC.downedGolemBoss, 1, 10, 30); + DropHelper.DropItemChance(npc, ModContent.ItemType(), 3); + } + } } diff --git a/NPCs/NormalNPCs/ShockstormShuttle.png b/NPCs/NormalNPCs/ShockstormShuttle.png index 6f56a972bf..ef2147cbc0 100644 Binary files a/NPCs/NormalNPCs/ShockstormShuttle.png and b/NPCs/NormalNPCs/ShockstormShuttle.png differ diff --git a/NPCs/NormalNPCs/StormlionCharger.cs b/NPCs/NormalNPCs/StormlionCharger.cs index 78954750dc..4eb682ee86 100644 --- a/NPCs/NormalNPCs/StormlionCharger.cs +++ b/NPCs/NormalNPCs/StormlionCharger.cs @@ -24,25 +24,26 @@ namespace CalamityMod.NPCs.NormalNPCs npc.defense = 8; npc.lifeMax = 80; npc.knockBackResist = 0.2f; - animationType = 508; + animationType = NPCID.WalkingAntlion; npc.value = Item.buyPrice(0, 0, 2, 0); npc.HitSound = SoundID.NPCHit31; npc.DeathSound = SoundID.NPCDeath34; banner = npc.type; bannerItem = ModContent.ItemType(); + npc.buffImmune[BuffID.Confused] = false; } public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/NormalNPCs/SunBat.cs b/NPCs/NormalNPCs/SunBat.cs index 3738c615ef..47fee87ff6 100644 --- a/NPCs/NormalNPCs/SunBat.cs +++ b/NPCs/NormalNPCs/SunBat.cs @@ -18,18 +18,19 @@ namespace CalamityMod.NPCs.NormalNPCs { npc.lavaImmune = true; npc.aiStyle = 14; - aiType = 151; + aiType = NPCID.Lavabat; npc.damage = 35; npc.width = 26; npc.height = 20; npc.defense = 10; - npc.lifeMax = 120; + npc.lifeMax = 200; npc.knockBackResist = 0.65f; npc.value = Item.buyPrice(0, 0, 5, 0); npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath4; banner = npc.type; bannerItem = ModContent.ItemType(); + npc.buffImmune[BuffID.Confused] = false; } public override void FindFrame(int frameHeight) diff --git a/NPCs/NormalNPCs/Sunskater.cs b/NPCs/NormalNPCs/Sunskater.cs index 22a827bbf5..3f8a47f067 100644 --- a/NPCs/NormalNPCs/Sunskater.cs +++ b/NPCs/NormalNPCs/Sunskater.cs @@ -1,6 +1,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; +using Microsoft.Xna.Framework; using System; using System.IO; using Terraria; @@ -100,42 +101,28 @@ namespace CalamityMod.NPCs.NormalNPCs npc.TargetClosest(true); npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.15f; npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * 0.15f; - if (npc.velocity.X > 10f) - { - npc.velocity.X = 10f; - } - if (npc.velocity.X < -10f) - { - npc.velocity.X = -10f; - } - if (npc.velocity.Y > 10f) - { - npc.velocity.Y = 10f; - } - if (npc.velocity.Y < -10f) - { - npc.velocity.Y = -10f; - } + npc.velocity.X = MathHelper.Clamp(npc.velocity.X, -10f, 10f); + npc.velocity.Y = MathHelper.Clamp(npc.velocity.Y, -10f, 10f); } else { - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; + npc.velocity.X += (float)npc.direction * 0.1f; if (npc.velocity.X < -2f || npc.velocity.X > 2f) { - npc.velocity.X = npc.velocity.X * 0.95f; + npc.velocity.X *= 0.95f; } if (npc.ai[0] == -1f) { - npc.velocity.Y = npc.velocity.Y - 0.01f; - if ((double)npc.velocity.Y < -0.3) + npc.velocity.Y -= 0.01f; + if (npc.velocity.Y < -0.3f) { npc.ai[0] = 1f; } } else { - npc.velocity.Y = npc.velocity.Y + 0.01f; - if ((double)npc.velocity.Y > 0.3) + npc.velocity.Y += 0.01f; + if (npc.velocity.Y > 0.3f) { npc.ai[0] = -1f; } @@ -166,17 +153,17 @@ namespace CalamityMod.NPCs.NormalNPCs npc.ai[0] = -1f; } } - if ((double)npc.velocity.Y > 0.4 || (double)npc.velocity.Y < -0.4) + if (npc.velocity.Y > 0.4f || npc.velocity.Y < -0.4f) { - npc.velocity.Y = npc.velocity.Y * 0.95f; + npc.velocity.Y *= 0.95f; } } else { if (npc.velocity.Y == 0f) { - npc.velocity.X = npc.velocity.X * 0.94f; - if ((double)npc.velocity.X > -0.2 && (double)npc.velocity.X < 0.2) + npc.velocity.X *= 0.94f; + if (npc.velocity.X > -0.2f && npc.velocity.X < 0.2f) { npc.velocity.X = 0f; } diff --git a/NPCs/NormalNPCs/SuperDummyNPC.cs b/NPCs/NormalNPCs/SuperDummyNPC.cs index e1193b6f3a..034a8ac109 100644 --- a/NPCs/NormalNPCs/SuperDummyNPC.cs +++ b/NPCs/NormalNPCs/SuperDummyNPC.cs @@ -3,44 +3,47 @@ using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.NPCs.NormalNPCs { - public class SuperDummyNPC : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Super Dummy"); - } + public class SuperDummyNPC : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Super Dummy"); + } - public override void SetDefaults() - { - npc.width = 18; - npc.height = 48; - npc.damage = 0; - npc.defense = 0; - npc.lifeMax = 9999999; - npc.HitSound = SoundID.NPCHit15; - npc.DeathSound = SoundID.NPCDeath2; - npc.value = 0f; - npc.knockBackResist = 0f; - } + public override void SetDefaults() + { + npc.width = 18; + npc.height = 48; + npc.damage = 0; + npc.defense = 0; + npc.lifeMax = 9999999; + npc.HitSound = SoundID.NPCHit15; + npc.DeathSound = SoundID.NPCDeath2; + npc.value = 0f; + npc.knockBackResist = 0f; + npc.buffImmune[BuffID.Confused] = false; + npc.netAlways = true; + npc.aiStyle = 0; + } - public override void UpdateLifeRegen(ref int damage) - { - npc.lifeRegen += 2000000; - } + public override void UpdateLifeRegen(ref int damage) + { + npc.lifeRegen += 2000000; + } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + return false; + } - public override bool CheckDead() - { - if (npc.lifeRegen < 0) - { - npc.life = npc.lifeMax; - return false; - } - return true; - } - } + public override bool CheckDead() + { + if (npc.lifeRegen < 0) + { + npc.life = npc.lifeMax; + return false; + } + return true; + } + } } diff --git a/NPCs/NormalNPCs/WulfrumDrone.cs b/NPCs/NormalNPCs/WulfrumDrone.cs index 126d245e90..a818545724 100644 --- a/NPCs/NormalNPCs/WulfrumDrone.cs +++ b/NPCs/NormalNPCs/WulfrumDrone.cs @@ -4,66 +4,155 @@ using CalamityMod.Items.Placeables.Banners; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using System; +using Microsoft.Xna.Framework; + namespace CalamityMod.NPCs.NormalNPCs { + internal enum DroneAIState + { + Searching = 0, + Charging = 1 + } public class WulfrumDrone : ModNPC { + internal DroneAIState AIState + { + get => (DroneAIState)(int)npc.ai[0]; + set => npc.ai[0] = (int)value; + } + public float HorizontalChargeTime + { + get => npc.ai[1]; + set => npc.ai[1] = value; + } + public float Time + { + get => npc.ai[2]; + set => npc.ai[2] = value; + } + public float SuperchargeTimer + { + get => npc.ai[3]; + set => npc.ai[3] = value; + } + public bool Supercharged => SuperchargeTimer > 0; + + public const float TotalHorizontalChargeTime = 75f; public override void SetStaticDefaults() { DisplayName.SetDefault("Wulfrum Drone"); - Main.npcFrameCount[npc.type] = 5; + Main.npcFrameCount[npc.type] = 6; } public override void SetDefaults() { - npc.damage = 10; - npc.aiStyle = 3; - aiType = 73; - npc.width = 40; - npc.height = 30; + aiType = -1; + npc.aiStyle = -1; + npc.damage = 16; + npc.width = 32; + npc.height = 32; npc.defense = 4; - npc.lifeMax = 22; + npc.lifeMax = 21; npc.knockBackResist = 0.35f; - npc.value = Item.buyPrice(0, 0, 0, 50); + npc.value = Item.buyPrice(0, 0, 1, 20); + npc.noGravity = true; + npc.noTileCollide = true; npc.HitSound = SoundID.NPCHit4; npc.DeathSound = SoundID.NPCDeath14; banner = npc.type; bannerItem = ModContent.ItemType(); } - public override void PostAI() + public override void AI() { - npc.spriteDirection = (npc.direction > 0) ? 1 : -1; + npc.TargetClosest(false); + + Player player = Main.player[npc.target]; + + if (Supercharged) + { + SuperchargeTimer--; + } + + if (AIState == DroneAIState.Searching) + { + if (npc.direction == 0) + npc.direction = 1; + Vector2 destination = player.Center + new Vector2(300f * npc.direction, -90f); + npc.velocity = Vector2.Lerp(npc.velocity, npc.DirectionTo(destination) * 8f, 0.1f); + if (npc.Distance(destination) < 40f) + { + Time++; + npc.velocity *= 0.95f; + if (Time >= 40f) + { + AIState = DroneAIState.Charging; + npc.netUpdate = true; + } + } + } + else + { + if (HorizontalChargeTime < 25) + { + npc.velocity = Vector2.Lerp(npc.velocity, npc.DirectionTo(player.Center) * 8f, 0.1f); + } + if (Supercharged && Main.netMode != NetmodeID.MultiplayerClient && HorizontalChargeTime % 30f == 29f) + { + Projectile.NewProjectile(npc.Center + Vector2.UnitX * 6f * npc.spriteDirection, npc.DirectionTo(player.Center) * 6f, ProjectileID.MartianTurretBolt, 14, 0f); + } + HorizontalChargeTime++; + if (HorizontalChargeTime > TotalHorizontalChargeTime) + { + AIState = DroneAIState.Searching; + HorizontalChargeTime = 0f; + npc.direction = (player.Center.X - npc.Center.X < 0).ToDirectionInt(); + npc.netUpdate = true; + } + } + npc.spriteDirection = (npc.velocity.X < 0).ToDirectionInt(); + npc.rotation = npc.velocity.X / 25f; + + // Generate idle dust + if (!Main.dedServ) + { + Dust dust = Dust.NewDustPerfect(npc.Bottom, 229); + dust.color = Color.Green; + dust.scale = 0.9f; + } } public override void FindFrame(int frameHeight) { - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; + npc.frameCounter++; + int frame = (int)(npc.frameCounter / 5) % (Main.npcFrameCount[npc.type] / 2); + if (Supercharged) + frame += Main.npcFrameCount[npc.type] / 2; + npc.frame.Y = frame * frameHeight; } public override float SpawnChance(NPCSpawnInfo spawnInfo) { + float pylonMult = NPC.AnyNPCs(ModContent.NPCType()) ? 2f : 1f; if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneSulphur) - { return 0f; - } - return SpawnCondition.OverworldDaySlime.Chance * (Main.hardMode ? 0.05f : 0.2f); + + return SpawnCondition.OverworldDaySlime.Chance * (Main.hardMode ? 0.05f : 0.2f) * pylonMult; } public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 3, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.GrassBlades, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 15; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 3, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.GrassBlades, hitDirection, -1f, 0, default, 1f); } } } @@ -71,8 +160,9 @@ namespace CalamityMod.NPCs.NormalNPCs public override void NPCLoot() { DropHelper.DropItem(npc, ModContent.ItemType(), 1, 3); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.expertMode, 1, 1); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.expertMode); DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), Supercharged); } } } diff --git a/NPCs/NormalNPCs/WulfrumDrone.png b/NPCs/NormalNPCs/WulfrumDrone.png index 63a3927889..f529f6a27e 100644 Binary files a/NPCs/NormalNPCs/WulfrumDrone.png and b/NPCs/NormalNPCs/WulfrumDrone.png differ diff --git a/NPCs/NormalNPCs/WulfrumGyrator.cs b/NPCs/NormalNPCs/WulfrumGyrator.cs new file mode 100644 index 0000000000..3323ce5634 --- /dev/null +++ b/NPCs/NormalNPCs/WulfrumGyrator.cs @@ -0,0 +1,178 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Banners; +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.NPCs.NormalNPCs +{ + public class WulfrumGyrator : ModNPC + { + public float TimeSpentStuck + { + get => npc.ai[0]; + set => npc.ai[0] = value; + } + public float SuperchargeTimer + { + get => npc.ai[3]; + set => npc.ai[3] = value; + } + public bool Supercharged => SuperchargeTimer > 0; + + public const float PlayerTargetingThreshold = 90f; + public const float PlayerSearchDistance = 500f; + public const float StuckJumpPromptTime = 45f; + public const float MaxMovementSpeedX = 8f; + public const float JumpSpeed = -9f; + public const float NPCGravity = 0.3f; // NPC.cs has this, but it's private, and there's no way in hell I'm using reflection. + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Wulfrum Gyrator"); + Main.npcFrameCount[npc.type] = 10; + } + + public override void SetDefaults() + { + aiType = -1; + npc.aiStyle = -1; + npc.damage = 15; + npc.width = 40; + npc.height = 40; + npc.defense = 5; + npc.lifeMax = 18; + npc.knockBackResist = 0.15f; + npc.value = Item.buyPrice(0, 0, 1, 15); + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + banner = npc.type; + bannerItem = ModContent.ItemType(); + npc.buffImmune[BuffID.Confused] = false; + } + + public override void FindFrame(int frameHeight) + { + npc.frameCounter++; + int frame = (int)(npc.frameCounter / 5) % (Main.npcFrameCount[npc.type] / 2); + if (Supercharged) + frame += Main.npcFrameCount[npc.type] / 2; + + npc.frame.Y = frame * frameHeight; + } + + public override void AI() + { + npc.TargetClosest(false); + + Player player = Main.player[npc.target]; + + if (Supercharged) + { + float chargeJumpSpeed = -14f; + + float maxHeight = chargeJumpSpeed * chargeJumpSpeed * (float)Math.Pow(Math.Sin(npc.AngleTo(player.Center)), 2) / (4f * NPCGravity); + bool jumpWouldHitPlayer = maxHeight > Math.Abs(player.Center.Y - npc.Center.Y) && maxHeight < Math.Abs(player.Center.Y - npc.Center.Y) + player.height; + if (jumpWouldHitPlayer && npc.collideY && npc.velocity.Y == 0f) + { + npc.velocity.Y = chargeJumpSpeed; + } + SuperchargeTimer--; + } + + // Jump if there's an obstacle ahead. + if (HoleAtPosition(npc.Center.X + npc.velocity.X * 4f) && npc.collideY && npc.velocity.Y == 0f) + { + npc.velocity.Y = JumpSpeed; + } + if (Collision.CanHitLine(player.position, player.width, player.height, npc.position, npc.width, npc.height) && + Math.Abs(player.Center.X - npc.Center.X) < PlayerSearchDistance && + Math.Abs(player.Center.X - npc.Center.X) > PlayerTargetingThreshold) + { + int direction = Math.Sign(player.Center.X - npc.Center.X) * (npc.confused ? -1 : 1); + if (npc.direction != direction) + { + npc.direction = direction; + npc.netUpdate = true; + } + } + else if (npc.collideX && npc.collideY && npc.velocity.Y == 0f) + { + npc.velocity.Y = JumpSpeed; + } + + if (npc.oldPosition == npc.position) + { + TimeSpentStuck++; + if (TimeSpentStuck > StuckJumpPromptTime) + { + npc.velocity.Y = JumpSpeed; + TimeSpentStuck = 0f; + npc.netUpdate = true; + } + } + else + { + TimeSpentStuck = 0f; + } + + npc.velocity.X = MathHelper.Lerp(npc.velocity.X, MaxMovementSpeedX * npc.direction * (Supercharged ? 1.333f : 1f), Supercharged ? 0.025f : 0.015f); + Vector4 adjustedVectors = Collision.WalkDownSlope(npc.position, npc.velocity, npc.width, npc.height, NPCGravity); + npc.position = adjustedVectors.XY(); + npc.velocity = adjustedVectors.ZW(); + } + private bool HoleAtPosition(float xPosition) + { + int tileWidth = npc.width / 16; + xPosition = (int)(xPosition / 16f) - tileWidth; + if (npc.velocity.X > 0) + { + xPosition += tileWidth; + } + int tileY = (int)((npc.position.Y + npc.height) / 16f); + for (int y = tileY; y < tileY + 2; y++) + { + for (int x = (int)xPosition; x < xPosition + tileWidth; x++) + { + if (Main.tile[x, y].active()) + { + return false; + } + } + } + return true; + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + float pylonMult = NPC.AnyNPCs(ModContent.NPCType()) ? 2f : 1f; + if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneSulphur) + return 0f; + return SpawnCondition.OverworldDaySlime.Chance * (Main.hardMode ? 0.0333f : 0.15f) * pylonMult; + } + + public override void HitEffect(int hitDirection, double damage) + { + if (!Main.dedServ) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 3, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 3, hitDirection, -1f, 0, default, 1f); + } + } + } + } + + public override void NPCLoot() + { + DropHelper.DropItem(npc, ModContent.ItemType(), 1, 2); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), Supercharged); + } + } +} diff --git a/NPCs/NormalNPCs/WulfrumGyrator.png b/NPCs/NormalNPCs/WulfrumGyrator.png new file mode 100644 index 0000000000..05d8021a90 Binary files /dev/null and b/NPCs/NormalNPCs/WulfrumGyrator.png differ diff --git a/NPCs/NormalNPCs/WulfrumHovercraft.cs b/NPCs/NormalNPCs/WulfrumHovercraft.cs new file mode 100644 index 0000000000..c03dd17b80 --- /dev/null +++ b/NPCs/NormalNPCs/WulfrumHovercraft.cs @@ -0,0 +1,255 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Banners; +using Microsoft.Xna.Framework; +using System; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.NormalNPCs +{ + public class WulfrumHovercraft : ModNPC + { + internal enum HovercraftAIState + { + Searching = 0, + Hover = 1, + Slowdown = 2, + SwoopDownward = 3 + } + public float StunTime; + internal HovercraftAIState AIState + { + get => (HovercraftAIState)(int)npc.ai[0]; + set => npc.ai[0] = (int)value; + } + public float SubphaseTime + { + get => npc.ai[1]; + set => npc.ai[1] = value; + } + public float SearchDirection + { + get => npc.ai[2]; + set => npc.ai[2] = value; + } + public float SuperchargeTimer + { + get => npc.ai[3]; + set => npc.ai[3] = value; + } + public bool Supercharged => SuperchargeTimer > 0; + + public const float StunTimeMax = 45f; + public const float SearchXOffset = 345f; + public const float SearchSpeed = 7f; + public const float HoverSpeed = 5f; + public const float TotalSubphaseTime = 110f; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Wulfrum Hovercraft"); + Main.npcFrameCount[npc.type] = 12; + } + + public override void SetDefaults() + { + aiType = -1; + npc.aiStyle = -1; + npc.damage = 15; + npc.width = 40; + npc.height = 38; + npc.defense = 4; + npc.lifeMax = 20; + npc.value = Item.buyPrice(0, 0, 1, 50); + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + npc.noGravity = true; + npc.noTileCollide = true; + banner = npc.type; + bannerItem = ModContent.ItemType(); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(StunTime); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + StunTime = reader.ReadSingle(); + } + + public override void FindFrame(int frameHeight) + { + npc.frameCounter++; + int frame = (int)(npc.frameCounter / 5) % (Main.npcFrameCount[npc.type] / 2); + if (Supercharged) + frame += Main.npcFrameCount[npc.type] / 2; + + npc.frame.Y = frame * frameHeight; + } + + public override void AI() + { + npc.knockBackResist = 0.1f; + + if (npc.target < 0 || npc.target >= 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) + { + npc.TargetClosest(false); + + // Fly away if there is no living target, or the closest target is too far away. + if (Main.player[npc.target].dead || + !Main.player[npc.target].active || + npc.Distance(Main.player[npc.target].Center) > 1100f) + { + npc.velocity = Vector2.Lerp(npc.velocity, Vector2.UnitY * -8f, 0.1f); + npc.rotation = npc.rotation.AngleTowards(0f, MathHelper.ToRadians(15f)); + return; + } + } + + Lighting.AddLight(npc.Center - Vector2.UnitY * 8f, Color.Lime.ToVector3() * 1.5f); + + if (StunTime > 0) + { + if (!Main.dedServ && Main.rand.NextBool(4)) + { + for (int i = 0; i < 2; i++) + { + Dust.NewDustPerfect(npc.Center + Main.rand.NextVector2Circular(8f, 8f), 226).scale = 0.7f; + } + } + + npc.rotation = npc.rotation.AngleTowards(0f, MathHelper.ToRadians(15f)); + if (StunTime > StunTimeMax - 15) + npc.velocity *= 0.6f; + else + npc.knockBackResist = 2.4f; + + StunTime--; + return; + } + + Player player = Main.player[npc.target]; + if (SearchDirection == 0f) + { + if (Math.Abs(player.Center.X + SearchXOffset - npc.Center.X) < Math.Abs(player.Center.X - SearchXOffset - npc.Center.X)) + SearchDirection = 1f; + else + SearchDirection = -1f; + + npc.netUpdate = true; + } + if (AIState == HovercraftAIState.Searching || + AIState == HovercraftAIState.Hover) + { + Vector2 destination = player.Center + new Vector2(SearchXOffset * SearchDirection, -160f); + npc.velocity = npc.DirectionTo(destination) * (Supercharged ? 8.5f : 6f); + if (AIState == HovercraftAIState.Hover) + { + destination = player.Center + new Vector2(SearchXOffset * -SearchDirection, -160f); + npc.velocity = npc.DirectionTo(destination) * (Supercharged ? 7f : 5f); + } + + npc.rotation = npc.velocity.X / 16f; + if (npc.Distance(destination) < 50f) + { + if (AIState == HovercraftAIState.Searching) + { + AIState = HovercraftAIState.Slowdown; + } + else + { + AIState = HovercraftAIState.SwoopDownward; + } + npc.netUpdate = true; + } + } + + if (AIState == HovercraftAIState.Slowdown) + { + SubphaseTime++; + if (SubphaseTime < 30f) + { + npc.velocity *= 0.96f; + } + else + { + AIState = HovercraftAIState.Hover; + SubphaseTime = 0f; + npc.netUpdate = true; + } + } + + if (AIState == HovercraftAIState.SwoopDownward) + { + npc.rotation = 0f; + float swoopType = Supercharged ? TotalSubphaseTime - 40f : TotalSubphaseTime; + float swoopSlowdownTime = Supercharged ? 10f : 45f; + Vector2 swoopVelocity = Vector2.UnitY.RotatedBy(MathHelper.Pi * SubphaseTime / swoopType * -SearchDirection) * (Supercharged ? 13f : 10f); + + SubphaseTime++; + if (SubphaseTime < swoopSlowdownTime) + { + swoopVelocity *= MathHelper.Lerp(1f, 0.75f, Utils.InverseLerp(45f, 0f, SubphaseTime)); + } + if (SubphaseTime >= swoopType - swoopSlowdownTime) + { + swoopVelocity *= MathHelper.Lerp(1f, 0.75f, Utils.InverseLerp(swoopType - 45f, swoopType, SubphaseTime)); + } + swoopVelocity.Y *= 0.5f; + + npc.velocity = Vector2.Lerp(npc.velocity, swoopVelocity, 0.25f); + + if (SubphaseTime >= swoopType) + { + AIState = HovercraftAIState.Searching; + SearchDirection = 0f; + SubphaseTime = 0f; + npc.netUpdate = true; + } + npc.rotation = npc.velocity.X / 12f; + } + npc.spriteDirection = (npc.velocity.X < 0).ToDirectionInt(); + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + float pylonMult = NPC.AnyNPCs(ModContent.NPCType()) ? 2f : 1f; + if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneSulphur) + return 0f; + return SpawnCondition.OverworldDaySlime.Chance * (Main.hardMode ? 0.025f : 0.125f) * pylonMult; + } + + public override void HitEffect(int hitDirection, double damage) + { + if (!Main.dedServ) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 3, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 3, hitDirection, -1f, 0, default, 1f); + } + } + } + } + + public override void OnHitByItem(Player player, Item item, int damage, float knockback, bool crit) + { + StunTime = StunTimeMax; + npc.netUpdate = true; + } + + public override void NPCLoot() + { + DropHelper.DropItem(npc, ModContent.ItemType(), 2, 3); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), Supercharged); + } + } +} diff --git a/NPCs/NormalNPCs/WulfrumHovercraft.png b/NPCs/NormalNPCs/WulfrumHovercraft.png new file mode 100644 index 0000000000..b3df311349 Binary files /dev/null and b/NPCs/NormalNPCs/WulfrumHovercraft.png differ diff --git a/NPCs/NormalNPCs/WulfrumPylon.cs b/NPCs/NormalNPCs/WulfrumPylon.cs new file mode 100644 index 0000000000..88443a1876 --- /dev/null +++ b/NPCs/NormalNPCs/WulfrumPylon.cs @@ -0,0 +1,160 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Banners; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Microsoft.Xna.Framework; +using System.Collections.Generic; + +namespace CalamityMod.NPCs.NormalNPCs +{ + public class WulfrumPylon : ModNPC + { + public bool Charging + { + get => npc.ai[0] != 0f; + set => npc.ai[0] = value.ToInt(); + } + public float ChargeRadius + { + get => npc.ai[1]; + set => npc.ai[1] = value; + } + public static List SuperchargableEnemies = new List() + { + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType() + }; + public const float ChargeRadiusMax = 200f; + public const float SuperchargeTime = 600f; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Wulfrum Pylon"); + Main.npcFrameCount[npc.type] = 6; + } + + public override void SetDefaults() + { + aiType = -1; + npc.aiStyle = -1; + npc.damage = 16; + npc.width = 44; + npc.height = 44; + npc.defense = 4; + npc.lifeMax = 49; + npc.knockBackResist = 0f; + npc.value = Item.buyPrice(0, 0, 1, 50); + npc.noGravity = false; + npc.noTileCollide = false; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + npc.buffImmune[BuffID.Confused] = false; + banner = npc.type; + bannerItem = ModContent.ItemType(); + } + + public override void AI() + { + npc.TargetClosest(false); + + Player player = Main.player[npc.target]; + + if (!Charging && npc.Distance(player.Center) < ChargeRadiusMax * 0.667f) + { + Charging = true; + npc.netUpdate = true; + } + else if (Charging) + { + ChargeRadius = (int)MathHelper.Lerp(ChargeRadius, ChargeRadiusMax, 0.1f); + + if (Main.rand.NextBool(4)) + { + float dustCount = MathHelper.TwoPi * ChargeRadius / 5f; + for (int i = 0; i < dustCount; i++) + { + float angle = MathHelper.TwoPi * i / dustCount; + Dust dust = Dust.NewDustPerfect(npc.Center, 229); + dust.position = npc.Center + angle.ToRotationVector2() * ChargeRadius; + dust.noGravity = true; + dust.velocity = npc.velocity; + } + } + + for (int i = 0; i < Main.npc.Length; i++) + { + NPC npcAtIndex = Main.npc[i]; + if (!npcAtIndex.active) + continue; + + // For some strange reason, the Wulfrum Rover is not counted when it's added to a static list. + // What I assume is going on is that it hasn't been loaded yet since it's later alphabetically (Pylon is before Rover). + // As a result, they are checked separately. + if (!SuperchargableEnemies.Contains(npcAtIndex.type) && + npcAtIndex.type != ModContent.NPCType()) + continue; + if (npcAtIndex.ai[3] > 0f) + continue; + if (npc.Distance(npcAtIndex.Center) > ChargeRadius) + continue; + + npcAtIndex.ai[3] = SuperchargeTime; // Supercharge the npc for a while if isn't already supercharged. + npcAtIndex.netUpdate = true; + + // And emit some dust. + + // Dust doesn't need to be spawned for the server. + if (Main.dedServ) + continue; + + for (int j = 0; j < 10; j++) + { + Dust.NewDust(npcAtIndex.position, npcAtIndex.width, npcAtIndex.height, 226); + } + } + } + } + + public override void FindFrame(int frameHeight) + { + npc.frameCounter++; + int frame = (int)(npc.frameCounter / 8) % Main.npcFrameCount[npc.type]; + + npc.frame.Y = frame * frameHeight; + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneSulphur) + return 0f; + + // Only spawn in the other thirds of the world bounds. + if (spawnInfo.playerFloorX > Main.maxTilesX * 0.333f && spawnInfo.playerFloorX < Main.maxTilesX - Main.maxTilesX * 0.333f) + return 0f; + + return SpawnCondition.OverworldDaySlime.Chance * (Main.hardMode ? 0.06f : 0.22f); + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, DustID.GrassBlades, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 15; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, DustID.GrassBlades, hitDirection, -1f, 0, default, 1f); + } + } + } + + public override void NPCLoot() + { + DropHelper.DropItem(npc, ModContent.ItemType(), 2, 3); + DropHelper.DropItem(npc, ModContent.ItemType()); + } + } +} diff --git a/NPCs/NormalNPCs/WulfrumPylon.png b/NPCs/NormalNPCs/WulfrumPylon.png new file mode 100644 index 0000000000..c578407dd3 Binary files /dev/null and b/NPCs/NormalNPCs/WulfrumPylon.png differ diff --git a/NPCs/NormalNPCs/WulfrumRover.cs b/NPCs/NormalNPCs/WulfrumRover.cs new file mode 100644 index 0000000000..1344b783bf --- /dev/null +++ b/NPCs/NormalNPCs/WulfrumRover.cs @@ -0,0 +1,146 @@ +using CalamityMod.Items.Accessories; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Banners; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.NPCs.NormalNPCs +{ + public class WulfrumRover : ModNPC + { + public float SuperchargeTimer + { + get => npc.ai[3]; + set => npc.ai[3] = value; + } + public const float PlayerTargetingThreshold = 90f; + public const float PlayerSearchDistance = 500f; + public const float StuckJumpPromptTime = 90f; + public const float MaxMovementSpeedX = 8f; + public bool Supercharged => SuperchargeTimer > 0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Wulfrum Rover"); + Main.npcFrameCount[npc.type] = 16; + } + + public override void SetDefaults() + { + aiType = -1; + npc.aiStyle = -1; + npc.damage = 10; + npc.width = 40; + npc.height = 40; + npc.defense = 4; + npc.lifeMax = 32; + npc.knockBackResist = 0.15f; + npc.value = Item.buyPrice(0, 0, 1, 15); + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + banner = npc.type; + bannerItem = ModContent.ItemType(); + npc.buffImmune[BuffID.Confused] = false; + } + + public override void FindFrame(int frameHeight) + { + npc.frameCounter++; + int frame = (int)(npc.frameCounter / 5) % (Main.npcFrameCount[npc.type] / 2); + if (Supercharged) + frame += Main.npcFrameCount[npc.type] / 2; + + npc.frame.Y = frame * frameHeight; + } + + public override void AI() + { + npc.TargetClosest(false); + + if (Supercharged) + { + SuperchargeTimer--; + npc.defense = 13; + } + else if (!Supercharged) + { + npc.defense = 4; + } + + Player player = Main.player[npc.target]; + if (Collision.CanHitLine(player.position, player.width, player.height, npc.position, npc.width, npc.height) && + Math.Abs(player.Center.X - npc.Center.X) < PlayerSearchDistance && + Math.Abs(player.Center.X - npc.Center.X) > PlayerTargetingThreshold) + { + int direction = Math.Sign(player.Center.X - npc.Center.X) * (npc.confused ? -1 : 1); + if (npc.direction != direction) + { + npc.direction = direction; + npc.netUpdate = true; + } + } + else if (npc.collideX) + { + npc.direction *= -1; + npc.netUpdate = true; + } + + npc.spriteDirection = -npc.direction; + npc.velocity.X = MathHelper.Lerp(npc.velocity.X, MaxMovementSpeedX * npc.direction, 0.015f); + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + float pylonMult = NPC.AnyNPCs(ModContent.NPCType()) ? 2f : 1f; + if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneSulphur) + return 0f; + return SpawnCondition.OverworldDaySlime.Chance * (Main.hardMode ? 0.05f : 0.2f) * pylonMult; + } + + public override void HitEffect(int hitDirection, double damage) + { + if (!Main.dedServ) + { + for (int k = 0; k < 4; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 3, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 3, hitDirection, -1f, 0, default, 1f); + } + } + } + } + + public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) + { + if (Supercharged) + { + Texture2D shieldTexture = ModContent.GetTexture("CalamityMod/NPCs/NormalNPCs/WulfrumRoverShield"); + Rectangle frame = shieldTexture.Frame(1, 11, 0, (int)(Main.GlobalTime * 8) % 11); + spriteBatch.Draw(shieldTexture, + npc.Center - Main.screenPosition + Vector2.UnitY * (npc.gfxOffY + 6f), + frame, + Color.White * 0.625f, + npc.rotation, + shieldTexture.Size() * 0.5f / new Vector2(1f, 11f), + npc.scale + (float)Math.Cos(Main.GlobalTime) * 0.1f, + SpriteEffects.None, + 0f); + } + } + + public override void NPCLoot() + { + DropHelper.DropItem(npc, ModContent.ItemType()); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), Supercharged); + DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); + } + } +} diff --git a/NPCs/NormalNPCs/WulfrumRover.png b/NPCs/NormalNPCs/WulfrumRover.png new file mode 100644 index 0000000000..aa460fa07c Binary files /dev/null and b/NPCs/NormalNPCs/WulfrumRover.png differ diff --git a/NPCs/NormalNPCs/WulfrumRoverShield.png b/NPCs/NormalNPCs/WulfrumRoverShield.png new file mode 100644 index 0000000000..9a824907ea Binary files /dev/null and b/NPCs/NormalNPCs/WulfrumRoverShield.png differ diff --git a/NPCs/NormalNPCs/WulfrumSlime.cs b/NPCs/NormalNPCs/WulfrumSlime.cs index e222977360..8ac0ef9fb2 100644 --- a/NPCs/NormalNPCs/WulfrumSlime.cs +++ b/NPCs/NormalNPCs/WulfrumSlime.cs @@ -5,63 +5,65 @@ using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.NPCs.NormalNPCs { - public class WulfrumSlime : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Wulfrum Slime"); - Main.npcFrameCount[npc.type] = 2; - } + public class WulfrumSlime : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Wulfrum Slime"); + Main.npcFrameCount[npc.type] = 2; + } - public override void SetDefaults() - { - npc.aiStyle = 1; - npc.damage = 8; - npc.width = 30; - npc.height = 22; - npc.defense = 2; - npc.lifeMax = 12; - npc.knockBackResist = 0f; - animationType = 81; - npc.value = Item.buyPrice(0, 0, 0, 30); - npc.alpha = 60; - npc.lavaImmune = false; - npc.noGravity = false; - npc.noTileCollide = false; - npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - banner = npc.type; - bannerItem = ModContent.ItemType(); - } + public override void SetDefaults() + { + npc.aiStyle = 1; + npc.damage = 8; + npc.width = 30; + npc.height = 22; + npc.defense = 2; + npc.lifeMax = 12; + npc.knockBackResist = 0f; + animationType = NPCID.CorruptSlime; + npc.value = Item.buyPrice(0, 0, 0, 30); + npc.alpha = 60; + npc.lavaImmune = false; + npc.noGravity = false; + npc.noTileCollide = false; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + banner = npc.type; + bannerItem = ModContent.ItemType(); + npc.buffImmune[BuffID.Confused] = false; + } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneSulphur) - { - return 0f; - } - return SpawnCondition.OverworldDaySlime.Chance * (Main.hardMode ? 0.08f : 0.33f); - } + /*public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + float pylonMult = NPC.AnyNPCs(ModContent.NPCType()) ? 2f : 1f; + if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneSulphur) + { + return 0f; + } + return SpawnCondition.OverworldDaySlime.Chance * (Main.hardMode ? 0.08f : 0.33f) * pylonMult; + }*/ - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 3, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 15; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 3, hitDirection, -1f, 0, default, 1f); - } - } - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 3, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 15; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 3, hitDirection, -1f, 0, default, 1f); + } + } + } - public override void NPCLoot() - { - DropHelper.DropItem(npc, ModContent.ItemType(), 1, 1); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.expertMode, 0.5f, 1, 1); - } - } + public override void NPCLoot() + { + DropHelper.DropItem(npc, ModContent.ItemType(), 1, 1); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.expertMode, 0.5f, 1, 1); + } + } } diff --git a/NPCs/OldDuke/OldDuke.cs b/NPCs/OldDuke/OldDuke.cs index 177ab2c180..f8fdc35197 100644 --- a/NPCs/OldDuke/OldDuke.cs +++ b/NPCs/OldDuke/OldDuke.cs @@ -41,8 +41,10 @@ namespace CalamityMod.NPCs.OldDuke npc.damage = 200; npc.defense = 100; npc.DR_NERD(0.5f, null, null, null, true); - npc.lifeMax = CalamityWorld.revenge ? 1000000 : 750000; - npc.knockBackResist = 0f; + npc.LifeMaxNERB(750000, 1000000, 4000000); + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + npc.lifeMax += (int)(npc.lifeMax * HPBoost); + npc.knockBackResist = 0f; npc.noTileCollide = true; npc.noGravity = true; npc.npcSlots = 15f; diff --git a/NPCs/OldDuke/OldDukeSharkron.cs b/NPCs/OldDuke/OldDukeSharkron.cs index 3fd351f0c3..c04ebc6469 100644 --- a/NPCs/OldDuke/OldDukeSharkron.cs +++ b/NPCs/OldDuke/OldDukeSharkron.cs @@ -8,11 +8,13 @@ using Terraria.ID; using Terraria.ModLoader; using CalamityMod.Dusts; using CalamityMod.Projectiles.Boss; +using CalamityMod.World; namespace CalamityMod.NPCs.OldDuke { public class OldDukeSharkron : ModNPC { + bool spawnedProjectiles = false; public override void SetStaticDefaults() { DisplayName.SetDefault("Sulphurous Sharkron"); @@ -28,6 +30,10 @@ namespace CalamityMod.NPCs.OldDuke npc.damage = 180; npc.defense = 100; npc.lifeMax = 8000; + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = 100000; + } npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath1; npc.knockBackResist = 0f; @@ -45,12 +51,14 @@ namespace CalamityMod.NPCs.OldDuke { writer.Write(npc.dontTakeDamage); writer.Write(npc.noGravity); + writer.Write(spawnedProjectiles); } public override void ReceiveExtraAI(BinaryReader reader) { npc.dontTakeDamage = reader.ReadBoolean(); npc.noGravity = reader.ReadBoolean(); + spawnedProjectiles = reader.ReadBoolean(); } public override void AI() @@ -224,15 +232,16 @@ namespace CalamityMod.NPCs.OldDuke for (int num623 = 0; num623 < 30; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 5, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, DustID.Blood, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity.Y *= 10f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 5, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, DustID.Blood, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity.X *= 2f; } - if (Main.netMode != NetmodeID.MultiplayerClient) + if (Main.netMode != NetmodeID.MultiplayerClient && !spawnedProjectiles) { + spawnedProjectiles = true; int spawnX = npc.width / 2; int damage = Main.expertMode ? 55 : 70; for (int i = 0; i < 2; i++) diff --git a/NPCs/OldDuke/OldDukeToothBall.cs b/NPCs/OldDuke/OldDukeToothBall.cs index f8b53ba23f..a5186f8300 100644 --- a/NPCs/OldDuke/OldDukeToothBall.cs +++ b/NPCs/OldDuke/OldDukeToothBall.cs @@ -7,11 +7,13 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using CalamityMod.Dusts; +using CalamityMod.World; namespace CalamityMod.NPCs.OldDuke { public class OldDukeToothBall : ModNPC { + bool spawnedProjectiles = false; public override void SetStaticDefaults() { DisplayName.SetDefault("Tooth Ball"); @@ -26,7 +28,11 @@ namespace CalamityMod.NPCs.OldDuke npc.height = 40; npc.defense = 0; npc.lifeMax = 5000; - npc.alpha = 255; + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = 75000; + } + npc.alpha = 255; npc.knockBackResist = 0f; for (int k = 0; k < npc.buffImmune.Length; k++) { @@ -42,11 +48,13 @@ namespace CalamityMod.NPCs.OldDuke public override void SendExtraAI(BinaryWriter writer) { writer.Write(npc.dontTakeDamage); + writer.Write(spawnedProjectiles); } public override void ReceiveExtraAI(BinaryReader reader) { npc.dontTakeDamage = reader.ReadBoolean(); + spawnedProjectiles = reader.ReadBoolean(); } public override void AI() @@ -85,16 +93,20 @@ namespace CalamityMod.NPCs.OldDuke npc.active = false; return; } + npc.ai[3] += 1f; - npc.dontTakeDamage = (npc.ai[3] >= 600f ? false : true); + npc.dontTakeDamage = npc.ai[3] >= 600f ? false : true; if (npc.ai[3] >= 480f) { - npc.velocity.Y *= 0.985f; - npc.velocity.X *= 0.985f; + npc.velocity *= 0.985f; return; } + float num1372 = 12f; - Vector2 vector167 = new Vector2(npc.Center.X + npc.direction * 20, npc.Center.Y + 6f); + if (Main.expertMode || CalamityWorld.bossRushActive) + num1372 += Vector2.Distance(player.Center, npc.Center) * 0.01f; + + Vector2 vector167 = new Vector2(npc.Center.X + npc.direction * 20, npc.Center.Y + 6f); float num1373 = player.position.X + player.width * 0.5f - vector167.X; float num1374 = player.Center.Y - vector167.Y; float num1375 = (float)Math.Sqrt(num1373 * num1373 + num1374 * num1374); @@ -175,13 +187,13 @@ namespace CalamityMod.NPCs.OldDuke npc.position.X = npc.position.X + (npc.width / 2); npc.position.Y = npc.position.Y + (npc.height / 2); - npc.width = (npc.height = 96); + npc.width = npc.height = 96; npc.position.X = npc.position.X - (npc.width / 2); npc.position.Y = npc.position.Y - (npc.height / 2); for (int num621 = 0; num621 < 15; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 5, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, DustID.Blood, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.Next(2) == 0) { @@ -201,8 +213,9 @@ namespace CalamityMod.NPCs.OldDuke Main.dust[num624].noGravity = true; } - if (Main.netMode != NetmodeID.MultiplayerClient) + if (Main.netMode != NetmodeID.MultiplayerClient && !spawnedProjectiles) { + spawnedProjectiles = true; int totalProjectiles = 4; float radians = MathHelper.TwoPi / totalProjectiles; int damage = Main.expertMode ? 55 : 70; diff --git a/NPCs/Perforator/PerforatorBodyLarge.cs b/NPCs/Perforator/PerforatorBodyLarge.cs index b061a46aef..1c0a4df67d 100644 --- a/NPCs/Perforator/PerforatorBodyLarge.cs +++ b/NPCs/Perforator/PerforatorBodyLarge.cs @@ -60,18 +60,18 @@ namespace CalamityMod.NPCs.Perforator if (Main.netMode != NetmodeID.MultiplayerClient) { int shoot = revenge ? 5 : 4; - npc.localAI[0] += (float)Main.rand.Next(shoot); - if (npc.localAI[0] >= (float)Main.rand.Next(5500, 20000)) + npc.localAI[0] += Main.rand.Next(shoot); + if (npc.localAI[0] >= Main.rand.Next(1800, 20000)) { npc.localAI[0] = 0f; npc.TargetClosest(true); if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) { float num941 = revenge ? 9f : 8f; - Vector2 vector104 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); - float num942 = player.position.X + (float)player.width * 0.5f - vector104.X; - float num943 = player.position.Y + (float)player.height * 0.5f - vector104.Y; - float num944 = (float)Math.Sqrt((double)(num942 * num942 + num943 * num943)); + Vector2 vector104 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + (npc.height / 2)); + float num942 = player.position.X + player.width * 0.5f - vector104.X; + float num943 = player.position.Y + player.height * 0.5f - vector104.Y; + float num944 = (float)Math.Sqrt(num942 * num942 + num943 * num943); num944 = num941 / num944; num942 *= num944; num943 *= num944; @@ -144,13 +144,13 @@ namespace CalamityMod.NPCs.Perforator { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/LargePerf2"), 1f); Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/LargePerf3"), 1f); diff --git a/NPCs/Perforator/PerforatorBodyMedium.cs b/NPCs/Perforator/PerforatorBodyMedium.cs index c789d3039e..210658a80d 100644 --- a/NPCs/Perforator/PerforatorBodyMedium.cs +++ b/NPCs/Perforator/PerforatorBodyMedium.cs @@ -60,18 +60,18 @@ namespace CalamityMod.NPCs.Perforator if (Main.netMode != NetmodeID.MultiplayerClient) { int shoot = revenge ? 5 : 4; - npc.localAI[0] += (float)Main.rand.Next(shoot); - if (npc.localAI[0] >= (float)Main.rand.Next(4000, 12000)) + npc.localAI[0] += Main.rand.Next(shoot); + if (npc.localAI[0] >= Main.rand.Next(1500, 12000)) { npc.localAI[0] = 0f; npc.TargetClosest(true); if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) { float num941 = revenge ? 9f : 8f; - Vector2 vector104 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); - float num942 = player.position.X + (float)player.width * 0.5f - vector104.X; - float num943 = player.position.Y + (float)player.height * 0.5f - vector104.Y; - float num944 = (float)Math.Sqrt((double)(num942 * num942 + num943 * num943)); + Vector2 vector104 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + (npc.height / 2)); + float num942 = player.position.X + player.width * 0.5f - vector104.X; + float num943 = player.position.Y + player.height * 0.5f - vector104.Y; + float num944 = (float)Math.Sqrt(num942 * num942 + num943 * num943); num944 = num941 / num944; num942 *= num944; num943 *= num944; @@ -144,13 +144,13 @@ namespace CalamityMod.NPCs.Perforator { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/MediumPerf2"), 1f); Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/MediumPerf3"), 1f); diff --git a/NPCs/Perforator/PerforatorBodySmall.cs b/NPCs/Perforator/PerforatorBodySmall.cs index c86879ab83..51c0a46ae3 100644 --- a/NPCs/Perforator/PerforatorBodySmall.cs +++ b/NPCs/Perforator/PerforatorBodySmall.cs @@ -60,18 +60,18 @@ namespace CalamityMod.NPCs.Perforator if (Main.netMode != NetmodeID.MultiplayerClient) { int shoot = revenge ? 5 : 4; - npc.localAI[0] += (float)Main.rand.Next(shoot); - if (npc.localAI[0] >= (float)Main.rand.Next(1500, 6000)) + npc.localAI[0] += Main.rand.Next(shoot); + if (npc.localAI[0] >= Main.rand.Next(1200, 6000)) { npc.localAI[0] = 0f; npc.TargetClosest(true); if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) { float num941 = revenge ? 9f : 8f; - Vector2 vector104 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); - float num942 = player.position.X + (float)player.width * 0.5f - vector104.X; - float num943 = player.position.Y + (float)player.height * 0.5f - vector104.Y; - float num944 = (float)Math.Sqrt((double)(num942 * num942 + num943 * num943)); + Vector2 vector104 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + (npc.height / 2)); + float num942 = player.position.X + player.width * 0.5f - vector104.X; + float num943 = player.position.Y + player.height * 0.5f - vector104.Y; + float num944 = (float)Math.Sqrt(num942 * num942 + num943 * num943); num944 = num941 / num944; num942 *= num944; num943 *= num944; @@ -144,13 +144,13 @@ namespace CalamityMod.NPCs.Perforator { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SmallPerf2"), 1f); } diff --git a/NPCs/Perforator/PerforatorCyst.cs b/NPCs/Perforator/PerforatorCyst.cs index 57972202bc..1858f46dfe 100644 --- a/NPCs/Perforator/PerforatorCyst.cs +++ b/NPCs/Perforator/PerforatorCyst.cs @@ -84,13 +84,13 @@ namespace CalamityMod.NPCs.Perforator { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } if (Main.netMode != NetmodeID.MultiplayerClient && NPC.CountNPCS(ModContent.NPCType()) < 1) { diff --git a/NPCs/Perforator/PerforatorHeadLarge.cs b/NPCs/Perforator/PerforatorHeadLarge.cs index 9ba199fc09..d60bbf6898 100644 --- a/NPCs/Perforator/PerforatorHeadLarge.cs +++ b/NPCs/Perforator/PerforatorHeadLarge.cs @@ -14,8 +14,6 @@ namespace CalamityMod.NPCs.Perforator public class PerforatorHeadLarge : ModNPC { private bool flies = false; - private float speed = 12f; - private float turnSpeed = 0.1f; private int minLength = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 7 : 15; private int maxLength = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 8 : 16; private bool TailSpawned = false; @@ -56,6 +54,9 @@ namespace CalamityMod.NPCs.Perforator // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; + float speed = 12f; + float turnSpeed = 0.1f; + if (expertMode) { speed += death ? 9f : 9f * (1f - lifeRatio); @@ -439,13 +440,13 @@ namespace CalamityMod.NPCs.Perforator { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/LargePerf"), 1f); Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/LargePerf2"), 1f); diff --git a/NPCs/Perforator/PerforatorHeadMedium.cs b/NPCs/Perforator/PerforatorHeadMedium.cs index 9c86a156f9..00d4b6cb90 100644 --- a/NPCs/Perforator/PerforatorHeadMedium.cs +++ b/NPCs/Perforator/PerforatorHeadMedium.cs @@ -13,8 +13,6 @@ namespace CalamityMod.NPCs.Perforator public class PerforatorHeadMedium : ModNPC { private bool flies = false; - private float speed = 14f; - private float turnSpeed = 0.12f; private int minLength = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 5 : 10; private int maxLength = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 6 : 11; private bool TailSpawned = false; @@ -36,7 +34,6 @@ namespace CalamityMod.NPCs.Perforator npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); npc.aiStyle = 6; aiType = -1; - animationType = 10; npc.knockBackResist = 0f; npc.alpha = 255; npc.buffImmune[ModContent.BuffType()] = false; @@ -56,6 +53,9 @@ namespace CalamityMod.NPCs.Perforator // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; + float speed = 14f; + float turnSpeed = 0.12f; + if (expertMode) { speed += death ? 9f : 9f * (1f - lifeRatio); @@ -435,13 +435,13 @@ namespace CalamityMod.NPCs.Perforator { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/MediumPerf"), 1f); Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/MediumPerf2"), 1f); diff --git a/NPCs/Perforator/PerforatorHeadSmall.cs b/NPCs/Perforator/PerforatorHeadSmall.cs index fbffc13768..3334a949c3 100644 --- a/NPCs/Perforator/PerforatorHeadSmall.cs +++ b/NPCs/Perforator/PerforatorHeadSmall.cs @@ -14,8 +14,6 @@ namespace CalamityMod.NPCs.Perforator { private const int MsgType = 23; private bool flies = false; - private float speed = 16f; - private float turnSpeed = 0.14f; private int minLength = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 3 : 6; private int maxLength = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 4 : 7; private bool TailSpawned = false; @@ -55,6 +53,9 @@ namespace CalamityMod.NPCs.Perforator // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; + float speed = 16f; + float turnSpeed = 0.14f; + if (expertMode) { speed += death ? 9f : 9f * (1f - lifeRatio); @@ -434,13 +435,13 @@ namespace CalamityMod.NPCs.Perforator { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SmallPerf"), 1f); } diff --git a/NPCs/Perforator/PerforatorHive.cs b/NPCs/Perforator/PerforatorHive.cs index 12236b7320..9822b9999a 100644 --- a/NPCs/Perforator/PerforatorHive.cs +++ b/NPCs/Perforator/PerforatorHive.cs @@ -426,7 +426,7 @@ namespace CalamityMod.NPCs.Perforator { for (int k = 0; k < damage / npc.lifeMax * 100.0; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { diff --git a/NPCs/Perforator/PerforatorTailLarge.cs b/NPCs/Perforator/PerforatorTailLarge.cs index 0a080fffa9..f3f3eef35d 100644 --- a/NPCs/Perforator/PerforatorTailLarge.cs +++ b/NPCs/Perforator/PerforatorTailLarge.cs @@ -88,13 +88,13 @@ namespace CalamityMod.NPCs.Perforator { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/LargePerf4"), 1f); Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/LargePerf5"), 1f); diff --git a/NPCs/Perforator/PerforatorTailMedium.cs b/NPCs/Perforator/PerforatorTailMedium.cs index c6975ee410..ac8765166e 100644 --- a/NPCs/Perforator/PerforatorTailMedium.cs +++ b/NPCs/Perforator/PerforatorTailMedium.cs @@ -88,13 +88,13 @@ namespace CalamityMod.NPCs.Perforator { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/MediumPerf3"), 1f); Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/MediumPerf4"), 1f); diff --git a/NPCs/Perforator/PerforatorTailSmall.cs b/NPCs/Perforator/PerforatorTailSmall.cs index 279a23f6fa..3ee50e4643 100644 --- a/NPCs/Perforator/PerforatorTailSmall.cs +++ b/NPCs/Perforator/PerforatorTailSmall.cs @@ -89,13 +89,13 @@ namespace CalamityMod.NPCs.Perforator { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SmallPerf3"), 1f); } diff --git a/NPCs/PlaguebringerGoliath/PlagueBeeG.cs b/NPCs/PlaguebringerGoliath/PlagueBeeG.cs index f0b014e617..908024d375 100644 --- a/NPCs/PlaguebringerGoliath/PlagueBeeG.cs +++ b/NPCs/PlaguebringerGoliath/PlagueBeeG.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -32,7 +33,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath npc.aiStyle = -1; aiType = -1; npc.knockBackResist = CalamityWorld.bossRushActive ? 0f : 0.9f; - animationType = 210; + animationType = NPCID.Bee; npc.HitSound = SoundID.NPCHit4; npc.DeathSound = SoundID.NPCDeath14; npc.noGravity = true; @@ -269,13 +270,13 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Plague, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Plague, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/PlaguebringerGoliath/PlagueBeeLargeG.cs b/NPCs/PlaguebringerGoliath/PlagueBeeLargeG.cs index 2303dc0cfe..359a096b21 100644 --- a/NPCs/PlaguebringerGoliath/PlagueBeeLargeG.cs +++ b/NPCs/PlaguebringerGoliath/PlagueBeeLargeG.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -67,7 +68,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath } if ((double)npc.position.Y > Main.rockLayer * 16.0) { - for (int num957 = 0; num957 < 200; num957++) + for (int num957 = 0; num957 < Main.maxNPCs; num957++) { if (Main.npc[num957].aiStyle == npc.aiStyle) { @@ -162,13 +163,13 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Plague, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Plague, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs b/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs index e72d1990bb..b902dd5b2a 100644 --- a/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs +++ b/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -82,10 +83,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath int num3; if (npc.ai[0] == 0f && npc.ai[1] > 0f) { - float[] var_2_2065C_cp_0 = npc.ai; - int var_2_2065C_cp_1 = 1; - float num73 = var_2_2065C_cp_0[var_2_2065C_cp_1]; - var_2_2065C_cp_0[var_2_2065C_cp_1] = num73 - 1f; + npc.ai[1] -= 1f; } else if (npc.ai[0] == 0f && npc.ai[1] == 0f) { @@ -97,10 +95,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath } else if (npc.ai[0] == 1f) { - float[] var_2_2087A_cp_0 = npc.localAI; - int var_2_2087A_cp_1 = 1; - float num73 = var_2_2087A_cp_0[var_2_2087A_cp_1]; - var_2_2087A_cp_0[var_2_2087A_cp_1] = num73 + 1f; + npc.localAI[1] += 1f; float num757 = 600f; float num758 = 0f; float num759 = 300f; @@ -116,23 +111,16 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath Vector2 v3 = Main.player[(int)npc.ai[1]].Center - npc.Center; float num760 = npc.velocity.ToRotation(); float num761 = v3.ToRotation(); - double num762 = (double)(num761 - num760); - if (num762 > 3.1415926535897931) - { - num762 -= 6.2831853071795862; - } - if (num762 < -3.1415926535897931) - { - num762 += 6.2831853071795862; - } - npc.velocity = npc.velocity.RotatedBy(num762 * 0.20000000298023224, default); + float angle = num761 - num760; + angle = MathHelper.WrapAngle(angle); + npc.velocity = npc.velocity.RotatedBy(angle * 0.2, default); } else { npc.noTileCollide = false; } } - for (int num767 = 0; num767 < 255; num767 = num3 + 1) + for (int num767 = 0; num767 < Main.maxPlayers; num767 = num3 + 1) { Player player5 = Main.player[num767]; if (player5.active && !player5.dead && Vector2.Distance(player5.Center, npc.Center) <= 42f) @@ -252,13 +240,13 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Plague, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 10; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Plague, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs index bbe25d94fc..14a4b61a6a 100644 --- a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs +++ b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; using CalamityMod.Items.Accessories; using CalamityMod.Items.Armor.Vanity; using CalamityMod.Items.LoreItems; @@ -79,6 +80,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.noGravity = true; @@ -178,12 +180,15 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath // Distance from target Vector2 distFromPlayer = player.Center - vectorCenter; - // Enrage - bool aboveGroundEnrage = (player.position.Y < Main.worldSurface * 16.0 || player.position.Y > ((Main.maxTilesY - 200) * 16)) && !CalamityWorld.bossRushActive; + // Enrage + int enrageScale = 0; + if ((npc.position.Y / 16f) < Main.worldSurface || (npc.position.Y / 16f) > (Main.maxTilesY - 200)) + enrageScale++; + if (!player.ZoneJungle) + enrageScale++; - bool jungleEnrage = false; - if (!player.ZoneJungle && !CalamityWorld.bossRushActive) - jungleEnrage = true; + if (CalamityWorld.bossRushActive) + enrageScale = 0; bool diagonalDash = revenge && (lifeRatio < 0.8f || death); @@ -235,20 +240,10 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath { if (Main.netMode != NetmodeID.MultiplayerClient) { - float num595 = npc.ai[1]; int num596; - do - { - num596 = Main.rand.Next(3); - if (MissileCountdown == 1) - num596 = 4; - else if (num596 == 1) - num596 = 2; - else if (num596 == 2) - num596 = 3; - } + do num596 = MissileCountdown == 1 ? 4 : Main.rand.Next(4); + while (num596 == npc.ai[1] || num596 == 1); - while (num596 == num595); if (num596 == 0 && diagonalDash && distFromPlayer.Length() < 1800f) { switch (Main.rand.Next(3)) @@ -274,8 +269,6 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath else if (npc.ai[0] == 0f) { float num1044 = revenge ? 28f : 26f; - if (aboveGroundEnrage) - num1044 += 6f; if (lifeRatio < 0.66f || death) num1044 += 2f; if (lifeRatio < 0.33f || death) @@ -283,7 +276,9 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath if (npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) num1044 += 2f; - int num1043 = 2; + num1044 += 6f * enrageScale; + + int num1043 = 2 + enrageScale; if ((npc.ai[1] > (2 * num1043) && npc.ai[1] % 2f == 0f) || distFromPlayer.Length() > 1800f) { npc.ai[0] = -1f; @@ -300,7 +295,10 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath float playerLocation = vectorCenter.X - player.Center.X; - if (Math.Abs(npc.Center.Y - (player.Center.Y - chargeDistance)) < 20f) + float num620 = 20f; + num620 += 20 * enrageScale; + + if (Math.Abs(npc.Center.Y - (player.Center.Y - chargeDistance)) < num620) { if (diagonalDash) { @@ -365,8 +363,10 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath num1048 += 2f; num1049 += 0.1f; } + num1048 += 3 * enrageScale; + num1049 += 0.5f * enrageScale; - if (vectorCenter.Y < (player.Center.Y - chargeDistance)) + if (vectorCenter.Y < (player.Center.Y - chargeDistance)) npc.velocity.Y += num1049; else npc.velocity.Y -= num1049; @@ -410,14 +410,15 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath int num1050 = revenge ? 525 : 550; if (npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) num1050 = 300; - else if (aboveGroundEnrage || CalamityWorld.bossRushActive) + else if (CalamityWorld.bossRushActive) num1050 = 400; else if (lifeRatio < 0.33f || death) num1050 = revenge ? 450 : 475; else if (lifeRatio < 0.66f) num1050 = revenge ? 475 : 500; + num1050 -= 100 * enrageScale; - int num1051 = 1; + int num1051 = 1; if (vectorCenter.X < player.Center.X) num1051 = -1; @@ -425,8 +426,10 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath { npc.ai[2] = 1f; } + if (enrageScale > 0 && npc.ai[2] == 1f) + npc.velocity *= 0.5f; - if (npc.ai[2] != 1f) + if (npc.ai[2] != 1f) { charging = true; npc.frameCounter = 4; @@ -466,8 +469,10 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath npc.velocity *= 0.98f; num1052 += 0.05f; } + if (enrageScale > 0) + npc.velocity *= 0.7f; - if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < num1052) + if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < num1052) { npc.ai[2] = 0f; npc.ai[1] += 1f; @@ -502,7 +507,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath } // Move closer - Movement(100f, 350f, 450f, player); + Movement(100f, 350f, 450f, player, enrageScale); } // Spawn bees @@ -526,7 +531,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath npc.ai[1] += 0.25f; bool flag103 = false; - if (npc.ai[1] > 40f) + if (npc.ai[1] > 40f - 12f * enrageScale) { npc.ai[1] = 0f; npc.ai[2] += 1f; @@ -545,10 +550,10 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath else randomAmt = ModContent.NPCType(); - if (expertMode && NPC.CountNPCS(ModContent.NPCType()) < (aboveGroundEnrage ? 4 : 2)) + if (expertMode && NPC.CountNPCS(ModContent.NPCType()) < 2) NPC.NewNPC((int)vector119.X, (int)vector119.Y, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); - if (revenge && NPC.CountNPCS(ModContent.NPCType()) < (aboveGroundEnrage ? 2 : 1)) + if (revenge && !NPC.AnyNPCs(ModContent.NPCType())) NPC.NewNPC((int)vector119.X, (int)vector119.Y, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); if (NPC.CountNPCS(ModContent.NPCType()) < 2) @@ -557,7 +562,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath Main.npc[num1062].velocity = player.Center - npc.Center; Main.npc[num1062].velocity.Normalize(); - Main.npc[num1062].velocity *= (CalamityWorld.bossRushActive ? 12f : 6f); + Main.npc[num1062].velocity *= CalamityWorld.bossRushActive ? 12f : 6f; Main.npc[num1062].localAI[0] = 60f; Main.npc[num1062].netUpdate = true; @@ -567,7 +572,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath // Move closer if too far away if (num1060 > 600f) - Movement(100f, 350f, 450f, player); + Movement(100f, 350f, 450f, player, enrageScale); else npc.velocity *= 0.9f; @@ -575,11 +580,12 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath npc.direction = playerLocation < 0 ? 1 : -1; npc.spriteDirection = npc.direction; - if (npc.ai[2] > 2f) + if (npc.ai[2] > 3f) { npc.ai[0] = -1f; - npc.ai[1] = 1f; - npc.netUpdate = true; + npc.ai[1] = 2f; + npc.ai[2] = 0f; + npc.netUpdate = true; } } @@ -604,7 +610,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath if (lifeRatio < 0.1f || death) npc.ai[1] += 0.25f; - if (npc.ai[1] > 40f) + if (npc.ai[1] > 40f - 12f * enrageScale) { npc.ai[1] = 0f; npc.ai[2] += 1f; @@ -617,10 +623,10 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath if (Main.netMode != NetmodeID.MultiplayerClient) { - if (expertMode && NPC.CountNPCS(ModContent.NPCType()) < (aboveGroundEnrage ? 6 : 4)) + if (expertMode && NPC.CountNPCS(ModContent.NPCType()) < 3) NPC.NewNPC((int)vector119.X, (int)vector119.Y, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); - if (revenge && NPC.CountNPCS(ModContent.NPCType()) < 1 && aboveGroundEnrage) + if (revenge && !NPC.AnyNPCs(ModContent.NPCType())) NPC.NewNPC((int)vector119.X, (int)vector119.Y, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); float projectileSpeed = revenge ? 6f : 5f; @@ -635,7 +641,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath num1071 *= num1073; num1072 *= num1073; - if (NPC.CountNPCS(ModContent.NPCType()) < (aboveGroundEnrage ? 8 : 5)) + if (NPC.CountNPCS(ModContent.NPCType()) < 5) { int num1062 = NPC.NewNPC((int)vector119.X, (int)vector119.Y, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); Main.npc[num1062].velocity.X = num1071; @@ -647,7 +653,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath // Move closer if too far away if (num1060 > 600f) - Movement(100f, 350f, 450f, player); + Movement(100f, 350f, 450f, player, enrageScale); else npc.velocity *= 0.9f; @@ -655,11 +661,12 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath npc.direction = playerLocation < 0 ? 1 : -1; npc.spriteDirection = npc.direction; - if (npc.ai[2] > 2f) + if (npc.ai[2] > 3f) { npc.ai[0] = -1f; - npc.ai[1] = 1f; - npc.netUpdate = true; + npc.ai[1] = 2f; + npc.ai[2] = 0f; + npc.netUpdate = true; } } @@ -667,21 +674,25 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath else if (npc.ai[0] == 3f) { Vector2 vector121 = new Vector2(npc.direction == 1 ? npc.getRect().BottomLeft().X : npc.getRect().BottomRight().X, npc.getRect().Bottom().Y - 40f); - vector121.X += (npc.direction * 120); + vector121.X += npc.direction * 120; npc.ai[1] += 1f; - int num650 = ((npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 10 : ((lifeRatio < 0.1f || death || aboveGroundEnrage) ? 20 : ((lifeRatio < 0.5f) ? 25 : 30))); + int num650 = (npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 10 : ((lifeRatio < 0.1f || death) ? 20 : ((lifeRatio < 0.5f) ? 25 : 30)); + num650 -= 5 * enrageScale; - if (npc.ai[1] % (float)num650 == (float)(num650 - 1) && vectorCenter.Y < player.position.Y) + if (npc.ai[1] % num650 == (num650 - 1) && vectorCenter.Y < player.position.Y) { Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 42); if (Main.netMode != NetmodeID.MultiplayerClient) { float projectileSpeed = revenge ? 6.5f : 6f; - if (jungleEnrage || npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) + projectileSpeed += 7 * enrageScale; + + if (npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) projectileSpeed += 10f; - if (CalamityWorld.bossRushActive) + + if (CalamityWorld.bossRushActive) projectileSpeed *= 1.5f; float num1071 = player.position.X + player.width * 0.5f - vector121.X; @@ -717,7 +728,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath } } - Movement(100f, 400f, 500f, player); + Movement(100f, 400f, 500f, player, enrageScale); float playerLocation = vectorCenter.X - player.Center.X; npc.direction = playerLocation < 0 ? 1 : -1; @@ -738,12 +749,14 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath if (CalamityWorld.bossRushActive) num1044 = 32f; - int num1043 = 2; + num1044 += 6f * enrageScale; + + int num1043 = 2 + enrageScale; if (npc.ai[1] > (2 * num1043) && npc.ai[1] % 2f == 0f) { MissileCountdown = 0; npc.ai[0] = -1f; - npc.ai[1] = 0f; + npc.ai[1] = -1f; npc.ai[2] = 0f; npc.netUpdate = true; return; @@ -756,7 +769,10 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath float playerLocation = vectorCenter.X - player.Center.X; - if (Math.Abs(vectorCenter.Y - (player.Center.Y - 500f)) < 20f) + float num620 = 20f; + num620 += 20 * enrageScale; + + if (Math.Abs(vectorCenter.Y - (player.Center.Y - 500f)) < num620) { if (MissileCountdown == 1) { @@ -765,10 +781,11 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath if (Main.netMode != NetmodeID.MultiplayerClient) { int speed = revenge ? 6 : 5; - if (aboveGroundEnrage) - speed = 8; - if (CalamityWorld.bossRushActive) + speed += 7 * enrageScale; + + if (CalamityWorld.bossRushActive) speed = 12; + int damage = expertMode ? 48 : 60; Vector2 baseVelocity = player.Center - vectorCenter; @@ -812,7 +829,9 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath float num1048 = revenge ? 16f : 14f; float num1049 = revenge ? 0.2f : 0.18f; - if (CalamityWorld.bossRushActive) + num1048 += 3 * enrageScale; + num1049 += 0.5f * enrageScale; + if (CalamityWorld.bossRushActive) { num1048 *= 1.5f; num1049 *= 1.5f; @@ -829,16 +848,16 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath npc.velocity.Y = num1048; if (Math.Abs(vectorCenter.X - player.Center.X) > 600f) - npc.velocity.X += 0.15f * npc.direction; + npc.velocity.X += num1049 * npc.direction; else if (Math.Abs(vectorCenter.X - player.Center.X) < 300f) - npc.velocity.X -= 0.15f * npc.direction; + npc.velocity.X -= num1049 * npc.direction; else npc.velocity.X *= 0.8f; - if (npc.velocity.X < -20f) - npc.velocity.X = -20f; - if (npc.velocity.X > 20f) - npc.velocity.X = 20f; + if (npc.velocity.X < -num1048) + npc.velocity.X = -num1048; + if (npc.velocity.X > num1048) + npc.velocity.X = num1048; npc.direction = playerLocation < 0 ? 1 : -1; npc.spriteDirection = npc.direction; @@ -866,8 +885,10 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath num1051 = -1; if (npc.direction == num1051 && Math.Abs(vectorCenter.X - player.Center.X) > num1050) npc.ai[2] = 1f; + if (enrageScale > 0 && npc.ai[2] == 1f) + npc.velocity *= 0.5f; - if (npc.ai[2] != 1f) + if (npc.ai[2] != 1f) { charging = true; @@ -906,8 +927,10 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath npc.velocity *= 0.9f; num1052 += 0.05f; } + if (enrageScale > 0) + npc.velocity *= 0.7f; - if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < num1052) + if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < num1052) { npc.ai[2] = 0f; npc.ai[1] += 1f; @@ -927,39 +950,48 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath } } - private void Movement(float xPos, float yPos, float yPos2, Player player) + private void Movement(float xPos, float yPos, float yPos2, Player player, int enrageScale) { - if (npc.position.Y > player.position.Y - yPos) + Vector2 acceleration = new Vector2(CalamityWorld.bossRushActive ? 0.15f : 0.1f, CalamityWorld.bossRushActive ? 0.2f : 0.15f); + Vector2 velocity = new Vector2(8f, 5f); + float deceleration = 0.98f; + + acceleration *= 0.2f * enrageScale + 1f; + velocity *= 0.2f * enrageScale + 1f; + deceleration *= 1f - enrageScale * 0.2f; + + if (npc.position.Y > player.position.Y - yPos) { if (npc.velocity.Y > 0f) - npc.velocity.Y *= 0.98f; - npc.velocity.Y -= (CalamityWorld.bossRushActive ? 0.2f : 0.15f); - if (npc.velocity.Y > 5f) - npc.velocity.Y = 5f; + npc.velocity.Y *= deceleration; + npc.velocity.Y -= acceleration.Y; + if (npc.velocity.Y > velocity.Y) + npc.velocity.Y = velocity.Y; } else if (npc.position.Y < player.position.Y - yPos2) { if (npc.velocity.Y < 0f) - npc.velocity.Y *= 0.98f; - npc.velocity.Y += (CalamityWorld.bossRushActive ? 0.2f : 0.15f); - if (npc.velocity.Y < -5f) - npc.velocity.Y = -5f; + npc.velocity.Y *= deceleration; + npc.velocity.Y += acceleration.Y; + if (npc.velocity.Y < -velocity.Y) + npc.velocity.Y = -velocity.Y; } + if (npc.position.X + (npc.width / 2) > player.position.X + (player.width / 2) + xPos) { if (npc.velocity.X > 0f) - npc.velocity.X *= 0.98f; - npc.velocity.X -= (CalamityWorld.bossRushActive ? 0.15f : 0.1f); - if (npc.velocity.X > 8f) - npc.velocity.X = 8f; + npc.velocity.X *= deceleration; + npc.velocity.X -= acceleration.X; + if (npc.velocity.X > velocity.X) + npc.velocity.X = velocity.X; } if (npc.position.X + (npc.width / 2) < player.position.X + (player.width / 2) - xPos) { if (npc.velocity.X < 0f) - npc.velocity.X *= 0.98f; - npc.velocity.X += (CalamityWorld.bossRushActive ? 0.15f : 0.1f); - if (npc.velocity.X < -8f) - npc.velocity.X = -8f; + npc.velocity.X *= deceleration; + npc.velocity.X += acceleration.X; + if (npc.velocity.X < -velocity.X) + npc.velocity.X = -velocity.X; } } @@ -969,7 +1001,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath { for (int k = 0; k < 2; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Plague, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { @@ -983,7 +1015,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath npc.position.Y = npc.position.Y - (npc.height / 2); for (int num621 = 0; num621 < 40; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 46, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.Plague, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -993,10 +1025,10 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath } for (int num623 = 0; num623 < 70; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 46, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.Plague, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 46, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.Plague, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } diff --git a/NPCs/PlaguebringerGoliath/PlaguebringerShade.cs b/NPCs/PlaguebringerGoliath/PlaguebringerShade.cs index 2667b3c27b..c239471a9a 100644 --- a/NPCs/PlaguebringerGoliath/PlaguebringerShade.cs +++ b/NPCs/PlaguebringerGoliath/PlaguebringerShade.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; using CalamityMod.Items.Materials; using CalamityMod.Items.Pets; using CalamityMod.Items.Placeables.Banners; @@ -60,6 +61,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.noGravity = true; @@ -637,7 +639,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 46, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Plague, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { @@ -654,7 +656,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath npc.position.Y = npc.position.Y - (float)(npc.height / 2); for (int num621 = 0; num621 < 40; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 46, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.Plague, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -664,10 +666,10 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath } for (int num623 = 0; num623 < 70; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 46, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.Plague, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 46, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.Plague, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } diff --git a/NPCs/Polterghast/PhantomFuckYou.cs b/NPCs/Polterghast/PhantomFuckYou.cs index b25763f438..bcfec7683e 100644 --- a/NPCs/Polterghast/PhantomFuckYou.cs +++ b/NPCs/Polterghast/PhantomFuckYou.cs @@ -95,16 +95,16 @@ namespace CalamityMod.NPCs.Polterghast timer = 0; } - Player player = Main.player[npc.target]; - double deg = npc.ai[1]; + NPC parent = Main.npc[NPC.FindFirstNPC(ModContent.NPCType())]; + double deg = npc.ai[1]; double rad = deg * (Math.PI / 180); double dist = 500; - npc.position.X = player.Center.X - (int)(Math.Cos(rad) * dist) - npc.width / 2; - npc.position.Y = player.Center.Y - (int)(Math.Sin(rad) * dist) - npc.height / 2; + npc.position.X = parent.Center.X - (int)(Math.Cos(rad) * dist) - npc.width / 2; + npc.position.Y = parent.Center.Y - (int)(Math.Sin(rad) * dist) - npc.height / 2; float SPEEN = 1f - lifeRatio * 2f; if (SPEEN < 0f) SPEEN = 0f; - npc.ai[1] += 0.5f + SPEEN; //1f + npc.ai[1] += 0.5f + SPEEN; return false; } diff --git a/NPCs/Polterghast/PolterPhantom.cs b/NPCs/Polterghast/PolterPhantom.cs index b6e99ca985..0de5edf868 100644 --- a/NPCs/Polterghast/PolterPhantom.cs +++ b/NPCs/Polterghast/PolterPhantom.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -43,6 +44,7 @@ namespace CalamityMod.NPCs.Polterghast npc.buffImmune[BuffID.CursedInferno] = false; npc.buffImmune[BuffID.Daybreak] = false; npc.buffImmune[BuffID.StardustMinionBleed] = false; + npc.buffImmune[BuffID.BetsysCurse] = false; npc.buffImmune[BuffID.Oiled] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; @@ -83,7 +85,7 @@ namespace CalamityMod.NPCs.Polterghast return; } - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.5f, 0.25f, 0.75f); + Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 0.5f, 0.25f, 0.75f); npc.TargetClosest(true); @@ -92,7 +94,10 @@ namespace CalamityMod.NPCs.Polterghast if (Vector2.Distance(Main.player[npc.target].Center, vector) > 6000f) npc.active = false; - bool speedBoost1 = false; + // Scale multiplier based on nearby active tiles + float tileEnrageMult = Main.npc[CalamityGlobalNPC.ghostBoss].ai[3]; + + bool speedBoost1 = false; bool despawnBoost = false; bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; @@ -118,12 +123,12 @@ namespace CalamityMod.NPCs.Polterghast } num = num733; } - num730 /= (float)num732; - num731 /= (float)num732; + num730 /= num732; + num731 /= num732; float num734 = 3f; float num735 = 0.03f; - if (!Main.player[npc.target].ZoneDungeon && !CalamityWorld.bossRushActive && (double)Main.player[npc.target].position.Y < Main.worldSurface * 16.0) + if (!Main.player[npc.target].ZoneDungeon && !CalamityWorld.bossRushActive && Main.player[npc.target].position.Y < Main.worldSurface * 16.0) { despawnTimer--; if (despawnTimer <= 0) @@ -159,16 +164,20 @@ namespace CalamityMod.NPCs.Polterghast num734 += 8f; } - float num738 = (float)Math.Sqrt((double)(num736 * num736 + num737 * num737)); + float num738 = (float)Math.Sqrt(num736 * num736 + num737 * num737); int num739 = 500; if (speedBoost1) num739 += 500; if (expertMode) num739 += 150; - if (num738 >= (float)num739) + // Increase speed based on nearby active tiles + num734 *= tileEnrageMult; + num735 *= tileEnrageMult; + + if (num738 >= num739) { - num738 = (float)num739 / num738; + num738 = num739 / num738; num736 *= num738; num737 *= num738; } @@ -178,7 +187,7 @@ namespace CalamityMod.NPCs.Polterghast vector91 = new Vector2(vector.X, vector.Y); num736 = num730 - vector91.X; num737 = num731 - vector91.Y; - num738 = (float)Math.Sqrt((double)(num736 * num736 + num737 * num737)); + num738 = (float)Math.Sqrt(num736 * num736 + num737 * num737); if (num738 < num734) { @@ -220,7 +229,7 @@ namespace CalamityMod.NPCs.Polterghast Vector2 vector92 = new Vector2(vector.X, vector.Y); float num740 = Main.player[npc.target].Center.X - vector92.X; float num741 = Main.player[npc.target].Center.Y - vector92.Y; - npc.rotation = (float)Math.Atan2((double)num741, (double)num740) + 1.57f; + npc.rotation = (float)Math.Atan2(num741, num740) + 1.57f; npc.damage = npc.defDamage; @@ -288,7 +297,9 @@ namespace CalamityMod.NPCs.Polterghast { if (CalamityWorld.revenge) player.AddBuff(ModContent.BuffType(), 180, true); - } + + player.AddBuff(BuffID.MoonLeech, 360, true); + } public override bool CanHitPlayer(Player target, ref int cooldownSlot) { @@ -315,7 +326,7 @@ namespace CalamityMod.NPCs.Polterghast npc.position.Y = npc.position.Y - (float)(npc.height / 2); for (int num621 = 0; num621 < 10; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 60, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.Phantoplasm, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { diff --git a/NPCs/Polterghast/Polterghast.cs b/NPCs/Polterghast/Polterghast.cs index 837ff00b9b..46ec7ec2d7 100644 --- a/NPCs/Polterghast/Polterghast.cs +++ b/NPCs/Polterghast/Polterghast.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; using CalamityMod.Events; using CalamityMod.Items.Armor.Vanity; using CalamityMod.Items.LoreItems; @@ -66,6 +67,7 @@ namespace CalamityMod.NPCs.Polterghast npc.buffImmune[BuffID.CursedInferno] = false; npc.buffImmune[BuffID.Daybreak] = false; npc.buffImmune[BuffID.StardustMinionBleed] = false; + npc.buffImmune[BuffID.BetsysCurse] = false; npc.buffImmune[BuffID.Oiled] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; @@ -110,17 +112,20 @@ namespace CalamityMod.NPCs.Polterghast if (CalamityGlobalNPC.ghostBossClone != -1) cloneAlive = Main.npc[CalamityGlobalNPC.ghostBossClone].active; - // Variables - Vector2 vector = npc.Center; + // Percent life remaining + float lifeRatio = npc.life / (float)npc.lifeMax; + + // Variables + Vector2 vector = npc.Center; bool speedBoost = false; bool despawnBoost = false; bool death = CalamityWorld.death || CalamityWorld.bossRushActive; bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; - bool phase2 = npc.life < npc.lifeMax * (death ? 0.9 : 0.75); //hooks fire beams - bool phase3 = npc.life < npc.lifeMax * (revenge ? (death ? 0.8 : 0.5) : 0.33); //hooks stop shooting and polter begins charging with ghosts spinning around player - bool phase4 = npc.life < npc.lifeMax * (revenge ? (death ? 0.5 : 0.33) : 0.2); //starts spitting ghost dudes - bool phase5 = npc.life < npc.lifeMax * (revenge ? (death ? 0.25 : 0.1) : 0.05); //starts moving incredibly fast + bool phase2 = lifeRatio < (death ? 0.9f : 0.75f); + bool phase3 = lifeRatio < (revenge ? (death ? 0.8f : 0.5f) : 0.33f); + bool phase4 = lifeRatio < (revenge ? (death ? 0.5f : 0.33f) : 0.2f); + bool phase5 = lifeRatio < (revenge ? (death ? 0.25f : 0.1f) : 0.05f); // Target npc.TargetClosest(true); @@ -178,8 +183,10 @@ namespace CalamityMod.NPCs.Polterghast // Velocity and acceleration bool charging = npc.ai[2] >= 300f; bool reset = npc.ai[2] >= 600f; - float num734 = 10f; // max should be 21 - float num735 = 0.05f; // max should be 0.13 + float speedUpDistance = 480f - 360f * (1f - lifeRatio); + bool speedUp = Vector2.Distance(player.Center, npc.Center) > speedUpDistance; // 30 or 40 tile distance + float velocity = 10f; // max should be 21 + float acceleration = 0.05f; // max should be 0.13 if (!player.ZoneDungeon && !CalamityWorld.bossRushActive && player.position.Y < Main.worldSurface * 16.0) { despawnTimer--; @@ -187,8 +194,8 @@ namespace CalamityMod.NPCs.Polterghast despawnBoost = true; speedBoost = true; - num734 += 5f; - num735 += 0.05f; + velocity += 5f; + acceleration += 0.05f; } else despawnTimer++; @@ -203,16 +210,16 @@ namespace CalamityMod.NPCs.Polterghast if (phase2) { - num734 += 2.5f; - num735 += 0.02f; + velocity += 2.5f; + acceleration += 0.02f; } if (!phase3) { if (charging) { - num734 += phase2 ? 4.5f : 3.5f; - num735 += phase2 ? 0.03f : 0.025f; + velocity += phase2 ? 4.5f : 3.5f; + acceleration += phase2 ? 0.03f : 0.025f; } npc.ai[2] += 1f; @@ -226,25 +233,25 @@ namespace CalamityMod.NPCs.Polterghast { if (charging) { - num734 += phase5 ? 8.5f : 4.5f; - num735 += phase5 ? 0.06f : 0.03f; + velocity += phase5 ? 8.5f : 4.5f; + acceleration += phase5 ? 0.06f : 0.03f; } else { if (phase5) { - num734 += 1.5f; - num735 += 0.015f; + velocity += 1.5f; + acceleration += 0.015f; } else if (phase4) { - num734 += 1f; - num735 += 0.01f; + velocity += 1f; + acceleration += 0.01f; } else { - num734 += 0.5f; - num735 += 0.005f; + velocity += 0.5f; + acceleration += 0.005f; } } @@ -256,15 +263,77 @@ namespace CalamityMod.NPCs.Polterghast } } - // Set DR based on phase - float dr = phase3 ? phase3DR : phase2 ? phase2DR : phase1DR; - npc.Calamity().DR = dr; + if (expertMode) + { + velocity += revenge ? 5f : 3.5f; + acceleration += revenge ? 0.035f : 0.025f; + } - if (expertMode) - { - num734 += revenge ? 5f : 3.5f; - num735 += revenge ? 0.035f : 0.025f; - } + // Move faster if inside active tiles + int radius = 2; // 2 tile radius + int diameter = radius * 2; + int npcCenterX = (int)(npc.Center.X / 16f); + int npcCenterY = (int)(npc.Center.Y / 16f); + Rectangle area = new Rectangle(npcCenterX - radius, npcCenterY - radius, diameter, diameter); + bool insideTiles = false; + for (int x = area.Left; x < area.Right; x++) + { + for (int y = area.Top; y < area.Bottom; y++) + { + if (Main.tile[x, y] != null) + { + if (Main.tile[x, y].nactive() && Main.tileSolid[Main.tile[x, y].type] && !Main.tileSolidTop[Main.tile[x, y].type] && !TileID.Sets.Platforms[Main.tile[x, y].type]) + insideTiles = true; + } + } + } + + // Slow down if close to target and not inside tiles + if (!speedUp && !insideTiles && !charging) + { + velocity = 8f; + acceleration = 0.035f; + } + + // Detect active tiles around Polterghast + radius = 20; // 20 tile radius + diameter = radius * 2; + area = new Rectangle(npcCenterX - radius, npcCenterY - radius, diameter, diameter); + int nearbyActiveTiles = 0; // 0 to 1600 + for (int x = area.Left; x < area.Right; x++) + { + for (int y = area.Top; y < area.Bottom; y++) + { + if (Main.tile[x, y] != null) + { + if (Main.tile[x, y].nactive() && Main.tileSolid[Main.tile[x, y].type] && !Main.tileSolidTop[Main.tile[x, y].type] && !TileID.Sets.Platforms[Main.tile[x, y].type]) + nearbyActiveTiles++; + } + } + } + + // Scale multiplier based on nearby active tiles + float tileEnrageMult = 1f; + if (nearbyActiveTiles < 800) + tileEnrageMult += (800 - nearbyActiveTiles) * 0.001f; // Ranges from 1f to 1.8f + + // Used to inform clone and hooks about number of active tiles nearby + npc.ai[3] = tileEnrageMult; + + // Increase projectile fire rate based on number of nearby active tiles + float projectileFireRateMultiplier = MathHelper.Lerp(1f, 2f, 1f - ((tileEnrageMult - 1f) / 0.8f)); + + // Increase projectile time left based on number of nearby active tiles + int baseProjectileTimeLeft = (int)(1200f * tileEnrageMult); + + // Increase damage of projectiles and contact damage based on number of nearby active tiles + int damageIncrease = 0; + if (nearbyActiveTiles < 400) + damageIncrease += (400 - nearbyActiveTiles) / 20; // Ranges from 0 to 20 + + // Set DR based on phase + float dr = phase3 ? phase3DR : phase2 ? phase2DR : phase1DR; + npc.Calamity().DR = dr; Vector2 vector91 = new Vector2(num730, num731); float num736 = player.Center.X - vector91.X; @@ -274,7 +343,7 @@ namespace CalamityMod.NPCs.Polterghast { num737 *= -1f; num736 *= -1f; - num734 += 10f; + velocity += 10f; } float num738 = (float)Math.Sqrt(num736 * num736 + num737 * num737); @@ -284,7 +353,11 @@ namespace CalamityMod.NPCs.Polterghast if (expertMode) num739 += 150; - if (num738 >= num739) + // Increase speed based on nearby active tiles + velocity *= tileEnrageMult; + acceleration *= tileEnrageMult; + + if (num738 >= num739) { num738 = num739 / num738; num736 *= num738; @@ -298,14 +371,14 @@ namespace CalamityMod.NPCs.Polterghast num737 = num731 - vector91.Y; num738 = (float)Math.Sqrt(num736 * num736 + num737 * num737); - if (num738 < num734) + if (num738 < velocity) { num736 = npc.velocity.X; num737 = npc.velocity.Y; } else { - num738 = num734 / num738; + num738 = velocity / num738; num736 *= num738; num737 *= num738; } @@ -317,32 +390,39 @@ namespace CalamityMod.NPCs.Polterghast if (npc.velocity.X < num736) { - npc.velocity.X += num735; + npc.velocity.X += acceleration; if (npc.velocity.X < 0f && num736 > 0f) - npc.velocity.X += num735 * 2f; + npc.velocity.X += acceleration * 2f; } else if (npc.velocity.X > num736) { - npc.velocity.X -= num735; + npc.velocity.X -= acceleration; if (npc.velocity.X > 0f && num736 < 0f) - npc.velocity.X -= num735 * 2f; + npc.velocity.X -= acceleration * 2f; } if (npc.velocity.Y < num737) { - npc.velocity.Y += num735; + npc.velocity.Y += acceleration; if (npc.velocity.Y < 0f && num737 > 0f) - npc.velocity.Y += num735 * 2f; + npc.velocity.Y += acceleration * 2f; } else if (npc.velocity.Y > num737) { - npc.velocity.Y -= num735; + npc.velocity.Y -= acceleration; if (npc.velocity.Y > 0f && num737 < 0f) - npc.velocity.Y -= num735 * 2f; + npc.velocity.Y -= acceleration * 2f; } - if (!phase2 && !phase3) + // Slow down considerably if near player + if (!speedUp && nearbyActiveTiles > 800 && !insideTiles && !charging) + { + if (npc.velocity.Length() > velocity) + npc.velocity *= 0.97f; + } + + if (!phase2 && !phase3) { - npc.damage = npc.defDamage; + npc.damage = npc.defDamage + damageIncrease * 4; npc.defense = npc.defDefense; if (speedBoost) @@ -351,13 +431,13 @@ namespace CalamityMod.NPCs.Polterghast npc.damage *= 2; } - if (Main.netMode != NetmodeID.MultiplayerClient) + if (Main.netMode != NetmodeID.MultiplayerClient && !charging) { npc.localAI[1] += expertMode ? 1.5f : 1f; if (speedBoost || CalamityWorld.bossRushActive) npc.localAI[1] += 3f; - if (npc.localAI[1] >= 40f) + if (npc.localAI[1] >= 90f * projectileFireRateMultiplier) { npc.localAI[1] = 0f; @@ -370,64 +450,89 @@ namespace CalamityMod.NPCs.Polterghast if (flag47) { - float num742 = CalamityWorld.bossRushActive ? 7f : 5f; - if (speedBoost || npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) - num742 *= 2f; - - Vector2 vector93 = new Vector2(vector.X, vector.Y); - float num743 = player.position.X + player.width * 0.5f - vector93.X; - float num744 = player.position.Y + player.height * 0.5f - vector93.Y; - float num745 = (float)Math.Sqrt(num743 * num743 + num744 * num744); - - num745 = num742 / num745; - num743 *= num745; - num744 *= num745; - - int num746 = expertMode ? 48 : 60; - int num747 = ModContent.ProjectileType(); + int damage = expertMode ? 48 : 60; + int type = ModContent.ProjectileType(); if (Main.rand.NextBool(3)) { - num746 = expertMode ? 60 : 70; + damage = expertMode ? 60 : 70; npc.localAI[1] = -30f; - num747 = ModContent.ProjectileType(); + type = ModContent.ProjectileType(); } + damage += damageIncrease; + if (speedBoost || npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) - num746 *= 2; + damage *= 2; - vector93.X += num743 * 3f; - vector93.Y += num744 * 3f; + Vector2 vector93 = new Vector2(vector.X, vector.Y); + float num742 = (CalamityWorld.bossRushActive ? 7f : 5f) * tileEnrageMult; + if (speedBoost || npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) + num742 *= 2f; - int num748 = Projectile.NewProjectile(vector93.X, vector93.Y, num743, num744, num747, num746, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[num748].timeLeft = num747 == ModContent.ProjectileType() ? 300 : 1200; - } + float num743 = player.position.X + player.width * 0.5f - vector93.X; + float num744 = player.position.Y + player.height * 0.5f - vector93.Y; + float num745 = (float)Math.Sqrt(num743 * num743 + num744 * num744); + + num745 = num742 / num745; + num743 *= num745; + num744 *= num745; + vector93.X += num743 * 3f; + vector93.Y += num744 * 3f; + + int numProj = 4; + int spread = 45; + float rotation = MathHelper.ToRadians(spread); + float baseSpeed = (float)Math.Sqrt(num743 * num743 + num744 * num744); + double startAngle = Math.Atan2(num743, num744) - rotation / 2; + double deltaAngle = rotation / numProj; + double offsetAngle; + for (int i = 0; i < numProj; i++) + { + offsetAngle = startAngle + deltaAngle * i; + int proj = Projectile.NewProjectile(vector93.X, vector93.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), type, damage, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[proj].timeLeft = type == ModContent.ProjectileType() ? baseProjectileTimeLeft / 4 : baseProjectileTimeLeft; + } + } else { - float num742 = CalamityWorld.bossRushActive ? 14f : 11f; - if (speedBoost || npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) - num742 *= 2f; + int damage = expertMode ? 60 : 70; + int type = ModContent.ProjectileType(); - Vector2 vector93 = new Vector2(vector.X, vector.Y); - float num743 = player.position.X + player.width * 0.5f - vector93.X; - float num744 = player.position.Y + player.height * 0.5f - vector93.Y; - float num745 = (float)Math.Sqrt(num743 * num743 + num744 * num744); + damage += damageIncrease; - num745 = num742 / num745; - num743 *= num745; - num744 *= num745; + if (speedBoost || npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) + damage *= 2; - int num746 = expertMode ? 60 : 70; - int num747 = ModContent.ProjectileType(); - if (speedBoost || npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) - num746 *= 2; + Vector2 vector93 = new Vector2(vector.X, vector.Y); + float num742 = (CalamityWorld.bossRushActive ? 14f : 10f) * tileEnrageMult; + if (speedBoost || npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) + num742 *= 2f; - vector93.X += num743 * 3f; - vector93.Y += num744 * 3f; + float num743 = player.position.X + player.width * 0.5f - vector93.X; + float num744 = player.position.Y + player.height * 0.5f - vector93.Y; + float num745 = (float)Math.Sqrt(num743 * num743 + num744 * num744); - int num748 = Projectile.NewProjectile(vector93.X, vector93.Y, num743, num744, num747, num746, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[num748].timeLeft = 180; - } + num745 = num742 / num745; + num743 *= num745; + num744 *= num745; + vector93.X += num743 * 3f; + vector93.Y += num744 * 3f; + + int numProj = 4; + int spread = 60; + float rotation = MathHelper.ToRadians(spread); + float baseSpeed = (float)Math.Sqrt(num743 * num743 + num744 * num744); + double startAngle = Math.Atan2(num743, num744) - rotation / 2; + double deltaAngle = rotation / numProj; + double offsetAngle; + for (int i = 0; i < numProj; i++) + { + offsetAngle = startAngle + deltaAngle * i; + int proj = Projectile.NewProjectile(vector93.X, vector93.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), type, damage, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[proj].timeLeft = baseProjectileTimeLeft / 4; + } + } } } } @@ -447,7 +552,7 @@ namespace CalamityMod.NPCs.Polterghast for (int num621 = 0; num621 < 10; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 60, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.Phantoplasm, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; Main.dust[num622].noGravity = true; if (Main.rand.NextBool(2)) @@ -468,7 +573,7 @@ namespace CalamityMod.NPCs.Polterghast npc.GivenName = "Necroghast"; - npc.damage = (int)(npc.defDamage * 1.2f); + npc.damage = (int)(npc.defDamage * 1.2f) + damageIncrease * 4; npc.defense = (int)(npc.defDefense * 0.8f); if (speedBoost || npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) @@ -477,13 +582,13 @@ namespace CalamityMod.NPCs.Polterghast npc.damage *= 2; } - if (Main.netMode != NetmodeID.MultiplayerClient) + if (Main.netMode != NetmodeID.MultiplayerClient && !charging) { npc.localAI[1] += expertMode ? 1.5f : 1f; if (speedBoost || CalamityWorld.bossRushActive) npc.localAI[1] += 3f; - if (npc.localAI[1] >= 36f) + if (npc.localAI[1] >= 150f * projectileFireRateMultiplier) { npc.localAI[1] = 0f; @@ -496,65 +601,89 @@ namespace CalamityMod.NPCs.Polterghast if (flag47) { - float num742 = CalamityWorld.bossRushActive ? 8f : 6f; - if (speedBoost || npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) - num742 *= 2f; + int damage = expertMode ? 53 : 65; + int type = ModContent.ProjectileType(); - Vector2 vector93 = new Vector2(vector.X, vector.Y); - float num743 = player.position.X + player.width * 0.5f - vector93.X; - float num744 = player.position.Y + player.height * 0.5f - vector93.Y; - float num745 = (float)Math.Sqrt(num743 * num743 + num744 * num744); + if (Main.rand.NextBool(3)) + { + damage = expertMode ? 65 : 75; + npc.localAI[1] = -30f; + type = ModContent.ProjectileType(); + } - num745 = num742 / num745; - num743 *= num745; - num744 *= num745; + damage += damageIncrease; - int num746 = expertMode ? 53 : 65; - int num747 = ModContent.ProjectileType(); + if (speedBoost || npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) + damage *= 2; - if (Main.rand.NextBool(3)) - { - num746 = expertMode ? 65 : 75; - npc.localAI[1] = -30f; - num747 = ModContent.ProjectileType(); - } + Vector2 vector93 = new Vector2(vector.X, vector.Y); + float num742 = (CalamityWorld.bossRushActive ? 8f : 6f) * tileEnrageMult; + if (speedBoost || npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) + num742 *= 2f; - if (speedBoost || npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) - num746 *= 2; + float num743 = player.position.X + player.width * 0.5f - vector93.X; + float num744 = player.position.Y + player.height * 0.5f - vector93.Y; + float num745 = (float)Math.Sqrt(num743 * num743 + num744 * num744); - vector93.X += num743 * 3f; - vector93.Y += num744 * 3f; + num745 = num742 / num745; + num743 *= num745; + num744 *= num745; + vector93.X += num743 * 3f; + vector93.Y += num744 * 3f; - int num748 = Projectile.NewProjectile(vector93.X, vector93.Y, num743, num744, num747, num746, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[num748].timeLeft = num747 == ModContent.ProjectileType() ? 300 : 1200; - } + int numProj = 5; + int spread = 60; + float rotation = MathHelper.ToRadians(spread); + float baseSpeed = (float)Math.Sqrt(num743 * num743 + num744 * num744); + double startAngle = Math.Atan2(num743, num744) - rotation / 2; + double deltaAngle = rotation / numProj; + double offsetAngle; + for (int i = 0; i < numProj; i++) + { + offsetAngle = startAngle + deltaAngle * i; + int proj = Projectile.NewProjectile(vector93.X, vector93.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), type, damage, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[proj].timeLeft = type == ModContent.ProjectileType() ? baseProjectileTimeLeft / 4 : baseProjectileTimeLeft; + } + } else { - float num742 = CalamityWorld.bossRushActive ? 14f : 11f; - if (speedBoost || npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) - num742 *= 2f; + int damage = expertMode ? 65 : 75; + int type = ModContent.ProjectileType(); - Vector2 vector93 = new Vector2(vector.X, vector.Y); - float num743 = player.position.X + player.width * 0.5f - vector93.X; - float num744 = player.position.Y + player.height * 0.5f - vector93.Y; - float num745 = (float)Math.Sqrt(num743 * num743 + num744 * num744); + damage += damageIncrease; - num745 = num742 / num745; - num743 *= num745; - num744 *= num745; + if (speedBoost || npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) + damage *= 2; - int num746 = expertMode ? 65 : 75; - int num747 = ModContent.ProjectileType(); + Vector2 vector93 = new Vector2(vector.X, vector.Y); + float num742 = (CalamityWorld.bossRushActive ? 14f : 10f) * tileEnrageMult; + if (speedBoost || npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) + num742 *= 2f; - if (speedBoost || npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) - num746 *= 2; + float num743 = player.position.X + player.width * 0.5f - vector93.X; + float num744 = player.position.Y + player.height * 0.5f - vector93.Y; + float num745 = (float)Math.Sqrt(num743 * num743 + num744 * num744); - vector93.X += num743 * 3f; - vector93.Y += num744 * 3f; + num745 = num742 / num745; + num743 *= num745; + num744 *= num745; + vector93.X += num743 * 3f; + vector93.Y += num744 * 3f; - int num748 = Projectile.NewProjectile(vector93.X, vector93.Y, num743, num744, num747, num746, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[num748].timeLeft = 240; - } + int numProj = 5; + int spread = 80; + float rotation = MathHelper.ToRadians(spread); + float baseSpeed = (float)Math.Sqrt(num743 * num743 + num744 * num744); + double startAngle = Math.Atan2(num743, num744) - rotation / 2; + double deltaAngle = rotation / numProj; + double offsetAngle; + for (int i = 0; i < numProj; i++) + { + offsetAngle = startAngle + deltaAngle * i; + int proj = Projectile.NewProjectile(vector93.X, vector93.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), type, damage, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[proj].timeLeft = baseProjectileTimeLeft / 4; + } + } } } } @@ -572,11 +701,9 @@ namespace CalamityMod.NPCs.Polterghast for (int I = 0; I < 3; I++) { - int Phantom = NPC.NewNPC((int)(player.Center.X + (Math.Sin(I * 120) * 500)), - (int)(player.Center.Y + (Math.Cos(I * 120) * 500)), ModContent.NPCType(), 0, 0, 0, 0, -1); - NPC Eye = Main.npc[Phantom]; - Eye.ai[0] = I * 120; - Eye.ai[3] = I * 120; + int spawn = NPC.NewNPC((int)(npc.Center.X + (Math.Sin(I * 120) * 500)), (int)(npc.Center.Y + (Math.Cos(I * 120) * 500)), ModContent.NPCType(), npc.whoAmI, 0, 0, 0, -1); + NPC npc2 = Main.npc[spawn]; + npc2.ai[0] = I * 120; } } @@ -590,7 +717,7 @@ namespace CalamityMod.NPCs.Polterghast for (int num621 = 0; num621 < 10; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 60, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.Phantoplasm, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; Main.dust[num622].noGravity = true; if (Main.rand.NextBool(2)) @@ -611,7 +738,7 @@ namespace CalamityMod.NPCs.Polterghast npc.GivenName = "Necroplasm"; - npc.damage = (int)(npc.defDamage * 1.4f); + npc.damage = (int)(npc.defDamage * 1.4f) + damageIncrease * 4; npc.defense = (int)(npc.defDefense * 0.5f); if (speedBoost || npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) @@ -621,43 +748,47 @@ namespace CalamityMod.NPCs.Polterghast } npc.ai[1] += 1f; - if (npc.ai[1] >= 420f && Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) + if (npc.ai[1] >= 210f * projectileFireRateMultiplier && Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) { npc.ai[1] = 0f; - Vector2 vector93 = new Vector2(vector.X, vector.Y); - float num742 = CalamityWorld.bossRushActive ? 7f : 5f; - float num743 = player.position.X + player.width * 0.5f - vector93.X; - float num744 = player.position.Y + player.height * 0.5f - vector93.Y; - float num745 = (float)Math.Sqrt(num743 * num743 + num744 * num744); - - num745 = num742 / num745; - num743 *= num745; - num744 *= num745; - vector93.X += num743 * 3f; - vector93.Y += num744 * 3f; - - int damage = expertMode ? 53 : 65; - int numProj = 4; - int spread = 45; - float rotation = MathHelper.ToRadians(spread); - float baseSpeed = (float)Math.Sqrt(num743 * num743 + num744 * num744); - double startAngle = Math.Atan2(num743, num744) - rotation / 2; - double deltaAngle = rotation / numProj; - double offsetAngle; - int type = ModContent.ProjectileType(); - for (int i = 0; i < numProj; i++) + if (Main.netMode != NetmodeID.MultiplayerClient && !charging) { - offsetAngle = startAngle + deltaAngle * i; - if (i == 1 || i == 2) - type = ModContent.ProjectileType(); - Projectile.NewProjectile(vector93.X, vector93.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), type, damage, 0f, Main.myPlayer, 0f, 0f); + Vector2 vector93 = new Vector2(vector.X, vector.Y); + float num742 = (CalamityWorld.bossRushActive ? 7f : 5f) * tileEnrageMult; + float num743 = player.position.X + player.width * 0.5f - vector93.X; + float num744 = player.position.Y + player.height * 0.5f - vector93.Y; + float num745 = (float)Math.Sqrt(num743 * num743 + num744 * num744); + + num745 = num742 / num745; + num743 *= num745; + num744 *= num745; + vector93.X += num743 * 3f; + vector93.Y += num744 * 3f; + + int damage = expertMode ? 53 : 65; + damage += damageIncrease; + int numProj = 6; + int spread = 90; + float rotation = MathHelper.ToRadians(spread); + float baseSpeed = (float)Math.Sqrt(num743 * num743 + num744 * num744); + double startAngle = Math.Atan2(num743, num744) - rotation / 2; + double deltaAngle = rotation / numProj; + double offsetAngle; + int type = ModContent.ProjectileType(); + for (int i = 0; i < numProj; i++) + { + offsetAngle = startAngle + deltaAngle * i; + if (i == 1 || i == 2) + type = ModContent.ProjectileType(); + Projectile.NewProjectile(vector93.X, vector93.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), type, damage, 0f, Main.myPlayer, 0f, 0f); + } } } if (phase4) { npc.localAI[1] += 1f; - if (npc.localAI[1] >= 150f) + if (npc.localAI[1] >= 420f) { npc.localAI[1] = 0f; @@ -677,7 +808,7 @@ namespace CalamityMod.NPCs.Polterghast if (NPC.CountNPCS(ModContent.NPCType()) < 2 && Main.netMode != NetmodeID.MultiplayerClient) { - int num762 = NPC.NewNPC((int)vector.X, (int)vector.Y, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); + int num762 = NPC.NewNPC((int)vector.X, (int)vector.Y, ModContent.NPCType()); Main.npc[num762].velocity.X = num758; Main.npc[num762].velocity.Y = num760; Main.npc[num762].netUpdate = true; @@ -824,14 +955,14 @@ namespace CalamityMod.NPCs.Polterghast { bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; bool death = CalamityWorld.death || CalamityWorld.bossRushActive; - bool phase2 = (double)npc.life >= (double)npc.lifeMax * (revenge ? (death ? 0.8 : 0.5) : 0.33); + bool phase2 = npc.life >= npc.lifeMax * (revenge ? (death ? 0.8 : 0.5) : 0.33); npc.frameCounter += 1D; if (npc.frameCounter > 6D) { npc.frameCounter = 0D; npc.frame.Y += frameHeight; } - if ((double)npc.life >= (double)npc.lifeMax * (death ? 0.9 : 0.75)) + if (npc.life >= npc.lifeMax * (death ? 0.9 : 0.75)) { if (npc.frame.Y > frameHeight * 3) { @@ -866,7 +997,9 @@ namespace CalamityMod.NPCs.Polterghast { if (CalamityWorld.revenge) player.AddBuff(ModContent.BuffType(), 300, true); - } + + player.AddBuff(BuffID.MoonLeech, 900, true); + } public override bool CanHitPlayer(Player target, ref int cooldownSlot) { @@ -885,20 +1018,20 @@ namespace CalamityMod.NPCs.Polterghast Dust.NewDust(npc.position, npc.width, npc.height, 180, hitDirection, -1f, 0, default, 1f); if (npc.life <= 0) { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.position.X = npc.position.X + (npc.width / 2); + npc.position.Y = npc.position.Y + (npc.height / 2); npc.width = 90; npc.height = 90; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); + npc.position.X = npc.position.X - (npc.width / 2); + npc.position.Y = npc.position.Y - (npc.height / 2); for (int num621 = 0; num621 < 10; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 60, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.Phantoplasm, 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; + Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } for (int num623 = 0; num623 < 60; num623++) diff --git a/NPCs/Polterghast/PolterghastHook.cs b/NPCs/Polterghast/PolterghastHook.cs index d95e3997ee..7b38b69da8 100644 --- a/NPCs/Polterghast/PolterghastHook.cs +++ b/NPCs/Polterghast/PolterghastHook.cs @@ -45,18 +45,22 @@ namespace CalamityMod.NPCs.Polterghast { writer.Write(phase2); writer.Write(despawnTimer); - } + writer.Write(npc.localAI[0]); + writer.Write(npc.localAI[1]); + } public override void ReceiveExtraAI(BinaryReader reader) { phase2 = reader.ReadBoolean(); despawnTimer = reader.ReadInt32(); - } + npc.localAI[0] = reader.ReadSingle(); + npc.localAI[1] = reader.ReadSingle(); + } public override void AI() { // Emit light - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0f, 0.3f, 0.3f); + Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 0f, 0.3f, 0.3f); // Bools bool speedBoost = false; @@ -82,11 +86,17 @@ namespace CalamityMod.NPCs.Polterghast } // Percent life remaining, Polter - float lifeRatio = (float)Main.npc[CalamityGlobalNPC.ghostBoss].life / (float)Main.npc[CalamityGlobalNPC.ghostBoss].lifeMax; + float lifeRatio = Main.npc[CalamityGlobalNPC.ghostBoss].life / (float)Main.npc[CalamityGlobalNPC.ghostBoss].lifeMax; - // Despawn - if (CalamityGlobalNPC.ghostBoss != -1 && !player.ZoneDungeon && - (double)player.position.Y < Main.worldSurface * 16.0 && !CalamityWorld.bossRushActive) + // Scale multiplier based on nearby active tiles + float tileEnrageMult = Main.npc[CalamityGlobalNPC.ghostBoss].ai[3]; + + // Increase projectile time left based on number of nearby active tiles + int baseProjectileTimeLeft = (int)(1200f * tileEnrageMult); + + // Despawn + if (CalamityGlobalNPC.ghostBoss != -1 && !player.ZoneDungeon && + player.position.Y < Main.worldSurface * 16.0 && !CalamityWorld.bossRushActive) { despawnTimer--; if (despawnTimer <= 0) @@ -105,13 +115,13 @@ namespace CalamityMod.NPCs.Polterghast npc.TargetClosest(true); - Movement(phase2, expertMode, revenge, death, speedBoost, despawnBoost, lifeRatio, player); + Movement(phase2, expertMode, revenge, death, speedBoost, despawnBoost, lifeRatio, tileEnrageMult, player); // Fire projectiles - Vector2 vector17 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num147 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector17.X; - float num148 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector17.Y; - float num149 = (float)Math.Sqrt((double)(num147 * num147 + num148 * num148)); + Vector2 vector17 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num147 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector17.X; + float num148 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector17.Y; + float num149 = (float)Math.Sqrt(num147 * num147 + num148 * num148); num149 = 4f / num149; num147 *= num149; @@ -141,13 +151,14 @@ namespace CalamityMod.NPCs.Polterghast if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == 20f) { - float num151 = 1.5f; - int num152 = expertMode ? 48 : 60; - int num153 = ModContent.ProjectileType(); + float num151 = (CalamityWorld.bossRushActive ? 7f : 5f) * tileEnrageMult; + int num152 = expertMode ? 48 : 60; + int num153 = ModContent.ProjectileType(); num149 = num151 / num149; num147 *= num149; num148 *= num149; - Projectile.NewProjectile(vector17.X, vector17.Y, num147, num148, num153, num152, 0f, Main.myPlayer, 0f, 0f); + int proj = Projectile.NewProjectile(vector17.X, vector17.Y, num147, num148, num153, num152, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[proj].timeLeft = baseProjectileTimeLeft; } } return; @@ -155,25 +166,25 @@ namespace CalamityMod.NPCs.Polterghast // Phase 1 or 3 phase2 = false; - Movement(phase2, expertMode, revenge, death, speedBoost, despawnBoost, lifeRatio, player); + Movement(phase2, expertMode, revenge, death, speedBoost, despawnBoost, lifeRatio, tileEnrageMult, player); } - private void Movement(bool phase2, bool expertMode, bool revenge, bool death, bool speedBoost, bool despawnBoost, float lifeRatio, Player player) + private void Movement(bool phase2, bool expertMode, bool revenge, bool death, bool speedBoost, bool despawnBoost, float lifeRatio, float tileEnrageMult, Player player) { if (phase2) { Vector2 vector92 = new Vector2(npc.Center.X, npc.Center.Y); float num740 = Main.player[npc.target].Center.X - vector92.X; float num741 = Main.player[npc.target].Center.Y - vector92.Y; - npc.rotation = (float)Math.Atan2((double)num741, (double)num740) + 1.57f; + npc.rotation = (float)Math.Atan2(num741, num740) + 1.57f; } if (Main.netMode == NetmodeID.MultiplayerClient) { if (npc.ai[0] == 0f) - npc.ai[0] = (float)(int)(npc.Center.X / 16f); + npc.ai[0] = (int)(npc.Center.X / 16f); if (npc.ai[1] == 0f) - npc.ai[1] = (float)(int)(npc.Center.X / 16f); + npc.ai[1] = (int)(npc.Center.X / 16f); } if (Main.netMode != NetmodeID.MultiplayerClient) @@ -182,8 +193,12 @@ namespace CalamityMod.NPCs.Polterghast npc.localAI[0] = 0f; float shootBoost = death ? 2f : 2f * (1f - lifeRatio); - npc.localAI[0] -= 1f + shootBoost; - if (speedBoost) + npc.localAI[0] -= 1f + shootBoost * tileEnrageMult; + if (expertMode) + npc.localAI[0] -= Vector2.Distance(npc.Center, player.Center) * 0.002f; + if (Main.npc[CalamityGlobalNPC.ghostBoss].ai[2] >= 300f) + npc.localAI[0] -= 3f; + if (speedBoost) npc.localAI[0] -= 6f; if (!despawnBoost && npc.localAI[0] <= 0f && npc.ai[0] != 0f) @@ -191,13 +206,13 @@ namespace CalamityMod.NPCs.Polterghast for (int num763 = 0; num763 < 200; num763++) { if (num763 != npc.whoAmI && Main.npc[num763].active && Main.npc[num763].type == npc.type && (Main.npc[num763].velocity.X != 0f || Main.npc[num763].velocity.Y != 0f)) - npc.localAI[0] = (float)Main.rand.Next(30, 121); + npc.localAI[0] = 180f; } } if (npc.localAI[0] <= 0f) { - npc.localAI[0] = (float)Main.rand.Next(150, 301); + npc.localAI[0] = 450f; bool flag50 = false; int num764 = 0; while (!flag50 && num764 <= 1000) @@ -216,7 +231,7 @@ namespace CalamityMod.NPCs.Polterghast num766 = (int)(Main.npc[CalamityGlobalNPC.ghostBoss].position.Y + 400f) / 16; } int num767 = 20; - num767 += (int)(100f * ((float)num764 / 1000f)); + num767 += (int)(100f * (num764 / 1000f)); int num768 = num765 + Main.rand.Next(-num767, num767 + 1); int num769 = num766 + Main.rand.Next(-num767, num767 + 1); try @@ -224,9 +239,10 @@ namespace CalamityMod.NPCs.Polterghast if (WorldGen.SolidTile(num768, num769) || Main.tile[num768, num769].wall > 0) { flag50 = true; - npc.ai[0] = (float)num768; - npc.ai[1] = (float)num769; - npc.netUpdate = true; + npc.ai[0] = num768; + npc.ai[1] = num769; + npc.localAI[1] = Vector2.Distance(npc.Center, player.Center) * 0.01f; + npc.netUpdate = true; } } catch { @@ -238,9 +254,9 @@ namespace CalamityMod.NPCs.Polterghast if (npc.ai[0] > 0f && npc.ai[1] > 0f) { float velocityBoost = death ? 2f : 2f * (1f - lifeRatio); - float velocity = 8f + velocityBoost; + float velocity = (8f + velocityBoost) * tileEnrageMult; if (expertMode) - velocity += 1f; + velocity += npc.localAI[1]; if (revenge) velocity += 1f; if (speedBoost) @@ -251,7 +267,7 @@ namespace CalamityMod.NPCs.Polterghast Vector2 vector95 = new Vector2(npc.Center.X, npc.Center.Y); float num773 = npc.ai[0] * 16f - 8f - vector95.X; float num774 = npc.ai[1] * 16f - 8f - vector95.Y; - float num775 = (float)Math.Sqrt((double)(num773 * num773 + num774 * num774)); + float num775 = (float)Math.Sqrt(num773 * num773 + num774 * num774); if (num775 < 12f + velocity) { npc.velocity.X = num773; @@ -269,7 +285,7 @@ namespace CalamityMod.NPCs.Polterghast Vector2 vector96 = new Vector2(npc.Center.X, npc.Center.Y); float num776 = Main.npc[CalamityGlobalNPC.ghostBoss].Center.X - vector96.X; float num777 = Main.npc[CalamityGlobalNPC.ghostBoss].Center.Y - vector96.Y; - npc.rotation = (float)Math.Atan2((double)num777, (double)num776) - 1.57f; + npc.rotation = (float)Math.Atan2(num777, num776) - 1.57f; } } } @@ -281,19 +297,19 @@ namespace CalamityMod.NPCs.Polterghast Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); float bossCenterX = Main.npc[CalamityGlobalNPC.ghostBoss].Center.X - center.X; float bossCenterY = Main.npc[CalamityGlobalNPC.ghostBoss].Center.Y - center.Y; - float rotation2 = (float)Math.Atan2((double)bossCenterY, (double)bossCenterX) - 1.57f; + float rotation2 = (float)Math.Atan2(bossCenterY, bossCenterX) - 1.57f; bool draw = true; while (draw) { int chainWidth = 20; //16 24 int chainHeight = 52; //32 16 - float num10 = (float)Math.Sqrt((double)(bossCenterX * bossCenterX + bossCenterY * bossCenterY)); - if (num10 < (float)chainHeight) + float num10 = (float)Math.Sqrt(bossCenterX * bossCenterX + bossCenterY * bossCenterY); + if (num10 < chainHeight) { chainWidth = (int)num10 - chainHeight + chainWidth; draw = false; } - num10 = (float)chainWidth / num10; + num10 = chainWidth / num10; bossCenterX *= num10; bossCenterY *= num10; center.X += bossCenterX; @@ -303,7 +319,7 @@ namespace CalamityMod.NPCs.Polterghast Color color2 = new Color(100, 100, 100, 0); Main.spriteBatch.Draw(ModContent.GetTexture("CalamityMod/NPCs/Polterghast/PolterghastChain"), new Vector2(center.X - Main.screenPosition.X, center.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, 0, ModContent.GetTexture("CalamityMod/NPCs/Polterghast/PolterghastChain").Width, chainWidth)), color2, rotation2, - new Vector2((float)ModContent.GetTexture("CalamityMod/NPCs/Polterghast/PolterghastChain").Width * 0.5f, (float)ModContent.GetTexture("CalamityMod/NPCs/Polterghast/PolterghastChain").Height * 0.5f), 1f, SpriteEffects.None, 0f); + new Vector2(ModContent.GetTexture("CalamityMod/NPCs/Polterghast/PolterghastChain").Width * 0.5f, ModContent.GetTexture("CalamityMod/NPCs/Polterghast/PolterghastChain").Height * 0.5f), 1f, SpriteEffects.None, 0f); } } diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianBoss.cs b/NPCs/ProfanedGuardians/ProfanedGuardianBoss.cs index 0922938200..9bd4a810ff 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianBoss.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianBoss.cs @@ -70,6 +70,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.value = Item.buyPrice(0, 25, 0, 0); @@ -444,7 +445,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.OnFire, 600, true); + player.AddBuff(ModContent.BuffType(), 300, true); } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianBoss2.cs b/NPCs/ProfanedGuardians/ProfanedGuardianBoss2.cs index 5f5f1215f8..e49436ef05 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianBoss2.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianBoss2.cs @@ -63,6 +63,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.HitSound = SoundID.NPCHit52; @@ -291,12 +292,12 @@ namespace CalamityMod.NPCs.ProfanedGuardians potionType = ItemID.GreaterHealingPotion; } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.OnFire, 600, true); - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(ModContent.BuffType(), 300, true); + } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { npc.lifeMax = (int)(npc.lifeMax * 0.7f * bossLifeScale); npc.damage = (int)(npc.damage * 0.8f); diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianBoss3.cs b/NPCs/ProfanedGuardians/ProfanedGuardianBoss3.cs index ad91d73b1d..08be31b070 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianBoss3.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianBoss3.cs @@ -63,6 +63,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.HitSound = SoundID.NPCHit52; @@ -300,12 +301,12 @@ namespace CalamityMod.NPCs.ProfanedGuardians potionType = ItemID.GreaterHealingPotion; } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.OnFire, 600, true); - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(ModContent.BuffType(), 300, true); + } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { npc.lifeMax = (int)(npc.lifeMax * 0.7f * bossLifeScale); npc.damage = (int)(npc.damage * 0.8f); diff --git a/NPCs/Providence/ProvSpawnDefense.cs b/NPCs/Providence/ProvSpawnDefense.cs index 03d02c235c..693765e465 100644 --- a/NPCs/Providence/ProvSpawnDefense.cs +++ b/NPCs/Providence/ProvSpawnDefense.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -45,6 +46,7 @@ namespace CalamityMod.NPCs.Providence npc.buffImmune[BuffID.Ichor] = false; npc.buffImmune[BuffID.CursedInferno] = false; npc.buffImmune[BuffID.StardustMinionBleed] = false; + npc.buffImmune[BuffID.Oiled] = false; npc.buffImmune[BuffID.BetsysCurse] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; @@ -53,6 +55,7 @@ namespace CalamityMod.NPCs.Providence npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.HitSound = SoundID.NPCHit52; @@ -96,7 +99,7 @@ namespace CalamityMod.NPCs.Providence int dustType = Main.rand.Next(2); if (dustType == 0) { - dustType = 244; + dustType = (int)CalamityDusts.ProfanedFire; } else { @@ -206,11 +209,16 @@ namespace CalamityMod.NPCs.Providence return true; } - public override void HitEffect(int hitDirection, double damage) + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(ModContent.BuffType(), 300, true); + } + + public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.ProfanedFire, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { @@ -219,7 +227,7 @@ namespace CalamityMod.NPCs.Providence Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossT3"), 1f); for (int k = 0; k < 30; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.ProfanedFire, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/Providence/ProvSpawnHealer.cs b/NPCs/Providence/ProvSpawnHealer.cs index a7271b8240..c96e2456f8 100644 --- a/NPCs/Providence/ProvSpawnHealer.cs +++ b/NPCs/Providence/ProvSpawnHealer.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -54,6 +55,7 @@ namespace CalamityMod.NPCs.Providence npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.HitSound = SoundID.NPCHit52; @@ -97,7 +99,7 @@ namespace CalamityMod.NPCs.Providence int dustType = Main.rand.Next(2); if (dustType == 0) { - dustType = 244; + dustType = (int)CalamityDusts.ProfanedFire; } else { @@ -247,7 +249,7 @@ namespace CalamityMod.NPCs.Providence { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.ProfanedFire, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { @@ -258,7 +260,7 @@ namespace CalamityMod.NPCs.Providence Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH5"), 1f); for (int k = 0; k < 50; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.ProfanedFire, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/Providence/ProvSpawnOffense.cs b/NPCs/Providence/ProvSpawnOffense.cs index 65f485cf55..f1d2ecf919 100644 --- a/NPCs/Providence/ProvSpawnOffense.cs +++ b/NPCs/Providence/ProvSpawnOffense.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -57,6 +58,7 @@ namespace CalamityMod.NPCs.Providence npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.HitSound = SoundID.NPCHit52; @@ -100,7 +102,7 @@ namespace CalamityMod.NPCs.Providence { if (Main.rand.Next(3) < num1009) { - int num1012 = Dust.NewDust(vectorCenter - new Vector2((float)num1010), num1010 * 2, num1010 * 2, 244, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default, 0.5f); + int num1012 = Dust.NewDust(vectorCenter - new Vector2((float)num1010), num1010 * 2, num1010 * 2, (int)CalamityDusts.ProfanedFire, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default, 0.5f); Main.dust[num1012].noGravity = true; Main.dust[num1012].velocity *= 0.2f; Main.dust[num1012].fadeIn = 1f; @@ -283,20 +285,16 @@ namespace CalamityMod.NPCs.Providence return true; } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - { - player.AddBuff(ModContent.BuffType(), 180); - } - player.AddBuff(BuffID.OnFire, 600, true); - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(ModContent.BuffType(), 300, true); + } - public override void HitEffect(int hitDirection, double damage) + public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.ProfanedFire, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { @@ -306,7 +304,7 @@ namespace CalamityMod.NPCs.Providence Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ProfanedGuardianBossGores/ProfanedGuardianBossA4"), 1f); for (int k = 0; k < 30; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.ProfanedFire, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/Providence/Providence.cs b/NPCs/Providence/Providence.cs index 6106fba79d..801ea6bccd 100644 --- a/NPCs/Providence/Providence.cs +++ b/NPCs/Providence/Providence.cs @@ -27,6 +27,7 @@ using Terraria; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; +using CalamityMod.Items.Dyes; using CalamityMod.Projectiles.Summon; using CalamityMod.Projectiles.Typeless; @@ -35,7 +36,6 @@ namespace CalamityMod.NPCs.Providence [AutoloadBossHead] public class Providence : ModNPC { - private bool hasTakenDaytimeDamage = false; private bool text = false; private bool useDefenseFrames = false; private float bossLife; @@ -46,8 +46,9 @@ namespace CalamityMod.NPCs.Providence private int frameUsed = 0; private int healTimer = 0; private bool challenge = Main.expertMode && Main.netMode == NetmodeID.SinglePlayer; //Used to determine if Profaned Soul Crystal should drop, couldn't figure out mp mems always dropping it so challenge is singleplayer only. + internal bool hasTakenDaytimeDamage = false; - public static float normalDR = 0.35f; + public static float normalDR = 0.35f; public static float cocoonDR = 0.9f; public override void SetStaticDefaults() @@ -91,6 +92,7 @@ namespace CalamityMod.NPCs.Providence npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.noGravity = true; @@ -214,6 +216,7 @@ namespace CalamityMod.NPCs.Providence // Phase times float phaseTime = nightTime ? 240f : 300f; float crystalPhaseTime = nightTime ? 60f : 120f; + int nightCrystalTime = 210; float attackDelayAfterCocoon = 90f; // Phases @@ -413,8 +416,10 @@ namespace CalamityMod.NPCs.Providence cocoonDR : delayAttacks ? MathHelper.Lerp(normalDR, cocoonDR, npc.localAI[2] / attackDelayAfterCocoon) : normalDR; - // Movement - if (npc.ai[0] != 2f && npc.ai[0] != 5f) + npc.Calamity().DR = 0f; + + // Movement + if (npc.ai[0] != 2f && npc.ai[0] != 5f) { // Firing holy ray or not bool firingLaser = npc.ai[0] == 7f; @@ -560,17 +565,6 @@ namespace CalamityMod.NPCs.Providence if (useLaser || nightTime) { npc.TargetClosest(false); - Vector2 v3 = player.Center - vector - new Vector2(0f, -22f); - float num1219 = v3.Length() / 500f; - if (num1219 > 1f) - num1219 = 1f; - num1219 = 1f - num1219; - num1219 *= 2f; - if (num1219 > 1f) - num1219 = 1f; - - npc.localAI[0] = v3.ToRotation(); - npc.localAI[1] = num1219; } break; // 1200 case 7: @@ -593,17 +587,6 @@ namespace CalamityMod.NPCs.Providence if (useLaser || nightTime) { npc.TargetClosest(false); - Vector2 v3 = player.Center - vector - new Vector2(0f, -22f); - float num1219 = v3.Length() / 500f; - if (num1219 > 1f) - num1219 = 1f; - num1219 = 1f - num1219; - num1219 *= 2f; - if (num1219 > 1f) - num1219 = 1f; - - npc.localAI[0] = v3.ToRotation(); - npc.localAI[1] = num1219; } break; case 13: @@ -628,17 +611,6 @@ namespace CalamityMod.NPCs.Providence if (useLaser) { npc.TargetClosest(false); - Vector2 v3 = player.Center - vector - new Vector2(0f, -22f); - float num1219 = v3.Length() / 500f; - if (num1219 > 1f) - num1219 = 1f; - num1219 = 1f - num1219; - num1219 *= 2f; - if (num1219 > 1f) - num1219 = 1f; - - npc.localAI[0] = v3.ToRotation(); - npc.localAI[1] = num1219; } break; case 2: @@ -673,17 +645,6 @@ namespace CalamityMod.NPCs.Providence if (useLaser) { npc.TargetClosest(false); - Vector2 v3 = player.Center - vector - new Vector2(0f, -22f); - float num1219 = v3.Length() / 500f; - if (num1219 > 1f) - num1219 = 1f; - num1219 = 1f - num1219; - num1219 *= 2f; - if (num1219 > 1f) - num1219 = 1f; - - npc.localAI[0] = v3.ToRotation(); - npc.localAI[1] = num1219; } break; case 12: @@ -1186,17 +1147,19 @@ namespace CalamityMod.NPCs.Providence if (!targetDead) npc.velocity *= 0.9f; - if (Main.netMode != NetmodeID.MultiplayerClient) + npc.ai[1] += 1f; + if (npc.ai[1] >= crystalPhaseTime) { - npc.ai[1] += 1f; - if (npc.ai[1] >= crystalPhaseTime) + if (npc.ai[1] == crystalPhaseTime && Main.netMode != NetmodeID.MultiplayerClient) { - if (npc.ai[1] == crystalPhaseTime) - Projectile.NewProjectile(player.Center.X, player.Center.Y - 360f, 0f, 0f, ModContent.ProjectileType(), crystalDamage, 0f, player.whoAmI, 0f, 0f); + int proj = Projectile.NewProjectile(player.Center.X, player.Center.Y - 360f, 0f, 0f, ModContent.ProjectileType(), crystalDamage, 0f, player.whoAmI, 0f, 0f); - if (npc.ai[1] >= crystalPhaseTime + 210f || !nightTime) - npc.ai[0] = -1f; + if (nightTime) + Main.projectile[proj].timeLeft = nightCrystalTime; } + + if (npc.ai[1] >= crystalPhaseTime + nightCrystalTime || !nightTime) + npc.ai[0] = -1f; } } @@ -1210,10 +1173,6 @@ namespace CalamityMod.NPCs.Providence npc.ai[2] += 1f; if (npc.ai[2] < 120f) { - npc.localAI[1] -= 0.07f; - if (npc.localAI[1] < 0f) - npc.localAI[1] = 0f; - if (npc.ai[2] >= 40f) { int num1220 = 0; @@ -1265,25 +1224,6 @@ namespace CalamityMod.NPCs.Providence npc.netUpdate = true; } } - - npc.localAI[1] += 0.05f; - if (npc.localAI[1] > 1f) - npc.localAI[1] = 1f; - - float num1226 = (npc.ai[3] >= 0f).ToDirectionInt(); - float num1227 = npc.ai[3]; - if (num1227 < 0f) - num1227 *= -1f; - num1227 += -(MathHelper.TwoPi + MathHelper.Pi); - num1227 += num1226 * MathHelper.TwoPi / rotation; - - npc.localAI[0] = num1227; - } - else - { - npc.localAI[1] -= 0.07f; - if (npc.localAI[1] < 0f) - npc.localAI[1] = 0f; } npc.ai[1] += 1f; @@ -1300,10 +1240,8 @@ namespace CalamityMod.NPCs.Providence if (projectile.active) { if (projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType()) - { projectile.Kill(); - } - else if (projectile.type == ModContent.ProjectileType()) + else if (projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType()) projectile.active = false; } } @@ -1334,7 +1272,7 @@ namespace CalamityMod.NPCs.Providence DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, shouldDrop); // Special drop for defeating her at night - //DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !hasTakenDaytimeDamage); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !hasTakenDaytimeDamage, 3, 4); // All other drops are contained in the bag, so they only drop directly on Normal if (!Main.expertMode) @@ -1621,8 +1559,18 @@ namespace CalamityMod.NPCs.Providence public override void OnHitByProjectile(Projectile projectile, int damage, float knockback, bool crit) { + bool oldDaytimeDamageCheck = hasTakenDaytimeDamage; hasTakenDaytimeDamage = Main.dayTime; + if (oldDaytimeDamageCheck != hasTakenDaytimeDamage && Main.netMode != NetmodeID.SinglePlayer) + { + var netMessage = mod.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.ProvidenceDyeConditionSync); + netMessage.Write((byte)npc.whoAmI); + netMessage.Write(hasTakenDaytimeDamage); + netMessage.Send(); + } + if (challenge) { bool goldenGun = projectile.type == ModContent.ProjectileType(); @@ -1637,9 +1585,19 @@ namespace CalamityMod.NPCs.Providence } public override void OnHitByItem(Player player, Item item, int damage, float knockback, bool crit) - { + { + bool oldDaytimeDamageCheck = hasTakenDaytimeDamage; hasTakenDaytimeDamage = Main.dayTime; + if (oldDaytimeDamageCheck != hasTakenDaytimeDamage && Main.netMode != NetmodeID.SinglePlayer) + { + var netMessage = mod.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.ProvidenceDyeConditionSync); + netMessage.Write((byte)npc.whoAmI); + netMessage.Write(hasTakenDaytimeDamage); + netMessage.Send(); + } + if (challenge) challenge = false; } diff --git a/NPCs/Ravager/FlamePillar.cs b/NPCs/Ravager/FlamePillar.cs index 285ece606c..66052ba09b 100644 --- a/NPCs/Ravager/FlamePillar.cs +++ b/NPCs/Ravager/FlamePillar.cs @@ -164,10 +164,10 @@ namespace CalamityMod.NPCs.Ravager } for (int num623 = 0; num623 < 30; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 1, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, DustID.Stone, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 8, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, DustID.Iron, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } diff --git a/NPCs/Ravager/RavagerBody.cs b/NPCs/Ravager/RavagerBody.cs index ff26b76c14..e6e6965c46 100644 --- a/NPCs/Ravager/RavagerBody.cs +++ b/NPCs/Ravager/RavagerBody.cs @@ -77,6 +77,7 @@ namespace CalamityMod.NPCs.Ravager npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.boss = true; @@ -94,14 +95,12 @@ namespace CalamityMod.NPCs.Ravager public override void SendExtraAI(BinaryWriter writer) { writer.Write(npc.dontTakeDamage); - writer.Write(npc.noGravity); writer.Write(velocityY); } public override void ReceiveExtraAI(BinaryReader reader) { npc.dontTakeDamage = reader.ReadBoolean(); - npc.noGravity = reader.ReadBoolean(); velocityY = reader.ReadSingle(); } @@ -136,11 +135,11 @@ namespace CalamityMod.NPCs.Ravager if (npc.localAI[0] == 0f && Main.netMode != NetmodeID.MultiplayerClient) { npc.localAI[0] = 1f; - NPC.NewNPC((int)npc.Center.X - 70, (int)npc.Center.Y + 88, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); - NPC.NewNPC((int)npc.Center.X + 70, (int)npc.Center.Y + 88, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); - NPC.NewNPC((int)npc.Center.X - 120, (int)npc.Center.Y + 50, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); - NPC.NewNPC((int)npc.Center.X + 120, (int)npc.Center.Y + 50, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); - NPC.NewNPC((int)npc.Center.X + 1, (int)npc.Center.Y - 20, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); + NPC.NewNPC((int)npc.Center.X - 70, (int)npc.Center.Y + 88, ModContent.NPCType()); + NPC.NewNPC((int)npc.Center.X + 70, (int)npc.Center.Y + 88, ModContent.NPCType()); + NPC.NewNPC((int)npc.Center.X - 120, (int)npc.Center.Y + 50, ModContent.NPCType()); + NPC.NewNPC((int)npc.Center.X + 120, (int)npc.Center.Y + 50, ModContent.NPCType()); + NPC.NewNPC((int)npc.Center.X + 1, (int)npc.Center.Y - 20, ModContent.NPCType()); } if (npc.target >= 0 && Main.player[npc.target].dead) @@ -167,7 +166,7 @@ namespace CalamityMod.NPCs.Ravager bool rightClawActive = false; bool leftClawActive = false; - for (int num619 = 0; num619 < 200; num619++) + for (int num619 = 0; num619 < Main.maxNPCs; num619++) { if (Main.npc[num619].active && Main.npc[num619].type == ModContent.NPCType()) headActive = true; @@ -182,7 +181,7 @@ namespace CalamityMod.NPCs.Ravager } bool immunePhase = headActive || rightClawActive || leftClawActive || rightLegActive || leftLegActive; - bool finalPhase = !leftClawActive && !rightClawActive && !headActive && !leftLegActive && !rightLegActive; + bool finalPhase = !leftClawActive && !rightClawActive && !headActive && !leftLegActive && !rightLegActive && expertMode; bool enrage = false; if (player.position.Y + (player.height / 2) > npc.position.Y + (npc.height / 2) + 10f) @@ -202,7 +201,7 @@ namespace CalamityMod.NPCs.Ravager if (!headActive) { - int rightDust = Dust.NewDust(new Vector2(npc.Center.X, npc.Center.Y - 30f), 8, 8, 5, 0f, 0f, 100, default, 2.5f); + int rightDust = Dust.NewDust(new Vector2(npc.Center.X, npc.Center.Y - 30f), 8, 8, DustID.Blood, 0f, 0f, 100, default, 2.5f); Main.dust[rightDust].alpha += Main.rand.Next(100); Main.dust[rightDust].velocity *= 0.2f; @@ -212,7 +211,7 @@ namespace CalamityMod.NPCs.Ravager if (Main.rand.NextBool(10)) { - rightDust = Dust.NewDust(new Vector2(npc.Center.X, npc.Center.Y - 30f), 8, 8, 6, 0f, 0f, 0, default, 1.5f); + rightDust = Dust.NewDust(new Vector2(npc.Center.X, npc.Center.Y - 30f), 8, 8, DustID.Fire, 0f, 0f, 0, default, 1.5f); if (Main.rand.Next(20) != 0) { Main.dust[rightDust].noGravity = true; @@ -250,7 +249,7 @@ namespace CalamityMod.NPCs.Ravager if (!rightClawActive) { - int rightDust = Dust.NewDust(new Vector2(npc.Center.X + 80f, npc.Center.Y + 45f), 8, 8, 5, 0f, 0f, 100, default, 3f); + int rightDust = Dust.NewDust(new Vector2(npc.Center.X + 80f, npc.Center.Y + 45f), 8, 8, DustID.Blood, 0f, 0f, 100, default, 3f); Main.dust[rightDust].alpha += Main.rand.Next(100); Main.dust[rightDust].velocity *= 0.2f; @@ -260,7 +259,7 @@ namespace CalamityMod.NPCs.Ravager if (Main.rand.NextBool(10)) { - rightDust = Dust.NewDust(new Vector2(npc.Center.X + 80f, npc.Center.Y + 45f), 8, 8, 6, 0f, 0f, 0, default, 2f); + rightDust = Dust.NewDust(new Vector2(npc.Center.X + 80f, npc.Center.Y + 45f), 8, 8, DustID.Fire, 0f, 0f, 0, default, 2f); if (Main.rand.Next(20) != 0) { Main.dust[rightDust].noGravity = true; @@ -290,22 +289,21 @@ namespace CalamityMod.NPCs.Ravager if (!leftClawActive) { - int leftDust = Dust.NewDust(new Vector2(npc.Center.X - 80f, npc.Center.Y + 45f), 8, 8, 5, 0f, 0f, 100, default, 3f); - Main.dust[leftDust].alpha += Main.rand.Next(100); - Main.dust[leftDust].velocity *= 0.2f; - + int leftDust = Dust.NewDust(new Vector2(npc.Center.X - 80f, npc.Center.Y + 45f), 8, 8, DustID.Blood, 0f, 0f, 100, default, 3f); Dust leftDustExpr = Main.dust[leftDust]; + leftDustExpr.alpha += Main.rand.Next(100); + leftDustExpr.velocity *= 0.2f; leftDustExpr.velocity.X -= 3f + Main.rand.Next(10) * 0.1f; - Main.dust[leftDust].fadeIn = 0.5f + Main.rand.Next(10) * 0.1f; + leftDustExpr.fadeIn = 0.5f + Main.rand.Next(10) * 0.1f; if (Main.rand.NextBool(10)) { - leftDust = Dust.NewDust(new Vector2(npc.Center.X - 80f, npc.Center.Y + 45f), 8, 8, 6, 0f, 0f, 0, default, 2f); + leftDust = Dust.NewDust(new Vector2(npc.Center.X - 80f, npc.Center.Y + 45f), 8, 8, DustID.Fire, 0f, 0f, 0, default, 2f); if (Main.rand.Next(20) != 0) { - Main.dust[leftDust].noGravity = true; - Main.dust[leftDust].scale *= 1f + Main.rand.Next(10) * 0.1f; Dust leftDustExpr2 = Main.dust[leftDust]; + leftDustExpr2.noGravity = true; + leftDustExpr2.scale *= 1f + Main.rand.Next(10) * 0.1f; leftDustExpr2.velocity.X -= 4f; } } @@ -330,22 +328,21 @@ namespace CalamityMod.NPCs.Ravager if (!rightLegActive) { - int rightDust = Dust.NewDust(new Vector2(npc.Center.X + 60f, npc.Center.Y + 60f), 8, 8, 5, 0f, 0f, 100, default, 2f); - Main.dust[rightDust].alpha += Main.rand.Next(100); - Main.dust[rightDust].velocity *= 0.2f; - + int rightDust = Dust.NewDust(new Vector2(npc.Center.X + 60f, npc.Center.Y + 60f), 8, 8, DustID.Blood, 0f, 0f, 100, default, 2f); Dust rightDustExpr = Main.dust[rightDust]; + rightDustExpr.alpha += Main.rand.Next(100); + rightDustExpr.velocity *= 0.2f; rightDustExpr.velocity.Y += 0.5f + Main.rand.Next(10) * 0.1f; - Main.dust[rightDust].fadeIn = 0.5f + Main.rand.Next(10) * 0.1f; + rightDustExpr.fadeIn = 0.5f + Main.rand.Next(10) * 0.1f; if (Main.rand.NextBool(10)) { - rightDust = Dust.NewDust(new Vector2(npc.Center.X + 60f, npc.Center.Y + 60f), 8, 8, 6, 0f, 0f, 0, default, 1.5f); + rightDust = Dust.NewDust(new Vector2(npc.Center.X + 60f, npc.Center.Y + 60f), 8, 8, DustID.Fire, 0f, 0f, 0, default, 1.5f); if (Main.rand.Next(20) != 0) { - Main.dust[rightDust].noGravity = true; - Main.dust[rightDust].scale *= 1f + Main.rand.Next(10) * 0.1f; Dust rightDustExpr2 = Main.dust[rightDust]; + rightDustExpr2.noGravity = true; + rightDustExpr2.scale *= 1f + Main.rand.Next(10) * 0.1f; rightDustExpr2.velocity.Y += 1f; } } @@ -369,7 +366,7 @@ namespace CalamityMod.NPCs.Ravager if (!leftLegActive) { - int leftDust = Dust.NewDust(new Vector2(npc.Center.X - 60f, npc.Center.Y + 60f), 8, 8, 5, 0f, 0f, 100, default, 2f); + int leftDust = Dust.NewDust(new Vector2(npc.Center.X - 60f, npc.Center.Y + 60f), 8, 8, DustID.Blood, 0f, 0f, 100, default, 2f); Main.dust[leftDust].alpha += Main.rand.Next(100); Main.dust[leftDust].velocity *= 0.2f; @@ -379,7 +376,7 @@ namespace CalamityMod.NPCs.Ravager if (Main.rand.NextBool(10)) { - leftDust = Dust.NewDust(new Vector2(npc.Center.X - 60f, npc.Center.Y + 60f), 8, 8, 6, 0f, 0f, 0, default, 1.5f); + leftDust = Dust.NewDust(new Vector2(npc.Center.X - 60f, npc.Center.Y + 60f), 8, 8, DustID.Fire, 0f, 0f, 0, default, 1.5f); if (Main.rand.Next(20) != 0) { Main.dust[leftDust].noGravity = true; @@ -408,7 +405,7 @@ namespace CalamityMod.NPCs.Ravager if (npc.ai[0] == 0f) { - npc.noTileCollide = false; + npc.noTileCollide = false; if (npc.velocity.Y == 0f) { @@ -448,8 +445,6 @@ namespace CalamityMod.NPCs.Ravager if (revenge) { - npc.Calamity().newAI[1] = 0f; - if (distanceBelowTarget > 0f) npc.Calamity().newAI[1] += 1f + distanceBelowTarget * 0.001f; @@ -460,7 +455,7 @@ namespace CalamityMod.NPCs.Ravager velocityY *= npc.Calamity().newAI[1]; } - if (expertMode) + if (expertMode && !finalPhase) { npc.noTileCollide = true; if (shouldFall) @@ -480,14 +475,22 @@ namespace CalamityMod.NPCs.Ravager } } + if (finalPhase) + { + npc.noTileCollide = true; + npc.Calamity().newAI[2] = player.direction; + } + npc.velocity.X = velocityX * npc.direction; npc.velocity.Y = velocityY; - npc.ai[0] = finalPhase && !shouldFall ? 2f : 1f; + npc.ai[0] = finalPhase ? 2f : 1f; npc.ai[1] = 0f; } } - } + + CustomGravity(); + } else if (npc.ai[0] >= 1f) { if (npc.velocity.Y == 0f && (npc.ai[1] == 31f || npc.ai[0] == 1f)) @@ -514,13 +517,13 @@ namespace CalamityMod.NPCs.Ravager if (!NPC.AnyNPCs(ModContent.NPCType())) { - NPC.NewNPC((int)npc.Center.X - spawnDistance, (int)npc.Center.Y - 10, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); - NPC.NewNPC((int)npc.Center.X + spawnDistance, (int)npc.Center.Y - 10, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); + NPC.NewNPC((int)npc.Center.X - spawnDistance, (int)npc.Center.Y - 10, ModContent.NPCType()); + NPC.NewNPC((int)npc.Center.X + spawnDistance, (int)npc.Center.Y - 10, ModContent.NPCType()); } else if (!NPC.AnyNPCs(ModContent.NPCType())) { - NPC.NewNPC((int)npc.Center.X - spawnDistance * 2, (int)npc.Center.Y - 10, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); - NPC.NewNPC((int)npc.Center.X + spawnDistance * 2, (int)npc.Center.Y - 10, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); + NPC.NewNPC((int)npc.Center.X - spawnDistance * 2, (int)npc.Center.Y - 10, ModContent.NPCType()); + NPC.NewNPC((int)npc.Center.X + spawnDistance * 2, (int)npc.Center.Y - 10, ModContent.NPCType()); } } } @@ -528,6 +531,9 @@ namespace CalamityMod.NPCs.Ravager if (revenge) npc.Calamity().newAI[0] += 1f; + npc.Calamity().newAI[1] = 0f; + npc.Calamity().newAI[3] = 0f; + for (int stompDustArea = (int)npc.position.X - 30; stompDustArea < (int)npc.position.X + npc.width + 60; stompDustArea += 30) { for (int stompDustAmount = 0; stompDustAmount < 6; stompDustAmount++) @@ -553,34 +559,44 @@ namespace CalamityMod.NPCs.Ravager npc.noTileCollide = false; } - float amount = death ? 1f : 1f - lifeRatio; - float unitsAhead = MathHelper.Lerp(48f, 160f, amount); - Vector2 targetVector = npc.ai[0] == 2f ? player.Center + player.velocity.SafeNormalize(Vector2.UnitY) * unitsAhead : player.Center; + Vector2 targetVector = player.position; + float aimY = targetVector.Y - 480f; + float distanceFromTargetPos = Math.Abs(npc.Top.Y - aimY); + bool inRange = npc.Top.Y <= aimY + 16f && npc.Top.Y >= aimY - 16f; if (npc.ai[0] == 2f && npc.ai[1] == 0f) { - float aimY = targetVector.Y - 240f; - if (npc.Top.Y > aimY) - { - if (npc.velocity.Y > velocityY) - npc.velocity.Y -= 0.2f + Math.Abs(npc.Center.Y - aimY) * 0.001f; - } + npc.Calamity().newAI[3] += 1f; + + if (inRange) + npc.velocity.Y = 0f; + else if (npc.Top.Y > aimY) + npc.velocity.Y -= 0.2f + distanceFromTargetPos * 0.001f; else - { - if (npc.velocity.Y < velocityY) - npc.velocity.Y += 0.2f + Math.Abs(npc.Center.Y - aimY) * 0.001f; - } + npc.velocity.Y += 0.2f + distanceFromTargetPos * 0.001f; + + if (npc.velocity.Y < velocityY) + npc.velocity.Y = velocityY; + if (npc.velocity.Y > -velocityY) + npc.velocity.Y = -velocityY; } - Vector2 aimAt = npc.ai[0] == 2f ? targetVector : player.position; + float maxOffset = 160f + (death ? 160f : 160f * (1f - lifeRatio)); + float offset = npc.ai[0] == 2f ? maxOffset * npc.Calamity().newAI[2] : 0f; - if ((npc.position.X < aimAt.X && npc.position.X + npc.width > aimAt.X + player.width) || npc.ai[1] > 0f) + // Set offset to 0 if the target stops moving + if (Math.Abs(player.velocity.X) < 0.5f) + npc.Calamity().newAI[2] = 0f; + else + npc.Calamity().newAI[2] = player.direction; + + if ((npc.position.X < targetVector.X + offset && npc.position.X + npc.width > targetVector.X + player.width + offset && (inRange || npc.ai[0] != 2f)) || npc.ai[1] > 0f || npc.Calamity().newAI[3] >= 180f) { if (npc.ai[0] == 2f) { - float stopBeforeFallTime = 30f; + float stopBeforeFallTime = npc.Calamity().newAI[2] == 0f ? 15f : 20f; if (expertMode) - stopBeforeFallTime -= death ? 15f : 15f * (1f - lifeRatio); + stopBeforeFallTime -= death ? 10f : 10f * (1f - lifeRatio); if (npc.ai[1] < stopBeforeFallTime) { @@ -618,7 +634,11 @@ namespace CalamityMod.NPCs.Ravager } else { - float velocityXChange = 0.2f + Math.Abs(npc.Center.X - targetVector.X) * 0.001f; + float velocityMult = 1.8f; + float velocityXChange = 0.2f + Math.Abs(npc.Center.X - player.Center.X) * 0.001f; + + if (npc.ai[0] == 2f) + velocityXChange *= velocityMult; if (npc.direction < 0) npc.velocity.X -= velocityXChange; @@ -626,7 +646,7 @@ namespace CalamityMod.NPCs.Ravager npc.velocity.X += velocityXChange; float velocityXBoost = death ? 4f : 4f * (1f - lifeRatio); - float velocityX = 8f + velocityXBoost + Math.Abs(npc.Center.X - targetVector.X) * 0.001f; + float velocityX = 8f + velocityXBoost + Math.Abs(npc.Center.X - player.Center.X) * 0.001f; if (npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) velocityX += 3f; @@ -642,7 +662,7 @@ namespace CalamityMod.NPCs.Ravager velocityX += 1f; if (npc.ai[0] == 2f) - velocityX *= 1.4f; + velocityX *= velocityMult; if (npc.velocity.X < -velocityX) npc.velocity.X = -velocityX; @@ -650,32 +670,36 @@ namespace CalamityMod.NPCs.Ravager npc.velocity.X = velocityX; } - // Custom gravity - float gravity = npc.ai[0] == 2f ? 0f : 0.3f; - float maxFallSpeed = npc.ai[0] == 2f ? 24f : 10f; - if (npc.wet) - { - if (npc.honeyWet) - { - gravity *= 0.33f; - maxFallSpeed *= 0.4f; - } - else - { - gravity *= 0.66f; - maxFallSpeed *= 0.7f; - } - } - - if (npc.Calamity().newAI[1] > 1f) - maxFallSpeed *= npc.Calamity().newAI[1]; - - npc.velocity.Y += gravity; - if (npc.velocity.Y > maxFallSpeed) - npc.velocity.Y = maxFallSpeed; + CustomGravity(); } } + void CustomGravity() + { + float gravity = npc.ai[0] == 2f ? 0f : 0.3f; + float maxFallSpeed = npc.ai[0] == 2f ? 24f : 10f; + if (npc.wet) + { + if (npc.honeyWet) + { + gravity *= 0.33f; + maxFallSpeed *= 0.4f; + } + else + { + gravity *= 0.66f; + maxFallSpeed *= 0.7f; + } + } + + if (npc.Calamity().newAI[1] > 1f) + maxFallSpeed *= npc.Calamity().newAI[1]; + + npc.velocity.Y += gravity; + if (npc.velocity.Y > maxFallSpeed) + npc.velocity.Y = maxFallSpeed; + } + player = Main.player[npc.target]; if (npc.target <= 0 || npc.target == 255 || player.dead || !player.active) { @@ -737,8 +761,8 @@ namespace CalamityMod.NPCs.Ravager { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 2f); - Dust.NewDust(npc.position, npc.width, npc.height, 6, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 2f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Fire, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { @@ -750,24 +774,19 @@ namespace CalamityMod.NPCs.Ravager for (int k = 0; k < 50; k++) { Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 2f); - Dust.NewDust(npc.position, npc.width, npc.height, 6, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Fire, hitDirection, -1f, 0, default, 1f); } } } - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 1; - return true; - } - public override void OnHitPlayer(Player player, int damage, bool crit) { if (CalamityWorld.revenge) { player.AddBuff(ModContent.BuffType(), 600, true); } - } + player.AddBuff(ModContent.BuffType(), 300, true); + } public override void BossLoot(ref string name, ref int potionType) { diff --git a/NPCs/Ravager/RavagerClawLeft.cs b/NPCs/Ravager/RavagerClawLeft.cs index 2ce97164b0..75b6fbe069 100644 --- a/NPCs/Ravager/RavagerClawLeft.cs +++ b/NPCs/Ravager/RavagerClawLeft.cs @@ -48,6 +48,7 @@ namespace CalamityMod.NPCs.Ravager npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.noGravity = true; @@ -318,7 +319,8 @@ namespace CalamityMod.NPCs.Ravager { player.AddBuff(ModContent.BuffType(), 300, true); } - } + player.AddBuff(ModContent.BuffType(), 180, true); + } public override void HitEffect(int hitDirection, double damage) { @@ -327,7 +329,7 @@ namespace CalamityMod.NPCs.Ravager int num285 = 0; while ((double)num285 < damage / (double)npc.lifeMax * 100.0) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, (float)hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, (float)hitDirection, -1f, 0, default, 1f); num285++; } } diff --git a/NPCs/Ravager/RavagerClawRight.cs b/NPCs/Ravager/RavagerClawRight.cs index d3fb95b3c0..caeafb145c 100644 --- a/NPCs/Ravager/RavagerClawRight.cs +++ b/NPCs/Ravager/RavagerClawRight.cs @@ -48,6 +48,7 @@ namespace CalamityMod.NPCs.Ravager npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.noGravity = true; @@ -319,7 +320,8 @@ namespace CalamityMod.NPCs.Ravager { player.AddBuff(ModContent.BuffType(), 300, true); } - } + player.AddBuff(ModContent.BuffType(), 180, true); + } public override void HitEffect(int hitDirection, double damage) { @@ -328,7 +330,7 @@ namespace CalamityMod.NPCs.Ravager int num285 = 0; while ((double)num285 < damage / (double)npc.lifeMax * 100.0) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, (float)hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, (float)hitDirection, -1f, 0, default, 1f); num285++; } } diff --git a/NPCs/Ravager/RavagerHead.cs b/NPCs/Ravager/RavagerHead.cs index c81fe6dd43..46d19d2639 100644 --- a/NPCs/Ravager/RavagerHead.cs +++ b/NPCs/Ravager/RavagerHead.cs @@ -47,6 +47,7 @@ namespace CalamityMod.NPCs.Ravager npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.noGravity = true; @@ -155,7 +156,7 @@ namespace CalamityMod.NPCs.Ravager int num285 = 0; while ((double)num285 < damage / (double)npc.lifeMax * 100.0) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, (float)hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, (float)hitDirection, -1f, 0, default, 1f); num285++; } } diff --git a/NPCs/Ravager/RavagerHead2.cs b/NPCs/Ravager/RavagerHead2.cs index 646e48ef76..c0975bb99f 100644 --- a/NPCs/Ravager/RavagerHead2.cs +++ b/NPCs/Ravager/RavagerHead2.cs @@ -258,7 +258,7 @@ namespace CalamityMod.NPCs.Ravager { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); Dust.NewDust(npc.position, npc.width, npc.height, 6, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) @@ -268,7 +268,7 @@ namespace CalamityMod.NPCs.Ravager Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerHead3"), 1f); for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); Dust.NewDust(npc.position, npc.width, npc.height, 6, hitDirection, -1f, 0, default, 1f); } } diff --git a/NPCs/Ravager/RavagerLegLeft.cs b/NPCs/Ravager/RavagerLegLeft.cs index 63c7bd86eb..33f5f05a1c 100644 --- a/NPCs/Ravager/RavagerLegLeft.cs +++ b/NPCs/Ravager/RavagerLegLeft.cs @@ -46,6 +46,7 @@ namespace CalamityMod.NPCs.Ravager npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.noGravity = true; npc.canGhostHeal = false; @@ -127,8 +128,8 @@ namespace CalamityMod.NPCs.Ravager { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - Dust.NewDust(npc.position, npc.width, npc.height, 6, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Fire, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { @@ -136,8 +137,8 @@ namespace CalamityMod.NPCs.Ravager Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerLegLeft2"), 1f); for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - Dust.NewDust(npc.position, npc.width, npc.height, 6, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Fire, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/Ravager/RavagerLegRight.cs b/NPCs/Ravager/RavagerLegRight.cs index 2441ba9d6c..c3d8445d1f 100644 --- a/NPCs/Ravager/RavagerLegRight.cs +++ b/NPCs/Ravager/RavagerLegRight.cs @@ -46,6 +46,7 @@ namespace CalamityMod.NPCs.Ravager npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.noGravity = true; npc.canGhostHeal = false; @@ -127,8 +128,8 @@ namespace CalamityMod.NPCs.Ravager { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - Dust.NewDust(npc.position, npc.width, npc.height, 6, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Fire, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { @@ -136,8 +137,8 @@ namespace CalamityMod.NPCs.Ravager Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerLegRight2"), 1f); for (int k = 0; k < 20; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); - Dust.NewDust(npc.position, npc.width, npc.height, 6, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Fire, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/Ravager/RockPillar.cs b/NPCs/Ravager/RockPillar.cs index c00ac6abc5..2be41e47b4 100644 --- a/NPCs/Ravager/RockPillar.cs +++ b/NPCs/Ravager/RockPillar.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.World; using Microsoft.Xna.Framework; using System; @@ -83,7 +84,7 @@ namespace CalamityMod.NPCs.Ravager for (int num621 = 0; num621 < 10; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 8, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, DustID.Iron, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -93,10 +94,10 @@ namespace CalamityMod.NPCs.Ravager } for (int num623 = 0; num623 < 10; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 1, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, DustID.Stone, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 8, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, DustID.Iron, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } @@ -134,6 +135,11 @@ namespace CalamityMod.NPCs.Ravager return false; } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(ModContent.BuffType(), 180, true); + } + public override void HitEffect(int hitDirection, double damage) { if (npc.life <= 0) @@ -146,7 +152,7 @@ namespace CalamityMod.NPCs.Ravager npc.position.Y = npc.position.Y - (npc.height / 2); for (int num621 = 0; num621 < 30; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 8, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, DustID.Iron, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -156,10 +162,10 @@ namespace CalamityMod.NPCs.Ravager } for (int num623 = 0; num623 < 30; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 1, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, DustID.Stone, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 8, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, DustID.Iron, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } @@ -167,7 +173,7 @@ namespace CalamityMod.NPCs.Ravager { for (int num621 = 0; num621 < 2; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 8, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, DustID.Iron, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -177,10 +183,10 @@ namespace CalamityMod.NPCs.Ravager } for (int num623 = 0; num623 < 2; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 1, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, DustID.Stone, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 8, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, DustID.Iron, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } diff --git a/NPCs/Signus/Signus.cs b/NPCs/Signus/Signus.cs index 874c634b3d..a2404f48ce 100644 --- a/NPCs/Signus/Signus.cs +++ b/NPCs/Signus/Signus.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; using CalamityMod.Items.Accessories; using CalamityMod.Items.Armor.Vanity; using CalamityMod.Items.LoreItems; @@ -47,7 +48,7 @@ namespace CalamityMod.NPCs.Signus music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); else music = MusicID.Boss4; - bool notDoGFight = CalamityWorld.DoGSecondStageCountdown <= 0; + bool notDoGFight = CalamityWorld.DoGSecondStageCountdown <= 0 || !CalamityWorld.downedSentinel3; npc.LifeMaxNERB(notDoGFight ? 280000 : 70000, notDoGFight ? 445500 : 109500, 2400000); if (notDoGFight) { @@ -80,6 +81,7 @@ namespace CalamityMod.NPCs.Signus npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; + npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.buffImmune[ModContent.BuffType()] = false; npc.noGravity = true; @@ -186,7 +188,7 @@ namespace CalamityMod.NPCs.Signus { if (Main.rand.Next(3) < 1) { - int num1012 = Dust.NewDust(vectorCenter - new Vector2(70f), 70 * 2, 70 * 2, 173, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default, 1.5f); + int num1012 = Dust.NewDust(vectorCenter - new Vector2(70f), 70 * 2, 70 * 2, (int)CalamityDusts.PurpleCosmolite, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default, 1.5f); Main.dust[num1012].noGravity = true; Main.dust[num1012].velocity *= 0.2f; Main.dust[num1012].fadeIn = 1f; @@ -281,7 +283,7 @@ namespace CalamityMod.NPCs.Signus Vector2 position = new Vector2(npc.ai[1] * 16f - (npc.width / 2), npc.ai[2] * 16f - (npc.height / 2)); for (int m = 0; m < 5; m++) { - int dust = Dust.NewDust(position, npc.width, npc.height, 173, 0f, 0f, 90, default, 2f); + int dust = Dust.NewDust(position, npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 90, default, 2f); Main.dust[dust].noGravity = true; Main.dust[dust].fadeIn = 1f; } @@ -297,7 +299,7 @@ namespace CalamityMod.NPCs.Signus npc.position = position; for (int n = 0; n < 15; n++) { - int num39 = Dust.NewDust(npc.position, npc.width, npc.height, 173, 0f, 0f, 90, default, 3f); + int num39 = Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 90, default, 3f); Main.dust[num39].noGravity = true; } npc.ai[0] = 2f; @@ -324,7 +326,7 @@ namespace CalamityMod.NPCs.Signus } for (int num621 = 0; num621 < 5; num621++) { - int num622 = Dust.NewDust(new Vector2(player.position.X + 750f, player.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(player.position.X + 750f, player.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; Main.dust[num622].noGravity = true; if (Main.rand.NextBool(2)) @@ -332,7 +334,7 @@ namespace CalamityMod.NPCs.Signus Main.dust[num622].scale = 0.5f; Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } - int num623 = Dust.NewDust(new Vector2(player.position.X - 750f, player.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + int num623 = Dust.NewDust(new Vector2(player.position.X - 750f, player.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); Main.dust[num623].velocity *= 3f; Main.dust[num623].noGravity = true; if (Main.rand.NextBool(2)) @@ -343,15 +345,15 @@ namespace CalamityMod.NPCs.Signus } for (int num623 = 0; num623 < 20; num623++) { - int num624 = Dust.NewDust(new Vector2(player.position.X + 750f, player.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(player.position.X + 750f, player.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(player.position.X + 750f, player.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(player.position.X + 750f, player.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; - int num625 = Dust.NewDust(new Vector2(player.position.X - 750f, player.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 3f); + int num625 = Dust.NewDust(new Vector2(player.position.X - 750f, player.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 3f); Main.dust[num625].noGravity = true; Main.dust[num625].velocity *= 5f; - num625 = Dust.NewDust(new Vector2(player.position.X - 750f, player.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + num625 = Dust.NewDust(new Vector2(player.position.X - 750f, player.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); Main.dust[num625].velocity *= 2f; } } @@ -781,11 +783,18 @@ namespace CalamityMod.NPCs.Signus netMessage.Write(CalamityWorld.DoGSecondStageCountdown); netMessage.Send(); } - } - // Mark Signus as dead - CalamityWorld.downedSentinel3 = true; - CalamityMod.UpdateServerBoolean(); + // Mark DoG fight sentinels as dead + CalamityWorld.downedSecondSentinels = true; + CalamityMod.UpdateServerBoolean(); + } + + // Mark Signus as dead + if (CalamityWorld.DoGSecondStageCountdown <= 0) + { + CalamityWorld.downedSentinel3 = true; + CalamityMod.UpdateServerBoolean(); + } } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) @@ -798,7 +807,7 @@ namespace CalamityMod.NPCs.Signus { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 173, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { @@ -810,7 +819,7 @@ namespace CalamityMod.NPCs.Signus npc.position.Y = npc.position.Y - (npc.height / 2); for (int num621 = 0; num621 < 40; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -820,10 +829,10 @@ namespace CalamityMod.NPCs.Signus } for (int num623 = 0; num623 < 60; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } float randomSpread = Main.rand.Next(-200, 200) / 100; diff --git a/NPCs/Signus/SignusBomb.cs b/NPCs/Signus/SignusBomb.cs index 8267b2a7b7..f05fa9d320 100644 --- a/NPCs/Signus/SignusBomb.cs +++ b/NPCs/Signus/SignusBomb.cs @@ -1,3 +1,4 @@ +using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -27,6 +28,7 @@ namespace CalamityMod.NPCs.Signus npc.knockBackResist = 0f; npc.noGravity = true; npc.noTileCollide = true; + npc.dontTakeDamage = true; npc.HitSound = SoundID.NPCHit53; npc.DeathSound = SoundID.NPCDeath44; } @@ -50,50 +52,58 @@ namespace CalamityMod.NPCs.Signus return; } - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.7f, 0.2f, 1.1f); + Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 0.7f, 0.2f, 1.1f); + npc.rotation = npc.velocity.X * 0.04f; - if (npc.ai[1] == 0f) - { - npc.scale -= 0.02f; - npc.alpha += 30; - if (npc.alpha >= 250) - { - npc.alpha = 255; - npc.ai[1] = 1f; - } - } - else if (npc.ai[1] == 1f) - { - npc.scale += 0.02f; - npc.alpha -= 30; - if (npc.alpha <= 0) - { - npc.alpha = 0; - npc.ai[1] = 0f; - } - } + npc.TargetClosest(true); Player player = Main.player[npc.target]; - Vector2 vector = player.Center - npc.Center; - if (vector.Length() < 90f || npc.ai[3] >= 300f) + Vector2 vector = player.Center - npc.Center; + npc.ai[2] = vector.Length(); + + npc.ai[3] += 1f; + if (npc.ai[2] < 90f || npc.ai[3] >= 300f || npc.Calamity().newAI[0] > 0f) { - npc.dontTakeDamage = false; - CheckDead(); - npc.life = 0; - return; + npc.Calamity().newAI[0] += 1f; + npc.velocity *= 0.98f; + npc.dontTakeDamage = false; + npc.scale = MathHelper.Lerp(1f, 3f, npc.Calamity().newAI[0] / 85f); + + if (npc.Calamity().newAI[0] >= 85f) + { + CheckDead(); + npc.life = 0; + } + + return; } - npc.ai[3] += 1f; - npc.dontTakeDamage = npc.ai[3] >= 240f ? false : true; - if (npc.ai[3] >= 180f) - { - npc.velocity *= 0.985f; - return; - } - float num1372 = 14f; - Vector2 vector167 = new Vector2(npc.Center.X + (float)(npc.direction * 20), npc.Center.Y + 6f); - float num1373 = player.position.X + (float)player.width * 0.5f - vector167.X; + + if (npc.ai[1] == 0f) + { + npc.scale -= 0.02f; + npc.alpha += 30; + if (npc.alpha >= 250) + { + npc.alpha = 255; + npc.ai[1] = 1f; + } + } + else if (npc.ai[1] == 1f) + { + npc.scale += 0.02f; + npc.alpha -= 30; + if (npc.alpha <= 0) + { + npc.alpha = 0; + npc.ai[1] = 0f; + } + } + + float num1372 = 14f; + Vector2 vector167 = new Vector2(npc.Center.X + (npc.direction * 20), npc.Center.Y + 6f); + float num1373 = player.position.X + player.width * 0.5f - vector167.X; float num1374 = player.Center.Y - vector167.Y; - float num1375 = (float)Math.Sqrt((double)(num1373 * num1373 + num1374 * num1374)); + float num1375 = (float)Math.Sqrt(num1373 * num1373 + num1374 * num1374); float num1376 = num1372 / num1375; num1373 *= num1376; num1374 *= num1376; @@ -114,6 +124,7 @@ namespace CalamityMod.NPCs.Signus } return; } + npc.velocity.X = (npc.velocity.X * 50f + num1373) / 51f; npc.velocity.Y = (npc.velocity.Y * 50f + num1374) / 51f; if (num1375 < 350f) @@ -140,7 +151,7 @@ namespace CalamityMod.NPCs.Signus spriteEffects = SpriteEffects.FlipHorizontally; Texture2D texture2D15 = Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / 2)); + Vector2 vector11 = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / 2); Color color36 = Color.White; float amount9 = 0.5f; int num153 = 5; @@ -152,16 +163,16 @@ namespace CalamityMod.NPCs.Signus Color color38 = lightColor; color38 = Color.Lerp(color38, color36, amount9); color38 = npc.GetAlpha(color38); - color38 *= (float)(num153 - num155) / 15f; - Vector2 vector41 = npc.oldPos[num155] + new Vector2((float)npc.width, (float)npc.height) / 2f - Main.screenPosition; - vector41 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * npc.scale / 2f; + color38 *= (num153 - num155) / 15f; + Vector2 vector41 = npc.oldPos[num155] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; + vector41 -= new Vector2(texture2D15.Width, texture2D15.Height) * npc.scale / 2f; vector41 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); spriteBatch.Draw(texture2D15, vector41, npc.frame, color38, npc.rotation, vector11, npc.scale, spriteEffects, 0f); } } Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * npc.scale / 2f; + vector43 -= new Vector2(texture2D15.Width, texture2D15.Height) * npc.scale / 2f; vector43 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); @@ -171,29 +182,29 @@ namespace CalamityMod.NPCs.Signus public override bool CheckDead() { Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 14); - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.position.X = npc.position.X + (npc.width / 2); + npc.position.Y = npc.position.Y + (npc.height / 2); npc.damage = 300; npc.width = npc.height = 256; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - for (int num621 = 0; num621 < 15; num621++) + npc.position.X = npc.position.X - (npc.width / 2); + npc.position.Y = npc.position.Y - (npc.height / 2); + for (int num621 = 0; num621 < 10; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 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; + Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } Main.dust[num622].noGravity = true; } - for (int num623 = 0; num623 < 30; num623++) + for (int num623 = 0; num623 < 20; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; Main.dust[num624].noGravity = true; } diff --git a/NPCs/SlimeGod/SlimeGod.cs b/NPCs/SlimeGod/SlimeGod.cs index b30c761e24..d70d78c6d5 100644 --- a/NPCs/SlimeGod/SlimeGod.cs +++ b/NPCs/SlimeGod/SlimeGod.cs @@ -35,7 +35,7 @@ namespace CalamityMod.NPCs.SlimeGod aiType = -1; npc.buffImmune[ModContent.BuffType()] = false; npc.knockBackResist = 0f; - animationType = 50; + animationType = NPCID.KingSlime; npc.value = 0f; npc.alpha = 55; npc.HitSound = SoundID.NPCHit1; diff --git a/NPCs/SlimeGod/SlimeGodCore.cs b/NPCs/SlimeGod/SlimeGodCore.cs index a19c87b13d..8670965432 100644 --- a/NPCs/SlimeGod/SlimeGodCore.cs +++ b/NPCs/SlimeGod/SlimeGodCore.cs @@ -3,7 +3,6 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Armor.Vanity; using CalamityMod.Items.LoreItems; using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Furniture.CraftingStations; using CalamityMod.Items.Placeables.Furniture.Trophies; using CalamityMod.Items.Potions; using CalamityMod.Items.TreasureBags; @@ -112,7 +111,7 @@ namespace CalamityMod.NPCs.SlimeGod npc.damage = npc.defDamage; // Enrage based on large slimes - bool flag100 = false; + bool phase2 = lifeRatio < 0.4f; bool hyperMode = true; bool purpleSlimeAlive = false; bool redSlimeAlive = false; @@ -130,7 +129,7 @@ namespace CalamityMod.NPCs.SlimeGod npc.Calamity().newAI[1] = Main.npc[CalamityGlobalNPC.slimeGodPurple].Center.Y; purpleSlimeAlive = true; - flag100 = lifeRatio >= 0.5f; + phase2 = lifeRatio < 0.2f; hyperMode = false; } } @@ -148,7 +147,7 @@ namespace CalamityMod.NPCs.SlimeGod npc.localAI[3] = Main.npc[CalamityGlobalNPC.slimeGodRed].Center.Y; redSlimeAlive = true; - flag100 = lifeRatio >= 0.5f; + phase2 = lifeRatio < 0.2f; hyperMode = false; } } @@ -213,6 +212,7 @@ namespace CalamityMod.NPCs.SlimeGod { npc.Calamity().newAI[2] = npc.life; npc.Calamity().newAI[3] = 1f; + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SlimeGodPossession"), (int)npc.position.X, (int)npc.position.Y); } } @@ -239,11 +239,36 @@ namespace CalamityMod.NPCs.SlimeGod Vector2 goToPosition = goToVector - vectorCenter; npc.velocity = Vector2.Normalize(goToPosition) * (CalamityWorld.bossRushActive ? 24f : 16f); + bool slimeDead = false; + if (goToVector == purpleSlimeVector) + slimeDead = CalamityGlobalNPC.slimeGodPurple < 0 || !Main.npc[CalamityGlobalNPC.slimeGodPurple].active; + else + slimeDead = CalamityGlobalNPC.slimeGodRed < 0 || !Main.npc[CalamityGlobalNPC.slimeGodRed].active; + npc.ai[2] += 1f; - if (npc.ai[2] >= 600f) + if (npc.ai[2] >= 600f || slimeDead) { npc.ai[2] = 0f; npc.Calamity().newAI[3] = 0f; + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SlimeGodExit"), (int)npc.position.X, (int)npc.position.Y); + for (int i = 0; i < 20; i++) + { + int dust = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 4, 0f, 0f, 100, default, 2f); + Main.dust[dust].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[dust].scale = 0.5f; + Main.dust[dust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + } + } + for (int j = 0; j < 30; j++) + { + int dust = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 4, 0f, 0f, 100, default, 3f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 5f; + dust = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 4, 0f, 0f, 100, default, 2f); + Main.dust[dust].velocity *= 2f; + } } return; @@ -253,7 +278,7 @@ namespace CalamityMod.NPCs.SlimeGod } // Spin and shoot orbs - if (!flag100) + if (phase2) { npc.ai[1] += 1f; if (revenge) @@ -339,7 +364,7 @@ namespace CalamityMod.NPCs.SlimeGod if (Main.netMode != NetmodeID.MultiplayerClient) { - if (npc.ai[1] % 10f == 0f && Vector2.Distance(player.Center, vectorCenter) > 160f) + if (npc.ai[1] % 15f == 0f && Vector2.Distance(player.Center, vectorCenter) > 160f) { if (expertMode && Main.rand.NextBool(2)) { @@ -421,7 +446,7 @@ namespace CalamityMod.NPCs.SlimeGod { if (Main.netMode != NetmodeID.MultiplayerClient && Vector2.Distance(player.Center, vectorCenter) > 160f) { - if (npc.ai[1] % 20f == 0f) + if (npc.ai[1] % 40f == 0f) { if (expertMode && Main.rand.NextBool(2)) { @@ -503,14 +528,10 @@ namespace CalamityMod.NPCs.SlimeGod } } - float num1372 = 6f; - if (!flag100 || death) + float num1372 = death ? 14f : revenge ? 11f : expertMode ? 8.5f : 6f; + if (phase2) { - num1372 = 14f; - } - else if (revenge) - { - num1372 = 10f; + num1372 = revenge ? 14f : expertMode ? 12.5f : 11f; } if (CalamityWorld.bossRushActive || player.gravDir == -1f) { @@ -654,7 +675,7 @@ namespace CalamityMod.NPCs.SlimeGod if (!Main.expertMode) { // Materials - DropHelper.DropItemSpray(npc, ModContent.ItemType(), 25, 40); + DropHelper.DropItemSpray(npc, ModContent.ItemType(), 30, 45); // Weapons DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); @@ -664,10 +685,9 @@ namespace CalamityMod.NPCs.SlimeGod DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); // Vanity - DropHelper.DropItemFromSetChance(npc, 7, ModContent.ItemType(), ModContent.ItemType()); + DropHelper.DropItemFromSetChance(npc, 0.142857f, ModContent.ItemType(), ModContent.ItemType()); // Other - DropHelper.DropItem(npc, ModContent.ItemType()); } // Mark the Slime God as dead @@ -683,12 +703,12 @@ namespace CalamityMod.NPCs.SlimeGod } if (npc.life <= 0) { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.position.X = npc.position.X + (npc.width / 2); + npc.position.Y = npc.position.Y + (npc.height / 2); npc.width = 40; npc.height = 40; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); + npc.position.X = npc.position.X - (npc.width / 2); + npc.position.Y = npc.position.Y - (npc.height / 2); for (int num621 = 0; num621 < 40; num621++) { int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 4, 0f, 0f, 100, default, 2f); @@ -696,7 +716,7 @@ namespace CalamityMod.NPCs.SlimeGod if (Main.rand.NextBool(2)) { Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } for (int num623 = 0; num623 < 70; num623++) diff --git a/NPCs/SlimeGod/SlimeGodRun.cs b/NPCs/SlimeGod/SlimeGodRun.cs index e88c0d36d8..4b06132d0a 100644 --- a/NPCs/SlimeGod/SlimeGodRun.cs +++ b/NPCs/SlimeGod/SlimeGodRun.cs @@ -32,7 +32,7 @@ namespace CalamityMod.NPCs.SlimeGod double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.knockBackResist = 0f; - animationType = 50; + animationType = NPCID.KingSlime; npc.buffImmune[ModContent.BuffType()] = false; npc.value = 0f; npc.alpha = 55; diff --git a/NPCs/SlimeGod/SlimeGodRunSplit.cs b/NPCs/SlimeGod/SlimeGodRunSplit.cs index af11c2316b..21203b572b 100644 --- a/NPCs/SlimeGod/SlimeGodRunSplit.cs +++ b/NPCs/SlimeGod/SlimeGodRunSplit.cs @@ -33,7 +33,7 @@ namespace CalamityMod.NPCs.SlimeGod npc.defense = 10; npc.knockBackResist = 0f; npc.buffImmune[ModContent.BuffType()] = false; - animationType = 50; + animationType = NPCID.KingSlime; npc.value = Item.buyPrice(0, 1, 0, 0); npc.alpha = 55; npc.lavaImmune = false; diff --git a/NPCs/SlimeGod/SlimeGodSplit.cs b/NPCs/SlimeGod/SlimeGodSplit.cs index 6f95f4c496..c295f07f12 100644 --- a/NPCs/SlimeGod/SlimeGodSplit.cs +++ b/NPCs/SlimeGod/SlimeGodSplit.cs @@ -35,7 +35,7 @@ namespace CalamityMod.NPCs.SlimeGod aiType = -1; npc.knockBackResist = 0f; npc.buffImmune[ModContent.BuffType()] = false; - animationType = 50; + animationType = NPCID.KingSlime; npc.value = Item.buyPrice(0, 1, 0, 0); npc.alpha = 55; npc.lavaImmune = false; diff --git a/NPCs/SlimeGod/SlimeSpawnCorrupt.cs b/NPCs/SlimeGod/SlimeSpawnCorrupt.cs index 7a1d77fc94..53c8d29f7a 100644 --- a/NPCs/SlimeGod/SlimeSpawnCorrupt.cs +++ b/NPCs/SlimeGod/SlimeSpawnCorrupt.cs @@ -35,7 +35,7 @@ namespace CalamityMod.NPCs.SlimeGod npc.canGhostHeal = false; npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath1; - npc.buffImmune[24] = true; + npc.buffImmune[BuffID.OnFire] = true; } public override bool PreNPCLoot() diff --git a/NPCs/SlimeGod/SlimeSpawnCorrupt2.cs b/NPCs/SlimeGod/SlimeSpawnCorrupt2.cs index d1d6cf5c9f..4050e653b9 100644 --- a/NPCs/SlimeGod/SlimeSpawnCorrupt2.cs +++ b/NPCs/SlimeGod/SlimeSpawnCorrupt2.cs @@ -26,7 +26,7 @@ namespace CalamityMod.NPCs.SlimeGod npc.lifeMax = 50000; } npc.knockBackResist = 0f; - animationType = 81; + animationType = NPCID.CorruptSlime; npc.alpha = 55; npc.lavaImmune = false; npc.noGravity = false; @@ -34,7 +34,7 @@ namespace CalamityMod.NPCs.SlimeGod npc.canGhostHeal = false; npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath1; - npc.buffImmune[24] = true; + npc.buffImmune[BuffID.OnFire] = true; } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/SlimeGod/SlimeSpawnCrimson.cs b/NPCs/SlimeGod/SlimeSpawnCrimson.cs index b32e6a5628..fbd905a275 100644 --- a/NPCs/SlimeGod/SlimeSpawnCrimson.cs +++ b/NPCs/SlimeGod/SlimeSpawnCrimson.cs @@ -26,7 +26,7 @@ namespace CalamityMod.NPCs.SlimeGod npc.lifeMax = 100000; } npc.knockBackResist = 0f; - animationType = 81; + animationType = NPCID.CorruptSlime; npc.alpha = 55; npc.lavaImmune = false; npc.noGravity = false; @@ -34,7 +34,7 @@ namespace CalamityMod.NPCs.SlimeGod npc.canGhostHeal = false; npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath1; - npc.buffImmune[24] = true; + npc.buffImmune[BuffID.OnFire] = true; } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/SlimeGod/SlimeSpawnCrimson2.cs b/NPCs/SlimeGod/SlimeSpawnCrimson2.cs index cf24a872bd..79e8bbf526 100644 --- a/NPCs/SlimeGod/SlimeSpawnCrimson2.cs +++ b/NPCs/SlimeGod/SlimeSpawnCrimson2.cs @@ -31,7 +31,7 @@ namespace CalamityMod.NPCs.SlimeGod npc.lifeMax = 120000; } npc.knockBackResist = 0f; - animationType = 81; + animationType = NPCID.CorruptSlime; npc.alpha = 55; npc.lavaImmune = false; npc.noGravity = false; @@ -39,7 +39,7 @@ namespace CalamityMod.NPCs.SlimeGod npc.canGhostHeal = false; npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath1; - npc.buffImmune[24] = true; + npc.buffImmune[BuffID.OnFire] = true; } public override void AI() diff --git a/NPCs/StormWeaver/StasisProbe.cs b/NPCs/StormWeaver/StasisProbe.cs index 1512bf4556..55a130d888 100644 --- a/NPCs/StormWeaver/StasisProbe.cs +++ b/NPCs/StormWeaver/StasisProbe.cs @@ -1,3 +1,4 @@ +using CalamityMod.Dusts; using CalamityMod.World; using Microsoft.Xna.Framework; using System; @@ -34,12 +35,15 @@ namespace CalamityMod.NPCs.StormWeaver npc.canGhostHeal = false; npc.HitSound = SoundID.NPCHit4; npc.DeathSound = SoundID.NPCDeath14; - npc.buffImmune[24] = true; + npc.buffImmune[BuffID.OnFire] = true; } public override void AI() { - bool revenge = CalamityWorld.revenge; + // Setting this in SetDefaults will disable expert mode scaling, so put it here instead + npc.damage = 0; + + bool revenge = CalamityWorld.revenge; if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) { npc.TargetClosest(true); @@ -129,7 +133,7 @@ namespace CalamityMod.NPCs.StormWeaver if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) { int num8 = Main.expertMode ? 50 : 60; - int num9 = 84; + int num9 = ProjectileID.PinkLaser; int beam = Projectile.NewProjectile(vector.X, vector.Y, num4, num5, num9, num8, 0f, Main.myPlayer, 0f, 0f); Main.projectile[beam].timeLeft = 200; } @@ -217,7 +221,7 @@ namespace CalamityMod.NPCs.StormWeaver npc.position.Y = npc.position.Y - (float)(npc.height / 2); for (int num621 = 0; num621 < 5; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -227,49 +231,14 @@ namespace CalamityMod.NPCs.StormWeaver } for (int num623 = 0; num623 < 10; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/StasisProbe1"),1f); - for (int num625 = 0; num625 < 1; num625++) - { - float scaleFactor10 = 0.33f; - if (num625 == 1) - { - scaleFactor10 = 0.66f; - } - if (num625 == 2) - { - scaleFactor10 = 1f; - } - int num626 = Gore.NewGore(new Vector2(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13AB6_cp_0 = Main.gore[num626]; - expr_13AB6_cp_0.velocity.X += 1f; - Gore expr_13AD6_cp_0 = Main.gore[num626]; - expr_13AD6_cp_0.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13B79_cp_0 = Main.gore[num626]; - expr_13B79_cp_0.velocity.X -= 1f; - Gore expr_13B99_cp_0 = Main.gore[num626]; - expr_13B99_cp_0.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13C3C_cp_0 = Main.gore[num626]; - expr_13C3C_cp_0.velocity.X += 1f; - Gore expr_13C5C_cp_0 = Main.gore[num626]; - expr_13C5C_cp_0.velocity.Y -= 1f; - num626 = Gore.NewGore(new Vector2(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13CFF_cp_0 = Main.gore[num626]; - expr_13CFF_cp_0.velocity.X -= 1f; - Gore expr_13D1F_cp_0 = Main.gore[num626]; - expr_13D1F_cp_0.velocity.Y -= 1f; - } + CalamityUtils.ExplosionGores(npc.Center, 1); } } diff --git a/NPCs/StormWeaver/StasisProbeNaked.cs b/NPCs/StormWeaver/StasisProbeNaked.cs index 8bc5f31d93..aeb40c143d 100644 --- a/NPCs/StormWeaver/StasisProbeNaked.cs +++ b/NPCs/StormWeaver/StasisProbeNaked.cs @@ -1,3 +1,4 @@ +using CalamityMod.Dusts; using CalamityMod.World; using Microsoft.Xna.Framework; using System; @@ -34,12 +35,15 @@ namespace CalamityMod.NPCs.StormWeaver npc.canGhostHeal = false; npc.HitSound = SoundID.NPCHit13; npc.DeathSound = SoundID.NPCDeath19; - npc.buffImmune[24] = true; + npc.buffImmune[BuffID.OnFire] = true; } public override void AI() { - bool revenge = CalamityWorld.revenge; + // Setting this in SetDefaults will disable expert mode scaling, so put it here instead + npc.damage = 0; + + bool revenge = CalamityWorld.revenge; if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) { npc.TargetClosest(true); @@ -123,13 +127,13 @@ namespace CalamityMod.NPCs.StormWeaver { npc.localAI[0] = 0f; } - if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] >= 180f) + if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] >= 120f) { npc.localAI[0] = 0f; if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) { int num8 = Main.expertMode ? 50 : 60; - int num9 = 84; + int num9 = ProjectileID.PinkLaser; int beam = Projectile.NewProjectile(vector.X, vector.Y, num4, num5, num9, num8, 0f, Main.myPlayer, 0f, 0f); Main.projectile[beam].timeLeft = 200; } @@ -170,11 +174,11 @@ namespace CalamityMod.NPCs.StormWeaver { npc.netUpdate = true; npc.velocity.Y = npc.oldVelocity.Y * -num12; - if (npc.velocity.Y > 0f && (double)npc.velocity.Y < 1.5) + if (npc.velocity.Y > 0f && npc.velocity.Y < 1.5f) { npc.velocity.Y = 2f; } - if (npc.velocity.Y < 0f && (double)npc.velocity.Y > -1.5) + if (npc.velocity.Y < 0f && npc.velocity.Y > -1.5f) { npc.velocity.Y = -2f; } @@ -185,12 +189,12 @@ namespace CalamityMod.NPCs.StormWeaver { if (Math.Abs(npc.velocity.X) < 12f) { - npc.velocity.X = npc.velocity.X * 1.05f; + npc.velocity.X *= 1.05f; } } else { - npc.velocity.X = npc.velocity.X * 0.9f; + npc.velocity.X *= 0.9f; } } if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) @@ -217,7 +221,7 @@ namespace CalamityMod.NPCs.StormWeaver npc.position.Y = npc.position.Y - (float)(npc.height / 2); for (int num621 = 0; num621 < 5; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -227,49 +231,14 @@ namespace CalamityMod.NPCs.StormWeaver } for (int num623 = 0; num623 < 10; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/StasisProbeNaked1"), 1f); - for (int num625 = 0; num625 < 1; num625++) - { - float scaleFactor10 = 0.33f; - if (num625 == 1) - { - scaleFactor10 = 0.66f; - } - if (num625 == 2) - { - scaleFactor10 = 1f; - } - int num626 = Gore.NewGore(new Vector2(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13AB6_cp_0 = Main.gore[num626]; - expr_13AB6_cp_0.velocity.X += 1f; - Gore expr_13AD6_cp_0 = Main.gore[num626]; - expr_13AD6_cp_0.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13B79_cp_0 = Main.gore[num626]; - expr_13B79_cp_0.velocity.X -= 1f; - Gore expr_13B99_cp_0 = Main.gore[num626]; - expr_13B99_cp_0.velocity.Y += 1f; - num626 = Gore.NewGore(new Vector2(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13C3C_cp_0 = Main.gore[num626]; - expr_13C3C_cp_0.velocity.X += 1f; - Gore expr_13C5C_cp_0 = Main.gore[num626]; - expr_13C5C_cp_0.velocity.Y -= 1f; - num626 = Gore.NewGore(new Vector2(npc.position.X + (float)(npc.width / 2) - 24f, npc.position.Y + (float)(npc.height / 2) - 24f), default, Main.rand.Next(61, 64), 1f); - Main.gore[num626].velocity *= scaleFactor10; - Gore expr_13CFF_cp_0 = Main.gore[num626]; - expr_13CFF_cp_0.velocity.X -= 1f; - Gore expr_13D1F_cp_0 = Main.gore[num626]; - expr_13D1F_cp_0.velocity.Y -= 1f; - } + CalamityUtils.ExplosionGores(npc.Center, 1); } } diff --git a/NPCs/StormWeaver/StormWeaverBody.cs b/NPCs/StormWeaver/StormWeaverBody.cs index 97b112e3a5..948cfc5591 100644 --- a/NPCs/StormWeaver/StormWeaverBody.cs +++ b/NPCs/StormWeaver/StormWeaverBody.cs @@ -25,7 +25,7 @@ namespace CalamityMod.NPCs.StormWeaver CalamityGlobalNPC global = npc.Calamity(); global.DR = 0.999999f; global.unbreakableDR = true; - bool notDoGFight = CalamityWorld.DoGSecondStageCountdown <= 0; + bool notDoGFight = CalamityWorld.DoGSecondStageCountdown <= 0 || !CalamityWorld.downedSentinel2; npc.LifeMaxNERB(notDoGFight ? 100000 : 20000, notDoGFight ? 100000 : 20000, 170000); Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); if (calamityModMusic != null) @@ -68,7 +68,7 @@ namespace CalamityMod.NPCs.StormWeaver public override void AI() { - if (npc.defense < 99999 && CalamityWorld.DoGSecondStageCountdown <= 0) + if (npc.defense < 99999 && (CalamityWorld.DoGSecondStageCountdown <= 0 || !CalamityWorld.downedSentinel2)) npc.defense = 99999; else npc.defense = 0; diff --git a/NPCs/StormWeaver/StormWeaverBodyNaked.cs b/NPCs/StormWeaver/StormWeaverBodyNaked.cs index 445d0a20f3..b3cb4bd850 100644 --- a/NPCs/StormWeaver/StormWeaverBodyNaked.cs +++ b/NPCs/StormWeaver/StormWeaverBodyNaked.cs @@ -1,4 +1,5 @@ -using CalamityMod.World; +using CalamityMod.Dusts; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System.IO; @@ -16,7 +17,8 @@ namespace CalamityMod.NPCs.StormWeaver public override void SetStaticDefaults() { DisplayName.SetDefault("Storm Weaver"); - } + NPCID.Sets.TrailingMode[npc.type] = 1; + } public override void SetDefaults() { @@ -25,7 +27,7 @@ namespace CalamityMod.NPCs.StormWeaver npc.width = 40; npc.height = 40; npc.lifeMax = 100000; - bool notDoGFight = CalamityWorld.DoGSecondStageCountdown <= 0; + bool notDoGFight = CalamityWorld.DoGSecondStageCountdown <= 0 || !CalamityWorld.downedSentinel2; npc.LifeMaxNERB(notDoGFight ? 900000 : 150000, notDoGFight ? 900000 : 150000, 3500000); Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); if (calamityModMusic != null) @@ -53,8 +55,6 @@ namespace CalamityMod.NPCs.StormWeaver npc.HitSound = SoundID.NPCHit13; npc.DeathSound = SoundID.NPCDeath13; npc.netAlways = true; - NPCID.Sets.TrailCacheLength[npc.type] = 8; - NPCID.Sets.TrailingMode[npc.type] = 1; for (int k = 0; k < npc.buffImmune.Length; k++) { npc.buffImmune[k] = true; @@ -176,46 +176,55 @@ namespace CalamityMod.NPCs.StormWeaver } } - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - Color color24 = npc.GetAlpha(drawColor); - Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); - Texture2D texture2D3 = Main.npcTexture[npc.type]; - int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; - int y3 = num156 * (int)npc.frameCounter; - Rectangle rectangle = new Rectangle(0, y3, texture2D3.Width, num156); - Vector2 origin2 = rectangle.Size() / 2f; - int num157 = 8; - int num158 = 2; - int num159 = 1; - float num160 = 0f; - int num161 = num159; - while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)) && CalamityConfig.Instance.Afterimages) - { - Color color26 = npc.GetAlpha(color25); - { - goto IL_6899; - } - IL_6881: - num161 += num158; - continue; - IL_6899: - float num164 = (float)(num157 - num161); - if (num158 < 0) - { - num164 = (float)(num159 - num161); - } - color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); - Vector2 value4 = npc.oldPos[num161]; - float num165 = npc.rotation; - Main.spriteBatch.Draw(texture2D3, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); - goto IL_6881; - } - var something = npc.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - spriteBatch.Draw(texture2D3, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, something, 0); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (npc.spriteDirection == 1) + spriteEffects = SpriteEffects.FlipHorizontally; + + Texture2D texture2D15 = Main.npcTexture[npc.type]; + Vector2 vector11 = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / 2); + Color color36 = Color.White; + float amount9 = 0.5f; + int num153 = 5; + + if (CalamityConfig.Instance.Afterimages) + { + for (int num155 = 1; num155 < num153; num155 += 2) + { + Color color38 = lightColor; + if (Main.npc[(int)npc.ai[2]].Calamity().newAI[0] > 280f && (CalamityWorld.revenge || CalamityWorld.bossRushActive)) + { + byte newColor = (byte)MathHelper.Clamp((Main.npc[(int)npc.ai[2]].Calamity().newAI[0] - 280f) / 120f * 255f, 0f, 255f); + color38.R = 0; + color38.G = newColor; + color38.B = newColor; + } + color38 = Color.Lerp(color38, color36, amount9); + color38 = npc.GetAlpha(color38); + color38 *= (num153 - num155) / 15f; + Vector2 vector41 = npc.oldPos[num155] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; + vector41 -= new Vector2(texture2D15.Width, texture2D15.Height) * npc.scale / 2f; + vector41 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); + spriteBatch.Draw(texture2D15, vector41, npc.frame, color38, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + } + } + + Vector2 vector43 = npc.Center - Main.screenPosition; + vector43 -= new Vector2(texture2D15.Width, texture2D15.Height) * npc.scale / 2f; + vector43 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); + Color color = npc.GetAlpha(lightColor); + if (Main.npc[(int)npc.ai[2]].Calamity().newAI[0] > 280f && (CalamityWorld.revenge || CalamityWorld.bossRushActive)) + { + byte newColor = (byte)MathHelper.Clamp((Main.npc[(int)npc.ai[2]].Calamity().newAI[0] - 280f) / 120f * 255f, 0f, 255f); + color.R = 0; + color.G = newColor; + color.B = newColor; + } + spriteBatch.Draw(texture2D15, vector43, npc.frame, color, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + + return false; + } public override bool CanHitPlayer(Player target, ref int cooldownSlot) { @@ -223,7 +232,13 @@ namespace CalamityMod.NPCs.StormWeaver return true; } - public override bool CheckActive() + public override void OnHitPlayer(Player player, int damage, bool crit) + { + int buffDuration = Main.npc[(int)npc.ai[2]].Calamity().newAI[0] >= 400f ? 200 : 60; + player.AddBuff(BuffID.Electrified, buffDuration, true); + } + + public override bool CheckActive() { return false; } @@ -240,28 +255,28 @@ namespace CalamityMod.NPCs.StormWeaver Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SWNudeBody1"), 1f); Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SWNudeBody2"), 1f); Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SWNudeBody3"), 1f); - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.position.X = npc.position.X + (npc.width / 2); + npc.position.Y = npc.position.Y + (npc.height / 2); npc.width = 30; npc.height = 30; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); + npc.position.X = npc.position.X - (npc.width / 2); + npc.position.Y = npc.position.Y - (npc.height / 2); for (int num621 = 0; num621 < 20; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 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; + Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } for (int num623 = 0; num623 < 40; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } @@ -271,7 +286,7 @@ namespace CalamityMod.NPCs.StormWeaver if (npc.life > 0 && Main.netMode != NetmodeID.MultiplayerClient && spawn <= 0) { spawn = 14; - int num660 = NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2)), (int)(npc.position.Y + (float)npc.height), ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); + int num660 = NPC.NewNPC((int)(npc.position.X + (npc.width / 2)), (int)(npc.position.Y + npc.height), ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); if (Main.netMode == NetmodeID.Server) { NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num660, 0f, 0f, 0f, 0, 0, 0); diff --git a/NPCs/StormWeaver/StormWeaverHead.cs b/NPCs/StormWeaver/StormWeaverHead.cs index adb60026cc..2dc24a65ba 100644 --- a/NPCs/StormWeaver/StormWeaverHead.cs +++ b/NPCs/StormWeaver/StormWeaverHead.cs @@ -1,4 +1,5 @@ -using CalamityMod.World; +using CalamityMod.Dusts; +using CalamityMod.World; using Microsoft.Xna.Framework; using System; using System.IO; @@ -34,7 +35,7 @@ namespace CalamityMod.NPCs.StormWeaver CalamityGlobalNPC global = npc.Calamity(); global.DR = 0.999999f; global.unbreakableDR = true; - bool notDoGFight = CalamityWorld.DoGSecondStageCountdown <= 0; + bool notDoGFight = CalamityWorld.DoGSecondStageCountdown <= 0 || !CalamityWorld.downedSentinel2; npc.LifeMaxNERB(notDoGFight ? 100000 : 20000, notDoGFight ? 100000 : 20000, 170000); Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); if (calamityModMusic != null) @@ -82,7 +83,7 @@ namespace CalamityMod.NPCs.StormWeaver { bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; - if (npc.defense < 99999 && CalamityWorld.DoGSecondStageCountdown <= 0) + if (npc.defense < 99999 && (CalamityWorld.DoGSecondStageCountdown <= 0 || !CalamityWorld.downedSentinel2)) { npc.defense = 99999; } @@ -154,8 +155,8 @@ namespace CalamityMod.NPCs.StormWeaver npc.TargetClosest(true); npc.netUpdate = true; float xPos = Main.rand.NextBool(2) ? npc.position.X + 300f : npc.position.X - 300f; - Vector2 vector2 = new Vector2(xPos, npc.position.Y + Main.rand.Next(-300, 301)); - Projectile.NewProjectile(vector2.X, vector2.Y, 0f, 0f, 465, damage, 0f, Main.myPlayer, 0f, 0f); + Vector2 spawnPos = new Vector2(xPos, npc.position.Y + Main.rand.Next(-300, 301)); + Projectile.NewProjectile(spawnPos, Vector2.Zero, ProjectileID.CultistBossLightningOrb, damage, 0f, Main.myPlayer, 0f, 0f); } } @@ -182,13 +183,13 @@ namespace CalamityMod.NPCs.StormWeaver int BoltProjectiles = 1; for (int i = 0; i < BoltProjectiles; i++) { - Vector2 spawn2 = baseSpawn; - spawn2.X = spawn2.X + i * 30 - (BoltProjectiles * 15); + Vector2 source = baseSpawn; + source.X += i * 30 - (BoltProjectiles * 15); Vector2 velocity = baseVelocity.RotatedBy(MathHelper.ToRadians(-BoltAngleSpread / 2 + (BoltAngleSpread * i / (float)BoltProjectiles))); velocity.X = velocity.X + 3 * Main.rand.NextFloat() - 1.5f; - Vector2 vector94 = Main.player[npc.target].Center - spawn2; + Vector2 vector94 = Main.player[npc.target].Center - source; float ai = (float)Main.rand.Next(100); - Projectile.NewProjectile(spawn2.X, spawn2.Y, velocity.X, velocity.Y, 466, damage, 0f, Main.myPlayer, vector94.ToRotation(), ai); + Projectile.NewProjectile(source, velocity, ProjectileID.CultistBossLightningOrbArc, damage, 0f, Main.myPlayer, vector94.ToRotation(), ai); } } } @@ -211,7 +212,7 @@ namespace CalamityMod.NPCs.StormWeaver netMessage.Write(CalamityWorld.DoGSecondStageCountdown); netMessage.Send(); } - for (int num957 = 0; num957 < 200; num957++) + for (int num957 = 0; num957 < Main.maxNPCs; num957++) { if (Main.npc[num957].active && (Main.npc[num957].type == ModContent.NPCType() || Main.npc[num957].type == ModContent.NPCType() @@ -232,7 +233,7 @@ namespace CalamityMod.NPCs.StormWeaver netMessage.Write(CalamityWorld.DoGSecondStageCountdown); netMessage.Send(); } - for (int num957 = 0; num957 < 200; num957++) + for (int num957 = 0; num957 < Main.maxNPCs; num957++) { if (Main.npc[num957].active && (Main.npc[num957].type == ModContent.NPCType() || Main.npc[num957].type == ModContent.NPCType() @@ -301,12 +302,6 @@ namespace CalamityMod.NPCs.StormWeaver { num188 = revenge ? 11f : 10f; num189 = revenge ? 0.31f : 0.28f; - - if (!Main.player[npc.target].ZoneSkyHeight && CalamityWorld.DoGSecondStageCountdown <= 0 && expertMode) - { - num188 *= 2f; - num189 *= 2f; - } } float num48 = num188 * 1.3f; float num49 = num188 * 0.7f; @@ -326,7 +321,7 @@ namespace CalamityMod.NPCs.StormWeaver } if (num42 > 0) { - for (int num51 = 0; num51 < 200; num51++) + for (int num51 = 0; num51 < Main.maxNPCs; num51++) { if (Main.npc[num51].active && Main.npc[num51].type == npc.type && num51 != npc.whoAmI) { @@ -343,7 +338,7 @@ namespace CalamityMod.NPCs.StormWeaver } else { - for (int num52 = 0; num52 < 200; num52++) + for (int num52 = 0; num52 < Main.maxNPCs; num52++) { if (Main.npc[num52].active && Main.npc[num52].type == npc.type && num52 != npc.whoAmI) { @@ -464,7 +459,7 @@ namespace CalamityMod.NPCs.StormWeaver } } } - npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + MathHelper.PiOver2; } public override bool CanHitPlayer(Player target, ref int cooldownSlot) @@ -482,7 +477,7 @@ namespace CalamityMod.NPCs.StormWeaver { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 173, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { @@ -495,7 +490,7 @@ namespace CalamityMod.NPCs.StormWeaver npc.position.Y = npc.position.Y - (float)(npc.height / 2); for (int num621 = 0; num621 < 20; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -505,10 +500,10 @@ namespace CalamityMod.NPCs.StormWeaver } for (int num623 = 0; num623 < 40; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } @@ -516,10 +511,9 @@ namespace CalamityMod.NPCs.StormWeaver public override bool CheckDead() { - for (int num957 = 0; num957 < 200; num957++) + for (int num957 = 0; num957 < Main.maxNPCs; num957++) { - if (Main.npc[num957].active && (Main.npc[num957].type == ModContent.NPCType() - || Main.npc[num957].type == ModContent.NPCType())) + if (Main.npc[num957].active && (Main.npc[num957].type == ModContent.NPCType() || Main.npc[num957].type == ModContent.NPCType())) { Main.npc[num957].life = 0; } diff --git a/NPCs/StormWeaver/StormWeaverHeadNaked.cs b/NPCs/StormWeaver/StormWeaverHeadNaked.cs index 78a8e17226..2962df3033 100644 --- a/NPCs/StormWeaver/StormWeaverHeadNaked.cs +++ b/NPCs/StormWeaver/StormWeaverHeadNaked.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Armor.Vanity; +using CalamityMod.Dusts; +using CalamityMod.Items.Armor.Vanity; using CalamityMod.Items.LoreItems; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Furniture.Trophies; @@ -17,7 +18,6 @@ namespace CalamityMod.NPCs.StormWeaver public class StormWeaverHeadNaked : ModNPC { private const float BoltAngleSpread = 280; - private int BoltCountdown = 0; private const float speed = 13f; private const float turnSpeed = 0.35f; private bool tail = false; @@ -28,7 +28,8 @@ namespace CalamityMod.NPCs.StormWeaver public override void SetStaticDefaults() { DisplayName.SetDefault("Storm Weaver"); - } + NPCID.Sets.TrailingMode[npc.type] = 1; + } public override void SetDefaults() { @@ -36,7 +37,7 @@ namespace CalamityMod.NPCs.StormWeaver npc.npcSlots = 5f; npc.width = 74; npc.height = 74; - bool notDoGFight = CalamityWorld.DoGSecondStageCountdown <= 0; + bool notDoGFight = CalamityWorld.DoGSecondStageCountdown <= 0 || !CalamityWorld.downedSentinel2; npc.LifeMaxNERB(notDoGFight ? 900000 : 150000, notDoGFight ? 900000 : 150000, 3500000); Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); if (calamityModMusic != null) @@ -64,8 +65,6 @@ namespace CalamityMod.NPCs.StormWeaver npc.HitSound = SoundID.NPCHit13; npc.DeathSound = SoundID.NPCDeath13; npc.netAlways = true; - NPCID.Sets.TrailCacheLength[npc.type] = 8; - NPCID.Sets.TrailingMode[npc.type] = 1; for (int k = 0; k < npc.buffImmune.Length; k++) { npc.buffImmune[k] = true; @@ -74,20 +73,24 @@ namespace CalamityMod.NPCs.StormWeaver public override void SendExtraAI(BinaryWriter writer) { - writer.Write(BoltCountdown); writer.Write(invinceTime); writer.Write(npc.dontTakeDamage); + writer.Write(npc.localAI[1]); + writer.Write(npc.localAI[2]); } public override void ReceiveExtraAI(BinaryReader reader) { - BoltCountdown = reader.ReadInt32(); invinceTime = reader.ReadInt32(); npc.dontTakeDamage = reader.ReadBoolean(); + npc.localAI[1] = reader.ReadSingle(); + npc.localAI[2] = reader.ReadSingle(); } public override void AI() { + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + bool death = CalamityWorld.death || CalamityWorld.bossRushActive; bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; @@ -111,8 +114,9 @@ namespace CalamityMod.NPCs.StormWeaver double lifeRatio = npc.life / (double)npc.lifeMax; int lifePercentage = (int)(100.0 * lifeRatio); + int projectileDamage = expertMode ? 62 : 75; - int BoltProjectiles = 2; + int BoltProjectiles = 2; if (lifePercentage < 33 || death) { BoltProjectiles = 4; @@ -176,7 +180,6 @@ namespace CalamityMod.NPCs.StormWeaver tail = true; } - int damage = expertMode ? 62 : 75; if (expertMode) { npc.localAI[0] += 1f; @@ -186,43 +189,10 @@ namespace CalamityMod.NPCs.StormWeaver npc.TargetClosest(true); npc.netUpdate = true; float xPos = Main.rand.NextBool(2) ? npc.position.X + 300f : npc.position.X - 300f; - Vector2 vector2 = new Vector2(xPos, npc.position.Y + Main.rand.Next(-300, 301)); - Projectile.NewProjectile(vector2.X, vector2.Y, 0f, 0f, 465, damage, 0f, Main.myPlayer, 0f, 0f); + Vector2 spawnPos = new Vector2(xPos, npc.position.Y + Main.rand.Next(-300, 301)); + Projectile.NewProjectile(spawnPos, Vector2.Zero, ProjectileID.CultistBossLightningOrb, projectileDamage, 0f, Main.myPlayer, 0f, 0f); } } - - if (BoltCountdown == 0) - { - BoltCountdown = 600; - } - if (BoltCountdown > 0) - { - BoltCountdown--; - if (BoltCountdown == 0) - { - int speed2 = revenge ? 8 : 7; - if (npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { - speed2 += 1; - } - float spawnX2 = Main.rand.Next(2001) - 1000f + Main.player[npc.target].Center.X; - float spawnY2 = -1000f + Main.player[npc.target].Center.Y; - Vector2 baseSpawn = new Vector2(spawnX2, spawnY2); - Vector2 baseVelocity = Main.player[npc.target].Center - baseSpawn; - baseVelocity.Normalize(); - baseVelocity *= speed2; - for (int i = 0; i < BoltProjectiles; i++) - { - Vector2 spawn2 = baseSpawn; - spawn2.X = spawn2.X + i * 30 - (BoltProjectiles * 15); - Vector2 velocity = baseVelocity.RotatedBy(MathHelper.ToRadians(-BoltAngleSpread / 2 + (BoltAngleSpread * i / BoltProjectiles))); - velocity.X = velocity.X + 3 * Main.rand.NextFloat() - 1.5f; - Vector2 vector94 = Main.player[npc.target].Center - spawn2; - float ai = Main.rand.Next(100); - Projectile.NewProjectile(spawn2.X, spawn2.Y, velocity.X, velocity.Y, 466, damage, 0f, Main.myPlayer, vector94.ToRotation(), ai); - } - } - } } if (Main.player[npc.target].dead && npc.life > 0) @@ -245,7 +215,7 @@ namespace CalamityMod.NPCs.StormWeaver } for (int num957 = 0; num957 < 200; num957++) { - if ( Main.npc[num957].active && (Main.npc[num957].type == ModContent.NPCType() + if (Main.npc[num957].active && (Main.npc[num957].type == ModContent.NPCType() || Main.npc[num957].type == ModContent.NPCType() || Main.npc[num957].type == ModContent.NPCType())) { @@ -296,11 +266,62 @@ namespace CalamityMod.NPCs.StormWeaver float num188 = revenge ? 13f : 12f; float num189 = revenge ? 0.31f : 0.28f; - if (!Main.player[npc.target].ZoneSkyHeight && CalamityWorld.DoGSecondStageCountdown <= 0 && expertMode) - { - num188 *= 2f; - num189 *= 2f; - } + calamityGlobalNPC.newAI[0] += 1f; + if (calamityGlobalNPC.newAI[0] >= 400f) + { + if (npc.localAI[1] == 0f) + npc.localAI[1] = 1f; + + if (calamityGlobalNPC.newAI[0] >= 500f) + { + npc.localAI[1] = 0f; + calamityGlobalNPC.newAI[0] = 0f; + } + + if (revenge) + { + if (npc.localAI[1] == 2f) + { + num188 += Vector2.Distance(Main.player[npc.target].Center, npc.Center) * 0.01f * (1f - (float)lifeRatio); + num189 += Vector2.Distance(Main.player[npc.target].Center, npc.Center) * 0.0001f * (1f - (float)lifeRatio); + num188 *= 2f; + num189 *= 0.75f; + + float stopChargeDistance = 800f * npc.localAI[2]; + if (stopChargeDistance < 0) + { + if (npc.Center.X < Main.player[npc.target].Center.X + stopChargeDistance) + { + npc.localAI[1] = 0f; + calamityGlobalNPC.newAI[0] = 0f; + } + } + else + { + if (npc.Center.X > Main.player[npc.target].Center.X + stopChargeDistance) + { + npc.localAI[1] = 0f; + calamityGlobalNPC.newAI[0] = 0f; + } + } + } + + int dustAmt = 5; + for (int num1474 = 0; num1474 < dustAmt; num1474++) + { + Vector2 vector171 = Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f; + vector171 = vector171.RotatedBy((num1474 - (dustAmt / 2 - 1)) * (double)MathHelper.Pi / (float)dustAmt) + npc.Center; + Vector2 value18 = ((float)(Main.rand.NextDouble() * MathHelper.Pi) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); + int num1475 = Dust.NewDust(vector171 + value18, 0, 0, 206, value18.X, value18.Y, 100, default, 3f); + Main.dust[num1475].noGravity = true; + Main.dust[num1475].noLight = true; + Main.dust[num1475].velocity /= 4f; + Main.dust[num1475].velocity -= npc.velocity; + } + } + } + else if (revenge) + calamityGlobalNPC.newAI[0] += death ? 2f : 2f * (float)(1D - lifeRatio); float num48 = num188 * 1.3f; float num49 = num188 * 0.7f; @@ -318,8 +339,50 @@ namespace CalamityMod.NPCs.StormWeaver npc.velocity *= num49; } } - - num191 = (int)(num191 / 16f) * 16; + + if (npc.localAI[1] == 1f) + { + npc.localAI[1] = 2f; + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/LightningStrike"), (int)Main.player[npc.target].Center.X, (int)Main.player[npc.target].Center.Y); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int speed2 = revenge ? 8 : 7; + if (npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) + { + speed2 += 1; + } + float spawnX2 = Main.rand.Next(2001) - 1000f + Main.player[npc.target].Center.X; + float spawnY2 = -1000f + Main.player[npc.target].Center.Y; + Vector2 baseSpawn = new Vector2(spawnX2, spawnY2); + Vector2 baseVelocity = Main.player[npc.target].Center - baseSpawn; + baseVelocity.Normalize(); + baseVelocity *= speed2; + for (int i = 0; i < BoltProjectiles; i++) + { + Vector2 source = baseSpawn; + source.X += i * 30 - (BoltProjectiles * 15); + Vector2 velocity = baseVelocity.RotatedBy(MathHelper.ToRadians(-BoltAngleSpread / 2 + (BoltAngleSpread * i / BoltProjectiles))); + velocity.X = velocity.X + 3 * Main.rand.NextFloat() - 1.5f; + Vector2 vector94 = Main.player[npc.target].Center - source; + float ai = Main.rand.Next(100); + Projectile.NewProjectile(source, velocity, ProjectileID.CultistBossLightningOrbArc, projectileDamage, 0f, Main.myPlayer, vector94.ToRotation(), ai); + } + } + + if (revenge) + npc.velocity = Vector2.Normalize(Main.player[npc.target].Center - npc.Center) * (num188 + Vector2.Distance(Main.player[npc.target].Center, npc.Center) * 0.01f * (1f - (float)lifeRatio)) * 2f; + + float chargeDirection = 0; + if (npc.velocity.X < 0f) + chargeDirection = -1f; + else if (npc.velocity.X > 0f) + chargeDirection = 1f; + + npc.localAI[2] = chargeDirection; + } + + num191 = (int)(num191 / 16f) * 16; num192 = (int)(num192 / 16f) * 16; vector18.X = (int)(vector18.X / 16f) * 16; vector18.Y = (int)(vector18.Y / 16f) * 16; @@ -428,44 +491,53 @@ namespace CalamityMod.NPCs.StormWeaver npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) + 1.57f; } - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - SpriteEffects spriteEffects = SpriteEffects.None; - Color color24 = npc.GetAlpha(drawColor); - Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); - Texture2D texture2D3 = Main.npcTexture[npc.type]; - int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; - int y3 = num156 * (int)npc.frameCounter; - Rectangle rectangle = new Rectangle(0, y3, texture2D3.Width, num156); - Vector2 origin2 = rectangle.Size() / 2f; - int num157 = 8; - int num158 = 2; - int num159 = 1; - float num160 = 0f; - int num161 = num159; - while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)) && CalamityConfig.Instance.Afterimages) - { - Color color26 = npc.GetAlpha(color25); - { - goto IL_6899; - } - IL_6881: - num161 += num158; - continue; - IL_6899: - float num164 = (float)(num157 - num161); - if (num158 < 0) - { - num164 = (float)(num159 - num161); - } - color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); - Vector2 value4 = npc.oldPos[num161]; - float num165 = npc.rotation; - Main.spriteBatch.Draw(texture2D3, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); - goto IL_6881; - } - var something = npc.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - spriteBatch.Draw(texture2D3, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, something, 0); + SpriteEffects spriteEffects = SpriteEffects.None; + if (npc.spriteDirection == 1) + spriteEffects = SpriteEffects.FlipHorizontally; + + Texture2D texture2D15 = Main.npcTexture[npc.type]; + Vector2 vector11 = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / 2); + Color color36 = Color.White; + float amount9 = 0.5f; + int num153 = 5; + + if (CalamityConfig.Instance.Afterimages) + { + for (int num155 = 1; num155 < num153; num155 += 2) + { + Color color38 = lightColor; + if (npc.Calamity().newAI[0] > 280f && (CalamityWorld.revenge || CalamityWorld.bossRushActive)) + { + byte newColor = (byte)MathHelper.Clamp((npc.Calamity().newAI[0] - 280f) / 120f * 255f, 0f, 255f); + color38.R = 0; + color38.G = newColor; + color38.B = newColor; + } + color38 = Color.Lerp(color38, color36, amount9); + color38 = npc.GetAlpha(color38); + color38 *= (num153 - num155) / 15f; + Vector2 vector41 = npc.oldPos[num155] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; + vector41 -= new Vector2(texture2D15.Width, texture2D15.Height) * npc.scale / 2f; + vector41 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); + spriteBatch.Draw(texture2D15, vector41, npc.frame, color38, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + } + } + + Vector2 vector43 = npc.Center - Main.screenPosition; + vector43 -= new Vector2(texture2D15.Width, texture2D15.Height) * npc.scale / 2f; + vector43 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); + Color color = npc.GetAlpha(lightColor); + if (npc.Calamity().newAI[0] > 280f && (CalamityWorld.revenge || CalamityWorld.bossRushActive)) + { + byte newColor = (byte)MathHelper.Clamp((npc.Calamity().newAI[0] - 280f) / 120f * 255f, 0f, 255f); + color.R = 0; + color.G = newColor; + color.B = newColor; + } + spriteBatch.Draw(texture2D15, vector43, npc.frame, color, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + return false; } @@ -475,7 +547,13 @@ namespace CalamityMod.NPCs.StormWeaver return true; } - public override bool CheckActive() + public override void OnHitPlayer(Player player, int damage, bool crit) + { + int buffDuration = npc.Calamity().newAI[0] >= 400f ? 300 : 90; + player.AddBuff(BuffID.Electrified, buffDuration, true); + } + + public override bool CheckActive() { return false; } @@ -484,37 +562,36 @@ namespace CalamityMod.NPCs.StormWeaver { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 173, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SWNudeHead1"), 1f); Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SWNudeHead2"), 1f); - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.position.X = npc.position.X + (npc.width / 2); + npc.position.Y = npc.position.Y + (npc.height / 2); npc.width = 30; npc.height = 30; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); + npc.position.X = npc.position.X - (npc.width / 2); + npc.position.Y = npc.position.Y - (npc.height / 2); for (int num621 = 0; num621 < 20; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 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; + Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } for (int num623 = 0; num623 < 40; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - Vector2 spawnAt = npc.Center + new Vector2(0f, (float)npc.height / 2f); } } @@ -586,9 +663,12 @@ namespace CalamityMod.NPCs.StormWeaver } } - // Mark Storm Weaver as dead - CalamityWorld.downedSentinel2 = true; - CalamityMod.UpdateServerBoolean(); + // Mark Storm Weaver as dead + if (CalamityWorld.DoGSecondStageCountdown <= 0) + { + CalamityWorld.downedSentinel2 = true; + CalamityMod.UpdateServerBoolean(); + } } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) diff --git a/NPCs/StormWeaver/StormWeaverTail.cs b/NPCs/StormWeaver/StormWeaverTail.cs index 00f5324989..81d4b11f26 100644 --- a/NPCs/StormWeaver/StormWeaverTail.cs +++ b/NPCs/StormWeaver/StormWeaverTail.cs @@ -1,3 +1,4 @@ +using CalamityMod.Dusts; using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; @@ -21,7 +22,7 @@ namespace CalamityMod.NPCs.StormWeaver npc.height = 80; npc.defense = 0; npc.takenDamageMultiplier = CalamityWorld.death ? 3f : 10f; - bool notDoGFight = CalamityWorld.DoGSecondStageCountdown <= 0; + bool notDoGFight = CalamityWorld.DoGSecondStageCountdown <= 0 || !CalamityWorld.downedSentinel2; npc.LifeMaxNERB(notDoGFight ? 100000 : 20000, notDoGFight ? 100000 : 20000, 170000); Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); if (calamityModMusic != null) @@ -167,7 +168,7 @@ namespace CalamityMod.NPCs.StormWeaver { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 173, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { @@ -181,7 +182,7 @@ namespace CalamityMod.NPCs.StormWeaver npc.position.Y = npc.position.Y - (float)(npc.height / 2); for (int num621 = 0; num621 < 20; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -191,10 +192,10 @@ namespace CalamityMod.NPCs.StormWeaver } for (int num623 = 0; num623 < 40; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } diff --git a/NPCs/StormWeaver/StormWeaverTailNaked.cs b/NPCs/StormWeaver/StormWeaverTailNaked.cs index c565aa4c42..4b3236099e 100644 --- a/NPCs/StormWeaver/StormWeaverTailNaked.cs +++ b/NPCs/StormWeaver/StormWeaverTailNaked.cs @@ -1,4 +1,5 @@ -using CalamityMod.World; +using CalamityMod.Dusts; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System.IO; @@ -15,7 +16,8 @@ namespace CalamityMod.NPCs.StormWeaver public override void SetStaticDefaults() { DisplayName.SetDefault("Storm Weaver"); - } + NPCID.Sets.TrailingMode[npc.type] = 1; + } public override void SetDefaults() { @@ -23,7 +25,7 @@ namespace CalamityMod.NPCs.StormWeaver npc.npcSlots = 5f; npc.width = 48; npc.height = 80; - bool notDoGFight = CalamityWorld.DoGSecondStageCountdown <= 0; + bool notDoGFight = CalamityWorld.DoGSecondStageCountdown <= 0 || !CalamityWorld.downedSentinel2; npc.LifeMaxNERB(notDoGFight ? 900000 : 150000, notDoGFight ? 900000 : 150000, 3500000); Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); if (calamityModMusic != null) @@ -51,8 +53,6 @@ namespace CalamityMod.NPCs.StormWeaver npc.HitSound = SoundID.NPCHit13; npc.DeathSound = SoundID.NPCDeath13; npc.netAlways = true; - NPCID.Sets.TrailCacheLength[npc.type] = 8; - NPCID.Sets.TrailingMode[npc.type] = 1; for (int k = 0; k < npc.buffImmune.Length; k++) { npc.buffImmune[k] = true; @@ -132,7 +132,7 @@ namespace CalamityMod.NPCs.StormWeaver } } - Vector2 vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + Vector2 vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); float num191 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2); float num192 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2); num191 = (int)(num191 / 16f) * 16; @@ -172,85 +172,100 @@ namespace CalamityMod.NPCs.StormWeaver } } - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - Color color24 = npc.GetAlpha(drawColor); - Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0)); - Texture2D texture2D3 = Main.npcTexture[npc.type]; - int num156 = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type]; - int y3 = num156 * (int)npc.frameCounter; - Rectangle rectangle = new Rectangle(0, y3, texture2D3.Width, num156); - Vector2 origin2 = rectangle.Size() / 2f; - int num157 = 8; - int num158 = 2; - int num159 = 1; - float num160 = 0f; - int num161 = num159; - while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)) && CalamityConfig.Instance.Afterimages) - { - Color color26 = npc.GetAlpha(color25); - { - goto IL_6899; - } - IL_6881: - num161 += num158; - continue; - IL_6899: - float num164 = (float)(num157 - num161); - if (num158 < 0) - { - num164 = (float)(num159 - num161); - } - color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f); - Vector2 value4 = npc.oldPos[num161]; - float num165 = npc.rotation; - Main.spriteBatch.Draw(texture2D3, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, spriteEffects, 0f); - goto IL_6881; - } - var something = npc.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - spriteBatch.Draw(texture2D3, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, color24, npc.rotation, npc.frame.Size() / 2, npc.scale, something, 0); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (npc.spriteDirection == 1) + spriteEffects = SpriteEffects.FlipHorizontally; - public override bool CanHitPlayer(Player target, ref int cooldownSlot) + Texture2D texture2D15 = Main.npcTexture[npc.type]; + Vector2 vector11 = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / 2); + Color color36 = Color.White; + float amount9 = 0.5f; + int num153 = 5; + + if (CalamityConfig.Instance.Afterimages) + { + for (int num155 = 1; num155 < num153; num155 += 2) + { + Color color38 = lightColor; + if (Main.npc[(int)npc.ai[2]].Calamity().newAI[0] > 280f && (CalamityWorld.revenge || CalamityWorld.bossRushActive)) + { + byte newColor = (byte)MathHelper.Clamp((Main.npc[(int)npc.ai[2]].Calamity().newAI[0] - 280f) / 120f * 255f, 0f, 255f); + color38.R = 0; + color38.G = newColor; + color38.B = newColor; + } + color38 = Color.Lerp(color38, color36, amount9); + color38 = npc.GetAlpha(color38); + color38 *= (num153 - num155) / 15f; + Vector2 vector41 = npc.oldPos[num155] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; + vector41 -= new Vector2(texture2D15.Width, texture2D15.Height) * npc.scale / 2f; + vector41 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); + spriteBatch.Draw(texture2D15, vector41, npc.frame, color38, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + } + } + + Vector2 vector43 = npc.Center - Main.screenPosition; + vector43 -= new Vector2(texture2D15.Width, texture2D15.Height) * npc.scale / 2f; + vector43 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); + Color color = npc.GetAlpha(lightColor); + if (Main.npc[(int)npc.ai[2]].Calamity().newAI[0] > 280f && (CalamityWorld.revenge || CalamityWorld.bossRushActive)) + { + byte newColor = (byte)MathHelper.Clamp((Main.npc[(int)npc.ai[2]].Calamity().newAI[0] - 280f) / 120f * 255f, 0f, 255f); + color.R = 0; + color.G = newColor; + color.B = newColor; + } + spriteBatch.Draw(texture2D15, vector43, npc.frame, color, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + + return false; + } + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) { cooldownSlot = 1; return true; } - public override void HitEffect(int hitDirection, double damage) + public override void OnHitPlayer(Player player, int damage, bool crit) + { + int buffDuration = Main.npc[(int)npc.ai[2]].Calamity().newAI[0] >= 400f ? 100 : 30; + player.AddBuff(BuffID.Electrified, buffDuration, true); + } + + public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 173, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SWNudeTail1"), 1f); Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SWNudeTail2"), 1f); - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.position.X = npc.position.X + (npc.width / 2); + npc.position.Y = npc.position.Y + (npc.height / 2); npc.width = 30; npc.height = 30; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); + npc.position.X = npc.position.X - (npc.width / 2); + npc.position.Y = npc.position.Y - (npc.height / 2); for (int num621 = 0; num621 < 20; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 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; + Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } for (int num623 = 0; num623 < 40; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } diff --git a/NPCs/SulphurousSea/Catfish.cs b/NPCs/SulphurousSea/Catfish.cs index e25ae8eca6..59875b9a5f 100644 --- a/NPCs/SulphurousSea/Catfish.cs +++ b/NPCs/SulphurousSea/Catfish.cs @@ -102,13 +102,13 @@ namespace CalamityMod.NPCs.SulphurousSea { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 25; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/SulphurousSea/Flounder.cs b/NPCs/SulphurousSea/Flounder.cs index 95b6cd60f2..21304249d3 100644 --- a/NPCs/SulphurousSea/Flounder.cs +++ b/NPCs/SulphurousSea/Flounder.cs @@ -122,13 +122,13 @@ namespace CalamityMod.NPCs.SulphurousSea { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 15; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } } diff --git a/NPCs/SulphurousSea/Gnasher.cs b/NPCs/SulphurousSea/Gnasher.cs index a540b0257b..620e0be1bc 100644 --- a/NPCs/SulphurousSea/Gnasher.cs +++ b/NPCs/SulphurousSea/Gnasher.cs @@ -116,13 +116,13 @@ namespace CalamityMod.NPCs.SulphurousSea { for (int k = 0; k < 3; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 15; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Gnasher"), 1f); Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Gnasher2"), 1f); diff --git a/NPCs/SulphurousSea/Mauler.cs b/NPCs/SulphurousSea/Mauler.cs index 023a4f0eec..aefec17e21 100644 --- a/NPCs/SulphurousSea/Mauler.cs +++ b/NPCs/SulphurousSea/Mauler.cs @@ -147,25 +147,25 @@ namespace CalamityMod.NPCs.SulphurousSea } else { - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.2f; + npc.velocity.X += (float)npc.direction * 0.2f; if (npc.velocity.X < -4f || npc.velocity.X > 4f) { - npc.velocity.X = npc.velocity.X * 0.95f; + npc.velocity.X *= 0.95f; } if (npc.ai[0] == -1f) { - npc.velocity.Y = npc.velocity.Y - 0.01f; - if ((double)npc.velocity.Y < -0.3) - { - npc.ai[0] = 1f; - } - } - else - { - npc.velocity.Y = npc.velocity.Y + 0.01f; - if ((double)npc.velocity.Y > 0.3) - { - npc.ai[0] = -1f; + npc.velocity.Y -= 0.01f; + if (npc.velocity.Y < -0.3f) + { + npc.ai[0] = 1f; + } + } + else + { + npc.velocity.Y += 0.01f; + if (npc.velocity.Y > 0.3f) + { + npc.ai[0] = -1f; } } } @@ -194,9 +194,9 @@ namespace CalamityMod.NPCs.SulphurousSea npc.ai[0] = -1f; } } - if ((double)npc.velocity.Y > 0.4 || (double)npc.velocity.Y < -0.4) + if (npc.velocity.Y > 0.4f || npc.velocity.Y < -0.4f) { - npc.velocity.Y = npc.velocity.Y * 0.95f; + npc.velocity.Y *= 0.95f; } } else @@ -261,11 +261,11 @@ namespace CalamityMod.NPCs.SulphurousSea } } npc.rotation = npc.velocity.Y * (float)npc.direction * 0.1f; - if ((double)npc.rotation < -0.2) + if (npc.rotation < -0.2f) { npc.rotation = -0.2f; } - if ((double)npc.rotation > 0.2) + if (npc.rotation > 0.2f) { npc.rotation = 0.2f; return; @@ -303,7 +303,7 @@ namespace CalamityMod.NPCs.SulphurousSea } for (int num621 = 0; num621 < 25; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 31, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(npc.position, npc.width, npc.height, 31, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -314,10 +314,10 @@ namespace CalamityMod.NPCs.SulphurousSea } for (int num623 = 0; num623 < 50; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 5, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 5, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; Main.dust[num624].noGravity = true; } @@ -351,7 +351,7 @@ namespace CalamityMod.NPCs.SulphurousSea public override void NPCLoot() { DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedPolterghast, 3, 1, 1); - 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); + int item = Item.NewItem(npc.Center, npc.Size, 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); } @@ -382,13 +382,13 @@ namespace CalamityMod.NPCs.SulphurousSea { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 30; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Mauler"), 1f); Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Mauler2"), 1f); diff --git a/NPCs/SulphurousSea/Trasher.cs b/NPCs/SulphurousSea/Trasher.cs index 1b22e75f28..e7966c8a0e 100644 --- a/NPCs/SulphurousSea/Trasher.cs +++ b/NPCs/SulphurousSea/Trasher.cs @@ -347,13 +347,13 @@ namespace CalamityMod.NPCs.SulphurousSea { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { for (int k = 0; k < 25; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Trasher"), 1f); Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Trasher2"), 1f); diff --git a/NPCs/SunkenSea/Clam.cs b/NPCs/SunkenSea/Clam.cs index 6a8fa5d317..c2f850bc6d 100644 --- a/NPCs/SunkenSea/Clam.cs +++ b/NPCs/SunkenSea/Clam.cs @@ -74,6 +74,7 @@ namespace CalamityMod.NPCs.SunkenSea { if (!statChange) { + npc.buffImmune[BuffID.Confused] = false; npc.defense = 6; npc.damage = Main.expertMode ? 60 : 30; if (Main.hardMode) @@ -108,7 +109,7 @@ namespace CalamityMod.NPCs.SunkenSea } if (npc.ai[2] < (float)num321) { - npc.velocity.X = npc.velocity.X * 0.9f; + npc.velocity.X *= 0.9f; return; } npc.ai[2] = 0f; diff --git a/NPCs/SunkenSea/EutrophicRay.cs b/NPCs/SunkenSea/EutrophicRay.cs index 015a2dfb45..a5e9279d71 100644 --- a/NPCs/SunkenSea/EutrophicRay.cs +++ b/NPCs/SunkenSea/EutrophicRay.cs @@ -134,11 +134,11 @@ namespace CalamityMod.NPCs.SunkenSea } npc.rotation = npc.velocity.Y * Rotation; - if ((double)npc.rotation < -0.1) + if (npc.rotation < -0.1f) { npc.rotation = -0.1f; } - if ((double)npc.rotation > 0.1) + if (npc.rotation > 0.1f) { npc.rotation = 0.1f; return; diff --git a/NPCs/SunkenSea/GiantClam.cs b/NPCs/SunkenSea/GiantClam.cs index c2d3aa4716..ae08fbb541 100644 --- a/NPCs/SunkenSea/GiantClam.cs +++ b/NPCs/SunkenSea/GiantClam.cs @@ -427,6 +427,7 @@ namespace CalamityMod.NPCs.SunkenSea // Mark Giant Clam as dead CalamityWorld.downedCLAM = true; + CalamityWorld.downedCLAMHardMode = Main.hardMode || CalamityWorld.downedCLAMHardMode; CalamityMod.UpdateServerBoolean(); } } diff --git a/NPCs/SunkenSea/PrismTurtle.cs b/NPCs/SunkenSea/PrismTurtle.cs index 0f1d7f69f8..eb1217ba61 100644 --- a/NPCs/SunkenSea/PrismTurtle.cs +++ b/NPCs/SunkenSea/PrismTurtle.cs @@ -11,8 +11,6 @@ namespace CalamityMod.NPCs.SunkenSea { public class PrismTurtle : ModNPC { - public bool hasBeenHit = false; - public override void SetStaticDefaults() { DisplayName.SetDefault("Prism-Back"); @@ -36,18 +34,17 @@ namespace CalamityMod.NPCs.SunkenSea npc.knockBackResist = 0.15f; banner = npc.type; bannerItem = ModContent.ItemType(); + npc.chaseable = false; } public override void SendExtraAI(BinaryWriter writer) { writer.Write(npc.chaseable); - writer.Write(hasBeenHit); } public override void ReceiveExtraAI(BinaryReader reader) { npc.chaseable = reader.ReadBoolean(); - hasBeenHit = reader.ReadBoolean(); } public override void AI() @@ -123,7 +120,7 @@ namespace CalamityMod.NPCs.SunkenSea { if (projectile.minion && !projectile.Calamity().overridesMinionDamagePrevention) { - return hasBeenHit; + return npc.chaseable; } return null; } diff --git a/NPCs/SupremeCalamitas/SCalWormBody.cs b/NPCs/SupremeCalamitas/SCalWormBody.cs index f9ef65298e..ea088e97a7 100644 --- a/NPCs/SupremeCalamitas/SCalWormBody.cs +++ b/NPCs/SupremeCalamitas/SCalWormBody.cs @@ -11,7 +11,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas { public class SCalWormBody : ModNPC { - public override void SetStaticDefaults() + private bool setAlpha = false; + + public override void SetStaticDefaults() { DisplayName.SetDefault("Sepulcher"); } @@ -20,8 +22,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas { npc.damage = 0; //70 npc.npcSlots = 5f; - npc.width = 26; //28 - npc.height = 18; //28 + npc.width = 20; //28 + npc.height = 20; //28 npc.defense = 0; CalamityGlobalNPC global = npc.Calamity(); global.DR = 0.999999f; @@ -31,7 +33,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas { npc.lifeMax = 2000000; } - npc.aiStyle = 6; //new + npc.aiStyle = -1; //new aiType = -1; //new npc.knockBackResist = 0f; npc.scale = 1.2f; @@ -58,12 +60,14 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override void SendExtraAI(BinaryWriter writer) { writer.Write(npc.localAI[3]); - } + writer.Write(setAlpha); + } public override void ReceiveExtraAI(BinaryReader reader) { npc.localAI[3] = reader.ReadSingle(); - } + setAlpha = reader.ReadBoolean(); + } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) { @@ -72,21 +76,90 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override void AI() { - if (!Main.npc[(int)npc.ai[1]].active) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.active = false; - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - } + if (npc.ai[3] > 0f) + { + npc.realLife = (int)npc.ai[3]; + } + + bool flag = false; + if (npc.ai[1] <= 0f) + { + flag = true; + } + else if (Main.npc[(int)npc.ai[1]].life <= 0 || npc.life <= 0) + { + flag = true; + } + if (flag) + { + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.checkDead(); + } + + if (Main.npc[(int)npc.ai[1]].alpha < 128 && !setAlpha) + { + if (npc.alpha != 0) + { + for (int num934 = 0; num934 < 2; num934++) + { + int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default, 2f); + Main.dust[num935].noGravity = true; + Main.dust[num935].noLight = true; + } + } + npc.alpha -= 42; + if (npc.alpha <= 0) + { + setAlpha = true; + npc.alpha = 0; + } + } + else + { + npc.alpha = Main.npc[(int)npc.ai[2]].alpha; + } + + Vector2 vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num191 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2); + float num192 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2); + num191 = (int)(num191 / 16f) * 16; + num192 = (int)(num192 / 16f) * 16; + vector18.X = (int)(vector18.X / 16f) * 16; + vector18.Y = (int)(vector18.Y / 16f) * 16; + num191 -= vector18.X; + num192 -= vector18.Y; + float num193 = (float)System.Math.Sqrt(num191 * num191 + num192 * num192); + if (npc.ai[1] > 0f && npc.ai[1] < Main.npc.Length) + { + try + { + vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + num191 = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; + num192 = Main.npc[(int)npc.ai[1]].position.Y + (Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; + } + catch + { + } + npc.rotation = (float)System.Math.Atan2(num192, num191) + 1.57f; + num193 = (float)System.Math.Sqrt(num191 * num191 + num192 * num192); + int num194 = npc.width; + num193 = (num193 - num194) / num193; + num191 *= num193; + num192 *= num193; + npc.velocity = Vector2.Zero; + npc.position.X = npc.position.X + num191; + npc.position.Y = npc.position.Y + num192; + if (num191 < 0f) + { + npc.spriteDirection = -1; + } + else if (num191 > 0f) + { + npc.spriteDirection = 1; + } + } + } public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { diff --git a/NPCs/SupremeCalamitas/SCalWormBodyWeak.cs b/NPCs/SupremeCalamitas/SCalWormBodyWeak.cs index ba61be3cae..5cf7c8e3b7 100644 --- a/NPCs/SupremeCalamitas/SCalWormBodyWeak.cs +++ b/NPCs/SupremeCalamitas/SCalWormBodyWeak.cs @@ -1,5 +1,6 @@ using CalamityMod.Projectiles.Boss; using CalamityMod.World; +using Microsoft.Xna.Framework; using System.IO; using Terraria; using Terraria.ID; @@ -9,10 +10,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas { public class SCalWormBodyWeak : ModNPC { - public double damageTaken = 0.0; - public int invinceTime = 360; + private bool setAlpha = false; - public override void SetStaticDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Brimstone Heart"); } @@ -21,14 +21,14 @@ namespace CalamityMod.NPCs.SupremeCalamitas { npc.damage = 0; npc.npcSlots = 5f; - npc.width = 14; - npc.height = 12; + npc.width = 20; + npc.height = 20; npc.lifeMax = CalamityWorld.revenge ? 1200000 : 1000000; if (CalamityWorld.death) { npc.lifeMax = 2000000; } - npc.aiStyle = 6; + npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; CalamityGlobalNPC global = npc.Calamity(); @@ -58,43 +58,118 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override void SendExtraAI(BinaryWriter writer) { writer.Write(npc.localAI[0]); - } + writer.Write(setAlpha); + } public override void ReceiveExtraAI(BinaryReader reader) { npc.localAI[0] = reader.ReadSingle(); - } + setAlpha = reader.ReadBoolean(); + } public override void AI() { - if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[0] += 1f; - if (npc.localAI[0] >= 900f) - { - npc.localAI[0] = 0f; - int damage = Main.expertMode ? 150 : 200; - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 1f, 1f, ModContent.ProjectileType(), damage, 0f, npc.target, 0f, 0f); - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, -1f, 1f, ModContent.ProjectileType(), damage, 0f, npc.target, 0f, 0f); - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 1f, -1f, ModContent.ProjectileType(), damage, 0f, npc.target, 0f, 0f); - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, -1f, -1f, ModContent.ProjectileType(), damage, 0f, npc.target, 0f, 0f); - npc.netUpdate = true; - } - } - if (!Main.npc[(int)npc.ai[1]].active) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.active = false; - } + if (npc.ai[3] > 0f) + { + npc.realLife = (int)npc.ai[3]; + } + + bool flag = false; + if (npc.ai[1] <= 0f) + { + flag = true; + } + else if (Main.npc[(int)npc.ai[1]].life <= 0 || npc.life <= 0) + { + flag = true; + } + if (flag) + { + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.checkDead(); + } + + if (Main.npc[(int)npc.ai[1]].alpha < 128 && !setAlpha) + { + if (npc.alpha != 0) + { + for (int num934 = 0; num934 < 2; num934++) + { + int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default, 2f); + Main.dust[num935].noGravity = true; + Main.dust[num935].noLight = true; + } + } + npc.alpha -= 42; + if (npc.alpha <= 0) + { + setAlpha = true; + npc.alpha = 0; + } + } + else + { + npc.alpha = Main.npc[(int)npc.ai[2]].alpha; + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[0] += 1f; + if (npc.localAI[0] >= 900f) + { + npc.localAI[0] = 0f; + int damage = Main.expertMode ? 150 : 200; + int totalProjectiles = 4; + float radians = MathHelper.TwoPi / totalProjectiles; + Vector2 spinningPoint = Vector2.Normalize(new Vector2(-1f, -1f)); + for (int k = 0; k < totalProjectiles; k++) + { + Vector2 vector255 = spinningPoint.RotatedBy(radians * k); + Projectile.NewProjectile(npc.Center, vector255, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + } + } + } + + Vector2 vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num191 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2); + float num192 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2); + num191 = (int)(num191 / 16f) * 16; + num192 = (int)(num192 / 16f) * 16; + vector18.X = (int)(vector18.X / 16f) * 16; + vector18.Y = (int)(vector18.Y / 16f) * 16; + num191 -= vector18.X; + num192 -= vector18.Y; + float num193 = (float)System.Math.Sqrt(num191 * num191 + num192 * num192); + if (npc.ai[1] > 0f && npc.ai[1] < Main.npc.Length) + { + try + { + vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + num191 = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; + num192 = Main.npc[(int)npc.ai[1]].position.Y + (Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; + } + catch + { + } + npc.rotation = (float)System.Math.Atan2(num192, num191) + 1.57f; + num193 = (float)System.Math.Sqrt(num191 * num191 + num192 * num192); + int num194 = npc.width; + num193 = (num193 - num194) / num193; + num191 *= num193; + num192 *= num193; + npc.velocity = Vector2.Zero; + npc.position.X = npc.position.X + num191; + npc.position.Y = npc.position.Y + num192; + if (num191 < 0f) + { + npc.spriteDirection = -1; + } + else if (num191 > 0f) + { + npc.spriteDirection = 1; + } + } } public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) diff --git a/NPCs/SupremeCalamitas/SCalWormHead.cs b/NPCs/SupremeCalamitas/SCalWormHead.cs index 696bdf7583..1c570f4c68 100644 --- a/NPCs/SupremeCalamitas/SCalWormHead.cs +++ b/NPCs/SupremeCalamitas/SCalWormHead.cs @@ -14,8 +14,6 @@ namespace CalamityMod.NPCs.SupremeCalamitas { private const int minLength = 51; private const int maxLength = 52; - private float speed = 10f; - private float turnSpeed = 0.15f; private float passedVar = 0f; private bool TailSpawned = false; @@ -28,8 +26,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas { npc.damage = 0; //150 npc.npcSlots = 5f; - npc.width = 56; //324 - npc.height = 62; //216 + npc.width = 62; //324 + npc.height = 78; //216 npc.defense = 0; CalamityGlobalNPC global = npc.Calamity(); global.DR = 0.999999f; @@ -39,7 +37,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas { npc.lifeMax = 2000000; } - npc.aiStyle = 6; //new + npc.aiStyle = -1; //new aiType = -1; //new npc.knockBackResist = 0f; npc.scale = 1.2f; @@ -65,12 +63,14 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override void SendExtraAI(BinaryWriter writer) { writer.Write(npc.localAI[0]); - } + writer.Write(npc.alpha); + } public override void ReceiveExtraAI(BinaryReader reader) { npc.localAI[0] = reader.ReadSingle(); - } + npc.alpha = reader.ReadInt32(); + } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) { @@ -80,21 +80,18 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override void AI() { CalamityGlobalNPC.SCalWorm = npc.whoAmI; - if (!NPC.AnyNPCs(ModContent.NPCType()) || CalamityGlobalNPC.SCal < 0 || !Main.npc[CalamityGlobalNPC.SCal].active) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.active = false; - } - if (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) - { - npc.TargetClosest(true); - } - npc.velocity.Length(); + + // Target + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) + npc.TargetClosest(true); + + Player player = Main.player[npc.target]; + + if (npc.ai[3] > 0f) + { + npc.realLife = (int)npc.ai[3]; + } + if (Main.netMode != NetmodeID.MultiplayerClient) { if (!TailSpawned && npc.ai[0] == 0f) @@ -127,9 +124,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType(), npc.whoAmI); } Main.npc[lol].realLife = npc.whoAmI; - Main.npc[lol].ai[2] = (float)npc.whoAmI; - Main.npc[lol].ai[1] = (float)Previous; - Main.npc[Previous].ai[0] = (float)lol; + Main.npc[lol].ai[2] = npc.whoAmI; + Main.npc[lol].ai[1] = Previous; + Main.npc[Previous].ai[0] = lol; Previous = lol; } TailSpawned = true; @@ -139,21 +136,22 @@ namespace CalamityMod.NPCs.SupremeCalamitas NetMessage.SendData(MessageID.StrikeNPC, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); } } - if (Main.player[npc.target].dead) + + if (Main.player[npc.target].dead || !NPC.AnyNPCs(ModContent.NPCType()) || CalamityGlobalNPC.SCal < 0 || !Main.npc[CalamityGlobalNPC.SCal].active) { npc.TargetClosest(false); npc.alpha += 5; if (npc.alpha >= 255) { npc.alpha = 255; - for (int num957 = 0; num957 < 200; num957++) - { - if (Main.npc[num957].aiStyle == npc.aiStyle) - { - Main.npc[num957].active = false; - } - } - } + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].type == npc.type || Main.npc[i].type == ModContent.NPCType() || Main.npc[i].type == ModContent.NPCType() || Main.npc[i].type == ModContent.NPCType()) + { + Main.npc[i].active = false; + } + } + } } else { @@ -163,217 +161,138 @@ namespace CalamityMod.NPCs.SupremeCalamitas npc.alpha = 0; } } - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 10000f) - { - for (int num957 = 0; num957 < 200; num957++) - { - if (Main.npc[num957].aiStyle == npc.aiStyle) - { - Main.npc[num957].active = false; - } - } - } - float num188 = speed; - float num189 = turnSpeed; - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); - int num42 = -1; - int num43 = (int)(Main.player[npc.target].Center.X / 16f); - int num44 = (int)(Main.player[npc.target].Center.Y / 16f); - for (int num45 = num43 - 2; num45 <= num43 + 2; num45++) - { - for (int num46 = num44; num46 <= num44 + 15; num46++) - { - if (WorldGen.SolidTile2(num45, num46)) - { - num42 = num46; - break; - } - } - if (num42 > 0) - { - break; - } - } - if (num42 > 0) - { - num42 *= 16; - float num47 = (float)(num42 - 400); //800 - if (Main.player[npc.target].position.Y > num47) - { - num192 = num47; - if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) < 500f) - { - if (npc.velocity.X > 0f) - { - num191 = Main.player[npc.target].Center.X + 600f; - } - else - { - num191 = Main.player[npc.target].Center.X - 600f; - } - } - } - } - float num48 = num188 * 1.3f; - float num49 = num188 * 0.7f; - float num50 = npc.velocity.Length(); - if (num50 > 0f) - { - if (num50 > num48) - { - npc.velocity.Normalize(); - npc.velocity *= num48; - } - else if (num50 < num49) - { - npc.velocity.Normalize(); - npc.velocity *= num49; - } - } - if (num42 > 0) - { - for (int num51 = 0; num51 < 200; num51++) - { - if (Main.npc[num51].active && Main.npc[num51].type == npc.type && num51 != npc.whoAmI) - { - Vector2 vector3 = Main.npc[num51].Center - npc.Center; - if (vector3.Length() < 400f) - { - vector3.Normalize(); - vector3 *= 1000f; - num191 -= vector3.X; - num192 -= vector3.Y; - } - } - } - } - else - { - for (int num52 = 0; num52 < 200; num52++) - { - if (Main.npc[num52].active && Main.npc[num52].type == npc.type && num52 != npc.whoAmI) - { - Vector2 vector4 = Main.npc[num52].Center - npc.Center; - if (vector4.Length() < 60f) - { - vector4.Normalize(); - vector4 *= 200f; - num191 -= vector4.X; - num192 -= vector4.Y; - } - } - } - } - num191 = (float)((int)(num191 / 16f) * 16); - num192 = (float)((int)(num192 / 16f) * 16); - vector18.X = (float)((int)(vector18.X / 16f) * 16); - vector18.Y = (float)((int)(vector18.Y / 16f) * 16); - num191 -= vector18.X; - num192 -= vector18.Y; - float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - float num196 = System.Math.Abs(num191); - float num197 = System.Math.Abs(num192); - float num198 = num188 / num193; - num191 *= num198; - num192 *= num198; - if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + num189; - } - else - { - if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num189; - } - } - if (npc.velocity.Y < num192) - { - npc.velocity.Y = npc.velocity.Y + num189; - } - else - { - if (npc.velocity.Y > num192) - { - npc.velocity.Y = npc.velocity.Y - num189; - } - } - if ((double)System.Math.Abs(num192) < (double)num188 * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + num189 * 2f; - } - else - { - npc.velocity.Y = npc.velocity.Y - num189 * 2f; - } - } - if ((double)System.Math.Abs(num191) < (double)num188 * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) - { - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + num189 * 2f; //changed from 2 - } - else - { - npc.velocity.X = npc.velocity.X - num189 * 2f; //changed from 2 - } - } - } - else - { - if (num196 > num197) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + num189 * 1.1f; //changed from 1.1 - } - else if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num189 * 1.1f; //changed from 1.1 - } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + num189; - } - else - { - npc.velocity.Y = npc.velocity.Y - num189; - } - } - } - else - { - if (npc.velocity.Y < num192) - { - npc.velocity.Y = npc.velocity.Y + num189 * 1.1f; - } - else if (npc.velocity.Y > num192) - { - npc.velocity.Y = npc.velocity.Y - num189 * 1.1f; - } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) - { - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + num189; - } - else - { - npc.velocity.X = npc.velocity.X - num189; - } - } - } - } - npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; - } + + Vector2 vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num191 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2); + float num192 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2); + float num188 = 10f; + float num189 = 0.1f; + + float num48 = num188 * 1.3f; + float num49 = num188 * 0.7f; + float num50 = npc.velocity.Length(); + if (num50 > 0f) + { + if (num50 > num48) + { + npc.velocity.Normalize(); + npc.velocity *= num48; + } + else if (num50 < num49) + { + npc.velocity.Normalize(); + npc.velocity *= num49; + } + } + + num191 = (int)(num191 / 16f) * 16; + num192 = (int)(num192 / 16f) * 16; + vector18.X = (int)(vector18.X / 16f) * 16; + vector18.Y = (int)(vector18.Y / 16f) * 16; + num191 -= vector18.X; + num192 -= vector18.Y; + float num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192); + float num196 = Math.Abs(num191); + float num197 = Math.Abs(num192); + float num198 = num188 / num193; + num191 *= num198; + num192 *= num198; + if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)) + { + if (npc.velocity.X < num191) + { + npc.velocity.X = npc.velocity.X + num189; + } + else + { + if (npc.velocity.X > num191) + { + npc.velocity.X = npc.velocity.X - num189; + } + } + if (npc.velocity.Y < num192) + { + npc.velocity.Y = npc.velocity.Y + num189; + } + else + { + if (npc.velocity.Y > num192) + { + npc.velocity.Y = npc.velocity.Y - num189; + } + } + if (Math.Abs(num192) < num188 * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + num189 * 2f; + } + else + { + npc.velocity.Y = npc.velocity.Y - num189 * 2f; + } + } + if (Math.Abs(num191) < num188 * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) + { + if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X + num189 * 2f; //changed from 2 + } + else + { + npc.velocity.X = npc.velocity.X - num189 * 2f; //changed from 2 + } + } + } + else + { + if (num196 > num197) + { + if (npc.velocity.X < num191) + { + npc.velocity.X = npc.velocity.X + num189 * 1.1f; //changed from 1.1 + } + else if (npc.velocity.X > num191) + { + npc.velocity.X = npc.velocity.X - num189 * 1.1f; //changed from 1.1 + } + if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < num188 * 0.5) + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + num189; + } + else + { + npc.velocity.Y = npc.velocity.Y - num189; + } + } + } + else + { + if (npc.velocity.Y < num192) + { + npc.velocity.Y = npc.velocity.Y + num189 * 1.1f; + } + else if (npc.velocity.Y > num192) + { + npc.velocity.Y = npc.velocity.Y - num189 * 1.1f; + } + if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < num188 * 0.5) + { + if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X + num189; + } + else + { + npc.velocity.X = npc.velocity.X - num189; + } + } + } + } + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) + MathHelper.PiOver2; + } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { diff --git a/NPCs/SupremeCalamitas/SCalWormHeart.cs b/NPCs/SupremeCalamitas/SCalWormHeart.cs index f75e9ef0b0..f9f859796a 100644 --- a/NPCs/SupremeCalamitas/SCalWormHeart.cs +++ b/NPCs/SupremeCalamitas/SCalWormHeart.cs @@ -53,7 +53,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas { if (projectile.type == ModContent.ProjectileType()) { - damage = (int)((double)damage * 0.66); + damage = (int)(damage * 0.66); } } diff --git a/NPCs/SupremeCalamitas/SCalWormTail.cs b/NPCs/SupremeCalamitas/SCalWormTail.cs index 8b6fded520..69f76be65e 100644 --- a/NPCs/SupremeCalamitas/SCalWormTail.cs +++ b/NPCs/SupremeCalamitas/SCalWormTail.cs @@ -1,6 +1,7 @@ using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,7 +10,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas { public class SCalWormTail : ModNPC { - public override void SetStaticDefaults() + private bool setAlpha = false; + + public override void SetStaticDefaults() { DisplayName.SetDefault("Sepulcher"); } @@ -18,8 +21,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas { npc.damage = 0; npc.npcSlots = 5f; - npc.width = 26; //324 - npc.height = 46; //216 + npc.width = 20; //324 + npc.height = 20; //216 npc.defense = 0; CalamityGlobalNPC global = npc.Calamity(); global.DR = 0.999999f; @@ -29,7 +32,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas { npc.lifeMax = 2000000; } - npc.aiStyle = 6; //new + npc.aiStyle = -1; //new aiType = -1; //new npc.knockBackResist = 0f; npc.scale = 1.2f; @@ -53,28 +56,107 @@ namespace CalamityMod.NPCs.SupremeCalamitas npc.dontCountMe = true; } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(setAlpha); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + setAlpha = reader.ReadBoolean(); + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) { return false; } public override void AI() { - if (!Main.npc[(int)npc.ai[1]].active) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.active = false; - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - } + if (npc.ai[3] > 0f) + { + npc.realLife = (int)npc.ai[3]; + } + + bool flag = false; + if (npc.ai[1] <= 0f) + { + flag = true; + } + else if (Main.npc[(int)npc.ai[1]].life <= 0 || npc.life <= 0) + { + flag = true; + } + if (flag) + { + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.checkDead(); + } + + if (Main.npc[(int)npc.ai[1]].alpha < 128 && !setAlpha) + { + if (npc.alpha != 0) + { + for (int num934 = 0; num934 < 2; num934++) + { + int num935 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 182, 0f, 0f, 100, default, 2f); + Main.dust[num935].noGravity = true; + Main.dust[num935].noLight = true; + } + } + npc.alpha -= 42; + if (npc.alpha <= 0) + { + setAlpha = true; + npc.alpha = 0; + } + } + else + { + npc.alpha = Main.npc[(int)npc.ai[2]].alpha; + } + + Vector2 vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num191 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2); + float num192 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2); + num191 = (int)(num191 / 16f) * 16; + num192 = (int)(num192 / 16f) * 16; + vector18.X = (int)(vector18.X / 16f) * 16; + vector18.Y = (int)(vector18.Y / 16f) * 16; + num191 -= vector18.X; + num192 -= vector18.Y; + float num193 = (float)System.Math.Sqrt(num191 * num191 + num192 * num192); + if (npc.ai[1] > 0f && npc.ai[1] < Main.npc.Length) + { + try + { + vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + num191 = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; + num192 = Main.npc[(int)npc.ai[1]].position.Y + (Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; + } + catch + { + } + npc.rotation = (float)System.Math.Atan2(num192, num191) + 1.57f; + num193 = (float)System.Math.Sqrt(num191 * num191 + num192 * num192); + int num194 = npc.width; + num193 = (num193 - num194) / num193; + num191 *= num193; + num192 *= num193; + npc.velocity = Vector2.Zero; + npc.position.X = npc.position.X + num191; + npc.position.Y = npc.position.Y + num192; + if (num191 < 0f) + { + npc.spriteDirection = -1; + } + else if (num191 > 0f) + { + npc.spriteDirection = 1; + } + } + } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas.cs b/NPCs/SupremeCalamitas/SupremeCalamitas.cs index 6628dc44c1..da653c78d0 100644 --- a/NPCs/SupremeCalamitas/SupremeCalamitas.cs +++ b/NPCs/SupremeCalamitas/SupremeCalamitas.cs @@ -227,6 +227,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas CalamityMod.StopRain(); bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; + bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; bool death = CalamityWorld.death || CalamityWorld.bossRushActive; bool enraged = npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive); Vector2 vectorCenter = npc.Center; @@ -452,18 +453,18 @@ namespace CalamityMod.NPCs.SupremeCalamitas int damage = expertMode ? 200 : 250; //800 500 if (bulletHellCounter2 < 300) //blasts from above { - Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 4f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 4f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); } else if (bulletHellCounter2 < 600) //blasts from left and right { - Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1000), -3.5f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1000), 3.5f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -3.5f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3.5f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); } else //blasts from above, left, and right { - Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 3f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1000), -3f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1000), 3f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 3f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -3f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); } } } @@ -527,21 +528,21 @@ namespace CalamityMod.NPCs.SupremeCalamitas { if (bulletHellCounter2 % 180 == 0) //blasts from top { - Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 5f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 5f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); } } else if (bulletHellCounter2 < 1500 && bulletHellCounter2 > 1200) { if (bulletHellCounter2 % 180 == 0) //blasts from right { - Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1000), -5f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -5f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); } } else if (bulletHellCounter2 > 1500) { if (bulletHellCounter2 % 180 == 0) //blasts from top { - Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 5f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 5f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); } } bulletHellCounter += 1; @@ -550,16 +551,16 @@ namespace CalamityMod.NPCs.SupremeCalamitas bulletHellCounter = 0; if (bulletHellCounter2 < 1200) //blasts from below { - Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1000), player.position.Y + 1000f, 0f, -4f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1001), player.position.Y + 1000f, 0f, -4f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); } else if (bulletHellCounter2 < 1500) //blasts from left { - Projectile.NewProjectile(player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1000), 3.5f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3.5f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); } else //blasts from left and right { - Projectile.NewProjectile(player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1000), 3f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1000), -3f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -3f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); } } } @@ -602,11 +603,11 @@ namespace CalamityMod.NPCs.SupremeCalamitas int damage = expertMode ? 150 : 200; if (bulletHellCounter2 % 180 == 0) //blasts from top { - Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 5f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 5f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); } if (bulletHellCounter2 % 240 == 0) //fireblasts from above { - Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 10f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 10f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); } bulletHellCounter += 1; if (bulletHellCounter > (enraged ? 9 : 11)) @@ -614,16 +615,16 @@ namespace CalamityMod.NPCs.SupremeCalamitas bulletHellCounter = 0; if (bulletHellCounter2 < 2100) //blasts from above { - Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 4f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 4f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); } else if (bulletHellCounter2 < 2400) //blasts from right { - Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1000), -3.5f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -3.5f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); } else //blasts from left and right { - Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1000), -3.5f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1000), 3.5f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -3.5f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3.5f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); } } } @@ -671,15 +672,16 @@ namespace CalamityMod.NPCs.SupremeCalamitas int damage = expertMode ? 150 : 200; if (bulletHellCounter2 % 180 == 0) //blasts from top { - Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 5f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 5f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); } if (bulletHellCounter2 % 240 == 0) //fireblasts from above { - Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 10f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 10f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); } - if (bulletHellCounter2 % 225 == 0 && expertMode) //giant homing fireballs + int divisor = revenge ? 225 : expertMode ? 450 : 675; + if (bulletHellCounter2 % divisor == 0 && expertMode) //giant homing fireballs { - Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 1f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, passedVar); + Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 1f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, passedVar); passedVar += 1f; } bulletHellCounter += 1; @@ -688,16 +690,16 @@ namespace CalamityMod.NPCs.SupremeCalamitas bulletHellCounter = 0; if (bulletHellCounter2 < 3000) //blasts from below { - Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1000), player.position.Y + 1000f, 0f, -4f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1001), player.position.Y + 1000f, 0f, -4f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); } else if (bulletHellCounter2 < 3300) //blasts from left { - Projectile.NewProjectile(player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1000), 3.5f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3.5f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); } else //blasts from left and right { - Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1000), -3.5f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1000), 3.5f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -3.5f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3.5f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); } } } @@ -745,34 +747,36 @@ namespace CalamityMod.NPCs.SupremeCalamitas int damage = expertMode ? 150 : 200; if (bulletHellCounter2 % 240 == 0) //blasts from top { - Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 5f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 5f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); } if (bulletHellCounter2 % 360 == 0) //fireblasts from above { - Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 10f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 10f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); } if (bulletHellCounter2 % 30 == 0) //projectiles that move in wave pattern { - Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + Main.rand.Next(-500, 500), -5f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); - } + int random = Main.rand.Next(-1000, 1001); + Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + random, -5f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X - 1000f, player.position.Y - random, 5f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + } bulletHellCounter += 1; if (bulletHellCounter > (enraged ? 12 : 14)) { bulletHellCounter = 0; if (bulletHellCounter2 < 3900) //blasts from above { - Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 4f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 4f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); } else if (bulletHellCounter2 < 4200) //blasts from left and right { - Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1000), -3.5f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1000), 3.5f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -3.5f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3.5f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); } else //blasts from above, left, and right { - Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 3f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1000), -3f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1000), 3f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 3f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -3f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); } } } @@ -880,7 +884,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas Projectile projectile = Main.projectile[x]; if (projectile.active && projectile.type == ModContent.ProjectileType()) { - projectile.Kill(); + if (projectile.timeLeft > 90) + projectile.timeLeft = 90; } } @@ -991,13 +996,16 @@ namespace CalamityMod.NPCs.SupremeCalamitas projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType()) { - projectile.Kill(); + if (projectile.timeLeft > 60) + projectile.timeLeft = 60; } - else if (projectile.type == ModContent.ProjectileType() || - projectile.type == ModContent.ProjectileType()) + else if (projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType()) { - projectile.active = false; - } + projectile.ai[1] = 1f; + + if (projectile.timeLeft > 60) + projectile.timeLeft = 60; + } } } despawnProj = false; @@ -1248,6 +1256,13 @@ namespace CalamityMod.NPCs.SupremeCalamitas float num823 = 12f; float num824 = 0.12f; + // Reduce acceleration if target is holding a true melee weapon + Item targetSelectedItem = player.inventory[player.selectedItem]; + if (targetSelectedItem.melee && (targetSelectedItem.shoot == 0 || CalamityMod.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) + { + num824 *= 0.5f; + } + Vector2 vector82 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); float num825 = player.position.X + (player.width / 2) - vector82.X; float num826 = player.position.Y + (player.height / 2) - 550f - vector82.Y; @@ -1328,8 +1343,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas num827 = num828 / num827; num825 *= num827; num826 *= num827; - vector82.X += num825 * 15f; - vector82.Y += num826 * 15f; + vector82.X += num825 * 8f; + vector82.Y += num826 * 8f; Projectile.NewProjectile(vector82.X, vector82.Y, num825, num826, randomShot, num829, 0f, Main.myPlayer, 0f, 0f); } else if (randomShot == 1 && canFireSplitingFireball) @@ -1340,8 +1355,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas num827 = num828 / num827; num825 *= num827; num826 *= num827; - vector82.X += num825 * 15f; - vector82.Y += num826 * 15f; + vector82.X += num825 * 8f; + vector82.Y += num826 * 8f; Projectile.NewProjectile(vector82.X, vector82.Y, num825, num826, randomShot, num829, 0f, Main.myPlayer, 0f, 0f); } else @@ -1428,6 +1443,13 @@ namespace CalamityMod.NPCs.SupremeCalamitas float num412 = 32f; float num413 = 1.2f; + // Reduce acceleration if target is holding a true melee weapon + Item targetSelectedItem = player.inventory[player.selectedItem]; + if (targetSelectedItem.melee && (targetSelectedItem.shoot == 0 || CalamityMod.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) + { + num413 *= 0.5f; + } + int num414 = 1; if (npc.position.X + (npc.width / 2) < player.position.X + player.width) num414 = -1; @@ -1514,6 +1536,13 @@ namespace CalamityMod.NPCs.SupremeCalamitas float num832 = 32f; float num833 = 1.2f; + // Reduce acceleration if target is holding a true melee weapon + Item targetSelectedItem = player.inventory[player.selectedItem]; + if (targetSelectedItem.melee && (targetSelectedItem.shoot == 0 || CalamityMod.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) + { + num833 *= 0.5f; + } + Vector2 vector83 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); float num834 = player.position.X + (player.width / 2) + (num831 * 750) - vector83.X; //600 float num835 = player.position.Y + (player.height / 2) - vector83.Y; @@ -1569,8 +1598,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas num836 = num837 / num836; num834 *= num836; num835 *= num836; - vector83.X += num834 * 15f; - vector83.Y += num835 * 15f; + vector83.X += num834 * 8f; + vector83.Y += num835 * 8f; Projectile.NewProjectile(vector83.X, vector83.Y, num834, num835, num839, num838, 0f, Main.myPlayer, 0f, 0f); } } @@ -1629,7 +1658,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas for (int num388 = 0; num388 < 50; num388++) Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Brimstone, Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f, 0, default, 1f); - Main.PlaySound(SoundID.Roar, npc.position); + Main.PlaySound(SoundID.Roar, (int)npc.position.X, (int)npc.position.Y, 0); } } @@ -1771,6 +1800,13 @@ namespace CalamityMod.NPCs.SupremeCalamitas float num823 = 12f; float num824 = 0.12f; + // Reduce acceleration if target is holding a true melee weapon + Item targetSelectedItem = player.inventory[player.selectedItem]; + if (targetSelectedItem.melee && (targetSelectedItem.shoot == 0 || CalamityMod.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) + { + num824 *= 0.5f; + } + Vector2 vector82 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); float num825 = player.position.X + (player.width / 2) - vector82.X; float num826 = player.position.Y + (player.height / 2) - 550f - vector82.Y; @@ -1852,8 +1888,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas num827 = num828 / num827; num825 *= num827; num826 *= num827; - vector82.X += num825 * 15f; - vector82.Y += num826 * 15f; + vector82.X += num825 * 8f; + vector82.Y += num826 * 8f; Projectile.NewProjectile(vector82.X, vector82.Y, num825, num826, randomShot, num829, 0f, Main.myPlayer, 0f, 0f); } else if (randomShot == 1 && canFireSplitingFireball) @@ -1864,8 +1900,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas num827 = num828 / num827; num825 *= num827; num826 *= num827; - vector82.X += num825 * 15f; - vector82.Y += num826 * 15f; + vector82.X += num825 * 8f; + vector82.Y += num826 * 8f; Projectile.NewProjectile(vector82.X, vector82.Y, num825, num826, randomShot, num829, 0f, Main.myPlayer, 0f, 0f); } else @@ -1947,6 +1983,14 @@ namespace CalamityMod.NPCs.SupremeCalamitas { float num412 = 32f; float num413 = 1.2f; + + // Reduce acceleration if target is holding a true melee weapon + Item targetSelectedItem = player.inventory[player.selectedItem]; + if (targetSelectedItem.melee && (targetSelectedItem.shoot == 0 || CalamityMod.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) + { + num413 *= 0.5f; + } + int num414 = 1; if (npc.position.X + (npc.width / 2) < player.position.X + player.width) num414 = -1; @@ -2033,6 +2077,13 @@ namespace CalamityMod.NPCs.SupremeCalamitas float num832 = 32f; float num833 = 1.2f; + // Reduce acceleration if target is holding a true melee weapon + Item targetSelectedItem = player.inventory[player.selectedItem]; + if (targetSelectedItem.melee && (targetSelectedItem.shoot == 0 || CalamityMod.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) + { + num833 *= 0.5f; + } + Vector2 vector83 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); float num834 = player.position.X + (player.width / 2) + (num831 * 750) - vector83.X; //600 float num835 = player.position.Y + (player.height / 2) - vector83.Y; @@ -2088,8 +2139,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas num836 = num837 / num836; num834 *= num836; num835 *= num836; - vector83.X += num834 * 15f; - vector83.Y += num835 * 15f; + vector83.X += num834 * 8f; + vector83.Y += num835 * 8f; int shot = Projectile.NewProjectile(vector83.X, vector83.Y, num834, num835, num839, num838, 0f, Main.myPlayer, 0f, 0f); } } @@ -2150,7 +2201,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas // Weapons // All non-hybrid weapons are listed twice so that the drop rates are actually equal between each unique weapon - DropHelper.DropItemFromSetCondition(npc, Main.expertMode, + DropHelper.DropItemFromSetCondition(npc, true, Main.expertMode, ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), @@ -2172,11 +2223,11 @@ namespace CalamityMod.NPCs.SupremeCalamitas ModContent.ItemType(), ModContent.ItemType(), //Temporal Umbrella ModContent.ItemType(), ModContent.ItemType() ); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.revenge); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.expertMode, CalamityWorld.revenge); // Vanity - DropHelper.DropItem(npc, ModContent.ItemType()); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.death); + DropHelper.DropItem(npc, ModContent.ItemType(), Main.expertMode); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.death); // Other DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); diff --git a/NPCs/SupremeCalamitas/SupremeCataclysm.cs b/NPCs/SupremeCalamitas/SupremeCataclysm.cs index fdb0481e5f..96afbf5f59 100644 --- a/NPCs/SupremeCalamitas/SupremeCataclysm.cs +++ b/NPCs/SupremeCalamitas/SupremeCataclysm.cs @@ -1,7 +1,6 @@ using CalamityMod.Dusts; using CalamityMod.Projectiles.Boss; using CalamityMod.Projectiles.Summon; -using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -83,7 +82,15 @@ namespace CalamityMod.NPCs.SupremeCalamitas npc.TargetClosest(true); float num676 = 60f; float num677 = 1.5f; - float distanceX = 750f; + + // Reduce acceleration if target is holding a true melee weapon + Item targetSelectedItem = Main.player[npc.target].inventory[Main.player[npc.target].selectedItem]; + if (targetSelectedItem.melee && (targetSelectedItem.shoot == 0 || CalamityMod.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) + { + num677 *= 0.5f; + } + + float distanceX = 750f; if (npc.ai[3] < 750f) { npc.ai[3] += 1f; diff --git a/NPCs/SupremeCalamitas/SupremeCatastrophe.cs b/NPCs/SupremeCalamitas/SupremeCatastrophe.cs index ade342568a..d895ac72bd 100644 --- a/NPCs/SupremeCalamitas/SupremeCatastrophe.cs +++ b/NPCs/SupremeCalamitas/SupremeCatastrophe.cs @@ -1,7 +1,6 @@ using CalamityMod.Dusts; using CalamityMod.Projectiles.Boss; using CalamityMod.Projectiles.Summon; -using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -83,7 +82,15 @@ namespace CalamityMod.NPCs.SupremeCalamitas npc.TargetClosest(true); float num676 = 60f; float num677 = 1.5f; - float distanceX = 750f; + + // Reduce acceleration if target is holding a true melee weapon + Item targetSelectedItem = Main.player[npc.target].inventory[Main.player[npc.target].selectedItem]; + if (targetSelectedItem.melee && (targetSelectedItem.shoot == 0 || CalamityMod.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) + { + num677 *= 0.5f; + } + + float distanceX = 750f; if (npc.ai[3] < 750f) { npc.ai[3] += 1f; diff --git a/NPCs/TownNPCs/DILF.cs b/NPCs/TownNPCs/DILF.cs index dabb943dcd..f042fc5f0c 100644 --- a/NPCs/TownNPCs/DILF.cs +++ b/NPCs/TownNPCs/DILF.cs @@ -52,19 +52,21 @@ namespace CalamityMod.NPCs.TownNPCs animationType = NPCID.Guide; } - public override bool CanTownNPCSpawn(int numTownNPCs, int money) - { - return CalamityWorld.downedCryogen; - } + public override void AI() + { + if (!CalamityWorld.foundHomePermafrost && !npc.homeless) + { + CalamityWorld.foundHomePermafrost = true; + } + } - public override string TownNPCName() - { - return "Permafrost"; - } + public override bool CanTownNPCSpawn(int numTownNPCs, int money) => CalamityWorld.downedCryogen; + + public override string TownNPCName() => "Permafrost"; public override string GetChat() { - if (npc.homeless) //not sure how to check if he has ever found a home before (to make this dialogue only run when he first spawns) + if (npc.homeless && !CalamityWorld.foundHomePermafrost) { if (Main.rand.NextBool(2)) return "I deeply appreciate you rescuing me from being trapped within my frozen castle... It's been many, many years..."; @@ -181,6 +183,7 @@ namespace CalamityMod.NPCs.TownNPCs shop.item[nextSlot].SetDefaults(ModContent.ItemType()); nextSlot++; shop.item[nextSlot].SetDefaults(ModContent.ItemType()); + shop.item[nextSlot].shopCustomPrice = 1000000; //I think this is 5 platinum nextSlot++; shop.item[nextSlot].SetDefaults(ModContent.ItemType()); shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 15, 0, 0); diff --git a/NPCs/TownNPCs/FAP.cs b/NPCs/TownNPCs/FAP.cs index 66686008bd..65b26c7346 100644 --- a/NPCs/TownNPCs/FAP.cs +++ b/NPCs/TownNPCs/FAP.cs @@ -1,6 +1,6 @@ using CalamityMod.Items.Placeables.Furniture; using CalamityMod.Items.Potions.Alcohol; -using CalamityMod.Projectiles.Magic; +using CalamityMod.Projectiles.Typeless; using CalamityMod.World; using System.Collections.Generic; using Terraria; @@ -57,15 +57,10 @@ namespace CalamityMod.NPCs.TownNPCs for (int k = 0; k < Main.maxPlayers; k++) { Player player = Main.player[k]; - if (player.active) + bool hasVodka = player.InventoryHas(ModContent.ItemType())/* || player.PortableStorageHas(ModContent.ItemType())*/; + if (player.active && hasVodka) { - for (int j = 0; j < player.inventory.Length; j++) - { - if (player.inventory[j].type == ModContent.ItemType()) - { - return Main.hardMode; - } - } + return Main.hardMode || CalamityWorld.spawnedCirrus; } } return CalamityWorld.spawnedCirrus; @@ -94,7 +89,7 @@ namespace CalamityMod.NPCs.TownNPCs int random = Main.rand.Next(4); if (random == 0) { - return "Hey! Nice night. I'm gonna make some Bloody Marys. Celery included. Want one?"; + return "Hey, nice night! I'm gonna make some Bloody Marys, celery included. Want one?"; } else if (random == 1) { @@ -141,7 +136,7 @@ namespace CalamityMod.NPCs.TownNPCs if (BirthdayParty.PartyIsUp) dialogue.Add("You'll always find me at parties where booze is involved...well, you'll always find booze where I'm involved."); - if (Main.invasionType == 4) + if (Main.invasionType == InvasionID.MartianMadness) dialogue.Add("Shoot down the space invaders! Sexy time will be postponed if we are invaded by UFOs!"); if (CalamityWorld.downedCryogen) @@ -194,8 +189,7 @@ namespace CalamityMod.NPCs.TownNPCs if (Main.player[Main.myPlayer].Calamity().chibii) dialogue.Add("Is that a toy? Looks like something I'd carry around if I was 5 years old."); - if ((Main.player[Main.myPlayer].Calamity().sirenBoobs && !Main.player[Main.myPlayer].Calamity().sirenBoobsHide) || - (Main.player[Main.myPlayer].Calamity().sirenBoobsAlt && !Main.player[Main.myPlayer].Calamity().sirenBoobsAltHide)) + if (Main.player[Main.myPlayer].Calamity().sirenBoobs && !Main.player[Main.myPlayer].Calamity().sirenBoobsHide) dialogue.Add("Nice scales...did it get hot in here?"); if (Main.player[Main.myPlayer].Calamity().fabsolVodka) @@ -386,7 +380,7 @@ namespace CalamityMod.NPCs.TownNPCs public override void TownNPCAttackProj(ref int projType, ref int attackDelay) { - projType = ModContent.ProjectileType(); + projType = ModContent.ProjectileType(); attackDelay = 1; } diff --git a/NPCs/TownNPCs/SEAHOE.cs b/NPCs/TownNPCs/SEAHOE.cs index 2224f11c68..0313bcebb4 100644 --- a/NPCs/TownNPCs/SEAHOE.cs +++ b/NPCs/TownNPCs/SEAHOE.cs @@ -123,8 +123,7 @@ namespace CalamityMod.NPCs.TownNPCs dialogue.Add("Ah, nice duds, my child!"); } - if ((Main.player[Main.myPlayer].Calamity().sirenBoobs && !Main.player[Main.myPlayer].Calamity().sirenBoobsHide) || - (Main.player[Main.myPlayer].Calamity().sirenBoobsAlt && !Main.player[Main.myPlayer].Calamity().sirenBoobsAltHide)) + if (Main.player[Main.myPlayer].Calamity().sirenBoobs && !Main.player[Main.myPlayer].Calamity().sirenBoobsHide) { dialogue.Add("Shouldn't you be wearing a clam bra?"); } diff --git a/NPCs/TownNPCs/THIEF.cs b/NPCs/TownNPCs/THIEF.cs index e7d0e8556a..d7b43f5d9b 100644 --- a/NPCs/TownNPCs/THIEF.cs +++ b/NPCs/TownNPCs/THIEF.cs @@ -25,7 +25,7 @@ namespace CalamityMod.NPCs.TownNPCs "Penelope", "Marisa", "Maribel", "Valerie", "Jessica", "Rowan", "Jessie", "Jade", "Hearn", - "Amber", "Anne", "Indiana", + "Amber", "Anne", "Indiana", "Xplizzy" }; public override void SetStaticDefaults() @@ -71,9 +71,10 @@ namespace CalamityMod.NPCs.TownNPCs for (int k = 0; k < Main.maxPlayers; k++) { Player player = Main.player[k]; - if (player.active && player.InventoryHas(ItemID.PlatinumCoin)) + bool rich = player.InventoryHas(ItemID.PlatinumCoin) || player.PortableStorageHas(ItemID.PlatinumCoin); + if (player.active && rich) { - return NPC.downedBoss3; + return NPC.downedBoss3 || CalamityWorld.spawnedBandit; } } return CalamityWorld.spawnedBandit; @@ -192,13 +193,13 @@ namespace CalamityMod.NPCs.TownNPCs public string Refund() { int goblinIndex = NPC.FindFirstNPC(NPCID.GoblinTinkerer); - if (goblinIndex != -1 && Main.LocalPlayer.Calamity().reforges >= 10) + if (goblinIndex != -1 && CalamityWorld.Reforges >= 1) { - Main.LocalPlayer.Calamity().reforges = 0; - Main.LocalPlayer.SellItem((int)Main.LocalPlayer.Calamity().moneyStolenByBandit, 1); - Main.LocalPlayer.Calamity().moneyStolenByBandit = 0; + CalamityWorld.Reforges = 0; + Main.LocalPlayer.SellItem(CalamityWorld.MoneyStolenByBandit, 1); + CalamityWorld.MoneyStolenByBandit = 0; NPC goblinFucker = Main.npc[goblinIndex]; - Main.PlaySound(SoundID.Coins, -1, -1, 1, 1f, 0f); //money dink sound + Main.PlaySound(SoundID.Coins, -1, -1, 1, 1f, 0f); // Money dink sound switch (Main.rand.Next(2)) { case 0: @@ -206,8 +207,9 @@ namespace CalamityMod.NPCs.TownNPCs case 1: return "Hey, if government officials can get tax, why can't I? The heck do you mean that these two things are nothing alike?"; } + CalamityMod.UpdateServerBoolean(); } - return "Sorry, I got nothing."; + return "Sorry, I got nothing. Perhaps you could reforge something and come back later..."; } public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) @@ -251,6 +253,8 @@ namespace CalamityMod.NPCs.TownNPCs shop.item[nextSlot].SetDefaults(ModContent.ItemType()); shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 40, 0, 0); nextSlot++; + shop.item[nextSlot].SetDefaults(ItemID.TigerClimbingGear); + nextSlot++; if (CalamityWorld.downedSlimeGod) { shop.item[nextSlot].SetDefaults(ModContent.ItemType()); diff --git a/NPCs/Yharon/DetonatingFlare.cs b/NPCs/Yharon/DetonatingFlare.cs index 570cd234b7..e5aed4aac6 100644 --- a/NPCs/Yharon/DetonatingFlare.cs +++ b/NPCs/Yharon/DetonatingFlare.cs @@ -164,7 +164,7 @@ namespace CalamityMod.NPCs.Yharon if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) { int num8 = Main.expertMode ? 75 : 90; - int num9 = 467; + int num9 = ProjectileID.CultistBossFireBall; Projectile.NewProjectile(vector.X, vector.Y, num4, num5, num9, num8, 0f, Main.myPlayer, 0f, 0f); } } diff --git a/NPCs/Yharon/DetonatingFlare2.cs b/NPCs/Yharon/DetonatingFlare2.cs index 4c7178c56b..a64bd8c3b0 100644 --- a/NPCs/Yharon/DetonatingFlare2.cs +++ b/NPCs/Yharon/DetonatingFlare2.cs @@ -31,7 +31,7 @@ namespace CalamityMod.NPCs.Yharon npc.noGravity = true; npc.noTileCollide = true; npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit52; + npc.HitSound = SoundID.NPCHit52; npc.DeathSound = SoundID.NPCDeath55; npc.alpha = 255; } diff --git a/NPCs/Yharon/Yharon.cs b/NPCs/Yharon/Yharon.cs index f07984ca70..17b23cde45 100644 --- a/NPCs/Yharon/Yharon.cs +++ b/NPCs/Yharon/Yharon.cs @@ -47,6 +47,7 @@ namespace CalamityMod.NPCs.Yharon public static float Phase1_DR = 0.24f; public static float Phase2_DR = 0.26f; + public static float ChargeTelegraph_DR = 0.75f; public static float EnragedDR = 0.9f; public override void SetStaticDefaults() @@ -93,7 +94,7 @@ namespace CalamityMod.NPCs.Yharon music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/YHARONREBIRTH"); else music = MusicID.Boss1; - if (CalamityWorld.downedBuffedMothron || CalamityWorld.bossRushActive) + if (CalamityWorld.buffedEclipse || CalamityWorld.bossRushActive) { if (calamityModMusic != null) music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/YHARON"); @@ -174,7 +175,7 @@ namespace CalamityMod.NPCs.Yharon if (startSecondAI) { // Despawn and drop phase 1 loot - if (!CalamityWorld.downedBuffedMothron && !CalamityWorld.bossRushActive) + if (!CalamityWorld.buffedEclipse && !CalamityWorld.bossRushActive) { npc.DeathSound = null; npc.dontTakeDamage = true; @@ -193,7 +194,7 @@ namespace CalamityMod.NPCs.Yharon if (npc.timeLeft < 5) { - string key = "Mods.CalamityMod.DargonBossText2"; + /*string key = "Mods.CalamityMod.DargonBossText2"; Color messageColor = Color.Orange; if (Main.netMode == NetmodeID.SinglePlayer) { @@ -202,7 +203,7 @@ namespace CalamityMod.NPCs.Yharon else if (Main.netMode == NetmodeID.Server) { NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } + }*/ startSecondAI = false; @@ -220,7 +221,16 @@ namespace CalamityMod.NPCs.Yharon } if (phaseOneLoot) + { + npc.boss = false; + + if (dropLoot) + npc.NPCLoot(); + + npc.boss = true; + npc.Calamity().AITimer = 0; + } // Don't drop phase 1 loot phaseOneLoot = false; @@ -239,9 +249,10 @@ namespace CalamityMod.NPCs.Yharon } // Phase bools - bool phase2Check = npc.life <= npc.lifeMax * (revenge ? 0.8 : (expertMode ? 0.7 : 0.5)); - bool phase3Check = npc.life <= npc.lifeMax * (revenge ? 0.5 : (expertMode ? 0.4 : 0.25)); + bool phase2Check = death || npc.life <= npc.lifeMax * (revenge ? 0.8 : (expertMode ? 0.7 : 0.5)); + bool phase3Check = npc.life <= npc.lifeMax * (death ? 0.6 : (revenge ? 0.5 : (expertMode ? 0.4 : 0.25))); bool phase4Check = npc.life <= npc.lifeMax * 0.1; + bool phase1Change = npc.ai[0] > -1f; bool phase2Change = npc.ai[0] > 5f; bool phase3Change = npc.ai[0] > 12f; bool isCharging = npc.ai[3] < 20f; @@ -254,6 +265,14 @@ namespace CalamityMod.NPCs.Yharon float acceleration = expertMode ? 0.7f : 0.69f; float velocity = expertMode ? 11f : 10.8f; + // Damage immunity + if (phase3Change) + npc.dontTakeDamage = phase4Check; + else if (phase2Change) + npc.dontTakeDamage = phase3Check; + else if (phase1Change) + npc.dontTakeDamage = phase2Check; + if (npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) { acceleration = 0.95f; @@ -410,8 +429,10 @@ namespace CalamityMod.NPCs.Yharon } } - // Set DR based on protection boost (aka enrage) - npc.Calamity().DR = protectionBoost ? EnragedDR : Phase1_DR; + // Set DR based on protection boost (aka enrage) + bool chargeTelegraph = (npc.ai[0] == 0f || npc.ai[0] == 6f || npc.ai[0] == 13f) && npc.localAI[1] > 0f; + bool bulletHell = npc.ai[0] == 8f || npc.ai[0] == 15f; + npc.Calamity().DR = protectionBoost ? EnragedDR : ((chargeTelegraph || bulletHell) ? ChargeTelegraph_DR : Phase1_DR); // Trigger spawn effects if (npc.localAI[0] == 0f) @@ -467,8 +488,6 @@ namespace CalamityMod.NPCs.Yharon // Spawn effects if (npc.ai[0] == -1f) { - npc.dontTakeDamage = true; - npc.velocity *= 0.98f; int num1467 = Math.Sign(player.Center.X - vectorCenter.X); @@ -526,8 +545,6 @@ namespace CalamityMod.NPCs.Yharon // Phase switch else if (npc.ai[0] == 0f && !player.dead) { - npc.dontTakeDamage = false; - if (npc.ai[1] == 0f) npc.ai[1] = 500 * Math.Sign((vectorCenter - player.Center).X); @@ -732,8 +749,6 @@ namespace CalamityMod.NPCs.Yharon // Enter new phase else if (npc.ai[0] == 4f) { - npc.dontTakeDamage = true; - npc.velocity *= 0.98f; npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); @@ -772,8 +787,6 @@ namespace CalamityMod.NPCs.Yharon // Phase switch else if (npc.ai[0] == 6f && !player.dead) { - npc.dontTakeDamage = false; - if (npc.ai[1] == 0f) npc.ai[1] = 500 * Math.Sign((vectorCenter - player.Center).X); @@ -1023,8 +1036,6 @@ namespace CalamityMod.NPCs.Yharon // Enter new phase else if (npc.ai[0] == 10f) { - npc.dontTakeDamage = true; - npc.velocity *= 0.98f; npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); @@ -1061,7 +1072,7 @@ namespace CalamityMod.NPCs.Yharon // Flare Dust that speeds up and whips around in a wave else if (npc.ai[0] == 12f) { - if (npc.ai[2] == 0f) + if (npc.ai[2] == 0f) Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); npc.ai[2] += 1f; @@ -1095,8 +1106,6 @@ namespace CalamityMod.NPCs.Yharon // Phase switch else if (npc.ai[0] == 13f && !player.dead) { - npc.dontTakeDamage = phase4Check; - if (npc.ai[1] == 0f) npc.ai[1] = 500 * Math.Sign((vectorCenter - player.Center).X); @@ -1284,8 +1293,6 @@ namespace CalamityMod.NPCs.Yharon // Charge else if (npc.ai[0] == 14f) { - npc.dontTakeDamage = phase4Check; - ChargeDust(7, pie); npc.ai[2] += 1f; @@ -1302,8 +1309,6 @@ namespace CalamityMod.NPCs.Yharon // Flare Dust bullet hell else if (npc.ai[0] == 15f) { - npc.dontTakeDamage = phase4Check; - if (npc.ai[2] == 0f) { Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); @@ -1323,7 +1328,7 @@ namespace CalamityMod.NPCs.Yharon // Rotate spiral by 7.2 * (300 / 12) = +90 degrees and then back -90 degrees if (Main.netMode != NetmodeID.MultiplayerClient) - DoFlareDustBulletHell(1, flareDustPhaseTimer, projectileDamage, 8, 12f, 7.2f, false); + DoFlareDustBulletHell(1, flareDustPhaseTimer, projectileDamage, 8, 12f, 3.6f, false); } npc.velocity = npc.velocity.RotatedBy(-(double)spinPhaseRotation * (float)npc.direction); @@ -1342,8 +1347,6 @@ namespace CalamityMod.NPCs.Yharon // Infernado else if (npc.ai[0] == 16f) { - npc.dontTakeDamage = phase4Check; - npc.velocity *= 0.98f; npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); @@ -1367,8 +1370,6 @@ namespace CalamityMod.NPCs.Yharon // Enter new phase else if (npc.ai[0] == 17f) { - npc.dontTakeDamage = true; - npc.velocity *= 0.98f; npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); @@ -1390,8 +1391,6 @@ namespace CalamityMod.NPCs.Yharon // Fast charge else if (npc.ai[0] == 18f) { - npc.dontTakeDamage = phase4Check; - ChargeDust(14, pie); npc.ai[2] += 1f; @@ -1408,8 +1407,6 @@ namespace CalamityMod.NPCs.Yharon // Fireball ring else if (npc.ai[0] == 19f) { - npc.dontTakeDamage = phase4Check; - if (npc.ai[2] == 0f) Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); @@ -1442,8 +1439,6 @@ namespace CalamityMod.NPCs.Yharon // Fireball breath else if (npc.ai[0] == 20f) { - npc.dontTakeDamage = phase4Check; - if (npc.ai[1] == 0f) npc.ai[1] = 400 * Math.Sign((vectorCenter - player.Center).X); @@ -1489,9 +1484,9 @@ namespace CalamityMod.NPCs.Yharon #region AI2 public void Yharon_AI2(bool expertMode, bool revenge, bool death, float pie) { - bool phase2 = npc.life <= npc.lifeMax * (revenge ? 0.8 : (expertMode ? 0.7 : 0.5)); - bool phase3 = npc.life <= npc.lifeMax * (revenge ? 0.5 : (expertMode ? 0.4 : 0.25)); - bool phase4 = npc.life <= npc.lifeMax * 0.15 && revenge; + bool phase2 = death || npc.life <= npc.lifeMax * (revenge ? 0.8 : (expertMode ? 0.7 : 0.5)); + bool phase3 = npc.life <= npc.lifeMax * (death ? 0.65 : (revenge ? 0.5 : (expertMode ? 0.4 : 0.25))); + bool phase4 = npc.life <= npc.lifeMax * (death ? 0.3 : 0.2) && revenge; if (npc.ai[0] != 8f) { @@ -1518,35 +1513,56 @@ namespace CalamityMod.NPCs.Yharon else if (Main.netMode == NetmodeID.Server) NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); } - if (invincibilityCounter < 900) - { - phase2 = phase3 = phase4 = false; - invincibilityCounter += 1; + if (invincibilityCounter < 900) + { + phase2 = phase3 = phase4 = false; - int heal = 5; //900 / 5 = 180 - healCounter += 1; - if (healCounter >= heal) - { - healCounter = 0; + invincibilityCounter += 1; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int healAmt = npc.lifeMax / 200; - if (healAmt > npc.lifeMax - npc.life) - healAmt = npc.lifeMax - npc.life; + int heal = 5; //900 / 5 = 180 + healCounter += 1; + if (healCounter >= heal) + { + healCounter = 0; - if (healAmt > 0) - { - npc.life += healAmt; - npc.HealEffect(healAmt, true); - npc.netUpdate = true; - } - } - } - } - else - npc.dontTakeDamage = npc.ai[0] == 9f; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int healAmt = npc.lifeMax / 200; + if (healAmt > npc.lifeMax - npc.life) + healAmt = npc.lifeMax - npc.life; + + if (healAmt > 0) + { + npc.life += healAmt; + npc.HealEffect(healAmt, true); + npc.netUpdate = true; + } + } + } + } + else + { + // Damage immunity + switch (secondPhasePhase) + { + case 1: + npc.dontTakeDamage = phase2; + break; + case 2: + npc.dontTakeDamage = phase3; + break; + case 3: + npc.dontTakeDamage = phase4; + break; + case 4: + npc.dontTakeDamage = false; + break; + } + + if (!npc.dontTakeDamage) + npc.dontTakeDamage = npc.ai[0] == 9f; + } // Acquire target and determine enrage state if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) @@ -1590,15 +1606,17 @@ namespace CalamityMod.NPCs.Yharon protectionBoost = false; npc.damage = npc.defDamage; - if (phase4) + if (secondPhasePhase == 4) npc.damage = (int)(npc.defDamage * 1.1f); } // Set DR based on protection boost (aka enrage) - npc.Calamity().DR = protectionBoost ? EnragedDR : Phase2_DR; + bool chargeTelegraph = npc.ai[0] < 2f && npc.localAI[1] > 0f; + bool bulletHell = npc.ai[0] == 5f; + npc.Calamity().DR = protectionBoost ? EnragedDR : ((chargeTelegraph || bulletHell) ? ChargeTelegraph_DR : Phase2_DR); int projectileDamage = expertMode ? 110 : 125; - if (phase4) + if (secondPhasePhase == 4) projectileDamage = (int)(projectileDamage * 1.1); float phaseSwitchTimer = expertMode ? 30f : 32f; @@ -1607,7 +1625,7 @@ namespace CalamityMod.NPCs.Yharon float chargeTime = expertMode ? 32f : 35f; float chargeSpeed = expertMode ? 32f : 30f; float fastChargeVelocityMultiplier = 1.5f; - int fastChargeTelegraphTimer = phase4 ? 60 : 120; + int fastChargeTelegraphTimer = secondPhasePhase == 4 ? 60 : 120; float fireballBreathTimer = 60f; float fireballBreathPhaseTimer = fireballBreathTimer + 120f; @@ -1621,13 +1639,12 @@ namespace CalamityMod.NPCs.Yharon float splittingFireballBreathYVelocityTimer = 40f; float splittingFireballBreathPhaseTimer = splittingFireballBreathTimer + splittingFireballBreathTimer2 + splittingFireballBreathYVelocityTimer; - float spinPhaseTimer = phase4 ? 180f : 240f; + float spinPhaseTimer = secondPhasePhase == 4 ? 180f : 240f; float spinTime = spinPhaseTimer / 2; float spinRotation = MathHelper.TwoPi * 3 / spinTime; float spinPhaseVelocity = 25f; int flareDustSpawnDivisor = 24; - int flareDustSpawnDivisor2 = 5; - int flareDustSpawnDivisor3 = 12 + (phase4 ? 4 : 0); + int flareDustSpawnDivisor3 = 12 + (secondPhasePhase == 4 ? 4 : 0); float increasedIdleTimeAfterBulletHell = -120f; float flareSpawnDecelerationTimer = 90f; @@ -1821,7 +1838,7 @@ namespace CalamityMod.NPCs.Yharon } } - if (num28 == 5 && npc.ai[1] < phaseSwitchTimer + teleportPhaseTimer - 15f) + if (num28 == 5 && npc.ai[1] < phaseSwitchTimer + teleportPhaseTimer) { float newRotation = npc.DirectionTo(targetData.Center).ToRotation(); float amount = 0.04f; @@ -1841,13 +1858,14 @@ namespace CalamityMod.NPCs.Yharon npc.alpha = 255; } - if (npc.ai[1] == phaseSwitchTimer + 15f) + float timeBeforeTeleport = teleportPhaseTimer - 15f; + if (npc.ai[1] == phaseSwitchTimer + timeBeforeTeleport) Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[1] == phaseSwitchTimer + 15f) + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[1] == phaseSwitchTimer + timeBeforeTeleport) { teleportLocation = Main.rand.NextBool(2) ? (revenge ? 500 : 600) : (revenge ? -500 : -600); - Vector2 center = targetData.Center + new Vector2(-npc.ai[2], teleportLocation); + Vector2 center = targetData.Center + new Vector2(-npc.ai[2] * 500f, teleportLocation); npcCenter = npc.Center = center; } @@ -1866,7 +1884,7 @@ namespace CalamityMod.NPCs.Yharon npc.rotation = npc.rotation.AngleTowards(newRotation, amount); npc.localAI[1] += 1f; - if (npc.localAI[1] == fastChargeTelegraphTimer - (phase4 ? 30 : 60)) + if (npc.localAI[1] == fastChargeTelegraphTimer - (secondPhasePhase == 4 ? 30 : 60)) Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); return; @@ -2108,7 +2126,7 @@ namespace CalamityMod.NPCs.Yharon // Fireball spin else if (npc.ai[0] == 5f) { - npc.velocity = npc.velocity.RotatedBy(-(double)spinRotation * (float)npc.direction); + npc.velocity = npc.velocity.RotatedBy(-(double)spinRotation * (float)npc.direction); npc.rotation -= spinRotation * npc.direction; if (npc.ai[1] == 1f) @@ -2120,40 +2138,30 @@ namespace CalamityMod.NPCs.Yharon npc.ai[1] += 1f; if (Main.netMode != NetmodeID.MultiplayerClient) { - if (phase3) + if (secondPhasePhase >= 3) { // Rotate spiral by 9 * (240 / 12) = +90 degrees and then back -90 degrees // For phase 4: Rotate spiral by 18 * (240 / 16) = +135 degrees and then back -135 degrees if (npc.ai[1] % flareDustSpawnDivisor3 == 0f) - DoFlareDustBulletHell(1, (int)spinPhaseTimer, projectileDamage, phase4 ? 12 : 10, phase4 ? 16f : 12f, phase4 ? 18f : 9f, true); - } - else if (phase2) - { - if (npc.ai[1] % flareDustSpawnDivisor == 0f) { - int totalProjectiles = 38 - (int)(npc.ai[1] / 12f); // 36 for first ring, 18 for last ring - DoFlareDustBulletHell(0, (int)spinPhaseTimer, projectileDamage, totalProjectiles, 0f, 0f, true); + int totalProjectiles = secondPhasePhase == 4 ? 12 : 10; + float projectileVelocity = secondPhasePhase == 4 ? 16f : 12f; + float radialOffset = secondPhasePhase == 4 ? 2.8f : 3.2f; + DoFlareDustBulletHell(1, (int)spinPhaseTimer, projectileDamage, totalProjectiles, projectileVelocity, radialOffset, true); } } else { - if (npc.ai[1] % flareDustSpawnDivisor2 == 0f) + if (npc.ai[1] % flareDustSpawnDivisor == 0f) { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - float xOffset = 30f; - Vector2 position = npc.Center + new Vector2((110f + xOffset) * npc.direction, -20f).RotatedBy(npc.rotation); - Vector2 projectileVelocity = targetData.Center - position; - projectileVelocity.Normalize(); - projectileVelocity *= 0.1f; - Projectile.NewProjectile(position, projectileVelocity, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 0f, 0f); - } + int totalProjectiles = (secondPhasePhase == 2 ? 42 : 38) - (int)(npc.ai[1] / 12f); // 36 for first ring, 18 for last ring + DoFlareDustBulletHell(0, (int)spinPhaseTimer, projectileDamage, totalProjectiles, 0f, 0f, true); } } - if (npc.ai[1] == 210f && phase4 && useTornado) + if (npc.ai[1] == 210f && secondPhasePhase == 4 && useTornado) { useTornado = false; Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0f, 0f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 1f, npc.target + 1); @@ -2163,7 +2171,7 @@ namespace CalamityMod.NPCs.Yharon if (npc.ai[1] >= spinPhaseTimer) { npc.ai[0] = 1f; - npc.ai[1] = phase2 ? increasedIdleTimeAfterBulletHell : 0f; + npc.ai[1] = increasedIdleTimeAfterBulletHell; npc.ai[2] = 0f; npc.localAI[2] = 0f; npc.velocity /= 2f; @@ -2282,7 +2290,7 @@ namespace CalamityMod.NPCs.Yharon } npc.ai[2] += 1f; - if (npc.ai[2] >= teleportPhaseTimer * (phase4 ? 0.5f : 1f)) + if (npc.ai[2] >= teleportPhaseTimer) { npc.ai[0] = 1f; npc.ai[1] = 0f; @@ -2306,7 +2314,7 @@ namespace CalamityMod.NPCs.Yharon if (npc.ai[2] == 120f) { - if (phase4) + if (secondPhasePhase == 4) { for (int x = 0; x < 1000; x++) { @@ -2468,7 +2476,8 @@ namespace CalamityMod.NPCs.Yharon Projectile.NewProjectile(flareDustBulletHellSpawn, vector2, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 2f, 0f); } - npc.localAI[2] += (aiVariableUsed < (timer / 2)) ? radialOffset : -radialOffset; + float newRadialOffset = (int)aiVariableUsed / (timer / 4) % 2f == 0f ? radialOffset : -radialOffset; + npc.localAI[2] += newRadialOffset; break; default: @@ -2808,7 +2817,7 @@ namespace CalamityMod.NPCs.Yharon } // These drops only occur in Phase 2 (where you actually kill Yharon) - if (startSecondAI) + if (startSecondAI && !phaseOneLoot) { // Materials int soulFragMin = Main.expertMode ? 22 : 15; @@ -2816,11 +2825,11 @@ namespace CalamityMod.NPCs.Yharon DropHelper.DropItem(npc, ModContent.ItemType(), true, soulFragMin, soulFragMax); // Equipment - DropHelper.DropItem(npc, ModContent.ItemType()); + DropHelper.DropItem(npc, ModContent.ItemType(), Main.expertMode); // Weapons - DropHelper.DropItemChance(npc, ModContent.ItemType(), DropHelper.RareVariantDropRateInt); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 100); //not affected by defiled and not a leggie + DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode, DropHelper.RareVariantDropRateInt); + DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode, 100); //not affected by defiled and not a leggie // Vanity DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); @@ -3022,11 +3031,11 @@ namespace CalamityMod.NPCs.Yharon { for (int k = 0; k < 5; k++) { - Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } if (npc.life <= 0) { - DoFireRing(150, 1000, 0f); + DoFireRing(150, (Main.expertMode || CalamityWorld.bossRushActive) ? 125 : 150, 0f); npc.position.X = npc.position.X + (npc.width / 2); npc.position.Y = npc.position.Y + (npc.height / 2); npc.width = 300; diff --git a/Prefixes/AccessoryPrefix.cs b/Prefixes/AccessoryPrefix.cs index b0646d2231..0235bbd3d0 100644 --- a/Prefixes/AccessoryPrefix.cs +++ b/Prefixes/AccessoryPrefix.cs @@ -27,7 +27,6 @@ namespace CalamityMod.Prefixes { if (base.Autoload(ref name)) { - //Damage, Use Time, Crit, Velocity, SS Dmg AccessoryModifiers = new List(); AddAccessoryPrefix(mod, AccPrefixType.Quiet, 1.02f); AddAccessoryPrefix(mod, AccPrefixType.Cloaked, 1.04f); diff --git a/Prefixes/RoguePrefix.cs b/Prefixes/RoguePrefix.cs index 180539af9d..3943122204 100644 --- a/Prefixes/RoguePrefix.cs +++ b/Prefixes/RoguePrefix.cs @@ -93,10 +93,17 @@ namespace CalamityMod.Prefixes public override void ValidateItem(Item item, ref bool invalid) { - if (item.damage == Math.Round(item.damage * damageMult)) + if (item.damage == Math.Round(item.damage * damageMult) && damageMult != 1f) invalid = true; - if (item.useAnimation == Math.Round(item.useAnimation * useTimeMult)) + if (item.useAnimation == Math.Round(item.useAnimation * useTimeMult) && useTimeMult != 1f) invalid = true; + // This code is commented out because CanRoll already guarantees that rogue prefixes will never appear on consumable items. + // Setting invalid to true doesn't do anything good. + // It just makes prefixed consumable rogue weapons put TML in an infinite loop looking for an appropriate prefix. + /* + if (item.consumable) + invalid = true; + */ } } diff --git a/Projectiles/BaseProjectiles/BaseLaserbeamProjectile.cs b/Projectiles/BaseProjectiles/BaseLaserbeamProjectile.cs new file mode 100644 index 0000000000..3abf6c5637 --- /dev/null +++ b/Projectiles/BaseProjectiles/BaseLaserbeamProjectile.cs @@ -0,0 +1,211 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Linq; +using Terraria; +using Terraria.Enums; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.BaseProjectiles +{ + public abstract class BaseLaserbeamProjectile : ModProjectile + { + #region Auto-Properties + public float RotationalSpeed + { + get => projectile.ai[0]; + set => projectile.ai[0] = value; + } + public float Time + { + get => projectile.localAI[0]; + set => projectile.localAI[0] = value; + } + public float LaserLength + { + get => projectile.localAI[1]; + set => projectile.localAI[1] = value; + } + #endregion + + #region Virtual Methods + + /// + /// Handles all AI logic for the laser. Can be overridden, but you probably won't need to do that. + /// + public virtual void Behavior() + { + // Attach to some arbitrary thing/position optionally. (The ai[1] value is a reserved for this in vanilla's Phantasmal Deathray) + AttachToSomething(); + + // Ensure the the velocity is a unit vector and is not a <0,0> vector. + projectile.velocity = projectile.velocity.SafeNormalize(-Vector2.UnitY); + + Time++; + if (Time >= Lifetime) + { + projectile.Kill(); + return; + } + + DetermineScale(); + + UpdateLaserMotion(); + + float idealLaserLength = DetermineLaserLength(); + LaserLength = MathHelper.Lerp(LaserLength, idealLaserLength, 0.9f); // Very quickly approach the ideal laser length. + + DelegateMethods.v3_1 = LightCastColor.ToVector3(); + Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * LaserLength, projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); + } + + /// + /// Handles movement logic for the laser. By default causes arcing/sweeping motiom. + /// + public virtual void UpdateLaserMotion() + { + // This part is rather complicated at a glance. + // What it's doing is converting the velocity to an angle, doing something with that angle, and changing it back into the velocity. + // In this case, "doing something with that angle" means incrementing it by a constant. This allows the laser to perform "arcing" motion. + // You could attempt to make it intelligent by having it move towards the target like the Last Prism, but that's not done here. + + float updatedVelocityDirection = projectile.velocity.ToRotation() + RotationalSpeed; + projectile.rotation = updatedVelocityDirection - MathHelper.PiOver2; // Pretty much all lasers have a vertical sheet. + projectile.velocity = updatedVelocityDirection.ToRotationVector2(); + } + + /// + /// Calculates the total scale of the laser. By default uses a clamped sine of time. + /// + public virtual void DetermineScale() + { + projectile.scale = (float)Math.Sin(Time / Lifetime * MathHelper.Pi) * 6f * MaxScale; + if (projectile.scale > MaxScale) + { + projectile.scale = MaxScale; + } + } + + /// + /// Handles direct attachment to things. The projectile.ai[1] array index is reserved for this. Does nothing by default. + /// + public virtual void AttachToSomething() { } + + /// + /// Calculates the current laser's length. By default does not collide with tiles. is a generic laser collision method if you want to do that. + /// + /// The laser length as a float. + public virtual float DetermineLaserLength() => MaxLaserLength; + + /// + /// An extra, empty by default method that exists so that a developer can add custom code after all typical AI logic is done. Think of it like PostAI. + /// + public virtual void ExtraBehavior() { } + #endregion + + #region Helper Methods + + /// + /// Calculates the laser length while taking tiles into account. + /// + /// The amount of samples the ray uses. The higher this is, the more precision, but also more calculations done. + public float DetermineLaserLength_CollideWithTiles(int samplePointCount) + { + float[] laserLengthSamplePoints = new float[samplePointCount]; + Collision.LaserScan(projectile.Center, projectile.velocity, projectile.scale, MaxLaserLength, laserLengthSamplePoints); + return laserLengthSamplePoints.Average(); + } + #endregion + + #region Hook Overrides + public override void AI() + { + Behavior(); + ExtraBehavior(); + } + public override void CutTiles() + { + DelegateMethods.tilecut_0 = TileCuttingContext.AttackMelee; + Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * LaserLength, projectile.Size.Length() * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); + } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + // This should never happen, but just in case- + if (projectile.velocity == Vector2.Zero) + return false; + + // Start texture drawing. + spriteBatch.Draw(LaserBeginTexture, + projectile.Center - Main.screenPosition, + null, + LaserOverlayColor, + projectile.rotation, + LaserBeginTexture.Size() / 2f, + projectile.scale, + SpriteEffects.None, + 0f); + + // Prepare things for body drawing. + float laserBodyLength = LaserLength; + laserBodyLength -= (LaserBeginTexture.Height / 2 + LaserEndTexture.Height) * projectile.scale; + Vector2 centerOnLaser = projectile.Center; + centerOnLaser += projectile.velocity * projectile.scale * LaserBeginTexture.Height / 2f; + + // Body drawing. + if (laserBodyLength > 0f) + { + float laserOffset = LaserMiddleTexture.Height * projectile.scale; + float incrementalBodyLength = 0f; + while (incrementalBodyLength + 1f < laserBodyLength) + { + spriteBatch.Draw(LaserMiddleTexture, + centerOnLaser - Main.screenPosition, + null, + LaserOverlayColor, + projectile.rotation, + LaserMiddleTexture.Width * 0.5f * Vector2.UnitX, + projectile.scale, + SpriteEffects.None, + 0f); + incrementalBodyLength += laserOffset; + centerOnLaser += projectile.velocity * laserOffset; + } + } + + // End texture drawing. + if (Math.Abs(LaserLength - DetermineLaserLength()) < 30f) + { + Vector2 laserEndCenter = centerOnLaser - Main.screenPosition; + spriteBatch.Draw(LaserEndTexture, + laserEndCenter, + null, + LaserOverlayColor, + projectile.rotation, + LaserEndTexture.Frame(1, 1, 0, 0).Top(), + projectile.scale, + SpriteEffects.None, + 0f); + } + return false; + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + if (projHitbox.Intersects(targetHitbox)) + return true; + float unused = 69420f; + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity * LaserLength, projectile.Size.Length() * projectile.scale, ref unused); + } + #endregion + + #region Virtual Properties + public virtual float Lifetime => 120f; + public virtual float MaxScale => 1f; + public virtual float MaxLaserLength => 2400f; // Be careful with this. Going too high will cause lag. + public virtual Color LightCastColor => Color.White; + public virtual Color LaserOverlayColor => Color.White * 0.9f; + public virtual Texture2D LaserBeginTexture { get; } + public virtual Texture2D LaserMiddleTexture { get; } + public virtual Texture2D LaserEndTexture { get; } + #endregion + } +} diff --git a/Projectiles/Boss/AbyssBallVolley.cs b/Projectiles/Boss/AbyssBallVolley.cs index ea803bc3ee..e559bfa2b6 100644 --- a/Projectiles/Boss/AbyssBallVolley.cs +++ b/Projectiles/Boss/AbyssBallVolley.cs @@ -1,3 +1,4 @@ +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -16,36 +17,37 @@ namespace CalamityMod.Projectiles.Boss projectile.width = 26; projectile.height = 26; projectile.hostile = true; - projectile.alpha = 60; projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.timeLeft = 120; + projectile.alpha = 60; + projectile.tileCollide = false; + projectile.timeLeft = 240; } public override void AI() { - if (projectile.ai[1] == 0f) + if (projectile.timeLeft < 60) + projectile.Opacity = MathHelper.Clamp(projectile.timeLeft / 60f, 0f, 1f); + + if (projectile.ai[1] == 0f) { projectile.ai[1] = 1f; Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 33); } + if (Main.rand.NextBool(2)) { Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, 0f, 0f); } } - public override void Kill(int timeLeft) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, 0f, 0f); - } - } + public override bool CanHitPlayer(Player target) => projectile.timeLeft >= 60; - public override void OnHitPlayer(Player target, int damage, bool crit) + public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(BuffID.Weak, 120); + if (projectile.timeLeft < 60) + return; + + target.AddBuff(BuffID.Weak, 120); } } } diff --git a/Projectiles/Boss/AbyssBallVolley2.cs b/Projectiles/Boss/AbyssBallVolley2.cs index 0e15ff0238..a23b8e4517 100644 --- a/Projectiles/Boss/AbyssBallVolley2.cs +++ b/Projectiles/Boss/AbyssBallVolley2.cs @@ -1,3 +1,4 @@ +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -16,19 +17,23 @@ namespace CalamityMod.Projectiles.Boss projectile.width = 26; projectile.height = 26; projectile.hostile = true; - projectile.alpha = 60; projectile.penetrate = 1; - projectile.tileCollide = false; + projectile.alpha = 60; + projectile.tileCollide = false; projectile.timeLeft = 300; } public override void AI() { - if (projectile.ai[1] == 0f) + if (projectile.timeLeft < 60) + projectile.Opacity = MathHelper.Clamp(projectile.timeLeft / 60f, 0f, 1f); + + if (projectile.ai[1] == 0f) { projectile.ai[1] = 1f; Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 33); } + if (Main.rand.NextBool(2)) { int dust = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 127, 0f, 0f); @@ -36,18 +41,14 @@ namespace CalamityMod.Projectiles.Boss } } - public override void Kill(int timeLeft) - { - for (int k = 0; k < 5; k++) - { - int dust = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 127, 0f, 0f); - Main.dust[dust].noGravity = true; - } - } + public override bool CanHitPlayer(Player target) => projectile.timeLeft >= 60; - public override void OnHitPlayer(Player target, int damage, bool crit) + public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(BuffID.Cursed, 90); + if (projectile.timeLeft < 60) + return; + + target.AddBuff(BuffID.Cursed, 90); } } } diff --git a/Projectiles/Boss/BirbAura.cs b/Projectiles/Boss/BirbAura.cs index b1620f3de1..dd3a42e613 100644 --- a/Projectiles/Boss/BirbAura.cs +++ b/Projectiles/Boss/BirbAura.cs @@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.Boss projectile.velocity = -Vector2.UnitY; Vector2 fireFrom = new Vector2(projectile.ai[0], projectile.ai[1]); - projectile.position = fireFrom - new Vector2((float)projectile.width, (float)projectile.height) / 2f; + projectile.position = fireFrom - new Vector2(projectile.width, projectile.height) / 2f; if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) projectile.velocity = -Vector2.UnitY; @@ -71,7 +71,7 @@ namespace CalamityMod.Projectiles.Boss return; } - projectile.scale = (float)Math.Sin((double)(projectile.localAI[0] * Math.PI / timeBeforeVanish)) * 10f * num801; + projectile.scale = (float)Math.Sin(projectile.localAI[0] * Math.PI / timeBeforeVanish) * 10f * num801; if (projectile.scale > num801) projectile.scale = num801; @@ -80,7 +80,7 @@ namespace CalamityMod.Projectiles.Boss projectile.velocity = num804.ToRotationVector2(); float num805 = 3f; //3f - float num806 = (float)projectile.width; + float num806 = projectile.width; Vector2 samplingPoint = projectile.Center; if (vector78.HasValue) @@ -96,13 +96,13 @@ namespace CalamityMod.Projectiles.Boss } num807 /= num805; - num807 = MathHelper.Clamp(num807, 1800f, 3600f); + num807 = MathHelper.Clamp(num807, 3600f, 4800f); float amount = 0.5f; projectile.localAI[1] = MathHelper.Lerp(projectile.localAI[1], num807, amount); DelegateMethods.v3_1 = new Vector3(0.9f, 0.3f, 0.3f); - Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], (float)projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); + Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); } public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) @@ -115,7 +115,7 @@ namespace CalamityMod.Projectiles.Boss Vector2 fireFrom = new Vector2(target.Center.X, target.Center.Y - 900f); Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/LightningStrike"), (int)target.Center.X, (int)target.Center.Y - 300); Vector2 ai0 = target.Center - fireFrom; - float ai = (float)Main.rand.Next(100); + float ai = Main.rand.Next(100); Vector2 velocity = Vector2.Normalize(ai0.RotatedByRandom(MathHelper.PiOver4)) * 7f; Projectile.NewProjectile(fireFrom.X, fireFrom.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, 0f, projectile.owner, ai0.ToRotation(), ai); } @@ -137,22 +137,22 @@ namespace CalamityMod.Projectiles.Boss Vector2 vector = projectile.Center - Main.screenPosition; Rectangle? sourceRectangle2 = null; spriteBatch.Draw(texture2, vector, sourceRectangle2, color44, projectile.rotation, texture2.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); - num223 -= (float)(texture2.Height / 2 + texture3.Height) * projectile.scale; + num223 -= (texture2.Height / 2 + texture3.Height) * projectile.scale; Vector2 value20 = projectile.Center; - value20 += projectile.velocity * projectile.scale * (float)texture2.Height / 2f; + value20 += projectile.velocity * projectile.scale * texture2.Height / 2f; if (num223 > 0f) { float num224 = 0f; Rectangle rectangle7 = new Rectangle(0, 16 * (projectile.timeLeft / 3 % 5), texture.Width, 16); while (num224 + 1f < num223) { - if (num223 - num224 < (float)rectangle7.Height) + if (num223 - num224 < rectangle7.Height) { rectangle7.Height = (int)(num223 - num224); } - spriteBatch.Draw(texture, value20 - Main.screenPosition, new Rectangle?(rectangle7), color44, projectile.rotation, new Vector2((float)(rectangle7.Width / 2), 0f), projectile.scale, SpriteEffects.None, 0f); - num224 += (float)rectangle7.Height * projectile.scale; - value20 += projectile.velocity * (float)rectangle7.Height * projectile.scale; + spriteBatch.Draw(texture, value20 - Main.screenPosition, new Rectangle?(rectangle7), color44, projectile.rotation, new Vector2(rectangle7.Width / 2, 0f), projectile.scale, SpriteEffects.None, 0f); + num224 += rectangle7.Height * projectile.scale; + value20 += projectile.velocity * rectangle7.Height * projectile.scale; rectangle7.Y += 16; if (rectangle7.Y + rectangle7.Height > texture.Height) { @@ -170,7 +170,7 @@ namespace CalamityMod.Projectiles.Boss { DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; Vector2 unit = projectile.velocity; - Utils.PlotTileLine(projectile.Center, projectile.Center + unit * projectile.localAI[1], (float)projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); + Utils.PlotTileLine(projectile.Center, projectile.Center + unit * projectile.localAI[1], projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) diff --git a/Projectiles/Boss/BirbAuraFlare.cs b/Projectiles/Boss/BirbAuraFlare.cs index 2a6f8bb09c..76073973b7 100644 --- a/Projectiles/Boss/BirbAuraFlare.cs +++ b/Projectiles/Boss/BirbAuraFlare.cs @@ -48,13 +48,13 @@ namespace CalamityMod.Projectiles.Boss if (projectile.localAI[0] > 10f) { // Dust pulse effect - projectile.localAI[1] = (float)Math.Abs(Math.Cos((double)MathHelper.ToRadians(projectile.localAI[0] * 2f))); + projectile.localAI[1] = (float)Math.Abs(Math.Cos(MathHelper.ToRadians(projectile.localAI[0] * 2f))); int num626 = 18; for (int num627 = 0; num627 < num626; num627++) { - Vector2 vector45 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * projectile.localAI[1]; - vector45 = vector45.RotatedBy((double)(num627 - (num626 / 2 - 1)) * 3.1415926535897931 / (double)(float)num626, default) + projectile.Center; - Vector2 value15 = ((float)(Main.rand.NextDouble() * Math.PI) - MathHelper.PiOver2).ToRotationVector2() * (float)Main.rand.Next(3, 8); + Vector2 vector45 = Vector2.Normalize(projectile.velocity) * new Vector2(projectile.width / 2f, projectile.height) * projectile.localAI[1]; + vector45 = vector45.RotatedBy((num627 - (num626 / 2 - 1)) * 3.1415926535897931 / (float)num626) + projectile.Center; + Vector2 value15 = ((float)(Main.rand.NextDouble() * Math.PI) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); int num628 = Dust.NewDust(vector45 + value15, 0, 0, 60, value15.X * 2f, value15.Y * 2f, 100, default, 1f); Main.dust[num628].scale = 1.4f; Main.dust[num628].noGravity = true; @@ -66,7 +66,7 @@ namespace CalamityMod.Projectiles.Boss Vector2 value16 = Main.player[num625].Center - projectile.Center; float num629 = 4f; - float divisor = projectile.ai[0] == 1f ? 45f : 60f; + float divisor = 60f - 15f * projectile.ai[0]; num629 += projectile.localAI[0] / divisor; projectile.velocity = Vector2.Normalize(value16) * num629; if (value16.Length() < 32f) @@ -84,8 +84,8 @@ namespace CalamityMod.Projectiles.Boss int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * MathHelper.TwoPi / (float)num226), default) + projectile.Center; + Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2(projectile.width / 2f, projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((num227 - (num226 / 2 - 1)) * MathHelper.TwoPi / num226) + projectile.Center; Vector2 vector7 = vector6 - projectile.Center; int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 60, vector7.X, vector7.Y, 100, default, 1.4f); Main.dust[num228].noGravity = true; @@ -113,16 +113,16 @@ namespace CalamityMod.Projectiles.Boss { num231 = Main.maxTilesY - num233 - 10; } - float x = (float)(num232 * 16); - float y = (float)(num231 * 16 + 900); + float x = num232 * 16; + float y = num231 * 16 + 900; Vector2 laserVelocity = new Vector2(x, 160f) - new Vector2(x, y); int damage = Main.expertMode ? 75 : 100; - if (projectile.ai[0] == 1f) + if (projectile.ai[0] >= 1f) { - x += 500f; + x += 750f; if ((int)(x / 16f) > Main.maxTilesX - 10) { - x = (float)(Main.maxTilesX - 10) * 16f; + x = (Main.maxTilesX - 10) * 16f; } laserVelocity = new Vector2(x, 160f) - new Vector2(x, y); laserVelocity.Normalize(); @@ -130,7 +130,7 @@ namespace CalamityMod.Projectiles.Boss Main.projectile[num237].timeLeft = 900; Main.projectile[num237].netUpdate = true; - x -= 1000f; + x -= 1500f; if ((int)(x / 16f) < 10) { x = 160f; diff --git a/Projectiles/Boss/BloodClot.cs b/Projectiles/Boss/BloodClot.cs index 22cdc226b7..4eaaae4689 100644 --- a/Projectiles/Boss/BloodClot.cs +++ b/Projectiles/Boss/BloodClot.cs @@ -2,6 +2,7 @@ using CalamityMod.Dusts; using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { @@ -19,7 +20,7 @@ namespace CalamityMod.Projectiles.Boss projectile.hostile = true; projectile.penetrate = 1; projectile.aiStyle = 1; - aiType = 1; + aiType = ProjectileID.WoodenArrowFriendly; } public override void AI() diff --git a/Projectiles/Boss/BloodGeyser.cs b/Projectiles/Boss/BloodGeyser.cs index 791e10fc55..17790e3893 100644 --- a/Projectiles/Boss/BloodGeyser.cs +++ b/Projectiles/Boss/BloodGeyser.cs @@ -2,6 +2,7 @@ using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using System; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { @@ -21,7 +22,7 @@ namespace CalamityMod.Projectiles.Boss projectile.timeLeft = 300; projectile.penetrate = 1; projectile.aiStyle = 1; - aiType = 1; + aiType = ProjectileID.WoodenArrowFriendly; } public override void AI() @@ -31,7 +32,7 @@ namespace CalamityMod.Projectiles.Boss projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + 1.57f; - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 5, 0f, 0f, 100, default, 0.5f); + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, DustID.Blood, 0f, 0f, 100, default, 0.5f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; } diff --git a/Projectiles/Boss/BrimstoneBall.cs b/Projectiles/Boss/BrimstoneBall.cs index 8bdf9df0af..1d3edc2464 100644 --- a/Projectiles/Boss/BrimstoneBall.cs +++ b/Projectiles/Boss/BrimstoneBall.cs @@ -2,6 +2,7 @@ using CalamityMod.Dusts; using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { @@ -20,7 +21,7 @@ namespace CalamityMod.Projectiles.Boss projectile.scale = 1.2f; projectile.penetrate = 6; projectile.aiStyle = 14; - aiType = 277; + aiType = ProjectileID.ThornBall; projectile.timeLeft = 300; } diff --git a/Projectiles/Boss/BrimstoneBarrage.cs b/Projectiles/Boss/BrimstoneBarrage.cs index 96f3f0394b..8bbb9d2785 100644 --- a/Projectiles/Boss/BrimstoneBarrage.cs +++ b/Projectiles/Boss/BrimstoneBarrage.cs @@ -25,8 +25,8 @@ namespace CalamityMod.Projectiles.Boss projectile.ignoreWater = true; projectile.tileCollide = false; projectile.penetrate = -1; - projectile.timeLeft = 600; - cooldownSlot = 1; + projectile.timeLeft = 690; + cooldownSlot = 1; } public override void AI() @@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Boss if (projectile.velocity.Length() < (projectile.ai[1] == 0f ? 14f : 10f)) projectile.velocity *= 1.01f; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; projectile.frameCounter++; if (projectile.frameCounter > 4) @@ -45,17 +45,20 @@ namespace CalamityMod.Projectiles.Boss if (projectile.frame > 3) projectile.frame = 0; - Lighting.AddLight(projectile.Center, 0.75f, 0f, 0f); + if (projectile.timeLeft < 60) + projectile.Opacity = MathHelper.Clamp(projectile.timeLeft / 60f, 0f, 1f); + + Lighting.AddLight(projectile.Center, 0.75f, 0f, 0f); } - public override Color? GetAlpha(Color lightColor) - { - return new Color(250, 50, 50, projectile.alpha); - } + public override bool CanHitPlayer(Player target) => projectile.Opacity == 1f; - public override void OnHitPlayer(Player target, int damage, bool crit) + public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 180); + if (projectile.Opacity != 1f) + return; + + target.AddBuff(ModContent.BuffType(), 180); if (projectile.ai[0] == 0f) target.AddBuff(ModContent.BuffType(), 120, true); @@ -63,7 +66,8 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + lightColor.R = (byte)(255 * projectile.Opacity); + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); return false; } diff --git a/Projectiles/Boss/BrimstoneFireblast.cs b/Projectiles/Boss/BrimstoneFireblast.cs index 93483613f7..bf53bdbcdb 100644 --- a/Projectiles/Boss/BrimstoneFireblast.cs +++ b/Projectiles/Boss/BrimstoneFireblast.cs @@ -24,8 +24,9 @@ namespace CalamityMod.Projectiles.Boss projectile.hostile = true; projectile.ignoreWater = true; projectile.penetrate = 1; - projectile.alpha = 120; - cooldownSlot = 1; + projectile.timeLeft = 120; + projectile.Opacity = 0f; + cooldownSlot = 1; } public override void AI() @@ -37,84 +38,91 @@ namespace CalamityMod.Projectiles.Boss projectile.frameCounter = 0; } if (projectile.frame > 5) - { projectile.frame = 0; - } - projectile.alpha -= 1; - if (projectile.alpha <= 0) - { - projectile.Kill(); - } + + if (projectile.ai[1] == 1f) + projectile.Opacity = MathHelper.Clamp(projectile.timeLeft / 60f, 0f, 1f); + else + projectile.Opacity = MathHelper.Clamp(1f - ((projectile.timeLeft - 60) / 60f), 0f, 1f); + Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.9f / 255f, 0f, 0f); - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (projectile.ai[1] == 0f) + + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + + if (projectile.localAI[0] == 0f) { - projectile.ai[1] = 1f; + projectile.localAI[0] = 1f; Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 20); } - int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); - projectile.ai[1] += 1f; - if (projectile.ai[1] < 220f && projectile.ai[1] > 20f) + + int target = Player.FindClosest(projectile.Center, 1, 1); + projectile.ai[0] += 1f; + if (projectile.ai[0] > 20f) { - float scaleFactor2 = projectile.velocity.Length(); - Vector2 vector11 = Main.player[num103].Center - projectile.Center; - vector11.Normalize(); - vector11 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 24f + vector11) / 25f; + float projSpeed = projectile.velocity.Length(); + Vector2 playerVec = Main.player[target].Center - projectile.Center; + playerVec.Normalize(); + playerVec *= projSpeed; + projectile.velocity = (projectile.velocity * 24f + playerVec) / 25f; projectile.velocity.Normalize(); - projectile.velocity *= scaleFactor2; + projectile.velocity *= projSpeed; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - 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); + Texture2D texture = Main.projectileTexture[projectile.type]; + int frameHeight = texture.Height / Main.projFrames[projectile.type]; + int drawStart = frameHeight * projectile.frame; + lightColor.R = (byte)(255 * projectile.Opacity); + Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, frameHeight)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2(texture.Width / 2f, frameHeight / 2f), projectile.scale, SpriteEffects.None, 0f); return false; } - public override Color? GetAlpha(Color lightColor) - { - return new Color(250, 50, 50, projectile.alpha); - } + public override bool CanHitPlayer(Player target) => projectile.Opacity == 1f; - public override void OnHitPlayer(Player target, int damage, bool crit) + public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 240); + if (projectile.Opacity != 1f) + return; + + target.AddBuff(ModContent.BuffType(), 240); target.AddBuff(ModContent.BuffType(), 180, true); } public override void Kill(int timeLeft) { Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 20); - float spread = 12f * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 30f; - double offsetAngle; - int i; - if (projectile.owner == Main.myPlayer) + + if (projectile.ai[1] == 0f) + { + float spread = 12f * MathHelper.PiOver2 * 0.01f; + double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; + double deltaAngle = spread / 30f; + double offsetAngle; + if (projectile.owner == Main.myPlayer) + { + for (int i = 0; i < 30; i++) + { + offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 1f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 1f); + } + } + } + + for (int j = 0; j < 2; j++) { - for (i = 0; i < 30; i++) - { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 1f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 1f); - } + Dust.NewDust(projectile.position, projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 50, default, 1f); } - for (int num193 = 0; num193 < 2; num193++) + for (int k = 0; k < 20; k++) { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 50, default, 1f); - } - for (int num194 = 0; num194 < 20; num194++) - { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 0, default, 1.5f); - Main.dust[num195].noGravity = true; - Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 50, default, 1f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; + int redFire = Dust.NewDust(projectile.position, projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 0, default, 1.5f); + Main.dust[redFire].noGravity = true; + Main.dust[redFire].velocity *= 3f; + redFire = Dust.NewDust(projectile.position, projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 50, default, 1f); + Main.dust[redFire].velocity *= 2f; + Main.dust[redFire].noGravity = true; } } diff --git a/Projectiles/Boss/BrimstoneGigaBlast.cs b/Projectiles/Boss/BrimstoneGigaBlast.cs index 3d75dbe0cf..4134292304 100644 --- a/Projectiles/Boss/BrimstoneGigaBlast.cs +++ b/Projectiles/Boss/BrimstoneGigaBlast.cs @@ -25,8 +25,8 @@ namespace CalamityMod.Projectiles.Boss projectile.hostile = true; projectile.ignoreWater = true; projectile.penetrate = 1; - projectile.alpha = 50; - projectile.timeLeft = 150; + projectile.Opacity = 0f; + projectile.timeLeft = 150; cooldownSlot = 1; } @@ -39,31 +39,38 @@ namespace CalamityMod.Projectiles.Boss projectile.frameCounter = 0; } if (projectile.frame >= 5) - { projectile.frame = 0; - } + bool revenge = CalamityWorld.revenge; - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.9f / 255f, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0f / 255f); - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (projectile.ai[1] == 0f) + + Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.9f / 255f, 0f, 0f); + + if (projectile.ai[1] == 1f) + projectile.Opacity = MathHelper.Clamp(projectile.timeLeft / 60f, 0f, 1f); + else + projectile.Opacity = MathHelper.Clamp(1f - ((projectile.timeLeft - 90) / 60f), 0f, 1f); + + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + + if (projectile.localAI[0] == 0f) { - projectile.ai[1] = 1f; + projectile.localAI[0] = 1f; Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 20); } - float num953 = revenge ? 100f : 80f; //100 - float scaleFactor12 = revenge ? 20f : 15f; //5 - float num954 = 40f; - int num959 = (int)projectile.ai[0]; - if (num959 >= 0 && Main.player[num959].active && !Main.player[num959].dead) + + float turnSpeed = revenge ? 100f : 80f; //100 + float homeSpeed = revenge ? 20f : 15f; //5 + float minDist = 40f; + int target = (int)projectile.ai[0]; + if (target >= 0 && Main.player[target].active && !Main.player[target].dead) { - if (projectile.Distance(Main.player[num959].Center) > num954) + if (projectile.Distance(Main.player[target].Center) > minDist) { - Vector2 vector102 = projectile.DirectionTo(Main.player[num959].Center); - if (vector102.HasNaNs()) - { - vector102 = Vector2.UnitY; - } - projectile.velocity = (projectile.velocity * (num953 - 1f) + vector102 * scaleFactor12) / num953; + Vector2 targetVec = projectile.DirectionTo(Main.player[target].Center); + if (targetVec.HasNaNs()) + targetVec = Vector2.UnitY; + + projectile.velocity = (projectile.velocity * (turnSpeed - 1f) + targetVec * homeSpeed) / turnSpeed; } } else @@ -78,50 +85,55 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - 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); + Texture2D texture = Main.projectileTexture[projectile.type]; + int frameHeight = texture.Height / Main.projFrames[projectile.type]; + int drawStart = frameHeight * projectile.frame; + lightColor.R = (byte)(255 * projectile.Opacity); + Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, frameHeight)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2(texture.Width / 2f, frameHeight / 2f), projectile.scale, SpriteEffects.None, 0f); return false; } - public override Color? GetAlpha(Color lightColor) - { - return new Color(250, 50, 50, projectile.alpha); - } + public override bool CanHitPlayer(Player target) => projectile.Opacity == 1f; - public override void OnHitPlayer(Player target, int damage, bool crit) + public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 240); + if (projectile.Opacity != 1f) + return; + + target.AddBuff(ModContent.BuffType(), 240); target.AddBuff(ModContent.BuffType(), 180, true); } public override void Kill(int timeLeft) { Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 20); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; - if (projectile.owner == Main.myPlayer) + + if (projectile.ai[1] == 0f) + { + float spread = 45f * MathHelper.PiOver2 * 0.01f; + double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + if (projectile.owner == Main.myPlayer) + { + for (int i = 0; i < 8; i++) + { + offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 7f), (float)(Math.Cos(offsetAngle) * 7f), ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 1f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 7f), (float)(-Math.Cos(offsetAngle) * 7f), ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 1f); + } + } + } + + Dust.NewDust(projectile.position, projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 50, default, 1f); + for (int j = 0; j < 10; j++) { - for (i = 0; i < 8; i++) - { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 7f), (float)(Math.Cos(offsetAngle) * 7f), ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 1f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 7f), (float)(-Math.Cos(offsetAngle) * 7f), ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 1f); - } - } - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 50, default, 1f); - for (int num194 = 0; num194 < 10; num194++) - { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 0, default, 1.5f); - Main.dust[num195].noGravity = true; - Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 50, default, 1f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; + int redFire = Dust.NewDust(projectile.position, projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 0, default, 1.5f); + Main.dust[redFire].noGravity = true; + Main.dust[redFire].velocity *= 3f; + redFire = Dust.NewDust(projectile.position, projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 50, default, 1f); + Main.dust[redFire].velocity *= 2f; + Main.dust[redFire].noGravity = true; } } diff --git a/Projectiles/Boss/BrimstoneHellblast.cs b/Projectiles/Boss/BrimstoneHellblast.cs index 9e32ff51ac..709c1db06c 100644 --- a/Projectiles/Boss/BrimstoneHellblast.cs +++ b/Projectiles/Boss/BrimstoneHellblast.cs @@ -28,7 +28,6 @@ namespace CalamityMod.Projectiles.Boss projectile.tileCollide = false; projectile.penetrate = -1; projectile.timeLeft = 255; - projectile.alpha = 0; cooldownSlot = 1; } @@ -45,38 +44,33 @@ namespace CalamityMod.Projectiles.Boss projectile.frame = 0; } projectile.alpha += 1; - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.9f / 255f, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0f / 255f); + Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.9f / 255f, 0f, 0f); if (projectile.ai[1] == 0f) { projectile.ai[1] = 1f; Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 20); } - projectile.velocity.X *= 1.03f; - projectile.velocity.Y *= 1.03f; + projectile.velocity *= 1.03f; if (projectile.velocity.X < 0f) { projectile.spriteDirection = -1; - projectile.rotation = (float)Math.Atan2((double)-(double)projectile.velocity.Y, (double)-(double)projectile.velocity.X); + projectile.rotation = (float)Math.Atan2(-projectile.velocity.Y, -projectile.velocity.X); } else { projectile.spriteDirection = 1; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X); } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + lightColor.R = (byte)(255 * projectile.Opacity); + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); return false; } - public override Color? GetAlpha(Color lightColor) - { - return new Color(250, 50, 50, projectile.alpha); - } - - public override void OnHitPlayer(Player target, int damage, bool crit) + public override void OnHitPlayer(Player target, int damage, bool crit) { target.AddBuff(ModContent.BuffType(), 180); diff --git a/Projectiles/Boss/BrimstoneHellblast2.cs b/Projectiles/Boss/BrimstoneHellblast2.cs index cb78339772..be51d96d10 100644 --- a/Projectiles/Boss/BrimstoneHellblast2.cs +++ b/Projectiles/Boss/BrimstoneHellblast2.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Boss projectile.extraUpdates = 1; projectile.penetrate = -1; projectile.timeLeft = 1500; - projectile.alpha = 0; + projectile.Opacity = 0f; cooldownSlot = 1; } @@ -37,41 +37,46 @@ namespace CalamityMod.Projectiles.Boss projectile.frameCounter = 0; } if (projectile.frame > 3) - { projectile.frame = 0; - } - projectile.alpha += 1; + + if (projectile.timeLeft < 60) + projectile.Opacity = MathHelper.Clamp(projectile.timeLeft / 60f, 0f, 1f); + else + projectile.Opacity = MathHelper.Clamp(1f - ((projectile.timeLeft - 1440) / 60f), 0f, 1f); + Lighting.AddLight(projectile.Center, 0.9f, 0f, 0f); + if (projectile.velocity.X < 0f) { projectile.spriteDirection = -1; - projectile.rotation = (float)Math.Atan2((double)-(double)projectile.velocity.Y, (double)-(double)projectile.velocity.X); + projectile.rotation = (float)Math.Atan2(-projectile.velocity.Y, -projectile.velocity.X); } else { projectile.spriteDirection = 1; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X); } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, spriteEffects, 0f); + Texture2D texture = Main.projectileTexture[projectile.type]; + int frameHeight = texture.Height / Main.projFrames[projectile.type]; + int drawStart = frameHeight * projectile.frame; + lightColor.R = (byte)(255 * projectile.Opacity); + Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, frameHeight)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2(texture.Width / 2f, frameHeight / 2f), projectile.scale, spriteEffects, 0f); return false; } - public override Color? GetAlpha(Color lightColor) - { - return new Color(250, 50, 50, projectile.alpha); - } + public override bool CanHitPlayer(Player target) => projectile.Opacity == 1f; - public override void OnHitPlayer(Player target, int damage, bool crit) + public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 180); + if (projectile.Opacity != 1f) + return; + + target.AddBuff(ModContent.BuffType(), 180); target.AddBuff(ModContent.BuffType(), 120, true); } diff --git a/Projectiles/Boss/BrimstoneLaser.cs b/Projectiles/Boss/BrimstoneLaser.cs index 556e438a16..c3ed3e7129 100644 --- a/Projectiles/Boss/BrimstoneLaser.cs +++ b/Projectiles/Boss/BrimstoneLaser.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using System; using System.IO; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { @@ -25,7 +26,7 @@ namespace CalamityMod.Projectiles.Boss projectile.ignoreWater = true; projectile.penetrate = -1; projectile.alpha = 120; - aiType = 100; + aiType = ProjectileID.DeathLaser; } public override void SendExtraAI(BinaryWriter writer) diff --git a/Projectiles/Boss/BrimstoneMonster.cs b/Projectiles/Boss/BrimstoneMonster.cs index 4e67bf40b0..82cf189fc3 100644 --- a/Projectiles/Boss/BrimstoneMonster.cs +++ b/Projectiles/Boss/BrimstoneMonster.cs @@ -9,194 +9,193 @@ using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { - public class BrimstoneMonster : ModProjectile - { - private float speedAdd = 0f; - private float speedLimit = 0f; + public class BrimstoneMonster : ModProjectile + { + private float speedAdd = 0f; + private float speedLimit = 0f; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimstone Monster"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimstone Monster"); + } - public override void SetDefaults() - { - projectile.width = 320; - projectile.height = 320; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 36000; - projectile.alpha = 50; - cooldownSlot = 1; - } + public override void SetDefaults() + { + projectile.width = 320; + projectile.height = 320; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.timeLeft = 36000; + projectile.Opacity = 0f; + cooldownSlot = 1; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(speedAdd); - writer.Write(projectile.localAI[0]); - writer.Write(speedLimit); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(speedAdd); + writer.Write(projectile.localAI[0]); + writer.Write(speedLimit); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - speedAdd = reader.ReadSingle(); - projectile.localAI[0] = reader.ReadSingle(); - speedLimit = reader.ReadSingle(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + speedAdd = reader.ReadSingle(); + projectile.localAI[0] = reader.ReadSingle(); + speedLimit = reader.ReadSingle(); + } + + public override void AI() + { + if (!CalamityPlayer.areThereAnyDamnBosses) + { + projectile.active = false; + projectile.netUpdate = true; + return; + } - public override void AI() - { - if (!CalamityPlayer.areThereAnyDamnBosses) - { - projectile.active = false; - projectile.netUpdate = true; - return; - } int choice = (int)projectile.ai[1]; + if (projectile.localAI[0] == 0f) + { + projectile.soundDelay = 1125 - (choice * 225); + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/BrimstoneMonsterSpawn"), projectile.Center); + projectile.localAI[0] += 1f; + switch (choice) + { + case 0: + speedLimit = 10f; + break; + case 1: + speedLimit = 20f; + break; + case 2: + speedLimit = 30f; + break; + case 3: + speedLimit = 40f; + break; + default: + break; + } + } + + if (speedAdd < speedLimit) + speedAdd += 0.04f; + if (projectile.soundDelay <= 0 && (choice == 0 || choice == 2)) { projectile.soundDelay = 420; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/BrimstoneMonsterDrone"), (int)projectile.Center.X, (int)projectile.Center.Y); + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/BrimstoneMonsterDrone"), projectile.Center); } - if (projectile.localAI[0] == 0f) - { - projectile.localAI[0] += 1f; - if (choice == 0) - { - speedLimit = 10f; - } - else if (choice == 1) - { - speedLimit = 20f; - } - else if (choice == 2) - { - speedLimit = 30f; - } - else - { - speedLimit = 40f; - } - } - if (speedAdd < speedLimit) - { - speedAdd += 0.04f; - } - bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; + bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; - Lighting.AddLight(projectile.Center, 3f, 0f, 0f); + Lighting.AddLight(projectile.Center, 3f, 0f, 0f); - float num953 = (revenge ? 5f : 4.5f) + speedAdd; //100 - float scaleFactor12 = (revenge ? 1.5f : 1.35f) + (speedAdd * 0.25f); //5 - float num954 = 160f; + float inertia = (revenge ? 5f : 4.5f) + speedAdd; //100 + float speed = (revenge ? 1.5f : 1.35f) + (speedAdd * 0.25f); //5 + float minDist = 160f; if (NPC.AnyNPCs(ModContent.NPCType())) { - num953 *= 0.5f; - scaleFactor12 *= 0.5f; + inertia *= 0.5f; + speed *= 0.5f; } - if (projectile.timeLeft > 30 && projectile.alpha > 0) - { - projectile.alpha -= 25; - } - if (projectile.timeLeft > 30 && projectile.alpha < 128 && Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.alpha = 128; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - int num959 = (int)projectile.ai[0]; - if (num959 >= 0 && Main.player[num959].active && !Main.player[num959].dead) - { - if (projectile.Distance(Main.player[num959].Center) > num954) - { - Vector2 vector102 = projectile.DirectionTo(Main.player[num959].Center); - if (vector102.HasNaNs()) - { - vector102 = Vector2.UnitY; - } - projectile.velocity = (projectile.velocity * (num953 - 1f) + vector102 * scaleFactor12) / num953; - } - } - else - { - if (projectile.ai[0] != -1f) - { - projectile.ai[0] = -1f; - projectile.netUpdate = true; - } - } + if (projectile.timeLeft < 90) + projectile.Opacity = MathHelper.Clamp(projectile.timeLeft / 90f, 0f, 1f); + else + projectile.Opacity = MathHelper.Clamp(1f - ((projectile.timeLeft - 35910) / 90f), 0f, 1f); + + int target = (int)projectile.ai[0]; + if (target >= 0 && Main.player[target].active && !Main.player[target].dead) + { + if (projectile.Distance(Main.player[target].Center) > minDist) + { + Vector2 targetVec = projectile.DirectionTo(Main.player[target].Center); + if (targetVec.HasNaNs()) + targetVec = Vector2.UnitY; + + projectile.velocity = (projectile.velocity * (inertia - 1f) + targetVec * speed) / inertia; + } + } + else + { + if (projectile.ai[0] != -1f) + { + projectile.ai[0] = -1f; + projectile.netUpdate = true; + } + } // Fly away from other brimstone monsters - float velocity = 0.05f; - for (int i = 0; i < Main.maxProjectiles; i++) + float pushForce = 0.05f; + for (int k = 0; k < Main.maxProjectiles; k++) { - if (Main.projectile[i].active) - { - if (i != projectile.whoAmI && Main.projectile[i].type == projectile.type) - { - if (Vector2.Distance(projectile.Center, Main.projectile[i].Center) < 320f) - { - if (projectile.position.X < Main.projectile[i].position.X) - projectile.velocity.X -= velocity; - else - projectile.velocity.X += velocity; + Projectile otherProj = Main.projectile[k]; + // Short circuits to make the loop as fast as possible + if (!otherProj.active || k == projectile.whoAmI) + continue; - if (projectile.position.Y < Main.projectile[i].position.Y) - projectile.velocity.Y -= velocity; - else - projectile.velocity.Y += velocity; - } - } + // If the other projectile is indeed the same owned by the same player and they're too close, nudge them away. + bool sameProjType = otherProj.type == projectile.type; + float taxicabDist = Vector2.Distance(projectile.Center, otherProj.Center); + if (sameProjType && taxicabDist < 320f) + { + if (projectile.position.X < otherProj.position.X) + projectile.velocity.X -= pushForce; + else + projectile.velocity.X += pushForce; + + if (projectile.position.Y < otherProj.position.Y) + projectile.velocity.Y -= pushForce; + else + projectile.velocity.Y += pushForce; } } } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) - { - float dist1 = Vector2.Distance(projectile.Center, targetHitbox.TopLeft()); - float dist2 = Vector2.Distance(projectile.Center, targetHitbox.TopRight()); - float dist3 = Vector2.Distance(projectile.Center, targetHitbox.BottomLeft()); - float dist4 = Vector2.Distance(projectile.Center, targetHitbox.BottomRight()); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + float dist1 = Vector2.Distance(projectile.Center, targetHitbox.TopLeft()); + float dist2 = Vector2.Distance(projectile.Center, targetHitbox.TopRight()); + float dist3 = Vector2.Distance(projectile.Center, targetHitbox.BottomLeft()); + float dist4 = Vector2.Distance(projectile.Center, targetHitbox.BottomRight()); - float minDist = dist1; - if (dist2 < minDist) - minDist = dist2; - if (dist3 < minDist) - minDist = dist3; - if (dist4 < minDist) - minDist = dist4; + float minDist = dist1; + if (dist2 < minDist) + minDist = dist2; + if (dist3 < minDist) + minDist = dist3; + if (dist4 < minDist) + minDist = dist4; - return minDist <= 170f; - } + return minDist <= 170f; + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + lightColor.R = (byte)(255 * projectile.Opacity); + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(250, 50, 50, projectile.alpha); - } + public override bool CanHitPlayer(Player target) => projectile.Opacity == 1f; - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(ModContent.BuffType(), 900); - target.AddBuff(ModContent.BuffType(), 300, true); - } + public override void OnHitPlayer(Player target, int damage, bool crit) + { + if (projectile.Opacity != 1f) + return; - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { + target.AddBuff(ModContent.BuffType(), 900); + target.AddBuff(ModContent.BuffType(), 300, true); + } + + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) + { target.Calamity().lastProjectileHit = projectile; } - } + } } diff --git a/Projectiles/Boss/BrimstoneRay.cs b/Projectiles/Boss/BrimstoneRay.cs index bb0a99096e..c16c04b578 100644 --- a/Projectiles/Boss/BrimstoneRay.cs +++ b/Projectiles/Boss/BrimstoneRay.cs @@ -50,20 +50,20 @@ namespace CalamityMod.Projectiles.Boss if (Main.npc[(int)projectile.ai[1]].active && Main.npc[(int)projectile.ai[1]].type == ModContent.NPCType()) { Vector2 fireFrom = new Vector2(Main.npc[(int)projectile.ai[1]].Center.X + (Main.npc[(int)projectile.ai[1]].spriteDirection > 0 ? 34f : -34f), Main.npc[(int)projectile.ai[1]].Center.Y - 74f); - projectile.position = fireFrom - new Vector2((float)projectile.width, (float)projectile.height) / 2f; + projectile.position = fireFrom - new Vector2(projectile.width, projectile.height) / 2f; } else projectile.Kill(); float num801 = 1f; projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 105f) + if (projectile.localAI[0] >= 45f) { projectile.Kill(); return; } - projectile.scale = (float)Math.Sin((double)(projectile.localAI[0] * (float)Math.PI / 105f)) * 10f * num801; + projectile.scale = (float)Math.Sin(projectile.localAI[0] * (float)Math.PI / 45f) * 10f * num801; if (projectile.scale > num801) projectile.scale = num801; @@ -77,7 +77,7 @@ namespace CalamityMod.Projectiles.Boss projectile.velocity = num804.ToRotationVector2(); float num805 = 3f; //3f - float num806 = (float)projectile.width; + float num806 = projectile.width; Vector2 samplingPoint = projectile.Center; if (vector78.HasValue) @@ -107,7 +107,7 @@ namespace CalamityMod.Projectiles.Boss { float num810 = projectile.velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? -1f : 1f) * MathHelper.PiOver2; float num811 = (float)Main.rand.NextDouble() * 2f + 2f; - Vector2 vector80 = new Vector2((float)Math.Cos((double)num810) * num811, (float)Math.Sin((double)num810) * num811); + Vector2 vector80 = new Vector2((float)Math.Cos(num810) * num811, (float)Math.Sin(num810) * num811); int num812 = Dust.NewDust(vector79, 0, 0, (int)CalamityDusts.Brimstone, vector80.X, vector80.Y, 0, default, 1f); Main.dust[num812].noGravity = true; Main.dust[num812].scale = 1.7f; @@ -115,7 +115,7 @@ namespace CalamityMod.Projectiles.Boss if (Main.rand.NextBool(5)) { - Vector2 value29 = projectile.velocity.RotatedBy(MathHelper.PiOver2, default) * ((float)Main.rand.NextDouble() - 0.5f) * (float)projectile.width; + Vector2 value29 = projectile.velocity.RotatedBy(MathHelper.PiOver2, default) * ((float)Main.rand.NextDouble() - 0.5f) * projectile.width; int num813 = Dust.NewDust(vector79 + value29 - Vector2.One * 4f, 8, 8, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1.5f); Dust dust = Main.dust[num813]; dust.velocity *= 0.5f; @@ -123,7 +123,7 @@ namespace CalamityMod.Projectiles.Boss } DelegateMethods.v3_1 = new Vector3(0.9f, 0.3f, 0.3f); - Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], (float)projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); + Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) @@ -140,22 +140,22 @@ namespace CalamityMod.Projectiles.Boss Vector2 vector = projectile.Center - Main.screenPosition; Rectangle? sourceRectangle2 = null; spriteBatch.Draw(texture2D19, vector, sourceRectangle2, color44, projectile.rotation, texture2D19.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); - num223 -= (float)(texture2D19.Height / 2 + texture2D21.Height) * projectile.scale; + num223 -= (texture2D19.Height / 2 + texture2D21.Height) * projectile.scale; Vector2 value20 = projectile.Center; - value20 += projectile.velocity * projectile.scale * (float)texture2D19.Height / 2f; + value20 += projectile.velocity * projectile.scale * texture2D19.Height / 2f; if (num223 > 0f) { float num224 = 0f; Rectangle rectangle7 = new Rectangle(0, 16 * (projectile.timeLeft / 3 % 5), texture2D20.Width, 16); while (num224 + 1f < num223) { - if (num223 - num224 < (float)rectangle7.Height) + if (num223 - num224 < rectangle7.Height) { rectangle7.Height = (int)(num223 - num224); } - spriteBatch.Draw(texture2D20, value20 - Main.screenPosition, new Rectangle?(rectangle7), color44, projectile.rotation, new Vector2((float)(rectangle7.Width / 2), 0f), projectile.scale, SpriteEffects.None, 0f); - num224 += (float)rectangle7.Height * projectile.scale; - value20 += projectile.velocity * (float)rectangle7.Height * projectile.scale; + spriteBatch.Draw(texture2D20, value20 - Main.screenPosition, new Rectangle?(rectangle7), color44, projectile.rotation, new Vector2(rectangle7.Width / 2, 0f), projectile.scale, SpriteEffects.None, 0f); + num224 += rectangle7.Height * projectile.scale; + value20 += projectile.velocity * rectangle7.Height * projectile.scale; rectangle7.Y += 16; if (rectangle7.Y + rectangle7.Height > texture2D20.Height) { @@ -173,7 +173,7 @@ namespace CalamityMod.Projectiles.Boss { DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; Vector2 unit = projectile.velocity; - Utils.PlotTileLine(projectile.Center, projectile.Center + unit * projectile.localAI[1], (float)projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); + Utils.PlotTileLine(projectile.Center, projectile.Center + unit * projectile.localAI[1], projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) diff --git a/Projectiles/Boss/BrimstoneTargetRay.cs b/Projectiles/Boss/BrimstoneTargetRay.cs index 27611a456d..4b3c4c25c1 100644 --- a/Projectiles/Boss/BrimstoneTargetRay.cs +++ b/Projectiles/Boss/BrimstoneTargetRay.cs @@ -49,7 +49,7 @@ namespace CalamityMod.Projectiles.Boss if (Main.npc[(int)projectile.ai[1]].active && Main.npc[(int)projectile.ai[1]].type == ModContent.NPCType()) { Vector2 fireFrom = new Vector2(Main.npc[(int)projectile.ai[1]].Center.X + (Main.npc[(int)projectile.ai[1]].spriteDirection > 0 ? 34f : -34f), Main.npc[(int)projectile.ai[1]].Center.Y - 74f); - projectile.position = fireFrom - new Vector2((float)projectile.width, (float)projectile.height) / 2f; + projectile.position = fireFrom - new Vector2(projectile.width, projectile.height) / 2f; } else projectile.Kill(); @@ -77,7 +77,7 @@ namespace CalamityMod.Projectiles.Boss } float num805 = 3f; //3f - float num806 = (float)projectile.width; + float num806 = projectile.width; Vector2 samplingPoint = projectile.Center; if (vector78.HasValue) @@ -104,7 +104,7 @@ namespace CalamityMod.Projectiles.Boss projectile.localAI[1] = MathHelper.Lerp(projectile.localAI[1], num807, amount); //length of laser, linear interpolation DelegateMethods.v3_1 = new Vector3(0.9f, 0.3f, 0.3f); - Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], (float)projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); + Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) @@ -121,22 +121,22 @@ namespace CalamityMod.Projectiles.Boss Vector2 vector = projectile.Center - Main.screenPosition; Rectangle? sourceRectangle2 = null; spriteBatch.Draw(texture2D19, vector, sourceRectangle2, color44, projectile.rotation, texture2D19.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); - num223 -= (float)(texture2D19.Height / 2 + texture2D21.Height) * projectile.scale; + num223 -= (texture2D19.Height / 2 + texture2D21.Height) * projectile.scale; Vector2 value20 = projectile.Center; - value20 += projectile.velocity * projectile.scale * (float)texture2D19.Height / 2f; + value20 += projectile.velocity * projectile.scale * texture2D19.Height / 2f; if (num223 > 0f) { float num224 = 0f; Rectangle rectangle7 = new Rectangle(0, 16 * (projectile.timeLeft / 3 % 5), texture2D20.Width, 16); while (num224 + 1f < num223) { - if (num223 - num224 < (float)rectangle7.Height) + if (num223 - num224 < rectangle7.Height) { rectangle7.Height = (int)(num223 - num224); } - spriteBatch.Draw(texture2D20, value20 - Main.screenPosition, new Rectangle?(rectangle7), color44, projectile.rotation, new Vector2((float)(rectangle7.Width / 2), 0f), projectile.scale, SpriteEffects.None, 0f); - num224 += (float)rectangle7.Height * projectile.scale; - value20 += projectile.velocity * (float)rectangle7.Height * projectile.scale; + spriteBatch.Draw(texture2D20, value20 - Main.screenPosition, new Rectangle?(rectangle7), color44, projectile.rotation, new Vector2(rectangle7.Width / 2, 0f), projectile.scale, SpriteEffects.None, 0f); + num224 += rectangle7.Height * projectile.scale; + value20 += projectile.velocity * rectangle7.Height * projectile.scale; rectangle7.Y += 16; if (rectangle7.Y + rectangle7.Height > texture2D20.Height) { @@ -154,7 +154,7 @@ namespace CalamityMod.Projectiles.Boss { DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; Vector2 unit = projectile.velocity; - Utils.PlotTileLine(projectile.Center, projectile.Center + unit * projectile.localAI[1], (float)projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); + Utils.PlotTileLine(projectile.Center, projectile.Center + unit * projectile.localAI[1], projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) diff --git a/Projectiles/Boss/BrimstoneWave.cs b/Projectiles/Boss/BrimstoneWave.cs index d5c0cd46e0..a03037bcec 100644 --- a/Projectiles/Boss/BrimstoneWave.cs +++ b/Projectiles/Boss/BrimstoneWave.cs @@ -26,6 +26,7 @@ namespace CalamityMod.Projectiles.Boss projectile.tileCollide = false; projectile.penetrate = -1; projectile.timeLeft = 1200; + projectile.Opacity = 0f; cooldownSlot = 1; } @@ -43,6 +44,7 @@ namespace CalamityMod.Projectiles.Boss { x++; projectile.velocity.Y = (float)(5D * Math.Sin(x / 5D)); + projectile.frameCounter++; if (projectile.frameCounter > 12) { @@ -50,18 +52,19 @@ namespace CalamityMod.Projectiles.Boss projectile.frameCounter = 0; } if (projectile.frame > 3) - { projectile.frame = 0; - } - Lighting.AddLight(projectile.Center, 0.5f, 0f, 0f); + + if (projectile.timeLeft < 60) + projectile.Opacity = MathHelper.Clamp(projectile.timeLeft / 60f, 0f, 1f); + else + projectile.Opacity = MathHelper.Clamp(1f - ((projectile.timeLeft - 1140) / 60f), 0f, 1f); + + Lighting.AddLight(projectile.Center, 0.5f, 0f, 0f); + if (projectile.velocity.X < 0f) - { projectile.spriteDirection = 1; - } else - { projectile.spriteDirection = -1; - } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) @@ -70,17 +73,18 @@ namespace CalamityMod.Projectiles.Boss Texture2D texture2D13 = Main.projectileTexture[projectile.type]; int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; 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, 0f); + lightColor.R = (byte)(255 * projectile.Opacity); + 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(texture2D13.Width / 2f, num214 / 2f), projectile.scale, spriteEffects, 0f); return false; } - public override Color? GetAlpha(Color lightColor) - { - return new Color(250, 50, 50, projectile.alpha); - } + public override bool CanHitPlayer(Player target) => projectile.Opacity == 1f; - public override void OnHitPlayer(Player target, int damage, bool crit) + public override void OnHitPlayer(Player target, int damage, bool crit) { + if (projectile.Opacity != 1f) + return; + target.AddBuff(ModContent.BuffType(), 180); target.AddBuff(ModContent.BuffType(), 120, true); } diff --git a/Projectiles/Boss/CosmicFlameBurst.cs b/Projectiles/Boss/CosmicFlameBurst.cs deleted file mode 100644 index e8ae26ea24..0000000000 --- a/Projectiles/Boss/CosmicFlameBurst.cs +++ /dev/null @@ -1,77 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Boss -{ - public class CosmicFlameBurst : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cosmic Flame"); - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - cooldownSlot = 1; - } - - public override void AI() - { - if (projectile.localAI[0] == 0f) - { - Main.PlaySound(SoundID.Item73, (int)projectile.position.X, (int)projectile.position.Y); - projectile.localAI[0] += 1f; - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num468 = 0; num468 < 2; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 3f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(SoundID.Item74, (int)projectile.position.X, (int)projectile.position.Y); - projectile.position = projectile.Center; - projectile.width = projectile.height = 48; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num621 = 0; num621 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 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 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 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, 173, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - projectile.Damage(); - } - - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { - target.Calamity().lastProjectileHit = projectile; - } - } -} diff --git a/Projectiles/Boss/DarkEnergyBall.cs b/Projectiles/Boss/DarkEnergyBall.cs index f174260fcc..7892710b88 100644 --- a/Projectiles/Boss/DarkEnergyBall.cs +++ b/Projectiles/Boss/DarkEnergyBall.cs @@ -80,6 +80,11 @@ namespace CalamityMod.Projectiles.Boss return false; } + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.VortexDebuff, 60); + } + public override void Kill(int timeLeft) { for (int k = 0; k < 5; k++) diff --git a/Projectiles/Boss/DarkEnergyBall2.cs b/Projectiles/Boss/DarkEnergyBall2.cs index 0369e7a7ab..b48b9510fb 100644 --- a/Projectiles/Boss/DarkEnergyBall2.cs +++ b/Projectiles/Boss/DarkEnergyBall2.cs @@ -93,6 +93,11 @@ namespace CalamityMod.Projectiles.Boss return false; } + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.VortexDebuff, 60); + } + public override void Kill(int timeLeft) { for (int k = 0; k < 5; k++) diff --git a/Projectiles/Boss/DeusRitualDrama.cs b/Projectiles/Boss/DeusRitualDrama.cs new file mode 100644 index 0000000000..20f12a90fd --- /dev/null +++ b/Projectiles/Boss/DeusRitualDrama.cs @@ -0,0 +1,179 @@ +using CalamityMod.Dusts; +using CalamityMod.NPCs.AstrumDeus; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.DataStructures; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class DeusRitualDrama : ModProjectile + { + public float Time + { + get => projectile.ai[0]; + set => projectile.ai[0] = value; + } + public const int TotalSinePeriods = 6; + public const int PulseTime = 45; + public const int TotalRitualTime = 420; + public const float MaxUpwardRise = 540f; + public static readonly Point PulseSize = new Point(300, 300); + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Deus Ritual Drama"); + } + + public override void SetDefaults() + { + projectile.width = projectile.height = 2; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.timeLeft = TotalRitualTime; + } + + public override void AI() + { + Time++; + if (Time == TotalRitualTime - PulseTime) + { + int idx = NPC.NewNPC((int)projectile.Center.X, (int)projectile.Center.Y - (int)MaxUpwardRise, ModContent.NPCType(), 1); + if (idx != -1) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + CalamityUtils.BossAwakenMessage(idx); + } + else + { + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, idx); + } + } + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + float upwardnessRatio = Utils.InverseLerp(60f, TotalRitualTime, Time, true); + float upwardness = MathHelper.Lerp(0f, MaxUpwardRise, upwardnessRatio); + if (Time >= TotalRitualTime - PulseTime) + { + spriteBatch.End(); + spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointWrap, DepthStencilState.Default, RasterizerState.CullNone, null, Main.GameViewMatrix.ZoomMatrix); + float pulseCompletionRatio = Utils.InverseLerp(TotalRitualTime - PulseTime, TotalRitualTime, Time, true); + Vector2 scale = projectile.scale * (3f + pulseCompletionRatio * 5f) * new Vector2(1.5f, 1f); + DrawData drawData = new DrawData(ModContent.GetTexture("Terraria/Misc/Perlin"), + projectile.Center - Main.screenPosition + PulseSize.ToVector2() * scale * 0.5f - Vector2.UnitY * upwardness, + new Rectangle(0, 0, PulseSize.X, PulseSize.Y), + new Color(new Vector4(1f - (float)Math.Sqrt(pulseCompletionRatio))) * 0.66f, + projectile.rotation, + PulseSize.ToVector2(), + scale, + SpriteEffects.None, 0); + + Color pulseColor = Color.Lerp(Color.Cyan * 1.5f, Color.OrangeRed, MathHelper.Clamp(pulseCompletionRatio * 1.5f, 0f, 1f)); + GameShaders.Misc["ForceField"].UseColor(pulseColor); + GameShaders.Misc["ForceField"].Apply(drawData); + drawData.Draw(spriteBatch); + return false; + } + float outwardnessRatio = Utils.InverseLerp(60f, 220f, Time, true); + if (Time > 250f) + outwardnessRatio = 1f - Utils.InverseLerp(250f, TotalRitualTime - PulseTime, Time, true); + float outwardness = MathHelper.Lerp(0f, 140f, outwardnessRatio); + + Vector2 offset = new Vector2((float)Math.Sin(Time / (TotalRitualTime - PulseTime) * MathHelper.TwoPi * TotalSinePeriods) * outwardness, -upwardness); + + // If the stars "collide", generate some small explosion dust. + if (!Main.dedServ && Math.Abs(offset.X) < 6f && Time > 60f) + { + for (int i = 0; i < 20; i++) + { + Dust dust = Dust.NewDustPerfect(projectile.Center + Vector2.UnitY * offset.Y, 261); + dust.color = Utils.SelectRandom(Main.rand, Color.Cyan, Color.OrangeRed); + dust.scale = 1.15f; + dust.velocity = Main.rand.NextVector2CircularEdge(3f, 3f) * Main.rand.NextFloat(0.7f, 1.4f); + dust.noGravity = true; + + float angle = MathHelper.TwoPi * i / 20f; + dust = Dust.NewDustPerfect(projectile.Center + Vector2.UnitY * offset.Y, 261); + dust.color = Utils.SelectRandom(Main.rand, Color.Cyan, Color.OrangeRed); + dust.scale = 1.15f; + dust.velocity = angle.ToRotationVector2() * 7f; + dust.noGravity = true; + } + } + + DrawStars(spriteBatch, offset); + + return false; + } + + public void DrawStars(SpriteBatch spriteBatch, Vector2 offset) + { + Texture2D starTexture = ModContent.GetTexture(Texture); + for (int i = 0; i < 6; i++) + { + float angle = MathHelper.TwoPi * i / 6f + Time / 15f; + Vector2 angularOffset = angle.ToRotationVector2() * 4f; + spriteBatch.Draw(starTexture, + projectile.Center + angularOffset + offset - Main.screenPosition, + null, + Color.Cyan * 0.5f, + 0f, + starTexture.Size() * 0.5f, + 0.6f, + SpriteEffects.None, + 0f); + spriteBatch.Draw(starTexture, + projectile.Center + angularOffset + offset * new Vector2(-1f, 1f) - Main.screenPosition, + null, + Color.OrangeRed * 0.5f, + 0f, + starTexture.Size() * 0.5f, + 0.6f, + SpriteEffects.None, + 0f); + } + spriteBatch.Draw(starTexture, + projectile.Center + offset - Main.screenPosition, + null, + Color.Cyan * 1.4f, + 0f, + starTexture.Size() * 0.5f, + 0.6f, + SpriteEffects.None, + 0f); + spriteBatch.Draw(starTexture, + projectile.Center + offset * new Vector2(-1f, 1f) - Main.screenPosition, + null, + Color.OrangeRed * 1.1f, + 0f, + starTexture.Size() * 0.5f, + 0.6f, + SpriteEffects.None, + 0f); + + // Generate dust at the star position. This gives them a trail effect. + if (!Main.dedServ) + { + Dust dust2 = Dust.NewDustPerfect(projectile.Center + offset, 261); + dust2.color = Color.Cyan; + dust2.scale = 1.15f; + dust2.velocity = Vector2.Zero; + dust2.noGravity = true; + + dust2 = Dust.NewDustPerfect(projectile.Center + offset * new Vector2(-1f, 1f), 261); + dust2.color = Color.OrangeRed; + dust2.scale = 1.15f; + dust2.velocity = Vector2.Zero; + dust2.noGravity = true; + } + } + } +} diff --git a/Projectiles/Boss/DeusRitualDrama.png b/Projectiles/Boss/DeusRitualDrama.png new file mode 100644 index 0000000000..306efb434e Binary files /dev/null and b/Projectiles/Boss/DeusRitualDrama.png differ diff --git a/Projectiles/Boss/DoGBeamPortal.cs b/Projectiles/Boss/DoGBeamPortal.cs index 844466f5c0..89e6fa7364 100644 --- a/Projectiles/Boss/DoGBeamPortal.cs +++ b/Projectiles/Boss/DoGBeamPortal.cs @@ -56,43 +56,40 @@ namespace CalamityMod.Projectiles.Boss if (beamTimer <= 0) { Main.PlaySound(SoundID.Item33, (int)projectile.position.X, (int)projectile.position.Y); - float spread = 30f * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; - if (projectile.owner == Main.myPlayer) - { - for (i = 0; i < 4; i++) - { - float speed = 4f; - int seeProjFileforDmg = 0; - if (CalamityWorld.death) - { - speed = 7f; - } - else if (CalamityWorld.revenge) - { - speed = 6f; - } - else if (Main.expertMode) - { - speed = 5f; - } - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * speed), (float)(Math.Cos(offsetAngle) * speed), ModContent.ProjectileType(), seeProjFileforDmg, projectile.knockBack, projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * speed), (float)(-Math.Cos(offsetAngle) * speed), ModContent.ProjectileType(), seeProjFileforDmg, projectile.knockBack, projectile.owner, 0f, 0f); - } - } + if (projectile.owner == Main.myPlayer) + { + float speed = 3f; + int seeProjFileforDmg = 0; + if (CalamityWorld.death) + { + speed = 5f; + } + else if (CalamityWorld.revenge) + { + speed = 4.5f; + } + else if (Main.expertMode) + { + speed = 4f; + } + speed *= projectile.ai[0]; + int totalProjectiles = 8; + float radians = MathHelper.TwoPi / totalProjectiles; + for (int i = 0; i < totalProjectiles; i++) + { + Vector2 vector255 = new Vector2(0f, -speed).RotatedBy(radians * i); + Projectile.NewProjectile(projectile.Center, vector255, ModContent.ProjectileType(), seeProjFileforDmg, 0f, projectile.owner, 0f, 0f); + } + } beamTimer = 180; } - int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); + int num103 = Player.FindClosest(projectile.Center, 1, 1); float scaleFactor2 = projectile.velocity.Length(); Vector2 vector11 = Main.player[num103].Center - projectile.Center; if (Vector2.Distance(Main.player[num103].Center, projectile.Center) > 2000f) { - projectile.position.X = (float)(Main.player[num103].Center.X / 16) * 16f - (float)(projectile.width / 2); - projectile.position.Y = (float)(Main.player[num103].Center.Y / 16) * 16f - (float)(projectile.height / 2) - 250f; + projectile.position.X = Main.player[num103].Center.X / 16 * 16f - (projectile.width / 2); + projectile.position.Y = Main.player[num103].Center.Y / 16 * 16f - (projectile.height / 2) - 250f; projectile.ai[1] = 0f; beamTimer = 90; } @@ -112,7 +109,7 @@ namespace CalamityMod.Projectiles.Boss if (Main.rand.NextBool(2)) { Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } for (int num623 = 0; num623 < 60; num623++) @@ -142,8 +139,8 @@ namespace CalamityMod.Projectiles.Boss if (projectile.timeLeft < 85) { byte b2 = (byte)(projectile.timeLeft * 3); - byte a2 = (byte)(100f * ((float)b2 / 255f)); - return new Color((int)b2, (int)b2, (int)b2, (int)a2); + byte a2 = (byte)(100f * (b2 / 255f)); + return new Color(b2, b2, b2, a2); } return new Color(255, 255, 255, 100); } diff --git a/Projectiles/Boss/DoGDeath.cs b/Projectiles/Boss/DoGDeath.cs index 97125619f8..23dbe65792 100644 --- a/Projectiles/Boss/DoGDeath.cs +++ b/Projectiles/Boss/DoGDeath.cs @@ -1,12 +1,22 @@ using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; -using System; +using Microsoft.Xna.Framework.Graphics; +using System.IO; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class DoGDeath : ModProjectile { + public float TelegraphDelay + { + get => projectile.ai[0]; + set => projectile.ai[0] = value; + } + public Vector2 OldVelocity; + public const float TelegraphTotalTime = 75f; + public const float TelegraphFadeTime = 15f; + public const float TelegraphWidth = 4200f; public override void SetStaticDefaults() { DisplayName.SetDefault("Death Beam"); @@ -26,19 +36,57 @@ namespace CalamityMod.Projectiles.Boss cooldownSlot = 1; } + public override void SendExtraAI(BinaryWriter writer) + { + writer.WriteVector2(OldVelocity); + } + public override void ReceiveExtraAI(BinaryReader reader) + { + OldVelocity = reader.ReadVector2(); + } + public override void AI() { - if (projectile.alpha > 0) + // Determine the relative opacities for each player based on their distance. + // This has a lower bound of 0.35 to prevent the laser from going completely invisible and players getting hit by cheap shots. + if (projectile.localAI[0] == 0f) { - projectile.alpha -= 25; + projectile.localAI[0] = 1f; + projectile.netUpdate = true; } - if (projectile.alpha < 0) + // Fade in after telegraphs have faded. + if (TelegraphDelay > TelegraphTotalTime) { - projectile.alpha = 0; + if (projectile.alpha > 0) + { + projectile.alpha -= 25; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + // If an old velocity is in reserve, set the true velocity to it and make it as "taken" by setting it to <0,0> + if (OldVelocity != Vector2.Zero) + { + projectile.velocity = OldVelocity; + OldVelocity = Vector2.Zero; + projectile.netUpdate = true; + } + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + // Otherwise, be sure to save the velocity the projectile started with. It will be set again when the telegraph is over. + else if (OldVelocity == Vector2.Zero) + { + OldVelocity = projectile.velocity; + projectile.velocity = Vector2.Zero; + projectile.netUpdate = true; + projectile.rotation = OldVelocity.ToRotation() + MathHelper.PiOver2; + } + TelegraphDelay++; } + public override bool CanDamage() => TelegraphDelay > TelegraphTotalTime; + public override void OnHitPlayer(Player target, int damage, bool crit) { target.AddBuff(ModContent.BuffType(), 180); @@ -53,5 +101,34 @@ namespace CalamityMod.Projectiles.Boss { target.Calamity().lastProjectileHit = projectile; } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + if (TelegraphDelay >= TelegraphTotalTime) + return true; + Texture2D laserTelegraph = ModContent.GetTexture("CalamityMod/ExtraTextures/LaserWallTelegraphBeam"); + float yScale = 2f; + if (TelegraphDelay < TelegraphFadeTime) + { + yScale = MathHelper.Lerp(0f, 2f, TelegraphDelay / 15f); + } + if (TelegraphDelay > TelegraphTotalTime - TelegraphFadeTime) + { + yScale = MathHelper.Lerp(2f, 0f, (TelegraphDelay - (TelegraphTotalTime - TelegraphFadeTime)) / 15f); + } + Vector2 scaleInner = new Vector2(TelegraphWidth / laserTelegraph.Width, yScale); + Vector2 origin = laserTelegraph.Size() * new Vector2(0f, 0.5f); + Vector2 scaleOuter = scaleInner * new Vector2(1f, 1.6f); + + Color colorOuter = Color.Lerp(Color.Cyan, Color.Purple, TelegraphDelay / TelegraphTotalTime * 2f % 1f); // Iterate through purple and cyan once and then flash. + Color colorInner = Color.Lerp(colorOuter, Color.White, 0.75f); + + colorOuter *= 0.7f; + colorInner *= 0.7f; + + spriteBatch.Draw(laserTelegraph, projectile.Center - Main.screenPosition, null, colorInner, OldVelocity.ToRotation(), origin, scaleInner, SpriteEffects.None, 0f); + spriteBatch.Draw(laserTelegraph, projectile.Center - Main.screenPosition, null, colorOuter, OldVelocity.ToRotation(), origin, scaleOuter, SpriteEffects.None, 0f); + return false; + } } } diff --git a/Projectiles/Boss/EssenceDust.cs b/Projectiles/Boss/EssenceDust.cs index 72cee558a4..f82bff0d80 100644 --- a/Projectiles/Boss/EssenceDust.cs +++ b/Projectiles/Boss/EssenceDust.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -64,7 +65,12 @@ namespace CalamityMod.Projectiles.Boss projectile.Damage(); } - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 180); + } + + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) { target.Calamity().lastProjectileHit = projectile; } diff --git a/Projectiles/Boss/FlareBomb.cs b/Projectiles/Boss/FlareBomb.cs index 7313b29f6e..00b8164505 100644 --- a/Projectiles/Boss/FlareBomb.cs +++ b/Projectiles/Boss/FlareBomb.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -30,6 +31,7 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; + projectile.frameCounter++; if (projectile.frameCounter > 4) { @@ -40,17 +42,9 @@ namespace CalamityMod.Projectiles.Boss { projectile.frame = 0; } + Lighting.AddLight(projectile.Center, 0.5f, 0.25f, 0f); - float num953 = revenge ? 110f : 100f; - float scaleFactor12 = revenge ? 35f : 30f; - if (projectile.ai[1] == 1f) - { - num953 *= 0.7f; - scaleFactor12 *= 0.7f; - } - - float num954 = 40f; if (projectile.timeLeft > 30 && projectile.alpha > 0) { projectile.alpha -= 25; @@ -63,17 +57,21 @@ namespace CalamityMod.Projectiles.Boss { projectile.alpha = 0; } - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - int num959 = (int)projectile.ai[0]; + + if (projectile.timeLeft > 135 && projectile.ai[1] == 1f) + return; + + float num953 = revenge ? 110f : 100f; + float num954 = 40f; + float scaleFactor12 = revenge ? 50f : 40f; + + if (projectile.ai[1] == 1f) + { + num953 *= 0.7f; + scaleFactor12 *= 0.7f; + } + + int num959 = (int)projectile.ai[0]; if (num959 >= 0 && Main.player[num959].active && !Main.player[num959].dead) { if (projectile.Distance(Main.player[num959].Center) > num954) @@ -95,7 +93,10 @@ namespace CalamityMod.Projectiles.Boss } } - float num1247 = 0.1f; + if (projectile.timeLeft < 60 || projectile.ai[1] == 1f) + return; + + float num1247 = 0.5f; for (int num1248 = 0; num1248 < Main.maxProjectiles; num1248++) { if (Main.projectile[num1248].active) @@ -143,7 +144,7 @@ namespace CalamityMod.Projectiles.Boss projectile.Damage(); for (int num621 = 0; num621 < 3; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -153,16 +154,21 @@ namespace CalamityMod.Projectiles.Boss } for (int num623 = 0; num623 < 5; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(projectile.position, 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); + num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - CalamityUtils.ExplosionGores(projectile, 3); + CalamityUtils.ExplosionGores(projectile.Center, 3); } - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 180); + } + + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) { target.Calamity().lastProjectileHit = projectile; } diff --git a/Projectiles/Boss/FlareDust.cs b/Projectiles/Boss/FlareDust.cs index 1505a5b87a..ef1fb85b8e 100644 --- a/Projectiles/Boss/FlareDust.cs +++ b/Projectiles/Boss/FlareDust.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -126,7 +127,7 @@ namespace CalamityMod.Projectiles.Boss projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); for (int num621 = 0; num621 < 2; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1f); + int num622 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -136,18 +137,23 @@ namespace CalamityMod.Projectiles.Boss } for (int num623 = 0; num623 < 4; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + int num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1f); + num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1f); Main.dust[num624].velocity *= 2f; } - CalamityUtils.ExplosionGores(projectile, 3); + CalamityUtils.ExplosionGores(projectile.Center, 3); projectile.damage = Main.expertMode ? 75 : 90; projectile.Damage(); } - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 180); + } + + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) { target.Calamity().lastProjectileHit = projectile; } diff --git a/Projectiles/Boss/FlareDust2.cs b/Projectiles/Boss/FlareDust2.cs index 07450c1ee3..ff2ed24cc2 100644 --- a/Projectiles/Boss/FlareDust2.cs +++ b/Projectiles/Boss/FlareDust2.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -136,7 +137,7 @@ namespace CalamityMod.Projectiles.Boss projectile.Damage(); for (int num621 = 0; num621 < 2; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1f); + int num622 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -146,16 +147,21 @@ namespace CalamityMod.Projectiles.Boss } for (int num623 = 0; num623 < 4; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + int num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1f); + num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1f); Main.dust[num624].velocity *= 2f; } - CalamityUtils.ExplosionGores(projectile, 3); + CalamityUtils.ExplosionGores(projectile.Center, 3); } - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 180); + } + + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) { target.Calamity().lastProjectileHit = projectile; } diff --git a/Projectiles/Boss/Flarenado.cs b/Projectiles/Boss/Flarenado.cs index 14b84be335..1829441a28 100644 --- a/Projectiles/Boss/Flarenado.cs +++ b/Projectiles/Boss/Flarenado.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -153,7 +154,12 @@ namespace CalamityMod.Projectiles.Boss return false; } - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 300); + } + + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) { target.Calamity().lastProjectileHit = projectile; } diff --git a/Projectiles/Boss/FrostMist.cs b/Projectiles/Boss/FrostMist.cs index 74a0e0b614..cc7d85f7b7 100644 --- a/Projectiles/Boss/FrostMist.cs +++ b/Projectiles/Boss/FrostMist.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Frost Mist"); - Main.projFrames[projectile.type] = 6; + Main.projFrames[projectile.type] = 8; ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; ProjectileID.Sets.TrailingMode[projectile.type] = 0; } @@ -24,9 +24,10 @@ namespace CalamityMod.Projectiles.Boss projectile.height = 20; projectile.hostile = true; projectile.ignoreWater = true; + projectile.tileCollide = false; projectile.penetrate = -1; projectile.timeLeft = 300; - projectile.alpha = 255; + projectile.Opacity = 0f; projectile.coldDamage = true; } @@ -42,107 +43,91 @@ namespace CalamityMod.Projectiles.Boss projectile.localAI[1] = reader.ReadSingle(); } - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - if (projectile.ai[1] == 0f) - { - for (int num621 = 0; num621 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 187, 0f, 0f, 100, default, 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; - } - } - projectile.ai[1] = 1f; - Main.PlaySound(SoundID.Item30, projectile.position); - } - projectile.localAI[1] += 1f; - if (projectile.localAI[1] == 16f) - { - projectile.localAI[1] = 0f; - for (int l = 0; l < 12; l++) - { - Vector2 vector3 = Vector2.UnitX * (float)-(float)projectile.width / 2f; - vector3 += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default) * new Vector2(8f, 16f); - vector3 = vector3.RotatedBy((double)(projectile.rotation - 1.57079637f), default); - int num9 = Dust.NewDust(projectile.Center, 0, 0, 187, 0f, 0f, 160, default, 1f); - Main.dust[num9].scale = 1.1f; - Main.dust[num9].noGravity = true; - Main.dust[num9].position = projectile.Center + vector3; - Main.dust[num9].velocity = projectile.velocity * 0.1f; - Main.dust[num9].velocity = Vector2.Normalize(projectile.Center - projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; - } - } - if (projectile.localAI[0] == 0f) - { - projectile.scale -= 0.01f; - projectile.alpha += 10; - if (projectile.alpha >= 100) - { - projectile.alpha = 100; - projectile.localAI[0] = 1f; - } - } - else if (projectile.localAI[0] == 1f) - { - projectile.scale += 0.01f; - projectile.alpha -= 10; - if (projectile.alpha <= 0) - { - projectile.alpha = 0; - projectile.localAI[0] = 0f; - } - } - if (projectile.ai[0] == 1f) - { - int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); - projectile.ai[1] += 1f; - if (projectile.ai[1] < 110f && projectile.ai[1] > 30f) - { - float scaleFactor2 = projectile.velocity.Length(); - Vector2 vector11 = Main.player[num103].Center - projectile.Center; - vector11.Normalize(); - vector11 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 24f + vector11) / 25f; - projectile.velocity.Normalize(); - projectile.velocity *= scaleFactor2; - } - if (projectile.velocity.Length() < 12f) - { - projectile.velocity *= 1.02f; - } - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - Lighting.AddLight(projectile.Center, 0f, (255 - projectile.alpha) * 0.35f / 255f, (255 - projectile.alpha) * 0.35f / 255f); - } + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= Main.projFrames[projectile.type]) + projectile.frame = 0; - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } + if (projectile.ai[1] == 0f) + { + for (int num621 = 0; num621 < 5; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 187, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + } + } + projectile.ai[1] = 1f; + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(200, 200, 200, projectile.alpha); - } + projectile.localAI[1] += 1f; + if (projectile.localAI[1] == 16f) + { + projectile.localAI[1] = 0f; + for (int l = 0; l < 12; l++) + { + Vector2 vector3 = Vector2.UnitX * -projectile.width / 2f; + vector3 += -Vector2.UnitY.RotatedBy(l * MathHelper.Pi / 6f) * new Vector2(8f, 16f); + vector3 = vector3.RotatedBy(projectile.rotation - MathHelper.PiOver2); + int num9 = Dust.NewDust(projectile.Center, 0, 0, 187, 0f, 0f, 160, default, 1f); + Main.dust[num9].scale = 1.1f; + Main.dust[num9].noGravity = true; + Main.dust[num9].position = projectile.Center + vector3; + Main.dust[num9].velocity = projectile.velocity * 0.1f; + Main.dust[num9].velocity = Vector2.Normalize(projectile.Center - projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; + } + } - public override void OnHitPlayer(Player target, int damage, bool crit) + if (projectile.timeLeft < 30) + projectile.Opacity = MathHelper.Clamp(projectile.timeLeft / 30f, 0f, 1f); + else + projectile.Opacity = MathHelper.Clamp(1f - ((projectile.timeLeft - 270) / 30f), 0f, 1f); + + int num103 = Player.FindClosest(projectile.Center, 1, 1); + projectile.ai[1] += 1f; + if (projectile.ai[1] < 140f && projectile.ai[1] > 60f) + { + float scaleFactor2 = projectile.velocity.Length(); + Vector2 vector11 = Main.player[num103].Center - projectile.Center; + vector11.Normalize(); + vector11 *= scaleFactor2; + projectile.velocity = (projectile.velocity * 24f + vector11) / 25f; + projectile.velocity.Normalize(); + projectile.velocity *= scaleFactor2; + } + if (projectile.velocity.Length() < 12f) + projectile.velocity *= 1.02f; + + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; + Lighting.AddLight(projectile.Center, 0f, 0.35f * projectile.Opacity, 0.35f * projectile.Opacity); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + lightColor.R = (byte)(255 * projectile.Opacity); + lightColor.G = (byte)(255 * projectile.Opacity); + lightColor.B = (byte)(255 * projectile.Opacity); + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + + public override bool CanHitPlayer(Player target) => projectile.Opacity == 1f; + + public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(BuffID.Frostburn, 240, true); + if (projectile.Opacity != 1f) + return; + + target.AddBuff(BuffID.Frostburn, 240, true); target.AddBuff(BuffID.Chilled, 120, true); target.AddBuff(BuffID.Frozen, 30, true); } diff --git a/Projectiles/Boss/FrostMist.png b/Projectiles/Boss/FrostMist.png index 8349afb42d..ef17040dd0 100644 Binary files a/Projectiles/Boss/FrostMist.png and b/Projectiles/Boss/FrostMist.png differ diff --git a/Projectiles/Boss/HiveBombGoliath.cs b/Projectiles/Boss/HiveBombGoliath.cs index d8caa973cb..383f5dfa4a 100644 --- a/Projectiles/Boss/HiveBombGoliath.cs +++ b/Projectiles/Boss/HiveBombGoliath.cs @@ -62,13 +62,13 @@ namespace CalamityMod.Projectiles.Boss } else if (Main.rand.NextBool(4)) { - int num252 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default, 0.5f); + int num252 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 31, 0f, 0f, 100, default, 0.5f); Main.dust[num252].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[num252].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f; Main.dust[num252].noGravity = true; Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2)).RotatedBy((double)projectile.rotation, default) * 1.1f; Main.rand.Next(2); - num252 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 1f); + num252 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 6, 0f, 0f, 100, default, 1f); Main.dust[num252].scale = 1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[num252].noGravity = true; Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2 - 6)).RotatedBy((double)projectile.rotation, default) * 1.1f; @@ -97,7 +97,7 @@ namespace CalamityMod.Projectiles.Boss Main.PlaySound(SoundID.Item14, projectile.position); for (int num621 = 0; num621 < 8; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 89, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 89, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -107,13 +107,13 @@ namespace CalamityMod.Projectiles.Boss } for (int num623 = 0; num623 < 10; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 89, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 89, 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, 89, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 89, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - CalamityUtils.ExplosionGores(projectile, 3); + CalamityUtils.ExplosionGores(projectile.Center, 3); } public override void OnHitPlayer(Player target, int damage, bool crit) diff --git a/Projectiles/Boss/HolyBurnOrb.cs b/Projectiles/Boss/HolyBurnOrb.cs index 920c6f23d6..eb6db64052 100644 --- a/Projectiles/Boss/HolyBurnOrb.cs +++ b/Projectiles/Boss/HolyBurnOrb.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Boss { projectile.width = 30; projectile.height = 30; - projectile.friendly = true; + projectile.hostile = true; projectile.ignoreWater = true; projectile.tileCollide = false; projectile.alpha = 255; @@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - if (projectile.ai[0] < 80f) + if (projectile.ai[0] < 240f) { projectile.ai[0] += 1f; @@ -41,14 +41,15 @@ namespace CalamityMod.Projectiles.Boss } bool expertMode = Main.expertMode; - projectile.velocity *= 1.01f; - int num487 = Player.FindClosest(projectile.position, projectile.width, projectile.height); - Vector2 vector36 = new Vector2(projectile.position.X + projectile.width * 0.5f, projectile.position.Y + projectile.height * 0.5f); - float num489 = Main.player[num487].Center.X - vector36.X; - float num490 = Main.player[num487].Center.Y - vector36.Y; - float num491 = (float)Math.Sqrt(num489 * num489 + num490 * num490); - if (num491 < 50f && projectile.position.X < Main.player[num487].position.X + Main.player[num487].width && projectile.position.X + projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + Main.player[num487].height && projectile.position.Y + projectile.height > Main.player[num487].position.Y) + if (projectile.velocity.Length() < 16f) + projectile.velocity *= 1.01f; + + projectile.ai[1] = Player.FindClosest(projectile.position, projectile.width, projectile.height); + int num487 = (int)projectile.ai[1]; + float num491 = Vector2.Distance(Main.player[num487].Center, projectile.Center); + + if (num491 < 50f && !Main.player[num487].dead && projectile.position.X < Main.player[num487].position.X + Main.player[num487].width && projectile.position.X + projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + Main.player[num487].height && projectile.position.Y + projectile.height > Main.player[num487].position.Y) { int num492 = expertMode ? -150 : -100; if (CalamityWorld.death || CalamityWorld.bossRushActive) @@ -66,7 +67,7 @@ namespace CalamityMod.Projectiles.Boss { Main.player[num487].KillMe(PlayerDeathReason.ByCustomReason(Main.player[Main.myPlayer].name + " burst into sinless ash."), 1000.0, 0, false); } - NetMessage.SendData(MessageID.SpiritHeal, -1, -1, null, num487, num492, 0f, 0f, 0, 0, 0); + NetMessage.SendData(MessageID.SpiritHeal, -1, -1, null, num487, num492); projectile.Kill(); } } diff --git a/Projectiles/Boss/HolyLight.cs b/Projectiles/Boss/HolyLight.cs index a43f292c80..a90f4bd63f 100644 --- a/Projectiles/Boss/HolyLight.cs +++ b/Projectiles/Boss/HolyLight.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Projectiles.Boss { projectile.width = 20; projectile.height = 20; - projectile.friendly = true; + projectile.hostile = true; projectile.ignoreWater = true; projectile.tileCollide = false; projectile.alpha = 255; @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - if (projectile.ai[0] < 80f) + if (projectile.ai[0] < 240f) { projectile.ai[0] += 1f; @@ -37,13 +37,15 @@ namespace CalamityMod.Projectiles.Boss } bool expertMode = Main.expertMode; - projectile.velocity *= 1.01f; - int num487 = Player.FindClosest(projectile.position, projectile.width, projectile.height); - Vector2 vector36 = new Vector2(projectile.position.X + projectile.width * 0.5f, projectile.position.Y + projectile.height * 0.5f); - float num489 = Main.player[num487].Center.X - vector36.X; - float num490 = Main.player[num487].Center.Y - vector36.Y; - float num491 = (float)Math.Sqrt(num489 * num489 + num490 * num490); - if (num491 < 50f && projectile.position.X < Main.player[num487].position.X + Main.player[num487].width && projectile.position.X + projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + Main.player[num487].height && projectile.position.Y + projectile.height > Main.player[num487].position.Y) + + if (projectile.velocity.Length() < 16f) + projectile.velocity *= 1.01f; + + projectile.ai[1] = Player.FindClosest(projectile.position, projectile.width, projectile.height); + int num487 = (int)projectile.ai[1]; + float num491 = Vector2.Distance(Main.player[num487].Center, projectile.Center); + + if (num491 < 50f && !Main.player[num487].dead && projectile.position.X < Main.player[num487].position.X + Main.player[num487].width && projectile.position.X + projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + Main.player[num487].height && projectile.position.Y + projectile.height > Main.player[num487].position.Y) { int num492 = expertMode ? 50 : 35; Main.player[num487].HealEffect(num492, false); @@ -52,7 +54,7 @@ namespace CalamityMod.Projectiles.Boss { Main.player[num487].statLife = Main.player[num487].statLifeMax2; } - NetMessage.SendData(MessageID.SpiritHeal, -1, -1, null, num487, num492, 0f, 0f, 0, 0, 0); + NetMessage.SendData(MessageID.SpiritHeal, -1, -1, null, num487, num492); projectile.Kill(); } } diff --git a/Projectiles/Boss/IchorShot.cs b/Projectiles/Boss/IchorShot.cs index e33da37af9..efaee0c312 100644 --- a/Projectiles/Boss/IchorShot.cs +++ b/Projectiles/Boss/IchorShot.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Boss Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; - projectile.velocity.Y = projectile.velocity.Y + 0.06f; + projectile.velocity.Y += 0.06f; projectile.velocity.X *= 0.995f; } diff --git a/Projectiles/Boss/Infernado.cs b/Projectiles/Boss/Infernado.cs index 8a2fca38b2..8aeb0720a9 100644 --- a/Projectiles/Boss/Infernado.cs +++ b/Projectiles/Boss/Infernado.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -154,7 +155,12 @@ namespace CalamityMod.Projectiles.Boss return false; } - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 420); + } + + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) { target.Calamity().lastProjectileHit = projectile; } diff --git a/Projectiles/Boss/Infernado2.cs b/Projectiles/Boss/Infernado2.cs index 891030de8f..13b5e3550e 100644 --- a/Projectiles/Boss/Infernado2.cs +++ b/Projectiles/Boss/Infernado2.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -154,7 +155,12 @@ namespace CalamityMod.Projectiles.Boss return false; } - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 420); + } + + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) { target.Calamity().lastProjectileHit = projectile; } diff --git a/Projectiles/Boss/LeviathanBomb.cs b/Projectiles/Boss/LeviathanBomb.cs index ef87549899..ec927d7ebb 100644 --- a/Projectiles/Boss/LeviathanBomb.cs +++ b/Projectiles/Boss/LeviathanBomb.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System.IO; @@ -64,7 +65,12 @@ namespace CalamityMod.Projectiles.Boss return false; } - public override void Kill(int timeLeft) + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 300); + } + + public override void Kill(int timeLeft) { Main.PlaySound(SoundID.Item14, projectile.position); projectile.Damage(); diff --git a/Projectiles/Boss/MoltenBlast.cs b/Projectiles/Boss/MoltenBlast.cs index c22cb912a6..b79d1986e2 100644 --- a/Projectiles/Boss/MoltenBlast.cs +++ b/Projectiles/Boss/MoltenBlast.cs @@ -57,9 +57,9 @@ namespace CalamityMod.Projectiles.Boss int dustType = Main.dayTime ? (int)CalamityDusts.ProfanedFire : (int)CalamityDusts.Nightwither; if (projectile.ai[1] == 0f) { - for (int num621 = 0; num621 < 10; num621++) + for (int d = 0; d < 10; d++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -106,19 +106,13 @@ namespace CalamityMod.Projectiles.Boss public override void Kill(int timeLeft) { - int num251 = Main.rand.Next(5, 10); + int blobAmt = Main.rand.Next(5, 10); if (projectile.owner == Main.myPlayer) { - for (int num252 = 0; num252 < num251; num252++) + for (int b = 0; b < blobAmt; b++) { - Vector2 value15 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= Main.rand.Next(70, 121) * 0.1f; //70 101 - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, ModContent.ProjectileType(), projectile.damage, 0f, projectile.owner, 0f, 0f); + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); + Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), projectile.damage, 0f, projectile.owner, 0f, 0f); } } Main.PlaySound(SoundID.Item20, projectile.Center); @@ -126,14 +120,14 @@ namespace CalamityMod.Projectiles.Boss int dustType = Main.dayTime ? (int)CalamityDusts.ProfanedFire : (int)CalamityDusts.Nightwither; for (int num193 = 0; num193 < 3; num193++) { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 50, default, 1.5f); + Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, 0f, 0f, 50, default, 1.5f); } for (int num194 = 0; num194 < 30; num194++) { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 0, default, 2.5f); + int num195 = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, 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, dustType, 0f, 0f, 50, default, 1.5f); + num195 = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, 0f, 0f, 50, default, 1.5f); Main.dust[num195].velocity *= 2f; Main.dust[num195].noGravity = true; } diff --git a/Projectiles/Boss/PhantomBlast.cs b/Projectiles/Boss/PhantomBlast.cs index 52c95df3f1..4ee028bf2b 100644 --- a/Projectiles/Boss/PhantomBlast.cs +++ b/Projectiles/Boss/PhantomBlast.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using System; using System.IO; @@ -51,12 +52,12 @@ namespace CalamityMod.Projectiles.Boss projectile.velocity.Y = projectile.velocity.Y + 0.035f; } float scaleFactor3 = 22f; - int num189 = (int)Player.FindClosest(projectile.Center, 1, 1); + int num189 = Player.FindClosest(projectile.Center, 1, 1); Vector2 vector20 = Main.player[num189].Center - projectile.Center; vector20.Normalize(); vector20 *= scaleFactor3; int num190 = 80; - projectile.velocity = (projectile.velocity * (float)(num190 - 1) + vector20) / (float)num190; + projectile.velocity = (projectile.velocity * (num190 - 1) + vector20) / num190; if (projectile.velocity.Length() < 14f) { projectile.velocity.Normalize(); @@ -129,7 +130,12 @@ namespace CalamityMod.Projectiles.Boss } } - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 180); + } + + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) { target.Calamity().lastProjectileHit = projectile; } diff --git a/Projectiles/Boss/PhantomBlast2.cs b/Projectiles/Boss/PhantomBlast2.cs index dcd5a44830..c87d356339 100644 --- a/Projectiles/Boss/PhantomBlast2.cs +++ b/Projectiles/Boss/PhantomBlast2.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using System; using System.IO; @@ -129,7 +130,12 @@ namespace CalamityMod.Projectiles.Boss } } - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 180); + } + + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) { target.Calamity().lastProjectileHit = projectile; } diff --git a/Projectiles/Boss/PhantomMine.cs b/Projectiles/Boss/PhantomMine.cs index a65b2afbba..d7dacfd160 100644 --- a/Projectiles/Boss/PhantomMine.cs +++ b/Projectiles/Boss/PhantomMine.cs @@ -1,3 +1,5 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using System; using Terraria; @@ -66,7 +68,13 @@ namespace CalamityMod.Projectiles.Boss } } - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 180); + } + + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) { target.Calamity().lastProjectileHit = projectile; } diff --git a/Projectiles/Boss/PhantomShot.cs b/Projectiles/Boss/PhantomShot.cs index 6c3074cffa..ad79d9e30f 100644 --- a/Projectiles/Boss/PhantomShot.cs +++ b/Projectiles/Boss/PhantomShot.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using System; using System.IO; @@ -27,19 +28,16 @@ namespace CalamityMod.Projectiles.Boss public override void SendExtraAI(BinaryWriter writer) { writer.Write(projectile.localAI[0]); - writer.Write(projectile.localAI[1]); } public override void ReceiveExtraAI(BinaryReader reader) { projectile.localAI[0] = reader.ReadSingle(); - projectile.localAI[1] = reader.ReadSingle(); } public override bool OnTileCollide(Vector2 oldVelocity) { projectile.penetrate--; - projectile.localAI[1] = -120f; if (projectile.penetrate <= 0) { projectile.Kill(); @@ -65,14 +63,7 @@ namespace CalamityMod.Projectiles.Boss projectile.ai[1] = 1f; Main.PlaySound(SoundID.Item20, projectile.position); } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - projectile.localAI[1] += 1f; - if (projectile.localAI[1] > 180f) - { - projectile.localAI[1] = 0f; - projectile.penetrate--; - projectile.velocity *= -1f; - } + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + 1.57f; projectile.localAI[0] += 1f; if (projectile.localAI[0] > 9f) { @@ -80,14 +71,31 @@ namespace CalamityMod.Projectiles.Boss if (projectile.alpha < 30) projectile.alpha = 30; } - } + if (projectile.localAI[0] > 180f && projectile.localAI[0] < 240f && Main.expertMode) + { + if (projectile.ai[0] == 0f) + projectile.ai[0] = projectile.velocity.Length() * 3f; + + int num189 = Player.FindClosest(projectile.Center, 1, 1); + Vector2 vector20 = Main.player[num189].Center - projectile.Center; + vector20.Normalize(); + vector20 *= projectile.ai[0]; + int num190 = 80; + projectile.velocity = (projectile.velocity * (num190 - 1) + vector20) / num190; + } + } public override Color? GetAlpha(Color lightColor) { return new Color(100, 250, 250, projectile.alpha); } - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 120); + } + + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) { target.Calamity().lastProjectileHit = projectile; } diff --git a/Projectiles/Boss/PhantomShot2.cs b/Projectiles/Boss/PhantomShot2.cs index 620988d1ed..a4d8559c89 100644 --- a/Projectiles/Boss/PhantomShot2.cs +++ b/Projectiles/Boss/PhantomShot2.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using System; using System.IO; @@ -27,19 +28,16 @@ namespace CalamityMod.Projectiles.Boss public override void SendExtraAI(BinaryWriter writer) { writer.Write(projectile.localAI[0]); - writer.Write(projectile.localAI[1]); } public override void ReceiveExtraAI(BinaryReader reader) { projectile.localAI[0] = reader.ReadSingle(); - projectile.localAI[1] = reader.ReadSingle(); } public override bool OnTileCollide(Vector2 oldVelocity) { projectile.penetrate--; - projectile.localAI[1] -= 105f; if (projectile.penetrate <= 0) { projectile.Kill(); @@ -65,14 +63,7 @@ namespace CalamityMod.Projectiles.Boss projectile.ai[1] = 1f; Main.PlaySound(SoundID.Item20, projectile.position); } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - projectile.localAI[1] += 1f; - if (projectile.localAI[1] > 150f) - { - projectile.localAI[1] = 0f; - projectile.penetrate--; - projectile.velocity *= -1f; - } + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + 1.57f; projectile.localAI[0] += 1f; if (projectile.localAI[0] > 9f) { @@ -80,6 +71,18 @@ namespace CalamityMod.Projectiles.Boss if (projectile.alpha < 30) projectile.alpha = 30; } + if (projectile.localAI[0] > 180f && projectile.localAI[0] < 300f && Main.expertMode) + { + if (projectile.ai[0] == 0f) + projectile.ai[0] = projectile.velocity.Length() * 2f; + + int num189 = Player.FindClosest(projectile.Center, 1, 1); + Vector2 vector20 = Main.player[num189].Center - projectile.Center; + vector20.Normalize(); + vector20 *= projectile.ai[0]; + int num190 = 80; + projectile.velocity = (projectile.velocity * (num190 - 1) + vector20) / num190; + } } public override Color? GetAlpha(Color lightColor) @@ -87,7 +90,12 @@ namespace CalamityMod.Projectiles.Boss return new Color(250, 100, 100, projectile.alpha); } - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 120); + } + + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) { target.Calamity().lastProjectileHit = projectile; } diff --git a/Projectiles/Boss/PlagueExplosion.cs b/Projectiles/Boss/PlagueExplosion.cs index d96878a30d..96a616128f 100644 --- a/Projectiles/Boss/PlagueExplosion.cs +++ b/Projectiles/Boss/PlagueExplosion.cs @@ -16,7 +16,8 @@ namespace CalamityMod.Projectiles.Boss { projectile.width = 20; projectile.height = 20; - projectile.hostile = true; + projectile.scale = 1.5f; + projectile.hostile = true; projectile.ignoreWater = true; projectile.tileCollide = false; projectile.penetrate = -1; @@ -25,7 +26,7 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.01f / 255f, (255 - projectile.alpha) * 0.15f / 255f, (255 - projectile.alpha) * 0.05f / 255f); + Lighting.AddLight(projectile.Center, 0f, 0.15f, 0f); bool flag15 = false; bool flag16 = false; if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) @@ -61,12 +62,12 @@ namespace CalamityMod.Projectiles.Boss num461 *= 0.7f; projectile.ai[0] += 4f; int num462 = 0; - while ((float)num462 < num461) + while (num462 < num461) { - float num463 = (float)Main.rand.Next(-10, 11); - float num464 = (float)Main.rand.Next(-10, 11); - float num465 = (float)Main.rand.Next(3, 9); - float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); + float num463 = Main.rand.Next(-10, 11); + float num464 = Main.rand.Next(-10, 11); + float num465 = Main.rand.Next(3, 9); + float num466 = (float)Math.Sqrt(num463 * num463 + num464 * num464); num466 = num465 / num466; num463 *= num466; num464 *= num466; @@ -75,9 +76,9 @@ namespace CalamityMod.Projectiles.Boss Main.dust[num467].position.X = projectile.Center.X; Main.dust[num467].position.Y = projectile.Center.Y; Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); + expr_149DF_cp_0.position.X += Main.rand.Next(-10, 11); Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); + expr_14A09_cp_0.position.Y += Main.rand.Next(-10, 11); Main.dust[num467].velocity.X = num463; Main.dust[num467].velocity.Y = num464; num462++; diff --git a/Projectiles/Boss/PlagueStingerGoliath.cs b/Projectiles/Boss/PlagueStingerGoliath.cs index b7a4a8a5d7..9355b50714 100644 --- a/Projectiles/Boss/PlagueStingerGoliath.cs +++ b/Projectiles/Boss/PlagueStingerGoliath.cs @@ -17,7 +17,8 @@ namespace CalamityMod.Projectiles.Boss { projectile.width = 10; projectile.height = 10; - projectile.hostile = true; + projectile.scale = 1.5f; + projectile.hostile = true; projectile.penetrate = -1; projectile.tileCollide = false; projectile.timeLeft = 300; @@ -28,9 +29,9 @@ namespace CalamityMod.Projectiles.Boss if (projectile.position.Y > projectile.ai[1]) projectile.tileCollide = true; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; - int num123 = (int)Player.FindClosest(projectile.Center, 1, 1); + int num123 = Player.FindClosest(projectile.Center, 1, 1); projectile.ai[0] += 1f; if (projectile.ai[0] < 110f && projectile.ai[0] > 30f) { @@ -61,13 +62,13 @@ namespace CalamityMod.Projectiles.Boss spriteEffects = SpriteEffects.FlipHorizontally; } Vector2 center = new Vector2(projectile.Center.X, projectile.Center.Y); - Vector2 vector11 = new Vector2((float)(Main.projectileTexture[projectile.type].Width / 2), (float)(Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type] / 2)); + Vector2 vector11 = new Vector2(Main.projectileTexture[projectile.type].Width / 2, Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type] / 2); Vector2 vector = center - Main.screenPosition; - vector -= new Vector2((float)ModContent.GetTexture("CalamityMod/Projectiles/Boss/PlagueStingerGoliathGlow").Width, (float)(ModContent.GetTexture("CalamityMod/Projectiles/Boss/PlagueStingerGoliathGlow").Height / Main.projFrames[projectile.type])) * 1f / 2f; + vector -= new Vector2(ModContent.GetTexture("CalamityMod/Projectiles/Boss/PlagueStingerGoliathGlow").Width, ModContent.GetTexture("CalamityMod/Projectiles/Boss/PlagueStingerGoliathGlow").Height / Main.projFrames[projectile.type]) * 1f / 2f; vector += vector11 * 1f + new Vector2(0f, 0f + 4f + projectile.gfxOffY); - Color color = new Color(127 - projectile.alpha, 127 - projectile.alpha, 127 - projectile.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.Red); + Color color = new Color(127 - projectile.alpha, 127 - projectile.alpha, 127 - projectile.alpha, 0).MultiplyRGBA(Color.Red); Main.spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Boss/PlagueStingerGoliathGlow"), vector, - null, color, projectile.rotation, vector11, 1f, spriteEffects, 0f); + null, color, projectile.rotation, vector11, projectile.scale, spriteEffects, 0f); } } } diff --git a/Projectiles/Boss/PlagueStingerGoliath.png b/Projectiles/Boss/PlagueStingerGoliath.png index 1d5914c74b..0c8fd55607 100644 Binary files a/Projectiles/Boss/PlagueStingerGoliath.png and b/Projectiles/Boss/PlagueStingerGoliath.png differ diff --git a/Projectiles/Boss/PlagueStingerGoliathV2.cs b/Projectiles/Boss/PlagueStingerGoliathV2.cs index 46be68fdc6..dd2f44e3bc 100644 --- a/Projectiles/Boss/PlagueStingerGoliathV2.cs +++ b/Projectiles/Boss/PlagueStingerGoliathV2.cs @@ -18,6 +18,7 @@ namespace CalamityMod.Projectiles.Boss { projectile.width = 10; projectile.height = 10; + projectile.scale = 1.5f; projectile.hostile = true; projectile.penetrate = -1; projectile.extraUpdates = 2; @@ -30,7 +31,7 @@ namespace CalamityMod.Projectiles.Boss if (projectile.position.Y > projectile.ai[1]) projectile.tileCollide = true; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -46,13 +47,13 @@ namespace CalamityMod.Projectiles.Boss spriteEffects = SpriteEffects.FlipHorizontally; } Vector2 center = new Vector2(projectile.Center.X, projectile.Center.Y); - Vector2 vector11 = new Vector2((float)(Main.projectileTexture[projectile.type].Width / 2), (float)(Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type] / 2)); + Vector2 vector11 = new Vector2(Main.projectileTexture[projectile.type].Width / 2, Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type] / 2); Vector2 vector = center - Main.screenPosition; - vector -= new Vector2((float)ModContent.GetTexture("CalamityMod/Projectiles/Boss/PlagueStingerGoliathV2Glow").Width, (float)(ModContent.GetTexture("CalamityMod/Projectiles/Boss/PlagueStingerGoliathV2Glow").Height / Main.projFrames[projectile.type])) * 1f / 2f; + vector -= new Vector2(ModContent.GetTexture("CalamityMod/Projectiles/Boss/PlagueStingerGoliathV2Glow").Width, ModContent.GetTexture("CalamityMod/Projectiles/Boss/PlagueStingerGoliathV2Glow").Height / Main.projFrames[projectile.type]) * 1f / 2f; vector += vector11 * 1f + new Vector2(0f, 0f + 4f + projectile.gfxOffY); - Color color = new Color(127 - projectile.alpha, 127 - projectile.alpha, 127 - projectile.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.Red); + Color color = new Color(127 - projectile.alpha, 127 - projectile.alpha, 127 - projectile.alpha, 0).MultiplyRGBA(Color.Red); Main.spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Boss/PlagueStingerGoliathV2Glow"), vector, - null, color, projectile.rotation, vector11, 1f, spriteEffects, 0f); + null, color, projectile.rotation, vector11, projectile.scale, spriteEffects, 0f); } public override void Kill(int timeLeft) diff --git a/Projectiles/Boss/ProvidenceCrystal.cs b/Projectiles/Boss/ProvidenceCrystal.cs index a1751ddb0b..5680c48c3d 100644 --- a/Projectiles/Boss/ProvidenceCrystal.cs +++ b/Projectiles/Boss/ProvidenceCrystal.cs @@ -48,9 +48,6 @@ namespace CalamityMod.Projectiles.Boss return; } - if (!Main.dayTime) - projectile.timeLeft -= CalamityWorld.death ? 9 : 16; - projectile.position.X = Main.player[projectile.owner].Center.X - (projectile.width / 2); projectile.position.Y = Main.player[projectile.owner].Center.Y - (projectile.height / 2) + Main.player[projectile.owner].gfxOffY - 360f; if (Main.player[projectile.owner].gravDir == -1f) diff --git a/Projectiles/Boss/ProvidenceHolyRay.cs b/Projectiles/Boss/ProvidenceHolyRay.cs index a386704c57..820bdb9bcf 100644 --- a/Projectiles/Boss/ProvidenceHolyRay.cs +++ b/Projectiles/Boss/ProvidenceHolyRay.cs @@ -53,10 +53,8 @@ namespace CalamityMod.Projectiles.Boss if (Main.npc[(int)projectile.ai[1]].active && Main.npc[(int)projectile.ai[1]].type == ModContent.NPCType()) { - Vector2 value21 = new Vector2(27f, 59f); Vector2 fireFrom = new Vector2(Main.npc[(int)projectile.ai[1]].Center.X, Main.npc[(int)projectile.ai[1]].Center.Y + 32f); - Vector2 value22 = Utils.Vector2FromElipse(Main.npc[(int)projectile.ai[1]].localAI[0].ToRotationVector2(), value21 * Main.npc[(int)projectile.ai[1]].localAI[1]); - projectile.position = fireFrom + value22 - new Vector2(projectile.width, projectile.height) / 2f; + projectile.position = fireFrom - new Vector2(projectile.width, projectile.height) / 2f; } if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) diff --git a/Projectiles/Boss/RedLightning.cs b/Projectiles/Boss/RedLightning.cs index 4087b80d52..93ce2b4b0f 100644 --- a/Projectiles/Boss/RedLightning.cs +++ b/Projectiles/Boss/RedLightning.cs @@ -167,6 +167,11 @@ namespace CalamityMod.Projectiles.Boss } } + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Electrified, 120); + } + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) { target.Calamity().lastProjectileHit = projectile; diff --git a/Projectiles/Boss/RedLightningFeather.cs b/Projectiles/Boss/RedLightningFeather.cs index 9a7a601c22..ff79ea25e8 100644 --- a/Projectiles/Boss/RedLightningFeather.cs +++ b/Projectiles/Boss/RedLightningFeather.cs @@ -45,25 +45,28 @@ namespace CalamityMod.Projectiles.Boss if (projectile.velocity.X < 0f) { projectile.spriteDirection = -1; - projectile.rotation = (float)Math.Atan2((double)-(double)projectile.velocity.Y, (double)-(double)projectile.velocity.X); + projectile.rotation = (float)Math.Atan2(-projectile.velocity.Y, -projectile.velocity.X); } else { projectile.spriteDirection = 1; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X); } - Lighting.AddLight(projectile.Center, 0.7f, 0f, 0f); + projectile.Opacity = MathHelper.Clamp(1f - ((projectile.timeLeft - 1140) / 60f), 0f, 1f); + + Lighting.AddLight(projectile.Center, 0.7f * projectile.Opacity, 0f, 0f); projectile.ai[0] += 1f; - if (projectile.ai[0] > 120f) + float timeGateValue = 150f; + if (projectile.ai[0] > timeGateValue) { - int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); + int num103 = Player.FindClosest(projectile.Center, 1, 1); projectile.ai[1] += 1f; - if (projectile.ai[1] <= 120f) + if (projectile.ai[1] <= timeGateValue) { - if (projectile.ai[1] == 120f) + if (projectile.ai[1] == timeGateValue) { Vector2 v4 = Main.player[num103].Center + Main.player[num103].velocity * 20f - projectile.Center; @@ -74,24 +77,22 @@ namespace CalamityMod.Projectiles.Boss projectile.velocity = Vector2.Normalize(v4) * 18f; } - else if (projectile.ai[1] > 90f) + else if (projectile.ai[1] > timeGateValue - 30f) { if (projectile.velocity.Length() > 2f) projectile.velocity *= 0.9f; } else { - if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 18f) - { + if (projectile.velocity.Length() < 12f) projectile.velocity *= 1.02f; - } float scaleFactor2 = projectile.velocity.Length(); Vector2 vector11 = Main.player[num103].Center - projectile.Center; vector11.Normalize(); vector11 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 15f + vector11) / 16f; + projectile.velocity = (projectile.velocity * 24f + vector11) / 25f; projectile.velocity.Normalize(); projectile.velocity *= scaleFactor2; } @@ -111,8 +112,8 @@ namespace CalamityMod.Projectiles.Boss { projectile.position = projectile.Center; projectile.width = projectile.height = 64; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.position.X = projectile.position.X - (projectile.width / 2); + projectile.position.Y = projectile.position.Y - (projectile.height / 2); EmitDust(); projectile.Damage(); } @@ -135,7 +136,17 @@ namespace CalamityMod.Projectiles.Boss } } - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) + public override bool CanHitPlayer(Player target) => projectile.Opacity == 1f; + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + if (projectile.Opacity != 1f) + return; + + target.AddBuff(BuffID.Electrified, 60); + } + + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) { target.Calamity().lastProjectileHit = projectile; } diff --git a/Projectiles/Boss/SandPoisonCloud.cs b/Projectiles/Boss/SandPoisonCloud.cs index 1c4e00283e..c9894eee49 100644 --- a/Projectiles/Boss/SandPoisonCloud.cs +++ b/Projectiles/Boss/SandPoisonCloud.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Projectiles.Boss projectile.frame = 0; } - projectile.velocity *= 0.99f; + projectile.velocity *= 0.995f; if (projectile.timeLeft < 180) { diff --git a/Projectiles/Boss/ScavengerNuke.cs b/Projectiles/Boss/ScavengerNuke.cs index c93b901a56..7eb944406a 100644 --- a/Projectiles/Boss/ScavengerNuke.cs +++ b/Projectiles/Boss/ScavengerNuke.cs @@ -104,7 +104,7 @@ namespace CalamityMod.Projectiles.Boss projectile.Damage(); for (int num621 = 0; num621 < 30; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -114,13 +114,13 @@ namespace CalamityMod.Projectiles.Boss } for (int num623 = 0; num623 < 40; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(projectile.position, 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); + num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - CalamityUtils.ExplosionGores(projectile, 3); + CalamityUtils.ExplosionGores(projectile.Center, 3); } } } diff --git a/Projectiles/Boss/SirenSong.cs b/Projectiles/Boss/SirenSong.cs index 8aa5ed76aa..214f2b29d9 100644 --- a/Projectiles/Boss/SirenSong.cs +++ b/Projectiles/Boss/SirenSong.cs @@ -1,4 +1,6 @@ +using CalamityMod.NPCs; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using System.IO; using Terraria; using Terraria.ID; @@ -11,15 +13,19 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Musical Note"); - } + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } public override void SetDefaults() { - projectile.width = 26; + projectile.width = 24; projectile.height = 58; projectile.hostile = true; + projectile.tileCollide = false; projectile.penetrate = -1; - projectile.timeLeft = 1800; + projectile.timeLeft = 960; + projectile.Opacity = 0f; } public override void SendExtraAI(BinaryWriter writer) @@ -35,40 +41,51 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { projectile.velocity *= 0.985f; - if (projectile.localAI[0] == 0f) + + if (projectile.timeLeft < 30) + projectile.Opacity = MathHelper.Clamp(projectile.timeLeft / 30f, 0f, 1f); + else + projectile.Opacity = MathHelper.Clamp(1f - ((projectile.timeLeft - 930) / 30f), 0f, 1f); + + if (projectile.localAI[0] == 0f) { projectile.scale += 0.01f; if (projectile.scale >= 1.1f) - { projectile.localAI[0] = 1f; - } } else if (projectile.localAI[0] == 1f) { projectile.scale -= 0.01f; if (projectile.scale <= 0.9f) - { projectile.localAI[0] = 0f; - } } - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - float soundPitch = (Main.rand.NextFloat() - 0.5f) * 0.5f; - Main.harpNote = soundPitch; - Main.PlaySound(SoundID.Item26, projectile.position); - } - Lighting.AddLight(projectile.Center, 0.7f, 0.5f, 0f); - } - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, 255, 255, 0); - } + Lighting.AddLight(projectile.Center, 0.7f * projectile.Opacity, 0.5f * projectile.Opacity, 0f); - public override void OnHitPlayer(Player target, int damage, bool crit) + if (CalamityGlobalNPC.leviathan != -1) + { + if (Main.npc[CalamityGlobalNPC.leviathan].active) + projectile.extraUpdates = 1; + } + } + + public override bool CanHitPlayer(Player target) => projectile.Opacity == 1f; + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + lightColor.R = (byte)(255 * projectile.Opacity); + lightColor.G = (byte)(255 * projectile.Opacity); + lightColor.B = (byte)(255 * projectile.Opacity); + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + + public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(BuffID.Confused, 120); + if (projectile.Opacity != 1f) + return; + + target.AddBuff(BuffID.Confused, 120); } } } diff --git a/Projectiles/Boss/SirenSong.png b/Projectiles/Boss/SirenSong.png index 418fb2622c..af5f7c5eb7 100644 Binary files a/Projectiles/Boss/SirenSong.png and b/Projectiles/Boss/SirenSong.png differ diff --git a/Projectiles/Boss/WaterSpear.cs b/Projectiles/Boss/WaterSpear.cs index 8d18da7a01..f7b0b3370d 100644 --- a/Projectiles/Boss/WaterSpear.cs +++ b/Projectiles/Boss/WaterSpear.cs @@ -23,9 +23,10 @@ namespace CalamityMod.Projectiles.Boss projectile.height = 14; projectile.hostile = true; projectile.ignoreWater = true; + projectile.tileCollide = false; projectile.penetrate = -1; projectile.timeLeft = 300; - projectile.alpha = 255; + projectile.Opacity = 0f; } public override void SendExtraAI(BinaryWriter writer) @@ -40,58 +41,45 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - projectile.velocity *= 1.005f; + if (projectile.velocity.Length() < 10f) + projectile.velocity *= 1.01f; + if (projectile.ai[1] == 0f) { - for (int num621 = 0; num621 < 20; num621++) + for (int num621 = 0; num621 < 10; num621++) { int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 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; + Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } projectile.ai[1] = 1f; - Main.PlaySound(SoundID.Item21, projectile.position); } - if (projectile.localAI[0] == 0f) - { - projectile.scale -= 0.01f; - projectile.alpha += 10; - if (projectile.alpha >= 100) - { - projectile.alpha = 100; - projectile.localAI[0] = 1f; - } - } - else if (projectile.localAI[0] == 1f) - { - projectile.scale += 0.01f; - projectile.alpha -= 10; - if (projectile.alpha <= 0) - { - projectile.alpha = 0; - projectile.localAI[0] = 0f; - } - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - Lighting.AddLight(projectile.Center, 0f, (255 - projectile.alpha) * 0.05f / 255f, (255 - projectile.alpha) * 0.35f / 255f); + + if (projectile.timeLeft < 30) + projectile.Opacity = MathHelper.Clamp(projectile.timeLeft / 30f, 0f, 1f); + else + projectile.Opacity = MathHelper.Clamp(1f - ((projectile.timeLeft - 270) / 30f), 0f, 1f); + + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; + Lighting.AddLight(projectile.Center, 0f, 0f, 0.5f * projectile.Opacity); } - public override Color? GetAlpha(Color lightColor) - { - return new Color(200, 200, 200, projectile.alpha); - } + public override bool CanHitPlayer(Player target) => projectile.Opacity == 1f; - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + lightColor.R = (byte)(255 * projectile.Opacity); + lightColor.G = (byte)(255 * projectile.Opacity); + lightColor.B = (byte)(255 * projectile.Opacity); + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } - public override void Kill(int timeLeft) + public override void Kill(int timeLeft) { for (int k = 0; k < 5; k++) { @@ -101,7 +89,10 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(BuffID.Wet, 240); + if (projectile.Opacity != 1f) + return; + + target.AddBuff(BuffID.Wet, 240); } } } diff --git a/Projectiles/Boss/WaterSpear.png b/Projectiles/Boss/WaterSpear.png index b923a9ea8b..a50659774e 100644 Binary files a/Projectiles/Boss/WaterSpear.png and b/Projectiles/Boss/WaterSpear.png differ diff --git a/Projectiles/Boss/YharonFireball.cs b/Projectiles/Boss/YharonFireball.cs index da2eddf87f..6644565178 100644 --- a/Projectiles/Boss/YharonFireball.cs +++ b/Projectiles/Boss/YharonFireball.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System.IO; @@ -112,7 +113,12 @@ namespace CalamityMod.Projectiles.Boss } } - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 180); + } + + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) { target.Calamity().lastProjectileHit = projectile; } diff --git a/Projectiles/Boss/YharonFireball2.cs b/Projectiles/Boss/YharonFireball2.cs index ac3295f599..26cb43809f 100644 --- a/Projectiles/Boss/YharonFireball2.cs +++ b/Projectiles/Boss/YharonFireball2.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System.IO; @@ -124,7 +125,12 @@ namespace CalamityMod.Projectiles.Boss projectile.Damage(); } - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 180); + } + + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) { target.Calamity().lastProjectileHit = projectile; } diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 780d09bfca..ffad71a7f8 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -9,9 +9,11 @@ using CalamityMod.Projectiles.Hybrid; using CalamityMod.Projectiles.Magic; using CalamityMod.Projectiles.Melee; using CalamityMod.Projectiles.Melee.Yoyos; +using CalamityMod.Projectiles.Ranged; using CalamityMod.Projectiles.Rogue; using CalamityMod.Projectiles.Summon; using CalamityMod.Projectiles.Typeless; +using CalamityMod.Projectiles.Typeless.FiniteUse; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -34,27 +36,28 @@ namespace CalamityMod.Projectiles } } - // Class Types - public bool rogue = false; + // Class Types + public bool rogue = false; public bool trueMelee = false; - // Force Class Types - public bool forceMelee = false; + // Force Class Types + public bool forceMelee = false; public bool forceRanged = false; public bool forceMagic = false; - public bool forceRogue = false; - public bool forceMinion = false; - public bool forceHostile = false; - public bool forceTypeless = false; + public bool forceMinion = false; + public bool forceRogue = false; + public bool forceTypeless = false; + public bool forceHostile = false; // Damage Adjusters private bool setDamageValues = true; public float spawnedPlayerMinionDamageValue = 1f; public int spawnedPlayerMinionProjectileDamageValue = 0; public int defDamage = 0; + public int defCrit = 0; - // Rogue Stuff - public bool stealthStrike = false; //Update all existing rogue weapons with this + // Rogue Stuff + public bool stealthStrike = false; //Update all existing rogue weapons with this public bool momentumCapacitatorBoost = false; //Constant acceleration // Iron Heart @@ -66,81 +69,54 @@ namespace CalamityMod.Projectiles public int lineColor = 0; //Note: Although this was intended for fishing line colors, I use this as an AI variable a lot because vanilla only has 4 that sometimes are already in use. ~Ben public bool extorterBoost = false; - public bool overridesMinionDamagePrevention = false; + // Organic/Inorganic Boosts + public bool hasOrganicEnemyHitBoost = false; + public bool hasInorganicEnemyHitBoost = false; + public float organicEnemyHitBoost = 0f; + public float inorganicEnemyHitBoost = 0f; + public Action organicEnemyHitEffect = null; + public Action inorganicEnemyHitEffect = null; + + public bool overridesMinionDamagePrevention = false; #region SetDefaults - public override void SetDefaults(Projectile projectile) - { - switch (projectile.type) - { - case ProjectileID.Spear: - case ProjectileID.Trident: - case ProjectileID.TheRottedFork: - case ProjectileID.Swordfish: - case ProjectileID.Arkhalis: - case ProjectileID.DarkLance: - case ProjectileID.CobaltNaginata: - case ProjectileID.PalladiumPike: - case ProjectileID.MythrilHalberd: - case ProjectileID.OrichalcumHalberd: - case ProjectileID.AdamantiteGlaive: - case ProjectileID.TitaniumTrident: - case ProjectileID.MushroomSpear: - case ProjectileID.Gungnir: - case ProjectileID.ObsidianSwordfish: - case ProjectileID.ChlorophytePartisan: - case ProjectileID.MonkStaffT1: - case ProjectileID.MonkStaffT2: - case ProjectileID.MonkStaffT3: - case ProjectileID.NorthPoleWeapon: + public override void SetDefaults(Projectile projectile) + { + if (CalamityMod.trueMeleeProjectileList.Contains(projectile.type)) + trueMelee = true; - //tools - case ProjectileID.CobaltDrill: - case ProjectileID.MythrilDrill: - case ProjectileID.AdamantiteDrill: - case ProjectileID.PalladiumDrill: - case ProjectileID.OrichalcumDrill: - case ProjectileID.TitaniumDrill: - case ProjectileID.ChlorophyteDrill: - case ProjectileID.CobaltChainsaw: - case ProjectileID.MythrilChainsaw: - case ProjectileID.AdamantiteChainsaw: - case ProjectileID.PalladiumChainsaw: - case ProjectileID.OrichalcumChainsaw: - case ProjectileID.TitaniumChainsaw: - case ProjectileID.ChlorophyteChainsaw: - case ProjectileID.VortexDrill: - case ProjectileID.VortexChainsaw: - case ProjectileID.NebulaDrill: - case ProjectileID.NebulaChainsaw: - case ProjectileID.SolarFlareDrill: - case ProjectileID.SolarFlareChainsaw: - case ProjectileID.StardustDrill: - case ProjectileID.StardustChainsaw: - case ProjectileID.Hamdrax: - case ProjectileID.ChlorophyteJackhammer: - case ProjectileID.SawtoothShark: - case ProjectileID.ButchersChainsaw: - trueMelee = true; - break; + switch (projectile.type) + { + case ProjectileID.ShadowBeamHostile: + projectile.timeLeft = 60; + break; - case ProjectileID.StarWrath: - projectile.penetrate = projectile.maxPenetrate = 1; - break; + case ProjectileID.LostSoulHostile: + projectile.tileCollide = true; + break; - case ProjectileID.Spazmamini: - case ProjectileID.Retanimini: - case ProjectileID.MiniRetinaLaser: - projectile.localNPCHitCooldown = 10; - projectile.usesLocalNPCImmunity = true; - break; - default: - break; - } + case ProjectileID.NebulaLaser: + projectile.extraUpdates = 1; + break; - // Disable Lunatic Cultist's homing resistance globally - ProjectileID.Sets.Homing[projectile.type] = false; - } + case ProjectileID.StarWrath: + projectile.penetrate = projectile.maxPenetrate = 1; + break; + + case ProjectileID.Spazmamini: + case ProjectileID.Retanimini: + case ProjectileID.MiniRetinaLaser: + projectile.localNPCHitCooldown = 10; + projectile.usesLocalNPCImmunity = true; + projectile.usesIDStaticNPCImmunity = false; + break; + default: + break; + } + + // Disable Lunatic Cultist's homing resistance globally + ProjectileID.Sets.Homing[projectile.type] = false; + } #endregion #region PreAI @@ -637,9 +613,13 @@ namespace CalamityMod.Projectiles projectile.damage = damage2; } } - SKIP_CALAMITY: + SKIP_CALAMITY: - if (forceMelee) + // If rogue projectiles are not internally throwing while in-flight, they can never critically strike. + if (rogue) + projectile.thrown = true; + + if (forceMelee) { projectile.hostile = false; projectile.friendly = true; @@ -647,7 +627,8 @@ namespace CalamityMod.Projectiles projectile.ranged = false; projectile.magic = false; projectile.minion = false; - rogue = false; + projectile.thrown = false; + rogue = false; } else if (forceRanged) { @@ -657,7 +638,8 @@ namespace CalamityMod.Projectiles projectile.ranged = true; projectile.magic = false; projectile.minion = false; - rogue = false; + projectile.thrown = false; + rogue = false; } else if (forceMagic) { @@ -667,17 +649,8 @@ namespace CalamityMod.Projectiles projectile.ranged = false; projectile.magic = true; projectile.minion = false; - rogue = false; - } - else if (forceRogue) - { - projectile.hostile = false; - projectile.friendly = true; - projectile.melee = false; - projectile.ranged = false; - projectile.magic = false; - projectile.minion = false; - rogue = true; + projectile.thrown = false; + rogue = false; } else if (forceMinion) { @@ -687,9 +660,32 @@ namespace CalamityMod.Projectiles projectile.ranged = false; projectile.magic = false; projectile.minion = true; - rogue = false; + projectile.thrown = false; + rogue = false; } - else if (forceHostile) + else if (forceRogue) + { + projectile.hostile = false; + projectile.friendly = true; + projectile.melee = false; + projectile.ranged = false; + projectile.magic = false; + projectile.minion = false; + projectile.thrown = true; + rogue = true; + } + else if (forceTypeless) + { + projectile.hostile = false; + projectile.friendly = true; + projectile.melee = false; + projectile.ranged = false; + projectile.magic = false; + projectile.minion = false; + projectile.thrown = false; + rogue = false; + } + else if (forceHostile) { projectile.hostile = true; projectile.friendly = false; @@ -697,16 +693,7 @@ namespace CalamityMod.Projectiles projectile.ranged = false; projectile.magic = false; projectile.minion = false; - rogue = false; - } - else if (forceTypeless) - { - projectile.hostile = false; - projectile.friendly = true; - projectile.melee = false; - projectile.ranged = false; - projectile.magic = false; - projectile.minion = false; + projectile.thrown = false; rogue = false; } @@ -857,16 +844,10 @@ namespace CalamityMod.Projectiles { if (projectile.owner == Main.myPlayer && Main.player[projectile.owner].ownedProjectileCounts[90] < 30) { - for (int num252 = 0; num252 < 2; num252++) + for (int i = 0; i < 2; i++) { - Vector2 value15 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= Main.rand.Next(70, 101) * 0.1f; - int shard = Projectile.NewProjectile(projectile.oldPosition + projectile.Size * 0.5f, value15, ProjectileID.CrystalShard, (int)(projectile.damage * 0.25), 0f, projectile.owner, 0f, 0f); + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); + int shard = Projectile.NewProjectile(projectile.Center, velocity, ProjectileID.CrystalShard, (int)(projectile.damage * 0.25), 0f, projectile.owner, 0f, 0f); Main.projectile[shard].ranged = false; } } @@ -889,7 +870,7 @@ namespace CalamityMod.Projectiles } if (modPlayer.providenceLore && projectile.owner == Main.myPlayer && projectile.damage > 0 && - (projectile.melee || projectile.ranged || projectile.magic || rogue)) + (projectile.melee || projectile.ranged || projectile.magic || projectile.thrown || rogue)) { if (Main.rand.NextBool(5)) { @@ -1025,31 +1006,54 @@ namespace CalamityMod.Projectiles #region PostAI public override void PostAI(Projectile projectile) { - int x = (int)(projectile.Center.X / 16f); - int y = (int)(projectile.Center.Y / 16f); - for (int i = x - 1; i <= x + 1; i++) - { - for (int j = y - 1; j <= y + 1; j++) - { - if (projectile.type == ProjectileID.PureSpray || projectile.type == ProjectileID.PurificationPowder) - { - WorldGenerationMethods.ConvertFromAstral(i, j, ConvertType.Pure); - } - //commented out for Terraria 1.4 when vile/vicious powder spread corruption/crimson - if (projectile.type == ProjectileID.CorruptSpray)// || projectile.type == ProjectileID.VilePowder) - { - WorldGenerationMethods.ConvertFromAstral(i, j, ConvertType.Corrupt); - } - if (projectile.type == ProjectileID.CrimsonSpray)// || projectile.type == ProjectileID.ViciousPowder) - { - WorldGenerationMethods.ConvertFromAstral(i, j, ConvertType.Crimson); - } - if (projectile.type == ProjectileID.HallowSpray) - { - WorldGenerationMethods.ConvertFromAstral(i, j, ConvertType.Hallow); - } - } - } + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + + // Set crit here to avoid issues with projectiles that change class types in PreAI and AI + if (defCrit == 0 && !projectile.npcProj && !projectile.trap) + { + if (projectile.melee) + defCrit = modPlayer.critStats[0]; + else if (projectile.ranged) + defCrit = modPlayer.critStats[1]; + else if (projectile.magic) + defCrit = modPlayer.critStats[2]; + else if (rogue) + defCrit = modPlayer.critStats[3]; + else if (projectile.IsSummon()) + defCrit = 4; + else if (player.ActiveItem().crit > 0) + defCrit = player.ActiveItem().crit; + } + + if (projectile.owner == Main.myPlayer/* && Main.netMode != NetmodeID.MultiplayerClient*/) + { + int x = (int)(projectile.Center.X / 16f); + int y = (int)(projectile.Center.Y / 16f); + for (int i = x - 1; i <= x + 1; i++) + { + for (int j = y - 1; j <= y + 1; j++) + { + if (projectile.type == ProjectileID.PureSpray || projectile.type == ProjectileID.PurificationPowder) + { + WorldGenerationMethods.ConvertFromAstral(i, j, ConvertType.Pure); + } + //commented out for Terraria 1.4 when vile/vicious powder spread corruption/crimson + if (projectile.type == ProjectileID.CorruptSpray)// || projectile.type == ProjectileID.VilePowder) + { + WorldGenerationMethods.ConvertFromAstral(i, j, ConvertType.Corrupt); + } + if (projectile.type == ProjectileID.CrimsonSpray)// || projectile.type == ProjectileID.ViciousPowder) + { + WorldGenerationMethods.ConvertFromAstral(i, j, ConvertType.Crimson); + } + if (projectile.type == ProjectileID.HallowSpray) + { + WorldGenerationMethods.ConvertFromAstral(i, j, ConvertType.Hallow); + } + } + } + } } #endregion @@ -1059,10 +1063,73 @@ namespace CalamityMod.Projectiles Player player = Main.player[projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - if (projectile.owner == Main.myPlayer && !projectile.npcProj && !projectile.trap) - { + // Super dummies have nearly 10 million max HP (which is used in damage calculations). + // This can very easily cause damage numbers that are unrealistic for the weapon. + // As a result, they are omitted in this code. + if (!target.boss && target.type != NPCType()) + { + if (target.Inorganic() && hasInorganicEnemyHitBoost) + { + damage += (int)(target.lifeMax * inorganicEnemyHitBoost); + inorganicEnemyHitEffect?.Invoke(target); + } + if (target.Organic() && hasOrganicEnemyHitBoost) + { + damage += (int)(target.lifeMax * organicEnemyHitBoost); + organicEnemyHitEffect?.Invoke(target); + } + } + + if (projectile.owner == Main.myPlayer && !projectile.npcProj && !projectile.trap) + { + int critMax = 100; + int critChance = (int)MathHelper.Clamp(defCrit, 1, critMax); + crit = Main.rand.Next(1, critMax + 1) <= critChance; + + if ((uint)(projectile.type - ProjectileID.DD2LightningAuraT1) <= 2u) + { + if (player.setMonkT3) + crit = Main.rand.NextBool(4); + else if (player.setMonkT2) + crit = Main.rand.NextBool(6); + } + if (rogue && stealthStrike && modPlayer.stealthStrikeAlwaysCrits) crit = true; + + //Following things need to be done in here. If done in the projectile file, it's overridden by the thing above + if (projectile.type == ProjectileType() && projectile.ai[0] == 1f) + crit = true; + + if (projectile.type == ProjectileType()) + { + double damageMult = 1D; + if (crit) + { + damageMult += 0.25; + } + if (target.Inorganic()) + { + damageMult += 0.1; + } + damage = (int)(damage * damageMult); + } + + if (projectile.type == ProjectileType()) + { + damage = (int)(damage * 1.2); + if (!crit) + crit = Main.rand.NextBool(10); + } + + if (projectile.type == ProjectileType()) + { + if (crit) + { + damage = (int)(damage * 1.25); + knockback *= 1.25f; + } + } } } #endregion @@ -1075,14 +1142,14 @@ namespace CalamityMod.Projectiles if (projectile.owner == Main.myPlayer && !projectile.npcProj && !projectile.trap && projectile.friendly) { - if (projectile.type == (ProjectileID.StardustDragon1 | ProjectileID.StardustDragon2 | ProjectileID.StardustDragon3 | ProjectileID.StardustDragon4)) + if (ProjectileID.Sets.StardustDragon[projectile.type]) { target.immune[projectile.owner] = 10; } //flask of party affects all types of weapons, !projectile.melee is to prevent double flask effects if (!projectile.melee && player.meleeEnchant == 7) - Projectile.NewProjectile(target.Center.X, target.Center.Y, target.velocity.X, target.velocity.Y, ProjectileID.ConfettiMelee, 0, 0f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(target.Center, target.velocity, ProjectileID.ConfettiMelee, 0, 0f, projectile.owner, 0f, 0f); if (rogue && stealthStrike && modPlayer.dragonScales && CalamityUtils.CountProjectiles(ProjectileType()) < 2) { @@ -1125,7 +1192,7 @@ namespace CalamityMod.Projectiles { if (player.ghostHurt) { - projectile.ghostHurt(damage, new Vector2(target.Center.X, target.Center.Y)); + projectile.ghostHurt(damage, target.Center); } if (player.setNebula && player.nebulaCD == 0 && Main.rand.Next(3) == 0) @@ -1137,7 +1204,7 @@ namespace CalamityMod.Projectiles ItemID.NebulaPickup2, ItemID.NebulaPickup3 }); - int nebulaBooster = Item.NewItem((int)target.position.X, (int)target.position.Y, target.width, target.height, boosterType, 1, false, 0, false, false); + int nebulaBooster = Item.NewItem(target.Center, target.Size, boosterType, 1, false, 0, false, false); Main.item[nebulaBooster].velocity.Y = Main.rand.Next(-20, 1) * 0.2f; Main.item[nebulaBooster].velocity.X = Main.rand.Next(10, 31) * 0.2f * projectile.direction; if (Main.netMode == NetmodeID.MultiplayerClient) @@ -1149,36 +1216,35 @@ namespace CalamityMod.Projectiles if (Main.player[Main.myPlayer].lifeSteal > 0f && target.canGhostHeal && target.type != NPCID.TargetDummy && target.type != NPCType() && !player.moonLeech) { - // Commented out for now to test the global life steal nerf - /* // Increases the degree to which Spectre Healing set contributes to the lifesteal cap if (player.ghostHeal) { - float num = 0.1f; - num -= projectile.numHits * 0.025f; - if (num < 0f) - num = 0f; + float cooldownMult = 0.1f; + cooldownMult -= projectile.numHits * 0.025f; + if (cooldownMult < 0f) + cooldownMult = 0f; - float num2 = damage * num; - Main.player[Main.myPlayer].lifeSteal -= num2; + float cooldown = damage * cooldownMult; + Main.player[Main.myPlayer].lifeSteal -= cooldown; } // Increases the degree to which Vampire Knives contribute to the lifesteal cap if (projectile.type == ProjectileID.VampireKnife) { - float num = damage * 0.0375f; - if (num < 0f) - num = 0f; + float cooldown = damage * 0.075f; + if (cooldown < 0f) + cooldown = 0f; - Main.player[Main.myPlayer].lifeSteal -= num; + Main.player[Main.myPlayer].lifeSteal -= cooldown; } - */ if (modPlayer.vampiricTalisman && rogue && crit) { float heal = MathHelper.Clamp(damage * 0.015f, 0f, 6f); - Main.player[Main.myPlayer].lifeSteal -= heal * 2f; - Projectile.NewProjectile(target.position.X, target.position.Y, 0f, 0f, ProjectileID.VampireHeal, 0, 0f, projectile.owner, projectile.owner, heal); + if ((int)heal > 0) + { + SpawnLifeStealProjectile(projectile, player, heal, ProjectileID.VampireHeal, 1200f, 2f); + } } if ((modPlayer.bloodyGlove || modPlayer.electricianGlove) && rogue && stealthStrike) @@ -1187,16 +1253,43 @@ namespace CalamityMod.Projectiles player.HealEffect(1); } + bool otherHealTypes = modPlayer.auricSet || modPlayer.silvaSet || modPlayer.godSlayerMage || modPlayer.tarraMage || modPlayer.ataxiaMage; + + if (projectile.magic && player.ActiveItem().magic) + { + if (modPlayer.manaOverloader && otherHealTypes) + { + if (Main.rand.NextBool(2)) + { + float healMult = 0.2f; + healMult -= projectile.numHits * 0.05f; + float heal = projectile.damage * healMult * (player.statMana / (float)player.statManaMax2); + + if (heal > 50) + heal = 50; + + if (!CanSpawnLifeStealProjectile(projectile, healMult, heal)) + goto OTHEREFFECTS; + + SpawnLifeStealProjectile(projectile, player, heal, ProjectileType(), 1200f, 2f); + goto OTHEREFFECTS; + } + } + } + if (modPlayer.auricSet) { float healMult = 0.05f; healMult -= projectile.numHits * 0.025f; float heal = projectile.damage * healMult; + if (heal > 50) + heal = 50; + if (!CanSpawnLifeStealProjectile(projectile, healMult, heal)) goto OTHEREFFECTS; - SpawnLifeStealProjectile(projectile, player, heal, ProjectileType(), 1200f, 1.5f); + SpawnLifeStealProjectile(projectile, player, heal, ProjectileType(), 1200f, 3f); } else if (modPlayer.silvaSet) { @@ -1204,23 +1297,43 @@ namespace CalamityMod.Projectiles healMult -= projectile.numHits * 0.015f; float heal = projectile.damage * healMult; + if (heal > 50) + heal = 50; + if (!CanSpawnLifeStealProjectile(projectile, healMult, heal)) goto OTHEREFFECTS; - SpawnLifeStealProjectile(projectile, player, heal, ProjectileType(), 1200f, 1.5f); + SpawnLifeStealProjectile(projectile, player, heal, ProjectileType(), 1200f, 3f); } - else if (projectile.magic) + else if (projectile.magic && player.ActiveItem().magic) { + if (modPlayer.manaOverloader) + { + float healMult = 0.2f; + healMult -= projectile.numHits * 0.05f; + float heal = projectile.damage * healMult * (player.statMana / (float)player.statManaMax2); + + if (heal > 50) + heal = 50; + + if (!CanSpawnLifeStealProjectile(projectile, healMult, heal)) + goto OTHEREFFECTS; + + SpawnLifeStealProjectile(projectile, player, heal, ProjectileType(), 1200f, 2f); + } if (modPlayer.godSlayerMage) { float healMult = 0.06f; healMult -= projectile.numHits * 0.015f; float heal = projectile.damage * healMult; + if (heal > 50) + heal = 50; + if (!CanSpawnLifeStealProjectile(projectile, healMult, heal)) goto OTHEREFFECTS; - SpawnLifeStealProjectile(projectile, player, heal, ProjectileType(), 1200f, 1.5f); + SpawnLifeStealProjectile(projectile, player, heal, ProjectileType(), 1200f, 2f); } else if (modPlayer.tarraMage) { @@ -1232,6 +1345,9 @@ namespace CalamityMod.Projectiles healMult -= projectile.numHits * 0.05f; float heal = projectile.damage * healMult; + if (heal > 50) + heal = 50; + if (!CanSpawnLifeStealProjectile(projectile, healMult, heal)) goto OTHEREFFECTS; @@ -1250,10 +1366,13 @@ namespace CalamityMod.Projectiles healMult -= projectile.numHits * 0.05f; float heal = projectile.damage * healMult; + if (heal > 50) + heal = 50; + if (!CanSpawnLifeStealProjectile(projectile, healMult, heal)) goto OTHEREFFECTS; - SpawnLifeStealProjectile(projectile, player, heal, ProjectileType(), 1200f, 1.5f); + SpawnLifeStealProjectile(projectile, player, heal, ProjectileType(), 1200f, 2f); } else if (modPlayer.manaOverloader) { @@ -1261,10 +1380,13 @@ namespace CalamityMod.Projectiles healMult -= projectile.numHits * 0.05f; float heal = projectile.damage * healMult * (player.statMana / (float)player.statManaMax2); + if (heal > 50) + heal = 50; + if (!CanSpawnLifeStealProjectile(projectile, healMult, heal)) goto OTHEREFFECTS; - SpawnLifeStealProjectile(projectile, player, heal, ProjectileType(), 1200f, 1.5f); + SpawnLifeStealProjectile(projectile, player, heal, ProjectileType(), 1200f, 2f); } } } @@ -1272,16 +1394,16 @@ namespace CalamityMod.Projectiles OTHEREFFECTS: if (modPlayer.alchFlask && - (projectile.magic || rogue || projectile.melee || projectile.minion || projectile.ranged || projectile.sentry || CalamityMod.projectileMinionList.Contains(projectile.type) || ProjectileID.Sets.MinionShot[projectile.type] || ProjectileID.Sets.SentryShot[projectile.type]) && + (projectile.magic || rogue || projectile.melee || projectile.IsSummon() || projectile.ranged) && player.ownedProjectileCounts[ProjectileType()] < 6) { - int plague = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ProjectileType(), CalamityUtils.DamageSoftCap(projectile.damage * 0.25, 30), 0f, projectile.owner, 0f, 0f); - Main.projectile[plague].Calamity().forceTypeless = false; + int plague = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileType(), CalamityUtils.DamageSoftCap(projectile.damage * 0.25, 30), 0f, projectile.owner, 0f, 0f); + Main.projectile[plague].Calamity().forceTypeless = true; } if (modPlayer.reaverBlast && projectile.melee) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ProjectileType(), CalamityUtils.DamageSoftCap(projectile.damage * 0.2, 30), 0f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileType(), CalamityUtils.DamageSoftCap(projectile.damage * 0.2, 30), 0f, projectile.owner, 0f, 0f); } if (projectile.magic) @@ -1289,23 +1411,20 @@ namespace CalamityMod.Projectiles if (modPlayer.silvaMage && projectile.penetrate == 1 && Main.rand.Next(0, 100) >= 97) { Main.PlaySound(SoundID.Zombie, (int)projectile.position.X, (int)projectile.position.Y, 103); - projectile.position = projectile.Center; - projectile.width = projectile.height = 96; - projectile.position.X -= projectile.width / 2; - projectile.position.Y -= projectile.height / 2; - for (int num193 = 0; num193 < 3; num193++) - { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 157, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.5f); - } - for (int num194 = 0; num194 < 30; num194++) - { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 157, 0f, 0f, 0, new Color(Main.DiscoR, 203, 103), 2.5f); - Main.dust[num195].noGravity = true; - Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 157, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.5f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; - } + ExpandHitboxBy(projectile, 96); + for (int d = 0; d < 3; d++) + { + Dust.NewDust(projectile.position, projectile.width, projectile.height, 157, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.5f); + } + for (int d = 0; d < 30; d++) + { + int explode = Dust.NewDust(projectile.position, projectile.width, projectile.height, 157, 0f, 0f, 0, new Color(Main.DiscoR, 203, 103), 2.5f); + Main.dust[explode].noGravity = true; + Main.dust[explode].velocity *= 3f; + explode = Dust.NewDust(projectile.position, projectile.width, projectile.height, 157, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.5f); + Main.dust[explode].velocity *= 2f; + Main.dust[explode].noGravity = true; + } projectile.damage *= modPlayer.auricSet ? 7 : 4; projectile.localNPCHitCooldown = 10; projectile.usesLocalNPCImmunity = true; @@ -1314,60 +1433,53 @@ namespace CalamityMod.Projectiles if (modPlayer.reaverBurst) { - int num251 = Main.rand.Next(2, 5); - for (int num252 = 0; num252 < num251; num252++) + int projAmt = Main.rand.Next(2, 5); + for (int i = 0; i < projAmt; i++) { - Vector2 value15 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= Main.rand.Next(70, 101) * 0.1f; - int proj = Projectile.NewProjectile(projectile.oldPosition.X + (projectile.width / 2), projectile.oldPosition.Y + (projectile.height / 2), value15.X, value15.Y, 569 + Main.rand.Next(3), CalamityUtils.DamageSoftCap(projectile.damage * 0.15, 15), 0f, projectile.owner, 0f, 0f); + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); + int proj = Projectile.NewProjectile(projectile.Center, velocity, ProjectileID.SporeGas + Main.rand.Next(3), CalamityUtils.DamageSoftCap(projectile.damage * 0.15, 15), 0f, projectile.owner, 0f, 0f); Main.projectile[proj].usesLocalNPCImmunity = true; Main.projectile[proj].localNPCHitCooldown = 30; } } else if (modPlayer.ataxiaMage && modPlayer.ataxiaDmg <= 0) { - SpawnOrb(projectile, 1.25f, ProjectileType(), 800f, 20f); - int num = (int)(projectile.damage * 0.5f); - modPlayer.ataxiaDmg += num; + SpawnOrb(projectile, (int)(projectile.damage * 0.625), ProjectileType(), 800f, 20f); + int cooldown = (int)(projectile.damage * 0.5f); + modPlayer.ataxiaDmg += cooldown; } else if (modPlayer.godSlayerMage && modPlayer.godSlayerDmg <= 0) { - SpawnOrb(projectile, modPlayer.auricSet ? 2f : 1.5f, ProjectileType(), 800f, 20f); - int num = (int)(projectile.damage * 0.5f); - modPlayer.godSlayerDmg += num; + SpawnOrb(projectile, (int)(projectile.damage * (modPlayer.auricSet ? 1 : 0.75)), ProjectileType(), 800f, 20f); + int cooldown = (int)(projectile.damage * 0.5f); + modPlayer.godSlayerDmg += cooldown; } } if (projectile.melee) { if (modPlayer.ataxiaGeyser && player.ownedProjectileCounts[ProjectileType()] < 3) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ProjectileType(), CalamityUtils.DamageSoftCap(projectile.damage * 0.15, 35), 0f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileType(), CalamityUtils.DamageSoftCap(projectile.damage * 0.15, 35), 0f, projectile.owner, 0f, 0f); } } if (rogue) { if (modPlayer.xerocSet && modPlayer.xerocDmg <= 0 && player.ownedProjectileCounts[ProjectileType()] < 3 && player.ownedProjectileCounts[ProjectileType()] < 3) { + int cooldown = (int)(projectile.damage * 0.5f); switch (Main.rand.Next(5)) { case 0: - SpawnOrb(projectile, 1.6f, ProjectileType(), 800f, Main.rand.Next(15, 30)); - int num = (int)(projectile.damage * 0.5f); - modPlayer.xerocDmg += num; + SpawnOrb(projectile, (int)(projectile.damage * 0.8), ProjectileType(), 800f, Main.rand.Next(15, 30)); + modPlayer.xerocDmg += cooldown; break; case 1: - SpawnOrb(projectile, 1.25f, ProjectileType(), 800f, 30f); - int num2 = (int)(projectile.damage * 0.5f); - modPlayer.xerocDmg += num2; + SpawnOrb(projectile, (int)(projectile.damage * 0.625), ProjectileType(), 800f, 30f); + modPlayer.xerocDmg += cooldown; if (target.canGhostHeal && Main.player[Main.myPlayer].lifeSteal > 0f) { @@ -1385,21 +1497,20 @@ namespace CalamityMod.Projectiles case 2: - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ProjectileType(), CalamityUtils.DamageSoftCap(projectile.damage * 0.15, 40), 0f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileType(), CalamityUtils.DamageSoftCap(projectile.damage * 0.15, 40), 0f, projectile.owner, 0f, 0f); break; case 3: - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ProjectileType(), CalamityUtils.DamageSoftCap(projectile.damage * 0.2, 40), 0f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileType(), CalamityUtils.DamageSoftCap(projectile.damage * 0.2, 40), 0f, projectile.owner, 0f, 0f); break; case 4: - SpawnOrb(projectile, 1.2f, ProjectileType(), 800f, 15f); - int num3 = (int)(projectile.damage * 0.5f); - modPlayer.xerocDmg += num3; + SpawnOrb(projectile, (int)(projectile.damage * 0.6), ProjectileType(), 800f, 15f); + modPlayer.xerocDmg += cooldown; break; @@ -1414,11 +1525,12 @@ namespace CalamityMod.Projectiles { for (int i = 0; i < 6; i++) { - Vector2 pos = new Vector2(target.Center.X + target.width * 0.5f + Main.rand.Next(-201, 201), Main.screenPosition.Y - 600f - Main.rand.Next(50)); - float speedX = (target.Center.X - pos.X) / 30f; - float speedY = (target.Center.Y - pos.Y) * 8; + Vector2 source = new Vector2(target.Center.X + Main.rand.Next(-201, 201), Main.screenPosition.Y - 600f - Main.rand.Next(50)); + float speedX = (target.Center.X - source.X) / 30f; + float speedY = (target.Center.Y - source.Y) * 8; + Vector2 velocity = new Vector2(speedX, speedY); int dmg = (int)(15 + (projectile.damage * 0.05f)); - int feather = Projectile.NewProjectile(pos.X, pos.Y, speedX, speedY, ProjectileType(), dmg, 3, projectile.owner, 0f, Main.rand.Next(15)); + int feather = Projectile.NewProjectile(source, velocity, ProjectileType(), dmg, 3f, projectile.owner); Main.projectile[feather].Calamity().forceRogue = true; modPlayer.featherCrownCooldown = 15; } @@ -1428,11 +1540,10 @@ namespace CalamityMod.Projectiles { for (int i = 0; i < 6; i++) { - Vector2 pos = new Vector2(target.Center.X + target.width * 0.5f + Main.rand.Next(-201, 201), Main.screenPosition.Y - 600f - Main.rand.Next(50)); - Vector2 velocity = (target.Center - pos) / 10f; - float AI1 = Main.rand.Next(3); + Vector2 source = new Vector2(target.Center.X + Main.rand.Next(-201, 201), Main.screenPosition.Y - 600f - Main.rand.Next(50)); + Vector2 velocity = (target.Center - source) / 10f; int dmg = (int)(150 + (projectile.damage * 0.05f)); - int flare = Projectile.NewProjectile(pos, velocity, ProjectileID.LunarFlare, dmg, 3, projectile.owner, 0f, AI1); + int flare = Projectile.NewProjectile(source, velocity, ProjectileID.LunarFlare, dmg, 3, projectile.owner); Main.projectile[flare].Calamity().forceRogue = true; modPlayer.moonCrownCooldown = 15; } @@ -1442,10 +1553,10 @@ namespace CalamityMod.Projectiles { for (int i = 0; i < 6; i++) { - Vector2 pos = new Vector2(target.Center.X + target.width * 0.5f + Main.rand.Next(-201, 201), Main.screenPosition.Y - 600f - Main.rand.Next(50)); - Vector2 velocity = (target.Center - pos) / 40f; + Vector2 source = new Vector2(target.Center.X + Main.rand.Next(-201, 201), Main.screenPosition.Y - 600f - Main.rand.Next(50)); + Vector2 velocity = (target.Center - source) / 40f; int dmg = (int)(1000 + (projectile.damage * 0.05f)); - int flare = Projectile.NewProjectile(pos, velocity, ProjectileType(),dmg, 3f, projectile.owner, 0f, 0f); + int flare = Projectile.NewProjectile(source, velocity, ProjectileType(),dmg, 3f, projectile.owner); Main.projectile[flare].Calamity().rogue = true; modPlayer.nanoFlareCooldown = 15; } @@ -1465,6 +1576,22 @@ namespace CalamityMod.Projectiles } } + if (modPlayer.titanHeartSet && stealthStrike && modPlayer.titanCooldown <= 0) + { + int dmg = (int)(85 + (projectile.damage * 0.05f)); + int boom = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileType(), dmg, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[boom].Calamity().forceRogue = true; + Main.PlaySound(SoundID.Item14, projectile.position); + for (int dustexplode = 0; dustexplode < 360; dustexplode++) + { + Vector2 dustd = new Vector2(17f, 17f).RotatedBy(MathHelper.ToRadians(dustexplode)); + int d = Dust.NewDust(projectile.Center, projectile.width, projectile.height, Main.rand.NextBool(2) ? ModContent.DustType() : ModContent.DustType(), dustd.X, dustd.Y, 100, default, 3f); + Main.dust[d].noGravity = true; + Main.dust[d].position = projectile.Center; + } + modPlayer.titanCooldown = 15; + } + if (modPlayer.corrosiveSpine && projectile.type != ProjectileType() && projectile.type != ProjectileType() && projectile.type != ProjectileType()) { for (int i = 0; i < 3; i++) @@ -1525,42 +1652,9 @@ namespace CalamityMod.Projectiles if (CalamityMod.boomerangProjList.Contains(projectile.type)) { int spiritDamage = CalamityUtils.DamageSoftCap(projectile.damage * 0.2, 60); - int[] numArray1 = new int[Main.maxNPCs]; - int maxValue1 = 0; - int maxValue2 = 0; - for (int index = 0; index < Main.maxNPCs; ++index) - { - if (Main.npc[index].CanBeChasedBy((object)projectile, false)) - { - float num2 = Math.Abs(Main.npc[index].Center.X - projectile.Center.X) + Math.Abs(Main.npc[index].Center.Y - projectile.Center.Y); - if (num2 < 800f) - { - if (Collision.CanHit(projectile.position, 1, 1, Main.npc[index].position, Main.npc[index].width, Main.npc[index].height) && num2 > 50f) - { - numArray1[maxValue2] = index; - ++maxValue2; - } - else if (maxValue2 == 0) - { - numArray1[maxValue1] = index; - ++maxValue1; - } - } - } - } - if (maxValue1 == 0 && maxValue2 == 0) - return; - int num3 = maxValue2 <= 0 ? numArray1[Main.rand.Next(maxValue1)] : numArray1[Main.rand.Next(maxValue2)]; - double num4 = 4.0; - float num5 = (float)Main.rand.Next(-100, 101); - float num6 = (float)Main.rand.Next(-100, 101); - double num7 = Math.Sqrt((double)num5 * (double)num5 + (double)num6 * (double)num6); - float num8 = (float)(num4 / num7); - float SpeedX = num5 * num8; - float SpeedY = num6 * num8; - int ghost = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, SpeedX, SpeedY, ProjectileID.SpectreWrath, spiritDamage, 0f, projectile.owner, (float)num3, 0f); - Main.projectile[ghost].Calamity().forceRogue = true; - Main.projectile[ghost].penetrate = 1; + Projectile ghost = SpawnOrb(projectile, spiritDamage, ProjectileID.SpectreWrath, 800f, 4f); + ghost.Calamity().forceRogue = true; + ghost.penetrate = 1; modPlayer.shadowPotCooldown = 30; } if (CalamityMod.flaskBombProjList.Contains(projectile.type)) @@ -1571,7 +1665,7 @@ namespace CalamityMod.Projectiles } } } - if (projectile.minion || projectile.sentry || CalamityMod.projectileMinionList.Contains(projectile.type) || ProjectileID.Sets.MinionShot[projectile.type] || ProjectileID.Sets.SentryShot[projectile.type]) + if (projectile.IsSummon()) { if (modPlayer.profanedCrystalBuffs || (modPlayer.pArtifact && !modPlayer.profanedCrystal)) { @@ -1614,9 +1708,9 @@ namespace CalamityMod.Projectiles if (modPlayer.godSlayerSummon && modPlayer.godSlayerDmg <= 0) { - SpawnOrb(projectile, 2f, ProjectileType(), 800f, 15f, true); - int num = (int)(projectile.damage * 0.5f); - modPlayer.godSlayerDmg += num; + SpawnOrb(projectile, projectile.damage, ProjectileType(), 800f, 15f, true); + int cooldown = (int)(projectile.damage * 0.5f); + modPlayer.godSlayerDmg += cooldown; } //Priorities: Nucleogenesis => Starbuster Core => Nuclear Rod => Jelly-Charged Battery @@ -1662,9 +1756,9 @@ namespace CalamityMod.Projectiles } else if (modPlayer.jellyChargedBattery) { - SpawnOrb(projectile, 1.05f, ProjectileType(), 800f, 15f); - int num = (int)(projectile.damage * 0.5f); - modPlayer.jellyDmg += num; + SpawnOrb(projectile, (int)(projectile.damage * 0.525), ProjectileType(), 800f, 15f); + int cooldown = (int)(projectile.damage * 0.5f); + modPlayer.jellyDmg += cooldown; } } @@ -1686,17 +1780,11 @@ namespace CalamityMod.Projectiles { if (modPlayer.tarraRanged && Main.rand.Next(0, 100) >= 88 && player.ownedProjectileCounts[ProjectileType()] <= 20 && (projectile.timeLeft <= 2 || projectile.penetrate <= 1)) { - int num251 = Main.rand.Next(2, 4); - for (int num252 = 0; num252 < num251; num252++) + int projAmt = Main.rand.Next(2, 4); + for (int projCount = 0; projCount < projAmt; projCount++) { - Vector2 value15 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, ProjectileType(), CalamityUtils.DamageSoftCap(projectile.damage * 0.33, 65), 0f, projectile.owner, 0f, 0f); + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); + Projectile.NewProjectile(projectile.Center, velocity, ProjectileType(), CalamityUtils.DamageSoftCap(projectile.damage * 0.33, 65), 0f, projectile.owner, 0f, 0f); } } } @@ -1729,12 +1817,12 @@ namespace CalamityMod.Projectiles #region Drawing public override Color? GetAlpha(Projectile projectile, Color lightColor) { - if (Main.player[Main.myPlayer].Calamity().omniscience && projectile.hostile) - return Color.Coral; - if (Main.player[Main.myPlayer].Calamity().trippy) return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, projectile.alpha); + if (Main.player[Main.myPlayer].Calamity().omniscience && projectile.hostile) + return Color.Coral; + if (projectile.type == ProjectileID.PinkLaser) { if (projectile.alpha < 200) @@ -1794,7 +1882,7 @@ namespace CalamityMod.Projectiles public static void DrawCenteredAndAfterimage(Projectile projectile, Color lightColor, int trailingMode, int afterimageCounter, Texture2D texture = null, bool drawCentered = true) { - if (texture == null) + if (texture is null) texture = Main.projectileTexture[projectile.type]; int frameHeight = texture.Height / Main.projFrames[projectile.type]; @@ -1857,11 +1945,11 @@ namespace CalamityMod.Projectiles { if (modPlayer.providenceLore && projectile.friendly && projectile.damage > 0 && (projectile.melee || projectile.ranged || projectile.magic || rogue)) { - Main.PlaySound(SoundID.Item20, (int)projectile.position.X, (int)projectile.position.Y); + Main.PlaySound(SoundID.Item20, projectile.Center); for (int dustIndex = 0; dustIndex < 3; dustIndex++) { - int dust = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, (int)CalamityDusts.ProfanedFire, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f, 0, default, 1f); - Main.dust[dust].noGravity = true; + int fire = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, (int)CalamityDusts.ProfanedFire, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f, 0, default, 1f); + Main.dust[fire].noGravity = true; } } @@ -1869,16 +1957,10 @@ namespace CalamityMod.Projectiles { if (modPlayer.etherealExtorter && Main.rand.Next(0, 100) >= 95) { - for (int num252 = 0; num252 < 3; num252++) + for (int i = 0; i < 3; i++) { - Vector2 value15 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= Main.rand.Next(70, 101) * 0.1f; - int soul = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, ModContent.ProjectileType(), (int)(projectile.damage * 0.33), 0f, projectile.owner, 0f, 0f); + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); + int soul = Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.33), 0f, projectile.owner, 0f, 0f); Main.projectile[soul].tileCollide = false; } } @@ -1934,78 +2016,66 @@ namespace CalamityMod.Projectiles if (Main.player[Main.myPlayer].moonLeech) return; Main.player[Main.myPlayer].lifeSteal -= healAmount * cooldownMultiplier; - float num13 = 0f; - int num14 = projectile.owner; + float lowestHealthCheck = 0f; + int healTarget = projectile.owner; for (int i = 0; i < Main.maxPlayers; i++) { - if (Main.player[i].active && !Main.player[i].dead && ((!player.hostile && !Main.player[i].hostile) || player.team == Main.player[i].team)) + Player otherPlayer = Main.player[i]; + if (otherPlayer.active && !otherPlayer.dead && ((!player.hostile && !otherPlayer.hostile) || player.team == otherPlayer.team)) { - float num15 = Math.Abs(Main.player[i].position.X + (Main.player[i].width / 2) - projectile.position.X + (projectile.width / 2)) + Math.Abs(Main.player[i].position.Y + (Main.player[i].height / 2) - projectile.position.Y + (projectile.height / 2)); - if (num15 < distanceRequired && (Main.player[i].statLifeMax2 - Main.player[i].statLife) > num13) + float playerDist = Vector2.Distance(projectile.Center, otherPlayer.Center); + if (playerDist < distanceRequired && (otherPlayer.statLifeMax2 - otherPlayer.statLife) > lowestHealthCheck) { - num13 = Main.player[i].statLifeMax2 - Main.player[i].statLife; - num14 = i; + lowestHealthCheck = otherPlayer.statLifeMax2 - otherPlayer.statLife; + healTarget = i; } } } - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, healProjectileType, 0, 0f, projectile.owner, num14, healAmount); + Projectile.NewProjectile(projectile.Center, Vector2.Zero, healProjectileType, 0, 0f, projectile.owner, healTarget, healAmount); } #endregion #region AI Shortcuts - public void SpawnOrb(Projectile projectile, float dmgMult, int projType, float distanceRequired, float N, bool gsPhantom = false) + public static Projectile SpawnOrb(Projectile projectile, int damage, int projType, float distanceRequired, float speedMult, bool gsPhantom = false) { Player player = Main.player[projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - int num = (int)(projectile.damage * 0.5f); float ai1 = Main.rand.NextFloat() + 0.5f; int[] array = new int[Main.maxNPCs]; - int num3 = 0; - int num4 = 0; + int targetArrayA = 0; + int targetArrayB = 0; for (int i = 0; i < Main.maxNPCs; i++) { - if (Main.npc[i].CanBeChasedBy(projectile, false)) + NPC npc = Main.npc[i]; + if (npc.CanBeChasedBy(projectile, false)) { - float num5 = Math.Abs(Main.npc[i].position.X + (Main.npc[i].width / 2) - projectile.position.X + (projectile.width / 2)) + Math.Abs(Main.npc[i].position.Y + (Main.npc[i].height / 2) - projectile.position.Y + (projectile.height / 2)); - if (num5 < distanceRequired) + float enemyDist = Vector2.Distance(projectile.Center, npc.Center); + if (enemyDist < distanceRequired) { - if (Collision.CanHit(projectile.position, 1, 1, Main.npc[i].position, Main.npc[i].width, Main.npc[i].height) && num5 > 50f) + if (Collision.CanHit(projectile.position, 1, 1, npc.position, npc.width, npc.height) && enemyDist > 50f) { - array[num4] = i; - num4++; + array[targetArrayB] = i; + targetArrayB++; } - else if (num4 == 0) + else if (targetArrayB == 0) { - array[num3] = i; - num3++; + array[targetArrayA] = i; + targetArrayA++; } } } } - if (num3 == 0 && num4 == 0) + if (targetArrayA == 0 && targetArrayB == 0) { - return; + return Projectile.NewProjectileDirect(projectile.Center, Vector2.Zero, ProjectileType(), 0, 0f, projectile.owner); } - int num6; - if (num4 > 0) - { - num6 = array[Main.rand.Next(num4)]; - } - else - { - num6 = array[Main.rand.Next(num3)]; - } - float num7 = N; - float num8 = Main.rand.Next(-100, 101); - float num9 = Main.rand.Next(-100, 101); - float num10 = (float)Math.Sqrt(num8 * num8 + num9 * num9); - num10 = num7 / num10; - num8 *= num10; - num9 *= num10; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, num8, num9, projType, (int)(num * dmgMult), 0f, projectile.owner, gsPhantom ? 0f : num6, gsPhantom ? ai1 : 0f); + int target = targetArrayB <= 0 ? array[Main.rand.Next(targetArrayA)] : array[Main.rand.Next(targetArrayB)]; + Vector2 velocity = CalamityUtils.RandomVelocity(100f, speedMult, speedMult, 1f); + Projectile orb = Projectile.NewProjectileDirect(projectile.Center, velocity, projType, damage, 0f, projectile.owner, gsPhantom ? 0f : target, gsPhantom ? ai1 : 0f); + return orb; } - + public static void HomeInOnNPC(Projectile projectile, bool ignoreTiles, float distanceRequired, float homingVelocity, float N) { Vector2 center = projectile.Center; @@ -2031,6 +2101,11 @@ namespace CalamityMod.Projectiles } } + if (!projectile.friendly) + { + homeIn = false; + } + if (homeIn) { Vector2 homeInVector = projectile.DirectionTo(center); @@ -2041,7 +2116,7 @@ namespace CalamityMod.Projectiles } } - public static void MagnetSphereHitscan(Projectile projectile, float distanceRequired, float homingVelocity, float projectileTimer, int maxTargets, int spawnedProjectile, double damageMult = 1D) + public static void MagnetSphereHitscan(Projectile projectile, float distanceRequired, float homingVelocity, float projectileTimer, int maxTargets, int spawnedProjectile, double damageMult = 1D, bool attackMultiple = false) { float maxDistance = distanceRequired; bool homeIn = false; @@ -2084,6 +2159,24 @@ namespace CalamityMod.Projectiles Vector2 value = projectile.Center + projectile.velocity * 4f; Vector2 velocity = Vector2.Normalize(Main.npc[randomTarget].Center - value) * homingVelocity; + if (attackMultiple) + { + for (int i = 0; i < targetArrayIndex; i++) + { + velocity = Vector2.Normalize(Main.npc[targetArray[i]].Center - value) * homingVelocity; + + if (projectile.owner == Main.myPlayer) + { + int projectile2 = Projectile.NewProjectile(value.X, value.Y, velocity.X, velocity.Y, spawnedProjectile, (int)(projectile.damage * damageMult), projectile.knockBack, projectile.owner, 0f, 0f); + + if (projectile.type == ProjectileType() && projectile.Calamity().rogue) + Main.projectile[projectile2].Calamity().forceRogue = true; + } + } + + return; + } + if (projectile.type == ProjectileType()) { velocity.Y += Main.rand.Next(-30, 31) * 0.05f; @@ -2097,9 +2190,6 @@ namespace CalamityMod.Projectiles if (projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType() || (projectile.type == ProjectileType() && projectile.melee)) Main.projectile[projectile2].Calamity().forceMelee = true; - - if (projectile.type == ProjectileType() && projectile.Calamity().rogue) - Main.projectile[projectile2].Calamity().forceRogue = true; } } } diff --git a/Projectiles/DraedonsArsenal/GatlingLaserProj.cs b/Projectiles/DraedonsArsenal/GatlingLaserProj.cs index 44f2f370b3..f466fd633b 100644 --- a/Projectiles/DraedonsArsenal/GatlingLaserProj.cs +++ b/Projectiles/DraedonsArsenal/GatlingLaserProj.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Audio; using Terraria; using Terraria.ModLoader; using CalamityMod.Items; +using Terraria.ID; namespace CalamityMod.Projectiles.DraedonsArsenal { @@ -65,8 +66,15 @@ namespace CalamityMod.Projectiles.DraedonsArsenal bool flag2 = player.channel && !player.noItems && !player.CCed; if (flag2) { - // Consume 2 ammo per shot - CalamityGlobalItem.ConsumeAdditionalAmmo(player, player.ActiveItem(), 2); + // Attempt to use power from the held item. + if (player.ActiveItem().type >= ItemID.Count && + player.ActiveItem().Calamity().Chargeable && + player.ActiveItem().Calamity().CurrentCharge > 0 && + Main.rand.NextBool((int)(120 / (float)fireRate))) + { + player.ActiveItem().Calamity().CurrentCharge--; + } + float scaleFactor = player.ActiveItem().shootSpeed * projectile.scale; Vector2 value2 = vector; @@ -101,8 +109,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal velocity2.Normalize(); velocity2 *= 5f; } - float SpeedX = velocity2.X + Main.rand.Next(-1, 2) * 0.01f; - float SpeedY = velocity2.Y + Main.rand.Next(-1, 2) * 0.01f; + float SpeedX = velocity2.X + Main.rand.Next(-1, 2) * 0.005f; + float SpeedY = velocity2.Y + Main.rand.Next(-1, 2) * 0.005f; float ai0 = projectile.ai[0] - 2f; // 0, 1, or 2 Projectile.NewProjectile(value2.X, value2.Y, SpeedX, SpeedY, type, weaponDamage2, projectile.knockBack, projectile.owner, ai0, 0f); } diff --git a/Projectiles/DraedonsArsenal/GatlingLaserShot.cs b/Projectiles/DraedonsArsenal/GatlingLaserShot.cs index 3743955ec1..83c36e2a8b 100644 --- a/Projectiles/DraedonsArsenal/GatlingLaserShot.cs +++ b/Projectiles/DraedonsArsenal/GatlingLaserShot.cs @@ -40,21 +40,21 @@ namespace CalamityMod.Projectiles.DraedonsArsenal switch ((int)projectile.ai[0]) { case 0: - int num41 = Dust.NewDust(projectile.Center, 0, 0, dust, 0f, 0f, 160, default(Color), 0.8f); + int num41 = Dust.NewDust(projectile.Center, 0, 0, dust, 0f, 0f, 160, default, 0.8f); Main.dust[num41].noGravity = true; Main.dust[num41].position = projectile.Center; Main.dust[num41].velocity = projectile.velocity; break; case 1: - value8 = -Vector2.UnitY.RotatedBy((double)(24f * 0.1308997f + 0f * 3.14159274f), default(Vector2)) * value7 * 0.5f; - int num42 = Dust.NewDust(projectile.Center, 0, 0, dust, 0f, 0f, 160, default(Color), 0.8f); + value8 = -Vector2.UnitY.RotatedBy(24f * 0.1308997f + 0f * MathHelper.Pi) * value7 * 0.5f; + int num42 = Dust.NewDust(projectile.Center, 0, 0, dust, 0f, 0f, 160, default, 0.8f); Main.dust[num42].noGravity = true; Main.dust[num42].position = projectile.Center + value8; Main.dust[num42].velocity = projectile.velocity; break; case 2: - value8 = -Vector2.UnitY.RotatedBy((double)(24f * 0.1308997f + 1f * 3.14159274f), default(Vector2)) * value7 * 0.5f; - int num43 = Dust.NewDust(projectile.Center, 0, 0, dust, 0f, 0f, 160, default(Color), 0.8f); + value8 = -Vector2.UnitY.RotatedBy(24f * 0.1308997f + 1f * MathHelper.Pi) * value7 * 0.5f; + int num43 = Dust.NewDust(projectile.Center, 0, 0, dust, 0f, 0f, 160, default, 0.8f); Main.dust[num43].noGravity = true; Main.dust[num43].position = projectile.Center + value8; Main.dust[num43].velocity = projectile.velocity; @@ -70,7 +70,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - damage -= target.defense / 2; + damage -= target.defense / 5; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -82,7 +82,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { int height = 20; projectile.position = projectile.Center; - projectile.width = (projectile.height = height); + projectile.width = projectile.height = height; projectile.Center = projectile.position; projectile.maxPenetrate = -1; projectile.penetrate = -1; @@ -97,14 +97,14 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { float num641 = 4f; - int num643 = Dust.NewDust(projectile.Center, 6, 6, dust, 0f, 0f, 100, default(Color), 1f); + int num643 = Dust.NewDust(projectile.Center, 6, 6, dust, 0f, 0f, 100, default, 1f); float num644 = Main.dust[num643].velocity.X; float num645 = Main.dust[num643].velocity.Y; if (num644 == 0f && num645 == 0f) num644 = 1f; - float num646 = (float)Math.Sqrt((double)(num644 * num644 + num645 * num645)); + float num646 = (float)Math.Sqrt(num644 * num644 + num645 * num645); num646 = num641 / num646; num644 *= num646; num645 *= num646; @@ -132,16 +132,16 @@ namespace CalamityMod.Projectiles.DraedonsArsenal dustVel = dustVel.RotatedBy(-angleRandom); dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); - int num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dust, dustVel.X, dustVel.Y, 200, default(Color), 0.9f); - Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + int num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dust, dustVel.X, dustVel.Y, 200, default, 0.9f); + Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * projectile.width / 2f; Main.dust[num54].noGravity = true; Dust dust2 = Main.dust[num54]; dust2.velocity *= 3f; dust2 = Main.dust[num54]; - num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dust, dustVel.X, dustVel.Y, 100, default(Color), 0.66f); - Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dust, dustVel.X, dustVel.Y, 100, default, 0.66f); + Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * projectile.width / 2f; dust2 = Main.dust[num54]; dust2.velocity *= 2f; @@ -161,8 +161,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal dustVel = dustVel.RotatedBy(-angleRandom); dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); - int num56 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dust, dustVel.X, dustVel.Y, 0, default(Color), 1.2f); - Main.dust[num56].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default(Vector2)) * (float)projectile.width / 3f; + int num56 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dust, dustVel.X, dustVel.Y, 0, default, 1.2f); + Main.dust[num56].position = projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(projectile.velocity.ToRotation()) * projectile.width / 3f; Main.dust[num56].noGravity = true; Dust dust2 = Main.dust[num56]; diff --git a/Projectiles/DraedonsArsenal/GaussFlux.cs b/Projectiles/DraedonsArsenal/GaussFlux.cs new file mode 100644 index 0000000000..6c5c2ac096 --- /dev/null +++ b/Projectiles/DraedonsArsenal/GaussFlux.cs @@ -0,0 +1,81 @@ +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.DraedonsArsenal +{ + public class GaussFlux : ModProjectile + { + public float Time + { + get => projectile.ai[0]; + set => projectile.ai[0] = value; + } + public NPC Target + { + get => Main.npc[(int)projectile.ai[1]]; + set => projectile.ai[1] = value.whoAmI; + } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Gauss Flux"); + } + + public override void SetDefaults() + { + projectile.width = 16; + projectile.height = 16; + projectile.friendly = true; + projectile.melee = true; + projectile.penetrate = -1; + projectile.timeLeft = 180; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 14; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, Color.Lime.ToVector3()); + if (!Target.active) + { + projectile.Kill(); + return; + } + projectile.Center = Target.Center; + if (!Main.dedServ) + { + if (Time == 0) + { + for (int i = 0; i < 60; i++) + { + Dust dust = Dust.NewDustPerfect(Target.Center, 261); + dust.color = Utils.SelectRandom(Main.rand, Color.Yellow, Color.YellowGreen); + dust.velocity = Main.rand.NextVector2Circular(20f, 20f); + dust.scale = 2f; + dust.noGravity = true; + } + } + for (int i = 0; i < 7; i++) + { + for (int arcIndex = 0; arcIndex < 6; arcIndex++) + { + float offsetAngle = MathHelper.ToRadians(1080f) * i / 18f; + offsetAngle += Time / 10f; + float scale = 1.4f + (float)Math.Cos(i / 7f * MathHelper.TwoPi + Time / 30f) * 0.3f; + scale *= MathHelper.Lerp(1f, 0.4f, arcIndex / 6f); + Vector2 offset = Target.Size.RotatedBy(offsetAngle) * 0.5f; + offset += (arcIndex * MathHelper.TwoPi / 6f + Time / 20f).ToRotationVector2() * 6f * arcIndex; + + Dust dust = Dust.NewDustPerfect(Target.Center + offset, 261); + dust.color = Utils.SelectRandom(Main.rand, Color.Yellow, Color.YellowGreen); + dust.velocity = Vector2.Zero; + dust.scale = scale; + dust.noGravity = true; + } + } + } + Time++; + } + } +} diff --git a/Projectiles/DraedonsArsenal/GaussFlux.png b/Projectiles/DraedonsArsenal/GaussFlux.png new file mode 100644 index 0000000000..272321a620 Binary files /dev/null and b/Projectiles/DraedonsArsenal/GaussFlux.png differ diff --git a/Projectiles/DraedonsArsenal/GaussPistolShot.cs b/Projectiles/DraedonsArsenal/GaussPistolShot.cs new file mode 100644 index 0000000000..06ddbb9a08 --- /dev/null +++ b/Projectiles/DraedonsArsenal/GaussPistolShot.cs @@ -0,0 +1,126 @@ +using Microsoft.Xna.Framework; +using System; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.DraedonsArsenal +{ + public class GaussPistolShot : ModProjectile + { + public float Time + { + get => projectile.ai[0]; + set => projectile.ai[0] = value; + } + public Vector2 OldVelocity; + public const float MaxChargeRadius = 7f; + public const float MinEnergyParticleSpeed = 0.25f; + public const float MaxEnergyParticleSpeed = 4f; + public const float EnergyChargeRadiusRatio = 1.45f; + public const float ChargeTime = 60f; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Gauss Shot"); + ProjectileID.Sets.TrailingMode[projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 12; + } + + public override void SetDefaults() + { + projectile.width = 16; + projectile.height = 16; + projectile.friendly = true; + projectile.magic = true; + projectile.penetrate = 1; + projectile.timeLeft = 240; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.WriteVector2(OldVelocity); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + OldVelocity = reader.ReadVector2(); + } + + public override void AI() + { + Time++; + + if (Time < ChargeTime && OldVelocity == Vector2.Zero) + { + OldVelocity = projectile.velocity; + projectile.velocity = Vector2.Zero; + projectile.netUpdate = true; + } + if (Time >= ChargeTime && OldVelocity != Vector2.Zero) + { + projectile.velocity = OldVelocity; + OldVelocity = Vector2.Zero; + projectile.netUpdate = true; + } + + float energyRadius = MathHelper.Lerp(MaxChargeRadius * 0.333f, MaxChargeRadius, Utils.InverseLerp(0f, ChargeTime, Time, true)); + float energySphereSpeedMax = MathHelper.Lerp(MaxEnergyParticleSpeed, MinEnergyParticleSpeed, Utils.InverseLerp(0f, ChargeTime, Time, true)); + + // Charge up dust. + if (projectile.velocity.Length() == 0f && !Main.dedServ) + { + for (int i = 0; i < 2; i++) + { + Vector2 offset = Main.rand.NextVector2CircularEdge(energyRadius, energyRadius) * 3f; + + float dustHue = Main.rand.NextFloat(0.15f, 0.3f); + Dust dust = Dust.NewDustPerfect(projectile.Center + offset, 261); + dust.velocity = projectile.DirectionFrom(dust.position) * energyRadius / 3f; + dust.color = Main.hslToRgb(dustHue, Main.rand.NextFloat(0.9f, 1f), Main.rand.NextFloat(0.5f, 0.66f)); + dust.noGravity = true; + } + } + + if (!Main.dedServ) + { + // To give a bubble effect. + float xOffsetFactor = MathHelper.Lerp(0.7f, 1.3f, (float)Math.Cos(Time / 15f) * 0.5f + 0.5f); + float yOffsetFactor = MathHelper.Lerp(0.7f, 1.3f, (float)Math.Sin(Time / 15f) * 0.5f + 0.5f); + + // Idle energy pulse dust. + for (int i = 0; i < 10; i++) + { + Vector2 offset = Main.rand.NextVector2Circular(energyRadius, energyRadius); + offset.X *= xOffsetFactor; + offset.Y *= yOffsetFactor; + + float dustHue = Main.rand.NextFloat(0.15f, 0.3f); + Dust dust = Dust.NewDustPerfect(projectile.Center + offset, 261); + dust.velocity = Main.rand.NextVector2Circular(energySphereSpeedMax, energySphereSpeedMax); + dust.velocity += projectile.velocity; + dust.color = Main.hslToRgb(dustHue, Main.rand.NextFloat(0.9f, 1f), Main.rand.NextFloat(0.5f, 0.66f)); + dust.scale = 0.8f; + dust.noGravity = true; + } + + // Ring of dust. + for (int i = 0; i < 25; i++) + { + float angle = i / 25f * MathHelper.TwoPi; + + Vector2 offset = angle.ToRotationVector2().RotatedBy(projectile.velocity.ToRotation()) * energyRadius * 1.5f; + offset.X *= -xOffsetFactor; + offset.Y *= yOffsetFactor; + + float dustHue = Main.rand.NextFloat(0.15f, 0.3f); + Dust dust = Dust.NewDustPerfect(projectile.Center + offset, 261); + dust.velocity = Vector2.Zero; + dust.color = Main.hslToRgb(dustHue, Main.rand.NextFloat(0.9f, 1f), Main.rand.NextFloat(0.5f, 0.66f)); + dust.scale = 0.5f; + dust.noGravity = true; + } + } + } + } +} diff --git a/Projectiles/DraedonsArsenal/GaussPistolShot.png b/Projectiles/DraedonsArsenal/GaussPistolShot.png new file mode 100644 index 0000000000..272321a620 Binary files /dev/null and b/Projectiles/DraedonsArsenal/GaussPistolShot.png differ diff --git a/Projectiles/DraedonsArsenal/GaussRifleBlast.cs b/Projectiles/DraedonsArsenal/GaussRifleBlast.cs new file mode 100644 index 0000000000..063519ea10 --- /dev/null +++ b/Projectiles/DraedonsArsenal/GaussRifleBlast.cs @@ -0,0 +1,70 @@ +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.DraedonsArsenal +{ + public class GaussRifleBlast : ModProjectile + { + public float Time + { + get => projectile.ai[0]; + set => projectile.ai[0] = value; + } + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Gauss Blast"); + } + + public override void SetDefaults() + { + projectile.width = projectile.height = 60; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 1; + projectile.timeLeft = 300; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 8; + } + + public override void AI() + { + Time++; + if (!Main.dedServ) + { + // Idle dust. + for (int i = 0; i < 10; i++) + { + float angle = i / 10f * MathHelper.TwoPi; + for (int j = 0; j < 4; j++) + { + Dust dust = Dust.NewDustPerfect(projectile.Center, 263); + dust.velocity = angle.ToRotationVector2().RotatedByRandom(0.25f) * Main.rand.NextFloat(6f, 8f); + dust.noGravity = true; + dust.scale = 2.1f; + } + } + // Ring dust. + for (int i = 0; i < 4; i++) + { + float angle = projectile.velocity.ToRotation() + (i / 4f * MathHelper.TwoPi) + Time / 24f; + float radius = (float)Math.Sin(Time / 7.5f) * 40f + 10f; + Dust dust = Dust.NewDustPerfect(projectile.Center + angle.ToRotationVector2() * radius, 226); + dust.velocity = Vector2.Zero; + dust.noGravity = true; + dust.scale = 2f; + } + } + } + public override void Kill(int timeLeft) + { + if (Main.myPlayer == projectile.owner) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LargeMechGaussRifle"), projectile.Center); + Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); + } + } + } +} diff --git a/Projectiles/DraedonsArsenal/GaussRifleBlast.png b/Projectiles/DraedonsArsenal/GaussRifleBlast.png new file mode 100644 index 0000000000..d819c1bdce Binary files /dev/null and b/Projectiles/DraedonsArsenal/GaussRifleBlast.png differ diff --git a/Projectiles/DraedonsArsenal/GaussRifleExplosion.cs b/Projectiles/DraedonsArsenal/GaussRifleExplosion.cs new file mode 100644 index 0000000000..fa749b237d --- /dev/null +++ b/Projectiles/DraedonsArsenal/GaussRifleExplosion.cs @@ -0,0 +1,50 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.DraedonsArsenal +{ + public class GaussRifleExplosion : ModProjectile + { + public float Time + { + get => projectile.ai[0]; + set => projectile.ai[0] = value; + } + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Gauss Explosion"); + } + + public override void SetDefaults() + { + projectile.width = projectile.height = 500; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 1; + projectile.timeLeft = 60; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 8; + } + + public override void AI() + { + Time++; + if (!Main.dedServ) + { + for (int i = 0; i < 50; i++) + { + float angle = i / 30f * MathHelper.TwoPi; + Dust dust = Dust.NewDustPerfect(projectile.Center, 261); + dust.velocity = angle.ToRotationVector2(); + dust.velocity = dust.velocity.RotatedByRandom(0.4f); + dust.velocity = dust.velocity.RotatedBy(Time / 60f * MathHelper.ToRadians(720f)); + dust.velocity *= Main.rand.NextFloat(20f, 50f); + dust.scale = Main.rand.NextFloat(1.7f, 2.1f); + dust.noGravity = true; + } + } + } + } +} diff --git a/Projectiles/DraedonsArsenal/GaussRifleExplosion.png b/Projectiles/DraedonsArsenal/GaussRifleExplosion.png new file mode 100644 index 0000000000..d819c1bdce Binary files /dev/null and b/Projectiles/DraedonsArsenal/GaussRifleExplosion.png differ diff --git a/Projectiles/DraedonsArsenal/HydraulicVoltCrasherProjectile.cs b/Projectiles/DraedonsArsenal/HydraulicVoltCrasherProjectile.cs new file mode 100644 index 0000000000..76cbc7d798 --- /dev/null +++ b/Projectiles/DraedonsArsenal/HydraulicVoltCrasherProjectile.cs @@ -0,0 +1,148 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.DraedonsArsenal +{ + public class HydraulicVoltCrasherProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hydraulic Volt Crasher"); + Main.projFrames[projectile.type] = 3; + } + + public override void SetDefaults() + { + projectile.width = 56; + projectile.height = 26; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.hide = true; + projectile.ownerHitCheck = true; + projectile.melee = true; + projectile.scale = 1.1f; + } + public override void AI() + { + projectile.timeLeft = 60; + projectile.frameCounter++; + if (projectile.frameCounter % 4f == 3f) + { + projectile.frame++; + if (projectile.frame >= Main.projFrames[projectile.type]) + { + projectile.frame = 0; + } + } + // Play idle sounds every so often. + if (projectile.soundDelay <= 0) + { + Main.PlaySound(SoundID.Item22, projectile.position); + projectile.soundDelay = 30; + } + Player player = Main.player[projectile.owner]; + Vector2 center = player.RotatedRelativePoint(player.MountedCenter); + if (Main.myPlayer == player.whoAmI) + { + if (player.channel) + { + // Attempt to use power from the held item. + if (player.ActiveItem().type >= ItemID.Count && + player.ActiveItem().Calamity().Chargeable && + player.ActiveItem().Calamity().CurrentCharge > 0 && + Main.rand.NextBool(50)) + { + player.ActiveItem().Calamity().CurrentCharge--; + } + + float speed = player.inventory[player.selectedItem].shootSpeed * projectile.scale; + Vector2 toPointTo = Main.MouseWorld; + if (player.gravDir == -1f) + { + toPointTo.Y = Main.screenHeight - toPointTo.Y; + } + toPointTo = Vector2.Normalize(toPointTo - center) * speed; + if (toPointTo != projectile.velocity) + { + projectile.netUpdate = true; + } + projectile.velocity = toPointTo; + } + else + { + projectile.Kill(); + } + } + player.ChangeDir((projectile.velocity.X > 0).ToDirectionInt()); + player.heldProj = projectile.whoAmI; + + player.itemAnimation = 2; + player.itemTime = 2; // Note: player.SetDummyItemTime(frame) exists in 1.4 which accomplishes this task + + player.itemRotation = (projectile.velocity * player.direction).ToRotation(); + projectile.direction = projectile.spriteDirection = player.direction; + projectile.rotation = projectile.velocity.ToRotation() + (projectile.direction == -1).ToInt() * MathHelper.Pi; + + if (Main.rand.NextBool(5)) + { + Vector2 spawnPosition = projectile.Center; + spawnPosition += projectile.Size.RotatedBy(projectile.velocity.ToRotation() - MathHelper.ToRadians(25f)) * 0.65f * projectile.scale; + Dust dust = Dust.NewDustPerfect(spawnPosition, 226); + dust.velocity = projectile.velocity.SafeNormalize(Vector2.Zero) * Main.rand.NextFloat(2f, 3.6f); + dust.velocity += player.velocity * 0.4f; + } + projectile.position = center - projectile.Size * 0.5f; + projectile.position -= projectile.velocity.ToRotation().ToRotationVector2() * 8f; + projectile.velocity.X *= Main.rand.NextFloat(0.97f, 1.03f); + } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaBolt"), target.Center); + TryToSuperchargeNPC(target); + for (int i = 0; i < Main.npc.Length; i++) + { + if (i != target.whoAmI && + target.CanBeChasedBy(null, false) && + Main.npc[i].Distance(target.Center) < 240f) + { + if (TryToSuperchargeNPC(Main.npc[i])) + { + for (float increment = 0f; increment <= 1f; increment += 0.05f) + { + Vector2 spawnPosition = Vector2.Lerp(target.Center, Main.npc[i].Center, increment); + Dust dust = Dust.NewDustPerfect(spawnPosition, 226); + dust.velocity = Vector2.Zero; + dust.scale = 1.6f; + dust.noGravity = true; + } + } + } + } + } + public bool TryToSuperchargeNPC(NPC npc) + { + // Prevent supercharging an enemy twice. + for (int i = 0; i < Main.projectile.Length; i++) + { + if (Main.projectile[i].active && + Main.projectile[i].type == ModContent.ProjectileType() && + Main.projectile[i].ai[1] == i) + { + return false; + } + } + Projectile.NewProjectileDirect(npc.Center, + Vector2.Zero, + ModContent.ProjectileType(), + (int)(projectile.damage * 0.35), + 0f, + projectile.owner, + 0f, + npc.whoAmI); + return true; + } + } +} diff --git a/Projectiles/DraedonsArsenal/HydraulicVoltCrasherProjectile.png b/Projectiles/DraedonsArsenal/HydraulicVoltCrasherProjectile.png new file mode 100644 index 0000000000..c23963ad94 Binary files /dev/null and b/Projectiles/DraedonsArsenal/HydraulicVoltCrasherProjectile.png differ diff --git a/Projectiles/DraedonsArsenal/LaserRifleShot.cs b/Projectiles/DraedonsArsenal/LaserRifleShot.cs index e7d9e3873d..a4e23a5fdf 100644 --- a/Projectiles/DraedonsArsenal/LaserRifleShot.cs +++ b/Projectiles/DraedonsArsenal/LaserRifleShot.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal for (int i = 0; i < 2; i++) { - int num41 = Dust.NewDust(projectile.Center, 0, 0, dust, 0f, 0f, 160, default(Color), 2f); + int num41 = Dust.NewDust(projectile.Center, 0, 0, dust, 0f, 0f, 160, projectile.ai[0] == 0f ? default : new Color(255, 255, 0), 2f); Main.dust[num41].noGravity = true; Main.dust[num41].position = projectile.Center; Main.dust[num41].velocity = projectile.velocity; @@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - damage -= target.defense / 2; + damage -= target.defense / 5; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -62,9 +62,9 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void Kill(int timeLeft) { - int height = 40; + int height = 60; projectile.position = projectile.Center; - projectile.width = (projectile.height = height); + projectile.width = projectile.height = height; projectile.Center = projectile.position; projectile.maxPenetrate = -1; projectile.penetrate = -1; @@ -74,19 +74,18 @@ namespace CalamityMod.Projectiles.DraedonsArsenal LaserBurst(2.4f, 4.2f); // 60 dusts - int num3; - for (int num640 = 0; num640 < 100; num640 = num3 + 1) + for (int num640 = 0; num640 < 100; num640++) { float num641 = 4f; - int num643 = Dust.NewDust(projectile.Center, 6, 6, dust, 0f, 0f, 100, default(Color), 2f); + int num643 = Dust.NewDust(projectile.Center, 6, 6, dust, 0f, 0f, 100, default, 2f); float num644 = Main.dust[num643].velocity.X; float num645 = Main.dust[num643].velocity.Y; if (num644 == 0f && num645 == 0f) num644 = 1f; - float num646 = (float)Math.Sqrt((double)(num644 * num644 + num645 * num645)); + float num646 = (float)Math.Sqrt(num644 * num644 + num645 * num645); num646 = num641 / num646; num644 *= num646; num645 *= num646; @@ -96,8 +95,6 @@ namespace CalamityMod.Projectiles.DraedonsArsenal dust2.velocity.X = dust2.velocity.X + num644; dust2.velocity.Y = dust2.velocity.Y + num645; dust2.noGravity = true; - - num3 = num640; } } @@ -105,24 +102,23 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { float angleRandom = 0.05f; - int num3; - for (int num53 = 0; num53 < 20; num53 = num3 + 1) + for (int num53 = 0; num53 < 20; num53++) { float dustSpeed = Main.rand.NextFloat(speed1, speed2); Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(projectile.velocity.ToRotation()); dustVel = dustVel.RotatedBy(-angleRandom); dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); - int num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dust, dustVel.X, dustVel.Y, 200, default(Color), 2.5f); - Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + int num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dust, dustVel.X, dustVel.Y, 200, default, 2.5f); + Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * projectile.width / 2f; Main.dust[num54].noGravity = true; Dust dust2 = Main.dust[num54]; dust2.velocity *= 3f; dust2 = Main.dust[num54]; - num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dust, dustVel.X, dustVel.Y, 100, default(Color), 1.9f); - Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dust, dustVel.X, dustVel.Y, 100, default, 1.9f); + Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * projectile.width / 2f; dust2 = Main.dust[num54]; dust2.velocity *= 2f; @@ -132,25 +128,21 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Main.dust[num54].color = Color.Orange * 0.5f; dust2 = Main.dust[num54]; - - num3 = num53; } - for (int num55 = 0; num55 < 10; num55 = num3 + 1) + for (int num55 = 0; num55 < 10; num55++) { float dustSpeed = Main.rand.NextFloat(speed1, speed2); Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(projectile.velocity.ToRotation()); dustVel = dustVel.RotatedBy(-angleRandom); dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); - int num56 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dust, dustVel.X, dustVel.Y, 0, default(Color), 3.2f); - Main.dust[num56].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default(Vector2)) * (float)projectile.width / 3f; + int num56 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dust, dustVel.X, dustVel.Y, 0, default, 3.2f); + Main.dust[num56].position = projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(projectile.velocity.ToRotation()) * projectile.width / 3f; Main.dust[num56].noGravity = true; Dust dust2 = Main.dust[num56]; dust2.velocity *= 0.5f; dust2 = Main.dust[num56]; - - num3 = num55; } } } diff --git a/Projectiles/DraedonsArsenal/MassivePlasmaExplosion.cs b/Projectiles/DraedonsArsenal/MassivePlasmaExplosion.cs new file mode 100644 index 0000000000..517389e439 --- /dev/null +++ b/Projectiles/DraedonsArsenal/MassivePlasmaExplosion.cs @@ -0,0 +1,47 @@ +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.DraedonsArsenal +{ + public class MassivePlasmaExplosion : ModProjectile + { + public float Time + { + get => projectile.ai[0]; + set => projectile.ai[0] = value; + } + public const int Lifetime = 25; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Plasma Explosion"); + } + + public override void SetDefaults() + { + projectile.width = projectile.height = 840; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.timeLeft = 37; + projectile.tileCollide = false; + projectile.Calamity().rogue = true; + projectile.usesIDStaticNPCImmunity = true; + projectile.idStaticNPCHitCooldown = 12; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, Color.White.ToVector3() * 4f * projectile.scale); + if (projectile.localAI[0] == 0f) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/FlareSound"), projectile.Center); + projectile.localAI[0] = 1f; + } + projectile.scale = (float)Math.Sin(Time / 37 * MathHelper.Pi) * 2f; + if (projectile.scale > 1f) + projectile.scale = 1f; + Time++; + } + } +} diff --git a/Projectiles/DraedonsArsenal/MassivePlasmaExplosion.png b/Projectiles/DraedonsArsenal/MassivePlasmaExplosion.png new file mode 100644 index 0000000000..5eaa600e71 Binary files /dev/null and b/Projectiles/DraedonsArsenal/MassivePlasmaExplosion.png differ diff --git a/Projectiles/DraedonsArsenal/MountedScannerLaser.cs b/Projectiles/DraedonsArsenal/MountedScannerLaser.cs new file mode 100644 index 0000000000..5d52edbbaf --- /dev/null +++ b/Projectiles/DraedonsArsenal/MountedScannerLaser.cs @@ -0,0 +1,98 @@ +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Linq; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.DraedonsArsenal +{ + public class MountedScannerLaser : BaseLaserbeamProjectile + { + public int OwnerIndex + { + get => Projectile.GetByUUID(projectile.owner, projectile.ai[1]); + set => projectile.ai[1] = value; + } + public override float MaxScale => 0.5f + (float)Math.Cos(Main.GlobalTime * 10f) * 0.07f; + public override float MaxLaserLength => 900f; + public override float Lifetime => 70f; + public override Color LaserOverlayColor => Color.Red; + public override Color LightCastColor => LaserOverlayColor; + public override Texture2D LaserBeginTexture => ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/UltimaRayStart"); + public override Texture2D LaserMiddleTexture => ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/UltimaRayMid"); + public override Texture2D LaserEndTexture => ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/UltimaRayEnd"); + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Deathray"); + ProjectileID.Sets.MinionShot[projectile.type] = true; + } + public override void SetDefaults() + { + projectile.width = projectile.height = 17; + projectile.friendly = true; + projectile.minion = true; + projectile.minionSlots = 0f; + projectile.penetrate = -1; + projectile.alpha = 255; + projectile.localNPCHitCooldown = 15; + projectile.usesLocalNPCImmunity = true; + } + public override float DetermineLaserLength() + { + float[] samples = new float[4]; + Collision.LaserScan(projectile.Center, projectile.velocity, projectile.width * projectile.scale, MaxLaserLength, samples); + return samples.Average(); + } + public override void UpdateLaserMotion() + { + if (OwnerIndex == -1) + { + projectile.Kill(); + return; + } + projectile.velocity = Vector2.Lerp(projectile.velocity, Main.projectile[OwnerIndex].rotation.ToRotationVector2().RotatedBy(Math.Cos(Time / 25) * 0.05f), 0.125f); + projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; + } + public override void AttachToSomething() + { + if (OwnerIndex == -1) + { + projectile.Kill(); + return; + } + projectile.Center = Main.projectile[OwnerIndex].Center + Main.projectile[OwnerIndex].rotation.ToRotationVector2() * 18f; + + // Kill the projectile if the owner isn't targeting anything anymore. + if (Main.projectile[OwnerIndex].localAI[0] == 0f) + projectile.Kill(); + } + public override bool ShouldUpdatePosition() => false; + public override void ExtraBehavior() + { + // Spawn dust at the end of the laser. + if (!Main.dedServ) + { + Vector2 laserSpawnPosition = projectile.Center + projectile.velocity * (LaserLength - 14f); + for (int i = 0; i < 3; i++) + { + Dust dust = Dust.NewDustPerfect(laserSpawnPosition + Main.rand.NextVector2Circular(8f, 8f), 261); + dust.velocity = Main.rand.NextVector2CircularEdge(9f, 9f) * Main.rand.NextFloat(0.3f, 1f); + dust.color = Color.Lerp(Color.Crimson, Color.Red, Main.rand.NextFloat()); + dust.noGravity = true; + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + projectile.damage /= 3; + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + projectile.damage /= 3; + } + } +} diff --git a/Projectiles/DraedonsArsenal/MountedScannerLaser.png b/Projectiles/DraedonsArsenal/MountedScannerLaser.png new file mode 100644 index 0000000000..15e8775737 Binary files /dev/null and b/Projectiles/DraedonsArsenal/MountedScannerLaser.png differ diff --git a/Projectiles/DraedonsArsenal/MountedScannerSummon.cs b/Projectiles/DraedonsArsenal/MountedScannerSummon.cs new file mode 100644 index 0000000000..8e1fb15626 --- /dev/null +++ b/Projectiles/DraedonsArsenal/MountedScannerSummon.cs @@ -0,0 +1,131 @@ +using CalamityMod.Buffs.Summon; +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.DraedonsArsenal +{ + public class MountedScannerSummon : ModProjectile + { + public float AngularOffsetRelativeToPlayer + { + get => projectile.ai[0]; + set => projectile.ai[0] = value; + } + public float Time + { + get => projectile.ai[1]; + set => projectile.ai[1] = value; + } + public const float OffsetDistanceFromPlayer = 60f; + public const float LaserFireRate = 40f; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mounted Scanner"); + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + ProjectileID.Sets.NeedsUUID[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 24; + projectile.height = 18; + projectile.netImportant = true; + projectile.friendly = true; + projectile.minionSlots = 1; + projectile.timeLeft = 18000; + projectile.penetrate = -1; + projectile.timeLeft *= 5; + projectile.minion = true; + projectile.tileCollide = false; + } + public override void AI() + { + Player player = Main.player[projectile.owner]; + projectile.Center = player.Center + AngularOffsetRelativeToPlayer.ToRotationVector2() * OffsetDistanceFromPlayer; + if (projectile.localAI[0] == 0f) + { + projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + } + AdjustDamage(player); + GrantBuffs(player); + + NPC potentialTarget = projectile.Center.MinionHoming(960f, player); + if (potentialTarget is null) + { + AdjustVisualValues_Idle(player); + projectile.localAI[0] = 0f; + } + else + { + AttackTarget(potentialTarget); + projectile.localAI[0] = 1f; + } + Time++; + } + // While this projectile cannot attack, the projectiles it shoots derive from the damage. + public void AdjustDamage(Player player) + { + if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int trueDamage = (int)(projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue * + player.MinionDamage()); + projectile.damage = trueDamage; + } + } + public void GrantBuffs(Player player) + { + bool isCorrectProjectile = projectile.type == ModContent.ProjectileType(); + player.AddBuff(ModContent.BuffType(), 3600); + if (isCorrectProjectile) + { + if (player.dead) + player.Calamity().mountedScanner = false; + if (player.Calamity().mountedScanner) + projectile.timeLeft = 2; + } + } + public void AdjustVisualValues_Idle(Player player) + { + if (player.velocity.Length() > 1.5f) + { + projectile.spriteDirection = (player.velocity.X > 0).ToDirectionInt(); + projectile.rotation = player.velocity.ToRotation() + (projectile.spriteDirection == -1).ToInt() * MathHelper.Pi; + } + else + { + projectile.spriteDirection = 1; + projectile.rotation = projectile.rotation.AngleLerp(MathHelper.PiOver2, 0.075f); + } + } + public void AttackTarget(NPC target) + { + projectile.spriteDirection = 1; + projectile.rotation = projectile.AngleTo(target.Center); + if (!Collision.CanHitLine(projectile.position, projectile.width, projectile.height, target.position, target.width, target.height)) + return; + if (Time % 80f == 79f) + { + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center, + projectile.DirectionTo(target.Center), + ModContent.ProjectileType(), + projectile.damage, + projectile.knockBack, + projectile.owner, + 0f, + projectile.whoAmI); + } + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), projectile.Center); + } + } + public override bool CanDamage() => false; + } +} diff --git a/Projectiles/DraedonsArsenal/MountedScannerSummon.png b/Projectiles/DraedonsArsenal/MountedScannerSummon.png new file mode 100644 index 0000000000..3458e6c98d Binary files /dev/null and b/Projectiles/DraedonsArsenal/MountedScannerSummon.png differ diff --git a/Projectiles/DraedonsArsenal/PhaseslayerBeam.cs b/Projectiles/DraedonsArsenal/PhaseslayerBeam.cs new file mode 100644 index 0000000000..de66606ea8 --- /dev/null +++ b/Projectiles/DraedonsArsenal/PhaseslayerBeam.cs @@ -0,0 +1,67 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.Graphics.Shaders; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.DraedonsArsenal +{ + public class PhaseslayerBeam : ModProjectile + { + public const int Lifetime = 180; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Light Blade"); + Main.projFrames[projectile.type] = 5; + } + + public override void SetDefaults() + { + projectile.width = 64; + projectile.height = 120; + projectile.scale = 0.5f; + projectile.Size *= projectile.scale; + + projectile.friendly = true; + projectile.penetrate = 3; + projectile.melee = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.timeLeft = Lifetime; + projectile.localNPCHitCooldown = 6; + } + + public override void AI() + { + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + NPC potentialTarget = projectile.Center.ClosestNPCAt(1000f); + if (potentialTarget != null && projectile.Distance(potentialTarget.Center) > 40f && projectile.timeLeft > Lifetime - 60) + { + projectile.velocity = (projectile.velocity * 7f + projectile.DirectionTo(potentialTarget.Center) * 24f) / 8f; + } + projectile.frameCounter++; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D bladeTexture = ModContent.GetTexture(Texture); + MiscShaderData distortationShader = GameShaders.Misc["CalamityMod:LightDistortion"]; + + spriteBatch.End(); + spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + + Rectangle frame = bladeTexture.Frame(1, 5, 0, projectile.frameCounter / 4 % 5); + var drawData2 = new DrawData(bladeTexture, projectile.Center - Main.screenPosition, frame, Color.White, projectile.rotation, bladeTexture.Size() * 0.5f, projectile.scale * 1.2f, SpriteEffects.None, 0); + distortationShader.Apply(drawData2); + drawData2.Draw(spriteBatch); + + return false; + } + public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) + { + spriteBatch.End(); + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + } + } +} diff --git a/Projectiles/DraedonsArsenal/PhaseslayerBeam.png b/Projectiles/DraedonsArsenal/PhaseslayerBeam.png new file mode 100644 index 0000000000..8c9c20d1fe Binary files /dev/null and b/Projectiles/DraedonsArsenal/PhaseslayerBeam.png differ diff --git a/Projectiles/DraedonsArsenal/PhaseslayerBlade.png b/Projectiles/DraedonsArsenal/PhaseslayerBlade.png new file mode 100644 index 0000000000..a7058e9bce Binary files /dev/null and b/Projectiles/DraedonsArsenal/PhaseslayerBlade.png differ diff --git a/Projectiles/DraedonsArsenal/PhaseslayerBladeSmall.png b/Projectiles/DraedonsArsenal/PhaseslayerBladeSmall.png new file mode 100644 index 0000000000..f52f934a8a Binary files /dev/null and b/Projectiles/DraedonsArsenal/PhaseslayerBladeSmall.png differ diff --git a/Projectiles/DraedonsArsenal/PhaseslayerProjectile.cs b/Projectiles/DraedonsArsenal/PhaseslayerProjectile.cs new file mode 100644 index 0000000000..70bf27abed --- /dev/null +++ b/Projectiles/DraedonsArsenal/PhaseslayerProjectile.cs @@ -0,0 +1,304 @@ +using CalamityMod.Dusts; +using CalamityMod.Items; +using CalamityMod.Items.Weapons.DraedonsArsenal; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.DraedonsArsenal +{ + public class PhaseslayerProjectile : ModProjectile + { + // The "average" or "expected" swing speed which the sword's damage balance is based off of. + // This is rotation EVERY FRAME. The "average" swing speed is 360 degrees in one second, aka pi/30 radians per frame. + public const float StandardSwingSpeed = MathHelper.Pi / 30f; + + // How quickly the sword's damage updates to reflect its current speed. Higher values make it change damage more quickly. + public const float DamageUpdateResponsiveness = 0.08f; + + // When the accumuluated "charge exhaustion" meter reaches this value, the Phaseslayer item loses one point of charge. + public const float ChargeLossBreakpoint = 300f; + + public const int SwordBeamCooldown = 15; + private const float MaximumMouseRange = 360f; + private const float ProjCenterOffset = 36f; + + public bool IsSmall + { + get + { + CalamityGlobalItem swordItem = Main.player[projectile.owner].ActiveItem().Calamity(); + float chargeRatio = swordItem.CurrentCharge / (float)swordItem.ChargeMax; + return chargeRatio < Phaseslayer.SizeChargeThreshold; + } + } + + // ai[0] wrapper. Stores a rolling lerped average of angular momentum which is used as the swing speed damage multiplier. + public float AngularDamageFactor + { + get => projectile.ai[0]; + set => projectile.ai[0] = value; + } + + // ai[1] wrapper. Stores an accumulating "charge exhaustion" meter. When it reaches the limit, a charge point is lost. + public float ChargeLossProgress + { + get => projectile.ai[1]; + set => projectile.ai[1] = value; + } + + // localAI[0] wrapper + public float FadeoutTime + { + get => projectile.localAI[0]; + set => projectile.localAI[0] = value; + } + + public int BladeFrameX => IsSmall ? 1 : projectile.frame / 7; + public int BladeFrameY => IsSmall ? projectile.frame % 3 : projectile.frame % 7; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Phaseslayer"); + ProjectileID.Sets.TrailingMode[projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; + } + + public override void SetDefaults() + { + projectile.width = 46; // Collision logic is done manually. + projectile.height = 46; + projectile.friendly = true; + projectile.melee = true; + projectile.tileCollide = false; + projectile.ignoreWater = true; + + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 7; + } + + public override void AI() + { + Player player = Main.player[projectile.owner]; + // Angles are wrapped to be 0 to 2pi instead of -pi to pi for convenience with absolute values. + float rotationAdjusted = MathHelper.WrapAngle(projectile.rotation) + MathHelper.Pi; + float oldRotationAdjusted = MathHelper.WrapAngle(projectile.oldRot[1]) + MathHelper.Pi; + float deltaAngle = Math.Abs(rotationAdjusted - oldRotationAdjusted); + + // Frame 1 effect: Prevent the sword from instantly firing a sword beam. + if (projectile.localAI[1] == 0f) + { + projectile.localAI[1] = 1f; + projectile.soundDelay = SwordBeamCooldown; + } + + ManipulatePlayer(player); + bool wasBig = !IsSmall; + UpdateCharge(player); + bool justShrunk = IsSmall && wasBig; + if (justShrunk) + OnShrinkEffects(); + AdjustDamageBasedOnRotation(player, deltaAngle); + ManipulateFrames(); + HandleSwordBeams(player, deltaAngle); + HandleFadeout(); + } + + private void ManipulatePlayer(Player player) + { + if (Main.myPlayer == player.whoAmI) + { + // In addition to typical channel cancellation criteria, the sword fizzles out if it runs out of charge. + Item playerItem = player.ActiveItem(); + bool hasCharge = playerItem.Calamity().CurrentCharge > 0; + if (player.channel && !player.noItems && !player.CCed && playerItem.type == ModContent.ItemType() && hasCharge) + { + // The distance ratio ranges from 0 (your mouse is directly on the player) to 1 (your mouse is at the max range considered, or any further distance). + float mouseDistance = projectile.Distance(Main.MouseWorld); + float distRatio = Utils.InverseLerp(0f, MaximumMouseRange, mouseDistance, true); + + // This formula ensures that the sword has a sudden and extremely harsh responsiveness penalty when the mouse is close to the player. + // Otherwise it controls perfectly fine. + float aimResponsiveness = 0.035f + 0.3f * (float)Math.Pow(distRatio, 1D/3); + + // Update the sword's angle with the responsiveness determined by mouse position. + projectile.rotation = projectile.rotation.AngleLerp(player.AngleTo(Main.MouseWorld), aimResponsiveness); + } + + // If the player is not wielding the sword, determine whether it should fade out or instantly vanish. + else if (FadeoutTime == 0f) + { + // If the player voluntarily stopped holding left mouse, start the fadeout timer. + if (!player.channel) + FadeoutTime = 10f; + // If the player was killed, frozen, cursed, etc. just delete it immediately. + else + projectile.Kill(); + } + + projectile.Center = player.MountedCenter + projectile.rotation.ToRotationVector2() * ProjCenterOffset; + } + + // These lines ensure the player and their arm are rotated the correct direction to hold the sword. + projectile.direction = (Math.Cos(projectile.rotation) > 0).ToDirectionInt(); + player.ChangeDir(projectile.direction); + player.heldProj = projectile.whoAmI; + player.itemTime = 2; + player.itemAnimation = 2; + player.itemRotation = projectile.rotation * projectile.direction; + } + + private void UpdateCharge(Player player) + { + // Having the sword active at all costs some energy. + ChargeLossProgress += 1f; + + // If charge is due to be lost, reset the accumuluated charge exhaustion and update the player's held item. + if (ChargeLossProgress > ChargeLossBreakpoint) + { + ChargeLossProgress -= ChargeLossBreakpoint; + + if (Main.myPlayer == projectile.owner) + { + if (Main.mouseItem.active) + Main.mouseItem.Calamity().CurrentCharge--; + else + player.HeldItem.Calamity().CurrentCharge--; + } + } + } + + private void OnShrinkEffects() + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/MechGaussRifle"), projectile.Center); + if (Main.dedServ) + return; + + for (int i = 0; i < 60; i++) + { + Dust dust = Dust.NewDustPerfect(projectile.Center, (int)CalamityDusts.Brimstone); + dust.velocity = Main.rand.NextVector2Circular(20f, 20f); + dust.scale = 2.5f; + dust.fadeIn = 1.2f; + dust.noGravity = true; + } + } + + private void AdjustDamageBasedOnRotation(Player player, float deltaAngle) + { + // Update the rolling "blade angular momentum" average by gently lerping in the newest data point. + AngularDamageFactor = MathHelper.Lerp(AngularDamageFactor, deltaAngle, DamageUpdateResponsiveness); + + // 0x expected speed gives you 53.5% damage. + // 1x expected speed gives you 100.0% damage. + // 1.5x expected speed gives you 116.6% damage. + // 2x expected speed gives you 130.6% damage. + // 3x expected speed gives you 153.5% damage. + // 4x expected speed gives you 171.7% damage. + // 5x expected speed gives you 187.0% damage. + float speedDamageScalar = 0.166f + (float)Math.Log(AngularDamageFactor / StandardSwingSpeed + 1.5f, 3f); + float statDamageScalar = player.MeleeDamage() * (IsSmall ? Phaseslayer.SmallDamageMultiplier : 1f); + projectile.damage = (int)(Phaseslayer.Damage * speedDamageScalar * statDamageScalar); + } + + private void ManipulateFrames() + { + projectile.frame = 0; + + if (IsSmall) + { + // Fadeout frames. + if (FadeoutTime > 5) + projectile.frame = 1; + else if (FadeoutTime > 0) + projectile.frame = 2; + } + else + { + projectile.frameCounter++; + int adjustFrameCounter = projectile.frameCounter % 120; + + // Idle lightning frames. + if (adjustFrameCounter >= 50 && adjustFrameCounter <= 78) + projectile.frame = (int)MathHelper.Lerp(1, 9, Utils.InverseLerp(50, 75, adjustFrameCounter, true)); + if (adjustFrameCounter >= 90 && adjustFrameCounter <= 120) + projectile.frame = (int)MathHelper.Lerp(10, 18, Utils.InverseLerp(90, 117, adjustFrameCounter, true)); + + // Fadeout frames. + if (FadeoutTime > 5) + projectile.frame = 19; + else if (FadeoutTime > 0) + projectile.frame = 20; + } + } + + private void HandleSwordBeams(Player player, float deltaAngle) + { + // Producing a sword beam takes a bit higher of a speed than the "typical" speed the sword is balanced around. + if (projectile.soundDelay <= 0 && deltaAngle >= 1.3f * StandardSwingSpeed) + { + // Sword beams cost a noticeable amount of energy, but deal the blade's current damage. Swing harder to get more damage! + ChargeLossProgress += 30f; + if (Main.myPlayer == player.whoAmI) + { + Vector2 velocity = projectile.rotation.ToRotationVector2() * 20f; + Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), projectile.damage, 0f, player.whoAmI); + } + + // The sound delay doubles as the sword beam's cooldown. + projectile.soundDelay = SwordBeamCooldown; + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/ELRFire"), projectile.Center); + } + } + + private void HandleFadeout() + { + if (FadeoutTime > 0) + { + FadeoutTime--; + if (FadeoutTime <= 0f) + projectile.Kill(); + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D bladeTexture = ModContent.GetTexture("CalamityMod/Projectiles/DraedonsArsenal/PhaseslayerBlade"); + Texture2D hiltTexture = ModContent.GetTexture(Texture); + if (IsSmall) + bladeTexture = ModContent.GetTexture("CalamityMod/Projectiles/DraedonsArsenal/PhaseslayerBladeSmall"); + Vector2 bladeOffset = projectile.rotation.ToRotationVector2() * (IsSmall ? 90f : 132f) * projectile.scale; + Vector2 origin = bladeTexture.Size() * 0.5f; + origin /= IsSmall ? new Vector2(1f, 3f) : new Vector2(3f, 7f); + Rectangle frame = IsSmall ? bladeTexture.Frame(1, 3, 0, BladeFrameY) : bladeTexture.Frame(3, 7, BladeFrameX, BladeFrameY); + + // TODO: Update this afterimage drawcode to be more cool. + for (int i = 1; i < projectile.oldRot.Length; i++) + { + float angleDelta = MathHelper.Clamp(projectile.rotation - projectile.oldRot[i], -0.26f, 0.26f); + float angle = projectile.rotation + angleDelta; + angle += MathHelper.PiOver2; + Color color = Color.White * (float)Math.Pow(1f - i / (float)projectile.oldRot.Length, 3f); + Rectangle afterimageFrame = IsSmall ? bladeTexture.Frame(1, 3, 0, 2) : bladeTexture.Frame(3, 7, 2, 6); + spriteBatch.Draw(bladeTexture, projectile.Center + bladeOffset - Main.screenPosition, afterimageFrame, color, angle, origin, projectile.scale, SpriteEffects.None, 0f); + } + + spriteBatch.Draw(bladeTexture, projectile.Center + bladeOffset - Main.screenPosition, frame, Color.White, projectile.rotation + MathHelper.PiOver2, origin, projectile.scale, SpriteEffects.None, 0f); + spriteBatch.Draw(hiltTexture, projectile.Center - Main.screenPosition, null, lightColor, projectile.rotation + MathHelper.PiOver2, hiltTexture.Size() * 0.5f, projectile.scale, SpriteEffects.None, 0f); + + return false; + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + float _ = 0f; + Vector2 start = projectile.Center + projectile.rotation.ToRotationVector2() * 28f; + Vector2 end = start + projectile.rotation.ToRotationVector2() * (IsSmall ? 202f : 254f) * projectile.scale; + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), start, end, 60f * projectile.scale, ref _); + } + } +} diff --git a/Projectiles/DraedonsArsenal/PhaseslayerProjectile.png b/Projectiles/DraedonsArsenal/PhaseslayerProjectile.png new file mode 100644 index 0000000000..53f9fb432a Binary files /dev/null and b/Projectiles/DraedonsArsenal/PhaseslayerProjectile.png differ diff --git a/Projectiles/DraedonsArsenal/PlasmaCasterShot.cs b/Projectiles/DraedonsArsenal/PlasmaCasterShot.cs index d0e6575f74..43999de22b 100644 --- a/Projectiles/DraedonsArsenal/PlasmaCasterShot.cs +++ b/Projectiles/DraedonsArsenal/PlasmaCasterShot.cs @@ -40,11 +40,11 @@ namespace CalamityMod.Projectiles.DraedonsArsenal for (int num447 = 0; num447 < 2; num447++) { Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - int num448 = Dust.NewDust(vector33, 1, 1, dustTypeOnTimer, 0f, 0f, 0, default(Color), 1f); + vector33 -= projectile.velocity * (num447 * 0.25f); + int num448 = Dust.NewDust(vector33, 1, 1, dustTypeOnTimer, 0f, 0f, 0, default, 1f); Main.dust[num448].noGravity = true; Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; + Main.dust[num448].scale = Main.rand.Next(70, 110) * 0.013f; Main.dust[num448].velocity *= 0.2f; } @@ -65,8 +65,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal for (int num41 = 0; num41 < 2; num41++) { Vector2 value8 = Vector2.UnitX * -12f; - value8 = -Vector2.UnitY.RotatedBy((double)(projectile.ai[0] * 0.1308997f + (float)num41 * 3.14159274f), default(Vector2)) * value7 * 0.75f; - int num42 = Dust.NewDust(projectile.Center, 0, 0, dust1, 0f, 0f, 160, default(Color), 1f); + value8 = -Vector2.UnitY.RotatedBy(projectile.ai[0] * 0.1308997f + num41 * MathHelper.Pi) * value7 * 0.75f; + int num42 = Dust.NewDust(projectile.Center, 0, 0, dust1, 0f, 0f, 160, default, 1f); Main.dust[num42].scale = 0.6f; Main.dust[num42].noGravity = true; Main.dust[num42].position = projectile.Center + value8; @@ -76,8 +76,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal for (int num41 = 0; num41 < 2; num41++) { Vector2 value8 = Vector2.UnitX * -12f; - value8 = -Vector2.UnitY.RotatedBy((double)(projectile.ai[0] * 0.1308997f + (float)num41 * 3.14159274f), default(Vector2)) * value7 * 1.5f; - int num42 = Dust.NewDust(projectile.Center, 0, 0, dust2, 0f, 0f, 160, default(Color), 1f); + value8 = -Vector2.UnitY.RotatedBy(projectile.ai[0] * 0.1308997f + num41 * MathHelper.Pi) * value7 * 1.5f; + int num42 = Dust.NewDust(projectile.Center, 0, 0, dust2, 0f, 0f, 160, default, 1f); Main.dust[num42].scale = 0.6f; Main.dust[num42].noGravity = true; Main.dust[num42].position = projectile.Center + value8; @@ -105,7 +105,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { int height = 60; projectile.position = projectile.Center; - projectile.width = (projectile.height = height); + projectile.width = projectile.height = height; projectile.Center = projectile.position; projectile.maxPenetrate = -1; projectile.penetrate = -1; @@ -128,14 +128,14 @@ namespace CalamityMod.Projectiles.DraedonsArsenal if (num640 < 100) num641 = 4f; - int num643 = Dust.NewDust(projectile.Center, 6, 6, (Main.rand.Next(2) == 0 ? dust1 : dust2), 0f, 0f, 100, default(Color), 1f); + int num643 = Dust.NewDust(projectile.Center, 6, 6, Main.rand.Next(2) == 0 ? dust1 : dust2, 0f, 0f, 100, default, 1f); float num644 = Main.dust[num643].velocity.X; float num645 = Main.dust[num643].velocity.Y; if (num644 == 0f && num645 == 0f) num644 = 1f; - float num646 = (float)Math.Sqrt((double)(num644 * num644 + num645 * num645)); + float num646 = (float)Math.Sqrt(num644 * num644 + num645 * num645); num646 = num641 / num646; num644 *= num646; num645 *= num646; @@ -174,25 +174,24 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { float angleRandom = 0.35f; - int num3; - for (int num53 = 0; num53 < 40; num53 = num3 + 1) + for (int num53 = 0; num53 < 40; num53++) { float dustSpeed = Main.rand.NextFloat(speed1, speed2); Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(projectile.velocity.ToRotation()); dustVel = dustVel.RotatedBy(-angleRandom); dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); - int randomDustType = (Main.rand.Next(2) == 0 ? dust1 : dust2); + int randomDustType = Main.rand.Next(2) == 0 ? dust1 : dust2; - int num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDustType, dustVel.X, dustVel.Y, 200, default(Color), 1.7f); - Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + int num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDustType, dustVel.X, dustVel.Y, 200, default, 1.7f); + Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * projectile.width / 2f; Main.dust[num54].noGravity = true; Dust dust = Main.dust[num54]; dust.velocity *= 3f; dust = Main.dust[num54]; - num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDustType, dustVel.X, dustVel.Y, 100, default(Color), 0.8f); - Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDustType, dustVel.X, dustVel.Y, 100, default, 0.8f); + Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * projectile.width / 2f; dust = Main.dust[num54]; dust.velocity *= 2f; @@ -202,26 +201,22 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Main.dust[num54].color = Color.Green * 0.5f; dust = Main.dust[num54]; - - num3 = num53; } - for (int num55 = 0; num55 < 20; num55 = num3 + 1) + for (int num55 = 0; num55 < 20; num55++) { float dustSpeed = Main.rand.NextFloat(speed1, speed2); Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(projectile.velocity.ToRotation()); dustVel = dustVel.RotatedBy(-angleRandom); dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); - int randomDustType = (Main.rand.Next(2) == 0 ? dust1 : dust2); + int randomDustType = Main.rand.Next(2) == 0 ? dust1 : dust2; - int num56 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDustType, dustVel.X, dustVel.Y, 0, default(Color), 2f); - Main.dust[num56].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default(Vector2)) * (float)projectile.width / 3f; + int num56 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDustType, dustVel.X, dustVel.Y, 0, default, 2f); + Main.dust[num56].position = projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(projectile.velocity.ToRotation()) * projectile.width / 3f; Main.dust[num56].noGravity = true; Dust dust = Main.dust[num56]; dust.velocity *= 0.5f; dust = Main.dust[num56]; - - num3 = num55; } } } diff --git a/Projectiles/DraedonsArsenal/PlasmaGrenadeProjectile.cs b/Projectiles/DraedonsArsenal/PlasmaGrenadeProjectile.cs new file mode 100644 index 0000000000..21822a2fb7 --- /dev/null +++ b/Projectiles/DraedonsArsenal/PlasmaGrenadeProjectile.cs @@ -0,0 +1,100 @@ +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.DraedonsArsenal +{ + public class PlasmaGrenadeProjectile : ModProjectile + { + public float Time + { + get => projectile.ai[0]; + set => projectile.ai[0] = value; + } + public const float FallAcceleration = 0.15f; + public const float MaxFallSpeed = 12f; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Web Ball"); + } + + public override void SetDefaults() + { + projectile.width = 22; + projectile.height = 28; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.timeLeft = 180; + projectile.Calamity().rogue = true; + } + + public override void AI() + { + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + Vector2 projectileTop = projectile.Center + new Vector2(0f, projectile.height * -0.5f).RotatedBy(projectile.rotation); + if (projectile.velocity.Y < MaxFallSpeed && Time > 30f) + { + projectile.velocity.Y += 0.5f; + } + if (!Main.dedServ) + { + Dust dust = Dust.NewDustPerfect(projectileTop, 107); + dust.velocity = projectile.rotation.ToRotationVector2().RotatedByRandom(0.35f) * Main.rand.NextFloat(2f, 4f); + dust.velocity += projectile.velocity; + dust.scale = Main.rand.NextFloat(0.95f, 1.3f); + } + Time++; + } + + public override void Kill(int timeLeft) + { + if (projectile.Calamity().stealthStrike) + { + if (Main.myPlayer == projectile.owner) + { + Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage * 2, projectile.knockBack * 2f, projectile.owner); + } + if (!Main.dedServ) + { + for (int i = 0; i < 220; i++) + { + int type = Main.rand.NextBool(2) ? 261 : 107; + Dust dust = Dust.NewDustPerfect(projectile.Center + Main.rand.NextVector2Circular(10f, 10f), type); + dust.scale = Main.rand.NextFloat(1.6f, 2.2f); + dust.velocity = Main.rand.NextVector2CircularEdge(75f, 75f); + dust.noGravity = true; + if (type == 261) + { + dust.velocity *= 1.5f; + } + } + } + } + else + { + CalamityGlobalProjectile.ExpandHitboxBy(projectile, 360); + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.Damage(); + if (!Main.dedServ) + { + for (int i = 0; i < 120; i++) + { + int type = Main.rand.NextBool(3) ? 261 : (int)CalamityDusts.SulfurousSeaAcid; + Dust dust = Dust.NewDustPerfect(projectile.Center + Main.rand.NextVector2Circular(10f, 10f), type); + dust.scale = Main.rand.NextFloat(1.3f, 1.5f); + dust.velocity = Main.rand.NextVector2CircularEdge(15f, 15f); + dust.noGravity = true; + if (type == 261) + { + dust.velocity *= 2f; + dust.scale *= 1.8f; + } + } + } + } + } + } +} + diff --git a/Projectiles/DraedonsArsenal/PlasmaGrenadeProjectile.png b/Projectiles/DraedonsArsenal/PlasmaGrenadeProjectile.png new file mode 100644 index 0000000000..f00d0b133f Binary files /dev/null and b/Projectiles/DraedonsArsenal/PlasmaGrenadeProjectile.png differ diff --git a/Projectiles/DraedonsArsenal/PoleWarperSummon.cs b/Projectiles/DraedonsArsenal/PoleWarperSummon.cs new file mode 100644 index 0000000000..68d31b2395 --- /dev/null +++ b/Projectiles/DraedonsArsenal/PoleWarperSummon.cs @@ -0,0 +1,182 @@ +using CalamityMod.Buffs.Summon; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.DraedonsArsenal +{ + public class PoleWarperSummon : ModProjectile + { + public float AngularOffset = 0f; + public const float MaximumRepulsionSpeed = 13f; + public float Time + { + get => projectile.ai[0]; + set => projectile.ai[0] = value; + } + public bool North + { + get => projectile.ai[1] == 1f; + set => projectile.ai[1] = value.ToInt(); + } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Pole Warper"); + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + } + + public override void SetDefaults() + { + projectile.width = projectile.height = 22; + projectile.netImportant = true; + projectile.friendly = true; + projectile.minionSlots = 0.5f; + projectile.timeLeft = 18000; + projectile.penetrate = -1; + projectile.timeLeft *= 5; + projectile.minion = true; + projectile.tileCollide = false; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 24; + } + + public override void AI() + { + Player player = Main.player[projectile.owner]; + if (projectile.localAI[0] == 0f) + { + Initialize(player); + projectile.localAI[0] = 1f; + } + GrantBuffs(player); + NPC potentialTarget = projectile.Center.MinionHoming(900f, player); + if (potentialTarget is null) + { + PlayerMovement(player); + RepelMovement(); + } + else + { + NPCMovement(potentialTarget); + if (Time % 90f < 60f) + { + RepelMovement(); + } + } + Time++; + } + public void Initialize(Player player) + { + projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + for (int i = 0; i < 45; i++) + { + float angle = MathHelper.TwoPi / 45f * i; + Vector2 velocity = angle.ToRotationVector2() * 4f; + Dust dust = Dust.NewDustPerfect(projectile.Center + velocity * 2.75f, 261, velocity); + dust.noGravity = true; + } + } + // While this projectile cannot attack, the projectiles it shoots derive from the damage. + public void AdjustDamage(Player player) + { + if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int trueDamage = (int)(projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue * + player.MinionDamage()); + projectile.damage = trueDamage; + } + } + public void GrantBuffs(Player player) + { + bool isCorrectProjectile = projectile.type == ModContent.ProjectileType(); + player.AddBuff(ModContent.BuffType(), 3600); + if (isCorrectProjectile) + { + if (player.dead) + { + player.Calamity().poleWarper = false; + } + if (player.Calamity().poleWarper) + { + projectile.timeLeft = 2; + } + } + } + public void PlayerMovement(Player player) + { + Vector2 destination = player.Center + Vector2.UnitY.RotatedBy(Time / 16f + AngularOffset + (!North).ToInt() * MathHelper.Pi) * 180f; + projectile.velocity = (projectile.velocity * 4f + projectile.DirectionTo(destination) * 10f) / 5f; + projectile.velocity = projectile.velocity.SafeNormalize(Vector2.UnitY) * 10f; + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + } + public void NPCMovement(NPC npc) + { + for (int i = 0; i < Main.projectile.Length; i++) + { + if (Main.projectile[i].type == projectile.type && + Main.projectile[i].active && + projectile.owner == projectile.owner) + { + PoleWarperSummon otherPole = (PoleWarperSummon)Main.projectile[i].modProjectile; + if (otherPole.Time != Time && otherPole.Time != Time + 1) + { + otherPole.Time = Time; + } + } + } + if (Time % 90f < 40f) + { + float offsetAngle = AngularOffset * 0.5f + (!North).ToInt() * MathHelper.Pi; + Vector2 destination = npc.Center + Vector2.UnitY.RotatedBy(offsetAngle) * 180f; + projectile.velocity = (projectile.velocity * 4f + projectile.DirectionTo(destination) * 10f) / 5f; + projectile.velocity = projectile.velocity.SafeNormalize(Vector2.UnitY) * 23f; + projectile.rotation = projectile.AngleTo(npc.Center) + MathHelper.PiOver2; + } + else if (Time % 90f < 60f) + { + projectile.velocity *= 0.96f; + projectile.rotation += 0.05f; + } + else if (Time % 90f == 60f) + { + projectile.velocity = projectile.DirectionTo(npc.Center) * 26f; + projectile.rotation = projectile.AngleTo(npc.Center) + MathHelper.PiOver2; + } + } + public void RepelMovement() + { + // This does not incorporate attraction on purpose. Doing so causes the minions to very easily become distracted. + for (int i = 0; i < Main.projectile.Length; i++) + { + if (Main.projectile[i].type == projectile.type && + Main.projectile[i].active && + projectile.Distance(Main.projectile[i].Center) < 40f) + { + PoleWarperSummon otherPole = (PoleWarperSummon)Main.projectile[i].modProjectile; + if (otherPole.North != North) + { + float distanceFromOtherPole = projectile.Distance(Main.projectile[i].Center) + 1f; + if (float.IsNaN(distanceFromOtherPole) || distanceFromOtherPole < 1f) + { + distanceFromOtherPole = 1f; + } + float repulsionSpeed = MaximumRepulsionSpeed * (float)Math.Pow(3f, -distanceFromOtherPole / 27f); + projectile.velocity -= (Main.projectile[i].Center - projectile.Center).SafeNormalize(Vector2.UnitY) * repulsionSpeed; + } + } + } + } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, 1, 2); + return false; + } + } +} diff --git a/Projectiles/DraedonsArsenal/PoleWarperSummon.png b/Projectiles/DraedonsArsenal/PoleWarperSummon.png new file mode 100644 index 0000000000..53c6a5f7ff Binary files /dev/null and b/Projectiles/DraedonsArsenal/PoleWarperSummon.png differ diff --git a/Projectiles/DraedonsArsenal/PulsePistolShot.cs b/Projectiles/DraedonsArsenal/PulsePistolShot.cs new file mode 100644 index 0000000000..b7617f922b --- /dev/null +++ b/Projectiles/DraedonsArsenal/PulsePistolShot.cs @@ -0,0 +1,130 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.DraedonsArsenal +{ + public class PulsePistolShot : ModProjectile + { + public NPC Target + { + get => Main.npc[(int)projectile.ai[0]]; + set => projectile.ai[0] = value.whoAmI; + } + public float Time + { + get => projectile.ai[1]; + set => projectile.ai[1] = value; + } + public List NPCsAlreadyHit = new List(); + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Pulse Bolt"); + ProjectileID.Sets.TrailingMode[projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 12; + } + + public override void SetDefaults() + { + projectile.width = 16; + projectile.height = 16; + projectile.friendly = true; + projectile.magic = true; + projectile.penetrate = 1; + projectile.extraUpdates = 10; + projectile.timeLeft = 120 * (1 + projectile.extraUpdates); + projectile.Calamity().hasInorganicEnemyHitBoost = true; + projectile.Calamity().inorganicEnemyHitBoost = 1f / 300f; + } + + public override void AI() + { + Time++; + if (Time >= 10f || NPCsAlreadyHit.Count > 0) + { + if (NPCsAlreadyHit.Count > 0) + { + float angleOffset = MathHelper.WrapAngle(projectile.AngleTo(Target.Center) - projectile.velocity.ToRotation()); + angleOffset = MathHelper.Clamp(angleOffset, -0.2f, 0.2f); + projectile.velocity = projectile.velocity.RotatedBy(angleOffset); + } + float radiusFactor = MathHelper.Lerp(0f, 1f, Utils.InverseLerp(10f, 50f, Time, true)); + + Dust dust = Dust.NewDustPerfect(projectile.Center, 234); + dust.noGravity = true; + dust.velocity = Vector2.Zero; + dust.scale = 1.6f; + + // Only the initial shot should have a circle of dust, to prevent potential dust overload. + if (NPCsAlreadyHit.Count == 0) + { + for (int i = 0; i < 5; i++) + { + float offsetRotationAngle = projectile.velocity.ToRotation() + Time / 20f; + float radius = (14f + (float)Math.Cos(Time / 13f) * 6f) * radiusFactor; + Vector2 dustPosition = projectile.Center; + dustPosition += offsetRotationAngle.ToRotationVector2().RotatedBy(i / 5f * MathHelper.TwoPi) * radius; + dust = Dust.NewDustPerfect(dustPosition, Main.rand.NextBool(3) ? 234 : 173); + dust.noGravity = true; + dust.velocity = -projectile.velocity; + dust.scale = 0.8f; + } + } + } + } + public override bool CanDamage() => Time > projectile.MaxUpdates; + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (!NPCsAlreadyHit.Contains(target)) + NPCsAlreadyHit.Add(target); + + // If the maximum amount of targets have already been hit, die early. + if (projectile.frameCounter >= 4) + { + projectile.Kill(); + return; + } + + float minDistance = 600f; + List potentialTargets = new List(); + for (int i = 0; i < Main.npc.Length; i++) + { + bool legalTarget = Main.npc[i] != target && Main.npc[i].active; + float distanceToTarget = projectile.Distance(Main.npc[i].Center); + if (legalTarget && distanceToTarget < minDistance && !NPCsAlreadyHit.Contains(Main.npc[i])) + { + minDistance = distanceToTarget; + // The NPCs at the bottom will always be at the bottom of the list because it works via a minimum distance. + potentialTargets.Add(Main.npc[i]); + } + } + + if (potentialTargets.Count == 0) + { + projectile.Kill(); + return; + } + + potentialTargets.Reverse(); // Move the closest NPCs to the top for convenience when indexing. + int maxIndex = Math.Min(potentialTargets.Count, 2); // Pick 1 out of the 2 closest NPCs. + NPC toHit = potentialTargets[Main.rand.Next(0, maxIndex)]; + + // A netcode block such as Main.myPlayer == projectile.owner is not required. OnHitNPC is only run client-side. + Projectile splitShot = Projectile.NewProjectileDirect(projectile.Center, + projectile.velocity, + projectile.type, + projectile.damage, + projectile.knockBack, + projectile.owner, + toHit.whoAmI); + splitShot.frameCounter = projectile.frameCounter + 1; + ((PulsePistolShot)splitShot.modProjectile).NPCsAlreadyHit.AddRange(NPCsAlreadyHit); + ((PulsePistolShot)splitShot.modProjectile).NPCsAlreadyHit.Add(toHit); + projectile.Kill(); + } + } +} diff --git a/Projectiles/DraedonsArsenal/PulsePistolShot.png b/Projectiles/DraedonsArsenal/PulsePistolShot.png new file mode 100644 index 0000000000..272321a620 Binary files /dev/null and b/Projectiles/DraedonsArsenal/PulsePistolShot.png differ diff --git a/Projectiles/DraedonsArsenal/PulseRifleShot.cs b/Projectiles/DraedonsArsenal/PulseRifleShot.cs index d4db6eaaad..05096de065 100644 --- a/Projectiles/DraedonsArsenal/PulseRifleShot.cs +++ b/Projectiles/DraedonsArsenal/PulseRifleShot.cs @@ -42,16 +42,16 @@ namespace CalamityMod.Projectiles.DraedonsArsenal for (int num447 = 0; num447 < 2; num447++) { Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - int num448 = Dust.NewDust(vector33, 1, 1, dust1, 0f, 0f, 0, default(Color), 1f); + vector33 -= projectile.velocity * (num447 * 0.25f); + int num448 = Dust.NewDust(vector33, 1, 1, dust1, 0f, 0f, 0, default, 1f); Main.dust[num448].noGravity = true; Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; + Main.dust[num448].scale = Main.rand.Next(70, 110) * 0.013f; - int num449 = Dust.NewDust(vector33, 1, 1, dust3, 0f, 0f, 0, default(Color), 1f); + int num449 = Dust.NewDust(vector33, 1, 1, dust3, 0f, 0f, 0, default, 1f); Main.dust[num449].noGravity = true; Main.dust[num449].position = vector33; - Main.dust[num449].scale = (float)Main.rand.Next(70, 110) * 0.013f; + Main.dust[num449].scale = Main.rand.Next(70, 110) * 0.013f; } if (notSplitProjectile) @@ -61,8 +61,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal for (int num41 = 0; num41 < 2; num41++) { - value8 = -Vector2.UnitY.RotatedBy((double)(24f * 0.1308997f + 0f * 3.14159274f), default(Vector2)) * value7; - int num42 = Dust.NewDust(projectile.Center, 0, 0, dust2, 0f, 0f, 160, default(Color), 1f); + value8 = -Vector2.UnitY.RotatedBy(24f * 0.1308997f + 0f * MathHelper.Pi) * value7; + int num42 = Dust.NewDust(projectile.Center, 0, 0, dust2, 0f, 0f, 160, default, 1f); Main.dust[num42].scale = 1.5f; Main.dust[num42].noGravity = true; Main.dust[num42].position = projectile.Center + value8; @@ -70,8 +70,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal for (int num41 = 0; num41 < 2; num41++) { - value8 = -Vector2.UnitY.RotatedBy((double)(24f * 0.1308997f + 1f * 3.14159274f), default(Vector2)) * value7; - int num42 = Dust.NewDust(projectile.Center, 0, 0, dust2, 0f, 0f, 160, default(Color), 1f); + value8 = -Vector2.UnitY.RotatedBy(24f * 0.1308997f + 1f * MathHelper.Pi) * value7; + int num42 = Dust.NewDust(projectile.Center, 0, 0, dust2, 0f, 0f, 160, default, 1f); Main.dust[num42].scale = 1.5f; Main.dust[num42].noGravity = true; Main.dust[num42].position = projectile.Center + value8; @@ -85,40 +85,40 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - if (projectile.ai[1] < 5f && !hasHit) + if (projectile.ai[1] < 5f && !hasHit && Main.myPlayer == projectile.owner) { hasHit = true; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + Vector2 vector35 = new Vector2(projectile.position.X + projectile.width * 0.5f, projectile.position.Y + projectile.height * 0.5f); float num474 = 600f; int alreadyTargetedNPCType = 0; if (projectile.ai[1] > 0f) alreadyTargetedNPCType = (int)projectile.ai[0]; - for (int i = 0; i < 200; i++) + for (int i = 0; i < Main.maxNPCs; i++) { if (Main.npc[i].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[i].Center, 1, 1)) { if (alreadyTargetedNPCType != Main.npc[i].whoAmI) { - float num476 = Main.npc[i].position.X + (float)(Main.npc[i].width / 2); - float num477 = Main.npc[i].position.Y + (float)(Main.npc[i].height / 2); + float num476 = Main.npc[i].position.X + (Main.npc[i].width / 2); + float num477 = Main.npc[i].position.Y + (Main.npc[i].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + float num478 = Math.Abs(projectile.position.X + (projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (projectile.height / 2) - num477); if (num478 < num474) { num474 = num478; float num484 = num476 - vector35.X; float num485 = num477 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + float num486 = (float)Math.Sqrt(num484 * num484 + num485 * num485); num486 = 2f / num486; num484 *= num486; num485 *= num486; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, num484, num485, projectile.type, projectile.damage / 2, 0f, projectile.owner, (float)target.whoAmI, projectile.ai[1] + 1f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, num484, num485, projectile.type, projectile.damage / 2, 0f, projectile.owner, target.whoAmI, projectile.ai[1] + 1f); break; } } @@ -174,7 +174,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal } projectile.position = projectile.Center; - projectile.width = (projectile.height = height); + projectile.width = projectile.height = height; projectile.Center = projectile.position; projectile.maxPenetrate = -1; projectile.penetrate = -1; @@ -186,12 +186,11 @@ namespace CalamityMod.Projectiles.DraedonsArsenal int fourth = totalDust / 4; int half = totalDust / 2; - int x = (int)((float)totalDust * 0.625f); + int x = (int)(totalDust * 0.625f); - int num3; - for (int num647 = 0; num647 < totalDust; num647 = num3 + 1) + for (int num647 = 0; num647 < totalDust; num647++) { - float num648 = 2f * ((float)num647 / (float)fourth); + float num648 = 2f * (num647 / (float)fourth); int dustType = dust1; if (num647 > fourth) { @@ -203,7 +202,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal dustType = dust3; } - int num650 = Dust.NewDust(projectile.Center, 6, 6, dustType, 0f, 0f, 100, default(Color), 1f); + int num650 = Dust.NewDust(projectile.Center, 6, 6, dustType, 0f, 0f, 100, default, 1f); float num651 = Main.dust[num650].velocity.X; float num652 = Main.dust[num650].velocity.Y; if (num651 == 0f && num652 == 0f) @@ -211,7 +210,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal num651 = 1f; } - float num653 = (float)Math.Sqrt((double)(num651 * num651 + num652 * num652)); + float num653 = (float)Math.Sqrt(num651 * num651 + num652 * num652); num653 = num648 / num653; if (num647 <= half) { @@ -235,8 +234,6 @@ namespace CalamityMod.Projectiles.DraedonsArsenal } dust2.noGravity = true; - - num3 = num647; } } @@ -244,24 +241,23 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { float angleRandom = 0.05f; - int num3; - for (int num53 = 0; num53 < 50; num53 = num3 + 1) + for (int num53 = 0; num53 < 50; num53++) { float dustSpeed = Main.rand.NextFloat(speed1, speed2); Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(projectile.velocity.ToRotation()); dustVel = dustVel.RotatedBy(-angleRandom); dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); - int num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dust3, dustVel.X, dustVel.Y, 200, default(Color), 1.7f); - Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + int num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dust3, dustVel.X, dustVel.Y, 200, default, 1.7f); + Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * projectile.width / 2f; Main.dust[num54].noGravity = true; Dust dust = Main.dust[num54]; dust.velocity *= 3f; dust = Main.dust[num54]; - num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dust1, dustVel.X, dustVel.Y, 100, default(Color), 1f); - Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dust1, dustVel.X, dustVel.Y, 100, default, 1f); + Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * projectile.width / 2f; dust = Main.dust[num54]; dust.velocity *= 2f; @@ -271,25 +267,21 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Main.dust[num54].color = Color.Green * 0.5f; dust = Main.dust[num54]; - - num3 = num53; } - for (int num55 = 0; num55 < 25; num55 = num3 + 1) + for (int num55 = 0; num55 < 25; num55++) { float dustSpeed = Main.rand.NextFloat(speed1, speed2); Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(projectile.velocity.ToRotation()); dustVel = dustVel.RotatedBy(-angleRandom); dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); - int num56 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dust2, dustVel.X, dustVel.Y, 0, default(Color), 3f); - Main.dust[num56].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default(Vector2)) * (float)projectile.width / 3f; + int num56 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dust2, dustVel.X, dustVel.Y, 0, default, 3f); + Main.dust[num56].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy(projectile.velocity.ToRotation()) * projectile.width / 3f; Main.dust[num56].noGravity = true; Dust dust = Main.dust[num56]; dust.velocity *= 0.5f; dust = Main.dust[num56]; - - num3 = num55; } } } diff --git a/Projectiles/DraedonsArsenal/PulseTurret.cs b/Projectiles/DraedonsArsenal/PulseTurret.cs new file mode 100644 index 0000000000..894391f217 --- /dev/null +++ b/Projectiles/DraedonsArsenal/PulseTurret.cs @@ -0,0 +1,152 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.DraedonsArsenal +{ + public class PulseTurret : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Pulse Turret"); + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 50; + projectile.height = 24; + projectile.ignoreWater = true; + projectile.tileCollide = true; + projectile.sentry = true; + projectile.timeLeft = Projectile.SentryLifeTime; + projectile.timeLeft *= 5; + projectile.penetrate = -1; + } + + public override void AI() + { + Player player = Main.player[projectile.owner]; + if (projectile.localAI[0] == 0f) + { + projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + projectile.localAI[0] = 1; + } + if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int trueDamage = (int)(projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue * + player.MinionDamage()); + projectile.damage = trueDamage; + } + + if (projectile.velocity.Y < 12f) + { + projectile.velocity.Y += 0.5f; + } + + NPC potentialTarget = projectile.Center.MinionHoming(850f, player, false); + + if (potentialTarget != null) + { + projectile.spriteDirection = (potentialTarget.Center.X - projectile.Center.X > 0).ToDirectionInt(); + projectile.ai[0]++; + if (projectile.ai[0] % 40f < 30f) + { + float idealAngle = projectile.AngleTo(potentialTarget.Center) + (projectile.spriteDirection == -1).ToInt() * MathHelper.Pi; + if (projectile.ai[1] <= 0f) + { + projectile.rotation = projectile.rotation.AngleLerp(idealAngle, MathHelper.TwoPi / 25f); + } + // Recoil back after firing + else + { + if (projectile.ai[1] > 13f) + { + projectile.rotation -= MathHelper.ToRadians(10f) * projectile.localAI[0]; + } + projectile.ai[1]--; + } + } + if (projectile.ai[0] % 40f == 39f && Main.myPlayer == projectile.owner) + { + Texture2D standTexture = ModContent.GetTexture("CalamityMod/Projectiles/DraedonsArsenal/PulseTurretStand"); + Vector2 shootPosition = projectile.Center - ((standTexture.Height / 2 + 6f) * Vector2.UnitY); + shootPosition += (projectile.Size * 0.5f).RotatedBy(projectile.rotation - MathHelper.ToRadians(18f) - (projectile.spriteDirection == -1).ToInt() * MathHelper.Pi); + + bool aimingAtTarget = Math.Abs(Vector2.Normalize(potentialTarget.Center - shootPosition).ToRotation() - projectile.rotation) < MathHelper.ToRadians(32f) + (projectile.spriteDirection == -1).ToInt() * MathHelper.Pi; + if (aimingAtTarget || projectile.Distance(potentialTarget.Center) < 45f) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PulseRifleFire"), shootPosition); + Projectile.NewProjectile(shootPosition, + Vector2.Normalize(potentialTarget.Center - shootPosition) * 12f, + ModContent.ProjectileType(), + projectile.damage, + projectile.knockBack, + projectile.owner); + if (projectile.ai[0] % 120f == 119f) + { + for (int i = -1; i <= 1; i += 2) + { + Projectile.NewProjectile(shootPosition, + Vector2.Normalize(potentialTarget.Center - shootPosition).RotatedBy(i * MathHelper.ToRadians(28f)) * 7f, + ModContent.ProjectileType(), + projectile.damage, + projectile.knockBack, + projectile.owner, + 0f, + 1f); + } + } + if (!Main.dedServ) + { + for (int i = 0; i < 12; i++) + { + Dust.NewDustPerfect(shootPosition, 173).scale = Main.rand.NextFloat(1.4f, 1.8f); + } + } + projectile.ai[1] = 15f; + projectile.localAI[0] = Math.Sign(projectile.DirectionTo(potentialTarget.Center).X); + } + } + } + else + { + projectile.rotation = projectile.rotation.AngleLerp(0f, MathHelper.TwoPi / 50f); + } + + projectile.StickToTiles(false, false); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D standTexture = ModContent.GetTexture("CalamityMod/Projectiles/DraedonsArsenal/PulseTurretStand"); + spriteBatch.Draw(ModContent.GetTexture(Texture), + projectile.Center - ((standTexture.Height / 2 + 6f) * Vector2.UnitY) - Main.screenPosition, + null, + lightColor, + projectile.rotation, + projectile.Size * 0.5f, + projectile.scale, + projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, + 0f); + spriteBatch.Draw(standTexture, + projectile.Center - Main.screenPosition, + null, + lightColor, + 0f, + standTexture.Size() * 0.5f, + projectile.scale, + SpriteEffects.None, + 0f); + return false; + } + + public override bool CanDamage() => false; + public override bool OnTileCollide(Vector2 oldVelocity) => false; + } +} diff --git a/Projectiles/DraedonsArsenal/PulseTurret.png b/Projectiles/DraedonsArsenal/PulseTurret.png new file mode 100644 index 0000000000..1ab7f7e95c Binary files /dev/null and b/Projectiles/DraedonsArsenal/PulseTurret.png differ diff --git a/Projectiles/DraedonsArsenal/PulseTurretShot.cs b/Projectiles/DraedonsArsenal/PulseTurretShot.cs new file mode 100644 index 0000000000..21324b7336 --- /dev/null +++ b/Projectiles/DraedonsArsenal/PulseTurretShot.cs @@ -0,0 +1,88 @@ +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.DraedonsArsenal +{ + public class PulseTurretShot : ModProjectile + { + public const int SpiralPrecision = 36; + public const int SpiralRings = 6; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Pulse Bolt"); + ProjectileID.Sets.SentryShot[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.minion = true; + projectile.penetrate = 1; + projectile.timeLeft = 600; + projectile.Calamity().hasInorganicEnemyHitBoost = true; + projectile.Calamity().inorganicEnemyHitBoost = 0.002f; + projectile.extraUpdates = 1; + } + + public override void AI() + { + projectile.ai[0] += MathHelper.ToRadians(6f); + if (!Main.dedServ) + { + for (int i = 0; i < 3; i++) + { + float angle = projectile.velocity.ToRotation() + MathHelper.PiOver2; + float pulse = (float)Math.Sin(projectile.ai[0] + MathHelper.TwoPi / 3f * i); + Vector2 offset = angle.ToRotationVector2().RotatedBy(MathHelper.TwoPi / 3f * i) * pulse * 7f; + Dust.NewDustPerfect(projectile.Center + offset, 234, Vector2.Zero).noGravity = true; + Dust.NewDustPerfect(projectile.Center - offset, 234, Vector2.Zero).noGravity = true; + } + } + if (projectile.ai[1] == 1f) + { + NPC potentialTarget = projectile.Center.MinionHoming(850f, Main.player[projectile.owner], false); + if (potentialTarget != null) + { + float speed = projectile.velocity.Length(); + float inertia = MathHelper.Lerp(18f, 6f, 1f - projectile.timeLeft / 300f); + projectile.velocity = (projectile.velocity * inertia + projectile.DirectionTo(potentialTarget.Center) * speed) / (inertia + 1f); + projectile.velocity = projectile.velocity.SafeNormalize(Vector2.UnitX) * speed; + } + } + } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (!Main.dedServ) + { + // Spirals + for (int i = 0; i < SpiralPrecision; i++) + { + for (int direction = -1; direction <= 1; direction += 2) + { + for (int j = 0; j < SpiralRings; j++) + { + Dust dust = Dust.NewDustPerfect(projectile.Center + + Vector2.UnitY.RotatedBy(j / (float)SpiralRings * MathHelper.TwoPi * direction).RotatedBy(i / (float)SpiralPrecision * MathHelper.TwoPi / SpiralRings * direction) * + 36f * i / SpiralPrecision, 173); + dust.velocity = projectile.DirectionTo(dust.position) * 2.4f; + dust.scale = 1.6f; + dust.noGravity = true; + + dust = Dust.NewDustPerfect(projectile.Center + + Vector2.UnitY.RotatedBy(j / (float)SpiralRings * MathHelper.TwoPi * direction).RotatedBy(i / (float)SpiralPrecision * MathHelper.TwoPi / SpiralRings * direction) * + 36f * i / SpiralPrecision, 173); + dust.velocity = projectile.DirectionFrom(dust.position) * 4f; + dust.scale = 1.6f; + dust.noGravity = true; + } + } + } + } + } + } +} diff --git a/Projectiles/DraedonsArsenal/PulseTurretShot.png b/Projectiles/DraedonsArsenal/PulseTurretShot.png new file mode 100644 index 0000000000..15e8775737 Binary files /dev/null and b/Projectiles/DraedonsArsenal/PulseTurretShot.png differ diff --git a/Projectiles/DraedonsArsenal/PulseTurretStand.png b/Projectiles/DraedonsArsenal/PulseTurretStand.png new file mode 100644 index 0000000000..80ef447e73 Binary files /dev/null and b/Projectiles/DraedonsArsenal/PulseTurretStand.png differ diff --git a/Projectiles/DraedonsArsenal/SnakeEyesSummon.cs b/Projectiles/DraedonsArsenal/SnakeEyesSummon.cs new file mode 100644 index 0000000000..ff6bb1d8e6 --- /dev/null +++ b/Projectiles/DraedonsArsenal/SnakeEyesSummon.cs @@ -0,0 +1,259 @@ +using CalamityMod.Buffs.Summon; +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.DraedonsArsenal +{ + public class SnakeEyesSummon : ModProjectile + { + public bool SufferingFromSeparationAnxiety = false; + public Vector2 OldCenter; + public Vector2 Destination; + public float Time + { + get => projectile.ai[0]; + set => projectile.ai[0] = value; + } + public float EyeOutwardness = 1f; + public float EyeRotation = 0f; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Snake Eyes"); + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = projectile.height = 22; + projectile.netImportant = true; + projectile.friendly = true; + projectile.minionSlots = 1; + projectile.timeLeft = 18000; + projectile.penetrate = -1; + projectile.timeLeft *= 5; + projectile.minion = true; + projectile.tileCollide = false; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(SufferingFromSeparationAnxiety); + writer.Write(EyeOutwardness); + writer.Write(EyeRotation); + writer.WriteVector2(OldCenter); + writer.WriteVector2(Destination); + } + public override void ReceiveExtraAI(BinaryReader reader) + { + SufferingFromSeparationAnxiety = reader.ReadBoolean(); + EyeOutwardness = reader.ReadSingle(); + EyeRotation = reader.ReadSingle(); + OldCenter = reader.ReadVector2(); + Destination = reader.ReadVector2(); + } + + public override void AI() + { + Player player = Main.player[projectile.owner]; + if (projectile.localAI[0] == 0f) + { + Initialize(player); + projectile.localAI[0] = 1f; + } + AdjustDamage(player); + GrantBuffs(player); + NPC potentialTarget = projectile.Center.MinionHoming(820f, player); + if (potentialTarget == null || SufferingFromSeparationAnxiety) + { + projectile.ai[1] = 0f; + if (projectile.localAI[1] == 1f) + { + Time = 0f; + projectile.localAI[1] = 0f; + } + PlayerMovement(player); + } + else + { + if (projectile.localAI[1] == 0f) + { + Time = 0f; + projectile.localAI[1] = 1f; + } + NPCMovement(potentialTarget); + } + if (!SufferingFromSeparationAnxiety && projectile.Distance(player.Center) > (potentialTarget == null ? 360f : 1500f)) + { + SufferingFromSeparationAnxiety = true; + projectile.netUpdate = true; + } + else if (SufferingFromSeparationAnxiety && projectile.Distance(player.Center) < (potentialTarget == null ? 10f : 120f)) + { + SufferingFromSeparationAnxiety = false; + projectile.netUpdate = true; + } + if (!Main.dedServ) + { + GenerateAfterimageDust(); + } + Time++; + } + public void Initialize(Player player) + { + projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + Destination = projectile.Center - Vector2.UnitY * 180f; + for (int i = 0; i < 45; i++) + { + float angle = MathHelper.TwoPi / 45f * i; + Vector2 velocity = angle.ToRotationVector2() * 4f; + Dust dust = Dust.NewDustPerfect(projectile.Center + velocity * 2.75f, 39, velocity); + dust.noGravity = true; + } + } + // While this projectile cannot attack, the projectiles it shoots derive from the damage. + public void AdjustDamage(Player player) + { + if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int trueDamage = (int)(projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue * + player.MinionDamage()); + projectile.damage = trueDamage; + } + } + public void GrantBuffs(Player player) + { + bool isCorrectProjectile = projectile.type == ModContent.ProjectileType(); + player.AddBuff(ModContent.BuffType(), 3600); + if (isCorrectProjectile) + { + if (player.dead) + { + player.Calamity().snakeEyes = false; + } + if (player.Calamity().snakeEyes) + { + projectile.timeLeft = 2; + } + } + } + public void PlayerMovement(Player player) + { + projectile.velocity = Vector2.Zero; + if (!SufferingFromSeparationAnxiety) + { + projectile.Center = player.Center - Vector2.UnitY * (80f + (float)Math.Sin(Time / 120f * MathHelper.TwoPi) * 30f); + EyeOutwardness = MathHelper.Lerp(EyeOutwardness, 0f, 0.15f); + return; + } + if (Time % 150f == 0f) + { + OldCenter = projectile.Center; + } + else if (Time % 150f <= 35f) + { + EyeRotation = projectile.AngleTo(player.Center); + EyeOutwardness = MathHelper.Lerp(EyeOutwardness, 1f, 0.15f); + projectile.Center = Vector2.SmoothStep(OldCenter, player.Center - Vector2.UnitY * 80f, Utils.InverseLerp(0f, 35f, Time % 150f)); + } + else + { + projectile.Center = player.Center - Vector2.UnitY * (80f + (float)Math.Sin((Time % 150f - 35f) / 115f * MathHelper.TwoPi) * 30f); + } + EyeOutwardness = MathHelper.Lerp(EyeOutwardness, 0f, 0.15f); + } + public void NPCMovement(NPC npc) + { + projectile.velocity = Vector2.Zero; + Vector2 offsetMultiplier = Vector2.UnitX; + switch ((int)projectile.ai[1] % 4) + { + case 0: + offsetMultiplier = new Vector2(-1f, -1f); + break; + case 1: + offsetMultiplier = new Vector2(-1f, 1f); + break; + case 2: + offsetMultiplier = new Vector2(1f, 1f); + break; + case 3: + offsetMultiplier = new Vector2(1f, -1f); + break; + } + if (Time % 20f == 0f) + { + if (projectile.ai[1] > 0 && Main.myPlayer == projectile.owner) + { + Projectile laser = Projectile.NewProjectileDirect(projectile.Center + Utils.Vector2FromElipse(EyeRotation.ToRotationVector2(), projectile.Size * 0.5f * EyeOutwardness), + projectile.DirectionTo(npc.Center) * 4f, ProjectileID.UFOLaser, projectile.damage, projectile.knockBack, projectile.owner); + laser.timeLeft *= 2; + laser.tileCollide = false; + laser.netUpdate = true; + laser.Calamity().forceMinion = true; + } + projectile.ai[1]++; + OldCenter = projectile.Center; + } + else + { + EyeOutwardness = MathHelper.Lerp(EyeOutwardness, 1f, 0.15f); + EyeRotation = EyeRotation.AngleTowards(projectile.AngleTo(npc.Center), MathHelper.TwoPi / 20f); + projectile.Center = Vector2.SmoothStep(OldCenter, npc.Center + (new Vector2(300f) + projectile.Size * 0.5f) * offsetMultiplier, Time % 20f / 20f); + } + } + public void GenerateAfterimageDust() + { + for (int i = 1; i < projectile.oldPos.Length; i++) + { + if (i == 1) + { + for (int j = 0; j < 14; j++) + { + Dust dust = Dust.NewDustPerfect(projectile.Center, 261); + dust.position += (j / 14f * MathHelper.TwoPi).ToRotationVector2() * projectile.Size * 0.5f * 1.3f; + dust.velocity = Vector2.Zero; + dust.scale = 0.6f; + dust.noGravity = true; + } + } + if (Vector2.Distance(projectile.oldPos[i - 1], projectile.oldPos[i]) > 3f) + { + for (int j = 0; j < 7; j++) + { + Dust dust = Dust.NewDustPerfect(projectile.oldPos[i] + projectile.Size * 0.5f, 261); + dust.position += (j / 7f * MathHelper.TwoPi).ToRotationVector2() * ((projectile.oldPos.Length - i) * 1.2f + 3f); + dust.velocity = Vector2.Zero; + dust.scale = 0.6f; + dust.noGravity = true; + } + } + } + } + public override bool CanDamage() => false; + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, Color.White, 0, ProjectileID.Sets.TrailCacheLength[projectile.type]); + Texture2D eyeTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/SnakeEye"); + Vector2 offsetVector = Utils.Vector2FromElipse(EyeRotation.ToRotationVector2(), projectile.Size * 0.5f * EyeOutwardness); + spriteBatch.Draw(eyeTexture, + projectile.Center + offsetVector - Main.screenPosition, + null, + Color.White, + 0f, + eyeTexture.Size() * 0.5f, + 1f, + SpriteEffects.None, + 0f); + return false; + } + } +} diff --git a/Projectiles/DraedonsArsenal/SnakeEyesSummon.png b/Projectiles/DraedonsArsenal/SnakeEyesSummon.png new file mode 100644 index 0000000000..30c2fe4cae Binary files /dev/null and b/Projectiles/DraedonsArsenal/SnakeEyesSummon.png differ diff --git a/Projectiles/DraedonsArsenal/StarSwallowerAcid.cs b/Projectiles/DraedonsArsenal/StarSwallowerAcid.cs new file mode 100644 index 0000000000..fc7d11f3d1 --- /dev/null +++ b/Projectiles/DraedonsArsenal/StarSwallowerAcid.cs @@ -0,0 +1,74 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Buffs.StatDebuffs; + +namespace CalamityMod.Projectiles.DraedonsArsenal +{ + public class StarSwallowerAcid : ModProjectile + { + public const float Gravity = 0.25f; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Acid"); + ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 20; + projectile.friendly = true; + projectile.tileCollide = true; + projectile.ignoreWater = false; + projectile.timeLeft = 300; + projectile.alpha = 255; + projectile.minion = true; + projectile.minionSlots = 0f; + } + public override void AI() + { + if (projectile.velocity.Y <= 10f) + { + projectile.velocity.Y += Gravity; + } + projectile.ai[0]++; + if (projectile.ai[0] < 10) + { + projectile.alpha = (int)MathHelper.Lerp(255, 0, projectile.ai[0] / 10f); + } + projectile.tileCollide = projectile.timeLeft <= 260; + 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 = 2f; + } + return true; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 180); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, new Color(255, 255, 255, 127) * projectile.Opacity, ProjectileID.Sets.TrailingMode[projectile.type], 2); + return false; + } + } +} diff --git a/Projectiles/DraedonsArsenal/StarSwallowerAcid.png b/Projectiles/DraedonsArsenal/StarSwallowerAcid.png new file mode 100644 index 0000000000..f5e4db998f Binary files /dev/null and b/Projectiles/DraedonsArsenal/StarSwallowerAcid.png differ diff --git a/Projectiles/DraedonsArsenal/StarSwallowerSummon.cs b/Projectiles/DraedonsArsenal/StarSwallowerSummon.cs new file mode 100644 index 0000000000..a057b9e389 --- /dev/null +++ b/Projectiles/DraedonsArsenal/StarSwallowerSummon.cs @@ -0,0 +1,313 @@ +using CalamityMod.Buffs.Summon; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.World.Generation; +namespace CalamityMod.Projectiles.DraedonsArsenal +{ + public class StarSwallowerSummon : ModProjectile + { + public bool FlyUntilNearPlayer; + public float HopCooldown = 0f; + public float AcidShootTimer = 0f; + public float AcidShootCooldown = 0f; + public float FallThroughYPoint = 0f; + public bool ReleasingAcid + { + get => projectile.ai[0] != 0f; + set => projectile.ai[0] = value.ToInt(); + } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Pet Froge"); + Main.projFrames[projectile.type] = 12; + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 38; + projectile.height = 30; + projectile.minionSlots = 1f; + projectile.timeLeft = 18000; + projectile.ignoreWater = true; + projectile.tileCollide = true; + projectile.minion = true; + projectile.timeLeft *= 5; + projectile.penetrate = -1; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(HopCooldown); + writer.Write(FlyUntilNearPlayer); + writer.Write(AcidShootTimer); + writer.Write(AcidShootCooldown); + } + public override void ReceiveExtraAI(BinaryReader reader) + { + HopCooldown = reader.ReadSingle(); + FlyUntilNearPlayer = reader.ReadBoolean(); + AcidShootTimer = reader.ReadSingle(); + AcidShootCooldown = reader.ReadSingle(); + } + + public override void AI() + { + Player player = Main.player[projectile.owner]; + + bool isCorrectProjectile = projectile.type == ModContent.ProjectileType(); + player.AddBuff(ModContent.BuffType(), 3600); + if (isCorrectProjectile) + { + if (player.dead) + { + player.Calamity().starSwallowerPetFroge = false; + } + if (player.Calamity().starSwallowerPetFroge) + { + projectile.timeLeft = 2; + } + } + + int minimumFrame = 0; + int maximumFrame = 11; + + if (projectile.velocity == Vector2.Zero) + { + minimumFrame = maximumFrame = 0; + } + + if (HopCooldown > 0) + { + if (projectile.velocity.Length() > 8f) + { + minimumFrame = maximumFrame = 1; + if (Math.Abs(projectile.oldPosition.Y - projectile.position.Y) < 5.5f) + minimumFrame = maximumFrame = 0; + } + else if (HopCooldown < 6) + { + minimumFrame = maximumFrame = 2; + } + else if (HopCooldown < 12) + { + minimumFrame = maximumFrame = 3; + } + else if (HopCooldown < 21) + { + minimumFrame = maximumFrame = 4; + } + else + { + minimumFrame = maximumFrame = 5; + } + } + + AdjustDamage(player); + + // Gravity effect. + projectile.velocity.Y = MathHelper.Clamp(projectile.velocity.Y + 0.4f, -11f, 11f); + + projectile.tileCollide = !FlyUntilNearPlayer; + + ReleasingAcid = false; + + // Remember, && doesn't evaluate future statements if the statement it just evaluated is true. + // This means that null problems should never happen, since it wouldn't pass the potentialTarget != null check. + NPC potentialTarget = projectile.Center.MinionHoming(800f, player); + if (potentialTarget != null && + Math.Abs(potentialTarget.Center.X - projectile.Center.X) < 320f && + Math.Sign(potentialTarget.Center.Y - projectile.Center.Y) == -1 && + Math.Abs(potentialTarget.Center.Y - projectile.Center.Y) < 160f && + Math.Sign(potentialTarget.Center.Y - projectile.Center.Y) == -1 && + !FlyUntilNearPlayer) + { + FallThroughYPoint = potentialTarget.Top.Y; + NPCTargetingAI(potentialTarget, player); + } + else + { + PlayerSeparationAnxietyAI(player, ref minimumFrame, ref maximumFrame); + FallThroughYPoint = player.Top.Y; + } + + projectile.MinionAntiClump(); + ManipulateFrames(minimumFrame, maximumFrame); + } + + public void AdjustDamage(Player player) + { + if (projectile.localAI[0] == 0f) + { + projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + projectile.localAI[0] += 1f; + } + if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int newDamage = (int)(projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue * + player.MinionDamage()); + projectile.damage = newDamage; + } + + } + public void HandleHop(Vector2 targetPosition) + { + if (HopCooldown <= 0f && projectile.oldPosition.Y == projectile.position.Y) + { + float hopXMult = Utils.InverseLerp(50f, 500f, targetPosition.X - projectile.Center.X, true); + float hopYMult = Utils.InverseLerp(40f, 300f, targetPosition.Y - projectile.Center.Y, true); + float hopSpeedX = MathHelper.Lerp(4f, 17f, hopXMult) * Math.Sign(targetPosition.X - projectile.Center.X); + float hopSpeedY = -1 * MathHelper.Lerp(8f, 23f, hopYMult); + + Vector2 velocity = new Vector2(hopSpeedX, hopSpeedY); + + projectile.velocity = velocity; + projectile.spriteDirection = (projectile.velocity.X > 0).ToDirectionInt(); + HopCooldown = 25f; + } + else + { + projectile.velocity.X *= 0.935f; + HopCooldown--; + } + } + public void PlayerSeparationAnxietyAI(Player player, ref int minimumFrame, ref int maximumFrame) + { + // If the player is extremely far away, don't bother homing. Just go to the player's location. + if (projectile.Distance(player.Center) > 1900f) + { + projectile.Center = player.Center; + projectile.netUpdate = true; + return; + } + Vector2 returnPosition = projectile.Center; + returnPosition.Y -= 200 * 16; + + bool noGround = !WorldUtils.Find(returnPosition.ToTileCoordinates(), Searches.Chain(new Searches.Down(400), new GenCondition[] + { + new Conditions.IsSolid() + }), out _); + + if (projectile.Distance(player.Center) > 1200f) + { + FlyUntilNearPlayer = true; + projectile.netUpdate = true; + } + if (projectile.Distance(player.Center) < 120f && + FlyUntilNearPlayer && + !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + FlyUntilNearPlayer = false; + projectile.netUpdate = true; + } + + bool flying = noGround || FlyUntilNearPlayer; + + // Fly to player. + if (flying) + { + minimumFrame = 7; + maximumFrame = 11; + float inertia = 30f; + projectile.velocity = (projectile.velocity * (inertia - 1) + projectile.DirectionTo(player.Center) * 18f) / inertia; + } + // Otherwise hop around when on the ground. + else if (projectile.oldPosition.Y == projectile.position.Y) + { + HandleHop(player.Center); + } + } + public void NPCTargetingAI(NPC potentialTarget, Player player) + { + HandleHop(potentialTarget.Center); + if (Collision.CanHit(projectile.position, projectile.width, projectile.height, potentialTarget.position, potentialTarget.width, projectile.height) && AcidShootCooldown <= 0f) + { + AcidShootTimer++; + ReleasingAcid = AcidShootTimer >= 16 && AcidShootTimer <= 44; + + if (AcidShootTimer >= 20 && + AcidShootTimer <= 44 && + AcidShootTimer % 6 == 0 && + Main.netMode != NetmodeID.MultiplayerClient) + { + Vector2 spawnPosition = projectile.Center + Vector2.UnitX * 8f * projectile.spriteDirection; + + float shootSpeed = 14f; + float gravity = -StarSwallowerAcid.Gravity; + float distance = Vector2.Distance(spawnPosition, potentialTarget.Center); + float angle = 0.5f * (float)Math.Asin(MathHelper.Clamp(gravity * distance / (float)Math.Pow(shootSpeed, 2), -1f, 1f)); + + Vector2 velocity = new Vector2(0f, -shootSpeed).RotatedBy(angle).RotatedByRandom(0.015f); + velocity.X *= (potentialTarget.Center.X - projectile.Center.X < 0).ToDirectionInt(); + + projectile.spriteDirection = (potentialTarget.Center.X - projectile.Center.X > 0).ToDirectionInt(); + + Projectile.NewProjectile(spawnPosition, + velocity, + ModContent.ProjectileType(), + projectile.damage, + projectile.knockBack, + projectile.owner); + Main.PlaySound(SoundID.Item13, spawnPosition); + } + if (AcidShootTimer > 48) + { + AcidShootTimer = 0; + AcidShootCooldown = 10f; + projectile.netUpdate = true; + } + } + else if (AcidShootCooldown > 0f) + AcidShootCooldown--; + projectile.velocity.X *= 0.8f; + } + public void ManipulateFrames(int minimumFrame, int maximumFrame) + { + if (projectile.frame < minimumFrame) + { + projectile.frame = minimumFrame; + } + projectile.frameCounter++; + if (projectile.frameCounter >= maximumFrame) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > maximumFrame) + { + projectile.frame = minimumFrame; + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture = ModContent.GetTexture(Texture); + Rectangle frame = texture.Frame(2, Main.projFrames[projectile.type], ReleasingAcid.ToInt(), projectile.frame); + spriteBatch.Draw(texture, + projectile.Center - Main.screenPosition, + frame, + lightColor, + projectile.rotation, + projectile.Size * 0.5f, + projectile.scale, + projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, + 0f); + return false; + } + public override bool OnTileCollide(Vector2 oldVelocity) => false; + public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough) + { + fallThrough = projectile.Bottom.Y < FallThroughYPoint - 120f; + return base.TileCollideStyle(ref width, ref height, ref fallThrough); + } + public override bool CanDamage() => false; + } +} diff --git a/Projectiles/DraedonsArsenal/StarSwallowerSummon.png b/Projectiles/DraedonsArsenal/StarSwallowerSummon.png new file mode 100644 index 0000000000..f8c6822514 Binary files /dev/null and b/Projectiles/DraedonsArsenal/StarSwallowerSummon.png differ diff --git a/Projectiles/DraedonsArsenal/TeslaCannonShot.cs b/Projectiles/DraedonsArsenal/TeslaCannonShot.cs index e2b8ab0df7..c7ea8fa382 100644 --- a/Projectiles/DraedonsArsenal/TeslaCannonShot.cs +++ b/Projectiles/DraedonsArsenal/TeslaCannonShot.cs @@ -41,11 +41,11 @@ namespace CalamityMod.Projectiles.DraedonsArsenal for (int num447 = 0; num447 < 2; num447++) { Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - int num448 = Dust.NewDust(vector33, 1, 1, dustArray[3], 0f, 0f, 0, default(Color), 1f); + vector33 -= projectile.velocity * (num447 * 0.25f); + int num448 = Dust.NewDust(vector33, 1, 1, dustArray[3], 0f, 0f, 0, default, 1f); Main.dust[num448].noGravity = true; Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.026f; + Main.dust[num448].scale = Main.rand.Next(70, 110) * 0.026f; } if (Main.rand.Next(6) == 0) @@ -67,8 +67,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal for (int num41 = 0; num41 < 2; num41++) { - value8 = -Vector2.UnitY.RotatedBy((double)(projectile.ai[0] * 0.1308997f + (float)num41 * 3.14159274f), default(Vector2)) * value7; - int num42 = Dust.NewDust(projectile.Center, 0, 0, dustArray[2], 0f, 0f, 160, default(Color), 1f); + value8 = -Vector2.UnitY.RotatedBy(projectile.ai[0] * 0.1308997f + num41 * MathHelper.Pi) * value7; + int num42 = Dust.NewDust(projectile.Center, 0, 0, dustArray[2], 0f, 0f, 160, default, 1f); Main.dust[num42].scale = scale; Main.dust[num42].noGravity = true; Main.dust[num42].position = projectile.Center + value8; @@ -76,8 +76,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal for (int num41 = 0; num41 < 2; num41++) { - value8 = -Vector2.UnitY.RotatedBy((double)(projectile.ai[0] * 0.1308997f + (float)num41 * 3.14159274f), default(Vector2)) * value7 * 1.5f; - int num42 = Dust.NewDust(projectile.Center, 0, 0, dustArray[1], 0f, 0f, 160, default(Color), 1f); + value8 = -Vector2.UnitY.RotatedBy(projectile.ai[0] * 0.1308997f + num41 * MathHelper.Pi) * value7 * 1.5f; + int num42 = Dust.NewDust(projectile.Center, 0, 0, dustArray[1], 0f, 0f, 160, default, 1f); Main.dust[num42].scale = scale; Main.dust[num42].noGravity = true; Main.dust[num42].position = projectile.Center + value8; @@ -85,36 +85,36 @@ namespace CalamityMod.Projectiles.DraedonsArsenal for (int num41 = 0; num41 < 2; num41++) { - value8 = -Vector2.UnitY.RotatedBy((double)(projectile.ai[0] * 0.1308997f + (float)num41 * 3.14159274f), default(Vector2)) * value7 * 2f; - int num42 = Dust.NewDust(projectile.Center, 0, 0, dustArray[0], 0f, 0f, 160, default(Color), 1f); + value8 = -Vector2.UnitY.RotatedBy(projectile.ai[0] * 0.1308997f + num41 * MathHelper.Pi) * value7 * 2f; + int num42 = Dust.NewDust(projectile.Center, 0, 0, dustArray[0], 0f, 0f, 160, default, 1f); Main.dust[num42].scale = scale; Main.dust[num42].noGravity = true; Main.dust[num42].position = projectile.Center + value8; } } - if (projectile.ai[1] == 0f) + if (projectile.ai[1] == 0f && Main.myPlayer == projectile.owner) { if (arcs < 10) { - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + Vector2 vector35 = new Vector2(projectile.position.X + projectile.width * 0.5f, projectile.position.Y + projectile.height * 0.5f); float num474 = 600f; - for (int i = 0; i < 200; i++) + for (int i = 0; i < Main.maxNPCs; i++) { if (Main.npc[i].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[i].Center, 1, 1)) { - float num476 = Main.npc[i].position.X + (float)(Main.npc[i].width / 2); - float num477 = Main.npc[i].position.Y + (float)(Main.npc[i].height / 2); + float num476 = Main.npc[i].position.X + (Main.npc[i].width / 2); + float num477 = Main.npc[i].position.Y + (Main.npc[i].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + float num478 = Math.Abs(projectile.position.X + (projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (projectile.height / 2) - num477); if (num478 < num474) { num474 = num478; float num484 = num476 - vector35.X; float num485 = num477 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); + float num486 = (float)Math.Sqrt(num484 * num484 + num485 * num485); num486 = 2f / num486; num484 *= num486; @@ -157,9 +157,9 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { bool notArcingProjectile = projectile.ai[1] >= 0f; - int height = (notArcingProjectile ? 120 : 60); + int height = notArcingProjectile ? 120 : 60; projectile.position = projectile.Center; - projectile.width = (projectile.height = height); + projectile.width = projectile.height = height; projectile.Center = projectile.position; projectile.maxPenetrate = -1; projectile.penetrate = -1; @@ -169,15 +169,14 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Main.PlaySound(SoundID.Item125, projectile.Center); - int dustAmt = (notArcingProjectile ? 400 : 100); - int fourth = (notArcingProjectile ? 100 : 25); - int half = (notArcingProjectile ? 200 : 50); - int threeFourths = (notArcingProjectile ? 300 : 75); + int dustAmt = notArcingProjectile ? 400 : 100; + int fourth = notArcingProjectile ? 100 : 25; + int half = notArcingProjectile ? 200 : 50; + int threeFourths = notArcingProjectile ? 300 : 75; - float dustSpeed = (notArcingProjectile ? 12f : 6f); + float dustSpeed = notArcingProjectile ? 12f : 6f; - int num3; - for (int num672 = 0; num672 < dustAmt; num672 = num3 + 1) + for (int num672 = 0; num672 < dustAmt; num672++) { int dustType = dustArray[4]; float num674 = dustSpeed; @@ -198,14 +197,14 @@ namespace CalamityMod.Projectiles.DraedonsArsenal } float scale = (dustType == dustArray[4] ? 3f : 1.5f); - int num675 = Dust.NewDust(projectile.Center, 6, 6, dustType, 0f, 0f, 100, default(Color), scale); + int num675 = Dust.NewDust(projectile.Center, 6, 6, dustType, 0f, 0f, 100, default, scale); float num676 = Main.dust[num675].velocity.X; float num677 = Main.dust[num675].velocity.Y; if (num676 == 0f && num677 == 0f) num676 = 1f; - float num678 = (float)Math.Sqrt((double)(num676 * num676 + num677 * num677)); + float num678 = (float)Math.Sqrt(num676 * num676 + num677 * num677); num678 = num674 / num678; if (num672 > threeFourths) { @@ -236,14 +235,14 @@ namespace CalamityMod.Projectiles.DraedonsArsenal if (num672 > threeFourths) { - int num650 = Dust.NewDust(projectile.Center, 6, 6, dustArray[5], 0f, 0f, 100, default(Color), 1.3f); + int num650 = Dust.NewDust(projectile.Center, 6, 6, dustArray[5], 0f, 0f, 100, default, 1.3f); float num651 = Main.dust[num650].velocity.X; float num652 = Main.dust[num650].velocity.Y; if (num651 == 0f && num652 == 0f) num651 = 1f; - float num653 = (float)Math.Sqrt((double)(num651 * num651 + num652 * num652)); + float num653 = (float)Math.Sqrt(num651 * num651 + num652 * num652); num653 = 16f / num653; num651 = num651 * num653 * 1.25f; num652 = num652 * num653 * 0.75f; @@ -254,8 +253,6 @@ namespace CalamityMod.Projectiles.DraedonsArsenal dust9.velocity.Y = dust9.velocity.Y + num652; dust9.noGravity = true; } - - num3 = num672; } } @@ -263,26 +260,25 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { float angleRandom = 0.05f; - int num3; - for (int num53 = 0; num53 < 40; num53 = num3 + 1) + for (int num53 = 0; num53 < 40; num53++) { float dustSpeed = Main.rand.NextFloat(speed1, speed2); Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(projectile.velocity.ToRotation()); dustVel = dustVel.RotatedBy(-angleRandom); - dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); - int randomDustType = (Main.rand.Next(2) == 0 ? dustArray[4] : dustArray[5]); - float scale = (randomDustType == dustArray[4] ? 1.5f : 1f); + dustVel = dustVel.RotatedByRandom(2f * angleRandom); + int randomDustType = Main.rand.Next(2) == 0 ? dustArray[4] : dustArray[5]; + float scale = randomDustType == dustArray[4] ? 1.5f : 1f; - int num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDustType, dustVel.X, dustVel.Y, 200, default(Color), 2.5f * scale); - Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + int num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDustType, dustVel.X, dustVel.Y, 200, default, 2.5f * scale); + Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * projectile.width / 2f; Main.dust[num54].noGravity = true; Dust dust = Main.dust[num54]; dust.velocity *= 3f; dust = Main.dust[num54]; - num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDustType, dustVel.X, dustVel.Y, 100, default(Color), 1.5f * scale); - Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDustType, dustVel.X, dustVel.Y, 100, default, 1.5f * scale); + Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * projectile.width / 2f; dust = Main.dust[num54]; dust.velocity *= 2f; @@ -292,27 +288,23 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Main.dust[num54].color = Color.Cyan * 0.5f; dust = Main.dust[num54]; - - num3 = num53; } - for (int num55 = 0; num55 < 20; num55 = num3 + 1) + for (int num55 = 0; num55 < 20; num55++) { float dustSpeed = Main.rand.NextFloat(speed1, speed2); - Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(projectile.velocity.ToRotation()); + Vector2 dustVel = new Vector2(dustSpeed, 0f).RotatedBy(projectile.velocity.ToRotation()); dustVel = dustVel.RotatedBy(-angleRandom); - dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); - int randomDustType = (Main.rand.Next(2) == 0 ? dustArray[4] : dustArray[5]); - float scale = (randomDustType == dustArray[4] ? 1.5f : 1f); + dustVel = dustVel.RotatedByRandom(2f * angleRandom); + int randomDustType = Main.rand.Next(2) == 0 ? dustArray[4] : dustArray[5]; + float scale = randomDustType == dustArray[4] ? 1.5f : 1f; - int num56 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDustType, dustVel.X, dustVel.Y, 0, default(Color), 3f * scale); - Main.dust[num56].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default(Vector2)) * (float)projectile.width / 3f; + int num56 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDustType, dustVel.X, dustVel.Y, 0, default, 3f * scale); + Main.dust[num56].position = projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(projectile.velocity.ToRotation()) * projectile.width / 3f; Main.dust[num56].noGravity = true; Dust dust = Main.dust[num56]; dust.velocity *= 0.5f; dust = Main.dust[num56]; - - num3 = num55; } } } diff --git a/Projectiles/DraedonsArsenal/VoltageStream.cs b/Projectiles/DraedonsArsenal/VoltageStream.cs new file mode 100644 index 0000000000..f1126050b0 --- /dev/null +++ b/Projectiles/DraedonsArsenal/VoltageStream.cs @@ -0,0 +1,124 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.DraedonsArsenal +{ + public class VoltageStream : ModProjectile + { + public float Time + { + get => projectile.ai[0]; + set => projectile.ai[0] = value; + } + public NPC Target + { + get => Main.npc[(int)projectile.ai[1]]; + set => projectile.ai[1] = value.whoAmI; + } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Voltage Stream"); + } + + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.friendly = true; + projectile.melee = true; + projectile.penetrate = -1; + projectile.timeLeft = 600; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 9; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, Color.SkyBlue.ToVector3()); + if (!Target.active) + { + projectile.Kill(); + return; + } + projectile.Center = Target.Center; + if (Time < 90f) + { + float completionRatio = Utils.InverseLerp(0f, 90f, Time, true); + float offsetRatioOnSprite = (float)Math.Sin(completionRatio * MathHelper.ToRadians(720f)) * 0.5f + 0.5f; + Vector2 dustInitialPosition = Vector2.Lerp(Target.Top, Target.Bottom, offsetRatioOnSprite); + for (int i = 0; i < 4; i++) + { + float angularOffset = MathHelper.TwoPi / 4f * i + Time / 90f * MathHelper.ToRadians(1080f); + Vector2 dustSpawnPosition = dustInitialPosition + angularOffset.ToRotationVector2() * 4f; + dustSpawnPosition.X += 10f * (float)Math.Sin(completionRatio * MathHelper.ToRadians(360f)); + + Dust dust = Dust.NewDustPerfect(dustSpawnPosition, 261); + dust.velocity = Vector2.Zero; + dust.noGravity = true; + + dustSpawnPosition = dustInitialPosition + angularOffset.ToRotationVector2() * 4f; + dustSpawnPosition.X -= 10f * (float)Math.Sin(completionRatio * MathHelper.ToRadians(360f)); + dust = Dust.NewDustPerfect(dustSpawnPosition, 261); + dust.velocity = Vector2.Zero; + dust.noGravity = true; + } + } + else if (Time < 150f) + { + for (int i = 0; i < 50; i++) + { + float angle = MathHelper.TwoPi / 50f * i + Utils.InverseLerp(90f, 150f, Time, true) * MathHelper.ToRadians(1080f); + float radius = MathHelper.Lerp(0f, 25f, Utils.InverseLerp(90f, 150f, Time, true)); + Dust dust = Dust.NewDustPerfect(Target.Center + angle.ToRotationVector2() * radius, 226); + dust.velocity = Vector2.Zero; + if (Main.rand.NextBool(6)) + { + dust.velocity = Target.DirectionTo(dust.position) * 4.5f; + } + dust.noGravity = true; + } + } + else + { + for (int i = 0; i < 120; i++) + { + float angle = MathHelper.TwoPi / 120f * i; + Dust dust = Dust.NewDustPerfect(Target.Center + angle.ToRotationVector2() * 25f, 226); + dust.velocity = angle.ToRotationVector2() * Main.rand.NextFloat(2f, 9f) * Main.rand.NextBool(2).ToDirectionInt(); + dust.velocity = dust.velocity.RotatedBy(dust.velocity.ToRotation() * -0.02f); + dust.velocity *= 2.1f; + dust.noGravity = true; + } + Target.AddBuff(BuffID.Electrified, 60 * 10); + projectile.Kill(); + } + Time++; + + if (projectile.damage <= 0) + projectile.Kill(); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + ReduceDamage(); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + ReduceDamage(); + } + + private void ReduceDamage() + { + projectile.damage = (int)(projectile.damage * 0.75); + } + + public override void Kill(int timeLeft) + { + } + } +} diff --git a/Projectiles/DraedonsArsenal/VoltageStream.png b/Projectiles/DraedonsArsenal/VoltageStream.png new file mode 100644 index 0000000000..272321a620 Binary files /dev/null and b/Projectiles/DraedonsArsenal/VoltageStream.png differ diff --git a/Projectiles/Enemy/DraedonLaser.cs b/Projectiles/Enemy/DraedonLaser.cs new file mode 100644 index 0000000000..735763c9ca --- /dev/null +++ b/Projectiles/Enemy/DraedonLaser.cs @@ -0,0 +1,82 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Enemy +{ + public class DraedonLaser : ModProjectile + { + public float TrailLength + { + get => projectile.ai[0]; + set => projectile.ai[0] = value; + } + public const int MaxTrailPoints = 50; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Laser"); + } + + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 6; + projectile.hostile = true; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.extraUpdates = 4; + projectile.timeLeft = 240; + } + + public override void AI() + { + if (projectile.localAI[0] == 0f) + { + Main.PlaySound(SoundID.Item12, (int)projectile.Center.X, (int)projectile.Center.Y); + projectile.localAI[0] = 1f; + } + projectile.alpha = (int)(Math.Sin(projectile.timeLeft / 240f * MathHelper.Pi) * 1.6f * 255f); + if (projectile.alpha > 255) + projectile.alpha = 255; + TrailLength += 1.5f; + if (TrailLength > MaxTrailPoints) + { + TrailLength = MaxTrailPoints; + } + } + + public override Color? GetAlpha(Color lightColor) => new Color(255, 190, 255, 0); + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture = ModContent.GetTexture(Texture); + float adjustedXOrigin = (texture.Width - projectile.width) * 0.5f + projectile.width * 0.5f; + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Rectangle roughScreenBounds = new Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); + // Only draw when within the bounds of the screen for performance reasons. + if (projectile.Hitbox.Intersects(roughScreenBounds)) + { + Vector2 drawPosition = new Vector2(projectile.position.X + adjustedXOrigin, projectile.position.Y + projectile.height / 2) - Main.screenPosition; + drawPosition += Vector2.UnitY * projectile.gfxOffY; + for (int i = 1; i <= (int)TrailLength; i++) + { + Vector2 drawOffset = Vector2.Normalize(projectile.velocity) * i * 1.5f; + Color drawColor = projectile.GetAlpha(lightColor); // The parameter doesn't really matter. The lightColor parameter in GetAlpha is ignored in this case. + drawColor.A = (byte)(255 - projectile.alpha); + drawColor *= (MaxTrailPoints - i) / (float)MaxTrailPoints; + float scale = MathHelper.Lerp(0.45f, 1f, 1f - i / TrailLength) * projectile.scale; + spriteBatch.Draw(texture, drawPosition - drawOffset, null, drawColor, projectile.rotation, new Vector2(adjustedXOrigin, projectile.height * 0.5f), scale, spriteEffects, 0f); + } + } + return false; + } + } +} diff --git a/Projectiles/Enemy/DraedonLaser.png b/Projectiles/Enemy/DraedonLaser.png new file mode 100644 index 0000000000..d2fb806a1a Binary files /dev/null and b/Projectiles/Enemy/DraedonLaser.png differ diff --git a/Projectiles/Enemy/EarthRockBig.cs b/Projectiles/Enemy/EarthRockBig.cs index 8b12ba1d48..d1d35e7c7f 100644 --- a/Projectiles/Enemy/EarthRockBig.cs +++ b/Projectiles/Enemy/EarthRockBig.cs @@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Enemy projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); for (int num621 = 0; num621 < 15; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 8, 0f, 0f, 100, default, 1.2f); + int num622 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 8, 0f, 0f, 100, default, 1.2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -71,13 +71,13 @@ namespace CalamityMod.Projectiles.Enemy } for (int num623 = 0; num623 < 30; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 1, 0f, 0f, 100, default, 1.7f); + int num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 1, 0f, 0f, 100, default, 1.7f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 8, 0f, 0f, 100, default, 1f); + num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 8, 0f, 0f, 100, default, 1f); Main.dust[num624].velocity *= 2f; } - CalamityUtils.ExplosionGores(projectile, 3); + CalamityUtils.ExplosionGores(projectile.Center, 3); } public override void OnHitPlayer(Player target, int damage, bool crit) diff --git a/Projectiles/Enemy/EarthRockSmall.cs b/Projectiles/Enemy/EarthRockSmall.cs index f9fc694331..23f4b6378d 100644 --- a/Projectiles/Enemy/EarthRockSmall.cs +++ b/Projectiles/Enemy/EarthRockSmall.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Projectiles.Enemy projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); for (int num621 = 0; num621 < 10; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 8, 0f, 0f, 100, default, 1.2f); + int num622 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 8, 0f, 0f, 100, default, 1.2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -50,13 +50,13 @@ namespace CalamityMod.Projectiles.Enemy } for (int num623 = 0; num623 < 20; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 1, 0f, 0f, 100, default, 1.7f); + int num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 1, 0f, 0f, 100, default, 1.7f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 8, 0f, 0f, 100, default, 1f); + num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 8, 0f, 0f, 100, default, 1f); Main.dust[num624].velocity *= 2f; } - CalamityUtils.ExplosionGores(projectile, 3); + CalamityUtils.ExplosionGores(projectile.Center, 3); } public override void OnHitPlayer(Player target, int damage, bool crit) diff --git a/Projectiles/Enemy/FlakAcid.cs b/Projectiles/Enemy/FlakAcid.cs index ea1941e212..5abc682b56 100644 --- a/Projectiles/Enemy/FlakAcid.cs +++ b/Projectiles/Enemy/FlakAcid.cs @@ -54,9 +54,7 @@ namespace CalamityMod.Projectiles.Enemy } public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = projectile.height = 150; - projectile.position -= projectile.Size / 2f; + CalamityGlobalProjectile.ExpandHitboxBy(projectile, 150); projectile.Damage(); for (int i = 0; i <= 40; i++) { @@ -74,6 +72,8 @@ namespace CalamityMod.Projectiles.Enemy } } + public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, 200); + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); diff --git a/Projectiles/Enemy/GammaAcid.cs b/Projectiles/Enemy/GammaAcid.cs index 3afba2d30d..cf04973c26 100644 --- a/Projectiles/Enemy/GammaAcid.cs +++ b/Projectiles/Enemy/GammaAcid.cs @@ -39,9 +39,7 @@ namespace CalamityMod.Projectiles.Enemy } public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = projectile.height = 80; - projectile.position -= projectile.Size / 2f; + CalamityGlobalProjectile.ExpandHitboxBy(projectile, 80); projectile.Damage(); for (int i = 0; i <= 40; i++) { @@ -59,6 +57,8 @@ namespace CalamityMod.Projectiles.Enemy } } + public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, 200); + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); diff --git a/Projectiles/Enemy/InkBomb.cs b/Projectiles/Enemy/InkBombHostile.cs similarity index 92% rename from Projectiles/Enemy/InkBomb.cs rename to Projectiles/Enemy/InkBombHostile.cs index 4328710d49..404587d035 100644 --- a/Projectiles/Enemy/InkBomb.cs +++ b/Projectiles/Enemy/InkBombHostile.cs @@ -5,7 +5,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Enemy { - public class InkBomb : ModProjectile + public class InkBombHostile : ModProjectile { public override void SetStaticDefaults() { @@ -31,7 +31,7 @@ namespace CalamityMod.Projectiles.Enemy if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) { projectile.velocity.X = projectile.velocity.X * 0.97f; - if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) + if (projectile.velocity.X > -0.01f && projectile.velocity.X < 0.01f) { projectile.velocity.X = 0f; projectile.netUpdate = true; @@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Enemy Vector2 vector15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); vector15.Normalize(); vector15 *= (float)Main.rand.Next(50, 401) * 0.01f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, vector15.X, vector15.Y, ModContent.ProjectileType() + Main.rand.Next(3), (int)((double)projectile.damage * 0.66), 1f, projectile.owner, 0f, (float)Main.rand.Next(-45, 1)); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, vector15.X, vector15.Y, ModContent.ProjectileType() + Main.rand.Next(3), (int)(projectile.damage * 0.66), 1f, projectile.owner, 0f, (float)Main.rand.Next(-45, 1)); } } projectile.position.X = projectile.position.X + (float)(projectile.width / 2); diff --git a/Projectiles/Enemy/InkBomb.png b/Projectiles/Enemy/InkBombHostile.png similarity index 100% rename from Projectiles/Enemy/InkBomb.png rename to Projectiles/Enemy/InkBombHostile.png diff --git a/Projectiles/Environment/LightningMark.cs b/Projectiles/Environment/LightningMark.cs index c266a3d844..4d6e303065 100644 --- a/Projectiles/Environment/LightningMark.cs +++ b/Projectiles/Environment/LightningMark.cs @@ -42,10 +42,13 @@ namespace CalamityMod.Projectiles.Environment Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/LightningStrike"), (int)projectile.Center.X, (int)projectile.Center.Y); Vector2 ai0 = projectile.Center - fireFrom; - float ai = (float)Main.rand.Next(100); - Vector2 velocity = Vector2.Normalize(ai0.RotatedByRandom(0.78539818525314331)) * 7f; - int proj = Projectile.NewProjectile(fireFrom.X, fireFrom.Y, velocity.X, velocity.Y, ProjectileID.CultistBossLightningOrbArc, 50, 0f, projectile.owner, ai0.ToRotation(), ai); - Main.projectile[proj].extraUpdates += 6; + float ai = Main.rand.Next(100); + Vector2 velocity = Vector2.Normalize(ai0.RotatedByRandom(MathHelper.PiOver4)) * 7f; + + int damage = NPC.downedMoonlord ? 80 : NPC.downedPlantBoss ? 40 : Main.hardMode ? 20 : 10; + + int proj = Projectile.NewProjectile(fireFrom.X, fireFrom.Y, velocity.X, velocity.Y, ProjectileID.CultistBossLightningOrbArc, damage, 0f, projectile.owner, ai0.ToRotation(), ai); + Main.projectile[proj].extraUpdates += 11; Main.projectile[proj].friendly = true; Main.projectile[proj].Calamity().lineColor = 1; } diff --git a/Projectiles/Healing/ShinobiHealOrb.cs b/Projectiles/Healing/ShinobiHealOrb.cs index f1a9380519..0f8802326f 100644 --- a/Projectiles/Healing/ShinobiHealOrb.cs +++ b/Projectiles/Healing/ShinobiHealOrb.cs @@ -15,7 +15,6 @@ namespace CalamityMod.Projectiles.Healing { projectile.width = 20; projectile.height = 20; - aiType = ProjectileID.FrostWave; projectile.friendly = true; projectile.melee = true; projectile.tileCollide = false; diff --git a/Projectiles/Healing/XerocHealOrb.cs b/Projectiles/Healing/XerocHealOrb.cs index c5d09d22e5..4c9f4ecb0a 100644 --- a/Projectiles/Healing/XerocHealOrb.cs +++ b/Projectiles/Healing/XerocHealOrb.cs @@ -26,11 +26,14 @@ namespace CalamityMod.Projectiles.Healing projectile.HealingProjectile((int)projectile.ai[1], (int)projectile.ai[0], 5.5f, 15f); float num498 = projectile.velocity.X * 0.2f; float num499 = -(projectile.velocity.Y * 0.2f); - int num500 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 58, 0f, 0f, 100, default, 2f); - Dust dust = Main.dust[num500]; - dust.noGravity = true; - dust.position.X -= num498; - dust.position.Y -= num499; + if (projectile.timeLeft % 2 == 0) + { + int num500 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 62, 0f, 0f, 100, default, 2f); + Dust dust = Main.dust[num500]; + dust.noGravity = true; + dust.position.X -= num498; + dust.position.Y -= num499; + } } } } diff --git a/Projectiles/Healing/XerocHealOrb.png b/Projectiles/Healing/XerocHealOrb.png index 15e8775737..c1fdbf1381 100644 Binary files a/Projectiles/Healing/XerocHealOrb.png and b/Projectiles/Healing/XerocHealOrb.png differ diff --git a/Projectiles/Hybrid/EradicatorProjectile.cs b/Projectiles/Hybrid/EradicatorProjectile.cs index 96c3f699a9..89990120da 100644 --- a/Projectiles/Hybrid/EradicatorProjectile.cs +++ b/Projectiles/Hybrid/EradicatorProjectile.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Hybrid public override void AI() { Lighting.AddLight(projectile.Center, 0.35f, 0f, 0.25f); - CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 300f, 6f, 8f, 20, ModContent.ProjectileType()); + CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 300f, 6f, 8f, 6, ModContent.ProjectileType(), 1D, true); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Hybrid/KelvinCatalystBoomerang.png b/Projectiles/Hybrid/KelvinCatalystBoomerang.png index 1d6c440160..86a074d801 100644 Binary files a/Projectiles/Hybrid/KelvinCatalystBoomerang.png and b/Projectiles/Hybrid/KelvinCatalystBoomerang.png differ diff --git a/Projectiles/Hybrid/PwnagehammerProj.cs b/Projectiles/Hybrid/PwnagehammerProj.cs index 4f9bf797e2..ffe1be0e76 100644 --- a/Projectiles/Hybrid/PwnagehammerProj.cs +++ b/Projectiles/Hybrid/PwnagehammerProj.cs @@ -1,41 +1,211 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Hybrid { - public class PwnagehammerProj : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Hammer"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public class PwnagehammerProj : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hammer"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.aiStyle = 3; - projectile.timeLeft = 120; - projectile.extraUpdates = 3; - aiType = ProjectileID.PaladinsHammerFriendly; - projectile.melee = true; - } + public override void SetDefaults() + { + projectile.width = projectile.height = 40; + projectile.friendly = true; + projectile.timeLeft = 3600; + projectile.melee = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + } - public override void AI() - { - projectile.velocity.X *= 1.06f; - projectile.velocity.Y *= 1.06f; - } + public override void AI() + { + projectile.direction = projectile.spriteDirection = (projectile.velocity.X > 0f) ? 1 : -1; + projectile.rotation += MathHelper.ToRadians(22.5f) * projectile.direction; - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - } + if (projectile.ai[0] == 1f) + { + float distance = 400f; + if (projectile.ai[1] == -1) + { + // used for finding a target + for (int i = 0; i < Main.maxNPCs; i++) + { + NPC npc = Main.npc[i]; + if (npc.CanBeChasedBy(projectile, false)) + { + Vector2 vec = npc.Center - projectile.Center; + float distanceTo = vec.Length(); + distanceTo -= (float)Math.Sqrt(npc.width * npc.width + npc.height * npc.height) * 0.75f; + if (distanceTo < distance && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + { + projectile.ai[1] = i; + } + } + } + } + else + { + int index = (int)projectile.ai[1]; + float speed = 34f; + float inertia = 15f; + + if (!Main.npc[index].CanBeChasedBy(projectile, false)) + projectile.ai[1] = -1; + + Vector2 direction = Main.npc[index].Center - projectile.Center; + direction.Normalize(); + direction *= speed; + projectile.velocity = (projectile.velocity * (inertia - 1) + direction) / inertia; + } + } + else + { + projectile.velocity.X *= 0.9711f; + projectile.velocity.Y += 0.426f; + } + + if (Main.rand.NextBool(2)) + { + Vector2 offset = new Vector2(12, 0).RotatedByRandom(MathHelper.ToRadians(360f)); + Vector2 velOffset = new Vector2(4, 0).RotatedBy(offset.ToRotation()); + Dust dust = Dust.NewDustPerfect(new Vector2(projectile.Center.X, projectile.Center.Y) + offset, DustID.GoldFlame, new Vector2((projectile.velocity.X * 0.2f) + velOffset.X, (projectile.velocity.Y * 0.2f) + velOffset.Y), 100, new Color(255, 245, 198), 2f); + dust.noGravity = true; + } + + if (Main.rand.NextBool(6)) + { + Vector2 offset = new Vector2(12, 0).RotatedByRandom(MathHelper.ToRadians(360f)); + Vector2 velOffset = new Vector2(4, 0).RotatedBy(offset.ToRotation()); + Dust dust = Dust.NewDustPerfect(new Vector2(projectile.Center.X, projectile.Center.Y) + offset, DustID.GoldFlame, new Vector2((projectile.velocity.X * 0.2f) + velOffset.X, (projectile.velocity.Y * 0.2f) + velOffset.Y), 100, new Color(255, 245, 198), 2f); + dust.noGravity = true; + } + } + + public override void Kill(int timeLeft) + { + Player player = Main.player[projectile.owner]; + if (projectile.ai[0] == 1f) + { + float numberOfDusts = 40f; + float rotFactor = 360f / numberOfDusts; + for (int i = 0; i < numberOfDusts; i++) + { + float rot = MathHelper.ToRadians(i * rotFactor); + Vector2 offset = new Vector2(15f, 0).RotatedBy(rot); + Vector2 velOffset = new Vector2(10f, 0).RotatedBy(rot); + Dust dust = Dust.NewDustPerfect(projectile.position + offset, 269, new Vector2(velOffset.X, velOffset.Y)); + dust.noGravity = true; + dust.velocity = velOffset; + dust.scale = 2.5f; + if ((i % 2) == 0) + { + dust = Dust.NewDustPerfect(projectile.position + offset, 269, new Vector2(velOffset.X, velOffset.Y)); + dust.noGravity = true; + dust.velocity = velOffset * 2f; + dust.scale = 2.5f; + } + if ((i % 4) == 0) + { + dust = Dust.NewDustPerfect(projectile.position + offset, 269, new Vector2(velOffset.X, velOffset.Y)); + dust.noGravity = true; + dust.velocity = velOffset / 2f; + dust.scale = 2.5f; + } + } + + float distance = 240f; + + for (int k = 0; k < Main.maxNPCs; k++) + { + NPC npc = Main.npc[k]; + Vector2 vec = npc.Center - projectile.Center; + float distanceTo = (float)Math.Sqrt(vec.X * vec.X + vec.Y * vec.Y); + distanceTo -= (float)Math.Sqrt(npc.width * npc.width + npc.height * npc.height) * 0.75f; + if (distanceTo < distance && npc.CanBeChasedBy(projectile, false) && k != projectile.localAI[0]) + { + float alldamage = projectile.damage * 1.25f; + double damage = npc.StrikeNPC((int)alldamage, projectile.knockBack, (projectile.velocity.X > 0f) ? 1 : -1); + player.addDPS((int)damage); + } + } + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PwnagehammerHoming").WithVolume(1f), projectile.Center); + Main.PlaySound(SoundID.Item14.WithVolume(.75f), projectile.position); + } + else + { + float numberOfDusts = 32f; + float rotFactor = 360f / numberOfDusts; + for (int i = 0; i < numberOfDusts; i++) + { + float rot = MathHelper.ToRadians(i * rotFactor); + Vector2 offset = new Vector2(15f, 0).RotatedBy(rot); + Vector2 velOffset = new Vector2(12.5f, 0).RotatedBy(rot); + Dust dust = Dust.NewDustPerfect(projectile.position + offset, 269, new Vector2(velOffset.X, velOffset.Y)); + dust.noGravity = true; + dust.velocity = velOffset; + dust.scale = 2.5f; + } + + float distance = 168f; + + for (int k = 0; k < Main.maxNPCs; k++) + { + NPC npc = Main.npc[k]; + Vector2 vec = npc.Center - projectile.Center; + float distanceTo = (float)Math.Sqrt(vec.X * vec.X + vec.Y * vec.Y); + distanceTo -= (float)Math.Sqrt(npc.width * npc.width + npc.height * npc.height) * 0.75f; + if (distanceTo < distance && npc.CanBeChasedBy(projectile, false) && k != projectile.localAI[0]) + { + float alldamage = projectile.damage * 0.75f; + double damage = npc.StrikeNPC((int)alldamage, projectile.knockBack, (projectile.velocity.X > 0f) ? 1 : -1); + player.addDPS((int)damage); + } + } + + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PwnagehammerSound").WithVolume(1f).WithPitchVariance(.08f), projectile.Center); + Main.PlaySound(SoundID.Item14.WithVolume(.60f), projectile.position); + } + } + + public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + if (projectile.ai[0] == 1f && Main.myPlayer == projectile.owner) + { + int hammer = Projectile.NewProjectile(projectile.Center, new Vector2(0, -15f), ModContent.ProjectileType(), projectile.damage * 2, projectile.knockBack, projectile.owner, 0f, projectile.ai[1]); + Main.projectile[hammer].localAI[0] = Math.Sign(projectile.velocity.X); + Main.projectile[hammer].melee = projectile.melee; + Main.projectile[hammer].Calamity().rogue = projectile.Calamity().rogue; + } + } + + public override void ModifyHitPvp(Player target, ref int damage, ref bool crit) + { + if (projectile.ai[0] == 1f && Main.myPlayer == projectile.owner) + { + int hammer = Projectile.NewProjectile(projectile.Center, new Vector2(0, -15f), ModContent.ProjectileType(), projectile.damage * 2, projectile.knockBack, projectile.owner, 0f, projectile.ai[1]); + Main.projectile[hammer].localAI[0] = Math.Sign(projectile.velocity.X); + Main.projectile[hammer].melee = projectile.melee; + Main.projectile[hammer].Calamity().rogue = projectile.Calamity().rogue; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + projectile.localAI[0] = target.whoAmI; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + } } diff --git a/Projectiles/Hybrid/PwnagehammerProjStealthStrike.cs b/Projectiles/Hybrid/PwnagehammerProjStealthStrike.cs new file mode 100644 index 0000000000..c717c1ccd6 --- /dev/null +++ b/Projectiles/Hybrid/PwnagehammerProjStealthStrike.cs @@ -0,0 +1,143 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Hybrid +{ + public class PwnagehammerProjStealthStrike : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spectral Hammer"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 7; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + + public override void SetDefaults() + { + projectile.width = 40; + projectile.height = 40; + projectile.aiStyle = 0; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.usesLocalNPCImmunity = true; + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, 248, 124, 255); + } + + public override void AI() + { + projectile.ai[0] += 1f; + if (projectile.ai[0] < 42f) + { + projectile.velocity.Y *= 0.9575f; + projectile.rotation += MathHelper.ToRadians(projectile.ai[0] * 0.5f) * projectile.localAI[0]; + } + else if (projectile.ai[0] < 44f) + { + NPC target = Main.npc[(int)projectile.ai[1]]; + float velConst = 3f; + projectile.velocity = new Vector2((target.Center.X - projectile.Center.X) / velConst, (target.Center.Y - projectile.Center.Y) / velConst); + projectile.rotation += MathHelper.ToRadians(48f) * projectile.localAI[0]; + } + + if (Main.rand.NextBool(2)) + { + Vector2 offset = new Vector2(7, 0).RotatedByRandom(MathHelper.ToRadians(360f)); + Vector2 velOffset = new Vector2(3, 0).RotatedBy(offset.ToRotation()); + Dust dust = Dust.NewDustPerfect(new Vector2(projectile.position.X, projectile.position.Y) + offset, DustID.GoldFlame, new Vector2((projectile.velocity.X * 0.2f) + velOffset.X, (projectile.velocity.Y * 0.2f) + velOffset.Y), 100, new Color(255, 245, 198), 2f); + dust.noGravity = true; + } + + if (Main.rand.NextBool(6)) + { + Vector2 offset = new Vector2(7, 0).RotatedByRandom(MathHelper.ToRadians(360f)); + Vector2 velOffset = new Vector2(3, 0).RotatedBy(offset.ToRotation()); + Dust dust = Dust.NewDustPerfect(new Vector2(projectile.position.X, projectile.position.Y) + offset, DustID.GoldFlame, new Vector2((projectile.velocity.X * 0.2f) + velOffset.X, (projectile.velocity.Y * 0.2f) + velOffset.Y), 100, new Color(255, 245, 198), 2f); + dust.noGravity = true; + } + } + + public override bool? CanHitNPC(NPC target) + { + if (projectile.ai[0] <= 42f) + { + return false; + } + return null; + } + + public override bool CanHitPvp(Player target) + { + return projectile.ai[0] > 42f; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + projectile.localAI[0] = target.whoAmI; + } + + public override bool PreKill(int timeLeft) + { + Player player = Main.player[projectile.owner]; + + float numberOfDusts = 32f; + float rotFactor = 360f / numberOfDusts; + for (int i = 0; i < numberOfDusts; i++) + { + float rot = MathHelper.ToRadians(i * rotFactor); + Vector2 offset = new Vector2(15f, 0).RotatedBy(rot); + Vector2 velOffset = new Vector2(12.5f, 0).RotatedBy(rot); + int dust = Dust.NewDust(projectile.position + offset, projectile.width, projectile.height, 269, velOffset.X, velOffset.Y); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity = velOffset; + Main.dust[dust].scale = 2.5f; + } + + float distance = 168f; + + for (int k = 0; k < Main.maxNPCs; k++) + { + NPC npc = Main.npc[k]; + Vector2 vec = npc.Center - projectile.Center; + float distanceTo = (float)Math.Sqrt(vec.X * vec.X + vec.Y * vec.Y); + if (distanceTo < distance && npc.CanBeChasedBy(projectile, false) && k != projectile.localAI[0]) + { + float alldamage = projectile.damage * 0.5f; + double damage = npc.StrikeNPC((int)alldamage, projectile.knockBack, projectile.velocity.X > 0f ? 1 : -1, true); + player.addDPS((int)damage); + } + } + return false; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Texture2D texture = Main.projectileTexture[projectile.type]; + Rectangle sourceRectangle = new Rectangle(0, 0, texture.Width, texture.Height); + Vector2 origin = sourceRectangle.Size() / 2f; + + for (int i = 0; i < projectile.oldPos.Length; i++) + { + float rot = MathHelper.ToRadians(22.5f) * Math.Sign(projectile.velocity.X); + Vector2 drawPos = projectile.oldPos[i] - Main.screenPosition + origin + new Vector2(0f, projectile.gfxOffY); + Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - i) / (float)projectile.oldPos.Length); + spriteBatch.Draw(texture, drawPos, new Rectangle?(), color, projectile.rotation - (i * rot), origin, projectile.scale, spriteEffects, 0f); + } + return false; + } + } +} \ No newline at end of file diff --git a/Projectiles/Hybrid/PwnagehammerProjStealthStrike.png b/Projectiles/Hybrid/PwnagehammerProjStealthStrike.png new file mode 100644 index 0000000000..705864283e Binary files /dev/null and b/Projectiles/Hybrid/PwnagehammerProjStealthStrike.png differ diff --git a/Projectiles/Hybrid/TerraDiskProjectile.cs b/Projectiles/Hybrid/TerraDiskProjectile.cs index a1b023665f..1c1320a3ed 100644 --- a/Projectiles/Hybrid/TerraDiskProjectile.cs +++ b/Projectiles/Hybrid/TerraDiskProjectile.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Hybrid projectile.penetrate = -1; projectile.aiStyle = 3; projectile.timeLeft = 180; - aiType = 52; + aiType = ProjectileID.WoodenBoomerang; } public override void AI() diff --git a/Projectiles/Hybrid/TerraDiskProjectile2.cs b/Projectiles/Hybrid/TerraDiskProjectile2.cs index bb7c3c1d1a..7bcd55d058 100644 --- a/Projectiles/Hybrid/TerraDiskProjectile2.cs +++ b/Projectiles/Hybrid/TerraDiskProjectile2.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Hybrid projectile.penetrate = -1; projectile.aiStyle = 3; projectile.timeLeft = 60; - aiType = 52; + aiType = ProjectileID.WoodenBoomerang; } public override void AI() diff --git a/Projectiles/Magic/AcidicSaxBubble.cs b/Projectiles/Magic/AcidicSaxBubble.cs index cdb82843ab..3d1ae98cc3 100644 --- a/Projectiles/Magic/AcidicSaxBubble.cs +++ b/Projectiles/Magic/AcidicSaxBubble.cs @@ -109,12 +109,12 @@ namespace CalamityMod.Projectiles.Magic projectile.Kill(); } } - CalamityUtils.StickyProjAI(projectile, 15); + projectile.StickyProjAI(15); } public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - CalamityUtils.ModifyHitNPCSticky(projectile, 3, false); + projectile.ModifyHitNPCSticky(3, false); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) diff --git a/Projectiles/Magic/AstralachneaFang.cs b/Projectiles/Magic/AstralachneaFang.cs index 06f099f567..332e5899c2 100644 --- a/Projectiles/Magic/AstralachneaFang.cs +++ b/Projectiles/Magic/AstralachneaFang.cs @@ -8,62 +8,55 @@ using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { - public class AstralachneaFang : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fang"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public class AstralachneaFang : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fang"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.magic = true; - projectile.tileCollide = true; - projectile.timeLeft = 240; - } + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.magic = true; + projectile.tileCollide = true; + projectile.timeLeft = 240; + } - public override void AI() - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1f); - Main.dust[num469].noGravity = true; + public override void AI() + { + int astral = Dust.NewDust(projectile.position, projectile.width, projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1f); + Main.dust[astral].noGravity = true; - 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); - } + projectile.rotation = projectile.velocity.ToRotation(); CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 250f, 13f, 25f); - } + } - public override void Kill(int timeLeft) - { - Main.PlaySound(SoundID.Item10, projectile.position); - for (int k = 0; k < 3; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, ModContent.DustType(), 0f, 0f); + public override void Kill(int timeLeft) + { + Main.PlaySound(SoundID.Item10, projectile.position); + for (int k = 0; k < 3; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, ModContent.DustType(), 0f, 0f); Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, ModContent.DustType(), 0f, 0f); } - } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 180); - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 180); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + } } diff --git a/Projectiles/Magic/AtlantisSpear.png b/Projectiles/Magic/AtlantisSpear.png index 122a12fd18..626938fb51 100644 Binary files a/Projectiles/Magic/AtlantisSpear.png and b/Projectiles/Magic/AtlantisSpear.png differ diff --git a/Projectiles/Magic/AuroraAustralis.cs b/Projectiles/Magic/AuroraAustralis.cs index cd166051f1..38887a0bda 100644 --- a/Projectiles/Magic/AuroraAustralis.cs +++ b/Projectiles/Magic/AuroraAustralis.cs @@ -7,115 +7,105 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { public class AuroraAustralis : ModProjectile - { - private static float CosFrequency = 0.05f; - private static float CosAmplitude = 0.008f; + { + private static float CosFrequency = 0.05f; + private static float CosAmplitude = 0.008f; public int[] dustTypes = new int[] { ModContent.DustType(), ModContent.DustType() }; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aurora Australis"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aurora Australis"); + } - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.timeLeft = 300; - projectile.magic = true; + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.tileCollide = false; + projectile.timeLeft = 300; + projectile.magic = true; projectile.alpha = 255; - CosFrequency = 0.15f; - CosAmplitude = 0.06f; - } + CosFrequency = 0.15f; + CosAmplitude = 0.06f; + } - public override void AI() - { - // On-spawn effects - if (projectile.ai[0] == 0) - { - // Store the X and Y of the spawn velocity so it can be used for trig calculations - projectile.localAI[0] = projectile.velocity.X; - projectile.localAI[1] = projectile.velocity.Y; - } + public override void AI() + { + // On-spawn effects + if (projectile.ai[0] == 0) + { + // Store the X and Y of the spawn velocity so it can be used for trig calculations + projectile.localAI[0] = projectile.velocity.X; + projectile.localAI[1] = projectile.velocity.Y; + } - // Doesn't collide with tiles for the first 2 frames - projectile.tileCollide = projectile.ai[0] > 2f; + // Doesn't collide with tiles for the first 2 frames + projectile.tileCollide = projectile.ai[0] > 2f; - // Apply fancy cosine movement, then slight gravity, then cap velocity. - // Original velocity is reconstructed so that it can be used in the calculation - Vector2 originalVelocity = new Vector2(projectile.localAI[0], projectile.localAI[1]); - ApplyCosVelocity(originalVelocity); - float currentSpeed = projectile.velocity.Length(); - float maxSpeed = 1.4f * originalVelocity.Length(); - if (currentSpeed > maxSpeed) - projectile.velocity *= maxSpeed / currentSpeed; + // Apply fancy cosine movement, then slight gravity, then cap velocity. + // Original velocity is reconstructed so that it can be used in the calculation + Vector2 originalVelocity = new Vector2(projectile.localAI[0], projectile.localAI[1]); + ApplyCosVelocity(originalVelocity); + float currentSpeed = projectile.velocity.Length(); + float maxSpeed = 1.4f * originalVelocity.Length(); + if (currentSpeed > maxSpeed) + projectile.velocity *= maxSpeed / currentSpeed; - // spawn dust - if (Main.rand.NextBool(5)) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, Main.rand.Next(dustTypes), projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - int rainbow = Dust.NewDust(projectile.Center, projectile.width, projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); - Dust dust = Main.dust[rainbow]; - dust.velocity *= 0.1f; - dust.velocity += projectile.velocity * 0.2f; - dust.position.X = projectile.Center.X + 4f + Main.rand.Next(-2, 3); - dust.position.Y = projectile.Center.Y + Main.rand.Next(-2, 3); - dust.noGravity = true; + // spawn dust + if (Main.rand.NextBool(5)) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, Main.rand.Next(dustTypes), projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + int rainbow = Dust.NewDust(projectile.Center, projectile.width, projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + Dust dust = Main.dust[rainbow]; + dust.velocity *= 0.1f; + dust.velocity += projectile.velocity * 0.2f; + dust.position.X = projectile.Center.X + 4f + Main.rand.Next(-2, 3); + dust.position.Y = projectile.Center.Y + Main.rand.Next(-2, 3); + dust.noGravity = true; - if (projectile.timeLeft % 10 == 0 && Main.myPlayer == projectile.owner) //spawn stars every 10 ticks - { - if (Main.player[projectile.owner].ownedProjectileCounts[ModContent.ProjectileType()] < 30) - { + if (projectile.timeLeft % 10 == 0 && Main.myPlayer == projectile.owner) //spawn stars every 10 ticks + { + if (Main.player[projectile.owner].ownedProjectileCounts[ModContent.ProjectileType()] < 30) + { float dmgKBMult = Main.rand.NextFloat(0.25f, 0.75f); - float xStart = projectile.Center.X + projectile.velocity.X; - float yStart = projectile.Center.Y - Main.rand.Next(500, 800); - Vector2 startPos = new Vector2(xStart, yStart); - Vector2 velocity = projectile.Center - startPos; - velocity.X += (float)Main.rand.Next(-100, 101); - float travelDist = velocity.Length(); - float starSpeed = Main.rand.NextFloat(10f, 20f); - travelDist = starSpeed / travelDist; - velocity.X *= travelDist; - velocity.Y *= travelDist; - int star = Projectile.NewProjectile(startPos, velocity, ModContent.ProjectileType(), (int)(projectile.damage * dmgKBMult), projectile.knockBack * dmgKBMult, projectile.owner, 0f, 0f); - Main.projectile[star].timeLeft = 120; - } - } + Projectile star = CalamityUtils.ProjectileRain(projectile.Center, projectile.velocity.X, 100f, 500f, 800f, Main.rand.NextFloat(10f, 20f), ModContent.ProjectileType(), (int)(projectile.damage * dmgKBMult), projectile.knockBack * dmgKBMult, projectile.owner); + star.timeLeft = 120; + } + } - projectile.ai[0]++; - } + projectile.ai[0]++; + } - private void ApplyCosVelocity(Vector2 baseVelocity) - { - float radians = -(-MathHelper.PiOver2 + CosFrequency * projectile.ai[0]); - projectile.velocity += CosAmplitude * baseVelocity.RotatedBy(radians); - } + private void ApplyCosVelocity(Vector2 baseVelocity) + { + float radians = -(-MathHelper.PiOver2 + CosFrequency * projectile.ai[0]); + projectile.velocity += CosAmplitude * baseVelocity.RotatedBy(radians); + } - public override void Kill(int timeLeft) - { - for (int i = 0; i <= 5; i++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, Main.rand.Next(dustTypes), projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - } + public override void Kill(int timeLeft) + { + for (int i = 0; i <= 5; i++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, Main.rand.Next(dustTypes), projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 180); - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 180); + } - public override void OnHitPvp(Player target, int damage, bool crit) - { - target.AddBuff(ModContent.BuffType(), 180); - } - } + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 180); + } + } } diff --git a/Projectiles/Magic/BeamingBolt.cs b/Projectiles/Magic/BeamingBolt.cs index d73e0d7aaf..38ad3ba37f 100644 --- a/Projectiles/Magic/BeamingBolt.cs +++ b/Projectiles/Magic/BeamingBolt.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { @@ -14,10 +15,8 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; + projectile.width = projectile.height = 30; projectile.friendly = true; - projectile.alpha = 0; projectile.timeLeft = 120; projectile.penetrate = -1; projectile.magic = true; @@ -75,7 +74,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(projectile.damage * 0.75), projectile.knockBack, projectile.owner, projectile.ai[0], 0f); } } - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 105); + Main.PlaySound(SoundID.Item105, projectile.position); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Magic/BrimstoneTentacle.cs b/Projectiles/Magic/BrimstoneTentacle.cs index 80915bf57b..02c463fd8f 100644 --- a/Projectiles/Magic/BrimstoneTentacle.cs +++ b/Projectiles/Magic/BrimstoneTentacle.cs @@ -25,6 +25,7 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { + projectile.localAI[1]++; if (projectile.velocity.X != projectile.velocity.X) { if (Math.Abs(projectile.velocity.X) < 1f) @@ -53,7 +54,7 @@ namespace CalamityMod.Projectiles.Magic projectile.height = projectile.width; projectile.position.X = center10.X - (float)(projectile.width / 2); projectile.position.Y = center10.Y - (float)(projectile.height / 2); - if ((double)projectile.localAI[0] < 0.1) + if (projectile.localAI[0] < 0.1f) { projectile.localAI[0] += 0.01f; } @@ -74,7 +75,7 @@ namespace CalamityMod.Projectiles.Magic } projectile.ai[0] *= 1.05f; projectile.ai[1] *= 1.05f; - if (projectile.scale < 1f) + if (projectile.scale < 1f && projectile.localAI[1] > 5f) { int num897 = 0; while ((float)num897 < projectile.scale * 10f) diff --git a/Projectiles/Magic/Climax2.cs b/Projectiles/Magic/Climax2.cs index 721d7ddd32..1eedb8acfa 100644 --- a/Projectiles/Magic/Climax2.cs +++ b/Projectiles/Magic/Climax2.cs @@ -32,8 +32,8 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { timeElapsed += 0.02; - projectile.velocity.X = (float)(Math.Sin(timeElapsed * (double)(0.5f * projectile.ai[0])) * circleSize); - projectile.velocity.Y = (float)(Math.Cos(timeElapsed * (double)(0.5f * projectile.ai[0])) * circleSize); + projectile.velocity.X = (float)(Math.Sin(timeElapsed * (0.5f * projectile.ai[0])) * circleSize); + projectile.velocity.Y = (float)(Math.Cos(timeElapsed * (0.5f * projectile.ai[0])) * circleSize); circleSize += circleGrowth; if (projectile.velocity.X > 0f) @@ -56,14 +56,14 @@ namespace CalamityMod.Projectiles.Magic } } - CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 300f, 8f, 4f, 5, ModContent.ProjectileType()); + CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 300f, 8f, 4f, 2, ModContent.ProjectileType(), 1D, true); } public override Color? GetAlpha(Color lightColor) { if (projectile.timeLeft < 30) { - float num7 = (float)projectile.timeLeft / 30f; + float num7 = projectile.timeLeft / 30f; projectile.alpha = (int)(255f - 255f * num7); } return new Color(255 - projectile.alpha, 255 - projectile.alpha, 255 - projectile.alpha, 0); @@ -74,8 +74,10 @@ namespace CalamityMod.Projectiles.Magic Texture2D texture2D13 = Main.projectileTexture[projectile.type]; int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; 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); + 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(texture2D13.Width / 2f, num214 / 2f), projectile.scale, SpriteEffects.None, 0f); return false; } + + public override bool CanDamage() => false; } } diff --git a/Projectiles/Magic/ClimaxProj.cs b/Projectiles/Magic/ClimaxProj.cs index 24c196528a..fc81a69681 100644 --- a/Projectiles/Magic/ClimaxProj.cs +++ b/Projectiles/Magic/ClimaxProj.cs @@ -49,14 +49,15 @@ namespace CalamityMod.Projectiles.Magic } } - CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 400f, 8f, 4f, 5, ModContent.ProjectileType()); + if (projectile.timeLeft % 2 == projectile.ai[0]) + CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 400f, 8f, 4f, 2, ModContent.ProjectileType(), 1D, true); } public override Color? GetAlpha(Color lightColor) { if (projectile.timeLeft < 30) { - float num7 = (float)projectile.timeLeft / 30f; + float num7 = projectile.timeLeft / 30f; projectile.alpha = (int)(255f - 255f * num7); } return new Color(255 - projectile.alpha, 255 - projectile.alpha, 255 - projectile.alpha, 0); @@ -67,8 +68,10 @@ namespace CalamityMod.Projectiles.Magic Texture2D texture2D13 = Main.projectileTexture[projectile.type]; int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; 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); + 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(texture2D13.Width / 2f, num214 / 2f), projectile.scale, SpriteEffects.None, 0f); return false; } + + public override bool CanDamage() => false; } } diff --git a/Projectiles/Magic/CosmicTentacle.cs b/Projectiles/Magic/CosmicTentacle.cs index 450e3a9de4..3cd1698c27 100644 --- a/Projectiles/Magic/CosmicTentacle.cs +++ b/Projectiles/Magic/CosmicTentacle.cs @@ -25,6 +25,7 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { + projectile.localAI[1]++; if (projectile.velocity.X != projectile.velocity.X) { if (Math.Abs(projectile.velocity.X) < 1f) @@ -53,7 +54,7 @@ namespace CalamityMod.Projectiles.Magic projectile.height = projectile.width; projectile.position.X = center10.X - (float)(projectile.width / 2); projectile.position.Y = center10.Y - (float)(projectile.height / 2); - if ((double)projectile.localAI[0] < 0.1) + if (projectile.localAI[0] < 0.1f) { projectile.localAI[0] += 0.01f; } @@ -74,12 +75,12 @@ namespace CalamityMod.Projectiles.Magic } projectile.ai[0] *= 1.05f; projectile.ai[1] *= 1.05f; - if (projectile.scale < 1f) + if (projectile.scale < 1f && projectile.localAI[1] > 5f) { int num897 = 0; while ((float)num897 < projectile.scale * 10f) { - int num898 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 58, projectile.velocity.X, projectile.velocity.Y, 100, default, 1.1f); + int num898 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 62, projectile.velocity.X, projectile.velocity.Y, 100, default, 1.1f); Main.dust[num898].position = (Main.dust[num898].position + projectile.Center) / 2f; Main.dust[num898].noGravity = true; Main.dust[num898].velocity *= 0.1f; diff --git a/Projectiles/Magic/CryoBlast.cs b/Projectiles/Magic/CryoBlast.cs index 1c823439dc..57f618517b 100644 --- a/Projectiles/Magic/CryoBlast.cs +++ b/Projectiles/Magic/CryoBlast.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using System; using Terraria; using Terraria.ID; @@ -11,12 +12,14 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Blast"); + Main.projFrames[projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 16; - projectile.height = 32; + projectile.width = projectile.height = 35; projectile.friendly = true; projectile.magic = true; projectile.penetrate = 4; @@ -29,26 +32,50 @@ namespace CalamityMod.Projectiles.Magic if (projectile.scale <= 3.6f) { projectile.scale *= 1.01f; - projectile.width = (int)(16f * projectile.scale); - projectile.height = (int)(32f * projectile.scale); + projectile.position = projectile.Center; + projectile.width = (int)(35f * projectile.scale); + projectile.height = (int)(35f * projectile.scale); + projectile.Center = projectile.position; } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + + if (projectile.timeLeft < 53) + projectile.alpha += 5; + + projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); + projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); + + if (projectile.frameCounter++ % 4 == 3) + { + projectile.frame++; + } + if (projectile.frame >= Main.projFrames[projectile.type]) + { + projectile.frame = 0; + } + Lighting.AddLight(projectile.Center, 0.5f, 0.5f, 0.5f); + projectile.localAI[0] += 1f; if (projectile.localAI[0] > 4f) { - for (int num468 = 0; num468 < 3; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, 0f, 0f, 100, default, projectile.scale); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - int num470 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 185, 0f, 0f, 100, default, projectile.scale); - Main.dust[num470].noGravity = true; - Main.dust[num470].velocity *= 0f; - } + int ice = Dust.NewDust(projectile.position, projectile.width, projectile.height, 66, 0f, 0f, 100, default, projectile.scale * 0.5f); + Main.dust[ice].noGravity = true; + Main.dust[ice].velocity *= 0f; + int snow = Dust.NewDust(projectile.position, projectile.width, projectile.height, 185, 0f, 0f, 100, default, projectile.scale * 0.5f); + Main.dust[snow].noGravity = true; + Main.dust[snow].velocity *= 0f; } } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + if (projectile.timeLeft > 599) + return false; + + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + return false; + } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 360); diff --git a/Projectiles/Magic/CryoBlast.png b/Projectiles/Magic/CryoBlast.png index 4a5f92eb8f..0976534c78 100644 Binary files a/Projectiles/Magic/CryoBlast.png and b/Projectiles/Magic/CryoBlast.png differ diff --git a/Projectiles/Magic/DarkSparkBeam.cs b/Projectiles/Magic/DarkSparkBeam.cs index 123ee4eb20..2e634b91eb 100644 --- a/Projectiles/Magic/DarkSparkBeam.cs +++ b/Projectiles/Magic/DarkSparkBeam.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Magic projectile.alpha = 255; projectile.tileCollide = false; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + projectile.localNPCHitCooldown = 15; } public override void SendExtraAI(BinaryWriter writer) @@ -127,15 +127,15 @@ namespace CalamityMod.Projectiles.Magic projectile.position += value37; projectile.velocity = Vector2.Normalize(projectile2.velocity).RotatedBy((double)num811, default); projectile.scale = 1.5f * (1.5f - num812); - projectile.damage = projectile2.damage; - double damageMult = 1.0 + (double)(projectile2.ai[0] * 0.0015f); //1 to 2.0 (1400 * x) - if (damageMult > 2.0) + + // Takes 360 frames to reach normal damage + float amount = projectile2.ai[0] / 1200f; + if (amount > 1f) + amount = 1f; + projectile.damage = (int)(projectile2.damage * MathHelper.Lerp(0.25f, 2.2f, amount)); + + if (projectile2.ai[0] >= 720f) { - damageMult = 2.0; - } - if (projectile2.ai[0] >= 720f) - { - projectile.damage = (int)((double)projectile.damage * damageMult); vector71 = new Vector2?(projectile2.Center); } if (!Collision.CanHitLine(Main.player[projectile.owner].Center, 0, 0, projectile2.Center, 0, 0)) @@ -164,8 +164,8 @@ namespace CalamityMod.Projectiles.Magic num821 += array3[num822]; } num821 /= num819; - float amount = 0.75f; - projectile.localAI[1] = MathHelper.Lerp(projectile.localAI[1], num821, amount); + float amount2 = 0.75f; + projectile.localAI[1] = MathHelper.Lerp(projectile.localAI[1], num821, amount2); if (Math.Abs(projectile.localAI[1] - num821) < 100f && projectile.scale > 0.15f) { //color.A = 0; diff --git a/Projectiles/Magic/EnormousConsumingVortex.cs b/Projectiles/Magic/EnormousConsumingVortex.cs index 12665a5124..6abcb381e3 100644 --- a/Projectiles/Magic/EnormousConsumingVortex.cs +++ b/Projectiles/Magic/EnormousConsumingVortex.cs @@ -71,7 +71,7 @@ namespace CalamityMod.Projectiles.Magic if (Time < 300) { TargetingMovement(); - if (Time % TentacleSpawnRate == TentacleSpawnRate - 1 && Main.netMode != NetmodeID.MultiplayerClient) + if (Time % TentacleSpawnRate == TentacleSpawnRate - 1 && Main.myPlayer == projectile.owner) { ProduceSubsumingHentai(); } @@ -110,7 +110,7 @@ namespace CalamityMod.Projectiles.Magic public void TargetingMovement() { - NPC potentialTarget = projectile.Center.ClosestNPCAt(1500f, true); + NPC potentialTarget = projectile.Center.ClosestNPCAt(1500f, true, true); if (potentialTarget != null) { projectile.velocity = (projectile.velocity * 5f + projectile.DirectionTo(potentialTarget.Center) * 7f) / 6f; @@ -151,9 +151,9 @@ namespace CalamityMod.Projectiles.Magic dust.noGravity = true; } } - if (Main.netMode != NetmodeID.MultiplayerClient) + if (Main.myPlayer == projectile.owner) { - NPC closestTarget = projectile.Center.ClosestNPCAt(1600f, true); + NPC closestTarget = projectile.Center.ClosestNPCAt(1600f, true, true); for (int i = 0; i < 12; i++) { float rotation = Main.rand.NextFloat(MathHelper.TwoPi); diff --git a/Projectiles/Magic/EternityBook.cs b/Projectiles/Magic/EternityBook.cs index d1ded915c0..571189b2b5 100644 --- a/Projectiles/Magic/EternityBook.cs +++ b/Projectiles/Magic/EternityBook.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Magic projectile.ai[0]++; if (projectile.ai[0] == 1f) { - NPC target = projectile.Center.ClosestNPCAt(4400f, true); + NPC target = Main.MouseWorld.ClosestNPCAt(4400f, true, true); if (target != null) { diff --git a/Projectiles/Magic/EternityHex.cs b/Projectiles/Magic/EternityHex.cs index 63e7f91b3d..fc60339ed0 100644 --- a/Projectiles/Magic/EternityHex.cs +++ b/Projectiles/Magic/EternityHex.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Projectiles.Magic if (!target.active) { - NPC potentialNPC = projectile.Center.ClosestNPCAt(4400f, true); + NPC potentialNPC = projectile.Center.ClosestNPCAt(4400f, true, true); if (potentialNPC != null) { projectile.ai[0] = potentialNPC.whoAmI; diff --git a/Projectiles/Magic/EventHorizonBlackhole.cs b/Projectiles/Magic/EventHorizonBlackhole.cs index 1aa100d4de..75c6ed0500 100644 --- a/Projectiles/Magic/EventHorizonBlackhole.cs +++ b/Projectiles/Magic/EventHorizonBlackhole.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Magic projectile.magic = true; projectile.tileCollide = false; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; + projectile.localNPCHitCooldown = 8; } public override void AI() @@ -45,7 +45,7 @@ namespace CalamityMod.Projectiles.Magic } else { - if (projectile.frame == 0 || projectile.frame == 1 || projectile.frame == 2 || projectile.frame == 3) + if (projectile.frame < 4) projectile.frame = 4; if (projectile.frame >= 8) projectile.frame = 4; diff --git a/Projectiles/Magic/EventHorizonStar.cs b/Projectiles/Magic/EventHorizonStar.cs index 45a8c88f6d..1b6fa190c2 100644 --- a/Projectiles/Magic/EventHorizonStar.cs +++ b/Projectiles/Magic/EventHorizonStar.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Magic projectile.penetrate = 1; projectile.magic = true; projectile.tileCollide = false; - projectile.timeLeft = 600; + projectile.timeLeft = 300; projectile.alpha = 180; } @@ -124,7 +124,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(BuffID.Daybreak, 300); - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(projectile.damage * 0.5f), projectile.knockBack * 0.5f, projectile.owner, 0f, 0f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Magic/FabBolt.cs b/Projectiles/Magic/FabBolt.cs index cfbd639b34..8139dc9f72 100644 --- a/Projectiles/Magic/FabBolt.cs +++ b/Projectiles/Magic/FabBolt.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Projectiles.Magic projectile.height = 4; projectile.extraUpdates = 100; projectile.friendly = true; - projectile.timeLeft = 90; + projectile.timeLeft = 45; projectile.magic = true; } @@ -30,7 +30,7 @@ namespace CalamityMod.Projectiles.Magic Main.dust[num448].position = vector33; Main.dust[num448].noGravity = true; Main.dust[num448].noLight = true; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; + Main.dust[num448].scale = Main.rand.Next(70, 110) * 0.013f; Main.dust[num448].velocity *= 0.1f; } } diff --git a/Projectiles/Magic/FabOrb.cs b/Projectiles/Magic/FabOrb.cs index 7ffb1f294b..140dacc724 100644 --- a/Projectiles/Magic/FabOrb.cs +++ b/Projectiles/Magic/FabOrb.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Projectiles.Magic projectile.friendly = true; projectile.alpha = 255; projectile.penetrate = -1; - projectile.timeLeft = 300; + projectile.timeLeft = 30; projectile.magic = true; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 10; @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 300f, 6f, 24f, 5, ModContent.ProjectileType()); + CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 150f, 6f, 6f, 2, ModContent.ProjectileType(), 1D, true); } } } diff --git a/Projectiles/Magic/FabRay.cs b/Projectiles/Magic/FabRay.cs index 55c9ed27ad..106332c811 100644 --- a/Projectiles/Magic/FabRay.cs +++ b/Projectiles/Magic/FabRay.cs @@ -12,8 +12,8 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; + projectile.width = 4; + projectile.height = 4; projectile.friendly = true; projectile.magic = true; projectile.penetrate = 20; @@ -26,27 +26,21 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { Lighting.AddLight(projectile.Center, 0.2f, 0.01f, 0.1f); - projectile.localAI[1] += 1f; - if (projectile.localAI[1] >= 9f && projectile.owner == Main.myPlayer) + projectile.ai[0] += 1f; + if (projectile.ai[0] % 6f == 0f && projectile.owner == Main.myPlayer) { - projectile.localAI[1] = 0f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 16f) + if (projectile.ai[0] > 16f && projectile.ai[0] % 2f == 0f) { - for (int num447 = 0; num447 < 2; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - int num448 = Dust.NewDust(vector33, 1, 1, 234, 0f, 0f, 0, default, 1.25f); - Main.dust[num448].noGravity = true; - Main.dust[num448].noLight = true; - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.1f; - } + Vector2 source = projectile.position; + int pink = Dust.NewDust(source, 1, 1, 234, 0f, 0f, 0, default, 1.25f); + Main.dust[pink].noGravity = true; + Main.dust[pink].noLight = true; + Main.dust[pink].position = source; + Main.dust[pink].scale = Main.rand.Next(70, 110) * 0.013f; + Main.dust[pink].velocity *= 0.1f; } } @@ -59,7 +53,6 @@ namespace CalamityMod.Projectiles.Magic } else { - projectile.ai[0] += 0.1f; if (projectile.velocity.X != oldVelocity.X) { projectile.velocity.X = -oldVelocity.X; diff --git a/Projectiles/Magic/FabRay.png b/Projectiles/Magic/FabRay.png index 0056fc1e24..15e8775737 100644 Binary files a/Projectiles/Magic/FabRay.png and b/Projectiles/Magic/FabRay.png differ diff --git a/Projectiles/Magic/ForbiddenSunProjectile.cs b/Projectiles/Magic/ForbiddenSunProjectile.cs index cbb7db1bf6..e770146004 100644 --- a/Projectiles/Magic/ForbiddenSunProjectile.cs +++ b/Projectiles/Magic/ForbiddenSunProjectile.cs @@ -25,12 +25,10 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); - projectile.frameCounter++; - if (projectile.frameCounter > 4) + projectile.rotation = projectile.velocity.ToRotation(); + if (projectile.frameCounter++ % 4 == 0) { projectile.frame++; - projectile.frameCounter = 0; } if (projectile.frame >= Main.projFrames[projectile.type]) { diff --git a/Projectiles/Magic/GranitePulse.cs b/Projectiles/Magic/GranitePulse.cs index 7aaecbf6db..6ca7cb8d9a 100644 --- a/Projectiles/Magic/GranitePulse.cs +++ b/Projectiles/Magic/GranitePulse.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Projectiles.Magic { public class GranitePulse : ModProjectile { - public float count = 0f; + public bool initialized = false; public override void SetStaticDefaults() { @@ -30,7 +30,7 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - projectile.velocity = new Vector2(0f, (float)Math.Sin((double)(6.28318548f * projectile.ai[0] / 300f)) * 0.5f); + projectile.velocity = new Vector2(0f, (float)Math.Sin((double)(MathHelper.TwoPi * projectile.ai[0] / 300f)) * 0.5f); projectile.ai[0] += 1f; if (projectile.ai[0] >= 300f) { @@ -62,84 +62,75 @@ namespace CalamityMod.Projectiles.Magic if (projectile.localAI[0] >= 10f) { projectile.localAI[0] = 0f; - int num416 = 0; - int num417 = 0; - float num418 = 0f; - int num419 = projectile.type; - for (int num420 = 0; num420 < Main.maxProjectiles; num420++) + int projCount = 0; + int index = 0; + float findOldest = 0f; + int projType = projectile.type; + for (int i = 0; i < Main.maxProjectiles; i++) { - if (Main.projectile[num420].active && Main.projectile[num420].owner == projectile.owner && Main.projectile[num420].type == num419 && Main.projectile[num420].ai[1] < 3600f) + Projectile proj = Main.projectile[i]; + if (proj.active && proj.owner == projectile.owner && proj.type == projType && proj.ai[1] < 3600f) { - num416++; - if (Main.projectile[num420].ai[1] > num418) + projCount++; + if (proj.ai[1] > findOldest) { - num417 = num420; - num418 = Main.projectile[num420].ai[1]; + index = i; + findOldest = proj.ai[1]; } } } - if (num416 > 1) + if (projCount > 1) { - Main.projectile[num417].netUpdate = true; - Main.projectile[num417].ai[1] = 36000f; + Main.projectile[index].netUpdate = true; + Main.projectile[index].ai[1] = 36000f; return; } } - if (count == 0f) + if (!initialized) { - Main.PlaySound(SoundID.NPCHit53, projectile.position); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 20; - projectile.height = 20; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num621 = 0; num621 < 5; num621++) + Main.PlaySound(SoundID.NPCHit53, projectile.Center); + CalamityGlobalProjectile.ExpandHitboxBy(projectile, 20); + for (int d = 0; d < 5; d++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 229, 0f, 0f, 100, default, 0.5f); - Main.dust[num622].velocity *= 3f; + int ecto = Dust.NewDust(projectile.position, projectile.width, projectile.height, 229, 0f, 0f, 100, default, 0.5f); + Main.dust[ecto].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; + Main.dust[ecto].scale = 0.5f; + Main.dust[ecto].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 10; num623++) + for (int d = 0; d < 10; d++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 206, 0f, 0f, 100, default, 1f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 206, 0f, 0f, 100, default, 0.5f); - Main.dust[num624].velocity *= 2f; + int ecto = Dust.NewDust(projectile.position, projectile.width, projectile.height, 206, 0f, 0f, 100, default, 1f); + Main.dust[ecto].noGravity = true; + Main.dust[ecto].velocity *= 5f; + ecto = Dust.NewDust(projectile.position, projectile.width, projectile.height, 206, 0f, 0f, 100, default, 0.5f); + Main.dust[ecto].velocity *= 2f; } - count += 1f; + initialized = true; } - if (projectile.timeLeft % 50 == 49) + if (projectile.timeLeft % 50 == 1 && projectile.alpha <= 0) { - Main.PlaySound(SoundID.NPCHit53, projectile.position); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 20; - projectile.height = 20; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num621 = 0; num621 < 5; num621++) + Main.PlaySound(SoundID.NPCHit53, projectile.Center); + CalamityGlobalProjectile.ExpandHitboxBy(projectile, 20); + for (int d = 0; d < 5; d++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 229, 0f, 0f, 100, default, 0.5f); - Main.dust[num622].velocity *= 3f; + int ecto = Dust.NewDust(projectile.position, projectile.width, projectile.height, 229, 0f, 0f, 100, default, 0.5f); + Main.dust[ecto].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; + Main.dust[ecto].scale = 0.5f; + Main.dust[ecto].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 10; num623++) + for (int d = 0; d < 10; d++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 206, 0f, 0f, 100, default, 1f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 206, 0f, 0f, 100, default, 0.5f); - Main.dust[num624].velocity *= 2f; + int ecto = Dust.NewDust(projectile.position, projectile.width, projectile.height, 206, 0f, 0f, 100, default, 1f); + Main.dust[ecto].noGravity = true; + Main.dust[ecto].velocity *= 5f; + ecto = Dust.NewDust(projectile.position, projectile.width, projectile.height, 206, 0f, 0f, 100, default, 0.5f); + Main.dust[ecto].velocity *= 2f; } float spread = 45f * 0.0174f; double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; @@ -165,8 +156,10 @@ namespace CalamityMod.Projectiles.Magic 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); + 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(texture.Width / 2f, height / 2f), projectile.scale, spriteEffects, 0f); return false; } + + public override bool CanDamage() => false; } } diff --git a/Projectiles/Magic/IceBarrageMain.cs b/Projectiles/Magic/IceBarrageMain.cs index c8b926209a..016ab4e72c 100644 --- a/Projectiles/Magic/IceBarrageMain.cs +++ b/Projectiles/Magic/IceBarrageMain.cs @@ -32,58 +32,37 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - float maxDistance = 500f; - bool bossFound = false; - - for (int i = 0; i < Main.maxNPCs; i++) - { - NPC npc = Main.npc[i]; - if (!npc.active || npc.type == NPCID.TargetDummy) - continue; - - // If we've found a valid boss target, ignore ALL targets which aren't bosses. - if (bossFound && !npc.boss) - continue; - - if (npc.CanBeChasedBy(projectile, false)) - { - float extraDistance = (float)(npc.width / 2) + (float)(npc.height / 2); - - if (Vector2.Distance(npc.Center, projectile.Center) < (maxDistance + extraDistance)) - { - if (npc.boss) - bossFound = true; - projectile.Center = npc.Center; - break; - } - } - } + NPC closestTarget = projectile.Center.ClosestNPCAt(500f, true, true); + if (closestTarget != null) + { + projectile.Center = closestTarget.Center; + } projectile.ai[0]++; projectile.ai[1]++; for (int j = 0; j < 3; j++) { - int num297 = Main.rand.NextBool(2) ? 68 : 67; + int dustType = Main.rand.NextBool(2) ? 68 : 67; if (Main.rand.NextBool(4)) { - num297 = 80; + dustType = 80; } if (projectile.ai[0] < 140f) { Vector2 direction = new Vector2(Main.rand.NextFloat(-4f, 4f), Main.rand.NextFloat(-4f, 4f)); - int dust = Dust.NewDust(projectile.Center, 1, 1, num297, direction.X, direction.Y, 50, default, 1.3f); + int dust = Dust.NewDust(projectile.Center, 1, 1, dustType, direction.X, direction.Y, 50, default, 1.3f); Main.dust[dust].noGravity = true; } else { int direct = Main.rand.NextBool(2) ? 1 : -1; Vector2 dir1 = new Vector2(0f, 10f) * direct; - int dust1 = Dust.NewDust(projectile.position, projectile.width, projectile.height, num297, dir1.X, dir1.Y, 50, default, 1.3f); + int dust1 = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, dir1.X, dir1.Y, 50, default, 1.3f); Main.dust[dust1].noGravity = true; Main.dust[dust1].velocity = dir1; int direct2 = Main.rand.NextBool(2) ? 1 : -1; Vector2 dir2 = new Vector2(10f, 0f) * direct2; - int dust2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, num297, dir2.X, dir2.Y, 50, default, 1.3f); + int dust2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, dir2.X, dir2.Y, 50, default, 1.3f); Main.dust[dust2].noGravity = true; Main.dust[dust2].velocity = dir2; } diff --git a/Projectiles/Magic/InfernalBlade.cs b/Projectiles/Magic/InfernalBlade.cs index a7fd668903..da9fd69275 100644 --- a/Projectiles/Magic/InfernalBlade.cs +++ b/Projectiles/Magic/InfernalBlade.cs @@ -59,24 +59,21 @@ namespace CalamityMod.Projectiles.Magic { Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); Main.PlaySound(SoundID.Item10, projectile.position); - int num487 = Main.rand.Next(4, 10); - for (int num488 = 0; num488 < num487; num488++) + int dustAmt = Main.rand.Next(4, 10); + for (int d = 0; d < dustAmt; d++) { - int num489 = Dust.NewDust(projectile.Center, 0, 0, 182, 0f, 0f, 100, default, 1f); - Main.dust[num489].velocity *= 1.6f; - Dust expr_FEDF_cp_0 = Main.dust[num489]; - expr_FEDF_cp_0.velocity.Y -= 1f; - Main.dust[num489].velocity += -projectile.velocity * (Main.rand.NextFloat() * 2f - 1f) * 0.5f; - Main.dust[num489].scale = 2f; - Main.dust[num489].fadeIn = 0.5f; - Main.dust[num489].noGravity = true; + int fire = Dust.NewDust(projectile.Center, 0, 0, 182, 0f, 0f, 100, default, 1f); + Dust dust = Main.dust[fire]; + dust.velocity *= 1.6f; + dust.velocity.Y -= 1f; + dust.velocity += -projectile.velocity * (Main.rand.NextFloat() * 2f - 1f) * 0.5f; + dust.scale = 2f; + dust.fadeIn = 0.5f; + dust.noGravity = true; } } - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, 50, 50, 0); - } + public override Color? GetAlpha(Color lightColor) => new Color(255, 50, 50, 0); public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { @@ -119,37 +116,22 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - float xPos = projectile.ai[0] > 0 ? projectile.position.X + 800 : projectile.position.X - 800; - Vector2 vector2 = new Vector2(xPos, projectile.position.Y + Main.rand.Next(-800, 801)); - - float num80 = xPos; - float speedX = (float)target.position.X - vector2.X; - float speedY = (float)target.position.Y - vector2.Y; - float dir = (float)Math.Sqrt((double)(speedX * speedX + speedY * speedY)); - dir = 10 / num80; - speedX *= dir * 150; - speedY *= dir * 150; - if (speedX > 15f) - { - speedX = 15f; - } - if (speedX < -15f) - { - speedX = -15f; - } - if (speedY > 15f) - { - speedY = 15f; - } - if (speedY < -15f) - { - speedY = -15f; - } - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(vector2.X, vector2.Y, speedX, speedY, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.75), 1f, projectile.owner); - } + OnHitEffects(target.Center); target.AddBuff(ModContent.BuffType(), 240); } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + OnHitEffects(target.Center); + target.AddBuff(ModContent.BuffType(), 240); + } + + private void OnHitEffects(Vector2 targetPos) + { + if (projectile.owner == Main.myPlayer) + { + CalamityUtils.ProjectileBarrage(projectile.Center, targetPos, Main.rand.NextBool(), 800f, 800f, 0f, 800f, 10f, ModContent.ProjectileType(), (int)(projectile.damage * 0.75), 1f, projectile.owner, true); + } + } } } diff --git a/Projectiles/Magic/LightBead.cs b/Projectiles/Magic/LightBead.cs index 237effaa0b..19dc99e163 100644 --- a/Projectiles/Magic/LightBead.cs +++ b/Projectiles/Magic/LightBead.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Magic projectile.ai[1] += 1f; if (Main.rand.NextBool(3)) { - int num300 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 0, default, 1f); + int num300 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 0, default, 1f); Main.dust[num300].noGravity = true; Main.dust[num300].velocity *= 0.5f; Main.dust[num300].scale *= 0.9f; @@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Magic if (projectile.ai[1] > 300f) { projectile.scale -= 0.05f; - if ((double)projectile.scale <= 0.2) + if (projectile.scale <= 0.2f) { projectile.scale = 0.2f; projectile.Kill(); @@ -58,19 +58,13 @@ namespace CalamityMod.Projectiles.Magic { Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 244, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); } - int num251 = Main.rand.Next(2, 3); + int beadAmt = Main.rand.Next(2, 3); if (projectile.owner == Main.myPlayer) { - for (int num252 = 0; num252 < num251; num252++) + for (int b = 0; b < beadAmt; b++) { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), value15.X, value15.Y, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.5), 0f, projectile.owner, 0f, 0f); + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); + Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.5), 0f, projectile.owner, 0f, 0f); } } } diff --git a/Projectiles/Magic/LiquidBlade.cs b/Projectiles/Magic/LiquidBlade.cs index 0e2c572a75..bcc8f79caa 100644 --- a/Projectiles/Magic/LiquidBlade.cs +++ b/Projectiles/Magic/LiquidBlade.cs @@ -120,39 +120,28 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - float xPos = projectile.ai[0] > 0 ? projectile.position.X + 800 : projectile.position.X - 800; - Vector2 vector2 = new Vector2(xPos, projectile.position.Y + Main.rand.Next(-800, 801)); - float num80 = xPos; - float speedX = (float)target.position.X - vector2.X; - float speedY = (float)target.position.Y - vector2.Y; - float dir = (float)Math.Sqrt((double)(speedX * speedX + speedY * speedY)); - dir = 10 / num80; - speedX *= dir * 150; - speedY *= dir * 150; - if (speedX > 15f) - { - speedX = 15f; - } - if (speedX < -15f) - { - speedX = -15f; - } - if (speedY > 15f) - { - speedY = 15f; - } - if (speedY < -15f) - { - speedY = -15f; - } - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(vector2.X, vector2.Y, speedX, speedY, ModContent.ProjectileType(), (int)(projectile.damage * 0.75), 1f, projectile.owner); - } - target.AddBuff(BuffID.Ichor, 200); - target.AddBuff(BuffID.Frostburn, 200); - target.AddBuff(BuffID.OnFire, 200); - target.AddBuff(BuffID.CursedInferno, 100); + OnHitEffects(target.Center); + target.AddBuff(BuffID.Ichor, 240); + target.AddBuff(BuffID.Frostburn, 240); + target.AddBuff(BuffID.OnFire, 240); + target.AddBuff(BuffID.CursedInferno, 120); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + OnHitEffects(target.Center); + target.AddBuff(BuffID.Ichor, 240); + target.AddBuff(BuffID.Frostburn, 240); + target.AddBuff(BuffID.OnFire, 240); + target.AddBuff(BuffID.CursedInferno, 120); + } + + private void OnHitEffects(Vector2 targetPos) + { + if (projectile.owner == Main.myPlayer) + { + CalamityUtils.ProjectileBarrage(projectile.Center, targetPos, Main.rand.NextBool(), 800f, 800f, 0f, 800f, 10f, ModContent.ProjectileType(), (int)(projectile.damage * 0.75), 1f, projectile.owner, true); + } } } } diff --git a/Projectiles/Magic/LiquidBlade2.cs b/Projectiles/Magic/LiquidBlade2.cs index 613abf79c2..a3e7f5672c 100644 --- a/Projectiles/Magic/LiquidBlade2.cs +++ b/Projectiles/Magic/LiquidBlade2.cs @@ -119,10 +119,10 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.Ichor, 200); - target.AddBuff(BuffID.Frostburn, 200); - target.AddBuff(BuffID.OnFire, 200); - target.AddBuff(BuffID.CursedInferno, 100); + target.AddBuff(BuffID.Ichor, 240); + target.AddBuff(BuffID.Frostburn, 240); + target.AddBuff(BuffID.OnFire, 240); + target.AddBuff(BuffID.CursedInferno, 120); } } } diff --git a/Projectiles/Magic/MadAlchemistsCocktailGasCloud.cs b/Projectiles/Magic/MadAlchemistsCocktailGasCloud.cs index d4d16ef5e5..7e75163b43 100644 --- a/Projectiles/Magic/MadAlchemistsCocktailGasCloud.cs +++ b/Projectiles/Magic/MadAlchemistsCocktailGasCloud.cs @@ -39,37 +39,40 @@ namespace CalamityMod.Projectiles.Magic projectile.rotation += projectile.velocity.X * 0.1f; projectile.rotation += (float)projectile.direction * 0.003f; projectile.velocity *= 0.96f; - Rectangle rectangle5 = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); - int num3; - for (int num894 = 0; num894 < 1000; num894 = num3 + 1) + + Rectangle cloudHitbox = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); + for (int i = 0; i < Main.maxProjectiles; i++) { - if (num894 != projectile.whoAmI && Main.projectile[num894].active) + Projectile otherProj = Main.projectile[i]; + // Short circuits to make the loop as fast as possible + if (!otherProj.active || otherProj.owner != projectile.owner || !otherProj.minion || i == projectile.whoAmI) + continue; + + if (otherProj.type == projectile.type) { - Rectangle value43 = new Rectangle((int)Main.projectile[num894].position.X, (int)Main.projectile[num894].position.Y, Main.projectile[num894].width, Main.projectile[num894].height); - if (rectangle5.Intersects(value43)) + Rectangle otherProjHitbox = new Rectangle((int)otherProj.position.X, (int)otherProj.position.Y, otherProj.width, otherProj.height); + if (cloudHitbox.Intersects(otherProjHitbox)) { - Vector2 vector105 = Main.projectile[num894].Center - projectile.Center; - if (vector105.X == 0f && vector105.Y == 0f) + Vector2 projDistance = otherProj.Center - projectile.Center; + if (projDistance.X == 0f && projDistance.Y == 0f) { - if (num894 < projectile.whoAmI) + if (i < projectile.whoAmI) { - vector105.X = -1f; - vector105.Y = 1f; + projDistance.X = -1f; + projDistance.Y = 1f; } else { - vector105.X = 1f; - vector105.Y = -1f; + projDistance.X = 1f; + projDistance.Y = -1f; } } - vector105.Normalize(); - vector105 *= 0.005f; - projectile.velocity -= vector105; - Projectile projectile2 = Main.projectile[num894]; - projectile2.velocity += vector105; + projDistance.Normalize(); + projDistance *= 0.005f; + projectile.velocity -= projDistance; + otherProj.velocity += projDistance; } } - num3 = num894; } } } diff --git a/Projectiles/Magic/MagicNebulaShot.cs b/Projectiles/Magic/MagicNebulaShot.cs index 43293cf1d2..1c8431dcac 100644 --- a/Projectiles/Magic/MagicNebulaShot.cs +++ b/Projectiles/Magic/MagicNebulaShot.cs @@ -1,64 +1,62 @@ +using CalamityMod.Projectiles.BaseProjectiles; 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 MagicNebulaShot : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Shot"); - } + public class MagicNebulaShot : BaseLaserbeamProjectile + { + private Color startingColor = new Color(119, 210, 255); + private Color secondColor = new Color(247, 119, 255); + public override float MaxScale => 0.7f; + public override float MaxLaserLength => 1599.999999f; + public override float Lifetime => 20f; + public override Color LaserOverlayColor => CalamityUtils.ColorSwap(startingColor, secondColor, 0.9f); + public override Color LightCastColor => LaserOverlayColor; + public override Texture2D LaserBeginTexture => ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/UltimaRayStart"); + public override Texture2D LaserMiddleTexture => ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/UltimaRayMid"); + public override Texture2D LaserEndTexture => ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/UltimaRayEnd"); - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.magic = true; - projectile.tileCollide = false; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.extraUpdates = 5; - projectile.timeLeft = 200; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 2; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Nebula Shot"); + } - public override void AI() - { - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - Main.PlaySound(SoundID.Item12, projectile.position); - } - if (projectile.alpha > 0) - { - projectile.alpha -= 15; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - Lighting.AddLight(projectile.Center, 0.4f, 0.2f, 0.4f); - for (int num121 = 0; num121 < 5; num121++) - { - Dust dust4 = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, Main.rand.NextBool(3) ? 56 : 242, projectile.velocity.X, projectile.velocity.Y, 100, default, 1f)]; - dust4.velocity = Vector2.Zero; - dust4.position -= projectile.velocity / 5f * (float)num121; - dust4.noGravity = true; - dust4.scale = 0.8f; - dust4.noLight = true; - } - } + public override void SetDefaults() + { + projectile.width = projectile.height = 22; + projectile.friendly = true; + projectile.magic = true; + projectile.penetrate = -1; + projectile.alpha = 255; + projectile.localNPCHitCooldown = 2; + projectile.usesLocalNPCImmunity = true; + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 600); - target.AddBuff(BuffID.Frostburn, 600); - } - } + public override bool PreAI() + { + // Initialization. Using the AI hook would override the base laser's code, and we don't want that. + if (projectile.localAI[0] == 0f) + { + if (Main.rand.NextBool()) + { + secondColor = new Color(119, 210, 255); + startingColor = new Color(247, 119, 255); + } + } + return true; + } + + public override bool ShouldUpdatePosition() => false; + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 600); + target.AddBuff(BuffID.Frostburn, 600); + } + } } diff --git a/Projectiles/Magic/MagneticOrb.cs b/Projectiles/Magic/MagneticOrb.cs index 799b640ce6..86f9056fe1 100644 --- a/Projectiles/Magic/MagneticOrb.cs +++ b/Projectiles/Magic/MagneticOrb.cs @@ -49,7 +49,7 @@ namespace CalamityMod.Projectiles.Magic } } - CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 400f, 8f, 4f, 5, ModContent.ProjectileType()); + CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 400f, 8f, 4f, 2, ModContent.ProjectileType(), 1D, true); } public override Color? GetAlpha(Color lightColor) @@ -70,5 +70,7 @@ namespace CalamityMod.Projectiles.Magic 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 bool CanDamage() => false; } } diff --git a/Projectiles/Magic/MagnusBeam.cs b/Projectiles/Magic/MagnusBeam.cs index d3a4e48a0d..91a963a290 100644 --- a/Projectiles/Magic/MagnusBeam.cs +++ b/Projectiles/Magic/MagnusBeam.cs @@ -23,6 +23,7 @@ namespace CalamityMod.Projectiles.Magic projectile.penetrate = 1; projectile.extraUpdates = 2; projectile.alpha = 0; + projectile.magic = true; } public override void AI() diff --git a/Projectiles/Magic/ShiftingSandsProj.cs b/Projectiles/Magic/ShiftingSandsProj.cs index 9e729a55f0..2b842424c7 100644 --- a/Projectiles/Magic/ShiftingSandsProj.cs +++ b/Projectiles/Magic/ShiftingSandsProj.cs @@ -7,158 +7,158 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { - public class ShiftingSandsProj : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Shifting Sands"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public class ShiftingSandsProj : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shifting Sands"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 18; - projectile.height = 18; - projectile.friendly = true; - projectile.penetrate = 5; - projectile.magic = true; + public override void SetDefaults() + { + projectile.width = 18; + projectile.height = 18; + projectile.friendly = true; + projectile.penetrate = 5; + projectile.magic = true; projectile.extraUpdates = 2; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - } + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + } - public override void AI() - { - if (projectile.soundDelay == 0 && Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) > 2f) - { - projectile.soundDelay = 10; - Main.PlaySound(SoundID.Item20, projectile.position); - } - int num114 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 85, 0f, 0f, 100, default, 2f); - Dust dust = Main.dust[num114]; - dust.velocity *= 0.3f; - Main.dust[num114].position.X = projectile.position.X + (float)(projectile.width / 2) + 4f + (float)Main.rand.Next(-4, 5); - Main.dust[num114].position.Y = projectile.position.Y + (float)(projectile.height / 2) + (float)Main.rand.Next(-4, 5); - Main.dust[num114].noGravity = true; - if (Main.myPlayer == projectile.owner && projectile.ai[0] <= 0f) - { - if (Main.player[projectile.owner].channel) - { - float num115 = 18f; - Vector2 vector10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num116 = (float)Main.mouseX + Main.screenPosition.X - vector10.X; - float num117 = (float)Main.mouseY + Main.screenPosition.Y - vector10.Y; - if (Main.player[projectile.owner].gravDir == -1f) - { - num117 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector10.Y; - } - float num118 = (float)Math.Sqrt((double)(num116 * num116 + num117 * num117)); - num118 = (float)Math.Sqrt((double)(num116 * num116 + num117 * num117)); - if (projectile.ai[0] < 0f) - { - projectile.ai[0] += 1f; - } - if (num118 > num115) - { - num118 = num115 / num118; - num116 *= num118; - num117 *= num118; - int num119 = (int)(num116 * 1000f); - int num120 = (int)(projectile.velocity.X * 1000f); - int num121 = (int)(num117 * 1000f); - int num122 = (int)(projectile.velocity.Y * 1000f); - if (num119 != num120 || num121 != num122) - { - projectile.netUpdate = true; - } - projectile.velocity.X = num116; - projectile.velocity.Y = num117; - } - else - { - int num123 = (int)(num116 * 1000f); - int num124 = (int)(projectile.velocity.X * 1000f); - int num125 = (int)(num117 * 1000f); - int num126 = (int)(projectile.velocity.Y * 1000f); - if (num123 != num124 || num125 != num126) - { - projectile.netUpdate = true; - } - projectile.velocity.X = num116; - projectile.velocity.Y = num117; - } - } - else if (projectile.ai[0] <= 0f) - { - projectile.netUpdate = true; - float num127 = 12f; - Vector2 vector11 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num128 = (float)Main.mouseX + Main.screenPosition.X - vector11.X; - float num129 = (float)Main.mouseY + Main.screenPosition.Y - vector11.Y; - if (Main.player[projectile.owner].gravDir == -1f) - { - num129 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector11.Y; - } - float num130 = (float)Math.Sqrt((double)(num128 * num128 + num129 * num129)); - if (num130 == 0f || projectile.ai[0] < 0f) - { - vector11 = new Vector2(Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2), Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2)); - num128 = projectile.position.X + (float)projectile.width * 0.5f - vector11.X; - num129 = projectile.position.Y + (float)projectile.height * 0.5f - vector11.Y; - num130 = (float)Math.Sqrt((double)(num128 * num128 + num129 * num129)); - } - num130 = num127 / num130; - num128 *= num130; - num129 *= num130; - projectile.velocity.X = num128; - projectile.velocity.Y = num129; - if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) - { - projectile.Kill(); - } - projectile.ai[0] = 1f; - } - } - if (projectile.velocity.X != 0f || projectile.velocity.Y != 0f) - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - } - if (projectile.velocity.Y > 16f) - { - projectile.velocity.Y = 16f; - } - } + public override void AI() + { + if (projectile.soundDelay == 0 && Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) > 2f) + { + projectile.soundDelay = 10; + Main.PlaySound(SoundID.Item20, projectile.Center); + } + int sand = Dust.NewDust(projectile.position, projectile.width, projectile.height, 85, 0f, 0f, 100, default, 2f); + Dust dust = Main.dust[sand]; + dust.velocity *= 0.3f; + dust.position.X = projectile.Center.X + 4f + (float)Main.rand.Next(-4, 5); + dust.position.Y = projectile.Center.Y + (float)Main.rand.Next(-4, 5); + dust.noGravity = true; - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } + if (Main.myPlayer == projectile.owner && projectile.ai[0] <= 0f) + { + Player player = Main.player[projectile.owner]; + if (player.channel) + { + float speed = 18f; + float mouseDistX = (float)Main.mouseX + Main.screenPosition.X - projectile.Center.X; + float mouseDistY = (float)Main.mouseY + Main.screenPosition.Y - projectile.Center.Y; + if (player.gravDir == -1f) + { + mouseDistY = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - projectile.Center.Y; + } + Vector2 mouseVec = new Vector2(mouseDistX, mouseDistY); + float mouseDist = mouseVec.Length(); + if (projectile.ai[0] < 0f) + { + projectile.ai[0] += 1f; + } + if (mouseDist > speed) + { + mouseDist = speed / mouseDist; + mouseVec.X *= mouseDist; + mouseVec.Y *= mouseDist; + int mouseSpeedX = (int)(mouseVec.X * 1000f); + int projSpeedX = (int)(projectile.velocity.X * 1000f); + int mouseSpeedY = (int)(mouseVec.Y * 1000f); + int projSpeedY = (int)(projectile.velocity.Y * 1000f); + if (mouseSpeedX != projSpeedX || mouseSpeedY != projSpeedY) + { + projectile.netUpdate = true; + } + projectile.velocity.X = mouseVec.X; + projectile.velocity.Y = mouseVec.Y; + } + else + { + int mouseSpeedX = (int)(mouseVec.X * 1000f); + int projSpeedX = (int)(projectile.velocity.X * 1000f); + int mouseSpeedY = (int)(mouseVec.Y * 1000f); + int projSpeedY = (int)(projectile.velocity.Y * 1000f); + if (mouseSpeedX != projSpeedX || mouseSpeedY != projSpeedY) + { + projectile.netUpdate = true; + } + projectile.velocity.X = mouseVec.X; + projectile.velocity.Y = mouseVec.Y; + } + } + else if (projectile.ai[0] <= 0f) + { + projectile.netUpdate = true; + float speed = 12f; + Vector2 projCenter = projectile.Center; + float mouseDistX = (float)Main.mouseX + Main.screenPosition.X - projCenter.X; + float mouseDistY = (float)Main.mouseY + Main.screenPosition.Y - projCenter.Y; + if (player.gravDir == -1f) + { + mouseDistY = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - projCenter.Y; + } + Vector2 mouseVec = new Vector2(mouseDistX, mouseDistY); + float mouseDist = mouseVec.Length(); + if (mouseDist == 0f || projectile.ai[0] < 0f) + { + projCenter = player.Center; + mouseVec = projectile.Center - projCenter; + mouseDist = mouseVec.Length(); + } + mouseDist = speed / mouseDist; + mouseVec.X *= mouseDist; + mouseVec.Y *= mouseDist; + projectile.velocity.X = mouseVec.X; + projectile.velocity.Y = mouseVec.Y; + if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) + { + projectile.Kill(); + } + projectile.ai[0] = 1f; + } + } + if (projectile.velocity.X != 0f || projectile.velocity.Y != 0f) + { + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + } + if (projectile.velocity.Y > 16f) + { + projectile.velocity.Y = 16f; + } + } - public override void Kill(int timeLeft) - { - projectile.position = projectile.Center; - projectile.width = projectile.height = 64; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - Main.PlaySound(SoundID.Item14, projectile.position); - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) - { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 85, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default, 1.2f); - Main.dust[num228].noGravity = true; - Main.dust[num228].noLight = true; - Main.dust[num228].velocity = vector7; - } - } - } + 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) + { + projectile.position = projectile.Center; + projectile.width = projectile.height = 64; + projectile.Center = projectile.position; + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.Damage(); + Main.PlaySound(SoundID.Item14, projectile.Center); + int dustAmt = 36; + for (int index = 0; index < dustAmt; index++) + { + Vector2 dustPos = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; + dustPos = dustPos.RotatedBy((double)((float)(index - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + projectile.Center; + Vector2 dustVel = dustPos - projectile.Center; + int sand = Dust.NewDust(dustPos + dustVel, 0, 0, 85, dustVel.X * 1.5f, dustVel.Y * 1.5f, 100, default, 1.2f); + Main.dust[sand].noGravity = true; + Main.dust[sand].noLight = true; + Main.dust[sand].velocity = dustVel; + } + } + } } diff --git a/Projectiles/Magic/SirensSongNote.png b/Projectiles/Magic/SirensSongNote.png index 2ec8ea38c0..e323ebc6e3 100644 Binary files a/Projectiles/Magic/SirensSongNote.png and b/Projectiles/Magic/SirensSongNote.png differ diff --git a/Projectiles/Magic/Snowflake.cs b/Projectiles/Magic/Snowflake.cs index 5a147f7d12..a7ce271023 100644 --- a/Projectiles/Magic/Snowflake.cs +++ b/Projectiles/Magic/Snowflake.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Magic projectile.penetrate = -1; projectile.timeLeft = 600; projectile.magic = true; - aiType = 491; + aiType = ProjectileID.FlyingKnife; projectile.coldDamage = true; } diff --git a/Projectiles/Magic/SparklingBeam.cs b/Projectiles/Magic/SparklingBeam.cs index 5d0d1a0383..cd46efefb5 100644 --- a/Projectiles/Magic/SparklingBeam.cs +++ b/Projectiles/Magic/SparklingBeam.cs @@ -111,20 +111,14 @@ namespace CalamityMod.Projectiles.Magic if (target.life <= 0) { Player player = Main.player[projectile.owner]; - int shardDamage = (int)((SparklingEmpress.BaseDamage / 5) * (player.allDamage + player.magicDamage - 1f)); - int num251 = Main.rand.Next(2, 4); + int shardDamage = (int)((SparklingEmpress.BaseDamage / 5) * player.MagicDamage()); + int shardAmt = Main.rand.Next(2, 4); if (projectile.owner == Main.myPlayer) { - for (int num252 = 0; num252 < num251; num252++) + for (int s = 0; s < shardAmt; s++) { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - int shard = Projectile.NewProjectile(target.Center.X, target.Center.Y, value15.X, value15.Y, ModContent.ProjectileType(), shardDamage, 0f, projectile.owner, 0f, 0f); + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); + int shard = Projectile.NewProjectile(target.Center, velocity, ModContent.ProjectileType(), shardDamage, 0f, projectile.owner, 0f, 0f); Main.projectile[shard].Calamity().forceMagic = true; } } diff --git a/Projectiles/Magic/SubsumingTentacle.cs b/Projectiles/Magic/SubsumingTentacle.cs index bf66907557..3374d189ea 100644 --- a/Projectiles/Magic/SubsumingTentacle.cs +++ b/Projectiles/Magic/SubsumingTentacle.cs @@ -70,7 +70,7 @@ namespace CalamityMod.Projectiles.Magic projectile.tileCollide = false; } - NPC closestTarget = projectile.Center.ClosestNPCAt(MaxEnemyDistance, true); + NPC closestTarget = projectile.Center.ClosestNPCAt(MaxEnemyDistance, true, true); if (closestTarget != null) { HomingMovement(closestTarget); @@ -111,8 +111,8 @@ namespace CalamityMod.Projectiles.Magic } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.Default, RasterizerState.CullNone, null, Main.GameViewMatrix.ZoomMatrix); + spriteBatch.End(); + spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); if (projectile.scale < 1f) { @@ -136,8 +136,8 @@ namespace CalamityMod.Projectiles.Magic } public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) { - Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, RasterizerState.CullCounterClockwise, null, Main.GameViewMatrix.TransformationMatrix); + spriteBatch.End(); + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) diff --git a/Projectiles/Magic/Vehemence.cs b/Projectiles/Magic/Vehemence.cs index 228160bdac..0f9f39ab4b 100644 --- a/Projectiles/Magic/Vehemence.cs +++ b/Projectiles/Magic/Vehemence.cs @@ -30,11 +30,11 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; Lighting.AddLight(projectile.Center, 0.45f, 0f, 0.45f); for (int num457 = 0; num457 < 2; num457++) { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 65, 0f, 0f, 100, default, 2f); + int num458 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 65, 0f, 0f, 100, default, 2f); Main.dust[num458].noGravity = true; Main.dust[num458].velocity *= 0.15f; Main.dust[num458].velocity += projectile.velocity * 0.1f; @@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Magic Main.PlaySound(SoundID.Item74, projectile.position); for (int j = 0; j <= 25; j++) { - int num459 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 65, 0f, 0f, 100, default, 1f); + int num459 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 65, 0f, 0f, 100, default, 1f); Main.dust[num459].noGravity = true; Main.dust[num459].velocity *= 0.1f; } diff --git a/Projectiles/Magic/VenusianFlame.cs b/Projectiles/Magic/VenusianFlame.cs index 66ea6493c3..e7b70c8a49 100644 --- a/Projectiles/Magic/VenusianFlame.cs +++ b/Projectiles/Magic/VenusianFlame.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Magic { public class VenusianFlame : ModProjectile { + private bool initialized = false; + public override void SetStaticDefaults() { DisplayName.SetDefault("Venusian Cinder"); @@ -31,6 +33,23 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { + //Rotation + if (projectile.ai[1] > 0f) + { + projectile.rotation = -projectile.velocity.X * 0.05f + MathHelper.PiOver2; + } + else + { + projectile.rotation = projectile.velocity.ToRotation(); + } + projectile.ai[1]--; + + //frames + if (!initialized) + { + initialized = true; + projectile.frame = Main.rand.Next(Main.projFrames[projectile.type]); + } projectile.frameCounter++; if (projectile.frameCounter > 4) { @@ -41,6 +60,8 @@ namespace CalamityMod.Projectiles.Magic { projectile.frame = 0; } + + //movement if (projectile.velocity.X != projectile.velocity.X) { projectile.velocity.X *= -0.1f; @@ -68,13 +89,25 @@ namespace CalamityMod.Projectiles.Magic } projectile.velocity.Y += 0.2f; } - projectile.rotation += projectile.velocity.X * 0.1f; - if (projectile.ai[1] == 0f && projectile.type >= 326 && projectile.type <= 328) + if (projectile.velocity.Y < 0.25f && projectile.velocity.Y > 0.15f) { - projectile.ai[1] = 1f; - Main.PlaySound(SoundID.Item13, projectile.position); + projectile.velocity.X *= 0.8f; } - if (Main.rand.NextBool(2)) + if (projectile.velocity.Y > 16f) + { + projectile.velocity.Y = 16f; + } + if (projectile.velocity.Y < 0.25f && projectile.velocity.Y > 0.15f) + { + projectile.velocity.X *= 0.8f; + } + if (projectile.velocity.Y > 16f) + { + projectile.velocity.Y = 16f; + } + + //Dust + if (Main.rand.NextBool(4)) { int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 55, 0f, 0f, 100, default, 1f); Dust dust = Main.dust[num199]; @@ -84,7 +117,7 @@ namespace CalamityMod.Projectiles.Magic dust.noGravity = true; dust.velocity.Y -= 2f; } - if (Main.rand.NextBool(3)) + if (Main.rand.NextBool(10)) { int num200 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 55, 0f, 0f, 100, default, 1f); Dust dust2 = Main.dust[num200]; @@ -94,15 +127,6 @@ namespace CalamityMod.Projectiles.Magic dust2.noGravity = true; dust2.velocity *= 0.1f; } - if (projectile.velocity.Y < 0.25f && projectile.velocity.Y > 0.15f) - { - projectile.velocity.X *= 0.8f; - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); - if (projectile.velocity.Y > 16f) - { - projectile.velocity.Y = 16f; - } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -110,7 +134,11 @@ namespace CalamityMod.Projectiles.Magic target.AddBuff(BuffID.OnFire, 300); } - public override bool OnTileCollide(Vector2 oldVelocity) => false; + public override bool OnTileCollide(Vector2 oldVelocity) + { + projectile.ai[1] = 10f; + return false; + } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { diff --git a/Projectiles/Magic/VividBeam.cs b/Projectiles/Magic/VividBeam.cs index 834975c128..f58366c6eb 100644 --- a/Projectiles/Magic/VividBeam.cs +++ b/Projectiles/Magic/VividBeam.cs @@ -1,5 +1,3 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using System; @@ -98,15 +96,16 @@ namespace CalamityMod.Projectiles.Magic { SummonLasers(); } - target.AddBuff(ModContent.BuffType(), 30); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.Ichor, 120); + target.ExoDebuffs(); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + if (projectile.owner == Main.myPlayer) + { + SummonLasers(); + } + target.ExoDebuffs(); } private void SummonLasers() diff --git a/Projectiles/Magic/VividBolt.cs b/Projectiles/Magic/VividBolt.cs index a0443dcca5..1fa5ae52b2 100644 --- a/Projectiles/Magic/VividBolt.cs +++ b/Projectiles/Magic/VividBolt.cs @@ -65,15 +65,12 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 30); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.Ichor, 120); + target.ExoDebuffs(); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.ExoDebuffs(); } } } diff --git a/Projectiles/Magic/VividClarityBeam.cs b/Projectiles/Magic/VividClarityBeam.cs index 59d149066b..614d4279b8 100644 --- a/Projectiles/Magic/VividClarityBeam.cs +++ b/Projectiles/Magic/VividClarityBeam.cs @@ -1,5 +1,3 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -97,20 +95,18 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 30); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.Ichor, 120); + target.ExoDebuffs(); if (target.type == NPCID.TargetDummy) { return; } - projectile.damage = (int)((double)projectile.damage * 1.1); + projectile.damage = (int)(projectile.damage * 1.1); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.ExoDebuffs(); + projectile.damage = (int)(projectile.damage * 1.1); } } } diff --git a/Projectiles/Magic/VividLaser2.cs b/Projectiles/Magic/VividLaser2.cs index b8f9e7ac1d..3db215c1c7 100644 --- a/Projectiles/Magic/VividLaser2.cs +++ b/Projectiles/Magic/VividLaser2.cs @@ -1,5 +1,3 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -62,16 +60,13 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 30); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.Ichor, 120); - } + target.ExoDebuffs(); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.ExoDebuffs(); + } // Cannot deal damage for the first several frames of existence. public override bool? CanHitNPC(NPC target) diff --git a/Projectiles/Magic/Vortex.cs b/Projectiles/Magic/Vortex.cs index 86462050c7..b78aa9ace8 100644 --- a/Projectiles/Magic/Vortex.cs +++ b/Projectiles/Magic/Vortex.cs @@ -1,5 +1,3 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -80,7 +78,7 @@ namespace CalamityMod.Projectiles.Magic // Attempt to find a target if the projectile has none. if (TargetIndex == -1 && TargetCheckCooldown <= 0f) { - NPC potentialTarget = projectile.Center.ClosestNPCAt(targetCheckDistance, true); + NPC potentialTarget = projectile.Center.ClosestNPCAt(targetCheckDistance, true, true); if (potentialTarget != null) TargetIndex = potentialTarget.whoAmI; projectile.netUpdate = true; @@ -111,7 +109,7 @@ namespace CalamityMod.Projectiles.Magic int dustCount = 5; for (int i = 0; i < dustCount; i++) { - Vector2 spawnPosition = projectile.Center + projectile.Size.RotatedBy(i / (float)dustCount * MathHelper.TwoPi) * 0.5f; + Vector2 spawnPosition = projectile.Center + projectile.Size.RotatedBy(i / (float)dustCount * MathHelper.TwoPi) * 0.333f; Vector2 velocity = Main.rand.NextFloat(MathHelper.TwoPi).ToRotationVector2() * Main.rand.NextFloat(6f, 16f); Dust dust = Dust.NewDustPerfect(spawnPosition, 66, velocity, 0, Main.DiscoColor, 0.7f); dust.noGravity = true; @@ -149,15 +147,12 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 30); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.Ichor, 120); + target.ExoDebuffs(); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.ExoDebuffs(); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Magic/WaterLeechProj.cs b/Projectiles/Magic/WaterLeechProj.cs index 40bff612ec..a60506e4b0 100644 --- a/Projectiles/Magic/WaterLeechProj.cs +++ b/Projectiles/Magic/WaterLeechProj.cs @@ -43,12 +43,12 @@ namespace CalamityMod.Projectiles.Magic projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + MathHelper.Pi; } //Sticky Behaviour - CalamityUtils.StickyProjAI(projectile, 5); + projectile.StickyProjAI(5); } public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - CalamityUtils.ModifyHitNPCSticky(projectile, 3, false); + projectile.ModifyHitNPCSticky(3, false); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Melee/AegisBeam.cs b/Projectiles/Melee/AegisBeam.cs index 079d99c4c8..0be8a8f07b 100644 --- a/Projectiles/Melee/AegisBeam.cs +++ b/Projectiles/Melee/AegisBeam.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Melee Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 73); projectile.localAI[0] += 1f; } - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 0.8f); + int num458 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 246, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 0.8f); Main.dust[num458].noGravity = true; Main.dust[num458].velocity *= 0.5f; Main.dust[num458].velocity += projectile.velocity * 0.1f; @@ -56,39 +56,32 @@ namespace CalamityMod.Projectiles.Melee projectile.localNPCHitCooldown = 10; projectile.Damage(); Main.PlaySound(SoundID.Item20, projectile.Center); - for (int dust = 0; dust <= 30; dust++) + for (int d = 0; d <= 30; d++) { float num463 = (float)Main.rand.Next(-10, 11); float num464 = (float)Main.rand.Next(-10, 11); - float num465 = (float)Main.rand.Next(3, 9); + float speed = (float)Main.rand.Next(3, 9); float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); - num466 = num465 / num466; + num466 = speed / num466; num463 *= num466; num464 *= num466; int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 1.2f); - Main.dust[num467].noGravity = true; - Main.dust[num467].position.X = projectile.Center.X; - Main.dust[num467].position.Y = projectile.Center.Y; - Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); - Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); - Main.dust[num467].velocity.X = num463; - Main.dust[num467].velocity.Y = num464; + Dust dust = Main.dust[num467]; + dust.noGravity = true; + dust.position.X = projectile.Center.X; + dust.position.Y = projectile.Center.Y; + dust.position.X += (float)Main.rand.Next(-10, 11); + dust.position.Y += (float)Main.rand.Next(-10, 11); + dust.velocity.X = num463; + dust.velocity.Y = num464; } - int num251 = Main.rand.Next(2, 4); + int flameAmt = Main.rand.Next(2, 4); if (projectile.owner == Main.myPlayer) { - for (int num252 = 0; num252 < num251; num252++) + for (int i = 0; i < flameAmt; i++) { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.75), 0f, projectile.owner, 0f, 0f); + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); + Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.75), 0f, projectile.owner, 0f, 0f); } } } diff --git a/Projectiles/Melee/AmidiasWhirlpool.cs b/Projectiles/Melee/AmidiasWhirlpool.cs index 87f4500b25..6dc23c828d 100644 --- a/Projectiles/Melee/AmidiasWhirlpool.cs +++ b/Projectiles/Melee/AmidiasWhirlpool.cs @@ -86,6 +86,7 @@ namespace CalamityMod.Projectiles.Melee vector145 = center13; flag59 = true; num1016 = num1017; + break; } } num3 = num1017; diff --git a/Projectiles/Melee/BallOFuguProj.png b/Projectiles/Melee/BallOFuguProj.png index f4673a0825..ca90c057a0 100644 Binary files a/Projectiles/Melee/BallOFuguProj.png and b/Projectiles/Melee/BallOFuguProj.png differ diff --git a/Projectiles/Melee/BansheeHookScythe.cs b/Projectiles/Melee/BansheeHookScythe.cs index b09579d645..31e5a2e40b 100644 --- a/Projectiles/Melee/BansheeHookScythe.cs +++ b/Projectiles/Melee/BansheeHookScythe.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { @@ -22,7 +23,7 @@ namespace CalamityMod.Projectiles.Melee projectile.penetrate = 5; projectile.timeLeft = 180; projectile.ignoreWater = true; - aiType = 274; + aiType = ProjectileID.DeathSickle; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 3; } diff --git a/Projectiles/Melee/BlazingPhantomBlade.cs b/Projectiles/Melee/BlazingPhantomBlade.cs index 9266c9b913..7cfd182482 100644 --- a/Projectiles/Melee/BlazingPhantomBlade.cs +++ b/Projectiles/Melee/BlazingPhantomBlade.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Melee projectile.penetrate = 5; projectile.timeLeft = 180; projectile.ignoreWater = true; - aiType = 274; + aiType = ProjectileID.DeathSickle; } public override void AI() diff --git a/Projectiles/Melee/BloodyBlade.png b/Projectiles/Melee/BloodyBlade.png index 1c3f739d78..b8d1439078 100644 Binary files a/Projectiles/Melee/BloodyBlade.png and b/Projectiles/Melee/BloodyBlade.png differ diff --git a/Projectiles/Melee/BlueAura.cs b/Projectiles/Melee/BlueAura.cs index 2f06f51597..ca5067e899 100644 --- a/Projectiles/Melee/BlueAura.cs +++ b/Projectiles/Melee/BlueAura.cs @@ -14,7 +14,6 @@ namespace CalamityMod.Projectiles.Melee { projectile.width = 20; projectile.height = 20; - aiType = 348; projectile.friendly = true; projectile.melee = true; projectile.tileCollide = false; diff --git a/Projectiles/Melee/BonebreakerProjectile.cs b/Projectiles/Melee/BonebreakerProjectile.cs index 7560a3df50..704f138600 100644 --- a/Projectiles/Melee/BonebreakerProjectile.cs +++ b/Projectiles/Melee/BonebreakerProjectile.cs @@ -31,10 +31,9 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - int num982 = 25; if (projectile.alpha > 0) { - projectile.alpha -= num982; + projectile.alpha -= 25; } if (projectile.alpha < 0) { @@ -42,24 +41,21 @@ namespace CalamityMod.Projectiles.Melee } if (projectile.ai[0] == 0f) { - projectile.ai[1] += 1f; - if (projectile.ai[1] >= 45f) + projectile.localAI[1] += 1f; + if (projectile.localAI[1] >= 45f) { - float num986 = 0.98f; - float num987 = 0.35f; - projectile.ai[1] = 45f; - projectile.velocity.X = projectile.velocity.X * num986; - projectile.velocity.Y = projectile.velocity.Y + num987; + projectile.velocity.X *= 0.98f; + projectile.velocity.Y += 0.35f; } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + MathHelper.PiOver2; + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; } //Sticky Behaviour - CalamityUtils.StickyProjAI(projectile, 15); + projectile.StickyProjAI(15); } public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - CalamityUtils.ModifyHitNPCSticky(projectile, 6, false); + projectile.ModifyHitNPCSticky(6, true); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) @@ -86,16 +82,16 @@ namespace CalamityMod.Projectiles.Melee } if (projectile.owner == Main.myPlayer) { - for (int num252 = 0; num252 < Main.rand.Next(2,5); num252++) + for (int s = 0; s < Main.rand.Next(2,5); s++) { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) + Vector2 velocity = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + while (velocity.X == 0f && velocity.Y == 0f) { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + velocity = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - int shard = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, ModContent.ProjectileType(), (int)((float)Bonebreaker.BaseDamage * 0.5f), projectile.knockBack * 0.5f, projectile.owner, Main.rand.Next(0,4), 0f); + velocity.Normalize(); + velocity *= (float)Main.rand.Next(70, 101) * 0.1f; + int shard = Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.5f), projectile.knockBack * 0.5f, projectile.owner, Main.rand.Next(0,4), 0f); } } } @@ -113,5 +109,16 @@ namespace CalamityMod.Projectiles.Melee target.AddBuff(BuffID.Venom, 240); target.AddBuff(ModContent.BuffType(), 240); } + + public override bool? CanHitNPC(NPC target) + { + if (projectile.ai[0] == 1f) + { + return false; + } + return null; + } + + public override bool CanHitPvp(Player target) => projectile.ai[0] != 1f; } } diff --git a/Projectiles/Melee/BrimstoneLaserFriendly.cs b/Projectiles/Melee/BrimstoneLaserFriendly.cs index 8db8363283..762fa42ec5 100644 --- a/Projectiles/Melee/BrimstoneLaserFriendly.cs +++ b/Projectiles/Melee/BrimstoneLaserFriendly.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { @@ -19,7 +20,7 @@ namespace CalamityMod.Projectiles.Melee projectile.width = 2; projectile.height = 2; projectile.aiStyle = 1; - aiType = 100; + aiType = ProjectileID.DeathLaser; projectile.friendly = true; projectile.melee = true; projectile.scale = 2f; diff --git a/Projectiles/Melee/ChaosFlameSmall.cs b/Projectiles/Melee/ChaosFlameSmall.cs index 2c334e743c..4cba2dbd61 100644 --- a/Projectiles/Melee/ChaosFlameSmall.cs +++ b/Projectiles/Melee/ChaosFlameSmall.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Melee { projectile.frame = 0; } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + projectile.rotation = projectile.velocity.ToRotation(); Lighting.AddLight(projectile.Center, 0.4f, 0f, 0f); if (Main.rand.NextBool(4)) { diff --git a/Projectiles/Melee/ClamCrusherFlail.cs b/Projectiles/Melee/ClamCrusherFlail.cs index 654d461866..9d9fe2dc87 100644 --- a/Projectiles/Melee/ClamCrusherFlail.cs +++ b/Projectiles/Melee/ClamCrusherFlail.cs @@ -127,14 +127,8 @@ namespace CalamityMod.Projectiles.Melee Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/ClamImpact"), (int)projectile.position.X, (int)projectile.position.Y); for (int num105 = 0; num105 < 50; num105++) { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - int waterDust = Dust.NewDust(new Vector2(projectile.Center.X, projectile.Center.Y), projectile.width / 2, projectile.height / 2, 33, value15.X, value15.Y, 0, new Color(0, 142, 255), 1.5f); + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); + int waterDust = Dust.NewDust(new Vector2(projectile.Center.X, projectile.Center.Y), projectile.width / 2, projectile.height / 2, 33, velocity.X, velocity.Y, 0, new Color(0, 142, 255), 1.5f); Main.dust[waterDust].velocity *= 2f; } } diff --git a/Projectiles/Melee/CrescentMoonProj.cs b/Projectiles/Melee/CrescentMoonProj.cs index 925b0ea343..e7e46a8137 100644 --- a/Projectiles/Melee/CrescentMoonProj.cs +++ b/Projectiles/Melee/CrescentMoonProj.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Projectiles.Melee projectile.localNPCHitCooldown = 10; projectile.extraUpdates = 1; projectile.aiStyle = 18; - aiType = 274; + aiType = ProjectileID.DeathSickle; } public override void AI() diff --git a/Projectiles/Melee/CrystylCrusherRay.cs b/Projectiles/Melee/CrystylCrusherRay.cs index ab34e78b90..b4b754ec2a 100644 --- a/Projectiles/Melee/CrystylCrusherRay.cs +++ b/Projectiles/Melee/CrystylCrusherRay.cs @@ -120,7 +120,6 @@ namespace CalamityMod.Projectiles.Melee // First we update player variables that are needed to channel the laser // Then we run our charging laser logic // If we are fully charged, we proceed to update the laser's position - // Finally we spawn some effects like dusts and light UpdatePlayer(player); ChargeLaser(player); @@ -136,46 +135,10 @@ namespace CalamityMod.Projectiles.Melee } SetLaserPosition(player); - SpawnDusts(player); CastLights(); DestroyTiles(); } - private void SpawnDusts(Player player) - { - Vector2 unit = projectile.velocity * -1; - Vector2 dustPos = player.Center + projectile.velocity * Distance; - - for (int i = 0; i < 2; ++i) - { - float num1 = projectile.velocity.ToRotation() + (Main.rand.Next(2) == 1 ? -1.0f : 1.0f) * 1.57f; - float num2 = (float)(Main.rand.NextDouble() * 0.8f + 1.0f); - Vector2 dustVel = new Vector2((float)Math.Cos(num1) * num2, (float)Math.Sin(num1) * num2); - Dust dust = Main.dust[Dust.NewDust(dustPos, 0, 0, 173, dustVel.X, dustVel.Y)]; - dust.noGravity = true; - dust.scale = 1.2f; - dust = Dust.NewDustDirect(Main.player[projectile.owner].Center, 0, 0, 31, - -unit.X * Distance, -unit.Y * Distance); - dust.fadeIn = 0f; - dust.color = new Color(Main.DiscoR, 0, 255); - dust.noGravity = true; - dust.scale = 0.88f; - } - - if (Main.rand.NextBool(5)) - { - Vector2 offset = projectile.velocity.RotatedBy(1.57f) * ((float)Main.rand.NextDouble() - 0.5f) * projectile.width; - Dust dust = Main.dust[Dust.NewDust(dustPos + offset - Vector2.One * 4f, 8, 8, 57, 0.0f, 0.0f, 100, new Color(Main.DiscoR, 0, 255), 1.5f)]; - dust.velocity *= 0.5f; - dust.velocity.Y = -Math.Abs(dust.velocity.Y); - unit = dustPos - Main.player[projectile.owner].Center; - unit.Normalize(); - dust = Main.dust[Dust.NewDust(Main.player[projectile.owner].Center + 55 * unit, 8, 8, 58, 0.0f, 0.0f, 100, new Color(Main.DiscoR, 0, 255), 1.5f)]; - dust.velocity = dust.velocity * 0.5f; - dust.velocity.Y = -Math.Abs(dust.velocity.Y); - } - } - /* * Sets the end of the laser position based on where it collides with something */ @@ -284,10 +247,10 @@ namespace CalamityMod.Projectiles.Melee { Vector2 destroyVector = projectile.Center + projectile.velocity * (Distance - MOVE_DISTANCE); int num814 = 3; - int num815 = (int)(destroyVector.X / 16f - (float)num814); - int num816 = (int)(destroyVector.X / 16f + (float)num814); - int num817 = (int)(destroyVector.Y / 16f - (float)num814); - int num818 = (int)(destroyVector.Y / 16f + (float)num814); + int num815 = (int)(destroyVector.X / 16f - num814); + int num816 = (int)(destroyVector.X / 16f + num814); + int num817 = (int)(destroyVector.Y / 16f - num814); + int num818 = (int)(destroyVector.Y / 16f + num814); if (num815 < 0) { num815 = 0; @@ -309,10 +272,10 @@ namespace CalamityMod.Projectiles.Melee { for (int num825 = num817; num825 <= num818; num825++) { - float num826 = Math.Abs((float)num824 - destroyVector.X / 16f); - float num827 = Math.Abs((float)num825 - destroyVector.Y / 16f); - double num828 = Math.Sqrt((double)(num826 * num826 + num827 * num827)); - if (num828 < (double)num814) + float num826 = Math.Abs(num824 - destroyVector.X / 16f); + float num827 = Math.Abs(num825 - destroyVector.Y / 16f); + double num828 = Math.Sqrt(num826 * num826 + num827 * num827); + if (num828 < num814) { if (Main.tile[num824, num825] != null && Main.tile[num824, num825].active()) { @@ -320,7 +283,7 @@ namespace CalamityMod.Projectiles.Melee DustExplosion(destroyVector); if (!Main.tile[num824, num825].active() && Main.netMode != NetmodeID.SinglePlayer) { - NetMessage.SendData(MessageID.TileChange, -1, -1, null, 0, (float)num824, (float)num825, 0f, 0, 0, 0); + NetMessage.SendData(MessageID.TileChange, -1, -1, null, 0, num824, num825, 0f, 0, 0, 0); } } } @@ -329,7 +292,7 @@ namespace CalamityMod.Projectiles.Melee AchievementsHelper.CurrentlyMining = false; if (Main.netMode != NetmodeID.SinglePlayer) { - NetMessage.SendData(MessageID.KillProjectile, -1, -1, null, projectile.identity, (float)projectile.owner, 0f, 0f, 0, 0, 0); + NetMessage.SendData(MessageID.KillProjectile, -1, -1, null, projectile.identity, projectile.owner, 0f, 0f, 0, 0, 0); } } } @@ -354,8 +317,8 @@ namespace CalamityMod.Projectiles.Melee default: break; } - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + vector; + Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2(projectile.width / 2f, projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((num227 - (num226 / 2 - 1)) * MathHelper.TwoPi / num226, default) + vector; Vector2 vector7 = vector6 - vector; int num228 = Dust.NewDust(vector6 + vector7, 0, 0, dustType, vector7.X * 0.5f, vector7.Y * 0.5f, 100, new Color(Main.DiscoR, 0, 255), 1f); Main.dust[num228].noGravity = true; diff --git a/Projectiles/Melee/DNA.cs b/Projectiles/Melee/DNA.cs index 7c191175f4..157b1c9a72 100644 --- a/Projectiles/Melee/DNA.cs +++ b/Projectiles/Melee/DNA.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Melee projectile.penetrate = -1; projectile.tileCollide = false; projectile.melee = true; - aiType = 493; + aiType = ProjectileID.CrystalVileShardHead; } public override void AI() diff --git a/Projectiles/Melee/DNA2.cs b/Projectiles/Melee/DNA2.cs index 643b147d8c..73a8f21372 100644 --- a/Projectiles/Melee/DNA2.cs +++ b/Projectiles/Melee/DNA2.cs @@ -1,6 +1,7 @@ using CalamityMod.CalPlayer; using System; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { @@ -21,7 +22,7 @@ namespace CalamityMod.Projectiles.Melee projectile.penetrate = -1; projectile.tileCollide = false; projectile.melee = true; - aiType = 494; + aiType = ProjectileID.CrystalVileShardShaft; } public override void AI() diff --git a/Projectiles/Melee/DepthOrb.cs b/Projectiles/Melee/DepthOrb.cs index 55372a55a9..84fd73405c 100644 --- a/Projectiles/Melee/DepthOrb.cs +++ b/Projectiles/Melee/DepthOrb.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { Lighting.AddLight(projectile.Center, 0f, 0f, 0.5f); - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 0.6f); + int num458 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 33, 0f, 0f, 100, default, 0.6f); Main.dust[num458].noGravity = true; Main.dust[num458].velocity *= 0.5f; Main.dust[num458].velocity += projectile.velocity * 0.1f; @@ -55,8 +55,7 @@ namespace CalamityMod.Projectiles.Melee Main.PlaySound(SoundID.Item10, projectile.position); projectile.position = projectile.Center; projectile.width = projectile.height = 64; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.Center = projectile.position; for (int dustIndex = 0; dustIndex < 30; dustIndex++) { float num463 = (float)Main.rand.Next(-10, 11); @@ -66,7 +65,7 @@ namespace CalamityMod.Projectiles.Melee num466 = num465 / num466; num463 *= num466; num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 1.2f); + int num467 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 33, 0f, 0f, 100, default, 1.2f); Dust dust = Main.dust[num467]; dust.noGravity = true; dust.position.X = projectile.Center.X; @@ -80,12 +79,14 @@ namespace CalamityMod.Projectiles.Melee projectile.penetrate = -1; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 10; + projectile.damage /= 2; projectile.Damage(); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 300); + if (Main.rand.NextBool(2)) + target.AddBuff(ModContent.BuffType(), 180); } } } diff --git a/Projectiles/Melee/DepthOrb2.cs b/Projectiles/Melee/DepthOrb2.cs index 330c767bd4..856ff6d7e7 100644 --- a/Projectiles/Melee/DepthOrb2.cs +++ b/Projectiles/Melee/DepthOrb2.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Projectiles.Melee { Lighting.AddLight(projectile.Center, 0f, 0f, 0.5f); - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 0.4f); + int num458 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 33, 0f, 0f, 100, default, 0.4f); Main.dust[num458].noGravity = true; Main.dust[num458].velocity *= 0.5f; Main.dust[num458].velocity += projectile.velocity * 0.1f; @@ -70,7 +70,7 @@ namespace CalamityMod.Projectiles.Melee num466 = num465 / num466; num463 *= num466; num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 1.2f); + int num467 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 33, 0f, 0f, 100, default, 1.2f); Dust dust = Main.dust[num467]; dust.noGravity = true; dust.position.X = projectile.Center.X; diff --git a/Projectiles/Melee/DevilsSunriseProj.cs b/Projectiles/Melee/DevilsSunriseProj.cs index f00921abcb..f3123d482c 100644 --- a/Projectiles/Melee/DevilsSunriseProj.cs +++ b/Projectiles/Melee/DevilsSunriseProj.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Melee projectile.ownerHitCheck = true; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 5; - projectile.Calamity().trueMelee = true; + //projectile.Calamity().trueMelee = true; } public override void AI() diff --git a/Projectiles/Melee/DragonPowFlail.cs b/Projectiles/Melee/DragonPowFlail.cs index 706d707863..a335681163 100644 --- a/Projectiles/Melee/DragonPowFlail.cs +++ b/Projectiles/Melee/DragonPowFlail.cs @@ -150,61 +150,57 @@ namespace CalamityMod.Projectiles.Melee if (target.type == NPCID.TargetDummy) return; - PetalStorm(target, damage, knockback, crit); - Waterfalls(target, damage, knockback, crit); + PetalStorm(target.Center); + Waterfalls(target.Center); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + // Inflicts Abyssal Flames and Holy Flames for 8 seconds on-hit + target.AddBuff(ModContent.BuffType(), 480); + target.AddBuff(ModContent.BuffType(), 480); + + projectile.ai[0] = 1f; + projectile.netUpdate = true; + + PetalStorm(target.Center); + Waterfalls(target.Center); } // Spawns a storm of flower petals on-hit. - private void PetalStorm(NPC target, int damage, float knockback, bool crit) + private void PetalStorm(Vector2 targetPos) { - Main.PlaySound(SoundID.Item105, target.Center); + Main.PlaySound(SoundID.Item105, targetPos); int type = ProjectileID.FlowerPetal; int numPetals = 12; int petalDamage = projectile.damage / 8; float petalKB = 0f; - Player owner = Main.player[projectile.owner]; for (int i = 0; i < numPetals; ++i) { - float startOffsetX = Main.rand.NextFloat(1000f, 1400f) * (Main.rand.NextBool() ? -1f : 1f); - float startOffsetY = Main.rand.NextFloat(80f, 900f) * (Main.rand.NextBool() ? -1f : 1f); - Vector2 startPos = new Vector2(target.Center.X + startOffsetX, target.Center.Y + startOffsetY); - float dx = target.Center.X - startPos.X; - float dy = target.Center.Y - startPos.Y; - - // Add some randomness / inaccuracy to the petal target location - dx += Main.rand.NextFloat(-5f, 5f); - dy += Main.rand.NextFloat(-5f, 5f); - float speed = Main.rand.NextFloat(DragonPow.MinPetalSpeed, DragonPow.MaxPetalSpeed); - float dist = (float)Math.Sqrt((double)(dx * dx + dy * dy)); - dist = speed / dist; - dx *= dist; - dy *= dist; - Vector2 petalVel = new Vector2(dx, dy); - float angle = Main.rand.NextFloat(MathHelper.TwoPi); - if (projectile.owner == Main.myPlayer) - { - int idx = Projectile.NewProjectile(startPos, petalVel, type, petalDamage, petalKB, projectile.owner, 0f, 0f); - Main.projectile[idx].rotation = angle; - Main.projectile[idx].melee = true; - Main.projectile[idx].usesLocalNPCImmunity = true; - Main.projectile[idx].localNPCHitCooldown = -1; - } + if (projectile.owner == Main.myPlayer) + { + float angle = Main.rand.NextFloat(MathHelper.TwoPi); + Projectile petal = CalamityUtils.ProjectileBarrage(projectile.Center, targetPos, Main.rand.NextBool(), 1000f, 1400f, 80f, 900f, Main.rand.NextFloat(DragonPow.MinPetalSpeed, DragonPow.MaxPetalSpeed), type, petalDamage, petalKB, projectile.owner); + petal.rotation = angle; + petal.Calamity().forceMelee = true; + petal.usesLocalNPCImmunity = true; + petal.localNPCHitCooldown = -1; + } } } - private void Waterfalls(NPC target, int damage, float knockback, bool crit) + private void Waterfalls(Vector2 targetPos) { int type = ModContent.ProjectileType(); int numWaterfalls = 12; int waterfallDamage = projectile.damage / 6; float waterfallKB = 0f; - Player owner = Main.player[projectile.owner]; for (int i = 0; i < numWaterfalls; ++i) { float startOffsetX = Main.rand.NextFloat(-120f, 120f); float startOffsetY = Main.rand.NextFloat(-740f, -700f); - Vector2 startPos = new Vector2(target.Center.X + startOffsetX, target.Center.Y + startOffsetY); + Vector2 startPos = new Vector2(targetPos.X + startOffsetX, targetPos.Y + startOffsetY); float fallSpeed = Main.rand.NextFloat(DragonPow.MinWaterfallSpeed, DragonPow.MaxWaterfallSpeed); Vector2 fallVec = new Vector2(0f, fallSpeed); fallVec = fallVec.RotatedBy(Main.rand.NextFloat(-0.08f, 0.08f)); diff --git a/Projectiles/Melee/DragonRageProj.cs b/Projectiles/Melee/DragonRageProj.cs index 86513eade7..b38af4fda1 100644 --- a/Projectiles/Melee/DragonRageProj.cs +++ b/Projectiles/Melee/DragonRageProj.cs @@ -74,7 +74,7 @@ namespace CalamityMod.Projectiles.Melee projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); for (int num621 = 0; num621 < 6; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -84,13 +84,13 @@ namespace CalamityMod.Projectiles.Melee } for (int num623 = 0; num623 < 9; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(projectile.position, 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); + num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - CalamityUtils.ExplosionGores(projectile, 3); + CalamityUtils.ExplosionGores(projectile.Center, 3); } } } diff --git a/Projectiles/Melee/Earth3.cs b/Projectiles/Melee/Earth3.cs index d4046ae419..c80c727a88 100644 --- a/Projectiles/Melee/Earth3.cs +++ b/Projectiles/Melee/Earth3.cs @@ -95,7 +95,7 @@ namespace CalamityMod.Projectiles.Melee projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); for (int num621 = 0; num621 < 20; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -105,13 +105,13 @@ namespace CalamityMod.Projectiles.Melee } for (int num623 = 0; num623 < 35; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(projectile.position, 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); + num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - CalamityUtils.ExplosionGores(projectile, 3); + CalamityUtils.ExplosionGores(projectile.Center, 3); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Melee/ElementBallShiv.cs b/Projectiles/Melee/ElementBallShiv.cs index a3ebd7e5db..f808dd0b00 100644 --- a/Projectiles/Melee/ElementBallShiv.cs +++ b/Projectiles/Melee/ElementBallShiv.cs @@ -17,8 +17,8 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; + projectile.width = 20; + projectile.height = 20; projectile.friendly = true; projectile.melee = true; projectile.penetrate = 1; @@ -29,9 +29,9 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - int num250 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, (float)(projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.3f); - Main.dust[num250].noGravity = true; - Main.dust[num250].velocity *= 0f; + int rainbow = Dust.NewDust(projectile.position, projectile.width, projectile.height, 66, (float)(projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.3f); + Main.dust[rainbow].noGravity = true; + Main.dust[rainbow].velocity = Vector2.Zero; CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 600f, 36f, 20f); } @@ -48,35 +48,38 @@ namespace CalamityMod.Projectiles.Melee { for (int k = 0; k < 4; k++) { - int num = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 66, (float)(projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); - Main.dust[num].noGravity = true; + int rainbow = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 66, (float)(projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + Main.dust[rainbow].noGravity = true; } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - float xPos = projectile.ai[0] > 0 ? projectile.position.X + 800 : projectile.position.X - 800; - Vector2 vector2 = new Vector2(xPos, projectile.position.Y + Main.rand.Next(-800, 801)); - - float num80 = xPos; - float speedX = (float)target.position.X - vector2.X; - float speedY = (float)target.position.Y - vector2.Y; - float dir = (float)Math.Sqrt((double)(speedX * speedX + speedY * speedY)); - dir = 10 / num80; - float random = (float)Main.rand.Next(1, 150); - if (projectile.owner == Main.myPlayer) - { - for (int i = 0; i < 4; i++) - { - speedX *= dir * random; - speedY *= dir * random; - Projectile.NewProjectile(vector2.X, vector2.Y, speedX, speedY, ModContent.ProjectileType(), projectile.damage, 1f, projectile.owner); - } - } + OnHitEffects(target.Center); 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) + { + OnHitEffects(target.Center); + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); + } + + private void OnHitEffects(Vector2 targetPos) + { + for (int x = 0; x < 4; x++) + { + if (projectile.owner == Main.myPlayer) + { + CalamityUtils.ProjectileBarrage(projectile.Center, targetPos, x > 2, 800f, 800f, 0f, 800f, 1f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, false, 50f); + } + } + } } } diff --git a/Projectiles/Melee/ElementalExcaliburBeam.cs b/Projectiles/Melee/ElementalExcaliburBeam.cs index 9df00e4032..660a368351 100644 --- a/Projectiles/Melee/ElementalExcaliburBeam.cs +++ b/Projectiles/Melee/ElementalExcaliburBeam.cs @@ -1,5 +1,3 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -245,15 +243,21 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 60); - target.AddBuff(ModContent.BuffType(), 240); - target.AddBuff(ModContent.BuffType(), 240); - target.AddBuff(ModContent.BuffType(), 240); - target.AddBuff(ModContent.BuffType(), 240); - target.AddBuff(BuffID.CursedInferno, 240); - target.AddBuff(BuffID.Frostburn, 240); - target.AddBuff(BuffID.OnFire, 240); - target.AddBuff(BuffID.Ichor, 240); + target.ExoDebuffs(2f); + + if (projectile.ai[0] == 7f) + { + projectile.velocity *= 0.25f; + } + else if (projectile.ai[0] == 8f) + { + projectile.velocity *= -1f; + } + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.ExoDebuffs(2f); if (projectile.ai[0] == 7f) { diff --git a/Projectiles/Melee/EssenceScythe.cs b/Projectiles/Melee/EssenceScythe.cs index de27177abd..1944665937 100644 --- a/Projectiles/Melee/EssenceScythe.cs +++ b/Projectiles/Melee/EssenceScythe.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Melee projectile.penetrate = 10; projectile.timeLeft = 300; projectile.ignoreWater = true; - aiType = 274; + aiType = ProjectileID.DeathSickle; } public override void AI() diff --git a/Projectiles/Melee/ExoGladComet.cs b/Projectiles/Melee/ExoGladComet.cs index ede9497a67..7ae372dc51 100644 --- a/Projectiles/Melee/ExoGladComet.cs +++ b/Projectiles/Melee/ExoGladComet.cs @@ -1,5 +1,3 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -70,15 +68,12 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 30); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.Ichor, 120); + target.ExoDebuffs(); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.ExoDebuffs(); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Melee/ExoGladProj.cs b/Projectiles/Melee/ExoGladProj.cs index ae2b717f7e..558ddc2dc6 100644 --- a/Projectiles/Melee/ExoGladProj.cs +++ b/Projectiles/Melee/ExoGladProj.cs @@ -1,5 +1,3 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using System; using Terraria; @@ -38,58 +36,26 @@ namespace CalamityMod.Projectiles.Melee } else { - for (int num41 = 0; num41 < 2; num41++) + for (int i = 0; i < 2; i++) { - int dustType = num41 == 0 ? 107 : 234; + int dustType = i == 0 ? 107 : 234; if (Main.rand.NextBool(4)) { dustType = 269; } - Vector2 value8 = Vector2.UnitX * -12f; - value8 = -Vector2.UnitY.RotatedBy((double)(counter * 0.1308997f + (float)num41 * 3.14159274f), default) * value7; - int num42 = Dust.NewDust(projectile.Center, 0, 0, dustType, 0f, 0f, 160, default, 1.5f); - Main.dust[num42].noGravity = true; - Main.dust[num42].position = projectile.Center + value8; - Main.dust[num42].velocity = projectile.velocity; - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 100, default, 0.8f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0f; + Vector2 offset = Vector2.UnitX * -12f; + offset = -Vector2.UnitY.RotatedBy((double)(counter * 0.1308997f + (float)i * MathHelper.Pi), default) * value7; + int exo = Dust.NewDust(projectile.Center, 0, 0, dustType, 0f, 0f, 160, default, 1.5f); + Main.dust[exo].noGravity = true; + Main.dust[exo].position = projectile.Center + offset; + Main.dust[exo].velocity = projectile.velocity; + int dusters = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 100, default, 0.8f); + Main.dust[dusters].noGravity = true; + Main.dust[dusters].velocity *= 0f; } } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 1000f; - bool flag17 = false; - for (int num475 = 0; num475 < Main.npc.Length; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 36f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 1000f, 36f, 20f); } public override void Kill(int timeLeft) @@ -102,66 +68,41 @@ namespace CalamityMod.Projectiles.Melee }); for (int k = 0; k < 4; k++) { - int num = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, dustType, (float)(projectile.direction * 2), 0f, 150, default, 1f); - Main.dust[num].noGravity = true; + int exo = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, dustType, (float)(projectile.direction * 2), 0f, 150, default, 1f); + Main.dust[exo].noGravity = true; } } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - int type = ModContent.ProjectileType(); - int numSwords = Main.rand.Next(1,4); + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + OnHitEffects(target.Center); + target.ExoDebuffs(); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + OnHitEffects(target.Center); + target.ExoDebuffs(); + } + + private void OnHitEffects(Vector2 targetPos) + { float swordKB = projectile.knockBack; - for (int i = 0; i < numSwords; ++i) - { - float startOffsetX = Main.rand.NextFloat(1000f, 1400f) * (Main.rand.NextBool() ? -1f : 1f); - float startOffsetY = Main.rand.NextFloat(80f, 900f) * (Main.rand.NextBool() ? -1f : 1f); - Vector2 startPos = new Vector2(target.Center.X + startOffsetX, target.Center.Y + startOffsetY); - float dx = target.Center.X - startPos.X; - float dy = target.Center.Y - startPos.Y; - - dx += Main.rand.NextFloat(-5f, 5f); - dy += Main.rand.NextFloat(-5f, 5f); - float speed = Main.rand.NextFloat(24f, 30f); - float dist = (float)Math.Sqrt((double)(dx * dx + dy * dy)); - dist = speed / dist; - dx *= dist; - dy *= dist; - Vector2 swordVel = new Vector2(dx, dy); - float angle = Main.rand.NextFloat(MathHelper.TwoPi); - if (projectile.owner == Main.myPlayer) - { - int idx = Projectile.NewProjectile(startPos, swordVel, type, (int)((double)projectile.damage * 0.25), swordKB, projectile.owner, 0f, 0f); - Main.projectile[idx].rotation = angle; - } - } - + int swordDmg = (int)(projectile.damage * 0.25); + int numSwords = Main.rand.Next(1,4); int spearAmt = Main.rand.Next(1,4); - for (int n = 0; n < spearAmt; n++) + if (projectile.owner == Main.myPlayer) { - float x = projectile.position.X + (float)Main.rand.Next(-400, 400); - float y = projectile.position.Y + (float)Main.rand.Next(800, 1000); - Vector2 vector = new Vector2(x, y); - float num13 = projectile.position.X + (float)(projectile.width / 2) - vector.X; - float num14 = projectile.position.Y + (float)(projectile.height / 2) - vector.Y; - num13 += (float)Main.rand.Next(-100, 101); - int num15 = 29; - float num16 = (float)Math.Sqrt((double)(num13 * num13 + num14 * num14)); - num16 = (float)num15 / num16; - num13 *= num16; - num14 *= num16; - int num17 = Projectile.NewProjectile(x, y, num13, num14, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.5), swordKB, projectile.owner, 0f, 0f); - } + for (int i = 0; i < numSwords; ++i) + { + CalamityUtils.ProjectileBarrage(projectile.Center, targetPos, Main.rand.NextBool(), 1000f, 1400f, 80f, 900f, Main.rand.NextFloat(24f, 30f), ModContent.ProjectileType(), swordDmg, swordKB, projectile.owner); + } - target.AddBuff(ModContent.BuffType(), 30); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.Ichor, 120); + for (int n = 0; n < spearAmt; n++) + { + CalamityUtils.ProjectileRain(targetPos, 400f, 100f, -1000f, -800f, 29f, ModContent.ProjectileType(), swordDmg, swordKB, projectile.owner); + } + } } } } diff --git a/Projectiles/Melee/ExoGladSpears.cs b/Projectiles/Melee/ExoGladSpears.cs index 8b1a20bf84..489d2eea50 100644 --- a/Projectiles/Melee/ExoGladSpears.cs +++ b/Projectiles/Melee/ExoGladSpears.cs @@ -1,5 +1,3 @@ -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -166,15 +164,12 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 30); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.Ichor, 120); + target.ExoDebuffs(); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.ExoDebuffs(); } } } diff --git a/Projectiles/Melee/ExoGladiusBeam.cs b/Projectiles/Melee/ExoGladiusBeam.cs index e0b562e115..bebcea157f 100644 --- a/Projectiles/Melee/ExoGladiusBeam.cs +++ b/Projectiles/Melee/ExoGladiusBeam.cs @@ -118,15 +118,15 @@ namespace CalamityMod.Projectiles.Melee projectile.scale += (maxScale - 1) / (float)penetrationAmt; projectile.ai[1] = 5 + Main.rand.Next(-2, 3); - target.AddBuff(ModContent.BuffType(), 30); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.Ichor, 120); + target.ExoDebuffs(); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + projectile.scale += (maxScale - 1) / (float)penetrationAmt; + projectile.ai[1] = 5 + Main.rand.Next(-2, 3); + + target.ExoDebuffs(); } } } diff --git a/Projectiles/Melee/Exobeam.cs b/Projectiles/Melee/Exobeam.cs index 77884b6d39..382ada426d 100644 --- a/Projectiles/Melee/Exobeam.cs +++ b/Projectiles/Melee/Exobeam.cs @@ -1,5 +1,3 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -137,15 +135,12 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 30); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.Ichor, 120); + target.ExoDebuffs(); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.ExoDebuffs(); } public override Color? GetAlpha(Color lightColor) diff --git a/Projectiles/Melee/Exoboom.cs b/Projectiles/Melee/Exoboom.cs index 8b5b528c9e..802afbb5f6 100644 --- a/Projectiles/Melee/Exoboom.cs +++ b/Projectiles/Melee/Exoboom.cs @@ -81,30 +81,26 @@ namespace CalamityMod.Projectiles.Melee num463 *= num466; num464 *= num466; int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); - Main.dust[num467].noGravity = true; - Main.dust[num467].position.X = projectile.Center.X; - Main.dust[num467].position.Y = projectile.Center.Y; - Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); - Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); - Main.dust[num467].velocity.X = num463; - Main.dust[num467].velocity.Y = num464; + Dust dust = Main.dust[num467]; + dust.noGravity = true; + dust.position.X = projectile.Center.X; + dust.position.Y = projectile.Center.Y; + dust.position.X += (float)Main.rand.Next(-10, 11); + dust.position.Y += (float)Main.rand.Next(-10, 11); + dust.velocity.X = num463; + dust.velocity.Y = num464; num462++; } } + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.ExoDebuffs(); + } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 30); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.Ichor, 120); + target.ExoDebuffs(); } } } diff --git a/Projectiles/Melee/Exocomet.cs b/Projectiles/Melee/Exocomet.cs index 4efc5a5ed2..400ab230b9 100644 --- a/Projectiles/Melee/Exocomet.cs +++ b/Projectiles/Melee/Exocomet.cs @@ -90,15 +90,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 30); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.Ichor, 120); + target.ExoDebuffs(); if (target.type == NPCID.TargetDummy) { return; @@ -115,6 +107,21 @@ namespace CalamityMod.Projectiles.Melee CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], healAmt, ModContent.ProjectileType(), 1200f, 1f); } + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.ExoDebuffs(); + float healAmt = (float)damage * 0.01f; + if ((int)healAmt == 0) + { + return; + } + if (Main.player[Main.myPlayer].lifeSteal <= 0f) + { + return; + } + CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], healAmt, ModContent.ProjectileType(), 1200f, 1f); + } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); diff --git a/Projectiles/Melee/GalileosPlanet.cs b/Projectiles/Melee/GalileosPlanet.cs index 07b18d4aa5..3853e7760b 100644 --- a/Projectiles/Melee/GalileosPlanet.cs +++ b/Projectiles/Melee/GalileosPlanet.cs @@ -130,7 +130,7 @@ namespace CalamityMod.Projectiles.Melee Main.dust[num21].velocity *= 2; } } - CalamityUtils.ExplosionGores(projectile, 3); + CalamityUtils.ExplosionGores(projectile.Center, 3); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Melee/GelWave.cs b/Projectiles/Melee/GelWave.cs index c15068673d..996d4c22a3 100644 --- a/Projectiles/Melee/GelWave.cs +++ b/Projectiles/Melee/GelWave.cs @@ -20,7 +20,6 @@ namespace CalamityMod.Projectiles.Melee { projectile.width = 30; projectile.height = 30; - aiType = ProjectileID.FrostWave; projectile.friendly = true; projectile.ignoreWater = true; projectile.melee = true; diff --git a/Projectiles/Melee/GreenBall.cs b/Projectiles/Melee/GreenBall.cs index 5ca2cbf060..f7c99668db 100644 --- a/Projectiles/Melee/GreenBall.cs +++ b/Projectiles/Melee/GreenBall.cs @@ -7,8 +7,6 @@ namespace CalamityMod.Projectiles.Melee { public class GreenBall : ModProjectile { - private int projTime = 15; - public override void SetStaticDefaults() { DisplayName.SetDefault("Green Bag"); @@ -36,14 +34,12 @@ namespace CalamityMod.Projectiles.Melee projectile.alpha = 0; } projectile.rotation = projectile.velocity.X * 0.04f; - projTime--; - if (projTime == 0) + if (projectile.timeLeft % 15 == 0) { if (projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.35f, projectile.velocity.Y * 0.35f, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.75), projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.35f, projectile.velocity.Y * 0.35f, ModContent.ProjectileType(), (int)(projectile.damage * 0.75), projectile.knockBack, projectile.owner, 0f, 0f); } - projTime = 15; } } diff --git a/Projectiles/Melee/HellionSpike.cs b/Projectiles/Melee/HellionSpike.cs index a682079272..64c2de990b 100644 --- a/Projectiles/Melee/HellionSpike.cs +++ b/Projectiles/Melee/HellionSpike.cs @@ -56,25 +56,27 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.immune[projectile.owner] = 8; + OnHitEffects(target.Center, crit); target.AddBuff(BuffID.Venom, 300); - if (crit) - { - float xPos = projectile.position.X + 800 * Main.rand.NextBool(2).ToDirectionInt(); - float yPos = projectile.position.Y + Main.rand.Next(-800, 801); - Vector2 spawnPosition = new Vector2(xPos, yPos); - Vector2 velocity = target.position - spawnPosition; - float dir = 10 / spawnPosition.X; - velocity.X *= dir * 150; - velocity.Y *= dir * 150; - velocity.X = MathHelper.Clamp(velocity.X, -15f, 15f); - velocity.Y = MathHelper.Clamp(velocity.Y, -15f, 15f); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + OnHitEffects(target.Center, crit); + target.AddBuff(BuffID.Venom, 300); + } + + private void OnHitEffects(Vector2 targetPos, bool crit) + { + if (crit) + { if (projectile.owner == Main.myPlayer) { - int petal = Projectile.NewProjectile(spawnPosition, velocity, ProjectileID.FlowerPetal, (int)(projectile.damage * 0.5), 2f, projectile.owner); - Main.projectile[petal].Calamity().forceMelee = true; - Main.projectile[petal].localNPCHitCooldown = -1; + Projectile petal = CalamityUtils.ProjectileBarrage(projectile.Center, targetPos, Main.rand.NextBool(), 800f, 800f, 0f, 800f, 10f, ProjectileID.FlowerPetal, (int)(projectile.damage * 0.5), projectile.knockBack * 0.5f, projectile.owner, true); + petal.Calamity().forceMelee = true; + petal.localNPCHitCooldown = -1; } - } - } + } + } } } diff --git a/Projectiles/Melee/InsidiousHarpoon.cs b/Projectiles/Melee/InsidiousHarpoon.cs index 5dff9df1da..f395b7deba 100644 --- a/Projectiles/Melee/InsidiousHarpoon.cs +++ b/Projectiles/Melee/InsidiousHarpoon.cs @@ -55,7 +55,7 @@ namespace CalamityMod.Projectiles.Melee projectile.rotation += projectile.spriteDirection * MathHelper.ToRadians(45f); } //Sticky Behaviour - CalamityUtils.StickyProjAI(projectile, 15); + projectile.StickyProjAI(15); if (projectile.ai[0] == 2f) { projectile.velocity *= 0f; @@ -64,7 +64,7 @@ namespace CalamityMod.Projectiles.Melee public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - CalamityUtils.ModifyHitNPCSticky(projectile, 20, true); + projectile.ModifyHitNPCSticky(20, true); } public override bool OnTileCollide(Vector2 oldVelocity) diff --git a/Projectiles/Melee/MarniteObliteratorProj.cs b/Projectiles/Melee/MarniteObliteratorProj.cs index f685f7f62a..ae875ee8fc 100644 --- a/Projectiles/Melee/MarniteObliteratorProj.cs +++ b/Projectiles/Melee/MarniteObliteratorProj.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Melee projectile.hide = true; projectile.ownerHitCheck = true; projectile.melee = true; - projectile.Calamity().trueMelee = true; + //projectile.Calamity().trueMelee = true; } } } diff --git a/Projectiles/Melee/MeldGreatswordBigProjectile.cs b/Projectiles/Melee/MeldGreatswordBigProjectile.cs new file mode 100644 index 0000000000..ebbeb8d830 --- /dev/null +++ b/Projectiles/Melee/MeldGreatswordBigProjectile.cs @@ -0,0 +1,64 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class MeldGreatswordBigProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; + } + + public override void SetDefaults() + { + projectile.width = 18; + projectile.height = 18; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.melee = true; + projectile.timeLeft = 600; + } + + public override void AI() + { + projectile.rotation = projectile.velocity.ToRotation(); + Vector2 value7 = new Vector2(6f, 12f); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] == 48f) + { + projectile.localAI[0] = 0f; + } + else + { + for (int num41 = 0; num41 < 2; num41++) + { + Vector2 value8 = Vector2.UnitX * -15f; + value8 = -Vector2.UnitY.RotatedBy((double)(projectile.localAI[0] * 0.1308997f + (float)num41 * 3.14159274f), default) * value7; + int num42 = Dust.NewDust(projectile.Center, 0, 0, 27, 0f, 0f, 160, default, 1f); + Main.dust[num42].scale = 1f; + Main.dust[num42].noGravity = true; + Main.dust[num42].position = projectile.Center + value8; + Main.dust[num42].velocity = projectile.velocity; + } + } + + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 27, 0f, 0f, 100, default, 0.8f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0f; + + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 400f, 12f, 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/Melee/MeldGreatswordBigProjectile.png b/Projectiles/Melee/MeldGreatswordBigProjectile.png new file mode 100644 index 0000000000..d2e1ad5ddb Binary files /dev/null and b/Projectiles/Melee/MeldGreatswordBigProjectile.png differ diff --git a/Projectiles/Melee/PlasmaBall.cs b/Projectiles/Melee/MeldGreatswordMediumProjectile.cs similarity index 74% rename from Projectiles/Melee/PlasmaBall.cs rename to Projectiles/Melee/MeldGreatswordMediumProjectile.cs index fd5f2a8405..0c511c7c71 100644 --- a/Projectiles/Melee/PlasmaBall.cs +++ b/Projectiles/Melee/MeldGreatswordMediumProjectile.cs @@ -1,15 +1,18 @@ using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { - public class PlasmaBall : ModProjectile + public class MeldGreatswordMediumProjectile : ModProjectile { public override void SetStaticDefaults() { - DisplayName.SetDefault("Ball"); + DisplayName.SetDefault("Bolt"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; } public override void SetDefaults() @@ -24,6 +27,7 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { + projectile.rotation = projectile.velocity.ToRotation(); Vector2 value7 = new Vector2(6f, 12f); projectile.localAI[0] += 1f; if (projectile.localAI[0] == 48f) @@ -50,5 +54,11 @@ namespace CalamityMod.Projectiles.Melee CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 400f, 12f, 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/Melee/MeldGreatswordMediumProjectile.png b/Projectiles/Melee/MeldGreatswordMediumProjectile.png new file mode 100644 index 0000000000..90aede20e7 Binary files /dev/null and b/Projectiles/Melee/MeldGreatswordMediumProjectile.png differ diff --git a/Projectiles/Melee/MeldGreatswordSmallProjectile.cs b/Projectiles/Melee/MeldGreatswordSmallProjectile.cs new file mode 100644 index 0000000000..c472068f63 --- /dev/null +++ b/Projectiles/Melee/MeldGreatswordSmallProjectile.cs @@ -0,0 +1,64 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class MeldGreatswordSmallProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; + } + + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.melee = true; + projectile.timeLeft = 600; + } + + public override void AI() + { + projectile.rotation = projectile.velocity.ToRotation(); + Vector2 value7 = new Vector2(6f, 12f); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] == 48f) + { + projectile.localAI[0] = 0f; + } + else + { + for (int num41 = 0; num41 < 2; num41++) + { + Vector2 value8 = Vector2.UnitX * -15f; + value8 = -Vector2.UnitY.RotatedBy((double)(projectile.localAI[0] * 0.1308997f + (float)num41 * 3.14159274f), default) * value7; + int num42 = Dust.NewDust(projectile.Center, 0, 0, 27, 0f, 0f, 160, default, 1f); + Main.dust[num42].scale = 1f; + Main.dust[num42].noGravity = true; + Main.dust[num42].position = projectile.Center + value8; + Main.dust[num42].velocity = projectile.velocity; + } + } + + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 27, 0f, 0f, 100, default, 0.8f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0f; + + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 400f, 12f, 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/Melee/MeldGreatswordSmallProjectile.png b/Projectiles/Melee/MeldGreatswordSmallProjectile.png new file mode 100644 index 0000000000..7930994094 Binary files /dev/null and b/Projectiles/Melee/MeldGreatswordSmallProjectile.png differ diff --git a/Projectiles/Melee/MurasamaSlash.cs b/Projectiles/Melee/MurasamaSlash.cs index 9792dc8e3b..51fdcb2818 100644 --- a/Projectiles/Melee/MurasamaSlash.cs +++ b/Projectiles/Melee/MurasamaSlash.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Melee projectile.ownerHitCheck = true; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 0; - projectile.Calamity().trueMelee = true; + //projectile.Calamity().trueMelee = true; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Melee/PlagueBeeDust.cs b/Projectiles/Melee/PlagueBeeDust.cs index 78ebebf984..148a617f39 100644 --- a/Projectiles/Melee/PlagueBeeDust.cs +++ b/Projectiles/Melee/PlagueBeeDust.cs @@ -7,126 +7,123 @@ using Microsoft.Xna.Framework.Graphics; namespace CalamityMod.Projectiles.Melee { - public class PlagueBeeDust : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dust"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public class PlagueBeeDust : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dust"); + Main.projFrames[projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 70; - projectile.height = 70; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.melee = true; - projectile.penetrate = -1; - projectile.extraUpdates = 3; - projectile.timeLeft = 150; - } + public override void SetDefaults() + { + projectile.width = 70; + projectile.height = 70; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.melee = true; + projectile.penetrate = -1; + projectile.extraUpdates = 3; + projectile.timeLeft = 150; + projectile.alpha = 100; + } - public override void AI() - { - projectile.ai[1]++; - Lighting.AddLight(projectile.Center, 0.05f, 0.4f, 0f); - if (projectile.ai[1] < 60f) - { - if (projectile.ai[0] > 7f) - { - float num296 = 1f; - if (projectile.ai[0] == 8f) - { - num296 = 0.25f; - } - else if (projectile.ai[0] == 9f) - { - num296 = 0.5f; - } - else if (projectile.ai[0] == 10f) - { - num296 = 0.75f; - } - projectile.ai[0] += 1f; - if (projectile.ai[0] % 2f == 0f) - { - int spawnX = (int)(projectile.width / 2); - int spawnY = (int)(projectile.width / 2); - int bee = Projectile.NewProjectile(projectile.Center.X + (float)Main.rand.Next(-spawnX, spawnX), projectile.Center.Y + (float)Main.rand.Next(-spawnY, spawnY), - projectile.velocity.X, projectile.velocity.Y, Main.player[projectile.owner].beeType(), - Main.player[projectile.owner].beeDamage(projectile.damage / 3), Main.player[projectile.owner].beeKB(0f), projectile.owner, 0f, 0f); - Main.projectile[bee].penetrate = 1; + public override void AI() + { + Player player = Main.player[projectile.owner]; + projectile.ai[1]++; + Lighting.AddLight(projectile.Center, 0.05f, 0.4f, 0f); + if (projectile.ai[1] < 60f) + { + if (projectile.ai[0] > 7f) + { + float scalar = 1f; + if (projectile.ai[0] == 8f) + { + scalar = 0.25f; + } + else if (projectile.ai[0] == 9f) + { + scalar = 0.5f; + } + else if (projectile.ai[0] == 10f) + { + scalar = 0.75f; + } + projectile.ai[0] += 1f; + if (projectile.ai[0] % 2f == 0f) + { + int spawnX = (int)(projectile.width / 2); + int spawnY = (int)(projectile.width / 2); + int bee = Projectile.NewProjectile(projectile.Center.X + (float)Main.rand.Next(-spawnX, spawnX), projectile.Center.Y + (float)Main.rand.Next(-spawnY, spawnY), projectile.velocity.X, projectile.velocity.Y, player.beeType(), player.beeDamage(projectile.damage / 3), player.beeKB(0f), projectile.owner, 0f, 0f); + Main.projectile[bee].penetrate = 1; Main.projectile[bee].Calamity().forceMelee = true; - } - int num297 = 89; - //Dust - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); - Dust dust = Main.dust[num299]; - if (Main.rand.NextBool(3)) - { - dust.noGravity = true; - dust.scale *= 1.8f; - dust.velocity.X *= 2f; - dust.velocity.Y *= 2f; - } - else - { - dust.scale *= 1.3f; - } - dust.velocity.X *= 1.2f; - dust.velocity.Y *= 1.2f; - dust.scale *= num296; + } + //Dust + int dustType = 89; + int plague = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); + Dust dust = Main.dust[plague]; + if (Main.rand.NextBool(3)) + { + dust.noGravity = true; + dust.scale *= 1.8f; + dust.velocity.X *= 2f; + dust.velocity.Y *= 2f; + } + else + { + dust.scale *= 1.3f; + } + dust.velocity.X *= 1.2f; + dust.velocity.Y *= 1.2f; + dust.scale *= scalar; + } + else + { + projectile.ai[0] += 1f; + } + } + else + { + projectile.damage = (int)(projectile.damage * 0.6); + projectile.velocity *= 0.85f; + //Fade out + if (projectile.alpha < 255) + projectile.alpha += 5; + if (projectile.alpha >= 255) + projectile.Kill(); + } - } - else - { - projectile.ai[0] += 1f; - } - } - else - { - projectile.damage = 0; - projectile.velocity *= 0.99f; - //Fade out - if (projectile.alpha < 255) - projectile.alpha += 5; - if (projectile.alpha > 255) - projectile.alpha = 255; - if (projectile.ai[1] >= 150) - projectile.Kill(); - } + //Rotation + projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); + projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); - //Rotation - projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); - projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); + //Animation + projectile.frameCounter++; + if (projectile.frameCounter > 8) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + } - //Animation - projectile.frameCounter++; - if (projectile.frameCounter > 8) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 8; + target.AddBuff(ModContent.BuffType(), 180); + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 8; - target.AddBuff(ModContent.BuffType(), 180); - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + } } diff --git a/Projectiles/Melee/PlagueDust.cs b/Projectiles/Melee/PlagueDust.cs index 3eb0abf276..5d1f2aa715 100644 --- a/Projectiles/Melee/PlagueDust.cs +++ b/Projectiles/Melee/PlagueDust.cs @@ -6,114 +6,113 @@ using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { - public class PlagueDust : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dust"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public class PlagueDust : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dust"); + Main.projFrames[projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 70; - projectile.height = 70; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.melee = true; - projectile.penetrate = -1; - projectile.extraUpdates = 3; - projectile.timeLeft = 150; - } + public override void SetDefaults() + { + projectile.width = 70; + projectile.height = 70; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.melee = true; + projectile.penetrate = -1; + projectile.extraUpdates = 3; + projectile.timeLeft = 150; + projectile.alpha = 100; + } - public override void AI() - { - projectile.ai[1]++; - Lighting.AddLight(projectile.Center, 0.05f, 0.4f, 0f); - if (projectile.ai[1] < 60) - { - if (projectile.ai[0] > 7f) - { - float num296 = 1f; - if (projectile.ai[0] == 8f) - { - num296 = 0.25f; - } - else if (projectile.ai[0] == 9f) - { - num296 = 0.5f; - } - else if (projectile.ai[0] == 10f) - { - num296 = 0.75f; - } - projectile.ai[0] += 1f; - int num297 = 89; - //Dust - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); - Dust dust = Main.dust[num299]; - if (Main.rand.NextBool(3)) - { - dust.noGravity = true; - dust.scale *= 1.8f; - dust.velocity.X *= 2f; - dust.velocity.Y *= 2f; - } - else - { - dust.scale *= 1.3f; - } - dust.velocity.X *= 1.2f; - dust.velocity.Y *= 1.2f; - dust.scale *= num296; - } - else - { - projectile.ai[0] += 1f; - } - } - else - { - projectile.damage = 0; - projectile.velocity *= 0.99f; - //Fade out - if (projectile.alpha < 255) - projectile.alpha += 5; - if (projectile.alpha > 255) - projectile.alpha = 255; - if (projectile.ai[1] >= 150) - projectile.Kill(); - } - //Rotation - projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); - projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); + public override void AI() + { + projectile.ai[1]++; + Lighting.AddLight(projectile.Center, 0.05f, 0.4f, 0f); + if (projectile.ai[1] < 60) + { + if (projectile.ai[0] > 7f) + { + float scalar = 1f; + if (projectile.ai[0] == 8f) + { + scalar = 0.25f; + } + else if (projectile.ai[0] == 9f) + { + scalar = 0.5f; + } + else if (projectile.ai[0] == 10f) + { + scalar = 0.75f; + } + projectile.ai[0] += 1f; + //Dust + int dustType = 89; + int plague = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); + Dust dust = Main.dust[plague]; + if (Main.rand.NextBool(3)) + { + dust.noGravity = true; + dust.scale *= 1.8f; + dust.velocity.X *= 2f; + dust.velocity.Y *= 2f; + } + else + { + dust.scale *= 1.3f; + } + dust.velocity.X *= 1.2f; + dust.velocity.Y *= 1.2f; + dust.scale *= scalar; + } + else + { + projectile.ai[0] += 1f; + } + } + else + { + projectile.damage = (int)(projectile.damage * 0.6); + projectile.velocity *= 0.85f; + //Fade out + if (projectile.alpha < 255) + projectile.alpha += 5; + if (projectile.alpha >= 255) + projectile.Kill(); + } + //Rotation + projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); + projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); - //Animation - projectile.frameCounter++; - if (projectile.frameCounter > 8) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - } + //Animation + projectile.frameCounter++; + if (projectile.frameCounter > 8) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 5; - target.AddBuff(ModContent.BuffType(), 120); - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 5; + target.AddBuff(ModContent.BuffType(), 120); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + } } diff --git a/Projectiles/Melee/PlasmaBall.png b/Projectiles/Melee/PlasmaBall.png deleted file mode 100644 index 139ef2e822..0000000000 Binary files a/Projectiles/Melee/PlasmaBall.png and /dev/null differ diff --git a/Projectiles/Melee/PrismaticWave.cs b/Projectiles/Melee/PrismaticWave.cs index 130da32740..eec9f82e40 100644 --- a/Projectiles/Melee/PrismaticWave.cs +++ b/Projectiles/Melee/PrismaticWave.cs @@ -50,7 +50,6 @@ namespace CalamityMod.Projectiles.Melee { projectile.width = 36; projectile.height = 36; - aiType = ProjectileID.FrostWave; projectile.friendly = true; projectile.ignoreWater = true; projectile.ranged = true; diff --git a/Projectiles/Melee/ProfanedSwordProj.cs b/Projectiles/Melee/ProfanedSwordProj.cs index dbaef5da37..3e8e17d725 100644 --- a/Projectiles/Melee/ProfanedSwordProj.cs +++ b/Projectiles/Melee/ProfanedSwordProj.cs @@ -30,14 +30,14 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + MathHelper.ToRadians(45f); if (Main.rand.NextBool(4)) { Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, (int)CalamityDusts.Brimstone, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); } if (projectile.spriteDirection == -1) { - projectile.rotation -= 1.57f; + projectile.rotation -= MathHelper.ToRadians(90f); } } diff --git a/Projectiles/Melee/ProfanedSwordProj.png b/Projectiles/Melee/ProfanedSwordProj.png index 0967c869b9..36dfb30fbe 100644 Binary files a/Projectiles/Melee/ProfanedSwordProj.png and b/Projectiles/Melee/ProfanedSwordProj.png differ diff --git a/Projectiles/Melee/RedBall.cs b/Projectiles/Melee/RedBall.cs index a489dc1a20..b3da2a6d7f 100644 --- a/Projectiles/Melee/RedBall.cs +++ b/Projectiles/Melee/RedBall.cs @@ -7,8 +7,6 @@ namespace CalamityMod.Projectiles.Melee { public class RedBall : ModProjectile { - private int projTime = 15; - public override void SetStaticDefaults() { DisplayName.SetDefault("Red Bag"); @@ -36,14 +34,12 @@ namespace CalamityMod.Projectiles.Melee projectile.alpha = 0; } projectile.rotation = projectile.velocity.X * 0.04f; - projTime--; - if (projTime == 0) + if (projectile.timeLeft % 15 == 0) { if (projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.35f, projectile.velocity.Y * 0.35f, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.75), projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.35f, projectile.velocity.Y * 0.35f, ModContent.ProjectileType(), (int)(projectile.damage * 0.75), projectile.knockBack, projectile.owner, 0f, 0f); } - projTime = 15; } } diff --git a/Projectiles/Melee/RedtideWhirlpool.cs b/Projectiles/Melee/RedtideWhirlpool.cs index 6dfcb4d07f..3e80bfc60c 100644 --- a/Projectiles/Melee/RedtideWhirlpool.cs +++ b/Projectiles/Melee/RedtideWhirlpool.cs @@ -58,7 +58,7 @@ namespace CalamityMod.Projectiles.Melee { projectile.frame = 0; } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Melee/RoxSlam.cs b/Projectiles/Melee/RoxSlam.cs index f2aeb687ed..c41919ffb6 100644 --- a/Projectiles/Melee/RoxSlam.cs +++ b/Projectiles/Melee/RoxSlam.cs @@ -1,7 +1,7 @@ using Microsoft.Xna.Framework; using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { @@ -9,8 +9,8 @@ namespace CalamityMod.Projectiles.Melee { public override void SetDefaults() { - projectile.width = 50; - projectile.height = 50; + projectile.width = 10; + projectile.height = 35; projectile.friendly = true; projectile.melee = true; projectile.timeLeft = 400; @@ -19,29 +19,39 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - Player player = Main.player[Main.myPlayer]; + Player player = Main.player[projectile.owner]; //Kills the projectile if the alt attack ended if (player.itemAnimation == 0) { projectile.Kill(); } - //Makes the projectiles follow the player - projectile.velocity.X = player.velocity.X; - projectile.velocity.Y = player.velocity.Y; + //Makes the projectiles track the player + float posX; + float posY = player.Center.Y + 63; + // Makes the projectile follow the proper position on the X axis + if (player.direction == 1) + { + posX = player.Center.X + 6; + } + else + { + posX = player.Center.X - 8; + } + projectile.Center = new Vector2(posX, posY - (player.height / 10f)); } public override bool OnTileCollide(Vector2 oldVelocity) { //This will only happen if the cooldown was full - if (projectile.ai[0] == 1) + if (projectile.ai[0] == 1 && Main.myPlayer == projectile.owner) { - Player player = Main.player[Main.myPlayer]; + Player player = Main.player[projectile.owner]; //Bounce player.velocity.Y = -18f; //reset player fall damage player.fallStart = (int)(player.position.Y / 16f); //Spawns the shockwave - Projectile.NewProjectile(projectile.position.X + 25, projectile.position.Y + 25, 0f, 0f, ModContent.ProjectileType(), 300, 12, projectile.owner); + Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), 300, 12, projectile.owner); Main.PlaySound(SoundID.Item14, projectile.position); projectile.Kill(); //Pretty things @@ -55,9 +65,9 @@ namespace CalamityMod.Projectiles.Melee return false; } //If the cooldown wasnt full, just bounce - else + else if (Main.myPlayer == projectile.owner) { - Player player = Main.player[Main.myPlayer]; + Player player = Main.player[projectile.owner]; player.velocity.Y = -14f; //reset player fall damage player.fallStart = (int)(player.position.Y / 16f); @@ -66,6 +76,7 @@ namespace CalamityMod.Projectiles.Melee return false; } + return false; } } } diff --git a/Projectiles/Melee/SHIV.cs b/Projectiles/Melee/SHIV.cs index 1072dba0d2..40091aee13 100644 --- a/Projectiles/Melee/SHIV.cs +++ b/Projectiles/Melee/SHIV.cs @@ -18,29 +18,31 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; + projectile.width = 20; + projectile.height = 20; projectile.friendly = true; projectile.melee = true; projectile.penetrate = 1; projectile.tileCollide = false; projectile.timeLeft = 600; projectile.aiStyle = 27; + projectile.extraUpdates = 1; } public override void AI() { - projectile.velocity.X *= 1.075f; - projectile.velocity.Y *= 1.075f; - int num250 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, (float)(projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.3f); - Main.dust[num250].noGravity = true; - Main.dust[num250].velocity *= 0f; + if (projectile.velocity.Length() < 25f && projectile.timeLeft % 2 == 0) + projectile.velocity *= 1.04f; + + int rainbow = Dust.NewDust(projectile.position, projectile.width, projectile.height, 66, (float)(projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.3f); + Main.dust[rainbow].noGravity = true; + Main.dust[rainbow].velocity = Vector2.Zero; } public override void Kill(int timeLeft) { - int num = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 66, (float)(projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); - Main.dust[num].noGravity = true; + int rainbow = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 66, (float)(projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + Main.dust[rainbow].noGravity = true; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Melee/ShortBeam.cs b/Projectiles/Melee/ShortBeam.cs index a97d2516d8..df133f307b 100644 --- a/Projectiles/Melee/ShortBeam.cs +++ b/Projectiles/Melee/ShortBeam.cs @@ -27,7 +27,6 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.2f / 255f, 0f, (255 - projectile.alpha) * 0.2f / 255f); - projectile.velocity.Y += projectile.ai[0]; if (Main.rand.NextBool(5)) { Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 73, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); diff --git a/Projectiles/Melee/ShortNightBeam.cs b/Projectiles/Melee/ShortNightBeam.cs index 8d71bb8209..b289cca935 100644 --- a/Projectiles/Melee/ShortNightBeam.cs +++ b/Projectiles/Melee/ShortNightBeam.cs @@ -27,7 +27,6 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { Lighting.AddLight(projectile.Center, 0f, (255 - projectile.alpha) * 0.5f / 255f, (255 - projectile.alpha) * 0.1f / 255f); - projectile.velocity.Y += projectile.ai[0]; if (Main.rand.NextBool(5)) { Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 21, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); diff --git a/Projectiles/Melee/ShortTerraBeam.cs b/Projectiles/Melee/ShortTerraBeam.cs index 846387995b..d959cc1355 100644 --- a/Projectiles/Melee/ShortTerraBeam.cs +++ b/Projectiles/Melee/ShortTerraBeam.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { projectile.width = 20; - projectile.height = 6; + projectile.height = 20; projectile.aiStyle = 27; projectile.friendly = true; projectile.melee = true; diff --git a/Projectiles/Melee/Spears/AmidiasTridentProj.cs b/Projectiles/Melee/Spears/AmidiasTridentProj.cs index 466458cc4d..e6ed3edefe 100644 --- a/Projectiles/Melee/Spears/AmidiasTridentProj.cs +++ b/Projectiles/Melee/Spears/AmidiasTridentProj.cs @@ -25,8 +25,9 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.penetrate = -1; projectile.ownerHitCheck = true; projectile.hide = true; - projectile.Calamity().trueMelee = true; + //projectile.Calamity().trueMelee = true; } + public override float InitialSpeed => 3f; public override float ReelbackSpeed => 1f; public override float ForwardSpeed => 0.75f; diff --git a/Projectiles/Melee/Spears/AstralPikeProj.cs b/Projectiles/Melee/Spears/AstralPikeProj.cs index e320763c27..3dcb01869d 100644 --- a/Projectiles/Melee/Spears/AstralPikeProj.cs +++ b/Projectiles/Melee/Spears/AstralPikeProj.cs @@ -29,8 +29,9 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.ignoreWater = true; projectile.penetrate = -1; projectile.ownerHitCheck = true; - projectile.Calamity().trueMelee = true; + //projectile.Calamity().trueMelee = true; } + public override float InitialSpeed => 3f; public override float ReelbackSpeed => 2.4f; public override float ForwardSpeed => 0.95f; diff --git a/Projectiles/Melee/Spears/BansheeHookProj.cs b/Projectiles/Melee/Spears/BansheeHookProj.cs index 2f843b5afd..0c3f58f8ac 100644 --- a/Projectiles/Melee/Spears/BansheeHookProj.cs +++ b/Projectiles/Melee/Spears/BansheeHookProj.cs @@ -29,8 +29,9 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 2; projectile.alpha = 255; - projectile.Calamity().trueMelee = true; + //projectile.Calamity().trueMelee = true; } + public override SpearType SpearAiType => SpearType.GhastlyGlaiveSpear; public override float TravelSpeed => 22f; public override Action EffectBeforeReelback => (proj) => diff --git a/Projectiles/Melee/Spears/BrimlanceProj.cs b/Projectiles/Melee/Spears/BrimlanceProj.cs index dffb04c169..56bf8f0efd 100644 --- a/Projectiles/Melee/Spears/BrimlanceProj.cs +++ b/Projectiles/Melee/Spears/BrimlanceProj.cs @@ -26,8 +26,9 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.penetrate = -1; projectile.ownerHitCheck = true; projectile.hide = true; - projectile.Calamity().trueMelee = true; + //projectile.Calamity().trueMelee = true; } + public override float InitialSpeed => 3f; public override float ReelbackSpeed => 2.4f; public override float ForwardSpeed => 0.95f; diff --git a/Projectiles/Melee/Spears/DiseasedPikeSpear.cs b/Projectiles/Melee/Spears/DiseasedPikeSpear.cs index d5cd3728fd..23764ae2ef 100644 --- a/Projectiles/Melee/Spears/DiseasedPikeSpear.cs +++ b/Projectiles/Melee/Spears/DiseasedPikeSpear.cs @@ -24,8 +24,9 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.ignoreWater = true; projectile.penetrate = -1; projectile.ownerHitCheck = true; - projectile.Calamity().trueMelee = true; + //projectile.Calamity().trueMelee = true; } + public override float InitialSpeed => 3f; public override float ReelbackSpeed => 2.4f; public override float ForwardSpeed => 0.95f; diff --git a/Projectiles/Melee/Spears/EarthenPikeSpear.cs b/Projectiles/Melee/Spears/EarthenPikeSpear.cs index a7cd0ea890..940739a1db 100644 --- a/Projectiles/Melee/Spears/EarthenPikeSpear.cs +++ b/Projectiles/Melee/Spears/EarthenPikeSpear.cs @@ -25,8 +25,9 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.ignoreWater = true; projectile.penetrate = -1; projectile.ownerHitCheck = true; - projectile.Calamity().trueMelee = true; + //projectile.Calamity().trueMelee = true; } + public override float InitialSpeed => 3f; public override float ReelbackSpeed => 2.4f; public override float ForwardSpeed => 0.95f; diff --git a/Projectiles/Melee/Spears/ExsanguinationLanceProjectile.cs b/Projectiles/Melee/Spears/ExsanguinationLanceProjectile.cs index 0b923b49cb..47f5399f4e 100644 --- a/Projectiles/Melee/Spears/ExsanguinationLanceProjectile.cs +++ b/Projectiles/Melee/Spears/ExsanguinationLanceProjectile.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.ignoreWater = true; projectile.penetrate = -1; projectile.ownerHitCheck = true; - projectile.Calamity().trueMelee = true; + //projectile.Calamity().trueMelee = true; } public override float InitialSpeed => 3f; public override float ReelbackSpeed => 2.4f; @@ -38,17 +38,29 @@ namespace CalamityMod.Projectiles.Melee.Spears if (Main.rand.NextBool(5)) Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, Main.rand.NextBool(3) ? 16 : 127, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - Vector2 goreVec = new Vector2(projectile.position.X + (float)(projectile.width / 2) + projectile.velocity.X, projectile.position.Y + (float)(projectile.height / 2) + projectile.velocity.Y); + Vector2 goreVec = projectile.Center + projectile.velocity; if (Main.rand.NextBool(8)) { int smoke = Gore.NewGore(goreVec, default, Main.rand.Next(375, 378), 1f); Main.gore[smoke].behindTiles = true; } } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.immune[projectile.owner] = 6; + OnHitEffects(target.Center, crit); target.AddBuff(BuffID.OnFire, 300); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + OnHitEffects(target.Center, crit); + target.AddBuff(BuffID.OnFire, 300); + } + + private void OnHitEffects(Vector2 targetPos, bool crit) + { if (projectile.owner == Main.myPlayer) { int boom = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); @@ -58,20 +70,12 @@ namespace CalamityMod.Projectiles.Melee.Spears { for (int i = 0; i < 2; i++) { - float xPos = projectile.position.X + 800f * Main.rand.NextBool(2).ToDirectionInt(); - Vector2 spawnPosition = new Vector2(xPos, projectile.position.Y - Main.rand.Next(-800, 801)); - float speedX = target.position.X - spawnPosition.X; - float speedY = target.position.Y - spawnPosition.Y; - float magnitude = (float)Math.Sqrt(speedX * speedX + speedY * speedY); - magnitude = 10f / xPos; - speedX *= magnitude * 150; - speedY *= magnitude * 150; - speedX = MathHelper.Clamp(speedX, -15f, 15f); - speedY = MathHelper.Clamp(speedY, -15f, 15f); - if (projectile.owner == Main.myPlayer) - Projectile.NewProjectile(spawnPosition.X, spawnPosition.Y, speedX, speedY, ModContent.ProjectileType(), (int)(projectile.damage * 0.5), 2f, projectile.owner); - } - } + if (projectile.owner == Main.myPlayer) + { + CalamityUtils.ProjectileBarrage(projectile.Center, targetPos, Main.rand.NextBool(), 800f, 800f, 0f, 800f, 10f, ModContent.ProjectileType(), (int)(projectile.damage * 0.5), 2f, projectile.owner, true); + } + } + } } } } diff --git a/Projectiles/Melee/Spears/FulgurationHalberdProj.cs b/Projectiles/Melee/Spears/FulgurationHalberdProj.cs index 6d4e771956..839d0b0979 100644 --- a/Projectiles/Melee/Spears/FulgurationHalberdProj.cs +++ b/Projectiles/Melee/Spears/FulgurationHalberdProj.cs @@ -25,8 +25,9 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.ignoreWater = true; projectile.penetrate = -1; projectile.ownerHitCheck = true; - projectile.Calamity().trueMelee = true; + //projectile.Calamity().trueMelee = true; } + public override float InitialSpeed => 3f; public override float ReelbackSpeed => 2.4f; public override float ForwardSpeed => 0.95f; diff --git a/Projectiles/Melee/Spears/GildedProboscisProj.cs b/Projectiles/Melee/Spears/GildedProboscisProj.cs index e0c17d0443..1e94a744d9 100644 --- a/Projectiles/Melee/Spears/GildedProboscisProj.cs +++ b/Projectiles/Melee/Spears/GildedProboscisProj.cs @@ -26,9 +26,10 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.ownerHitCheck = true; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 1; - projectile.Calamity().trueMelee = true; + //projectile.Calamity().trueMelee = true; } - // These numbers sure are common, huh? + + // These numbers sure are common, huh? yeah, they are public override float InitialSpeed => 3f; public override float ReelbackSpeed => 2.4f; public override float ForwardSpeed => 0.95f; diff --git a/Projectiles/Melee/Spears/GoldplumeSpearProjectile.cs b/Projectiles/Melee/Spears/GoldplumeSpearProjectile.cs index 1774c09694..1df1536735 100644 --- a/Projectiles/Melee/Spears/GoldplumeSpearProjectile.cs +++ b/Projectiles/Melee/Spears/GoldplumeSpearProjectile.cs @@ -23,8 +23,9 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.ignoreWater = true; projectile.penetrate = -1; projectile.ownerHitCheck = true; - projectile.Calamity().trueMelee = true; + //projectile.Calamity().trueMelee = true; } + public override float InitialSpeed => 3f; public override float ReelbackSpeed => 1.1f; public override float ForwardSpeed => 0.95f; diff --git a/Projectiles/Melee/Spears/HellionFlowerSpearProjectile.cs b/Projectiles/Melee/Spears/HellionFlowerSpearProjectile.cs index e2852b4045..f4970d16a2 100644 --- a/Projectiles/Melee/Spears/HellionFlowerSpearProjectile.cs +++ b/Projectiles/Melee/Spears/HellionFlowerSpearProjectile.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.ignoreWater = true; projectile.penetrate = -1; projectile.ownerHitCheck = true; - projectile.Calamity().trueMelee = true; + //projectile.Calamity().trueMelee = true; } public override float InitialSpeed => 3f; @@ -37,27 +37,29 @@ namespace CalamityMod.Projectiles.Melee.Spears { Projectile.NewProjectile(projectile.Center.X + projectile.velocity.X, projectile.Center.Y + projectile.velocity.Y, projectile.velocity.X * 2.4f, projectile.velocity.Y * 2.4f, ModContent.ProjectileType(), (int)(projectile.damage * 0.65), projectile.knockBack * 0.85f, projectile.owner, 0f, 0f); }; - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 8; - target.AddBuff(BuffID.Venom, 300); + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 8; + OnHitEffects(target.Center, crit); + target.AddBuff(BuffID.Venom, 300); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + OnHitEffects(target.Center, crit); + target.AddBuff(BuffID.Venom, 300); + } + + private void OnHitEffects(Vector2 targetPos, bool crit) + { if (crit) { - float xPos = projectile.position.X + 800f * Main.rand.NextBool(2).ToDirectionInt(); - Vector2 spawnPosition = new Vector2(xPos, projectile.position.Y - Main.rand.Next(-800, 801)); - float speedX = target.position.X - spawnPosition.X; - float speedY = target.position.Y - spawnPosition.Y; - float magnitude = (float)Math.Sqrt(speedX * speedX + speedY * speedY); - magnitude = 10f / xPos; - speedX *= magnitude * 150; - speedY *= magnitude * 150; - speedX = MathHelper.Clamp(speedX, -15f, 15f); - speedY = MathHelper.Clamp(speedY, -15f, 15f); - if (projectile.owner == Main.myPlayer) + if (projectile.owner == Main.myPlayer) { - int petal = Projectile.NewProjectile(spawnPosition.X, spawnPosition.Y, speedX, speedY, ProjectileID.FlowerPetal, (int)(projectile.damage * 0.5), 2f, projectile.owner); - Main.projectile[petal].Calamity().forceMelee = true; - Main.projectile[petal].localNPCHitCooldown = -1; + Projectile petal = CalamityUtils.ProjectileBarrage(projectile.Center, targetPos, Main.rand.NextBool(), 800f, 800f, 0f, 800f, 10f, ProjectileID.FlowerPetal, (int)(projectile.damage * 0.5), projectile.knockBack * 0.5f, projectile.owner, true); + petal.Calamity().forceMelee = true; + petal.localNPCHitCooldown = -1; } } } diff --git a/Projectiles/Melee/Spears/InsidiousImpalerProj.cs b/Projectiles/Melee/Spears/InsidiousImpalerProj.cs index 57e63628bd..63ecb07dfc 100644 --- a/Projectiles/Melee/Spears/InsidiousImpalerProj.cs +++ b/Projectiles/Melee/Spears/InsidiousImpalerProj.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.ownerHitCheck = true; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 8; - projectile.Calamity().trueMelee = true; + //projectile.Calamity().trueMelee = true; } public override float InitialSpeed => 3f; diff --git a/Projectiles/Melee/Spears/MarniteSpearProjectile.cs b/Projectiles/Melee/Spears/MarniteSpearProjectile.cs index 4f8192da22..6cbde975c3 100644 --- a/Projectiles/Melee/Spears/MarniteSpearProjectile.cs +++ b/Projectiles/Melee/Spears/MarniteSpearProjectile.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.ignoreWater = true; projectile.penetrate = -1; projectile.ownerHitCheck = true; - projectile.Calamity().trueMelee = true; + //projectile.Calamity().trueMelee = true; } public override float InitialSpeed => 3f; diff --git a/Projectiles/Melee/Spears/NadirSpear.cs b/Projectiles/Melee/Spears/NadirSpear.cs index 41609031a9..61e4138a06 100644 --- a/Projectiles/Melee/Spears/NadirSpear.cs +++ b/Projectiles/Melee/Spears/NadirSpear.cs @@ -27,8 +27,9 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.penetrate = -1; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 4; - projectile.Calamity().trueMelee = true; + //projectile.Calamity().trueMelee = true; } + public override float InitialSpeed => 5.5f; public override float ReelbackSpeed => 2.1f; public override float ForwardSpeed => 1.1f; diff --git a/Projectiles/Melee/Spears/SausageMakerSpear.cs b/Projectiles/Melee/Spears/SausageMakerSpear.cs index c70e961628..cf3c3d119b 100644 --- a/Projectiles/Melee/Spears/SausageMakerSpear.cs +++ b/Projectiles/Melee/Spears/SausageMakerSpear.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.ignoreWater = true; projectile.penetrate = -1; projectile.ownerHitCheck = true; - projectile.Calamity().trueMelee = true; + //projectile.Calamity().trueMelee = true; } public override float InitialSpeed => 3f; diff --git a/Projectiles/Melee/Spears/SpatialLanceProjectile.cs b/Projectiles/Melee/Spears/SpatialLanceProjectile.cs index bc41e8ad53..1127f9fc24 100644 --- a/Projectiles/Melee/Spears/SpatialLanceProjectile.cs +++ b/Projectiles/Melee/Spears/SpatialLanceProjectile.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.ownerHitCheck = true; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 3; - projectile.Calamity().trueMelee = true; + //projectile.Calamity().trueMelee = true; } public override float InitialSpeed => 3f; diff --git a/Projectiles/Melee/Spears/StarnightLanceProjectile.cs b/Projectiles/Melee/Spears/StarnightLanceProjectile.cs index 286651e0ac..2ffb51c4fb 100644 --- a/Projectiles/Melee/Spears/StarnightLanceProjectile.cs +++ b/Projectiles/Melee/Spears/StarnightLanceProjectile.cs @@ -25,8 +25,9 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.ignoreWater = true; projectile.penetrate = -1; projectile.ownerHitCheck = true; - projectile.Calamity().trueMelee = true; + //projectile.Calamity().trueMelee = true; } + public override float InitialSpeed => 3f; public override float ReelbackSpeed => 2.4f; public override float ForwardSpeed => 0.95f; diff --git a/Projectiles/Melee/Spears/StreamGougeProj.cs b/Projectiles/Melee/Spears/StreamGougeProj.cs index bc60d48bd2..b06ad17ee1 100644 --- a/Projectiles/Melee/Spears/StreamGougeProj.cs +++ b/Projectiles/Melee/Spears/StreamGougeProj.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.hide = true; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 1; - projectile.Calamity().trueMelee = true; + //projectile.Calamity().trueMelee = true; } public override float InitialSpeed => 3f; diff --git a/Projectiles/Melee/Spears/TenebreusTidesProjectile.cs b/Projectiles/Melee/Spears/TenebreusTidesProjectile.cs index ab3ba4b3af..755b3b173d 100644 --- a/Projectiles/Melee/Spears/TenebreusTidesProjectile.cs +++ b/Projectiles/Melee/Spears/TenebreusTidesProjectile.cs @@ -27,10 +27,11 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.ignoreWater = true; projectile.penetrate = -1; projectile.ownerHitCheck = true; - projectile.Calamity().trueMelee = true; + //projectile.Calamity().trueMelee = true; projectile.usesIDStaticNPCImmunity = true; projectile.idStaticNPCHitCooldown = 15; } + public override float InitialSpeed => 3f; public override float ReelbackSpeed => 2.4f; public override float ForwardSpeed => 0.95f; @@ -47,65 +48,25 @@ namespace CalamityMod.Projectiles.Melee.Spears public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 300); - SwordSpam(target, damage, knockback, crit); + SwordSpam(target.Center); } public override void OnHitPvp(Player target, int damage, bool crit) { target.AddBuff(ModContent.BuffType(), 300); - SwordSpamPvp(target, damage, crit); + SwordSpam(target.Center); } // Spawns a storm of water projectiles on-hit. - public void SwordSpam(NPC target, int damage, float knockback, bool crit) + public void SwordSpam(Vector2 targetPos) { int projAmt = 3; for (int i = 0; i < projAmt; ++i) { int type = Main.rand.NextBool() ? ModContent.ProjectileType() : ModContent.ProjectileType(); - float startOffsetX = Main.rand.NextFloat(1000f, 1400f) * (Main.rand.NextBool() ? -1f : 1f); - float startOffsetY = Main.rand.NextFloat(80f, 900f) * (Main.rand.NextBool() ? -1f : 1f); - Vector2 startPos = new Vector2(target.Center.X + startOffsetX, target.Center.Y + startOffsetY); - Vector2 projVel = target.Center - startPos; - - // Add some randomness / inaccuracy to the projectile target location - projVel.X += Main.rand.NextFloat(-5f, 5f); - projVel.Y += Main.rand.NextFloat(-5f, 5f); - float speed = Main.rand.NextFloat(25f, 35f); - float dist = projVel.Length(); - dist = speed / dist; - projVel.X *= dist; - projVel.Y *= dist; if (projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(startPos, projVel, type, projectile.damage / 2, projectile.knockBack * 0.5f, projectile.owner, 0f, 0f); - } - } - } - - // Spawns a storm of water projectiles on-hit. - public void SwordSpamPvp(Player target, int damage, bool crit) - { - int projAmt = 3; - for (int i = 0; i < projAmt; ++i) - { - int type = Main.rand.NextBool() ? ModContent.ProjectileType() : ModContent.ProjectileType(); - float startOffsetX = Main.rand.NextFloat(1000f, 1400f) * (Main.rand.NextBool() ? -1f : 1f); - float startOffsetY = Main.rand.NextFloat(80f, 900f) * (Main.rand.NextBool() ? -1f : 1f); - Vector2 startPos = new Vector2(target.Center.X + startOffsetX, target.Center.Y + startOffsetY); - Vector2 projVel = target.Center - startPos; - - // Add some randomness / inaccuracy to the projectile target location - projVel.X += Main.rand.NextFloat(-5f, 5f); - projVel.Y += Main.rand.NextFloat(-5f, 5f); - float speed = Main.rand.NextFloat(25f, 35f); - float dist = projVel.Length(); - dist = speed / dist; - projVel.X *= dist; - projVel.Y *= dist; - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(startPos, projVel, type, projectile.damage / 2, projectile.knockBack * 0.5f, projectile.owner, 0f, 0f); + CalamityUtils.ProjectileBarrage(projectile.Center, targetPos, Main.rand.NextBool(), 1000f, 1400f, 80f, 900f, Main.rand.NextFloat(25f, 35f), type, projectile.damage / 2, projectile.knockBack * 0.5f, projectile.owner); } } } diff --git a/Projectiles/Melee/Spears/TerraLanceProjectile.cs b/Projectiles/Melee/Spears/TerraLanceProjectile.cs index 19d02dd618..1353d9b72c 100644 --- a/Projectiles/Melee/Spears/TerraLanceProjectile.cs +++ b/Projectiles/Melee/Spears/TerraLanceProjectile.cs @@ -24,8 +24,9 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.ignoreWater = true; projectile.penetrate = -1; projectile.ownerHitCheck = true; - projectile.Calamity().trueMelee = true; + //projectile.Calamity().trueMelee = true; } + public override float InitialSpeed => 3f; public override float ReelbackSpeed => 2.4f; public override float ForwardSpeed => 0.95f; diff --git a/Projectiles/Melee/Spears/UrchinSpearProjectile.cs b/Projectiles/Melee/Spears/UrchinSpearProjectile.cs index da72e359c2..0157170e2b 100644 --- a/Projectiles/Melee/Spears/UrchinSpearProjectile.cs +++ b/Projectiles/Melee/Spears/UrchinSpearProjectile.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.ignoreWater = true; projectile.penetrate = -1; projectile.ownerHitCheck = true; - projectile.Calamity().trueMelee = true; + //projectile.Calamity().trueMelee = true; } public override float InitialSpeed => 3f; diff --git a/Projectiles/Melee/Spears/YateveoBloomSpear.cs b/Projectiles/Melee/Spears/YateveoBloomSpear.cs index 9da2f9ca74..5220848d6b 100644 --- a/Projectiles/Melee/Spears/YateveoBloomSpear.cs +++ b/Projectiles/Melee/Spears/YateveoBloomSpear.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.ignoreWater = true; projectile.penetrate = -1; projectile.ownerHitCheck = true; - projectile.Calamity().trueMelee = true; + //projectile.Calamity().trueMelee = true; } public override float InitialSpeed => 3f; diff --git a/Projectiles/Melee/TenebreusTidesWaterProjectile.cs b/Projectiles/Melee/TenebreusTidesWaterProjectile.cs index 11c42e25f4..7970a0aa6a 100644 --- a/Projectiles/Melee/TenebreusTidesWaterProjectile.cs +++ b/Projectiles/Melee/TenebreusTidesWaterProjectile.cs @@ -29,17 +29,18 @@ namespace CalamityMod.Projectiles.Melee projectile.usesIDStaticNPCImmunity = true; projectile.idStaticNPCHitCooldown = 10; projectile.tileCollide = false; + aiType = ProjectileID.LightBeam; } public override void AI() { Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 0f, 0f, (255 - projectile.alpha) * 1f / 255f); - int water = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 0.4f); + int water = Dust.NewDust(projectile.position, projectile.width, projectile.height, 33, 0f, 0f, 100, default, 0.4f); Main.dust[water].noGravity = true; Main.dust[water].velocity *= 0.5f; Main.dust[water].velocity += projectile.velocity * 0.1f; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + MathHelper.ToRadians(135f); + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(135f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) @@ -57,8 +58,8 @@ namespace CalamityMod.Projectiles.Melee Main.PlaySound(SoundID.Item10, projectile.position); projectile.position = projectile.Center; projectile.width = projectile.height = 64; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.position.X -= (float)(projectile.width / 2); + projectile.position.Y -= (float)(projectile.height / 2); for (int dustIndex = 0; dustIndex <= 30; dustIndex++) { Vector2 dustVel = new Vector2(Main.rand.Next(-10, 11), Main.rand.Next(-10, 11)); @@ -67,7 +68,7 @@ namespace CalamityMod.Projectiles.Melee dist = dustSpeed / dist; dustVel.X *= dist; dustVel.Y *= dist; - int water = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 1.2f); + int water = Dust.NewDust(projectile.position, projectile.width, projectile.height, 33, 0f, 0f, 100, default, 1.2f); Dust dust = Main.dust[water]; dust.noGravity = true; dust.position.X = projectile.Center.X; @@ -81,65 +82,25 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 240); - SwordSpam(target, damage, knockback, crit); + SwordSpam(target.Center); } public override void OnHitPvp(Player target, int damage, bool crit) { target.AddBuff(ModContent.BuffType(), 240); - SwordSpamPvp(target, damage, crit); + SwordSpam(target.Center); } // Spawns a storm of water projectiles on-hit. - public void SwordSpam(NPC target, int damage, float knockback, bool crit) + public void SwordSpam(Vector2 targetPos) { int projAmt = 3; for (int i = 0; i < projAmt; ++i) { int type = Main.rand.NextBool() ? ModContent.ProjectileType() : ModContent.ProjectileType(); - float startOffsetX = Main.rand.NextFloat(1000f, 1400f) * (Main.rand.NextBool() ? -1f : 1f); - float startOffsetY = Main.rand.NextFloat(80f, 900f) * (Main.rand.NextBool() ? -1f : 1f); - Vector2 startPos = new Vector2(target.Center.X + startOffsetX, target.Center.Y + startOffsetY); - Vector2 projVel = target.Center - startPos; - - // Add some randomness / inaccuracy to the projectile target location - projVel.X += Main.rand.NextFloat(-5f, 5f); - projVel.Y += Main.rand.NextFloat(-5f, 5f); - float speed = Main.rand.NextFloat(25f, 35f); - float dist = projVel.Length(); - dist = speed / dist; - projVel.X *= dist; - projVel.Y *= dist; if (projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(startPos, projVel, type, projectile.damage / 2, projectile.knockBack * 0.5f, projectile.owner, 0f, 0f); - } - } - } - - // Spawns a storm of water projectiles on-hit. - public void SwordSpamPvp(Player target, int damage, bool crit) - { - int projAmt = 3; - for (int i = 0; i < projAmt; ++i) - { - int type = Main.rand.NextBool() ? ModContent.ProjectileType() : ModContent.ProjectileType(); - float startOffsetX = Main.rand.NextFloat(1000f, 1400f) * (Main.rand.NextBool() ? -1f : 1f); - float startOffsetY = Main.rand.NextFloat(80f, 900f) * (Main.rand.NextBool() ? -1f : 1f); - Vector2 startPos = new Vector2(target.Center.X + startOffsetX, target.Center.Y + startOffsetY); - Vector2 projVel = target.Center - startPos; - - // Add some randomness / inaccuracy to the projectile target location - projVel.X += Main.rand.NextFloat(-5f, 5f); - projVel.Y += Main.rand.NextFloat(-5f, 5f); - float speed = Main.rand.NextFloat(25f, 35f); - float dist = projVel.Length(); - dist = speed / dist; - projVel.X *= dist; - projVel.Y *= dist; - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(startPos, projVel, type, projectile.damage / 2, projectile.knockBack * 0.5f, projectile.owner, 0f, 0f); + CalamityUtils.ProjectileBarrage(projectile.Center, targetPos, Main.rand.NextBool(), 1000f, 1400f, 80f, 900f, Main.rand.NextFloat(25f, 35f), type, projectile.damage / 2, projectile.knockBack * 0.5f, projectile.owner); } } } diff --git a/Projectiles/Melee/TerraEdgeBeam.cs b/Projectiles/Melee/TerraEdgeBeam.cs index f1419d3d33..7e291378f1 100644 --- a/Projectiles/Melee/TerraEdgeBeam.cs +++ b/Projectiles/Melee/TerraEdgeBeam.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Melee projectile.melee = true; projectile.penetrate = 3; projectile.timeLeft = 600; - aiType = 132; + aiType = ProjectileID.TerraBeam; } public override void AI() diff --git a/Projectiles/Melee/TyphonsGreedBubble.cs b/Projectiles/Melee/TyphonsGreedBubble.cs index 77220055cf..b15fa59403 100644 --- a/Projectiles/Melee/TyphonsGreedBubble.cs +++ b/Projectiles/Melee/TyphonsGreedBubble.cs @@ -39,32 +39,27 @@ namespace CalamityMod.Projectiles.Melee { projectile.frame = 0; } - float num953 = 50f * projectile.ai[1]; //100 - float scaleFactor12 = 10f * projectile.ai[1]; //5 + float inertia = 50f * projectile.ai[1]; //100 + float speed = 10f * projectile.ai[1]; //5 float num954 = 40f; - if ((double)Math.Abs(projectile.velocity.X) > 0.2) + if (Math.Abs(projectile.velocity.X) > 0.2f) { 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); - } + projectile.rotation = projectile.velocity.ToRotation(); Lighting.AddLight(projectile.Center, 0f, 0.1f, 0.7f); - if (Main.player[projectile.owner].active && !Main.player[projectile.owner].dead) + + Player player = Main.player[projectile.owner]; + if (player.active && !player.dead) { - if (projectile.Distance(Main.player[projectile.owner].Center) > num954) + if (projectile.Distance(player.Center) > num954) { - Vector2 vector102 = projectile.DirectionTo(Main.player[projectile.owner].Center); + Vector2 vector102 = projectile.DirectionTo(player.Center); if (vector102.HasNaNs()) { vector102 = Vector2.UnitY; } - projectile.velocity = (projectile.velocity * (num953 - 1f) + vector102 * scaleFactor12) / num953; + projectile.velocity = (projectile.velocity * (inertia - 1f) + vector102 * speed) / inertia; } } else @@ -90,7 +85,8 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 180); + if (Main.rand.NextBool(3)) + target.AddBuff(ModContent.BuffType(), 180); } public override void Kill(int timeLeft) @@ -98,18 +94,18 @@ namespace CalamityMod.Projectiles.Melee Main.PlaySound(SoundID.Item21, projectile.position); projectile.position = projectile.Center; projectile.width = projectile.height = 64; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.position.X -= (float)(projectile.width / 2); + projectile.position.Y -= (float)(projectile.height / 2); for (int num193 = 0; num193 < 2; num193++) { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + Dust.NewDust(projectile.position, projectile.width, projectile.height, 33, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); } for (int num194 = 0; num194 < 6; num194++) { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 186, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); + int num195 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 186, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); Main.dust[num195].noGravity = true; Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 186, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + num195 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 186, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); Main.dust[num195].velocity *= 2f; Main.dust[num195].noGravity = true; } @@ -117,6 +113,7 @@ namespace CalamityMod.Projectiles.Melee projectile.penetrate = -1; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 10; + projectile.damage /= 2; projectile.Damage(); } } diff --git a/Projectiles/Melee/TyphonsGreedStaff.cs b/Projectiles/Melee/TyphonsGreedStaff.cs index 7c659b2b56..2b213b2620 100644 --- a/Projectiles/Melee/TyphonsGreedStaff.cs +++ b/Projectiles/Melee/TyphonsGreedStaff.cs @@ -140,38 +140,12 @@ namespace CalamityMod.Projectiles.Melee player.itemAnimation = 2; player.itemRotation = MathHelper.WrapAngle(projectile.rotation); projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 12f) + if (projectile.localAI[0] % 12f == 0f) { - projectile.localAI[0] = 0f; - float xPos = Main.rand.NextBool(2) ? projectile.position.X + 800f : projectile.position.X - 800f; - Vector2 vector20 = new Vector2(xPos, projectile.position.Y + (float)Main.rand.Next(-800, 801)); - float num80 = xPos; - float speedX = (float)player.position.X - vector20.X; - float speedY = (float)player.position.Y - vector20.Y; - float dir = (float)Math.Sqrt((double)(speedX * speedX + speedY * speedY)); - dir = 10 / num80; - speedX *= dir * 150; - speedY *= dir * 150; - if (speedX > 15f) - { - speedX = 15f; - } - if (speedX < -15f) - { - speedX = -15f; - } - if (speedY > 15f) - { - speedY = 15f; - } - if (speedY < -15f) - { - speedY = -15f; - } if (projectile.owner == Main.myPlayer) { - float ai1 = Main.rand.NextFloat() + 0.5f; - Projectile.NewProjectile(vector20.X, vector20.Y, speedX, speedY, ModContent.ProjectileType(), projectile.damage, 2f, projectile.owner, 0.0f, ai1); + Projectile bubble = CalamityUtils.ProjectileBarrage(projectile.Center, player.Center, Main.rand.NextBool(), 800f, 800f, 0f, 800f, 10f, ModContent.ProjectileType(), (int)(projectile.damage * 0.5), projectile.knockBack * 0.5f, projectile.owner, true); + bubble.ai[1] = Main.rand.NextFloat() + 0.5f; } } } @@ -181,10 +155,10 @@ namespace CalamityMod.Projectiles.Melee Rectangle myRect = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); if (projectile.owner == Main.myPlayer) { - for (int i = 0; i < 200; i++) + for (int i = 0; i < Main.maxNPCs; i++) { if (Main.npc[i].active && !Main.npc[i].dontTakeDamage && - ((projectile.friendly && (!Main.npc[i].friendly || projectile.type == 318 || (Main.npc[i].type == NPCID.Guide && projectile.owner < 255 && Main.player[projectile.owner].killGuide) || (Main.npc[i].type == NPCID.Clothier && projectile.owner < 255 && Main.player[projectile.owner].killClothier))) || + ((projectile.friendly && (!Main.npc[i].friendly || (Main.npc[i].type == NPCID.Guide && projectile.owner < 255 && Main.player[projectile.owner].killGuide) || (Main.npc[i].type == NPCID.Clothier && projectile.owner < 255 && Main.player[projectile.owner].killClothier))) || (projectile.hostile && Main.npc[i].friendly && !Main.npc[i].dontTakeDamageFromHostiles)) && (projectile.owner < 0 || Main.npc[i].immune[projectile.owner] == 0 || projectile.maxPenetrate == 1)) { if (Main.npc[i].noTileCollide || !projectile.ownerHitCheck || projectile.CanHit(Main.npc[i])) diff --git a/Projectiles/Melee/UrchinBallSpike.cs b/Projectiles/Melee/UrchinBallSpike.cs index 47e23b7897..6681fb93ea 100644 --- a/Projectiles/Melee/UrchinBallSpike.cs +++ b/Projectiles/Melee/UrchinBallSpike.cs @@ -33,12 +33,12 @@ namespace CalamityMod.Projectiles.Melee projectile.spriteDirection = projectile.direction; } //Sticky Behaviour - CalamityUtils.StickyProjAI(projectile, 6); + projectile.StickyProjAI(6); } public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - CalamityUtils.ModifyHitNPCSticky(projectile, 6, false); + projectile.ModifyHitNPCSticky(6, false); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) diff --git a/Projectiles/Melee/Yoyos/MicrowaveYoyo.cs b/Projectiles/Melee/Yoyos/MicrowaveYoyo.cs index 9d885753b9..9407653a75 100644 --- a/Projectiles/Melee/Yoyos/MicrowaveYoyo.cs +++ b/Projectiles/Melee/Yoyos/MicrowaveYoyo.cs @@ -84,6 +84,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void Kill(int timeLeft) { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/MicrowaveBeep"), (int)projectile.Center.X, (int)projectile.Center.Y); mmmmmm?.Stop(); mmmmmm?.Dispose(); } diff --git a/Projectiles/Pets/BendyPet.cs b/Projectiles/Pets/BendyPet.cs new file mode 100644 index 0000000000..62b0184678 --- /dev/null +++ b/Projectiles/Pets/BendyPet.cs @@ -0,0 +1,257 @@ +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.Pets +{ + public class BendyPet : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dreamfog Dragon"); + Main.projFrames[projectile.type] = 5; + Main.projPet[projectile.type] = true; + ProjectileID.Sets.LightPet[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.netImportant = true; + projectile.width = 38; + projectile.height = 56; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.timeLeft *= 5; + projectile.ignoreWater = true; + projectile.tileCollide = false; + } + + public override void AI() + { + //Set up namespaces + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + + //If the player dies or something, kill thte projectile + if (!player.active) + { + projectile.active = false; + return; + } + if (player.dead) + { + modPlayer.bendyPet = false; + } + + //Prevent the projectile from losing its timeLeft + if (modPlayer.bendyPet) + { + projectile.timeLeft = 2; + } + + //Update frames + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= Main.projFrames[projectile.type]) + { + projectile.frame = 0; + } + + //Highlight nearby danger sources + player.dangerSense = true; + player.detectCreature = true; + + //Generate less light if returning to the player + if (projectile.localAI[0] == 0f) + { + Lighting.AddLight(projectile.Center, 0.8118f, 0.2529f, 1.3294f); //138, 43, 226 + } + else + { + Lighting.AddLight(projectile.Center, 0.4329f, 0.1349f, 0.709f); + } + + float idleMvt = 0.2f; + float projSpeed = 5f; + //Calculate where the pet should reside based on pressed controls + Vector2 projVec = player.Center - projectile.Center; + projVec.Y += player.gfxOffY; + if (player.controlLeft) + { + projVec.X -= 120f; + } + else if (player.controlRight) + { + projVec.X += 120f; + } + if (player.controlDown) + { + projVec.Y += 120f; + } + else + { + if (player.controlUp) + { + projVec.Y -= 120f; + } + projVec.Y -= 60f; + } + float playerDist = projVec.Length(); + if (playerDist > 1000f) + { + projectile.position.X += projVec.X; + projectile.position.Y += projVec.Y; + } + + //Returning to player AI + if (projectile.localAI[0] == 1f) + { + //If close enough, the player isn't moving too much, and isn't moving vertically, return to normal + if (playerDist < 10f && Math.Abs(player.velocity.X) + Math.Abs(player.velocity.Y) < projSpeed && player.velocity.Y == 0f) + { + projectile.localAI[0] = 0f; + } + + //Go faster + projSpeed = 12f; + if (playerDist < projSpeed) + { + projectile.velocity.X = projVec.X; + projectile.velocity.Y = projVec.Y; + } + else + { + playerDist = projSpeed / playerDist; + projectile.velocity.X = projVec.X * playerDist; + projectile.velocity.Y = projVec.Y * playerDist; + } + + //Set projectile direction and rotation + if (projectile.velocity.X > 0.5f) + { + projectile.direction = -1; + } + else if (projectile.velocity.X < -0.5f) + { + projectile.direction = 1; + } + projectile.spriteDirection = projectile.direction; + projectile.rotation = projectile.velocity.X * 0.05f; + return; + } + + //If too far, return to the player + if (playerDist > 200f) + { + projectile.localAI[0] = 1f; + } + + //Set projectile direction and rotation + if (projectile.velocity.X > 0.5f) + { + projectile.direction = -1; + } + else if (projectile.velocity.X < -0.5f) + { + projectile.direction = 1; + } + projectile.spriteDirection = projectile.direction; + + if (playerDist < 10f) + { + projectile.velocity.X = projVec.X; + projectile.velocity.Y = projVec.Y; + projectile.rotation = projectile.velocity.X * 0.05f; + if (playerDist < projSpeed) + { + projectile.position += projectile.velocity; + projectile.velocity *= 0f; + idleMvt = 0f; + } + projectile.direction = -player.direction; + } + playerDist = projSpeed / playerDist; + projVec.X *= playerDist; + projVec.Y *= playerDist; + if (projectile.velocity.X < projVec.X) + { + projectile.velocity.X += idleMvt; + if (projectile.velocity.X < 0f) + { + projectile.velocity.X *= 0.99f; + } + } + if (projectile.velocity.X > projVec.X) + { + projectile.velocity.X -= idleMvt; + if (projectile.velocity.X > 0f) + { + projectile.velocity.X *= 0.99f; + } + } + if (projectile.velocity.Y < projVec.Y) + { + projectile.velocity.Y += idleMvt; + if (projectile.velocity.Y < 0f) + { + projectile.velocity.Y *= 0.99f; + } + } + if (projectile.velocity.Y > projVec.Y) + { + projectile.velocity.Y -= idleMvt; + if (projectile.velocity.Y > 0f) + { + projectile.velocity.Y *= 0.99f; + } + } + + //Rotation if moving + if (projectile.velocity.X != 0f || projectile.velocity.Y != 0f) + { + projectile.rotation = projectile.velocity.X * 0.05f; + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture = Main.projectileTexture[projectile.type]; + 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; + } + + public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture = ModContent.GetTexture("CalamityMod/Projectiles/Pets/BendyPetGlow"); + int height = texture.Height / Main.projFrames[projectile.type]; + int frameHeight = height * projectile.frame; + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + spriteEffects = SpriteEffects.FlipHorizontally; + Color rainbow = CalamityUtils.MulticolorLerp(Main.GlobalTime / 2f % 1f, new Color[] + { + new Color(255, 0, 0, 50), //Red + new Color(255, 255, 0, 50), //Yellow + new Color(0, 255, 0, 50), //Green + new Color(0, 255, 255, 50), //Cyan + new Color(0, 0, 255, 50), //Blue + new Color(255, 0, 255, 50), //Fuschia + }); + + spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, frameHeight, texture.Width, height)), rainbow, projectile.rotation, new Vector2((float)texture.Width / 2f, (float)height / 2f), projectile.scale, spriteEffects, 0f); + } + } +} diff --git a/Projectiles/Pets/BendyPet.png b/Projectiles/Pets/BendyPet.png new file mode 100644 index 0000000000..5f6a240c6d Binary files /dev/null and b/Projectiles/Pets/BendyPet.png differ diff --git a/Projectiles/Pets/BendyPetGlow.png b/Projectiles/Pets/BendyPetGlow.png new file mode 100644 index 0000000000..8a154743f9 Binary files /dev/null and b/Projectiles/Pets/BendyPetGlow.png differ diff --git a/Projectiles/Pets/RotomPet.cs b/Projectiles/Pets/RotomPet.cs index 241890e028..c9c30336f8 100644 --- a/Projectiles/Pets/RotomPet.cs +++ b/Projectiles/Pets/RotomPet.cs @@ -6,138 +6,168 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Pets { public class RotomPet : ModProjectile - { - private int biome = 0; - private float dust = 0f; + { + private bool initialized = false; + private int form = 0; + private const int Normal = 0; + private const int Dex = 1; + private const int Wash = 2; + private const int Heat = 3; + private const int Frost = 4; + private const int Mow = 5; + private const int Fan = 6; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Rotom"); - Main.projFrames[projectile.type] = 4; - Main.projPet[projectile.type] = true; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Rotom"); + Main.projFrames[projectile.type] = 4; + Main.projPet[projectile.type] = true; + } - public override void SetDefaults() - { - projectile.netImportant = true; - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft *= 5; - } + public override void SetDefaults() + { + projectile.netImportant = true; + projectile.width = projectile.height = 30; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.timeLeft *= 5; + } - public override void AI() - { - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); + public override void AI() + { + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); - if (CalamityPlayer.areThereAnyDamnBosses) - biome = 1; //dex - else if (player.ZoneBeach || player.Calamity().ZoneSunkenSea || player.Calamity().ZoneSulphur || player.Calamity().ZoneAbyss) - biome = 2; //wash - else if (player.ZoneTowerSolar || player.ZoneDesert || player.ZoneUndergroundDesert || player.ZoneUnderworldHeight || player.Calamity().ZoneCalamity) - biome = 3; //heat - else if (player.ZoneSnow || Main.snowMoon) - biome = 4; //frost - else if (player.ZoneJungle) - biome = 5; //mow - else if (player.ZoneSkyHeight || player.ZoneMeteor || player.Calamity().ZoneAstral) - biome = 6; //fan - else - biome = 0; //anything else + if (!player.active) + { + projectile.active = false; + return; + } + if (player.dead) + { + modPlayer.rotomPet = false; + } + if (modPlayer.rotomPet) + { + projectile.timeLeft = 2; + } - if (!player.active) - { - projectile.active = false; - return; - } - if (player.dead) - { - modPlayer.rotomPet = false; - } - if (modPlayer.rotomPet) - { - projectile.timeLeft = 2; - } + if (!initialized) + { + DustEffects(); + initialized = true; + } - if (dust == 0f) - { - int num501 = 25; - for (int num502 = 0; num502 < num501; num502++) - { - int num503 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 132, 0f, 0f, 0, default, 1f); - Main.dust[num503].velocity *= 2f; - Main.dust[num503].scale *= 1.15f; - } - dust += 1f; - } + UpdateForm(player); + UpdateFrames(); projectile.FloatingPetAI(true, 0.05f); + } - projectile.frameCounter++; + private void UpdateForm(Player player) + { + if (CalamityPlayer.areThereAnyDamnBosses) + form = Dex; + else if (player.ZoneBeach || player.InSunkenSea() || player.InSulphur() || player.InAbyss()) + form = Wash; + else if (player.ZoneTowerSolar || player.ZoneDesert || player.ZoneUndergroundDesert || player.ZoneUnderworldHeight || player.InCalamity()) + form = Heat; + else if (player.ZoneSnow || Main.snowMoon) + form = Frost; + else if (player.ZoneJungle) + form = Mow; + else if (player.ZoneSkyHeight || player.ZoneMeteor || player.InAstral()) + form = Fan; + else + form = Normal; + } + + private void DustEffects() + { + int dustAmt = 25; + for (int i = 0; i < dustAmt; i++) + { + int electric = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 132, 0f, 0f, 0, default, 1f); + Main.dust[electric].velocity *= 2f; + Main.dust[electric].scale *= 1.15f; + } + } + + private void UpdateFrames() + { + projectile.frameCounter++; if (projectile.frameCounter > 6) { projectile.frame++; - projectile.frameCounter = 0; + projectile.frameCounter = 0; } - if (projectile.frame >= 4) - { - projectile.frame = 0; - } - } + if (projectile.frame >= 4) + { + projectile.frame = 0; + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D texture = Main.projectileTexture[projectile.type]; - if (biome == 1) - texture = ModContent.GetTexture("CalamityMod/Projectiles/Pets/RotomDex"); - if (biome == 2) - texture = ModContent.GetTexture("CalamityMod/Projectiles/Pets/RotomWash"); - if (biome == 3) - texture = ModContent.GetTexture("CalamityMod/Projectiles/Pets/RotomHeat"); - if (biome == 4) - texture = ModContent.GetTexture("CalamityMod/Projectiles/Pets/RotomFrost"); - if (biome == 5) - texture = ModContent.GetTexture("CalamityMod/Projectiles/Pets/RotomMow"); - if (biome == 6) - texture = ModContent.GetTexture("CalamityMod/Projectiles/Pets/RotomFan"); - 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; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Drawing(spriteBatch, lightColor, + Main.projectileTexture[projectile.type], + ModContent.GetTexture("CalamityMod/Projectiles/Pets/RotomDex"), + ModContent.GetTexture("CalamityMod/Projectiles/Pets/RotomWash"), + ModContent.GetTexture("CalamityMod/Projectiles/Pets/RotomHeat"), + ModContent.GetTexture("CalamityMod/Projectiles/Pets/RotomFrost"), + ModContent.GetTexture("CalamityMod/Projectiles/Pets/RotomMow"), + ModContent.GetTexture("CalamityMod/Projectiles/Pets/RotomFan")); + return false; + } public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture = ModContent.GetTexture("CalamityMod/Projectiles/Pets/RotomPetGlow"); - if (biome == 1) - texture = ModContent.GetTexture("CalamityMod/Projectiles/Pets/RotomDexGlow"); - if (biome == 2) - texture = ModContent.GetTexture("CalamityMod/Projectiles/Pets/RotomWashGlow"); - if (biome == 3) - texture = ModContent.GetTexture("CalamityMod/Projectiles/Pets/RotomHeatGlow"); - if (biome == 4) - texture = ModContent.GetTexture("CalamityMod/Projectiles/Pets/RotomFrostGlow"); - if (biome == 5) - texture = ModContent.GetTexture("CalamityMod/Projectiles/Pets/RotomMowGlow"); - if (biome == 6) - texture = ModContent.GetTexture("CalamityMod/Projectiles/Pets/RotomFanGlow"); - int num214 = texture.Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; + Drawing(spriteBatch, Color.White, + ModContent.GetTexture("CalamityMod/Projectiles/Pets/RotomPetGlow"), + ModContent.GetTexture("CalamityMod/Projectiles/Pets/RotomDexGlow"), + ModContent.GetTexture("CalamityMod/Projectiles/Pets/RotomWashGlow"), + ModContent.GetTexture("CalamityMod/Projectiles/Pets/RotomHeatGlow"), + ModContent.GetTexture("CalamityMod/Projectiles/Pets/RotomFrostGlow"), + ModContent.GetTexture("CalamityMod/Projectiles/Pets/RotomMowGlow"), + ModContent.GetTexture("CalamityMod/Projectiles/Pets/RotomFanGlow")); + } + + private void Drawing(SpriteBatch spriteBatch, Color color, Texture2D normal, Texture2D dex, Texture2D wash, Texture2D heat, Texture2D frost, Texture2D mow, Texture2D fan) + { + Texture2D texture = normal; + switch (form) + { + case Dex: + texture = dex; + break; + case Wash: + texture = wash; + break; + case Heat: + texture = heat; + break; + case Frost: + texture = frost; + break; + case Mow: + texture = mow; + break; + case Fan: + texture = fan; + break; + default: + break; + } + + int height = texture.Height / Main.projFrames[projectile.type]; + int frameHeight = height * projectile.frame; SpriteEffects spriteEffects = SpriteEffects.None; if (projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; - spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, num214)), Color.White, projectile.rotation, new Vector2((float)texture.Width / 2f, (float)num214 / 2f), projectile.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, frameHeight, texture.Width, height)), color, projectile.rotation, new Vector2(texture.Width / 2f, height / 2f), projectile.scale, spriteEffects, 0f); } - public override bool CanDamage() - { - return false; - } - } + public override bool CanDamage() => false; + } } diff --git a/Projectiles/Pets/SirenFlopping.png b/Projectiles/Pets/SirenFlopping.png deleted file mode 100644 index 62bcb652ae..0000000000 Binary files a/Projectiles/Pets/SirenFlopping.png and /dev/null differ diff --git a/Projectiles/Pets/SirenYoung.cs b/Projectiles/Pets/SirenYoung.cs index 0e59557428..70bd66a006 100644 --- a/Projectiles/Pets/SirenYoung.cs +++ b/Projectiles/Pets/SirenYoung.cs @@ -11,11 +11,13 @@ namespace CalamityMod.Projectiles.Pets public class SirenYoung : ModProjectile { private bool underwater = false; + private int sleepyTimer = 0; + private int lightLevel = 0; public override void SetStaticDefaults() { - DisplayName.SetDefault("Siren"); - Main.projFrames[projectile.type] = 4; + DisplayName.SetDefault("Ocean Spirit"); + Main.projFrames[projectile.type] = 17; Main.projPet[projectile.type] = true; ProjectileID.Sets.LightPet[projectile.type] = true; } @@ -23,12 +25,13 @@ namespace CalamityMod.Projectiles.Pets public override void SetDefaults() { projectile.netImportant = true; - projectile.width = 30; - projectile.height = 30; + projectile.width = 38; + projectile.height = 58; projectile.friendly = true; projectile.penetrate = -1; projectile.timeLeft *= 5; projectile.ignoreWater = true; + projectile.tileCollide = false; } public override void AI() @@ -48,325 +51,91 @@ namespace CalamityMod.Projectiles.Pets { projectile.timeLeft = 2; } - projectile.frameCounter++; - if (projectile.frameCounter > 6) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - underwater = Collision.DrownCollision(player.position, player.width, player.height, player.gravDir) || modPlayer.leviathanAndSirenLore; + if (sleepyTimer < 180) + { + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + } + if (underwater) + { + if (projectile.frame >= 8) + { + projectile.frame = 0; + } + } + else + { + if (projectile.frame >= 16) + { + projectile.frame = sleepyTimer >= 180 ? 16 : 8; + } + } + underwater = player.IsUnderwater() || modPlayer.leviathanAndSirenLore; if (underwater) { - projectile.width = 30; - projectile.height = 30; + if (projectile.frame == 16) + projectile.frame = 0; + if (sleepyTimer > 0) + sleepyTimer--; if (projectile.localAI[0] == 0f) { - Lighting.AddLight(projectile.Center, 2.5f, 2f, 0f); //4.5 + lightLevel = 0; } else { - Lighting.AddLight(projectile.Center, 1.65f, 1.32f, 0f); //3 + lightLevel = 1; } } - else - { - projectile.width = 54; - projectile.height = 54; - Lighting.AddLight(projectile.Center, 0.825f, 0.66f, 0f); //1.5 - Vector2 vector54 = player.Center; - vector54.X -= (float)((15 + player.width / 2) * player.direction); - vector54.X -= (float)(40 * player.direction); - if (projectile.ai[0] == 1f) - { - projectile.tileCollide = false; - float num663 = 0.2f; - float num664 = 10f; - int num665 = 200; - if (num664 < Math.Abs(player.velocity.X) + Math.Abs(player.velocity.Y)) - { - num664 = Math.Abs(player.velocity.X) + Math.Abs(player.velocity.Y); - } - Vector2 vector58 = vector54 - projectile.Center; - float num666 = vector58.Length(); - if (num666 > 2000f) - { - projectile.position = player.Center - new Vector2((float)projectile.width, (float)projectile.height) / 2f; - } - if (num666 < (float)num665 && player.velocity.Y == 0f && projectile.position.Y + (float)projectile.height <= player.position.Y + (float)player.height && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.ai[0] = 0f; - projectile.netUpdate = true; - if (projectile.velocity.Y < -6f) - { - projectile.velocity.Y = -6f; - } - } - if (num666 >= 60f) - { - vector58.Normalize(); - vector58 *= num664; - if (projectile.velocity.X < vector58.X) - { - projectile.velocity.X = projectile.velocity.X + num663; - if (projectile.velocity.X < 0f) - { - projectile.velocity.X = projectile.velocity.X + num663 * 1.5f; - } - } - if (projectile.velocity.X > vector58.X) - { - projectile.velocity.X = projectile.velocity.X - num663; - if (projectile.velocity.X > 0f) - { - projectile.velocity.X = projectile.velocity.X - num663 * 1.5f; - } - } - if (projectile.velocity.Y < vector58.Y) - { - projectile.velocity.Y = projectile.velocity.Y + num663; - if (projectile.velocity.Y < 0f) - { - projectile.velocity.Y = projectile.velocity.Y + num663 * 1.5f; - } - } - if (projectile.velocity.Y > vector58.Y) - { - projectile.velocity.Y = projectile.velocity.Y - num663; - if (projectile.velocity.Y > 0f) - { - projectile.velocity.Y = projectile.velocity.Y - num663 * 1.5f; - } - } - } - if (projectile.velocity.X != 0f) - { - projectile.spriteDirection = Math.Sign(projectile.velocity.X); - } - } - if (projectile.ai[0] == 2f) - { - projectile.friendly = true; - projectile.spriteDirection = projectile.direction; - projectile.velocity.Y = projectile.velocity.Y + 0.4f; - if (projectile.velocity.Y > 10f) - { - projectile.velocity.Y = 10f; - } - projectile.ai[1] -= 1f; - if (projectile.ai[1] <= 0f) - { - projectile.ai[1] = 0f; - projectile.ai[0] = 0f; - projectile.friendly = false; - projectile.netUpdate = true; - return; - } - } - if (projectile.ai[0] == 0f) - { - float num671 = 200f; - if (player.rocketDelay2 > 0) - { - projectile.ai[0] = 1f; - projectile.netUpdate = true; - } - Vector2 vector59 = vector54 - projectile.Center; - if (vector59.Length() > 2000f) - { - projectile.position = vector54 - new Vector2((float)projectile.width, (float)projectile.height) / 2f; - } - else if (vector59.Length() > num671 || Math.Abs(vector59.Y) > 300f) - { - projectile.ai[0] = 1f; - projectile.netUpdate = true; - if (projectile.velocity.Y > 0f && vector59.Y < 0f) - { - projectile.velocity.Y = 0f; - } - if (projectile.velocity.Y < 0f && vector59.Y > 0f) - { - projectile.velocity.Y = 0f; - } - } - projectile.tileCollide = true; - float num672 = 0.5f; - float num673 = 4f; - float num674 = 4f; - float num675 = 0.1f; - if (num674 < Math.Abs(player.velocity.X) + Math.Abs(player.velocity.Y)) - { - num674 = Math.Abs(player.velocity.X) + Math.Abs(player.velocity.Y); - num672 = 0.7f; - } - int num676 = 0; - bool flag29 = false; - float num677 = vector54.X - projectile.Center.X; - if (Math.Abs(num677) > 5f) - { - if (num677 < 0f) - { - num676 = -1; - if (projectile.velocity.X > -num673) - { - projectile.velocity.X = projectile.velocity.X - num672; - } - else - { - projectile.velocity.X = projectile.velocity.X - num675; - } - } - else - { - num676 = 1; - if (projectile.velocity.X < num673) - { - projectile.velocity.X = projectile.velocity.X + num672; - } - else - { - projectile.velocity.X = projectile.velocity.X + num675; - } - } - flag29 = true; - } - else - { - projectile.velocity.X = projectile.velocity.X * 0.9f; - if (Math.Abs(projectile.velocity.X) < num672 * 2f) - { - projectile.velocity.X = 0f; - } - } - if (num676 != 0) - { - int num678 = (int)(projectile.position.X + (float)(projectile.width / 2)) / 16; - int num679 = (int)projectile.position.Y / 16; - num678 += num676; - num678 += (int)projectile.velocity.X; - int num3; - for (int num680 = num679; num680 < num679 + projectile.height / 16 + 1; num680 = num3 + 1) - { - if (WorldGen.SolidTile(num678, num680)) - { - flag29 = true; - } - num3 = num680; - } - } - if (projectile.velocity.X != 0f) - { - flag29 = true; - } - Collision.StepUp(ref projectile.position, ref projectile.velocity, projectile.width, projectile.height, ref projectile.stepSpeed, ref projectile.gfxOffY, 1, false, 0); - if (projectile.velocity.Y == 0f && flag29) - { - int num3; - for (int num681 = 0; num681 < 3; num681 = num3 + 1) - { - int num682 = (int)(projectile.position.X + (float)(projectile.width / 2)) / 16; - if (num681 == 0) - { - num682 = (int)projectile.position.X / 16; - } - if (num681 == 2) - { - num682 = (int)(projectile.position.X + (float)projectile.width) / 16; - } - int num683 = (int)(projectile.position.Y + (float)projectile.height) / 16; - if (WorldGen.SolidTile(num682, num683) || Main.tile[num682, num683].halfBrick() || Main.tile[num682, num683].slope() > 0 || (TileID.Sets.Platforms[(int)Main.tile[num682, num683].type] && Main.tile[num682, num683].active() && !Main.tile[num682, num683].inActive())) - { - try - { - num682 = (int)(projectile.position.X + (float)(projectile.width / 2)) / 16; - num683 = (int)(projectile.position.Y + (float)(projectile.height / 2)) / 16; - num682 += num676; - num682 += (int)projectile.velocity.X; - if (!WorldGen.SolidTile(num682, num683 - 1) && !WorldGen.SolidTile(num682, num683 - 2)) - { - projectile.velocity.Y = -5.1f; - } - else if (!WorldGen.SolidTile(num682, num683 - 2)) - { - projectile.velocity.Y = -7.1f; - } - else if (WorldGen.SolidTile(num682, num683 - 5)) - { - projectile.velocity.Y = -11.1f; - } - else if (WorldGen.SolidTile(num682, num683 - 4)) - { - projectile.velocity.Y = -10.1f; - } - else - { - projectile.velocity.Y = -9.1f; - } - } catch - { - projectile.velocity.Y = -9.1f; - } - } - num3 = num681; - } - } - if (projectile.velocity.X > num674) - { - projectile.velocity.X = num674; - } - if (projectile.velocity.X < -num674) - { - projectile.velocity.X = -num674; - } - if (projectile.velocity.X < 0f) - { - projectile.direction = -1; - } - if (projectile.velocity.X > 0f) - { - projectile.direction = 1; - } - if (projectile.velocity.X > num672 && num676 == 1) - { - projectile.direction = 1; - } - if (projectile.velocity.X < -num672 && num676 == -1) - { - projectile.direction = -1; - } - projectile.spriteDirection = projectile.direction; - projectile.velocity.Y = projectile.velocity.Y + 0.4f; - if (projectile.velocity.Y > 10f) - { - projectile.velocity.Y = 10f; - } - } - return; - } + else + { + if (sleepyTimer < 180) + { + sleepyTimer++; + lightLevel = 1; + } + else + { + lightLevel = 2; + projectile.frame = 16; + } + } + switch (lightLevel) + { + case 0: + Lighting.AddLight(projectile.Center, 0f, 2f, 2.5f); //4.5 + break; + case 1: + Lighting.AddLight(projectile.Center, 0f, 1.32f, 1.65f); //3 + break; + case 2: + Lighting.AddLight(projectile.Center, 0f, 0.5f, 0.7f); + break; + } + float num23 = 0.2f; float num24 = 5f; - projectile.tileCollide = false; Vector2 vector4 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num25 = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - vector4.X; - float num26 = Main.player[projectile.owner].position.Y + Main.player[projectile.owner].gfxOffY + (float)(Main.player[projectile.owner].height / 2) - vector4.Y; - if (Main.player[projectile.owner].controlLeft) + float num25 = player.position.X + (float)(player.width / 2) - vector4.X; + float num26 = player.position.Y + player.gfxOffY + (float)(player.height / 2) - vector4.Y; + if (player.controlLeft && sleepyTimer < 180) { num25 -= 120f; } - else if (Main.player[projectile.owner].controlRight) + else if (player.controlRight && sleepyTimer < 180) { num25 += 120f; } - if (Main.player[projectile.owner].controlDown) + if (player.controlDown && sleepyTimer < 180) { num26 += 120f; } else { - if (Main.player[projectile.owner].controlUp) + if (player.controlUp && sleepyTimer < 180) { num26 -= 120f; } @@ -375,12 +144,12 @@ namespace CalamityMod.Projectiles.Pets float num27 = (float)Math.Sqrt((double)(num25 * num25 + num26 * num26)); if (num27 > 1000f) { - projectile.position.X = projectile.position.X + num25; - projectile.position.Y = projectile.position.Y + num26; + projectile.position.X += num25; + projectile.position.Y += num26; } if (projectile.localAI[0] == 1f) { - if (num27 < 10f && Math.Abs(Main.player[projectile.owner].velocity.X) + Math.Abs(Main.player[projectile.owner].velocity.Y) < num24 && Main.player[projectile.owner].velocity.Y == 0f) + if (num27 < 10f && Math.Abs(player.velocity.X) + Math.Abs(player.velocity.Y) < num24 && player.velocity.Y == 0f) { projectile.localAI[0] = 0f; } @@ -396,11 +165,11 @@ namespace CalamityMod.Projectiles.Pets projectile.velocity.X = num25 * num27; projectile.velocity.Y = num26 * num27; } - if ((double)projectile.velocity.X > 0.5) + if (projectile.velocity.X > 0.5f) { projectile.direction = -1; } - else if ((double)projectile.velocity.X < -0.5) + else if (projectile.velocity.X < -0.5f) { projectile.direction = 1; } @@ -412,11 +181,11 @@ namespace CalamityMod.Projectiles.Pets { projectile.localAI[0] = 1f; } - if ((double)projectile.velocity.X > 0.5) + if (projectile.velocity.X > 0.5f) { projectile.direction = -1; } - else if ((double)projectile.velocity.X < -0.5) + else if (projectile.velocity.X < -0.5f) { projectile.direction = 1; } @@ -432,14 +201,14 @@ namespace CalamityMod.Projectiles.Pets projectile.velocity *= 0f; num23 = 0f; } - projectile.direction = -Main.player[projectile.owner].direction; + projectile.direction = -player.direction; } num27 = num24 / num27; num25 *= num27; num26 *= num27; if (projectile.velocity.X < num25) { - projectile.velocity.X = projectile.velocity.X + num23; + projectile.velocity.X += num23; if (projectile.velocity.X < 0f) { projectile.velocity.X = projectile.velocity.X * 0.99f; @@ -447,7 +216,7 @@ namespace CalamityMod.Projectiles.Pets } if (projectile.velocity.X > num25) { - projectile.velocity.X = projectile.velocity.X - num23; + projectile.velocity.X -= num23; if (projectile.velocity.X > 0f) { projectile.velocity.X = projectile.velocity.X * 0.99f; @@ -455,7 +224,7 @@ namespace CalamityMod.Projectiles.Pets } if (projectile.velocity.Y < num26) { - projectile.velocity.Y = projectile.velocity.Y + num23; + projectile.velocity.Y += num23; if (projectile.velocity.Y < 0f) { projectile.velocity.Y = projectile.velocity.Y * 0.99f; @@ -463,7 +232,7 @@ namespace CalamityMod.Projectiles.Pets } if (projectile.velocity.Y > num26) { - projectile.velocity.Y = projectile.velocity.Y - num23; + projectile.velocity.Y -= num23; if (projectile.velocity.Y > 0f) { projectile.velocity.Y = projectile.velocity.Y * 0.99f; @@ -473,15 +242,6 @@ namespace CalamityMod.Projectiles.Pets { projectile.rotation = projectile.velocity.X * 0.05f; } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D texture = underwater ? Main.projectileTexture[projectile.type] : ModContent.GetTexture("CalamityMod/Projectiles/Pets/SirenFlopping"); - int height = (underwater ? Main.projectileTexture[projectile.type].Height : 256) / Main.projFrames[projectile.type]; - int frameHeight = height * projectile.frame; - 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.None, 0f); - return false; - } + } } } diff --git a/Projectiles/Pets/SirenYoung.png b/Projectiles/Pets/SirenYoung.png index 41481d1dba..70e101e4e1 100644 Binary files a/Projectiles/Pets/SirenYoung.png and b/Projectiles/Pets/SirenYoung.png differ diff --git a/Projectiles/Ranged/AMR2.cs b/Projectiles/Ranged/AMR2.cs index 1561160879..6f24ad444f 100644 --- a/Projectiles/Ranged/AMR2.cs +++ b/Projectiles/Ranged/AMR2.cs @@ -1,3 +1,4 @@ +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { @@ -21,7 +22,7 @@ namespace CalamityMod.Projectiles.Ranged projectile.ranged = true; projectile.ignoreWater = true; projectile.aiStyle = 1; - aiType = 242; + aiType = ProjectileID.BulletHighVelocity; projectile.penetrate = 1; projectile.timeLeft = 600; } diff --git a/Projectiles/Ranged/AMRShot.cs b/Projectiles/Ranged/AMRShot.cs index 08b817254f..b6a2b523e2 100644 --- a/Projectiles/Ranged/AMRShot.cs +++ b/Projectiles/Ranged/AMRShot.cs @@ -40,30 +40,32 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (crit) - { - for (int x = 0; x < 8; x++) - { - float xPos = x > 4 ? projectile.position.X + 500 : projectile.position.X - 500; - Vector2 vector2 = new Vector2(xPos, projectile.position.Y + Main.rand.Next(-500, 501)); - float num80 = xPos; - float speedX = (float)target.position.X - vector2.X; - float speedY = (float)target.position.Y - vector2.Y; - float dir = (float)Math.Sqrt((double)(speedX * speedX + speedY * speedY)); - dir = 10 / num80; - speedX *= dir * 150; - speedY *= dir * 150; - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(vector2.X, vector2.Y, speedX, speedY, ModContent.ProjectileType(), (int)(projectile.damage * 0.1), 1f, projectile.owner); - } - } - } + OnHitEffects(target.Center, crit); target.AddBuff(ModContent.BuffType(), 600); if (target.defense > 50) { target.defense -= 50; } + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + OnHitEffects(target.Center, crit); + target.AddBuff(ModContent.BuffType(), 600); + } + + private void OnHitEffects(Vector2 targetPos, bool crit) + { + if (crit) + { + for (int x = 0; x < 8; x++) + { + if (projectile.owner == Main.myPlayer) + { + CalamityUtils.ProjectileBarrage(projectile.Center, targetPos, x > 4, 500f, 500f, 0f, 500f, 10f, ModContent.ProjectileType(), (int)(projectile.damage * 0.1), 1f, projectile.owner); + } + } + } } } } diff --git a/Projectiles/Ranged/Aquashard.cs b/Projectiles/Ranged/Aquashard.cs index 5faf5234ff..0b9f8b7705 100644 --- a/Projectiles/Ranged/Aquashard.cs +++ b/Projectiles/Ranged/Aquashard.cs @@ -26,24 +26,18 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { projectile.velocity.X *= 0.9995f; - projectile.velocity.Y = projectile.velocity.Y + 0.01f; + projectile.velocity.Y += 0.01f; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - int num251 = Main.rand.Next(2, 4); + int projAmt = Main.rand.Next(2, 4); if (projectile.owner == Main.myPlayer) { - for (int num252 = 0; num252 < num251; num252++) + for (int i = 0; i < projAmt; i++) { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.5), 0f, projectile.owner, 0f, 0f); + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); + Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.5), 0f, projectile.owner, 0f, 0f); } } } diff --git a/Projectiles/Ranged/ArcticArrowProj.cs b/Projectiles/Ranged/ArcticArrowProj.cs index 04652dbf92..ff3cf364b6 100644 --- a/Projectiles/Ranged/ArcticArrowProj.cs +++ b/Projectiles/Ranged/ArcticArrowProj.cs @@ -2,8 +2,8 @@ using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using System; using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; if (Main.rand.NextBool(5)) { Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 67, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); diff --git a/Projectiles/Ranged/ArcticArrowProj.png b/Projectiles/Ranged/ArcticArrowProj.png index e4023c5037..5fcacaa5de 100644 Binary files a/Projectiles/Ranged/ArcticArrowProj.png and b/Projectiles/Ranged/ArcticArrowProj.png differ diff --git a/Projectiles/Ranged/AstralRound.cs b/Projectiles/Ranged/AstralRound.cs index 919fdbb32d..a43f9b7e03 100644 --- a/Projectiles/Ranged/AstralRound.cs +++ b/Projectiles/Ranged/AstralRound.cs @@ -10,6 +10,7 @@ namespace CalamityMod.Projectiles.Ranged { public class AstralRound : ModProjectile { + private float speed = 0f; public override void SetStaticDefaults() { DisplayName.SetDefault("Astral Round"); @@ -50,95 +51,20 @@ namespace CalamityMod.Projectiles.Ranged projectile.spriteDirection = projectile.direction; if (Main.rand.NextBool(2)) { - int randomDust = Main.rand.Next(2); - if (randomDust == 0) - { - randomDust = ModContent.DustType(); - } - else - { - randomDust = ModContent.DustType(); - } - int num137 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 1, 1, randomDust, 0f, 0f, 0, default, 0.5f); - Main.dust[num137].alpha = projectile.alpha; - Main.dust[num137].velocity *= 0f; - Main.dust[num137].noGravity = true; - } - float num138 = (float)Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)); - float num139 = projectile.localAI[0]; - if (num139 == 0f) - { - projectile.localAI[0] = num138; - num139 = num138; - } - float num140 = projectile.position.X; - float num141 = projectile.position.Y; - float num142 = 200f; - bool flag4 = false; - int num143 = 0; - if (projectile.ai[1] == 0f) - { - for (int num144 = 0; num144 < 200; num144++) - { - if (Main.npc[num144].CanBeChasedBy(projectile, false) && (projectile.ai[1] == 0f || projectile.ai[1] == (float)(num144 + 1))) - { - float num145 = Main.npc[num144].position.X + (float)(Main.npc[num144].width / 2); - float num146 = Main.npc[num144].position.Y + (float)(Main.npc[num144].height / 2); - float num147 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num145) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num146); - if (num147 < num142 && Collision.CanHit(new Vector2(projectile.position.X + (float)(projectile.width / 2), projectile.position.Y + (float)(projectile.height / 2)), 1, 1, Main.npc[num144].position, Main.npc[num144].width, Main.npc[num144].height)) - { - num142 = num147; - num140 = num145; - num141 = num146; - flag4 = true; - num143 = num144; - } - } - } - if (flag4) - { - projectile.ai[1] = (float)(num143 + 1); - } - flag4 = false; - } - if (projectile.ai[1] > 0f) - { - int num148 = (int)(projectile.ai[1] - 1f); - if (Main.npc[num148].active && Main.npc[num148].CanBeChasedBy(projectile, true) && !Main.npc[num148].dontTakeDamage) - { - float num149 = Main.npc[num148].position.X + (float)(Main.npc[num148].width / 2); - float num150 = Main.npc[num148].position.Y + (float)(Main.npc[num148].height / 2); - float num151 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num149) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num150); - if (num151 < 1000f) - { - flag4 = true; - num140 = Main.npc[num148].position.X + (float)(Main.npc[num148].width / 2); - num141 = Main.npc[num148].position.Y + (float)(Main.npc[num148].height / 2); - } - } - else - { - projectile.ai[1] = 0f; - } - } - if (!projectile.friendly) - { - flag4 = false; - } - if (flag4) - { - float num152 = num139; - Vector2 vector13 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num153 = num140 - vector13.X; - float num154 = num141 - vector13.Y; - float num155 = (float)Math.Sqrt((double)(num153 * num153 + num154 * num154)); - num155 = num152 / num155; - num153 *= num155; - num154 *= num155; - int num156 = 12; - projectile.velocity.X = (projectile.velocity.X * (float)(num156 - 1) + num153) / (float)num156; - projectile.velocity.Y = (projectile.velocity.Y * (float)(num156 - 1) + num154) / (float)num156; + int randomDust = Utils.SelectRandom(Main.rand, new int[] + { + ModContent.DustType(), + ModContent.DustType() + }); + int astral = Dust.NewDust(projectile.position, 1, 1, randomDust, 0f, 0f, 0, default, 0.5f); + Main.dust[astral].alpha = projectile.alpha; + Main.dust[astral].velocity *= 0f; + Main.dust[astral].noGravity = true; } + + if (speed == 0f) + speed = projectile.velocity.Length(); + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 200f, speed, 12f); return false; } diff --git a/Projectiles/Ranged/BallistaGreatArrow.cs b/Projectiles/Ranged/BallistaGreatArrow.cs index adb0166742..f68b286d64 100644 --- a/Projectiles/Ranged/BallistaGreatArrow.cs +++ b/Projectiles/Ranged/BallistaGreatArrow.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Ranged projectile.arrow = true; projectile.penetrate = 2; projectile.aiStyle = 1; - aiType = 1; + aiType = ProjectileID.WoodenArrowFriendly; } public override bool OnTileCollide(Vector2 oldVelocity) diff --git a/Projectiles/Ranged/BeeRPG.cs b/Projectiles/Ranged/BeeRPG.cs index 9e4e8c21e0..715177685a 100644 --- a/Projectiles/Ranged/BeeRPG.cs +++ b/Projectiles/Ranged/BeeRPG.cs @@ -52,13 +52,13 @@ namespace CalamityMod.Projectiles.Ranged } else if (Main.rand.NextBool(2)) { - int num252 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default, 1f); + int num252 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 31, 0f, 0f, 100, default, 1f); Main.dust[num252].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[num252].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f; Main.dust[num252].noGravity = true; Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2)).RotatedBy((double)projectile.rotation, default) * 1.1f; Main.rand.Next(2); - num252 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 1f); + num252 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 6, 0f, 0f, 100, default, 1f); Main.dust[num252].scale = 1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[num252].noGravity = true; Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2 - 6)).RotatedBy((double)projectile.rotation, default) * 1.1f; @@ -124,7 +124,7 @@ namespace CalamityMod.Projectiles.Ranged Main.PlaySound(SoundID.Item, (int)projectile.Center.X, (int)projectile.Center.Y, 14); for (int num621 = 0; num621 < 5; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 31, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -134,13 +134,13 @@ namespace CalamityMod.Projectiles.Ranged } for (int num623 = 0; num623 < 10; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 6, 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, 6, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 6, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - CalamityUtils.ExplosionGores(projectile, 3); + CalamityUtils.ExplosionGores(projectile.Center, 3); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Ranged/BigNuke.cs b/Projectiles/Ranged/BigNuke.cs index 37922be5c9..ded24101f6 100644 --- a/Projectiles/Ranged/BigNuke.cs +++ b/Projectiles/Ranged/BigNuke.cs @@ -71,7 +71,7 @@ namespace CalamityMod.Projectiles.Ranged Main.PlaySound(SoundID.Item, (int)projectile.Center.X, (int)projectile.Center.Y, 14); for (int num621 = 0; num621 < 90; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 31, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -81,13 +81,13 @@ namespace CalamityMod.Projectiles.Ranged } for (int num623 = 0; num623 < 180; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 6, 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, 6, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 6, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - CalamityUtils.ExplosionGores(projectile, 9); + CalamityUtils.ExplosionGores(projectile.Center, 9); } } } diff --git a/Projectiles/Ranged/BloodfireArrowProj.cs b/Projectiles/Ranged/BloodfireArrowProj.cs index c8b41d9cfa..12ac42b282 100644 --- a/Projectiles/Ranged/BloodfireArrowProj.cs +++ b/Projectiles/Ranged/BloodfireArrowProj.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Ranged; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -39,10 +40,8 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) - MathHelper.ToRadians(90); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] == 15f) + if (projectile.timeLeft % 15 == 0) { - projectile.localAI[0] = 0f; for (int l = 0; l < 12; l++) { Vector2 vector3 = Vector2.UnitX * (float)-(float)projectile.width / 2f; @@ -56,6 +55,10 @@ namespace CalamityMod.Projectiles.Ranged Main.dust[num9].velocity = Vector2.Normalize(projectile.Center - projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; } } + if (projectile.ai[1] == 80f) //means it's from Arterial Assault's wooden arrow conversion + { + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 400f, 20f, 20f); + } } public override void Kill(int timeLeft) @@ -86,7 +89,12 @@ namespace CalamityMod.Projectiles.Ranged return; } Player player = Main.player[projectile.owner]; - if (Main.rand.NextBool(3)) + int chance = 3; + if (player.ActiveItem().type == ModContent.ItemType()) + { + chance = 6; + } + if (Main.rand.NextBool(chance)) { player.statLife += 1; player.HealEffect(1); diff --git a/Projectiles/Ranged/BlueExoArrow.cs b/Projectiles/Ranged/BlueExoArrow.cs index b38cfbcacc..2a9210321b 100644 --- a/Projectiles/Ranged/BlueExoArrow.cs +++ b/Projectiles/Ranged/BlueExoArrow.cs @@ -96,17 +96,30 @@ namespace CalamityMod.Projectiles.Ranged return false; } + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.ExoDebuffs(); + for (int x = 0; x < 3; x++) + { + float xPos = projectile.ai[0] > 0 ? projectile.position.X + 500 : projectile.position.X - 500; + Vector2 vector2 = new Vector2(xPos, projectile.position.Y + Main.rand.Next(-500, 501)); + float num80 = xPos; + float speedX = (float)target.position.X - vector2.X; + float speedY = (float)target.position.Y - vector2.Y; + float dir = (float)Math.Sqrt((double)(speedX * speedX + speedY * speedY)); + dir = 10 / num80; + speedX *= dir * 150; + speedY *= dir * 150; + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(vector2.X, vector2.Y, speedX, speedY, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.7), 1f, projectile.owner); + } + } + } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 30); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.Ichor, 120); + target.ExoDebuffs(); for (int x = 0; x < 3; x++) { float xPos = projectile.ai[0] > 0 ? projectile.position.X + 500 : projectile.position.X - 500; diff --git a/Projectiles/Ranged/Bolt.cs b/Projectiles/Ranged/Bolt.cs index 15d4aba20f..cbe59afe1f 100644 --- a/Projectiles/Ranged/Bolt.cs +++ b/Projectiles/Ranged/Bolt.cs @@ -26,6 +26,7 @@ namespace CalamityMod.Projectiles.Ranged projectile.ranged = true; projectile.alpha = 255; projectile.penetrate = 1; + projectile.timeLeft = 600; } public override void AI() @@ -33,11 +34,9 @@ namespace CalamityMod.Projectiles.Ranged Lighting.AddLight(projectile.Center, 0f, 0.5f, 0.65f); projectile.velocity.X *= 1.015f; projectile.velocity.Y *= 1.015f; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] == 30f) + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + if (projectile.timeLeft % 30 == 0) { - projectile.localAI[0] = 0f; for (int l = 0; l < 12; l++) { Vector2 vector3 = Vector2.UnitX * (float)-(float)projectile.width / 2f; @@ -69,5 +68,25 @@ namespace CalamityMod.Projectiles.Ranged CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); return false; } + + public override void Kill(int timeLeft) + { + projectile.position = projectile.Center; + projectile.width = projectile.height = 32; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.Damage(); + int num212 = Main.rand.Next(4, 8); + for (int num213 = 0; num213 < num212; num213++) + { + int num214 = Dust.NewDust(projectile.Center - projectile.velocity / 2f, 0, 0, 135, 0f, 0f, 100, default, 2f); + Main.dust[num214].velocity *= 2f; + Main.dust[num214].noGravity = true; + } + } } } diff --git a/Projectiles/Ranged/CardDiamond.cs b/Projectiles/Ranged/CardDiamond.cs index ebb8b18787..ccc514c942 100644 --- a/Projectiles/Ranged/CardDiamond.cs +++ b/Projectiles/Ranged/CardDiamond.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Ranged projectile.spriteDirection = projectile.direction; if (Main.rand.NextBool(2)) { - int num137 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 1, 1, 30, 0f, 0f, 0, default, 0.5f); + int num137 = Dust.NewDust(projectile.position, 1, 1, 30, 0f, 0f, 0, default, 0.5f); Main.dust[num137].velocity *= 0f; Main.dust[num137].noGravity = true; } @@ -53,33 +53,31 @@ namespace CalamityMod.Projectiles.Ranged { projectile.position = projectile.Center; projectile.width = projectile.height = 50; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; + projectile.Center = projectile.position; + projectile.maxPenetrate = projectile.penetrate = -1; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 10; projectile.Damage(); - Main.PlaySound(SoundID.Item14, (int)projectile.Center.X, (int)projectile.Center.Y); - for (int num621 = 0; num621 < 10; num621++) + Main.PlaySound(SoundID.Item14, projectile.Center); + for (int d = 0; d < 10; d++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 30, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int paper = Dust.NewDust(projectile.position, projectile.width, projectile.height, 30, 0f, 0f, 100, default, 2f); + Main.dust[paper].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; + Main.dust[paper].scale = 0.5f; + Main.dust[paper].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 15; num623++) + for (int d = 0; d < 15; d++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 30, 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, 30, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int paper = Dust.NewDust(projectile.position, projectile.width, projectile.height, 30, 0f, 0f, 100, default, 3f); + Main.dust[paper].noGravity = true; + Main.dust[paper].velocity *= 5f; + paper = Dust.NewDust(projectile.position, projectile.width, projectile.height, 30, 0f, 0f, 100, default, 2f); + Main.dust[paper].velocity *= 2f; } - CalamityUtils.ExplosionGores(projectile, 3); + CalamityUtils.ExplosionGores(projectile.Center, 3); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Ranged/ClamorRifleProj.cs b/Projectiles/Ranged/ClamorRifleProj.cs index b356c3be83..9b5430bd60 100644 --- a/Projectiles/Ranged/ClamorRifleProj.cs +++ b/Projectiles/Ranged/ClamorRifleProj.cs @@ -49,19 +49,13 @@ namespace CalamityMod.Projectiles.Ranged public override void Kill(int timeLeft) { - int num251 = Main.rand.Next(2, 3); + int bulletAmt = 2; if (projectile.owner == Main.myPlayer) { - for (int num252 = 0; num252 < num251; num252++) + for (int b = 0; b < bulletAmt; b++) { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, ModContent.ProjectileType(), (int)(projectile.damage * 0.45), 0f, projectile.owner, 0f, 0f); + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); + Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.45), 0f, projectile.owner, 0f, 0f); } } Main.PlaySound(SoundID.Item118, projectile.Center); diff --git a/Projectiles/Ranged/CosmicFire.cs b/Projectiles/Ranged/CosmicFire.cs index 08fd53fe89..a55ec15ef8 100644 --- a/Projectiles/Ranged/CosmicFire.cs +++ b/Projectiles/Ranged/CosmicFire.cs @@ -14,8 +14,8 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 6; - projectile.height = 6; + projectile.width = 10; + projectile.height = 10; projectile.friendly = true; projectile.ignoreWater = true; projectile.ranged = true; @@ -37,47 +37,44 @@ namespace CalamityMod.Projectiles.Ranged } if (projectile.ai[0] > 7f) { - float num296 = 1f; + float scalar = 1f; if (projectile.ai[0] == 8f) { - num296 = 0.25f; + scalar = 0.25f; } else if (projectile.ai[0] == 9f) { - num296 = 0.5f; + scalar = 0.5f; } else if (projectile.ai[0] == 10f) { - num296 = 0.75f; + scalar = 0.75f; } projectile.ai[0] += 1f; - int num297 = 58; + int dustType = Main.rand.NextBool(4) ? 61 : 62; if (Main.rand.NextBool(2)) { - for (int num298 = 0; num298 < 1; num298++) - { - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); - Dust dust = Main.dust[num299]; - 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 *= num296; - dust.velocity += projectile.velocity; - if (!dust.noGravity) - { - dust.velocity *= 0.5f; - } - } + int fire = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); + Dust dust = Main.dust[fire]; + 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 *= scalar; + dust.velocity += projectile.velocity; + if (!dust.noGravity) + { + dust.velocity *= 0.5f; + } } } else diff --git a/Projectiles/Ranged/DrataliornusExoArrow.cs b/Projectiles/Ranged/DrataliornusExoArrow.cs index c032573a6e..d57837122d 100644 --- a/Projectiles/Ranged/DrataliornusExoArrow.cs +++ b/Projectiles/Ranged/DrataliornusExoArrow.cs @@ -60,10 +60,11 @@ namespace CalamityMod.Projectiles.Ranged } } - public override void OnHitPlayer(Player target, int damage, bool crit) + public override void OnHitPvp(Player target, int damage, bool crit) { - target.AddBuff(BuffID.Ichor, 540); target.AddBuff(ModContent.BuffType(), 540); + target.AddBuff(BuffID.Ichor, 540); + target.ExoDebuffs(); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -72,14 +73,7 @@ namespace CalamityMod.Projectiles.Ranged target.AddBuff(BuffID.Daybreak, 540); target.AddBuff(ModContent.BuffType(), 540); - target.AddBuff(ModContent.BuffType(), 30); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.Ichor, 120); + target.ExoDebuffs(); } public override Color? GetAlpha(Color lightColor) diff --git a/Projectiles/Ranged/ElysianArrowProj.cs b/Projectiles/Ranged/ElysianArrowProj.cs index ea2f43977c..484e84d68c 100644 --- a/Projectiles/Ranged/ElysianArrowProj.cs +++ b/Projectiles/Ranged/ElysianArrowProj.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; } public override bool OnTileCollide(Vector2 oldVelocity) @@ -57,7 +57,7 @@ namespace CalamityMod.Projectiles.Ranged projectile.Damage(); for (int num621 = 0; num621 < 2; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -67,13 +67,13 @@ namespace CalamityMod.Projectiles.Ranged } for (int num623 = 0; num623 < 6; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(projectile.position, 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); + num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - CalamityUtils.ExplosionGores(projectile, 3); + CalamityUtils.ExplosionGores(projectile.Center, 3); float x = projectile.position.X + (float)Main.rand.Next(-400, 400); float y = projectile.position.Y - (float)Main.rand.Next(500, 800); Vector2 vector = new Vector2(x, y); diff --git a/Projectiles/Ranged/ElysianArrowProj.png b/Projectiles/Ranged/ElysianArrowProj.png index bf8d18b65e..e0936c2556 100644 Binary files a/Projectiles/Ranged/ElysianArrowProj.png and b/Projectiles/Ranged/ElysianArrowProj.png differ diff --git a/Projectiles/Ranged/EmesisGore.cs b/Projectiles/Ranged/EmesisGore.cs index 27d0c67df6..e31c82702e 100644 --- a/Projectiles/Ranged/EmesisGore.cs +++ b/Projectiles/Ranged/EmesisGore.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Ranged } public override void AI() { - CalamityUtils.StickyProjAI(projectile, 15); + projectile.StickyProjAI(15); // Override the default DOT used in the method above. if (projectile.ai[0] == 1f) @@ -66,7 +66,7 @@ namespace CalamityMod.Projectiles.Ranged public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - CalamityUtils.ModifyHitNPCSticky(projectile, 8, true); + projectile.ModifyHitNPCSticky(8, true); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) diff --git a/Projectiles/Ranged/EnhancedNanoRoundProj.cs b/Projectiles/Ranged/EnhancedNanoRoundProj.cs index c360fdb514..2e3f3e5e69 100644 --- a/Projectiles/Ranged/EnhancedNanoRoundProj.cs +++ b/Projectiles/Ranged/EnhancedNanoRoundProj.cs @@ -61,16 +61,10 @@ namespace CalamityMod.Projectiles.Ranged { if (projectile.owner == Main.myPlayer) { - for (int num252 = 0; num252 < 2; num252++) + for (int i = 0; i < 2; i++) { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), value15.X, value15.Y, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.3), 0f, projectile.owner, 0f, 0f); + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); + Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.3), 0f, projectile.owner, 0f, 0f); } } } diff --git a/Projectiles/Ranged/EssenceFire.cs b/Projectiles/Ranged/EssenceFire.cs index 0ef5baaf68..ff134707ac 100644 --- a/Projectiles/Ranged/EssenceFire.cs +++ b/Projectiles/Ranged/EssenceFire.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; @@ -50,12 +51,12 @@ namespace CalamityMod.Projectiles.Ranged num296 = 0.75f; } projectile.ai[0] += 1f; - int num297 = 173; + int dustType = (int)CalamityDusts.PurpleCosmolite; if (Main.rand.NextBool(2)) { for (int num298 = 0; num298 < 1; num298++) { - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); + int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); Dust dust = Main.dust[num299]; if (Main.rand.NextBool(3)) { diff --git a/Projectiles/Ranged/ExoFire.cs b/Projectiles/Ranged/ExoFire.cs index 8058226979..455f3739a8 100644 --- a/Projectiles/Ranged/ExoFire.cs +++ b/Projectiles/Ranged/ExoFire.cs @@ -1,5 +1,3 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using System.Collections.Generic; using Terraria; @@ -96,15 +94,12 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 30); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.Ichor, 120); + target.ExoDebuffs(); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.ExoDebuffs(); } } } diff --git a/Projectiles/Ranged/ExoLight.cs b/Projectiles/Ranged/ExoLight.cs index a87ba62638..3572009064 100644 --- a/Projectiles/Ranged/ExoLight.cs +++ b/Projectiles/Ranged/ExoLight.cs @@ -1,6 +1,4 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; using System.IO; @@ -86,15 +84,11 @@ namespace CalamityMod.Projectiles.Ranged } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 60); - target.AddBuff(ModContent.BuffType(), 180); - target.AddBuff(ModContent.BuffType(), 180); - target.AddBuff(ModContent.BuffType(), 180); - target.AddBuff(ModContent.BuffType(), 180); - target.AddBuff(BuffID.CursedInferno, 180); - target.AddBuff(BuffID.Frostburn, 180); - target.AddBuff(BuffID.OnFire, 180); - target.AddBuff(BuffID.Ichor, 180); + target.ExoDebuffs(2f); + } + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.ExoDebuffs(2f); } } } diff --git a/Projectiles/Ranged/ExoLightBurst.cs b/Projectiles/Ranged/ExoLightBurst.cs index b34a586853..1a6a497922 100644 --- a/Projectiles/Ranged/ExoLightBurst.cs +++ b/Projectiles/Ranged/ExoLightBurst.cs @@ -1,6 +1,4 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using System; using Terraria; using Terraria.ID; @@ -50,7 +48,7 @@ namespace CalamityMod.Projectiles.Ranged } if (projectile.ai[0] == 0f) { - NPC potentialTarget = projectile.Center.ClosestNPCAt(MaxDistanceFromTarget, true); + NPC potentialTarget = projectile.Center.ClosestNPCAt(MaxDistanceFromTarget, true, true); if (potentialTarget != null) { if (projectile.Distance(potentialTarget.Center) > MinDistanceFromTarget) @@ -61,11 +59,11 @@ namespace CalamityMod.Projectiles.Ranged } } } - CalamityUtils.StickyProjAI(projectile, 5); + projectile.StickyProjAI(5); } public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - CalamityUtils.ModifyHitNPCSticky(projectile, 4, false); + projectile.ModifyHitNPCSticky(4, false); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) @@ -75,17 +73,15 @@ namespace CalamityMod.Projectiles.Ranged CalamityGlobalProjectile.ExpandHitboxBy(projectile, width, height); return null; } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 60); - target.AddBuff(ModContent.BuffType(), 180); - target.AddBuff(ModContent.BuffType(), 180); - target.AddBuff(ModContent.BuffType(), 180); - target.AddBuff(ModContent.BuffType(), 180); - target.AddBuff(BuffID.CursedInferno, 180); - target.AddBuff(BuffID.Frostburn, 180); - target.AddBuff(BuffID.OnFire, 180); - target.AddBuff(BuffID.Ichor, 180); + target.ExoDebuffs(2f); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.ExoDebuffs(2f); } } } diff --git a/Projectiles/Ranged/ExplodingStake.cs b/Projectiles/Ranged/ExplodingStake.cs index 6e06e2293f..4e57b6f021 100644 --- a/Projectiles/Ranged/ExplodingStake.cs +++ b/Projectiles/Ranged/ExplodingStake.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Ranged projectile.scale = 0.8f; projectile.extraUpdates = 3; projectile.aiStyle = 1; - aiType = 323; + aiType = ProjectileID.Stake; } public override void AI() diff --git a/Projectiles/Ranged/FlamingStake.cs b/Projectiles/Ranged/FlamingStake.cs index 645e97232a..aa2e150a3d 100644 --- a/Projectiles/Ranged/FlamingStake.cs +++ b/Projectiles/Ranged/FlamingStake.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Ranged projectile.alpha = 255; projectile.extraUpdates = 3; projectile.aiStyle = 1; - aiType = 323; + aiType = ProjectileID.Stake; } public override void AI() diff --git a/Projectiles/Ranged/FossilShard.cs b/Projectiles/Ranged/FossilShard.cs index e0da13936a..6a2444b113 100644 --- a/Projectiles/Ranged/FossilShard.cs +++ b/Projectiles/Ranged/FossilShard.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.StatDebuffs; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { @@ -19,7 +20,7 @@ namespace CalamityMod.Projectiles.Ranged projectile.penetrate = 1; projectile.aiStyle = 1; projectile.timeLeft = 120; - aiType = 1; + aiType = ProjectileID.WoodenArrowFriendly; } public override void AI() diff --git a/Projectiles/Ranged/FungiOrb.cs b/Projectiles/Ranged/FungiOrb.cs index eb951a4840..5515739c10 100644 --- a/Projectiles/Ranged/FungiOrb.cs +++ b/Projectiles/Ranged/FungiOrb.cs @@ -44,19 +44,13 @@ namespace CalamityMod.Projectiles.Ranged public override void Kill(int timeLeft) { - int num251 = Main.rand.Next(2, 5); + int fungiAmt = Main.rand.Next(2, 5); if (projectile.owner == Main.myPlayer) { - for (int num252 = 0; num252 < num251; num252++) + for (int f = 0; f < fungiAmt; f++) { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.25), 0f, projectile.owner, 0f, 0f); + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); + Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.25), 0f, projectile.owner, 0f, 0f); } } Main.PlaySound(SoundID.NPCDeath1, projectile.position); diff --git a/Projectiles/Ranged/GoliathRocket.cs b/Projectiles/Ranged/GoliathRocket.cs index 5110295332..1d7a314a2e 100644 --- a/Projectiles/Ranged/GoliathRocket.cs +++ b/Projectiles/Ranged/GoliathRocket.cs @@ -67,13 +67,13 @@ namespace CalamityMod.Projectiles.Ranged } else if (Main.rand.NextBool(2)) { - int num252 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default, 1f); + int num252 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 31, 0f, 0f, 100, default, 1f); Main.dust[num252].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[num252].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f; Main.dust[num252].noGravity = true; Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2)).RotatedBy((double)projectile.rotation, default) * 1.1f; Main.rand.Next(2); - num252 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 1f); + num252 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 6, 0f, 0f, 100, default, 1f); Main.dust[num252].scale = 1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[num252].noGravity = true; Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2 - 6)).RotatedBy((double)projectile.rotation, default) * 1.1f; @@ -140,7 +140,7 @@ namespace CalamityMod.Projectiles.Ranged Main.PlaySound(SoundID.Item14, projectile.position); for (int num621 = 0; num621 < 20; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 31, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -150,13 +150,13 @@ namespace CalamityMod.Projectiles.Ranged } for (int num623 = 0; num623 < 30; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 6, 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, 6, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 6, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - CalamityUtils.ExplosionGores(projectile, 3); + CalamityUtils.ExplosionGores(projectile.Center, 3); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Ranged/GreenExoArrow.cs b/Projectiles/Ranged/GreenExoArrow.cs index 14dbd90676..966670abc7 100644 --- a/Projectiles/Ranged/GreenExoArrow.cs +++ b/Projectiles/Ranged/GreenExoArrow.cs @@ -1,5 +1,3 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -59,15 +57,12 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 30); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.Ichor, 120); + target.ExoDebuffs(); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.ExoDebuffs(); } public override Color? GetAlpha(Color lightColor) diff --git a/Projectiles/Ranged/HalleysComet.cs b/Projectiles/Ranged/HalleysComet.cs index fa16faba6b..791ce568d8 100644 --- a/Projectiles/Ranged/HalleysComet.cs +++ b/Projectiles/Ranged/HalleysComet.cs @@ -13,8 +13,7 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; + projectile.width = projectile.height = 12; projectile.friendly = true; projectile.ignoreWater = true; projectile.ranged = true; @@ -29,32 +28,30 @@ namespace CalamityMod.Projectiles.Ranged { projectile.scale *= 1.01f; } + Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.35f / 255f, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0.45f / 255f); - if (projectile.timeLeft > 600) + + if (projectile.ai[0]++ > 5f) { - projectile.timeLeft = 600; - } - if (projectile.ai[0] > 5f) - { - float num296 = 1f; + float dustScaleSize = 1f; if (projectile.ai[0] == 6f) { - num296 = 0.25f; + dustScaleSize = 0.25f; } else if (projectile.ai[0] == 7f) { - num296 = 0.5f; + dustScaleSize = 0.5f; } else if (projectile.ai[0] == 8f) { - num296 = 0.75f; + dustScaleSize = 0.75f; } projectile.ai[0] += 1f; - int num297 = 176; - for (int num298 = 0; num298 < 3; num298++) + int dustType = 176; + for (int i = 0; i < 3; i++) { - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 1, default, 1f); - Dust dust = Main.dust[num299]; + int fire = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 1, default, 1f); + Dust dust = Main.dust[fire]; if (Main.rand.NextBool(3)) { dust.noGravity = true; @@ -68,7 +65,7 @@ namespace CalamityMod.Projectiles.Ranged } dust.velocity.X *= 1.2f; dust.velocity.Y *= 1.2f; - dust.scale *= num296; + dust.scale *= dustScaleSize; dust.velocity += projectile.velocity; if (!dust.noGravity) { @@ -76,16 +73,18 @@ namespace CalamityMod.Projectiles.Ranged } } } - else - { - projectile.ai[0] += 1f; - } + projectile.rotation += 0.3f * (float)projectile.direction; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 300); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 300); } } } diff --git a/Projectiles/Ranged/HandheldTankShell.cs b/Projectiles/Ranged/HandheldTankShell.cs index effbbe3a81..428e03643e 100644 --- a/Projectiles/Ranged/HandheldTankShell.cs +++ b/Projectiles/Ranged/HandheldTankShell.cs @@ -106,7 +106,7 @@ namespace CalamityMod.Projectiles.Ranged void SpawnExplosionDust() { // Sparks and such - Vector2 corner = new Vector2(projectile.position.X, projectile.position.Y); + Vector2 corner = projectile.position; for (int i = 0; i < 40; i++) { int idx = Dust.NewDust(corner, projectile.width, projectile.height, 31, 0f, 0f, 100, default, 2f); @@ -127,7 +127,7 @@ namespace CalamityMod.Projectiles.Ranged } // Smoke, which counts as a Gore - CalamityUtils.ExplosionGores(projectile, 3); + CalamityUtils.ExplosionGores(projectile.Center, 3); } } } diff --git a/Projectiles/Ranged/HiveBomb.cs b/Projectiles/Ranged/HiveBomb.cs index 44bcc0fcbf..40452af1b9 100644 --- a/Projectiles/Ranged/HiveBomb.cs +++ b/Projectiles/Ranged/HiveBomb.cs @@ -67,13 +67,13 @@ namespace CalamityMod.Projectiles.Ranged } else if (Main.rand.NextBool(2)) { - int num252 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default, 1f); + int num252 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 31, 0f, 0f, 100, default, 1f); Main.dust[num252].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[num252].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f; Main.dust[num252].noGravity = true; Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2)).RotatedBy((double)projectile.rotation, default) * 1.1f; Main.rand.Next(2); - num252 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 1f); + num252 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 6, 0f, 0f, 100, default, 1f); Main.dust[num252].scale = 1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[num252].noGravity = true; Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2 - 6)).RotatedBy((double)projectile.rotation, default) * 1.1f; @@ -140,7 +140,7 @@ namespace CalamityMod.Projectiles.Ranged Main.PlaySound(SoundID.Item14, projectile.position); for (int num621 = 0; num621 < 20; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 89, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 89, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -150,13 +150,13 @@ namespace CalamityMod.Projectiles.Ranged } for (int num623 = 0; num623 < 30; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 89, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 89, 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, 89, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 89, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - CalamityUtils.ExplosionGores(projectile, 3); + CalamityUtils.ExplosionGores(projectile.Center, 3); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Ranged/HiveMissile.cs b/Projectiles/Ranged/HiveMissile.cs index 7ca2d9624d..f765cf2c87 100644 --- a/Projectiles/Ranged/HiveMissile.cs +++ b/Projectiles/Ranged/HiveMissile.cs @@ -67,13 +67,13 @@ namespace CalamityMod.Projectiles.Ranged } else if (Main.rand.NextBool(2)) { - int num252 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default, 1f); + int num252 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 31, 0f, 0f, 100, default, 1f); Main.dust[num252].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[num252].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f; Main.dust[num252].noGravity = true; Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2)).RotatedBy((double)projectile.rotation, default) * 1.1f; Main.rand.Next(2); - num252 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 1f); + num252 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 6, 0f, 0f, 100, default, 1f); Main.dust[num252].scale = 1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[num252].noGravity = true; Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2 - 6)).RotatedBy((double)projectile.rotation, default) * 1.1f; @@ -140,7 +140,7 @@ namespace CalamityMod.Projectiles.Ranged Main.PlaySound(SoundID.Item14, projectile.position); for (int num621 = 0; num621 < 20; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 90, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 90, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -150,13 +150,13 @@ namespace CalamityMod.Projectiles.Ranged } for (int num623 = 0; num623 < 30; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 90, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 90, 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, 90, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 90, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - CalamityUtils.ExplosionGores(projectile, 3); + CalamityUtils.ExplosionGores(projectile.Center, 3); } } } diff --git a/Projectiles/Ranged/HyperiusBulletProj.cs b/Projectiles/Ranged/HyperiusBulletProj.cs index 14f578fa0d..2f0713c0b3 100644 --- a/Projectiles/Ranged/HyperiusBulletProj.cs +++ b/Projectiles/Ranged/HyperiusBulletProj.cs @@ -75,36 +75,20 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - float xPos = Main.rand.NextBool(2) ? projectile.position.X + 800 : projectile.position.X - 800; - Vector2 vector2 = new Vector2(xPos, projectile.position.Y + Main.rand.Next(-800, 801)); - float num80 = xPos; - float speedX = (float)target.position.X - vector2.X; - float speedY = (float)target.position.Y - vector2.Y; - float dir = 10 / num80; - speedX *= dir * 150; - speedY *= dir * 150; - if (speedX > 15f) - { - speedX = 15f; - } - if (speedX < -15f) - { - speedX = -15f; - } - if (speedY > 15f) - { - speedY = 15f; - } - if (speedY < -15f) - { - speedY = -15f; - } - if (projectile.owner == Main.myPlayer) - { - int splitDamage = (int)(projectile.damage * 0.6f); - float splitKB = 1f; - Projectile.NewProjectile(vector2, new Vector2(speedX, speedY), ModContent.ProjectileType(), splitDamage, splitKB, projectile.owner); - } + OnHitEffects(target.Center); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + OnHitEffects(target.Center); + } + + private void OnHitEffects(Vector2 targetPos) + { + if (projectile.owner == Main.myPlayer) + { + CalamityUtils.ProjectileBarrage(projectile.Center, targetPos, Main.rand.NextBool(), 800f, 800f, 0f, 800f, 10f, ModContent.ProjectileType(), (int)(projectile.damage * 0.6), 1f, projectile.owner, true); + } } public override void Kill(int timeLeft) diff --git a/Projectiles/Ranged/HyperiusSplit.cs b/Projectiles/Ranged/HyperiusSplit.cs index 83c1c3f3c9..60719f0a07 100644 --- a/Projectiles/Ranged/HyperiusSplit.cs +++ b/Projectiles/Ranged/HyperiusSplit.cs @@ -50,6 +50,8 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { + if (projectile.timeLeft == 360) + return false; CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); return false; } diff --git a/Projectiles/Ranged/ImpactRound.cs b/Projectiles/Ranged/ImpactRound.cs index c471d98944..77be1dd621 100644 --- a/Projectiles/Ranged/ImpactRound.cs +++ b/Projectiles/Ranged/ImpactRound.cs @@ -43,19 +43,5 @@ namespace CalamityMod.Projectiles.Ranged } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.timeLeft < 600; - - public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - double damageMult = 1D; - if (crit) - { - damageMult += 0.25; - } - if (target.Inorganic()) - { - damageMult += 0.1; - } - damage = (int)(damage * damageMult); - } } } diff --git a/Projectiles/Ranged/LunarBolt.cs b/Projectiles/Ranged/LunarBolt.cs index 6cd1925b5f..8a588f734e 100644 --- a/Projectiles/Ranged/LunarBolt.cs +++ b/Projectiles/Ranged/LunarBolt.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Projectiles.Ranged projectile.friendly = true; projectile.ranged = true; projectile.alpha = 255; - projectile.penetrate = 1; + projectile.penetrate = 2; projectile.extraUpdates = 1; projectile.timeLeft = 180; } @@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Ranged for (int num161 = 0; num161 < 5; num161++) { Vector2 dspeed = -projectile.velocity * 0.5f; - int num162 = Dust.NewDust(projectile.Center, 1, 1, 206, 0f, 0f, 0, default(Color), 1.2f); + int num162 = Dust.NewDust(projectile.Center, 1, 1, 206, 0f, 0f, 0, default, 1.2f); Main.dust[num162].alpha = projectile.alpha; Main.dust[num162].velocity = dspeed; Main.dust[num162].noGravity = true; diff --git a/Projectiles/Ranged/MagnomalyBeam.cs b/Projectiles/Ranged/MagnomalyBeam.cs index c89a3e15ca..6814cdcebe 100644 --- a/Projectiles/Ranged/MagnomalyBeam.cs +++ b/Projectiles/Ranged/MagnomalyBeam.cs @@ -103,15 +103,12 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 30); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.Ichor, 120); + target.ExoDebuffs(); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.ExoDebuffs(); } } } diff --git a/Projectiles/Ranged/MagnomalyExplosion.cs b/Projectiles/Ranged/MagnomalyExplosion.cs index 5f6e9859f2..eaa19849a5 100644 --- a/Projectiles/Ranged/MagnomalyExplosion.cs +++ b/Projectiles/Ranged/MagnomalyExplosion.cs @@ -1,8 +1,6 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; namespace CalamityMod.Projectiles.Ranged { public class MagnomalyExplosion : ModProjectile @@ -29,15 +27,12 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 30); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.Ichor, 120); + target.ExoDebuffs(); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.ExoDebuffs(); } } } diff --git a/Projectiles/Ranged/MagnomalyRocket.cs b/Projectiles/Ranged/MagnomalyRocket.cs index ebc84779fa..767866cf0e 100644 --- a/Projectiles/Ranged/MagnomalyRocket.cs +++ b/Projectiles/Ranged/MagnomalyRocket.cs @@ -1,5 +1,3 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -21,10 +19,8 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 22; - projectile.height = 22; + projectile.width = projectile.height = 22; projectile.friendly = true; - projectile.penetrate = 1; projectile.timeLeft = 300; projectile.ranged = true; projectile.tileCollide = false; @@ -42,7 +38,7 @@ namespace CalamityMod.Projectiles.Ranged projectile.frame++; projectile.frameCounter = 0; } - if (projectile.frame >= 4) + if (projectile.frame >= Main.projFrames[projectile.type]) { projectile.frame = 0; } @@ -51,33 +47,33 @@ namespace CalamityMod.Projectiles.Ranged projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) + MathHelper.ToRadians(90) * projectile.direction; - int num297 = Main.rand.NextBool(2) ? 107 : 234; + int dustType = Main.rand.NextBool(2) ? 107 : 234; if (Main.rand.NextBool(4)) { - num297 = 269; + dustType = 269; } if (projectile.owner == Main.myPlayer && !spawnedAura) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(projectile.damage * 0.5f), projectile.knockBack * 0.5f, projectile.owner, projectile.identity, 0f); + Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(projectile.damage * 0.5f), projectile.knockBack * 0.5f, projectile.owner, projectile.identity, 0f); spawnedAura = true; } - float num247 = projectile.velocity.X * 0.5f; - float num248 = projectile.velocity.Y * 0.5f; + float dustOffsetX = projectile.velocity.X * 0.5f; + float dustOffsetY = projectile.velocity.Y * 0.5f; if (Main.rand.NextBool(2)) { - int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, num297, 0f, 0f, 100, default, 0.5f); - Main.dust[num249].scale *= (float)Main.rand.Next(10) * 0.1f; - Main.dust[num249].velocity *= 0.2f; - Main.dust[num249].noGravity = true; - Main.dust[num249].noLight = true; + int exo = Dust.NewDust(new Vector2(projectile.position.X + 3f + dustOffsetX, projectile.position.Y + 3f + dustOffsetY) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, dustType, 0f, 0f, 100, default, 0.5f); + Main.dust[exo].scale *= (float)Main.rand.Next(10) * 0.1f; + Main.dust[exo].velocity *= 0.2f; + Main.dust[exo].noGravity = true; + Main.dust[exo].noLight = true; } else { - int dust2 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, num297, 0f, 0f, 100, default, 0.25f); - Main.dust[dust2].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[dust2].velocity *= 0.05f; - Main.dust[dust2].noGravity = true; - Main.dust[dust2].noLight = true; + int exo = Dust.NewDust(new Vector2(projectile.position.X + 3f + dustOffsetX, projectile.position.Y + 3f + dustOffsetY) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, dustType, 0f, 0f, 100, default, 0.25f); + Main.dust[exo].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[exo].velocity *= 0.05f; + Main.dust[exo].noGravity = true; + Main.dust[exo].noLight = true; } CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 600f, 16f, 20f); } @@ -88,39 +84,38 @@ namespace CalamityMod.Projectiles.Ranged { projectile.position = projectile.Center; projectile.width = projectile.height = 192; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.Center = projectile.position; Main.PlaySound(SoundID.Item14, projectile.position); //DO NOT REMOVE THIS PROJECTILE - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - int num298 = Main.rand.NextBool(2) ? 107 : 234; + int dustType = Main.rand.NextBool(2) ? 107 : 234; if (Main.rand.NextBool(4)) { - num298 = 269; + dustType = 269; } - for (int num621 = 0; num621 < 30; num621++) + for (int d = 0; d < 30; d++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num298, 0f, 0f, 100, default, 1f); - Main.dust[num622].velocity *= 3f; - Main.dust[num622].noGravity = true; - Main.dust[num622].noLight = true; + int exo = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, 0f, 0f, 100, default, 1f); + Main.dust[exo].velocity *= 3f; + Main.dust[exo].noGravity = true; + Main.dust[exo].noLight = true; if (Main.rand.NextBool(2)) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[exo].scale = 0.5f; + Main.dust[exo].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 40; num623++) + for (int d = 0; d < 40; d++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num298, 0f, 0f, 100, default, 0.5f); - Main.dust[num624].noGravity = true; - Main.dust[num624].noLight = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num298, 0f, 0f, 100, default, 0.75f); - Main.dust[num624].velocity *= 2f; + int exo = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, 0f, 0f, 100, default, 0.5f); + Main.dust[exo].noGravity = true; + Main.dust[exo].noLight = true; + Main.dust[exo].velocity *= 5f; + exo = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, 0f, 0f, 100, default, 0.75f); + Main.dust[exo].velocity *= 2f; } - CalamityUtils.ExplosionGores(projectile, 10); + CalamityUtils.ExplosionGores(projectile.Center, 9); } } @@ -131,6 +126,18 @@ namespace CalamityMod.Projectiles.Ranged } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + OnHitEffects(); + target.ExoDebuffs(); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + OnHitEffects(); + target.ExoDebuffs(); + } + + private void OnHitEffects() { if (projectile.owner == Main.myPlayer) { @@ -145,15 +152,6 @@ namespace CalamityMod.Projectiles.Ranged int proj2 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), projectile.damage / 4, projectile.knockBack / 4, projectile.owner, 0f, 1f); } } - target.AddBuff(ModContent.BuffType(), 30); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.Ichor, 120); } } } diff --git a/Projectiles/Ranged/MiniRocket.cs b/Projectiles/Ranged/MiniRocket.cs index 4be243b865..4f328eebd1 100644 --- a/Projectiles/Ranged/MiniRocket.cs +++ b/Projectiles/Ranged/MiniRocket.cs @@ -78,7 +78,7 @@ namespace CalamityMod.Projectiles.Ranged Main.PlaySound(SoundID.Item14, projectile.position); for (int num621 = 0; num621 < 20; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 31, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -88,13 +88,13 @@ namespace CalamityMod.Projectiles.Ranged } for (int num623 = 0; num623 < 30; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 6, 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, 6, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 6, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - CalamityUtils.ExplosionGores(projectile, 3); + CalamityUtils.ExplosionGores(projectile.Center, 3); } } } diff --git a/Projectiles/Ranged/MistArrow.cs b/Projectiles/Ranged/MistArrow.cs index 328d472513..a4c846cd12 100644 --- a/Projectiles/Ranged/MistArrow.cs +++ b/Projectiles/Ranged/MistArrow.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Ranged projectile.penetrate = 1; projectile.aiStyle = 1; projectile.timeLeft = 300; - aiType = 1; + aiType = ProjectileID.WoodenArrowFriendly; projectile.arrow = true; projectile.coldDamage = true; } diff --git a/Projectiles/Ranged/MortarRoundProj.cs b/Projectiles/Ranged/MortarRoundProj.cs index c574334730..6c6ff512d8 100644 --- a/Projectiles/Ranged/MortarRoundProj.cs +++ b/Projectiles/Ranged/MortarRoundProj.cs @@ -89,7 +89,7 @@ namespace CalamityMod.Projectiles.Ranged Main.PlaySound(SoundID.Item14, projectile.position); for (int num621 = 0; num621 < 40; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 31, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -99,13 +99,13 @@ namespace CalamityMod.Projectiles.Ranged } for (int num623 = 0; num623 < 70; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 6, 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, 6, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 6, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - CalamityUtils.ExplosionGores(projectile, 3); + CalamityUtils.ExplosionGores(projectile.Center, 3); if (projectile.owner == Main.myPlayer) { int num814 = 5; diff --git a/Projectiles/Ranged/NapalmArrowProj.cs b/Projectiles/Ranged/NapalmArrowProj.cs index 746ebbc87b..c9bed216bd 100644 --- a/Projectiles/Ranged/NapalmArrowProj.cs +++ b/Projectiles/Ranged/NapalmArrowProj.cs @@ -1,3 +1,4 @@ +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using System; using Terraria; @@ -26,10 +27,10 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; if (Main.rand.NextBool(5)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 6, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, DustID.Fire, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); } } @@ -37,40 +38,42 @@ namespace CalamityMod.Projectiles.Ranged { projectile.position = projectile.Center; projectile.width = projectile.height = 32; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.position.X -= (float)(projectile.width / 2); + projectile.position.Y -= (float)(projectile.height / 2); Main.PlaySound(SoundID.Item14, projectile.position); - for (int num621 = 0; num621 < 5; num621++) + for (int j = 0; j < 5; j++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int fire = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Fire, 0f, 0f, 100, default, 2f); + Main.dust[fire].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; + Main.dust[fire].scale = 0.5f; + Main.dust[fire].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 10; num623++) + for (int k = 0; k < 10; k++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 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, 6, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int fire = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Fire, 0f, 0f, 100, default, 3f); + Main.dust[fire].noGravity = true; + Main.dust[fire].velocity *= 5f; + fire = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Fire, 0f, 0f, 100, default, 2f); + Main.dust[fire].velocity *= 2f; } - CalamityUtils.ExplosionGores(projectile, 3); + CalamityUtils.ExplosionGores(projectile.Center, 3); if (projectile.owner == Main.myPlayer) { - for (int num252 = 0; num252 < 3; num252++) + for (int i = 0; i < 3; i++) { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) + Vector2 velocity = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + while (velocity.X == 0f && velocity.Y == 0f) { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + velocity = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, ProjectileID.MolotovFire + Main.rand.Next(3), (int)((double)projectile.damage * 0.3), 0f, projectile.owner, 0f, 0f); + velocity.Normalize(); + velocity *= (float)Main.rand.Next(70, 101) * 0.1f; + int flames = Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.3), 0f, projectile.owner, 0f, 0f); + Main.projectile[flames].Calamity().forceRanged = true; + Main.projectile[flames].penetrate = 3; } } } diff --git a/Projectiles/Ranged/NapalmArrowProj.png b/Projectiles/Ranged/NapalmArrowProj.png index 53fb0e274a..48ef48d4c4 100644 Binary files a/Projectiles/Ranged/NapalmArrowProj.png and b/Projectiles/Ranged/NapalmArrowProj.png differ diff --git a/Projectiles/Ranged/NorfleetCannon.png b/Projectiles/Ranged/NorfleetCannon.png index c38fd3b142..64cd96565e 100644 Binary files a/Projectiles/Ranged/NorfleetCannon.png and b/Projectiles/Ranged/NorfleetCannon.png differ diff --git a/Projectiles/Ranged/Nuke.cs b/Projectiles/Ranged/Nuke.cs index c92614ff2b..304f24dcad 100644 --- a/Projectiles/Ranged/Nuke.cs +++ b/Projectiles/Ranged/Nuke.cs @@ -103,7 +103,7 @@ namespace CalamityMod.Projectiles.Ranged Main.PlaySound(SoundID.Item14, projectile.position); for (int num621 = 0; num621 < 40; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -113,13 +113,13 @@ namespace CalamityMod.Projectiles.Ranged } for (int num623 = 0; num623 < 60; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(projectile.position, 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); + num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - CalamityUtils.ExplosionGores(projectile, 10); + CalamityUtils.ExplosionGores(projectile.Center, 10); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Ranged/OrangeExoArrow.cs b/Projectiles/Ranged/OrangeExoArrow.cs index 085e80af95..275bbc4e0a 100644 --- a/Projectiles/Ranged/OrangeExoArrow.cs +++ b/Projectiles/Ranged/OrangeExoArrow.cs @@ -1,5 +1,3 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -97,15 +95,12 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 30); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.Ichor, 120); + target.ExoDebuffs(); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.ExoDebuffs(); } public override void Kill(int timeLeft) diff --git a/Projectiles/Ranged/PiercingBullet.cs b/Projectiles/Ranged/PiercingBullet.cs index 29d5803af7..05416b3556 100644 --- a/Projectiles/Ranged/PiercingBullet.cs +++ b/Projectiles/Ranged/PiercingBullet.cs @@ -54,48 +54,29 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (crit) - { - int bulletCount = 10; - for (int x = 0; x < bulletCount; x++) - { - float speed = 12f; - float xPos = projectile.Center.X + (x < bulletCount / 2 ? 500f : -500f); - float yPos = projectile.Center.Y + Main.rand.Next(-500, 501); - Vector2 origin = new Vector2(xPos, yPos); - Vector2 velocity = new Vector2(target.Center.X - origin.X, target.Center.Y - origin.Y); - velocity.Normalize(); - velocity *= speed; - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(origin, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.2), projectile.knockBack, projectile.owner); - } - } - } + OnHitEffects(target.Center, crit); target.AddBuff(ModContent.BuffType(), 900); } public override void OnHitPvp(Player target, int damage, bool crit) { + OnHitEffects(target.Center, crit); + target.AddBuff(ModContent.BuffType(), 900); + } + + private void OnHitEffects(Vector2 targetPos, bool crit) + { if (crit) { int bulletCount = 10; for (int x = 0; x < bulletCount; x++) { - float speed = 12f; - float xPos = projectile.Center.X + (x < bulletCount / 2 ? 500f : -500f); - float yPos = projectile.Center.Y + Main.rand.Next(-500, 501); - Vector2 origin = new Vector2(xPos, yPos); - Vector2 velocity = new Vector2(target.Center.X - origin.X, target.Center.Y - origin.Y); - velocity.Normalize(); - velocity *= speed; if (projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(origin, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.2), projectile.knockBack, projectile.owner); - } + CalamityUtils.ProjectileBarrage(projectile.Center, targetPos, x < bulletCount / 2, 500f, 500f, 0f, 500f, 12f, ModContent.ProjectileType(), (int)(projectile.damage * 0.2), projectile.knockBack, projectile.owner); + } } } - target.AddBuff(ModContent.BuffType(), 900); } } } diff --git a/Projectiles/Ranged/PlagueArrow.cs b/Projectiles/Ranged/PlagueArrow.cs index aec0a0cbbc..6490b0ae85 100644 --- a/Projectiles/Ranged/PlagueArrow.cs +++ b/Projectiles/Ranged/PlagueArrow.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Ranged projectile.penetrate = 1; projectile.aiStyle = 1; projectile.timeLeft = 600; - aiType = 1; + aiType = ProjectileID.WoodenArrowFriendly; } public override void Kill(int timeLeft) diff --git a/Projectiles/Ranged/PlanarRipperBolt.cs b/Projectiles/Ranged/PlanarRipperBolt.cs index 870632a0d8..60db04bcb7 100644 --- a/Projectiles/Ranged/PlanarRipperBolt.cs +++ b/Projectiles/Ranged/PlanarRipperBolt.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Ranged projectile.timeLeft = 600; projectile.ranged = true; projectile.aiStyle = 1; - aiType = 242; + aiType = ProjectileID.BulletHighVelocity; } public override void AI() diff --git a/Projectiles/Ranged/PlasmaBlast.cs b/Projectiles/Ranged/PlasmaBlast.cs index b852422d7e..bc6f5d6735 100644 --- a/Projectiles/Ranged/PlasmaBlast.cs +++ b/Projectiles/Ranged/PlasmaBlast.cs @@ -26,7 +26,6 @@ namespace CalamityMod.Projectiles.Ranged projectile.penetrate = 1; projectile.timeLeft = 600; projectile.ignoreWater = true; - aiType = 503; } public override void AI() diff --git a/Projectiles/Ranged/RubberMortarRoundProj.cs b/Projectiles/Ranged/RubberMortarRoundProj.cs index bd60f48538..644d747b8b 100644 --- a/Projectiles/Ranged/RubberMortarRoundProj.cs +++ b/Projectiles/Ranged/RubberMortarRoundProj.cs @@ -89,7 +89,7 @@ namespace CalamityMod.Projectiles.Ranged Main.PlaySound(SoundID.Item14, projectile.position); for (int num621 = 0; num621 < 40; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 31, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -99,13 +99,13 @@ namespace CalamityMod.Projectiles.Ranged } for (int num623 = 0; num623 < 70; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 6, 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, 6, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 6, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - CalamityUtils.ExplosionGores(projectile, 3); + CalamityUtils.ExplosionGores(projectile.Center, 3); if (projectile.owner == Main.myPlayer) { int num814 = 5; @@ -229,7 +229,7 @@ namespace CalamityMod.Projectiles.Ranged Main.PlaySound(SoundID.Item14, projectile.position); for (int num621 = 0; num621 < 40; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 31, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -239,10 +239,10 @@ namespace CalamityMod.Projectiles.Ranged } for (int num623 = 0; num623 < 70; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 6, 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, 6, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 6, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } for (int num625 = 0; num625 < 3; num625++) diff --git a/Projectiles/Ranged/SeaDragonRocket.cs b/Projectiles/Ranged/SeaDragonRocket.cs index e3fc2e1452..757e5a6ad8 100644 --- a/Projectiles/Ranged/SeaDragonRocket.cs +++ b/Projectiles/Ranged/SeaDragonRocket.cs @@ -1,3 +1,4 @@ +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using System; using Terraria; @@ -26,53 +27,53 @@ namespace CalamityMod.Projectiles.Ranged { if (projectile.ai[1] == 0f) { - for (int num621 = 0; num621 < 5; num621++) + for (int i = 0; i < 5; i++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int fire = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Fire, 0f, 0f, 100, default, 2f); + Main.dust[fire].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; + Main.dust[fire].scale = 0.5f; + Main.dust[fire].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } projectile.ai[1] = 1f; Main.PlaySound(SoundID.Item109, projectile.position); } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; if (projectile.owner == Main.myPlayer && projectile.timeLeft <= 3) { projectile.tileCollide = false; projectile.ai[1] = 0f; projectile.alpha = 255; - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.position.X = projectile.Center.X; + projectile.position.Y = projectile.Center.Y; projectile.width = 200; projectile.height = 200; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.position.X -= (float)(projectile.width / 2); + projectile.position.Y -= (float)(projectile.height / 2); projectile.knockBack = 10f; } else { if (Math.Abs(projectile.velocity.X) >= 8f || Math.Abs(projectile.velocity.Y) >= 8f) { - for (int num246 = 0; num246 < 2; num246++) + for (int j = 0; j < 2; j++) { float num247 = 0f; float num248 = 0f; - if (num246 == 1) + if (j == 1) { num247 = projectile.velocity.X * 0.5f; num248 = projectile.velocity.Y * 0.5f; } - int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 6, 0f, 0f, 100, default, 1f); - Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[num249].velocity *= 0.2f; - Main.dust[num249].noGravity = true; - num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 33, 0f, 0f, 100, default, 0.5f); - Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num249].velocity *= 0.05f; + int explosion = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, DustID.Fire, 0f, 0f, 100, default, 1f); + Main.dust[explosion].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[explosion].velocity *= 0.2f; + Main.dust[explosion].noGravity = true; + explosion = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 33, 0f, 0f, 100, default, 0.5f); + Main.dust[explosion].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; + Main.dust[explosion].velocity *= 0.05f; } } } @@ -91,37 +92,39 @@ namespace CalamityMod.Projectiles.Ranged projectile.localNPCHitCooldown = 10; projectile.Damage(); Main.PlaySound(SoundID.Item110, projectile.position); - for (int num621 = 0; num621 < 15; num621++) + for (int i = 0; i < 15; i++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int smoke = Dust.NewDust(projectile.position, projectile.width, projectile.height, 33, 0f, 0f, 100, default, 2f); + Main.dust[smoke].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; + Main.dust[smoke].scale = 0.5f; + Main.dust[smoke].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 25; num623++) + for (int j = 0; j < 25; j++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 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, 6, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int fire = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Fire, 0f, 0f, 100, default, 3f); + Main.dust[fire].noGravity = true; + Main.dust[fire].velocity *= 5f; + fire = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Fire, 0f, 0f, 100, default, 2f); + Main.dust[fire].velocity *= 2f; } - int num251 = Main.rand.Next(2, 4); + int projAmt = Main.rand.Next(2, 4); if (projectile.owner == Main.myPlayer) { - for (int num252 = 0; num252 < num251; num252++) + for (int k = 0; k < projAmt; k++) { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) + Vector2 velocity = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + while (velocity.X == 0f && velocity.Y == 0f) { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + velocity = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, ProjectileID.MolotovFire + Main.rand.Next(3), (int)((double)projectile.damage * 0.33), 0f, projectile.owner, 0f, 0f); + velocity.Normalize(); + velocity *= (float)Main.rand.Next(70, 101) * 0.1f; + int flames = Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.33), 0f, projectile.owner, 0f, 0f); + Main.projectile[flames].Calamity().forceRanged = true; + Main.projectile[flames].penetrate = 3; } } } diff --git a/Projectiles/Ranged/SeasSearingBubble.cs b/Projectiles/Ranged/SeasSearingBubble.cs index 40baf7cdb3..56554d93b7 100644 --- a/Projectiles/Ranged/SeasSearingBubble.cs +++ b/Projectiles/Ranged/SeasSearingBubble.cs @@ -88,42 +88,33 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - Main.PlaySound(SoundID.Item96, projectile.position); + OnHitEffects(target.Center); target.AddBuff(BuffID.Wet, 240); target.AddBuff(ModContent.BuffType(), 240); + } - int type = ModContent.ProjectileType(); + public override void OnHitPvp(Player target, int damage, bool crit) + { + OnHitEffects(target.Center); + target.AddBuff(BuffID.Wet, 240); + target.AddBuff(ModContent.BuffType(), 240); + } + + private void OnHitEffects(Vector2 targetPos) + { + Main.PlaySound(SoundID.Item96, projectile.Center); if (projectile.ai[0] == 1f) { - int numWaterBlasts = 2; - int waterDamage = SeasSearing.BaseDamage / 2; - float waterKB = 1f; - Player owner = Main.player[projectile.owner]; - for (int i = 0; i < numWaterBlasts; ++i) + for (int x = 0; x < 2; x++) { - float startOffsetX = Main.rand.NextFloat(1000f, 1400f) * (Main.rand.NextBool() ? -1f : 1f); - float startOffsetY = Main.rand.NextFloat(80f, 900f) * (Main.rand.NextBool() ? -1f : 1f); - Vector2 startPos = new Vector2(target.Center.X + startOffsetX, target.Center.Y + startOffsetY); - float dx = target.Center.X - startPos.X; - float dy = target.Center.Y - startPos.Y; - - // Add some randomness / inaccuracy - dx += Main.rand.NextFloat(-5f, 5f); - dy += Main.rand.NextFloat(-5f, 5f); - float speed = Main.rand.NextFloat(20f, 25f); - float dist = (float)Math.Sqrt((double)(dx * dx + dy * dy)); - dist = speed / dist; - dx *= dist; - dy *= dist; - Vector2 waterVel = new Vector2(dx, dy); - float angle = Main.rand.NextFloat(MathHelper.TwoPi); if (projectile.owner == Main.myPlayer) { - int idx = Projectile.NewProjectile(startPos, waterVel, type, waterDamage, waterKB, projectile.owner, 0f, 0f); - Main.projectile[idx].rotation = angle; - Main.projectile[idx].tileCollide = false; - Main.projectile[idx].usesLocalNPCImmunity = true; - Main.projectile[idx].localNPCHitCooldown = -1; + float angle = Main.rand.NextFloat(MathHelper.TwoPi); + Projectile bubble = CalamityUtils.ProjectileBarrage(projectile.Center, targetPos, Main.rand.NextBool(), 1000f, 1400f, 80f, 900f, Main.rand.NextFloat(20f, 25f), ModContent.ProjectileType(), projectile.damage / 2, 1f, projectile.owner); + bubble.rotation = angle; + bubble.tileCollide = false; + bubble.usesLocalNPCImmunity = true; + bubble.localNPCHitCooldown = -1; } } } diff --git a/Projectiles/Ranged/SlashRound.cs b/Projectiles/Ranged/SlashRound.cs index 0be707d289..c95c64aa1f 100644 --- a/Projectiles/Ranged/SlashRound.cs +++ b/Projectiles/Ranged/SlashRound.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { @@ -22,7 +23,7 @@ namespace CalamityMod.Projectiles.Ranged projectile.ranged = true; projectile.ignoreWater = true; projectile.aiStyle = 1; - aiType = 242; + aiType = ProjectileID.BulletHighVelocity; projectile.penetrate = 1; projectile.timeLeft = 600; } diff --git a/Projectiles/Ranged/SparkSpreaderFire.cs b/Projectiles/Ranged/SparkSpreaderFire.cs index 4fede1d4eb..97f9a05507 100644 --- a/Projectiles/Ranged/SparkSpreaderFire.cs +++ b/Projectiles/Ranged/SparkSpreaderFire.cs @@ -14,8 +14,7 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; + projectile.width = projectile.height = 12; projectile.friendly = true; projectile.ranged = true; projectile.penetrate = 3; @@ -28,71 +27,69 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.05f / 255f, (255 - projectile.alpha) * 0.45f / 255f, (255 - projectile.alpha) * 0.05f / 255f); - if (projectile.timeLeft > 60) - { - projectile.timeLeft = 60; - } + if (projectile.wet && !projectile.lavaWet) { projectile.Kill(); } - if (Main.rand.Next(3) == 0) + + if (Main.rand.NextBool(3)) { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 35, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 80, default, 0.75f); - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 55, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 50, default, 0.75f); + Dust.NewDust(projectile.position, projectile.width, projectile.height, 35, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 80, default, 0.75f); + Dust.NewDust(projectile.position, projectile.width, projectile.height, 55, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 50, default, 0.75f); } - if (projectile.ai[0] > 7f) + + if (projectile.ai[0]++ > 7f) { - float num296 = 1f; + float dustScaleSize = 1f; if (projectile.ai[0] == 8f) { - num296 = 0.25f; + dustScaleSize = 0.25f; } else if (projectile.ai[0] == 9f) { - num296 = 0.5f; + dustScaleSize = 0.5f; } else if (projectile.ai[0] == 10f) { - num296 = 0.75f; + dustScaleSize = 0.75f; } projectile.ai[0] += 1f; - int num297 = 6; - if (Main.rand.Next(1) == 0) - { - for (int num298 = 0; num298 < 2; num298++) - { - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 10, default, 0.75f); - Dust dust = Main.dust[num299]; - if (Main.rand.Next(3) == 0) - { - dust.noGravity = true; - dust.scale *= 1.75f; - dust.velocity.X *= 2f; - dust.velocity.Y *= 2f; - } - else - { - dust.noGravity = true; - dust.scale *= 0.5f; - } - dust.velocity.X *= 1.2f; - dust.velocity.Y *= 1.2f; - dust.scale *= num296; - dust.velocity += projectile.velocity; - } + int dustType = DustID.Fire; + for (int i = 0; i < 2; i++) + { + int fire = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 10, default, 0.75f); + Dust dust = Main.dust[fire]; + if (Main.rand.Next(3) == 0) + { + dust.noGravity = true; + dust.scale *= 1.75f; + dust.velocity.X *= 2f; + dust.velocity.Y *= 2f; + } + else + { + dust.noGravity = true; + dust.scale *= 0.5f; + } + dust.velocity.X *= 1.2f; + dust.velocity.Y *= 1.2f; + dust.scale *= dustScaleSize; + dust.velocity += projectile.velocity; } } - else - { - projectile.ai[0] += 1f; - } + projectile.rotation += 0.3f * (float)projectile.direction; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(BuffID.OnFire, 60 * Main.rand.Next(1, 4)); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.OnFire, 60 * Main.rand.Next(1, 4)); } } } diff --git a/Projectiles/Ranged/SporeBomb.cs b/Projectiles/Ranged/SporeBomb.cs index 035b88d0cb..c05d251d6a 100644 --- a/Projectiles/Ranged/SporeBomb.cs +++ b/Projectiles/Ranged/SporeBomb.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Ranged if (projectile.localAI[0] == 0f) { projectile.scale += 0.05f; - if ((double)projectile.scale > 1.2) + if (projectile.scale > 1.2f) { projectile.localAI[0] = 1f; } @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Ranged else { projectile.scale -= 0.05f; - if ((double)projectile.scale < 0.8) + if (projectile.scale < 0.8f) { projectile.localAI[0] = 0f; } @@ -72,26 +72,20 @@ namespace CalamityMod.Projectiles.Ranged public override void Kill(int timeLeft) { Main.PlaySound(SoundID.Item14, projectile.position); - for (int num407 = 0; num407 < 25; num407++) + for (int d = 0; d < 25; d++) { - int num408 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 157, 0f, 0f, 0, new Color(Main.DiscoR, 203, 103), 1f); - Main.dust[num408].noGravity = true; - Main.dust[num408].velocity *= 1.5f; - Main.dust[num408].scale = 1.5f; + int index = Dust.NewDust(projectile.position, projectile.width, projectile.height, 157, 0f, 0f, 0, new Color(Main.DiscoR, 203, 103), 1f); + Main.dust[index].noGravity = true; + Main.dust[index].velocity *= 1.5f; + Main.dust[index].scale = 1.5f; } - int num251 = Main.rand.Next(3, 7); + int sporeAmt = Main.rand.Next(3, 7); if (projectile.owner == Main.myPlayer) { - for (int num252 = 0; num252 < num251; num252++) + for (int s = 0; s < sporeAmt; s++) { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, ProjectileID.SporeGas + Main.rand.Next(3), (int)((double)projectile.damage * 0.25), 0f, projectile.owner, 0f, 0f); + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); + int proj = Projectile.NewProjectile(projectile.Center, velocity, ProjectileID.SporeGas + Main.rand.Next(3), (int)(projectile.damage * 0.25), 0f, projectile.owner, 0f, 0f); Main.projectile[proj].Calamity().forceRanged = true; Main.projectile[proj].usesLocalNPCImmunity = true; Main.projectile[proj].localNPCHitCooldown = 30; diff --git a/Projectiles/Ranged/SpykerProj.cs b/Projectiles/Ranged/SpykerProj.cs index e20aa2169b..9abaee61b8 100644 --- a/Projectiles/Ranged/SpykerProj.cs +++ b/Projectiles/Ranged/SpykerProj.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Ranged projectile.ranged = true; projectile.extraUpdates = 2; projectile.aiStyle = 93; - aiType = 514; + aiType = ProjectileID.NailFriendly; } public override void AI() @@ -66,24 +66,18 @@ namespace CalamityMod.Projectiles.Ranged projectile.width = projectile.height = 32; projectile.position.X = projectile.position.X - (float)(projectile.width / 2); projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - int num251 = Main.rand.Next(3, 6); + int projAmt = Main.rand.Next(3, 6); if (projectile.owner == Main.myPlayer) { - for (int num252 = 0; num252 < num251; num252++) + for (int p = 0; p < projAmt; p++) { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.65), 0f, projectile.owner, 0f, 0f); + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); + Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.65), 0f, projectile.owner, 0f, 0f); } } for (int num621 = 0; num621 < 3; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 46, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.2f); + int num622 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 46, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -93,10 +87,10 @@ namespace CalamityMod.Projectiles.Ranged } for (int num623 = 0; num623 < 5; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 39, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); + int num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 39, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 44, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); + num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 44, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); Main.dust[num624].velocity *= 2f; } } diff --git a/Projectiles/Ranged/SulphuricAcidBubble2.cs b/Projectiles/Ranged/SulphuricAcidBubble2.cs index 7535d82ea0..3ceba84047 100644 --- a/Projectiles/Ranged/SulphuricAcidBubble2.cs +++ b/Projectiles/Ranged/SulphuricAcidBubble2.cs @@ -106,12 +106,12 @@ namespace CalamityMod.Projectiles.Ranged projectile.Kill(); } } - CalamityUtils.StickyProjAI(projectile, 15); + projectile.StickyProjAI(15); } public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - CalamityUtils.ModifyHitNPCSticky(projectile, 3, false); + projectile.ModifyHitNPCSticky(3, false); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) diff --git a/Projectiles/Ranged/TealExoArrow.cs b/Projectiles/Ranged/TealExoArrow.cs index 4a9e00a9f9..0704497d31 100644 --- a/Projectiles/Ranged/TealExoArrow.cs +++ b/Projectiles/Ranged/TealExoArrow.cs @@ -1,5 +1,3 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -61,15 +59,12 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 30); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.Ichor, 120); + target.ExoDebuffs(); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.ExoDebuffs(); } public override Color? GetAlpha(Color lightColor) diff --git a/Projectiles/Ranged/TelluricGlareProj.cs b/Projectiles/Ranged/TelluricGlareProj.cs index caa48a860f..0f9c86ca28 100644 --- a/Projectiles/Ranged/TelluricGlareProj.cs +++ b/Projectiles/Ranged/TelluricGlareProj.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Ranged projectile.aiStyle = 1; projectile.timeLeft = 300; projectile.arrow = true; - aiType = 1; + aiType = ProjectileID.WoodenArrowFriendly; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 1; } diff --git a/Projectiles/Ranged/TerraArrowMain.cs b/Projectiles/Ranged/TerraArrowMain.cs index af9e439e3f..7af1f17a05 100644 --- a/Projectiles/Ranged/TerraArrowMain.cs +++ b/Projectiles/Ranged/TerraArrowMain.cs @@ -27,42 +27,36 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { projectile.velocity *= 1.005f; - if (projectile.velocity.X >= 20f || projectile.velocity.Y >= 20f || projectile.velocity.X <= -20f || projectile.velocity.Y <= -20f) + if (projectile.velocity.Length() >= 20f) { projectile.Kill(); } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; } public override void Kill(int timeLeft) { projectile.position = projectile.Center; projectile.width = projectile.height = 32; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.position.X -= (float)(projectile.width / 2); + projectile.position.Y -= (float)(projectile.height / 2); Main.PlaySound(SoundID.Item60, projectile.position); - for (int num621 = 0; num621 < 3; num621++) + for (int d = 0; d < 3; d++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 1.2f; + int terra = Dust.NewDust(projectile.position, projectile.width, projectile.height, 107, 0f, 0f, 100, default, 2f); + Main.dust[terra].velocity *= 1.2f; if (Main.rand.NextBool(2)) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[terra].scale = 0.5f; + Main.dust[terra].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } if (projectile.owner == Main.myPlayer) { - for (int num252 = 0; num252 < 2; num252++) + for (int a = 0; a < 2; a++) { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.25), 0f, projectile.owner, 0f, 0f); + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); + Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.25), 0f, projectile.owner, 0f, 0f); } } } diff --git a/Projectiles/Ranged/TerraArrowSplit.cs b/Projectiles/Ranged/TerraArrowSplit.cs index 6b821fb134..7b26b855de 100644 --- a/Projectiles/Ranged/TerraArrowSplit.cs +++ b/Projectiles/Ranged/TerraArrowSplit.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { projectile.alpha -= 5; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 300f, 20f, 20f); } diff --git a/Projectiles/Ranged/TerraBulletMain.cs b/Projectiles/Ranged/TerraBulletMain.cs index bd0366cb1a..db3ce4ef4a 100644 --- a/Projectiles/Ranged/TerraBulletMain.cs +++ b/Projectiles/Ranged/TerraBulletMain.cs @@ -71,16 +71,10 @@ namespace CalamityMod.Projectiles.Ranged { if (projectile.owner == Main.myPlayer) { - for (int num252 = 0; num252 < 2; num252++) + for (int b = 0; b < 2; b++) { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.3), 0f, projectile.owner, 0f, 0f); + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); + Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.3), 0f, projectile.owner, 0f, 0f); } } Main.PlaySound(SoundID.Item118, projectile.position); diff --git a/Projectiles/Ranged/TerraBulletSplit.cs b/Projectiles/Ranged/TerraBulletSplit.cs index 3f021bf8f2..b2f59896bc 100644 --- a/Projectiles/Ranged/TerraBulletSplit.cs +++ b/Projectiles/Ranged/TerraBulletSplit.cs @@ -9,6 +9,7 @@ namespace CalamityMod.Projectiles.Ranged { public class TerraBulletSplit : ModProjectile { + private float speed = 0f; public override void SetStaticDefaults() { DisplayName.SetDefault("Bullet"); @@ -57,81 +58,10 @@ namespace CalamityMod.Projectiles.Ranged Main.dust[num137].position.Y = y2; Main.dust[num137].velocity *= 0f; Main.dust[num137].noGravity = true; - float num138 = (float)Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)); - float num139 = projectile.localAI[0]; - if (num139 == 0f) - { - projectile.localAI[0] = num138; - num139 = num138; - } - float num140 = projectile.position.X; - float num141 = projectile.position.Y; - float num142 = 400f; - bool flag4 = false; - int num143 = 0; - if (projectile.ai[1] == 0f) - { - for (int num144 = 0; num144 < 200; num144++) - { - if (Main.npc[num144].CanBeChasedBy(projectile, false) && (projectile.ai[1] == 0f || projectile.ai[1] == (float)(num144 + 1))) - { - float num145 = Main.npc[num144].position.X + (float)(Main.npc[num144].width / 2); - float num146 = Main.npc[num144].position.Y + (float)(Main.npc[num144].height / 2); - float num147 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num145) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num146); - if (num147 < num142 && Collision.CanHit(new Vector2(projectile.position.X + (float)(projectile.width / 2), projectile.position.Y + (float)(projectile.height / 2)), 1, 1, Main.npc[num144].position, Main.npc[num144].width, Main.npc[num144].height)) - { - num142 = num147; - num140 = num145; - num141 = num146; - flag4 = true; - num143 = num144; - } - } - } - if (flag4) - { - projectile.ai[1] = (float)(num143 + 1); - } - flag4 = false; - } - if (projectile.ai[1] > 0f) - { - int num148 = (int)(projectile.ai[1] - 1f); - if (Main.npc[num148].active && Main.npc[num148].CanBeChasedBy(projectile, true) && !Main.npc[num148].dontTakeDamage) - { - float num149 = Main.npc[num148].position.X + (float)(Main.npc[num148].width / 2); - float num150 = Main.npc[num148].position.Y + (float)(Main.npc[num148].height / 2); - float num151 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num149) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num150); - if (num151 < 1000f) - { - flag4 = true; - num140 = Main.npc[num148].position.X + (float)(Main.npc[num148].width / 2); - num141 = Main.npc[num148].position.Y + (float)(Main.npc[num148].height / 2); - } - } - else - { - projectile.ai[1] = 0f; - } - } - if (!projectile.friendly) - { - flag4 = false; - } - if (flag4) - { - float num152 = num139; - Vector2 vector13 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num153 = num140 - vector13.X; - float num154 = num141 - vector13.Y; - float num155 = (float)Math.Sqrt((double)(num153 * num153 + num154 * num154)); - num155 = num152 / num155; - num153 *= num155; - num154 *= num155; - int num156 = 12; - projectile.velocity.X = (projectile.velocity.X * (float)(num156 - 1) + num153) / (float)num156; - projectile.velocity.Y = (projectile.velocity.Y * (float)(num156 - 1) + num154) / (float)num156; - } - } + + if (speed == 0f) + speed = projectile.velocity.Length(); + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 400f, speed, 12f); + } } } diff --git a/Projectiles/Ranged/ToxicannonDrop.cs b/Projectiles/Ranged/ToxicannonDrop.cs index 689a8b0d3e..c17c8d455e 100644 --- a/Projectiles/Ranged/ToxicannonDrop.cs +++ b/Projectiles/Ranged/ToxicannonDrop.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Ranged projectile.tileCollide = true; projectile.ignoreWater = false; projectile.timeLeft = 420; - projectile.Calamity().rogue = true; + projectile.ranged = true; } public override void AI() { diff --git a/Projectiles/Ranged/TyphoonArrow.cs b/Projectiles/Ranged/TyphoonArrow.cs index 135b6e21c8..656ef65779 100644 --- a/Projectiles/Ranged/TyphoonArrow.cs +++ b/Projectiles/Ranged/TyphoonArrow.cs @@ -1,4 +1,5 @@ using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { @@ -19,7 +20,7 @@ namespace CalamityMod.Projectiles.Ranged projectile.penetrate = 1; projectile.aiStyle = 1; projectile.timeLeft = 600; - aiType = 1; + aiType = ProjectileID.WoodenArrowFriendly; } public override void Kill(int timeLeft) diff --git a/Projectiles/Ranged/UltimaBolt.cs b/Projectiles/Ranged/UltimaBolt.cs new file mode 100644 index 0000000000..1201e4a9ae --- /dev/null +++ b/Projectiles/Ranged/UltimaBolt.cs @@ -0,0 +1,112 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Ranged +{ + public class UltimaBolt : ModProjectile + { + public float Bounces + { + get => projectile.ai[0]; + set => projectile.ai[0] = value; + } + public float DefaultHue => ((float)Math.Sin(Main.GlobalTime * 2.5f) + 1) * 0.5f; + public const int MaxBounces = 1; + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; + DisplayName.SetDefault("Ultima Bolt"); + } + + public override void SetDefaults() + { + projectile.width = 18; + projectile.height = 42; + projectile.friendly = true; + projectile.ranged = true; + projectile.arrow = true; + projectile.penetrate = 1; + projectile.timeLeft = 300; + } + + public override void AI() + { + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + } + + public Color GetColorFromHue(float hue) => Main.hslToRgb(hue, 1f, 0.725f) * projectile.Opacity; + public override Color? GetAlpha(Color lightColor) => GetColorFromHue(DefaultHue); + + public void ProduceExplosionDust(int dustCount) + { + if (!Main.dedServ) + { + for (int i = 0; i < dustCount; i++) + { + Dust dust = Dust.NewDustPerfect(projectile.Center, 267); + dust.color = Main.hslToRgb(Main.rand.NextFloat(), 1f, 0.8f); + dust.scale = Main.rand.NextFloat(1f, 1.25f); + dust.velocity = Main.rand.NextVector2Circular(7f, 7f); + dust.noGravity = true; + } + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (Bounces >= MaxBounces) + { + projectile.Kill(); + return false; + } + + if (projectile.velocity.X != oldVelocity.X) + { + projectile.velocity.X = -oldVelocity.X; + } + if (projectile.velocity.Y != oldVelocity.Y) + { + projectile.velocity.Y = -oldVelocity.Y; + } + Bounces++; + ProduceExplosionDust(24); + + return false; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture = ModContent.GetTexture(Texture); + for (int i = 0; i < projectile.oldPos.Length; i++) + { + if (i > 0) + { + CalamityUtils.DistanceClamp(ref projectile.oldPos[i], ref projectile.oldPos[i - 1], 8f); // Ensure the max distance between the old positions isn't too great. It looks weird if it is. + } + float completionRatio = i / (float)projectile.oldPos.Length; + Color color = GetColorFromHue((DefaultHue + completionRatio * 0.5f) % 1f) * (float)Math.Pow(1f - completionRatio, 2); + spriteBatch.Draw(texture, + projectile.oldPos[i] + texture.Size() * 0.5f - Main.screenPosition, + null, + color, + projectile.rotation, + texture.Size() * 0.5f, + projectile.scale, + SpriteEffects.None, + 0f); + } + return false; + } + + public override void Kill(int timeLeft) + { + CalamityGlobalProjectile.ExpandHitboxBy(projectile, 90, 90); + projectile.Damage(); + ProduceExplosionDust(32); + } + } +} diff --git a/Projectiles/Ranged/UltimaBolt.png b/Projectiles/Ranged/UltimaBolt.png new file mode 100644 index 0000000000..4e0b7c7f9b Binary files /dev/null and b/Projectiles/Ranged/UltimaBolt.png differ diff --git a/Projectiles/Ranged/UltimaBowProjectile.cs b/Projectiles/Ranged/UltimaBowProjectile.cs new file mode 100644 index 0000000000..a5b20419e8 --- /dev/null +++ b/Projectiles/Ranged/UltimaBowProjectile.cs @@ -0,0 +1,108 @@ +using CalamityMod.Items.Weapons.Ranged; +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class UltimaBowProjectile : ModProjectile + { + public float Time + { + get => projectile.ai[0]; + set => projectile.ai[0] = value; + } + public const float PositioningOffset = 35f; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ultima"); + } + + public override void SetDefaults() + { + projectile.width = 82; + projectile.height = 144; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.ranged = true; + projectile.ignoreWater = true; + } + + public override void AI() + { + Player player = Main.player[projectile.owner]; + projectile.direction = (Math.Cos(projectile.velocity.ToRotation()) > 0).ToDirectionInt(); + AttemptToFireProjectiles(player); + AttachToPlayer(player); + projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == -1).ToInt() * MathHelper.Pi; + Time++; + } + + public void AttemptToFireProjectiles(Player player) + { + bool canFire = player.channel && player.HasAmmo(player.ActiveItem(), true) && !player.noItems && !player.CCed; + if (!canFire) + { + projectile.Kill(); + return; + } + if (Main.netMode != NetmodeID.MultiplayerClient && Time % player.ActiveItem().useTime == 0) + { + int type = ProjectileID.WoodenArrowFriendly; // This doesn't really matter. It's overwritten anyway. But it is passed into the PickAmmo method. + float shotSpeed = player.ActiveItem().shootSpeed; + int damage = player.GetWeaponDamage(player.ActiveItem()); + float knockBack = player.ActiveItem().knockBack; + + player.PickAmmo(player.ActiveItem(), ref type, ref shotSpeed, ref canFire, ref damage, ref knockBack); // Pick ammo and consume it (this incorporates the bow's chance to not consume ammo). + + Main.PlaySound(player.ActiveItem().UseSound, projectile.Center); + + type = ModContent.ProjectileType(); + float shootLaserChance = Utils.InverseLerp(Ultima.FullChargeTime * 0.35f, Ultima.FullChargeTime, Time, true); + Vector2 shotPosition = player.RotatedRelativePoint(player.MountedCenter, true); + shotPosition += projectile.velocity.ToRotation().ToRotationVector2().RotatedByRandom(MathHelper.ToRadians(40f)).RotatedBy(-0.25f * projectile.spriteDirection) * 42f; + + projectile.velocity = projectile.DirectionTo(Main.MouseWorld); + + Vector2 shotVelocity = projectile.velocity * shotSpeed; // The velocity should always be a unit vector. + + // Fire a laser. + if (Main.rand.NextFloat() <= shootLaserChance) + { + type = ModContent.ProjectileType(); + shotVelocity = shotVelocity.RotatedByRandom(0.03f); + damage = (int)(damage * 1.5); + } + // Sometimes fire little sparks if the bow is fully charged. + if (Time >= Ultima.FullChargeTime * 0.7f && Main.rand.NextBool(6)) + { + // To ensure that the sparks don't spawn on top of the laser itself. + float offsetAngle = Main.rand.NextFloat(0.2f, 0.5f) * Main.rand.NextBool(2).ToDirectionInt(); + Vector2 sparkVelocity = projectile.DirectionTo(Main.MouseWorld).RotatedByRandom(0.5f) * 13f; + sparkVelocity = sparkVelocity.RotatedBy(offsetAngle); + Projectile.NewProjectile(shotPosition, sparkVelocity, ModContent.ProjectileType(), damage / 3, knockBack, projectile.owner); + } + knockBack = player.GetWeaponKnockback(player.ActiveItem(), knockBack); + + Projectile.NewProjectile(shotPosition, shotVelocity, type, damage, knockBack, projectile.owner); + projectile.netUpdate = true; + } + } + + public void AttachToPlayer(Player player) + { + projectile.Center = player.RotatedRelativePoint(player.MountedCenter, true) + projectile.velocity.ToRotation().ToRotationVector2() * PositioningOffset; + projectile.spriteDirection = projectile.direction; + projectile.timeLeft = 2; + player.ChangeDir(projectile.direction); + player.heldProj = projectile.whoAmI; + player.itemTime = player.itemAnimation = 2; + player.itemRotation = (projectile.velocity * projectile.direction).ToRotation(); + } + + public override bool CanDamage() => false; + } +} diff --git a/Projectiles/Ranged/UltimaBowProjectile.png b/Projectiles/Ranged/UltimaBowProjectile.png new file mode 100644 index 0000000000..a5e99993fd Binary files /dev/null and b/Projectiles/Ranged/UltimaBowProjectile.png differ diff --git a/Projectiles/Ranged/UltimaRay.cs b/Projectiles/Ranged/UltimaRay.cs new file mode 100644 index 0000000000..5f2b6287d4 --- /dev/null +++ b/Projectiles/Ranged/UltimaRay.cs @@ -0,0 +1,51 @@ +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Ranged +{ + public class UltimaRay : BaseLaserbeamProjectile + { + public float HueOffset + { + get => projectile.ai[1]; + set => projectile.ai[1] = value; + } + public override float MaxScale => 0.7f; + public override float MaxLaserLength => 2400f; + public override float Lifetime => 50f; + public override Color LaserOverlayColor => Main.hslToRgb((float)Math.Sin(Main.GlobalTime * 2.3f + HueOffset) * 0.5f + 0.5f, 1f, 0.775f) * Utils.InverseLerp(Lifetime, 0f, Time, true); + public override Color LightCastColor => LaserOverlayColor; + public override Texture2D LaserBeginTexture => ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/UltimaRayStart"); + public override Texture2D LaserMiddleTexture => ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/UltimaRayMid"); + public override Texture2D LaserEndTexture => ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/UltimaRayEnd"); + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ultima Ray"); + } + public override void SetDefaults() + { + projectile.width = projectile.height = 22; + projectile.friendly = true; + projectile.ranged = true; + projectile.arrow = true; + projectile.penetrate = -1; + projectile.alpha = 255; + projectile.localNPCHitCooldown = 10; + projectile.usesLocalNPCImmunity = true; + } + public override bool PreAI() + { + // Initialization. Using the AI hook would override the base laser's code, and we don't want that. + if (projectile.localAI[0] == 0f) + { + HueOffset = Main.rand.NextFloat(MathHelper.Pi / 5f); + projectile.localAI[0] = 1f; + } + return true; + } + public override bool ShouldUpdatePosition() => false; + } +} diff --git a/Projectiles/Ranged/UltimaRay.png b/Projectiles/Ranged/UltimaRay.png new file mode 100644 index 0000000000..15e8775737 Binary files /dev/null and b/Projectiles/Ranged/UltimaRay.png differ diff --git a/Projectiles/Ranged/UltimaSpark.cs b/Projectiles/Ranged/UltimaSpark.cs new file mode 100644 index 0000000000..277bb81070 --- /dev/null +++ b/Projectiles/Ranged/UltimaSpark.cs @@ -0,0 +1,91 @@ +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Ranged +{ + public class UltimaSpark : ModProjectile + { + public float Time + { + get => projectile.ai[0]; + set => projectile.ai[0] = value; + } + public const int DustType = 261; + public const float MaxHomingDistance = 1200f; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ultima Spark"); + } + + public override void SetDefaults() + { + projectile.width = projectile.height = 8; + projectile.friendly = true; + projectile.ranged = true; + projectile.arrow = true; + projectile.penetrate = 1; + projectile.timeLeft = 240; + projectile.extraUpdates = 1; + } + + public override void AI() + { + if (!Main.dedServ && Time > 5f) + { + for (int i = 0; i < 3; i++) + { + Vector2 spawnPosition = Vector2.Lerp(projectile.oldPosition, projectile.position, i / 3f); + Dust dust = Dust.NewDustPerfect(spawnPosition, DustType); + dust.color = Main.hslToRgb((Main.rand.NextFloat(-0.04f, 0.04f) + Time / 80f) % 1f, 0.8f, 0.6f); + dust.scale = 2.3f; + dust.fadeIn = 1f; + dust.rotation = Main.rand.NextFloat(MathHelper.TwoPi); + dust.velocity = Vector2.Zero; + dust.noGravity = true; + } + } + + NPC potentialTarget = projectile.Center.ClosestNPCAt(MaxHomingDistance); + if (potentialTarget != null) + { + projectile.velocity = (projectile.velocity * 8f + projectile.DirectionTo(potentialTarget.Center) * 18f) / 9f; + return; + } + + if (Time > 30f) + { + float updatedTime = Time - 30f; + // Make a complete 90 degree turn in 30 frames. + if (updatedTime % 120f > 90f) + { + projectile.velocity = projectile.velocity.RotatedBy(MathHelper.PiOver2 / 20f); + } + // Arc around quickly for 60 frames. + else if (updatedTime % 120f > 30f) + { + projectile.velocity = projectile.velocity.RotatedBy((float)Math.Sin((updatedTime - 30f) % 60f / 60f * MathHelper.TwoPi) * MathHelper.ToRadians(15f)); + } + } + + Time++; + } + + public override void Kill(int timeLeft) + { + CalamityGlobalProjectile.ExpandHitboxBy(projectile, 60, 60); + projectile.Damage(); + if (!Main.dedServ) + { + for (int i = 0; i < 20; i++) + { + Dust dust = Dust.NewDustPerfect(projectile.Center, DustType); + dust.color = Main.hslToRgb(Main.rand.NextFloat(), 1f, 0.7f); + dust.scale = Main.rand.NextFloat(0.9f, 1.25f); + dust.velocity = Main.rand.NextVector2Circular(6f, 6f); + dust.noGravity = true; + } + } + } + } +} diff --git a/Projectiles/Ranged/UltimaSpark.png b/Projectiles/Ranged/UltimaSpark.png new file mode 100644 index 0000000000..a799dbbc35 Binary files /dev/null and b/Projectiles/Ranged/UltimaSpark.png differ diff --git a/Projectiles/Ranged/VeriumBulletProj.cs b/Projectiles/Ranged/VeriumBulletProj.cs index 25615a3b50..855bdf7477 100644 --- a/Projectiles/Ranged/VeriumBulletProj.cs +++ b/Projectiles/Ranged/VeriumBulletProj.cs @@ -9,6 +9,7 @@ namespace CalamityMod.Projectiles.Ranged { public class VeriumBulletProj : ModProjectile { + private float speed = 0f; public override void SetStaticDefaults() { DisplayName.SetDefault("Bullet"); @@ -23,10 +24,12 @@ namespace CalamityMod.Projectiles.Ranged projectile.aiStyle = 1; projectile.friendly = true; projectile.ranged = true; - projectile.penetrate = 1; + projectile.penetrate = 2; projectile.timeLeft = 600; projectile.extraUpdates = 1; aiType = ProjectileID.Bullet; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) @@ -41,87 +44,104 @@ namespace CalamityMod.Projectiles.Ranged projectile.spriteDirection = projectile.direction; if (Main.rand.NextBool(2)) { - int num137 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 1, 1, 70, 0f, 0f, 0, default, 0.5f); - Main.dust[num137].alpha = projectile.alpha; - Main.dust[num137].velocity *= 0f; - Main.dust[num137].noGravity = true; + int purple = Dust.NewDust(projectile.position, 1, 1, 70, 0f, 0f, 0, default, 0.5f); + Main.dust[purple].alpha = projectile.alpha; + Main.dust[purple].velocity *= 0f; + Main.dust[purple].noGravity = true; } - float num138 = (float)Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)); - float num139 = projectile.localAI[0]; - if (num139 == 0f) - { - projectile.localAI[0] = num138; - num139 = num138; - } - float num140 = projectile.position.X; - float num141 = projectile.position.Y; - float num142 = 300f; - bool flag4 = false; - int num143 = 0; - if (projectile.ai[1] == 0f) - { - for (int num144 = 0; num144 < 200; num144++) - { - if (Main.npc[num144].CanBeChasedBy(projectile, false) && (projectile.ai[1] == 0f || projectile.ai[1] == (float)(num144 + 1))) - { - float num145 = Main.npc[num144].position.X + (float)(Main.npc[num144].width / 2); - float num146 = Main.npc[num144].position.Y + (float)(Main.npc[num144].height / 2); - float num147 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num145) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num146); - if (num147 < num142 && Collision.CanHit(new Vector2(projectile.position.X + (float)(projectile.width / 2), projectile.position.Y + (float)(projectile.height / 2)), 1, 1, Main.npc[num144].position, Main.npc[num144].width, Main.npc[num144].height)) - { - num142 = num147; - num140 = num145; - num141 = num146; - flag4 = true; - num143 = num144; - } - } - } - if (flag4) - { - projectile.ai[1] = (float)(num143 + 1); - } - flag4 = false; - } - if (projectile.ai[1] > 0f) - { - int num148 = (int)(projectile.ai[1] - 1f); - if (Main.npc[num148].active && Main.npc[num148].CanBeChasedBy(projectile, true) && !Main.npc[num148].dontTakeDamage) - { - float num149 = Main.npc[num148].position.X + (float)(Main.npc[num148].width / 2); - float num150 = Main.npc[num148].position.Y + (float)(Main.npc[num148].height / 2); - float num151 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num149) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num150); - if (num151 < 1000f) - { - flag4 = true; - num140 = Main.npc[num148].position.X + (float)(Main.npc[num148].width / 2); - num141 = Main.npc[num148].position.Y + (float)(Main.npc[num148].height / 2); - } - } - else - { - projectile.ai[1] = 0f; - } - } - if (!projectile.friendly) - { - flag4 = false; - } - if (flag4) - { - float num152 = num139; - Vector2 vector13 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num153 = num140 - vector13.X; - float num154 = num141 - vector13.Y; - float num155 = (float)Math.Sqrt((double)(num153 * num153 + num154 * num154)); - num155 = num152 / num155; - num153 *= num155; - num154 *= num155; - int num156 = 12; - projectile.velocity.X = (projectile.velocity.X * (float)(num156 - 1) + num153) / (float)num156; - projectile.velocity.Y = (projectile.velocity.Y * (float)(num156 - 1) + num154) / (float)num156; - } - return false; + + if (projectile.ai[0] > 0f) + projectile.ai[0]--; + if (speed == 0f) + speed = projectile.velocity.Length(); + if (projectile.penetrate == 1 && projectile.ai[0] <= 0f) + { + float inertia = 15f; + Vector2 center = projectile.Center; + float maxDistance = 300f; + bool homeIn = false; + + int targetIndex = (int)projectile.ai[1]; + NPC target = Main.npc[targetIndex]; + if (target.CanBeChasedBy(projectile, false)) + { + float extraDistance = (target.width / 2) + (target.height / 2); + + bool canHit = true; + if (extraDistance < maxDistance) + canHit = Collision.CanHit(projectile.Center, 1, 1, target.Center, 1, 1); + + if (Vector2.Distance(target.Center, projectile.Center) < (maxDistance + extraDistance) && canHit) + { + center = target.Center; + homeIn = true; + } + } + + if (!homeIn) + { + for (int i = 0; i < Main.maxNPCs; i++) + { + NPC npc = Main.npc[i]; + if (npc.CanBeChasedBy(projectile, false)) + { + float extraDistance = (npc.width / 2) + (npc.height / 2); + + bool canHit = true; + if (extraDistance < maxDistance) + canHit = Collision.CanHit(projectile.Center, 1, 1, npc.Center, 1, 1); + + if (Vector2.Distance(npc.Center, projectile.Center) < (maxDistance + extraDistance) && canHit) + { + center = npc.Center; + homeIn = true; + break; + } + } + } + } + + if (!projectile.friendly) + { + homeIn = false; + } + + if (homeIn) + { + Vector2 homeInVector = projectile.DirectionTo(center); + if (homeInVector.HasNaNs()) + homeInVector = Vector2.UnitY; + + projectile.velocity = (projectile.velocity * inertia + homeInVector * speed) / (inertia + 1f); + } + return false; + } + return true; + } + + public override bool? CanHitNPC(NPC target) + { + if (projectile.ai[0] > 0f) + { + return false; + } + return null; + } + + public override bool CanHitPvp(Player target) => projectile.ai[0] <= 0f; + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + projectile.ai[0] = 10f; + projectile.damage /= 2; + if (target.life > 0) + projectile.ai[1] = target.whoAmI; + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + projectile.ai[0] = 10f; + projectile.damage /= 2; } } } diff --git a/Projectiles/Ranged/Voidragon.cs b/Projectiles/Ranged/Voidragon.cs index 5e799fd498..e12926a541 100644 --- a/Projectiles/Ranged/Voidragon.cs +++ b/Projectiles/Ranged/Voidragon.cs @@ -26,7 +26,6 @@ namespace CalamityMod.Projectiles.Ranged projectile.penetrate = 1; projectile.timeLeft = 600; projectile.ignoreWater = true; - aiType = 503; } public override void AI() diff --git a/Projectiles/Rogue/XerocPitchforkProjectile.cs b/Projectiles/Rogue/AntumbraShardProjectile.cs similarity index 88% rename from Projectiles/Rogue/XerocPitchforkProjectile.cs rename to Projectiles/Rogue/AntumbraShardProjectile.cs index 710588bed7..fb9821e918 100644 --- a/Projectiles/Rogue/XerocPitchforkProjectile.cs +++ b/Projectiles/Rogue/AntumbraShardProjectile.cs @@ -8,19 +8,19 @@ using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { - public class XerocPitchforkProjectile : ModProjectile + public class AntumbraShardProjectile : ModProjectile { public override void SetStaticDefaults() { - DisplayName.SetDefault("Pitchfork"); + DisplayName.SetDefault("Antumbra Shard"); ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; ProjectileID.Sets.TrailingMode[projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; + projectile.width = 20; + projectile.height = 20; projectile.friendly = true; projectile.penetrate = -1; projectile.extraUpdates = 1; @@ -32,14 +32,14 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; - if (Main.rand.NextBool(3)) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 58, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(135f); if (projectile.spriteDirection == -1) { projectile.rotation -= 1.57f; + } + if (Main.rand.NextBool(3)) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 62, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); } if (projectile.timeLeft % 12 == 0) { diff --git a/Projectiles/Rogue/AntumbraShardProjectile.png b/Projectiles/Rogue/AntumbraShardProjectile.png new file mode 100644 index 0000000000..ca5e3d8840 Binary files /dev/null and b/Projectiles/Rogue/AntumbraShardProjectile.png differ diff --git a/Projectiles/Rogue/AuroradicalStar.cs b/Projectiles/Rogue/AuroradicalStar.cs index f7468a41c1..5af928b27e 100644 --- a/Projectiles/Rogue/AuroradicalStar.cs +++ b/Projectiles/Rogue/AuroradicalStar.cs @@ -51,7 +51,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.soundDelay = 20 + Main.rand.Next(40); if (Main.rand.NextBool(5)) { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 9); + Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 9); } } @@ -64,7 +64,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.ai[0] += 1f; if (projectile.ai[0] > 15f) { - int astral = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, Main.rand.Next(dustTypes), 0f, 0f, 100, default, 0.8f); + int astral = Dust.NewDust(projectile.position, projectile.width, projectile.height, Main.rand.Next(dustTypes), 0f, 0f, 100, default, 0.8f); Main.dust[astral].noGravity = true; Main.dust[astral].velocity *= 0f; } @@ -133,7 +133,7 @@ namespace CalamityMod.Projectiles.Rogue int dmg = projectile.damage / 2; int comet = Projectile.NewProjectile(pos, velocity, ModContent.ProjectileType(), dmg, projectile.knockBack, projectile.owner, 0f, 0f); Main.projectile[comet].Calamity().forceRogue = true; - Main.projectile[comet].Calamity().lineColor = Main.rand.Next(3);; + Main.projectile[comet].Calamity().lineColor = Main.rand.Next(3); } } @@ -147,30 +147,27 @@ namespace CalamityMod.Projectiles.Rogue int dmg = projectile.damage / 2; int comet = Projectile.NewProjectile(pos, velocity, ModContent.ProjectileType(), dmg, projectile.knockBack, projectile.owner, 0f, 0f); Main.projectile[comet].Calamity().forceRogue = true; - Main.projectile[comet].Calamity().lineColor = Main.rand.Next(3);; + Main.projectile[comet].Calamity().lineColor = Main.rand.Next(3); } } public override void Kill(int timeLeft) { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 9, 1f, 0f); - projectile.position = projectile.Center; - projectile.width = projectile.height = 96; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 9, 1f, 0f); + CalamityGlobalProjectile.ExpandHitboxBy(projectile, 96); projectile.localNPCHitCooldown = 10; projectile.usesLocalNPCImmunity = true; projectile.Damage(); for (int d = 0; d < 2; d++) { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, Main.rand.Next(dustTypes), 0f, 0f, 50, default, 1f); + Dust.NewDust(projectile.position, projectile.width, projectile.height, Main.rand.Next(dustTypes), 0f, 0f, 50, default, 1f); } for (int d = 0; d < 20; d++) { - int astral = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, Main.rand.Next(dustTypes), 0f, 0f, 0, default, 1.5f); + int astral = Dust.NewDust(projectile.position, projectile.width, projectile.height, Main.rand.Next(dustTypes), 0f, 0f, 0, default, 1.5f); Main.dust[astral].noGravity = true; Main.dust[astral].velocity *= 3f; - astral = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 50, default, 1f); + astral = Dust.NewDust(projectile.position, projectile.width, projectile.height, 173, 0f, 0f, 50, default, 1f); Main.dust[astral].velocity *= 2f; Main.dust[astral].noGravity = true; } diff --git a/Projectiles/Rogue/BallisticPoisonBombProj.cs b/Projectiles/Rogue/BallisticPoisonBombProj.cs index 228ddf7dee..d6e9dbf72b 100644 --- a/Projectiles/Rogue/BallisticPoisonBombProj.cs +++ b/Projectiles/Rogue/BallisticPoisonBombProj.cs @@ -1,5 +1,6 @@ using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -30,59 +31,13 @@ namespace CalamityMod.Projectiles.Rogue { Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 14, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); } - try - { - int num223 = (int)(projectile.position.X / 16f) - 1; - int num224 = (int)((projectile.position.X + (float)projectile.width) / 16f) + 2; - int num225 = (int)(projectile.position.Y / 16f) - 1; - int num226 = (int)((projectile.position.Y + (float)projectile.height) / 16f) + 2; - if (num223 < 0) - { - num223 = 0; - } - if (num224 > Main.maxTilesX) - { - num224 = Main.maxTilesX; - } - if (num225 < 0) - { - num225 = 0; - } - if (num226 > Main.maxTilesY) - { - num226 = Main.maxTilesY; - } - for (int num227 = num223; num227 < num224; num227++) - { - for (int num228 = num225; num228 < num226; num228++) - { - if (Main.tile[num227, num228] != null && !TileID.Sets.Platforms[Main.tile[num227, num228].type] && Main.tile[num227, num228].nactive() && (Main.tileSolid[(int)Main.tile[num227, num228].type] || (Main.tileSolidTop[(int)Main.tile[num227, num228].type] && Main.tile[num227, num228].frameY == 0))) - { - Vector2 vector19; - vector19.X = (float)(num227 * 16); - vector19.Y = (float)(num228 * 16); - if (projectile.position.X + (float)projectile.width - 4f > vector19.X && projectile.position.X + 4f < vector19.X + 16f && projectile.position.Y + (float)projectile.height - 4f > vector19.Y && projectile.position.Y + 4f < vector19.Y + 16f) - { - projectile.velocity.X = 0f; - projectile.velocity.Y = -0.2f; - } - } - } - } - } catch - { - } + projectile.StickToTiles(true, false); if (projectile.owner == Main.myPlayer && projectile.timeLeft <= 3) { projectile.tileCollide = false; projectile.ai[1] = 0f; projectile.alpha = 255; - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 128; - projectile.height = 128; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + CalamityGlobalProjectile.ExpandHitboxBy(projectile, 128); } projectile.ai[0] += 1f; if (projectile.ai[0] > 10f) @@ -90,8 +45,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.ai[0] = 10f; if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) { - projectile.velocity.X = projectile.velocity.X * 0.97f; - if (projectile.velocity.X > -0.01f && projectile.velocity.X < 0.01f) + projectile.velocity.X *= 0.97f; + if (Math.Abs(projectile.velocity.X) < 0.01f) { projectile.velocity.X = 0f; projectile.netUpdate = true; @@ -104,55 +59,42 @@ namespace CalamityMod.Projectiles.Rogue public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = projectile.height = 128; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - Main.PlaySound(SoundID.Item, (int)projectile.Center.X, (int)projectile.Center.Y, 14); - int num251 = Main.rand.Next(3, 5); + CalamityGlobalProjectile.ExpandHitboxBy(projectile, 128); + Main.PlaySound(SoundID.Item14, projectile.Center); + int projAmt = Main.rand.Next(3, 5); if (projectile.owner == Main.myPlayer) { - for (int num252 = 0; num252 < num251; num252++) + for (int s = 0; s < projAmt; s++) { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, ModContent.ProjectileType(), (int)(projectile.damage * 0.5), 0f, projectile.owner, 0f, 0f); + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); + Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.5), 0f, projectile.owner, 0f, 0f); } - int num320 = Main.rand.Next(8, 13); - int num3; - for (int num321 = 0; num321 < num320; num321 = num3 + 1) + int cloudAmt = Main.rand.Next(8, 13); + for (int c = 0; c < cloudAmt; c++) { - Vector2 vector15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - vector15.Normalize(); - vector15 *= (float)Main.rand.Next(10, 201) * 0.01f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, vector15.X, vector15.Y, ModContent.ProjectileType(), (int)(projectile.damage * 0.3), 1f, projectile.owner, 0f, (float)Main.rand.Next(-45, 1)); - num3 = num321; + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 10f, 200f, 0.01f); + Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.25), 1f, projectile.owner, 0f, (float)Main.rand.Next(-45, 1)); } } - for (int num621 = 0; num621 < 5; num621++) + for (int d = 0; d < 5; d++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 14, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int boom = Dust.NewDust(projectile.position, projectile.width, projectile.height, 14, 0f, 0f, 100, default, 2f); + Main.dust[boom].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; + Main.dust[boom].scale = 0.5f; + Main.dust[boom].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 9; num623++) + for (int d = 0; d < 9; d++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 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, 6, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int fire = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Fire, 0f, 0f, 100, default, 3f); + Main.dust[fire].noGravity = true; + Main.dust[fire].velocity *= 5f; + fire = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Fire, 0f, 0f, 100, default, 2f); + Main.dust[fire].velocity *= 2f; } - CalamityUtils.ExplosionGores(projectile, 3); + CalamityUtils.ExplosionGores(projectile.Center, 3); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Rogue/BettyExplosion.cs b/Projectiles/Rogue/BettyExplosion.cs index 96371c4c0f..29f5e8bfc3 100644 --- a/Projectiles/Rogue/BettyExplosion.cs +++ b/Projectiles/Rogue/BettyExplosion.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Rogue void SpawnExplosionDust() { // Sparks and such - Vector2 corner = new Vector2(projectile.position.X, projectile.position.Y); + Vector2 corner = projectile.position; for (int i = 0; i < 15; i++) { int idx = Dust.NewDust(corner, projectile.width, projectile.height, 31, 0f, 0f, 100, default, 2f); @@ -55,7 +55,7 @@ namespace CalamityMod.Projectiles.Rogue } // Smoke, which counts as a Gore - CalamityUtils.ExplosionGores(projectile, 3); + CalamityUtils.ExplosionGores(projectile.Center, 3); } } diff --git a/Projectiles/Rogue/BlastBarrelProjectile.cs b/Projectiles/Rogue/BlastBarrelProjectile.cs index 2ead573d84..b57ad8b134 100644 --- a/Projectiles/Rogue/BlastBarrelProjectile.cs +++ b/Projectiles/Rogue/BlastBarrelProjectile.cs @@ -81,13 +81,9 @@ namespace CalamityMod.Projectiles.Rogue else { Vector2 fireVelocity = (Vector2.UnitY * (-16f + Main.rand.NextFloat(-3, 12f))).RotatedByRandom((double)MathHelper.ToRadians(40f)); - int fireIndex = Projectile.NewProjectile(projectile.Center, projectile.velocity + fireVelocity, - Main.rand.Next(ProjectileID.MolotovFire, ProjectileID.MolotovFire3 + 1), - (int)(projectile.damage * 0.75f), 1f, projectile.owner); - Main.projectile[fireIndex].Calamity().forceRogue = true; + int fireIndex = Projectile.NewProjectile(projectile.Center, projectile.velocity + fireVelocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.75f), 1f, projectile.owner); Main.projectile[fireIndex].timeLeft = 300; - Main.projectile[fireIndex].usesLocalNPCImmunity = true; - Main.projectile[fireIndex].localNPCHitCooldown = -1; + Main.projectile[fireIndex].penetrate = 3; } } projectile.ai[1]--; diff --git a/Projectiles/Rogue/BloodsoakedCrashax.cs b/Projectiles/Rogue/BloodsoakedCrashax.cs index 802f3d0811..d871f158a9 100644 --- a/Projectiles/Rogue/BloodsoakedCrashax.cs +++ b/Projectiles/Rogue/BloodsoakedCrashax.cs @@ -7,133 +7,122 @@ using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { - public class BloodsoakedCrashax : ModProjectile - { - private int bounce = 3; //number of times it bounces - private int grind = 0; //used to know when to slow down + public class BloodsoakedCrashax : ModProjectile + { + private int bounce = 3; //number of times it bounces + private int grind = 0; //used to know when to slow down - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bloodsoaked Crasher"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bloodsoaked Crasher"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.penetrate = 10; - projectile.aiStyle = 2; - projectile.timeLeft = 600; //10 seconds and counting - aiType = ProjectileID.ThrowingKnife; //Throwing Knife AI - projectile.Calamity().rogue = true; - projectile.usesIDStaticNPCImmunity = true; - projectile.idStaticNPCHitCooldown = 5; - projectile.extraUpdates = 1; - } + public override void SetDefaults() + { + projectile.width = projectile.height = 30; + projectile.friendly = true; + projectile.penetrate = 10; + projectile.timeLeft = 600; //10 seconds and counting + projectile.aiStyle = 2; + aiType = ProjectileID.ThrowingKnife; //Throwing Knife AI + projectile.Calamity().rogue = true; + projectile.usesIDStaticNPCImmunity = true; + projectile.idStaticNPCHitCooldown = 5; + projectile.extraUpdates = 1; + } - public override void AI() - { - grind--; - if (grind <= 0) - { - grind = 0; - } - if (grind >= 1) - { - projectile.extraUpdates = 0; //stop, you're touching an enemy - projectile.velocity.X *= 0.75f; - projectile.velocity.Y *= 0.75f; - } - else - { - projectile.velocity.X *= 1.005f; //you broke up, time to yeet yourself out - projectile.velocity.Y *= 1.005f; - if (projectile.velocity.X > 16f) - { - projectile.velocity.X = 16f; - } - if (projectile.velocity.Y > 16f) - { - projectile.velocity.Y = 16f; - } - projectile.extraUpdates = 1; - } - } + public override void AI() + { + if (grind > 0) + { + grind--; + } + if (grind >= 1) + { + projectile.extraUpdates = 0; //stop, you're touching an enemy + projectile.velocity.X *= 0.75f; + projectile.velocity.Y *= 0.75f; + } + else + { + projectile.velocity.X *= 1.005f; //you broke up, time to yeet yourself out + projectile.velocity.Y *= 1.005f; + if (projectile.velocity.X > 16f) + { + projectile.velocity.X = 16f; + } + if (projectile.velocity.Y > 16f) + { + projectile.velocity.Y = 16f; + } + projectile.extraUpdates = 1; + } + } - public override bool OnTileCollide(Vector2 oldVelocity) - { - bounce--; - if (bounce <= 0) - { - projectile.Kill(); //you can only bounce so much 'til death - } - else - { - if (projectile.velocity.X != oldVelocity.X) - { - projectile.velocity.X = -oldVelocity.X; - } - if (projectile.velocity.Y != oldVelocity.Y) - { - projectile.velocity.Y = -oldVelocity.Y; - } - } - return false; - } + public override bool OnTileCollide(Vector2 oldVelocity) + { + bounce--; + if (bounce <= 0) + { + projectile.Kill(); //you can only bounce so much 'til death + } + else + { + if (projectile.velocity.X != oldVelocity.X) + { + projectile.velocity.X = -oldVelocity.X; + } + if (projectile.velocity.Y != oldVelocity.Y) + { + projectile.velocity.Y = -oldVelocity.Y; + } + } + return false; + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - grind += 5; //THE GRIND NEVER STOPS - if (grind >= 10) - { - grind = 10; - } - Player player = Main.player[projectile.owner]; - target.AddBuff(ModContent.BuffType(), 300); - if (projectile.ai[1] == 1f && projectile.owner == Main.myPlayer && grind >= 1) //stealth strike attack - { - int stealth = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); - Main.projectile[stealth].Calamity().forceRogue = true; - } - if (!target.canGhostHeal || player.moonLeech) //canGhostHeal be like lol - { - return; - } - if (Main.rand.NextBool(2)) - { - player.statLife += 1; //Trello said 2 hp per hit. Sounds like a fat balancing problem. - player.HealEffect(1); - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 300); + OnHitEffects(!target.canGhostHeal || Main.player[projectile.owner].moonLeech); + } - public override void OnHitPvp(Player target, int damage, bool crit) - { - grind += 5; //THE GRIND NEVER STOPS - if (grind >= 10) - { - grind = 10; - } - Player player = Main.player[projectile.owner]; - target.AddBuff(ModContent.BuffType(), 300); - if (projectile.ai[1] == 1f && projectile.owner == Main.myPlayer && grind >= 1) //stealth strike attack - { - int stealth = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); - Main.projectile[stealth].Calamity().forceRogue = true; - } - if (Main.rand.NextBool(2)) - { - player.statLife += 1; //Trello said 2 hp per hit. Sounds like a fat balancing problem. - player.HealEffect(1); - } - } + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 300); + OnHitEffects(Main.player[projectile.owner].moonLeech); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) //afterimages - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - } + private void OnHitEffects(bool cannotLifesteal) + { + if (grind < 10) + { + grind += 5; //THE GRIND NEVER STOPS + } + + if (projectile.Calamity().stealthStrike && projectile.owner == Main.myPlayer) //stealth strike attack + { + int stealth = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + Main.projectile[stealth].Calamity().forceRogue = true; + } + + Player player = Main.player[projectile.owner]; + if (cannotLifesteal) //canGhostHeal be like lol + { + return; + } + if (Main.rand.NextBool(2)) + { + player.statLife += 1; //Trello said 2 hp per hit. Sounds like a fat balancing problem. + player.HealEffect(1); + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) //afterimages + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + } } diff --git a/Projectiles/Rogue/BouncingBettyProjectile.cs b/Projectiles/Rogue/BouncingBettyProjectile.cs index fb059edbe4..c3b1bfcbf2 100644 --- a/Projectiles/Rogue/BouncingBettyProjectile.cs +++ b/Projectiles/Rogue/BouncingBettyProjectile.cs @@ -40,13 +40,7 @@ namespace CalamityMod.Projectiles.Rogue else { Vector2 fireVelocity = (Vector2.UnitY * (-6f + Main.rand.NextFloat(-6f, 2f))).RotatedByRandom((double)MathHelper.ToRadians(40f)); - int fireIndex = Projectile.NewProjectile(projectile.Center, projectile.velocity + fireVelocity, - Main.rand.Next(ProjectileID.MolotovFire, ProjectileID.MolotovFire3 + 1), - (int)(projectile.damage * 0.6f), 1f, projectile.owner); - Main.projectile[fireIndex].thrown = false; - Main.projectile[fireIndex].Calamity().forceRogue = true; - Main.projectile[fireIndex].penetrate = -1; - Main.projectile[fireIndex].usesLocalNPCImmunity = true; + int fireIndex = Projectile.NewProjectile(projectile.Center, projectile.velocity + fireVelocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.6f), 1f, projectile.owner); Main.projectile[fireIndex].localNPCHitCooldown = 9; Main.projectile[fireIndex].timeLeft = 240; } diff --git a/Projectiles/Rogue/BrackishFlaskProj.cs b/Projectiles/Rogue/BrackishFlaskProj.cs index fe00874d77..e5683ce1d5 100644 --- a/Projectiles/Rogue/BrackishFlaskProj.cs +++ b/Projectiles/Rogue/BrackishFlaskProj.cs @@ -41,7 +41,6 @@ namespace CalamityMod.Projectiles.Rogue double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; double deltaAngle = spread / 8f; double offsetAngle; - int i; if (projectile.owner == Main.myPlayer) { if (projectile.Calamity().stealthStrike) @@ -51,11 +50,11 @@ namespace CalamityMod.Projectiles.Rogue Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - for (i = 0; i < 4; i++) + for (int i = 0; i < 4; i++) { offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), projectile.damage / 2, projectile.knockBack * 0.5f, projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), projectile.damage / 2, projectile.knockBack * 0.5f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), projectile.damage / 2, projectile.knockBack * 0.5f, projectile.owner, 1f, 0f); } } } diff --git a/Projectiles/Rogue/BrackishFlaskProj.png b/Projectiles/Rogue/BrackishFlaskProj.png index c0101e465c..0e5ad78a57 100644 Binary files a/Projectiles/Rogue/BrackishFlaskProj.png and b/Projectiles/Rogue/BrackishFlaskProj.png differ diff --git a/Projectiles/Rogue/BrackishWater.cs b/Projectiles/Rogue/BrackishWater.cs index 78719abe3c..77bfdf8c6e 100644 --- a/Projectiles/Rogue/BrackishWater.cs +++ b/Projectiles/Rogue/BrackishWater.cs @@ -26,23 +26,23 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0.25f / 255f, (255 - projectile.alpha) * 0.5f / 255f); - if (projectile.localAI[0] == 0f) + if (projectile.localAI[0] == 0f && projectile.ai[0] == 1f) { Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 21); projectile.localAI[0] += 1f; } - int randomDust = Utils.SelectRandom(Main.rand, new int[] + if (projectile.timeLeft % 2 == 0) { - 33, - 89 - }); - for (int num457 = 0; num457 < 3; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDust, 0f, 0f, 100, default, 1.2f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } + int randomDust = Utils.SelectRandom(Main.rand, new int[] + { + 33, + 89 + }); + int water = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDust, 0f, 0f, 100, default, 1.2f); + Main.dust[water].noGravity = true; + Main.dust[water].velocity *= 0.5f; + Main.dust[water].velocity += projectile.velocity * 0.1f; + } } public override void Kill(int timeLeft) diff --git a/Projectiles/Rogue/BrackishWater.png b/Projectiles/Rogue/BrackishWater.png index 831f72cfc8..29d231bf6d 100644 Binary files a/Projectiles/Rogue/BrackishWater.png and b/Projectiles/Rogue/BrackishWater.png differ diff --git a/Projectiles/Rogue/Brimblade2.png b/Projectiles/Rogue/Brimblade2.png index d7de00d24b..0d93160ef8 100644 Binary files a/Projectiles/Rogue/Brimblade2.png and b/Projectiles/Rogue/Brimblade2.png differ diff --git a/Projectiles/Rogue/BrimbladeProj.png b/Projectiles/Rogue/BrimbladeProj.png index d7de00d24b..0d93160ef8 100644 Binary files a/Projectiles/Rogue/BrimbladeProj.png and b/Projectiles/Rogue/BrimbladeProj.png differ diff --git a/Projectiles/Rogue/CarvingFork.cs b/Projectiles/Rogue/CarvingFork.cs index 54ce3829da..6508ed2839 100644 --- a/Projectiles/Rogue/CarvingFork.cs +++ b/Projectiles/Rogue/CarvingFork.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.penetrate = -1; projectile.aiStyle = 113; projectile.timeLeft = 600; - aiType = 598; + aiType = ProjectileID.BoneJavelin; projectile.Calamity().rogue = true; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 30; diff --git a/Projectiles/Rogue/CelestialReaperProjectile.cs b/Projectiles/Rogue/CelestialReaperProjectile.cs index a005b94e1b..df056ca2c8 100644 --- a/Projectiles/Rogue/CelestialReaperProjectile.cs +++ b/Projectiles/Rogue/CelestialReaperProjectile.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool? CanHitNPC(NPC target) { - if (HomingCooldown != 0) + if (HomingCooldown > 0) { return false; } @@ -62,7 +62,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool CanHitPvp(Player target) { - return HomingCooldown == 0; + return HomingCooldown <= 0; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Rogue/Celestus2.cs b/Projectiles/Rogue/Celestus2.cs index 7f9d070323..825b8d27e4 100644 --- a/Projectiles/Rogue/Celestus2.cs +++ b/Projectiles/Rogue/Celestus2.cs @@ -1,5 +1,3 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -52,28 +50,12 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 30); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.Ichor, 120); + target.ExoDebuffs(); } public override void OnHitPvp(Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 30); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.Ichor, 120); + target.ExoDebuffs(); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Rogue/CelestusBoomerang.cs b/Projectiles/Rogue/CelestusBoomerang.cs index 5ccaed09b3..08a6c98a18 100644 --- a/Projectiles/Rogue/CelestusBoomerang.cs +++ b/Projectiles/Rogue/CelestusBoomerang.cs @@ -1,5 +1,3 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -116,15 +114,7 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 30); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.Ichor, 120); + target.ExoDebuffs(); if (projectile.owner == Main.myPlayer) { float spread = 45f * 0.0174f; @@ -143,15 +133,7 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitPvp(Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 30); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.Ichor, 120); + target.ExoDebuffs(); if (projectile.owner == Main.myPlayer) { float spread = 45f * 0.0174f; diff --git a/Projectiles/Rogue/CircletTornado.cs b/Projectiles/Rogue/CircletTornado.cs index 54af35c75c..f3dba7b2d1 100644 --- a/Projectiles/Rogue/CircletTornado.cs +++ b/Projectiles/Rogue/CircletTornado.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.penetrate = -1; projectile.timeLeft = 1200; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 20; + projectile.localNPCHitCooldown = 30; } public override void AI() diff --git a/Projectiles/Rogue/CraniumSMASH.cs b/Projectiles/Rogue/CraniumSMASH.cs index 44c0ab554d..7da9b66221 100644 --- a/Projectiles/Rogue/CraniumSMASH.cs +++ b/Projectiles/Rogue/CraniumSMASH.cs @@ -36,10 +36,10 @@ namespace CalamityMod.Projectiles.Rogue void SpawnExplosionDust() { Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14); - CalamityUtils.ExplosionGores(projectile, 3); + CalamityUtils.ExplosionGores(projectile.Center, 3); for (int num194 = 0; num194 < 25; num194++) { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 135, 0f, 0f, 100, default, 2f); + int num195 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 135, 0f, 0f, 100, default, 2f); Main.dust[num195].noGravity = true; Main.dust[num195].velocity *= 0f; } diff --git a/Projectiles/Rogue/CraniumSmasherExplosive.cs b/Projectiles/Rogue/CraniumSmasherExplosive.cs index 40c9faf471..41d1d816d9 100644 --- a/Projectiles/Rogue/CraniumSmasherExplosive.cs +++ b/Projectiles/Rogue/CraniumSmasherExplosive.cs @@ -47,10 +47,10 @@ namespace CalamityMod.Projectiles.Rogue projectile.localNPCHitCooldown = 10; projectile.Damage(); Main.PlaySound(SoundID.Item14, (int)projectile.position.X, (int)projectile.position.Y); - CalamityUtils.ExplosionGores(projectile, 3); + CalamityUtils.ExplosionGores(projectile.Center, 3); for (int num194 = 0; num194 < 25; num194++) { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 135, 0f, 0f, 100, default, 2f); + int num195 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 135, 0f, 0f, 100, default, 2f); Main.dust[num195].noGravity = true; Main.dust[num195].velocity *= 0f; } diff --git a/Projectiles/Rogue/CraniumSmasherStealth.cs b/Projectiles/Rogue/CraniumSmasherStealth.cs index 058da37834..7e616a124d 100644 --- a/Projectiles/Rogue/CraniumSmasherStealth.cs +++ b/Projectiles/Rogue/CraniumSmasherStealth.cs @@ -68,10 +68,10 @@ namespace CalamityMod.Projectiles.Rogue projectile.localNPCHitCooldown = 10; projectile.Damage(); Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14); - CalamityUtils.ExplosionGores(projectile, 3); + CalamityUtils.ExplosionGores(projectile.Center, 3); for (int num194 = 0; num194 < 25; num194++) { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 135, 0f, 0f, 100, default, 2f); + int num195 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 135, 0f, 0f, 100, default, 2f); Main.dust[num195].noGravity = true; Main.dust[num195].velocity *= 0f; } diff --git a/Projectiles/Rogue/Crystalline2.cs b/Projectiles/Rogue/Crystalline2.cs index 6aaabebe15..993bca11aa 100644 --- a/Projectiles/Rogue/Crystalline2.cs +++ b/Projectiles/Rogue/Crystalline2.cs @@ -28,10 +28,10 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { projectile.localAI[0]++; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(135f); if (projectile.spriteDirection == -1) { - projectile.rotation -= 1.57f; + projectile.rotation -= MathHelper.PiOver2; } if (projectile.localAI[0] == 10f && projectile.ai[1] == 1f) { @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Rogue for (int i = 0; i < numProj + 1; i++) { Vector2 perturbedSpeed = new Vector2(projectile.velocity.X * 0.8f, projectile.velocity.Y * 0.8f).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.5f), projectile.knockBack, projectile.owner, 0f, 2f); + int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, ModContent.ProjectileType(), (int)(projectile.damage * 0.5f), projectile.knockBack, projectile.owner, 0f, 2f); Main.projectile[proj].timeLeft = 20; } } @@ -51,6 +51,8 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { + if (projectile.timeLeft == (projectile.ai[1] == 2f ? 20 : 30)) + return false; Texture2D tex = Main.projectileTexture[projectile.type]; spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); return false; diff --git a/Projectiles/Rogue/CrystallineProj.cs b/Projectiles/Rogue/CrystallineProj.cs index d5e35bf284..14b3066e8b 100644 --- a/Projectiles/Rogue/CrystallineProj.cs +++ b/Projectiles/Rogue/CrystallineProj.cs @@ -27,10 +27,10 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(135f); if (projectile.spriteDirection == -1) { - projectile.rotation -= 1.57f; + projectile.rotation -= MathHelper.PiOver2; } projectile.ai[1] += 1f; if (projectile.ai[1] == 30f) @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Rogue { float AI1 = projectile.Calamity().stealthStrike ? 1f : 0f; Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.5f), projectile.knockBack, projectile.owner, 0f, AI1); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, ModContent.ProjectileType(), (int)(projectile.damage * 0.5f), projectile.knockBack, projectile.owner, 0f, AI1); } } } diff --git a/Projectiles/Rogue/DestructionBolt.cs b/Projectiles/Rogue/DestructionBolt.cs index 88a821815f..f90577c3fa 100644 --- a/Projectiles/Rogue/DestructionBolt.cs +++ b/Projectiles/Rogue/DestructionBolt.cs @@ -151,7 +151,7 @@ namespace CalamityMod.Projectiles.Rogue Main.PlaySound(SoundID.Item14, (int)projectile.position.X, (int)projectile.position.Y); for (int num621 = 0; num621 < 20; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 31, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -161,13 +161,13 @@ namespace CalamityMod.Projectiles.Rogue } for (int num623 = 0; num623 < 45; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, 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, dustType, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - CalamityUtils.ExplosionGores(projectile, 9); + CalamityUtils.ExplosionGores(projectile.Center, 9); } } } diff --git a/Projectiles/Rogue/DestructionBolt.png b/Projectiles/Rogue/DestructionBolt.png index bb6630a736..66a812cf0b 100644 Binary files a/Projectiles/Rogue/DestructionBolt.png and b/Projectiles/Rogue/DestructionBolt.png differ diff --git a/Projectiles/Rogue/DestructionStar.cs b/Projectiles/Rogue/DestructionStar.cs index 3e4ba4e834..2018a0a830 100644 --- a/Projectiles/Rogue/DestructionStar.cs +++ b/Projectiles/Rogue/DestructionStar.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Projectiles.Rogue public class DestructionStar : ModProjectile { public int hitCount = 0; - private static float Radius = 43f; + private static float Radius = 47f; public override void SetStaticDefaults() { @@ -19,8 +19,8 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 86; - projectile.height = 86; + projectile.width = 94; + projectile.height = 94; projectile.friendly = true; projectile.penetrate = 16; projectile.usesLocalNPCImmunity = true; @@ -33,12 +33,12 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { - if (Main.rand.Next(8) == 0) + if (Main.rand.NextBool(8)) { Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 191, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); } projectile.rotation += Math.Sign(projectile.velocity.X) * MathHelper.ToRadians(8f); - if (projectile.Calamity().stealthStrike == true || hitCount > 16) + if (projectile.Calamity().stealthStrike || hitCount > 16) hitCount = 16; } @@ -89,17 +89,10 @@ namespace CalamityMod.Projectiles.Rogue } if (projectile.owner == Main.myPlayer) { - int i; - for (i = 0; i < hitCount; i++) + for (int i = 0; i < hitCount; i++) { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.5), 0f, Main.myPlayer, 0f, 0f); + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); + Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.5), 0f, Main.myPlayer, 0f, 0f); } } } diff --git a/Projectiles/Rogue/DestructionStar.png b/Projectiles/Rogue/DestructionStar.png index 732056dac4..46c3428789 100644 Binary files a/Projectiles/Rogue/DestructionStar.png and b/Projectiles/Rogue/DestructionStar.png differ diff --git a/Projectiles/Rogue/DragonShit.cs b/Projectiles/Rogue/DragonShit.cs index e0ae51ace5..1c098b42a1 100644 --- a/Projectiles/Rogue/DragonShit.cs +++ b/Projectiles/Rogue/DragonShit.cs @@ -87,7 +87,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); for (int num621 = 0; num621 < 5; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1f); + int num622 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -97,13 +97,13 @@ namespace CalamityMod.Projectiles.Rogue } for (int num623 = 0; num623 < 8; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + int num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1f); + num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1f); Main.dust[num624].velocity *= 2f; } - CalamityUtils.ExplosionGores(projectile, 3); + CalamityUtils.ExplosionGores(projectile.Center, 3); projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 10; projectile.Damage(); diff --git a/Projectiles/Rogue/EclipsesFallMain.cs b/Projectiles/Rogue/EclipsesFallMain.cs index 5969e11d6e..94dfe345b5 100644 --- a/Projectiles/Rogue/EclipsesFallMain.cs +++ b/Projectiles/Rogue/EclipsesFallMain.cs @@ -7,81 +7,64 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { - public class EclipsesFallMain : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Eclipse's Fall"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public class EclipsesFallMain : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Eclipse's Fall"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 26; - projectile.height = 26; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.extraUpdates = 1; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.timeLeft = 300; - projectile.Calamity().rogue = true; - } + public override void SetDefaults() + { + projectile.width = 26; + projectile.height = 26; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.extraUpdates = 1; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.timeLeft = 300; + projectile.Calamity().rogue = true; + } - public override void AI() - { - if (Main.rand.Next(8) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 138, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; - } + public override void AI() + { + if (Main.rand.NextBool(8)) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 138, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver4; + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - for (int n = 0; n < Main.rand.Next(3, 6); n++) //3 to 5 spears - { - 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)(projectile.damage * 0.08f * Main.rand.NextFloat(4f, 7f)), (int)(projectile.knockBack * 0.1f * Main.rand.NextFloat(7f, 10f)), projectile.owner, 0f, 0f); - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + SpawnSpears(target.Center); + } - public override void OnHitPvp(Player target, int damage, bool crit) - { - for (int n = 0; n < Main.rand.Next(3, 6); n++) //3 to 5 spears - { - 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)(projectile.damage * 0.08f * Main.rand.NextFloat(4f, 7f)), (int)(projectile.knockBack * 0.1f * Main.rand.NextFloat(7f, 10f)), projectile.owner, 0f, 0f); - } - } + public override void OnHitPvp(Player target, int damage, bool crit) + { + SpawnSpears(target.Center); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - } + private void SpawnSpears(Vector2 targetPos) + { + int spearAmt = Main.rand.Next(3, 6); //3 to 5 spears + for (int n = 0; n < spearAmt; n++) + { + float dmgMult = 0.08f * Main.rand.NextFloat(4f, 7f); + float kBMult = 0.1f * Main.rand.NextFloat(7f, 10f); + CalamityUtils.ProjectileRain(targetPos, 400f, 100f, 500f, 800f, 29f, ModContent.ProjectileType(), (int)(projectile.damage * dmgMult), projectile.knockBack * kBMult, projectile.owner); + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + } } diff --git a/Projectiles/Rogue/EclipsesSmol.cs b/Projectiles/Rogue/EclipsesSmol.cs index fa9ad85291..0da5447707 100644 --- a/Projectiles/Rogue/EclipsesSmol.cs +++ b/Projectiles/Rogue/EclipsesSmol.cs @@ -18,7 +18,6 @@ namespace CalamityMod.Projectiles.Rogue projectile.width = 20; projectile.height = 20; projectile.friendly = true; - projectile.penetrate = 1; projectile.tileCollide = false; projectile.ignoreWater = true; projectile.timeLeft = 150; @@ -28,36 +27,30 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver4; CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 400f, 24f, 20f); } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item14, (int)projectile.position.X, (int)projectile.position.Y); - for (int num621 = 0; num621 < 20; num621++) + Main.PlaySound(SoundID.Item14, projectile.Center); + for (int i = 0; i < 2; i++) { - if (Main.rand.NextBool(10)) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 138, 0f, 0f, 100, default, 1.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; - } - } + int dustInt = Dust.NewDust(projectile.position, projectile.width, projectile.height, 138, 0f, 0f, 100, default, 1.2f); + Main.dust[dustInt].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[dustInt].scale = 0.5f; + Main.dust[dustInt].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } } - for (int num623 = 0; num623 < 35; num623++) + for (int j = 0; j < 3; j++) { - if (Main.rand.NextBool(10)) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 138, 0f, 0f, 100, default, 1.7f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 138, 0f, 0f, 100, default, 1f); - Main.dust[num624].velocity *= 2f; - } + int moreDust = Dust.NewDust(projectile.position, projectile.width, projectile.height, 138, 0f, 0f, 100, default, 1.7f); + Main.dust[moreDust].noGravity = true; + Main.dust[moreDust].velocity *= 5f; + moreDust = Dust.NewDust(projectile.position, projectile.width, projectile.height, 138, 0f, 0f, 100, default, 1f); + Main.dust[moreDust].velocity *= 2f; } } diff --git a/Projectiles/Rogue/EclipsesStealth.cs b/Projectiles/Rogue/EclipsesStealth.cs index f2a28866f3..4dfec90536 100644 --- a/Projectiles/Rogue/EclipsesStealth.cs +++ b/Projectiles/Rogue/EclipsesStealth.cs @@ -7,90 +7,96 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { - public class EclipsesStealth : ModProjectile - { + public class EclipsesStealth : ModProjectile + { private bool changedTimeLeft = false; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Eclipse's Stealth"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Eclipse's Stealth"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 25; - projectile.height = 25; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft = 300; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 30; - projectile.Calamity().rogue = true; - } + public override void SetDefaults() + { + projectile.width = 25; + projectile.height = 25; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.timeLeft = 300; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = -1; + projectile.Calamity().rogue = true; + } - public override void AI() - { - if (projectile.timeLeft % 5 == 0) //congrats Pinkie... every 5 ticks - { - if (Main.rand.NextBool(2) && Main.myPlayer == projectile.owner) - { - float dmgKBMult = Main.rand.NextFloat(0.32f, 0.56f); - int spearAmt = Main.rand.Next(1, 4); //1 to 3 spears - for (int n = 0; n < spearAmt; n++) - { - float xStart = projectile.position.X + Main.rand.Next(-400, 400); - float yStart = projectile.position.Y - Main.rand.Next(500, 800); - Vector2 startPos = new Vector2(xStart, yStart); - Vector2 velocity = projectile.Center - startPos; - velocity.X += (float)Main.rand.Next(-100, 101); - float travelDist = velocity.Length(); - float spearSpeed = 29f; - travelDist = spearSpeed / travelDist; - velocity.X *= travelDist; - velocity.Y *= travelDist; - Projectile.NewProjectile(startPos, velocity, ModContent.ProjectileType(), (int)(projectile.damage * dmgKBMult), projectile.knockBack * dmgKBMult, projectile.owner, 0f, 0f); - } - } - } - if (projectile.ai[0] == 0f) - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; - if (Main.rand.NextBool(8)) //dust - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 138, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - } + public override void AI() + { + if (projectile.timeLeft % 5 == 0) //congrats Pinkie... every 5 ticks + { + if (Main.rand.NextBool(2) && Main.myPlayer == projectile.owner) + { + float dmgKBMult = Main.rand.NextFloat(0.4f, 0.6f); + int spearAmt = Main.rand.Next(1, 3); //1 to 2 spears + for (int n = 0; n < spearAmt; n++) + { + CalamityUtils.ProjectileRain(projectile.Center, 400f, 100f, 500f, 800f, 29f, ModContent.ProjectileType(), (int)(projectile.damage * dmgKBMult), projectile.knockBack * dmgKBMult, projectile.owner); + } + } + } + + //Behavior when not sticking to anything + if (projectile.ai[0] == 0f) + { + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver4; + if (Main.rand.NextBool(8)) //dust + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 138, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + } + + //Ensures that a spear will last 10 seconds after it hits something if (projectile.ai[0] == 1f && !changedTimeLeft) { - projectile.timeLeft = 900; + projectile.timeLeft = 600; changedTimeLeft = true; } - //Sticky Behaviour - CalamityUtils.StickyProjAI(projectile, 15); - } - public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - CalamityUtils.ModifyHitNPCSticky(projectile, 1, true); - } + //Sticky Behaviour + projectile.StickyProjAI(10); + } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) - { - if (targetHitbox.Width > 8 && targetHitbox.Height > 8) - { - targetHitbox.Inflate(-targetHitbox.Width / 8, -targetHitbox.Height / 8); - } - return null; - } + public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + projectile.ModifyHitNPCSticky(1, true); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + if (targetHitbox.Width > 8 && targetHitbox.Height > 8) + { + targetHitbox.Inflate(-targetHitbox.Width / 8, -targetHitbox.Height / 8); + } + return null; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + + public override bool? CanHitNPC(NPC target) + { + if (projectile.ai[0] == 1f) + { + return false; + } + return null; + } + + public override bool CanHitPvp(Player target) => projectile.ai[0] != 1f; + } } diff --git a/Projectiles/Rogue/FantasyTalismanProj.cs b/Projectiles/Rogue/FantasyTalismanProj.cs index 5d14ce2f96..744533b7e7 100644 --- a/Projectiles/Rogue/FantasyTalismanProj.cs +++ b/Projectiles/Rogue/FantasyTalismanProj.cs @@ -35,11 +35,11 @@ namespace CalamityMod.Projectiles.Rogue { projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); - if (Main.rand.Next(3) == 0) + if (Main.rand.NextBool(3)) { Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 175, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); } - CalamityUtils.StickyProjAI(projectile, 15); + projectile.StickyProjAI(4); if (projectile.ai[0] == 1f) { if (projectile.timeLeft % 10 == 0) @@ -47,42 +47,9 @@ namespace CalamityMod.Projectiles.Rogue if (Main.rand.NextBool(2)) { int spiritDamage = projectile.damage / 2; - int[] numArray1 = new int[Main.maxNPCs]; - int maxValue1 = 0; - int maxValue2 = 0; - for (int index = 0; index < Main.maxNPCs; ++index) - { - if (Main.npc[index].CanBeChasedBy((object) projectile, false)) - { - float num2 = Math.Abs(Main.npc[index].Center.X - projectile.Center.X) + Math.Abs(Main.npc[index].Center.Y - projectile.Center.Y); - if (num2 < 800f) - { - if (Collision.CanHit(projectile.position, 1, 1, Main.npc[index].position, Main.npc[index].width, Main.npc[index].height) && num2 > 50f) - { - numArray1[maxValue2] = index; - ++maxValue2; - } - else if (maxValue2 == 0) - { - numArray1[maxValue1] = index; - ++maxValue1; - } - } - } - } - if (maxValue1 == 0 && maxValue2 == 0) - return; - int num3 = maxValue2 <= 0 ? numArray1[Main.rand.Next(maxValue1)] : numArray1[Main.rand.Next(maxValue2)]; - double num4 = 4.0; - float num5 = (float) Main.rand.Next(-100, 101); - float num6 = (float) Main.rand.Next(-100, 101); - double num7 = Math.Sqrt((double) num5 * (double) num5 + (double) num6 * (double) num6); - float num8 = (float) (num4 / num7); - float SpeedX = num5 * num8; - float SpeedY = num6 * num8; - int ghost = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, SpeedX, SpeedY, ProjectileID.SpectreWrath, spiritDamage, 0.0f, projectile.owner, (float)num3, 0f); - Main.projectile[ghost].Calamity().forceRogue = true; - Main.projectile[ghost].penetrate = 1; + Projectile ghost = CalamityGlobalProjectile.SpawnOrb(projectile, spiritDamage, ProjectileID.SpectreWrath, 800f, 4f); + ghost.Calamity().forceRogue = true; + ghost.penetrate = 1; } } } @@ -96,7 +63,7 @@ namespace CalamityMod.Projectiles.Rogue public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - CalamityUtils.ModifyHitNPCSticky(projectile, 3, true); + projectile.ModifyHitNPCSticky(3, true); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) @@ -107,13 +74,5 @@ namespace CalamityMod.Projectiles.Rogue } return null; } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - if (projectile.timeLeft > 240) - { - projectile.timeLeft = 240; - } - } } } diff --git a/Projectiles/Rogue/FantasyTalismanStealth.cs b/Projectiles/Rogue/FantasyTalismanStealth.cs index d291322099..fb27738123 100644 --- a/Projectiles/Rogue/FantasyTalismanStealth.cs +++ b/Projectiles/Rogue/FantasyTalismanStealth.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Projectiles.Rogue { projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); - if (Main.rand.Next(3) == 0) + if (Main.rand.NextBool(3)) { Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 175, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); } @@ -45,11 +45,11 @@ namespace CalamityMod.Projectiles.Rogue { if (projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); } } } - CalamityUtils.StickyProjAI(projectile, 15); + projectile.StickyProjAI(4); if (projectile.ai[0] == 1f) { if (projectile.timeLeft % 4 == 0) @@ -57,42 +57,9 @@ namespace CalamityMod.Projectiles.Rogue if (Main.rand.NextBool(2)) { int spiritDamage = projectile.damage / 2; - int[] numArray1 = new int[Main.maxNPCs]; - int maxValue1 = 0; - int maxValue2 = 0; - for (int index = 0; index < Main.maxNPCs; ++index) - { - if (Main.npc[index].CanBeChasedBy((object) projectile, false)) - { - float num2 = Math.Abs(Main.npc[index].Center.X - projectile.Center.X) + Math.Abs(Main.npc[index].Center.Y - projectile.Center.Y); - if (num2 < 800f) - { - if (Collision.CanHit(projectile.position, 1, 1, Main.npc[index].position, Main.npc[index].width, Main.npc[index].height) && num2 > 50f) - { - numArray1[maxValue2] = index; - ++maxValue2; - } - else if (maxValue2 == 0) - { - numArray1[maxValue1] = index; - ++maxValue1; - } - } - } - } - if (maxValue1 == 0 && maxValue2 == 0) - return; - int num3 = maxValue2 <= 0 ? numArray1[Main.rand.Next(maxValue1)] : numArray1[Main.rand.Next(maxValue2)]; - double num4 = 4.0; - float num5 = (float) Main.rand.Next(-100, 101); - float num6 = (float) Main.rand.Next(-100, 101); - double num7 = Math.Sqrt((double) num5 * (double) num5 + (double) num6 * (double) num6); - float num8 = (float) (num4 / num7); - float SpeedX = num5 * num8; - float SpeedY = num6 * num8; - int ghost = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, SpeedX, SpeedY, ProjectileID.SpectreWrath, spiritDamage, 0.0f, projectile.owner, (float)num3, 0f); - Main.projectile[ghost].Calamity().forceRogue = true; - Main.projectile[ghost].penetrate = 1; + Projectile ghost = CalamityGlobalProjectile.SpawnOrb(projectile, spiritDamage, ProjectileID.SpectreWrath, 800f, 4f); + ghost.Calamity().forceRogue = true; + ghost.penetrate = 1; } } } @@ -106,7 +73,7 @@ namespace CalamityMod.Projectiles.Rogue public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - CalamityUtils.ModifyHitNPCSticky(projectile, 1, true); + projectile.ModifyHitNPCSticky(1, true); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) @@ -117,13 +84,5 @@ namespace CalamityMod.Projectiles.Rogue } return null; } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - if (projectile.timeLeft > 240) - { - projectile.timeLeft = 240; - } - } } } diff --git a/Projectiles/Rogue/FinalDawnFireSlash.cs b/Projectiles/Rogue/FinalDawnFireSlash.cs index 18e059abb4..ff28601aa3 100644 --- a/Projectiles/Rogue/FinalDawnFireSlash.cs +++ b/Projectiles/Rogue/FinalDawnFireSlash.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Projectiles.Rogue { Player player = Main.player[projectile.owner]; - if (player.dead || player is null || Main.myPlayer != projectile.owner) + if (player.dead || player is null) projectile.Kill(); player.direction = projectile.direction; diff --git a/Projectiles/Rogue/FinalDawnHorizontalSlash.cs b/Projectiles/Rogue/FinalDawnHorizontalSlash.cs index 5ed9d58eea..63e04254e4 100644 --- a/Projectiles/Rogue/FinalDawnHorizontalSlash.cs +++ b/Projectiles/Rogue/FinalDawnHorizontalSlash.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Projectiles.Rogue { Player player = Main.player[projectile.owner]; - if (player.dead || player is null || Main.myPlayer != projectile.owner) + if (player.dead || player is null) projectile.Kill(); projectile.Center = player.Center; @@ -47,7 +47,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.friendly = true; Main.PlaySound(SoundID.Item71, projectile.position); - if(projectile.owner == Main.myPlayer) + if (projectile.owner == Main.myPlayer) { Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage / 2, 0f, projectile.owner); } diff --git a/Projectiles/Rogue/FinalDawnProjectile.cs b/Projectiles/Rogue/FinalDawnProjectile.cs index a7e799af8d..36e42761d0 100644 --- a/Projectiles/Rogue/FinalDawnProjectile.cs +++ b/Projectiles/Rogue/FinalDawnProjectile.cs @@ -7,169 +7,173 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { - public class FinalDawnProjectile : ModProjectile - { - public const float MaxChargeTime = 20f; - public override void SetStaticDefaults() + public class FinalDawnProjectile : ModProjectile + { + public const float MaxChargeTime = 20f; + public override void SetStaticDefaults() { DisplayName.SetDefault("The Final Dawn"); + Main.projFrames[projectile.type] = 2; } - public override void SetDefaults() - { - projectile.width = 16; - projectile.height = 16; - projectile.friendly = false; - projectile.Calamity().rogue = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - Main.projFrames[projectile.type] = 2; - //projectile.extraUpdates = 2; - } - public override bool ShouldUpdatePosition() => false; - public override void AI() + public override void SetDefaults() { - Player player = Main.player[projectile.owner]; + projectile.width = 16; + projectile.height = 16; + projectile.friendly = false; + projectile.Calamity().rogue = true; + projectile.penetrate = -1; + projectile.tileCollide = false; + //projectile.extraUpdates = 2; + } + public override bool ShouldUpdatePosition() => false; + public override void AI() + { + Player player = Main.player[projectile.owner]; - if (player.dead || player is null || Main.myPlayer != projectile.owner) + if (player.dead || player is null) projectile.Kill(); - if (Main.myPlayer == player.whoAmI) - { - projectile.velocity = Main.MouseWorld - player.Center; - projectile.velocity.Normalize(); - } - player.direction = projectile.direction; - player.heldProj = projectile.whoAmI; - projectile.Center = player.Center; - projectile.position.Y -= 44; - projectile.position.X -= 46 * player.direction; - player.bodyFrame.Y = player.bodyFrame.Height; + if (Main.myPlayer == player.whoAmI) + { + projectile.velocity = Main.MouseWorld - player.Center; + projectile.velocity.Normalize(); + } + player.direction = projectile.direction; + player.heldProj = projectile.whoAmI; + projectile.Center = player.Center; + projectile.position.Y -= 44; + projectile.position.X -= 46 * player.direction; + player.bodyFrame.Y = player.bodyFrame.Height; - if (projectile.ai[0] < MaxChargeTime) - { - // Charging dust - Vector2 dustCenter = new Vector2(projectile.Center.X, projectile.Center.Y - 40); - int flame = Dust.NewDust(dustCenter, projectile.width, projectile.height, ModContent.DustType(), 0, 0, 100, default, 2f); - Main.dust[flame].noGravity = true; - Main.dust[flame].fadeIn = 1.5f; - Main.dust[flame].scale = 1.4f; - Vector2 offsetVector = Utils.NextVector2CircularEdge(Main.rand, 100f, 100f); - Main.dust[flame].position = dustCenter - offsetVector; - Vector2 newVelocity = dustCenter - Main.dust[flame].position; - Main.dust[flame].velocity = newVelocity * 0.1f; - } - if (projectile.ai[0] == MaxChargeTime) - { - int dustCount = 36; - for (int i = 0; i < dustCount; i++) - { - Vector2 startingPosition = projectile.Center + new Vector2(0, -40); - Vector2 offset = Vector2.UnitX * projectile.width * 0.1875f; - offset = offset.RotatedBy((i - (dustCount / 2 - 1)) * MathHelper.TwoPi / dustCount); - int dustIdx = Dust.NewDust(startingPosition + offset, 0, 0, ModContent.DustType(), offset.X * 2f, offset.Y * 2f, 100, default, 3.4f); - Main.dust[dustIdx].noGravity = true; - Main.dust[dustIdx].noLight = true; - Main.dust[dustIdx].velocity = Vector2.Normalize(offset) * 5f; - } - projectile.frame = 1; - } - projectile.ai[0]++; + if (projectile.ai[0] < MaxChargeTime) + { + // Charging dust + Vector2 dustCenter = new Vector2(projectile.Center.X, projectile.Center.Y - 40); + int flame = Dust.NewDust(dustCenter, projectile.width, projectile.height, ModContent.DustType(), 0, 0, 100, default, 2f); + Main.dust[flame].noGravity = true; + Main.dust[flame].fadeIn = 1.5f; + Main.dust[flame].scale = 1.4f; + Vector2 offsetVector = Utils.NextVector2CircularEdge(Main.rand, 100f, 100f); + Main.dust[flame].position = dustCenter - offsetVector; + Vector2 newVelocity = dustCenter - Main.dust[flame].position; + Main.dust[flame].velocity = newVelocity * 0.1f; + } + if (projectile.ai[0] == MaxChargeTime) + { + int dustCount = 36; + for (int i = 0; i < dustCount; i++) + { + Vector2 startingPosition = projectile.Center + new Vector2(0, -40); + Vector2 offset = Vector2.UnitX * projectile.width * 0.1875f; + offset = offset.RotatedBy((i - (dustCount / 2 - 1)) * MathHelper.TwoPi / dustCount); + int dustIdx = Dust.NewDust(startingPosition + offset, 0, 0, ModContent.DustType(), offset.X * 2f, offset.Y * 2f, 100, default, 3.4f); + Main.dust[dustIdx].noGravity = true; + Main.dust[dustIdx].noLight = true; + Main.dust[dustIdx].velocity = Vector2.Normalize(offset) * 5f; + } + projectile.frame = 1; + } + projectile.ai[0]++; - projectile.spriteDirection = (projectile.velocity.X > 0).ToDirectionInt(); + projectile.spriteDirection = (projectile.velocity.X > 0).ToDirectionInt(); - if (Main.myPlayer == projectile.owner) - { - if (!player.channel || player.noItems || player.CCed) - { - AttemptExecuteAttacks(player); - projectile.Kill(); - } - } - } + if (Main.myPlayer == projectile.owner) + { + if (!player.channel || player.noItems || player.CCed) + { + AttemptExecuteAttacks(player); + projectile.Kill(); + } + } + } - public void AttemptExecuteAttacks(Player player) - { - if (projectile.ai[0] >= MaxChargeTime && !player.noItems && !player.CCed) - { - // Far range attack - if (player.controlUp) - { - // Stealth Strike - if (player.Calamity().StealthStrikeAvailable()) - { - Projectile.NewProjectile(player.Center, - player.DirectionTo(Main.MouseWorld) * 38f, - ModContent.ProjectileType(), - (int)(projectile.damage * 2.5f), - projectile.knockBack, - projectile.owner); - player.Calamity().ConsumeStealthByAttacking(); - } - else - { - Projectile.NewProjectile(projectile.Center, - projectile.DirectionTo(Main.MouseWorld) * 38f, - ModContent.ProjectileType(), projectile.damage, - projectile.knockBack, projectile.owner); - } - } - // Close range attack - else - { - // Stealth - if (player.Calamity().StealthStrikeAvailable()) - { - Projectile.NewProjectile(projectile.Center, - projectile.velocity, - ModContent.ProjectileType(), - (int)(projectile.damage * 2.5f), - projectile.knockBack, - projectile.owner); - player.Calamity().ConsumeStealthByAttacking(); - } - else - { - Projectile.NewProjectile(projectile.Center, - projectile.velocity, - ModContent.ProjectileType(), - (int)(projectile.damage * 1.5f), - projectile.knockBack, - projectile.owner); - } - } - } - } + public void AttemptExecuteAttacks(Player player) + { + //projectile.ai[1] == 1f if spawned via Venerated Locket + if (projectile.ai[0] >= MaxChargeTime && !player.noItems && !player.CCed) + { + // Far range attack + if (player.controlUp) + { + // Stealth Strike + if (player.Calamity().StealthStrikeAvailable() && projectile.ai[1] != 1f) + { + Projectile.NewProjectile(player.Center, + player.DirectionTo(Main.MouseWorld) * 38f, + ModContent.ProjectileType(), + (int)(projectile.damage * 1.5f), + projectile.knockBack, + projectile.owner); + player.Calamity().ConsumeStealthByAttacking(); + } + else + { + Projectile.NewProjectile(projectile.Center, + projectile.DirectionTo(Main.MouseWorld) * 38f, + ModContent.ProjectileType(), projectile.damage, + projectile.knockBack, projectile.owner); + if (projectile.ai[1] != 1f) + player.Calamity().ConsumeStealthByAttacking(); + } + } + // Close range attack + else + { + // Stealth + if (player.Calamity().StealthStrikeAvailable() && projectile.ai[1] != 1f) + { + Projectile.NewProjectile(projectile.Center, + projectile.velocity, + ModContent.ProjectileType(), + (int)(projectile.damage * 1.5f), + projectile.knockBack, + projectile.owner); + player.Calamity().ConsumeStealthByAttacking(); + } + else + { + //This one doesn't consume stealth since it replenishes stealth on hits + Projectile.NewProjectile(projectile.Center, + projectile.velocity, + ModContent.ProjectileType(), + projectile.damage, + projectile.knockBack, + projectile.owner); + } + } + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D scytheTexture = Main.projectileTexture[projectile.type]; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/FinalDawnProjectile_Glow"); - int height = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int yStart = height * projectile.frame; - Main.spriteBatch.Draw(scytheTexture, - projectile.Center - Main.screenPosition + Vector2.UnitY * projectile.gfxOffY, - new Rectangle?(new Rectangle(0, yStart, scytheTexture.Width, height)), - projectile.GetAlpha(lightColor), - projectile.rotation, - new Vector2(scytheTexture.Width / 2f, height / 2f), - projectile.scale, - projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, - 0f); - Main.spriteBatch.Draw(glowmask, - projectile.Center - Main.screenPosition + Vector2.UnitY * projectile.gfxOffY, - new Rectangle?(new Rectangle(0, yStart, scytheTexture.Width, height)), - projectile.GetAlpha(Color.White), - projectile.rotation, - new Vector2(scytheTexture.Width / 2f, height / 2f), - projectile.scale, - projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, - 0f); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D scytheTexture = Main.projectileTexture[projectile.type]; + Texture2D glowmask = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/FinalDawnProjectile_Glow"); + int height = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int yStart = height * projectile.frame; + Main.spriteBatch.Draw(scytheTexture, + projectile.Center - Main.screenPosition + Vector2.UnitY * projectile.gfxOffY, + new Rectangle?(new Rectangle(0, yStart, scytheTexture.Width, height)), + projectile.GetAlpha(lightColor), + projectile.rotation, + new Vector2(scytheTexture.Width / 2f, height / 2f), + projectile.scale, + projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, + 0f); + Main.spriteBatch.Draw(glowmask, + projectile.Center - Main.screenPosition + Vector2.UnitY * projectile.gfxOffY, + new Rectangle?(new Rectangle(0, yStart, scytheTexture.Width, height)), + projectile.GetAlpha(Color.White), + projectile.rotation, + new Vector2(scytheTexture.Width / 2f, height / 2f), + projectile.scale, + projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, + 0f); + return false; + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 600); - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 600); + } + } } \ No newline at end of file diff --git a/Projectiles/Rogue/FinalDawnThrow.cs b/Projectiles/Rogue/FinalDawnThrow.cs index 9151e544a7..d09dc8400f 100644 --- a/Projectiles/Rogue/FinalDawnThrow.cs +++ b/Projectiles/Rogue/FinalDawnThrow.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Projectiles.Rogue { Player player = Main.player[projectile.owner]; - if (player.dead || player is null || Main.myPlayer != projectile.owner) + if (player.dead || player is null) projectile.Kill(); if (projectile.localAI[0] == 0) diff --git a/Projectiles/Rogue/FinalDawnThrow2.cs b/Projectiles/Rogue/FinalDawnThrow2.cs index 80aa357634..6bb8d51475 100644 --- a/Projectiles/Rogue/FinalDawnThrow2.cs +++ b/Projectiles/Rogue/FinalDawnThrow2.cs @@ -45,7 +45,7 @@ namespace CalamityMod.Projectiles.Rogue Vector2 velocity = Utils.NextVector2Circular(Main.rand, 7.2f, 7.2f); Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), - (int)(projectile.damage * 0.8), projectile.knockBack, projectile.owner, 0f, + (int)(projectile.damage * 0.3), projectile.knockBack, projectile.owner, 0f, target.whoAmI); } HasHitEnemy = true; @@ -55,7 +55,7 @@ namespace CalamityMod.Projectiles.Rogue { Player player = Main.player[projectile.owner]; - if (player.dead || player is null || Main.myPlayer != projectile.owner) + if (player.dead || player is null) projectile.Kill(); if (projectile.localAI[0] == 0) diff --git a/Projectiles/Rogue/FossilShardThrown.cs b/Projectiles/Rogue/FossilShardThrown.cs index c5392e9423..134deb8fa9 100644 --- a/Projectiles/Rogue/FossilShardThrown.cs +++ b/Projectiles/Rogue/FossilShardThrown.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.StatDebuffs; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { @@ -18,7 +19,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.penetrate = 1; projectile.aiStyle = 1; projectile.timeLeft = 90; - aiType = 1; + aiType = ProjectileID.WoodenArrowFriendly; projectile.Calamity().rogue = true; } diff --git a/Projectiles/Rogue/GildedDaggerProj.cs b/Projectiles/Rogue/GildedDaggerProj.cs index 6832282326..a408cb64e8 100644 --- a/Projectiles/Rogue/GildedDaggerProj.cs +++ b/Projectiles/Rogue/GildedDaggerProj.cs @@ -2,8 +2,8 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System.Collections.Generic; using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { @@ -30,9 +30,9 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { - if (Main.rand.Next(7) == 0) + if (Main.rand.NextBool(7)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 246, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, DustID.GoldCoin, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); } if (hasHitEnemy) { @@ -94,7 +94,7 @@ namespace CalamityMod.Projectiles.Rogue { previousNPCs.Add(i); } - if (!npc.friendly && !npc.townNPC && npc.active && !npc.dontTakeDamage && npc.chaseable && npc != target && !hasHitNPC) + if (!npc.friendly && !npc.townNPC && npc.active && !npc.dontTakeDamage && npc.chaseable && npc != target && !hasHitNPC && npc.type != NPCID.TargetDummy) { float dist = (projectile.Center - npc.Center).Length(); if (dist < minDist) @@ -140,7 +140,7 @@ namespace CalamityMod.Projectiles.Rogue { for (int num621 = 0; num621 < 8; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 1f); + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, DustID.GoldCoin, 0f, 0f, 100, default, 1f); Main.dust[num622].velocity *= 1f; } } diff --git a/Projectiles/Rogue/GlaiveProj.cs b/Projectiles/Rogue/GlaiveProj.cs index e2a3d4a386..f8af833e7e 100644 --- a/Projectiles/Rogue/GlaiveProj.cs +++ b/Projectiles/Rogue/GlaiveProj.cs @@ -82,25 +82,25 @@ namespace CalamityMod.Projectiles.Rogue // Home back in on the player. if (projectile.velocity.X < xDist) { - projectile.velocity.X = projectile.velocity.X + acceleration; + projectile.velocity.X += acceleration; if (projectile.velocity.X < 0f && xDist > 0f) projectile.velocity.X += acceleration; } else if (projectile.velocity.X > xDist) { - projectile.velocity.X = projectile.velocity.X - acceleration; + projectile.velocity.X -= acceleration; if (projectile.velocity.X > 0f && xDist < 0f) projectile.velocity.X -= acceleration; } if (projectile.velocity.Y < yDist) { - projectile.velocity.Y = projectile.velocity.Y + acceleration; + projectile.velocity.Y += acceleration; if (projectile.velocity.Y < 0f && yDist > 0f) projectile.velocity.Y += acceleration; } else if (projectile.velocity.Y > yDist) { - projectile.velocity.Y = projectile.velocity.Y - acceleration; + projectile.velocity.Y -= acceleration; if (projectile.velocity.Y > 0f && yDist < 0f) projectile.velocity.Y -= acceleration; } diff --git a/Projectiles/Rogue/GleamingDaggerProj.cs b/Projectiles/Rogue/GleamingDaggerProj.cs index 34771a7146..9e7407a93f 100644 --- a/Projectiles/Rogue/GleamingDaggerProj.cs +++ b/Projectiles/Rogue/GleamingDaggerProj.cs @@ -2,8 +2,8 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System.Collections.Generic; using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { @@ -30,9 +30,9 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { - if (Main.rand.Next(7) == 0) + if (Main.rand.NextBool(7)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 247, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, DustID.PlatinumCoin, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); } if (hasHitEnemy) { @@ -94,7 +94,7 @@ namespace CalamityMod.Projectiles.Rogue { previousNPCs.Add(i); } - if (!npc.friendly && !npc.townNPC && npc.active && !npc.dontTakeDamage && npc.chaseable && npc != target && !hasHitNPC) + if (!npc.friendly && !npc.townNPC && npc.active && !npc.dontTakeDamage && npc.chaseable && npc != target && !hasHitNPC && npc.type != NPCID.TargetDummy) { float dist = (projectile.Center - npc.Center).Length(); if (dist < minDist) @@ -140,7 +140,7 @@ namespace CalamityMod.Projectiles.Rogue { for (int num621 = 0; num621 < 8; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 247, 0f, 0f, 100, default, 1f); + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, DustID.PlatinumCoin, 0f, 0f, 100, default, 1f); Main.dust[num622].velocity *= 1f; } } diff --git a/Projectiles/Rogue/GodsParanoiaProj.cs b/Projectiles/Rogue/GodsParanoiaProj.cs index 1cab7a319c..7549220f05 100644 --- a/Projectiles/Rogue/GodsParanoiaProj.cs +++ b/Projectiles/Rogue/GodsParanoiaProj.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Rogue Main.dust[num137].noGravity = true; } - CalamityUtils.StickyProjAI(projectile, 15); + projectile.StickyProjAI(15); if (projectile.ai[0] == 1f) { @@ -102,7 +102,7 @@ namespace CalamityMod.Projectiles.Rogue public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - CalamityUtils.ModifyHitNPCSticky(projectile, 10, true); + projectile.ModifyHitNPCSticky(10, true); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) diff --git a/Projectiles/Rogue/Honeycomb.cs b/Projectiles/Rogue/Honeycomb.cs index 375de85006..786ef9fd0f 100644 --- a/Projectiles/Rogue/Honeycomb.cs +++ b/Projectiles/Rogue/Honeycomb.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.penetrate = 1; projectile.aiStyle = 2; projectile.timeLeft = 300; - aiType = 48; + aiType = ProjectileID.ThrowingKnife; projectile.Calamity().rogue = true; } diff --git a/Projectiles/Rogue/HypothermiaChunk.cs b/Projectiles/Rogue/HypothermiaChunk.cs index f52bc2a2b0..05d18001a9 100644 --- a/Projectiles/Rogue/HypothermiaChunk.cs +++ b/Projectiles/Rogue/HypothermiaChunk.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.tileCollide = true; } - if (Main.rand.Next(10) == 0) + if (Main.rand.NextBool(10)) { Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 191, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f, 0, default, 0.8f); } @@ -58,16 +58,10 @@ namespace CalamityMod.Projectiles.Rogue } if (projectile.owner == Main.myPlayer) { - for (int num252 = 0; num252 < Main.rand.Next(1,4); num252++) + for (int i = 0; i < Main.rand.Next(1,4); i++) { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - int shard = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, ModContent.ProjectileType(), (int)((float)projectile.damage * 0.33f), projectile.knockBack * 0.75f, Main.myPlayer, Main.rand.Next(0,4), 1f); + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); + int shard = Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.33f), projectile.knockBack * 0.75f, Main.myPlayer, Main.rand.Next(4), 1f); } } } diff --git a/Projectiles/Rogue/HypothermiaShard.cs b/Projectiles/Rogue/HypothermiaShard.cs index 583d5f1aca..8c9b3d1ae5 100644 --- a/Projectiles/Rogue/HypothermiaShard.cs +++ b/Projectiles/Rogue/HypothermiaShard.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Rogue counter += 0.25f; if (Main.rand.NextBool(10)) { - int num300 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 191, 0f, 0f, 0, default, 0.8f); + int num300 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 191, 0f, 0f, 0, default, 0.8f); Main.dust[num300].noGravity = true; Main.dust[num300].velocity *= 0.2f; } diff --git a/Projectiles/Rogue/JawsProjectile.cs b/Projectiles/Rogue/JawsProjectile.cs index 97a677283b..b9fd32b1e7 100644 --- a/Projectiles/Rogue/JawsProjectile.cs +++ b/Projectiles/Rogue/JawsProjectile.cs @@ -60,12 +60,12 @@ namespace CalamityMod.Projectiles.Rogue } } //Sticky Behaviour - CalamityUtils.StickyProjAI(projectile, 15); + projectile.StickyProjAI(15); } public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - CalamityUtils.ModifyHitNPCSticky(projectile, 6, false); + projectile.ModifyHitNPCSticky(6, false); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Rogue/LatcherMineProjectile.cs b/Projectiles/Rogue/LatcherMineProjectile.cs index ffbf73bc8b..5b59d81b0b 100644 --- a/Projectiles/Rogue/LatcherMineProjectile.cs +++ b/Projectiles/Rogue/LatcherMineProjectile.cs @@ -113,80 +113,7 @@ namespace CalamityMod.Projectiles.Rogue } public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - Rectangle myRect = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); - if (projectile.owner == Main.myPlayer) - { - for (int i = 0; i < Main.npc.Length; i++) - { - // TODO -- replace the 318 here with whatever projectileID that is - if (Main.npc[i].active && !Main.npc[i].dontTakeDamage && - ((projectile.friendly && (!Main.npc[i].friendly || projectile.type == 318 || (Main.npc[i].type == NPCID.Guide && projectile.owner < 255 && Main.player[projectile.owner].killGuide) || (Main.npc[i].type == NPCID.Clothier && projectile.owner < 255 && Main.player[projectile.owner].killClothier))) || - (projectile.hostile && Main.npc[i].friendly && !Main.npc[i].dontTakeDamageFromHostiles)) && (projectile.owner < 0 || Main.npc[i].immune[projectile.owner] == 0 || projectile.maxPenetrate == 1)) - { - if (Main.npc[i].noTileCollide || !projectile.ownerHitCheck || projectile.CanHit(Main.npc[i])) - { - bool colliding; - if (Main.npc[i].type == NPCID.SolarCrawltipedeTail) - { - Rectangle rect = Main.npc[i].getRect(); - rect.X -= 8; - rect.Y -= 8; - rect.Width += 16; - rect.Height += 16; - colliding = projectile.Colliding(myRect, rect); - } - else - { - colliding = projectile.Colliding(myRect, Main.npc[i].getRect()); - } - if (colliding) - { - if (Main.npc[i].reflectingProjectiles && projectile.CanReflect()) - { - Main.npc[i].ReflectProjectile(projectile.whoAmI); - return; - } - projectile.ai[0] = 1f; - projectile.ai[1] = (float)i; - projectile.velocity = (Main.npc[i].Center - projectile.Center) * 0.75f; - projectile.netUpdate = true; - projectile.StatusNPC(i); - projectile.damage = 0; - const int maxNumberOfMines = 6; - Point[] otherMinesArray = new Point[maxNumberOfMines]; - int otherMinesIndex = 0; - for (int l = 0; l < Main.projectile.Length; l++) - { - if (l != projectile.whoAmI && Main.projectile[l].active && - Main.projectile[l].owner == Main.myPlayer && - Main.projectile[l].type == projectile.type && - Main.projectile[l].ai[0] == 1f && - Main.projectile[l].ai[1] == (float)i) - { - otherMinesArray[otherMinesIndex++] = new Point(l, Main.projectile[l].timeLeft); - if (otherMinesIndex >= otherMinesArray.Length) - { - break; - } - } - } - if (otherMinesIndex >= otherMinesArray.Length) - { - int idx = 0; - for (int m = 1; m < otherMinesArray.Length; m++) - { - if (otherMinesArray[m].Y < otherMinesArray[idx].Y) - { - idx = m; - } - } - Main.projectile[otherMinesArray[idx].X].Kill(); - } - } - } - } - } - } + projectile.ModifyHitNPCSticky(6, false); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) @@ -211,18 +138,12 @@ namespace CalamityMod.Projectiles.Rogue if (Main.rand.NextBool(2) && projectile.Calamity().stealthStrike) { Vector2 shrapnelVelocity = (Vector2.UnitY * (-16f + Main.rand.NextFloat(-3, 12f))).RotatedByRandom((double)MathHelper.ToRadians(40f)); - Projectile.NewProjectile(projectile.Top, shrapnelVelocity, - ModContent.ProjectileType(), projectile.damage, 3f, projectile.owner); + Projectile.NewProjectile(projectile.Top, shrapnelVelocity, ModContent.ProjectileType(), projectile.damage, 3f, projectile.owner); } else { Vector2 fireVelocity = (Vector2.UnitY * (-16f + Main.rand.NextFloat(-3, 12f))).RotatedByRandom((double)MathHelper.ToRadians(40f)); - int fireIndex = Projectile.NewProjectile(projectile.Top, fireVelocity, - Main.rand.Next(ProjectileID.MolotovFire, ProjectileID.MolotovFire3 + 1), - projectile.damage / 3, 1f, projectile.owner); - Main.projectile[fireIndex].Calamity().forceRogue = true; - Main.projectile[fireIndex].penetrate = -1; - Main.projectile[fireIndex].usesLocalNPCImmunity = true; + int fireIndex = Projectile.NewProjectile(projectile.Top, fireVelocity, ModContent.ProjectileType(), projectile.damage / 3, 1f, projectile.owner); Main.projectile[fireIndex].localNPCHitCooldown = -2; } } diff --git a/Projectiles/Rogue/LeviathanTooth.cs b/Projectiles/Rogue/LeviathanTooth.cs index 72eebe6551..c0045d9d56 100644 --- a/Projectiles/Rogue/LeviathanTooth.cs +++ b/Projectiles/Rogue/LeviathanTooth.cs @@ -44,12 +44,12 @@ namespace CalamityMod.Projectiles.Rogue } } //Sticky Behaviour - CalamityUtils.StickyProjAI(projectile, 15); + projectile.StickyProjAI(15); } public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - CalamityUtils.ModifyHitNPCSticky(projectile, 6, false); + projectile.ModifyHitNPCSticky(6, false); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Rogue/LionfishProj.cs b/Projectiles/Rogue/LionfishProj.cs index 237c3334f8..1328886ff4 100644 --- a/Projectiles/Rogue/LionfishProj.cs +++ b/Projectiles/Rogue/LionfishProj.cs @@ -74,12 +74,12 @@ namespace CalamityMod.Projectiles.Rogue } } //Sticky Behaviour - CalamityUtils.StickyProjAI(projectile, 15); + projectile.StickyProjAI(15); } public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - CalamityUtils.ModifyHitNPCSticky(projectile, 6, false); + projectile.ModifyHitNPCSticky(6, false); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) diff --git a/Projectiles/Rogue/LionfishProj.png b/Projectiles/Rogue/LionfishProj.png index 56025eca70..e97c12862e 100644 Binary files a/Projectiles/Rogue/LionfishProj.png and b/Projectiles/Rogue/LionfishProj.png differ diff --git a/Projectiles/Rogue/MetalShard.cs b/Projectiles/Rogue/MetalShard.cs index c497aa702c..ecbab2f436 100644 --- a/Projectiles/Rogue/MetalShard.cs +++ b/Projectiles/Rogue/MetalShard.cs @@ -36,12 +36,12 @@ namespace CalamityMod.Projectiles.Rogue if (projectile.velocity.Y > 16f) projectile.velocity.Y = 16f; //Sticky Behaviour - CalamityUtils.StickyProjAI(projectile, 15); + projectile.StickyProjAI(15); } public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - CalamityUtils.ModifyHitNPCSticky(projectile, 8 , true); + projectile.ModifyHitNPCSticky(8 , true); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) diff --git a/Projectiles/Rogue/NastyChollaBol.cs b/Projectiles/Rogue/NastyChollaBol.cs index e40b858041..65724c1574 100644 --- a/Projectiles/Rogue/NastyChollaBol.cs +++ b/Projectiles/Rogue/NastyChollaBol.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Weapons.Rogue; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -30,73 +31,32 @@ namespace CalamityMod.Projectiles.Rogue Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 157, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); } //Sticky Behaviour - CalamityUtils.StickyProjAI(projectile, 15); + projectile.StickyProjAI(15); if (projectile.ai[0] != 1f) { - try - { - int num223 = (int)(projectile.position.X / 16f) - 1; - int num224 = (int)((projectile.position.X + (float)projectile.width) / 16f) + 2; - int num225 = (int)(projectile.position.Y / 16f) - 1; - int num226 = (int)((projectile.position.Y + (float)projectile.height) / 16f) + 2; - if (num223 < 0) - { - num223 = 0; - } - if (num224 > Main.maxTilesX) - { - num224 = Main.maxTilesX; - } - if (num225 < 0) - { - num225 = 0; - } - if (num226 > Main.maxTilesY) - { - num226 = Main.maxTilesY; - } - for (int num227 = num223; num227 < num224; num227++) - { - for (int num228 = num225; num228 < num226; num228++) - { - if (Main.tile[num227, num228] != null && Main.tile[num227, num228].nactive() && (Main.tileSolid[(int)Main.tile[num227, num228].type] || (Main.tileSolidTop[(int)Main.tile[num227, num228].type] && Main.tile[num227, num228].frameY == 0))) - { - Vector2 vector19; - vector19.X = (float)(num227 * 16); - vector19.Y = (float)(num228 * 16); - if (projectile.position.X + (float)projectile.width - 4f > vector19.X && projectile.position.X + 4f < vector19.X + 16f && projectile.position.Y + (float)projectile.height - 4f > vector19.Y && projectile.position.Y + 4f < vector19.Y + 16f) - { - projectile.velocity.X = 0f; - projectile.velocity.Y = -0.2f; - } - } - } - } - } catch - { - } + projectile.StickToTiles(true, false); projectile.localAI[1] += 1f; if (projectile.localAI[1] > 10f) { projectile.localAI[1] = 10f; if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) { - projectile.velocity.X = projectile.velocity.X * 0.97f; - if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) + projectile.velocity.X *= 0.97f; + if (Math.Abs(projectile.velocity.X) < 0.01f) { projectile.velocity.X = 0f; projectile.netUpdate = true; } } - projectile.velocity.Y = projectile.velocity.Y + 0.2f; + projectile.velocity.Y += 0.2f; } projectile.rotation += projectile.velocity.X * 0.1f; - } + } } public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - CalamityUtils.ModifyHitNPCSticky(projectile, 20, false); + projectile.ModifyHitNPCSticky(20, false); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) @@ -121,19 +81,13 @@ namespace CalamityMod.Projectiles.Rogue public override void Kill(int timeLeft) { Player player = Main.player[projectile.owner]; - int num251 = Main.rand.Next(2, 4); + int needleAmt = Main.rand.Next(2, 4); if (projectile.owner == Main.myPlayer) { - for (int num252 = 0; num252 < num251; num252++) + for (int n = 0; n < needleAmt; n++) { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - int shard = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, ModContent.ProjectileType(), (int)((NastyCholla.BaseDamage/4) * (player.allDamage + player.meleeDamage - 1f)), 0f, projectile.owner, 0f, 0f); + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); + int shard = Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), (int)((NastyCholla.BaseDamage/4) * player.RogueDamage()), 0f, projectile.owner, 0f, 0f); } } } diff --git a/Projectiles/Rogue/PlaguenadeBee.cs b/Projectiles/Rogue/PlaguenadeBee.cs index f08bcae8a1..49d5978846 100644 --- a/Projectiles/Rogue/PlaguenadeBee.cs +++ b/Projectiles/Rogue/PlaguenadeBee.cs @@ -7,161 +7,160 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { - public class PlaguenadeBee : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Plague Bee"); - Main.projFrames[projectile.type] = 4; - } + public class PlaguenadeBee : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Plague Bee"); + Main.projFrames[projectile.type] = 4; + } - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.penetrate = 2; - projectile.timeLeft = 420; - projectile.ignoreWater = true; - projectile.Calamity().rogue = true; - } + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.penetrate = 2; + projectile.timeLeft = 240; + projectile.ignoreWater = true; + projectile.Calamity().rogue = true; + } - public override void AI() - { - if (projectile.velocity.X > 0f) - { - projectile.spriteDirection = projectile.direction = 1; - } - else if (projectile.velocity.X < 0f) - { - projectile.spriteDirection = projectile.direction = -1; - } - projectile.rotation = projectile.velocity.X * 0.05f; - projectile.frameCounter++; - if (projectile.frameCounter >= 3) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame >= 3) - { - projectile.frame = 0; - } - float num373 = projectile.position.X; - float num374 = projectile.position.Y; - float num375 = 100000f; - bool flag10 = false; - projectile.ai[0] += 1f; - if (projectile.ai[0] > 30f) - { - projectile.ai[0] = 30f; - for (int num376 = 0; num376 < Main.maxNPCs; num376++) - { - if (Main.npc[num376].CanBeChasedBy(projectile, false) && (!Main.npc[num376].wet || projectile.type == 307)) - { - float num377 = Main.npc[num376].position.X + (float)(Main.npc[num376].width / 2); - float num378 = Main.npc[num376].position.Y + (float)(Main.npc[num376].height / 2); - float num379 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num377) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num378); - if (num379 < 800f && num379 < num375 && Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[num376].position, Main.npc[num376].width, Main.npc[num376].height)) - { - num375 = num379; - num373 = num377; - num374 = num378; - flag10 = true; - } - } - } - } - if (!flag10) - { - num373 = projectile.position.X + (float)(projectile.width / 2) + projectile.velocity.X * 100f; - num374 = projectile.position.Y + (float)(projectile.height / 2) + projectile.velocity.Y * 100f; - } - float num380 = 10f; - float num381 = 0.14f; - Vector2 vector30 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num382 = num373 - vector30.X; - float num383 = num374 - vector30.Y; - float num384 = (float)Math.Sqrt((double)(num382 * num382 + num383 * num383)); - num384 = num380 / num384; - num382 *= num384; - num383 *= num384; - if (projectile.velocity.X < num382) - { - projectile.velocity.X = projectile.velocity.X + num381; - if (projectile.velocity.X < 0f && num382 > 0f) - { - projectile.velocity.X = projectile.velocity.X + num381 * 2f; - } - } - else if (projectile.velocity.X > num382) - { - projectile.velocity.X = projectile.velocity.X - num381; - if (projectile.velocity.X > 0f && num382 < 0f) - { - projectile.velocity.X = projectile.velocity.X - num381 * 2f; - } - } - if (projectile.velocity.Y < num383) - { - projectile.velocity.Y = projectile.velocity.Y + num381; - if (projectile.velocity.Y < 0f && num383 > 0f) - { - projectile.velocity.Y = projectile.velocity.Y + num381 * 2f; - } - } - else if (projectile.velocity.Y > num383) - { - projectile.velocity.Y = projectile.velocity.Y - num381; - if (projectile.velocity.Y > 0f && num383 < 0f) - { - projectile.velocity.Y = projectile.velocity.Y - num381 * 2f; - } - } - } + public override void AI() + { + if (projectile.owner != Main.myPlayer) + projectile.Kill(); - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.velocity.X != oldVelocity.X) - { - projectile.velocity.X = -oldVelocity.X; - } - if (projectile.velocity.Y != oldVelocity.Y) - { - projectile.velocity.Y = -oldVelocity.Y; - } - return false; - } + projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); + projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); + projectile.rotation += projectile.spriteDirection * MathHelper.ToRadians(45f); - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - 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; - } + projectile.frameCounter++; + if (projectile.frameCounter >= 3) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= Main.projFrames[projectile.type]) + { + projectile.frame = 0; + } - public override void Kill(int timeLeft) - { - int num3; - for (int num418 = 0; num418 < 3; num418 = num3 + 1) - { - int num419 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 89, projectile.velocity.X, projectile.velocity.Y, 50, default, 1f); - Main.dust[num419].noGravity = true; - Main.dust[num419].scale = 1f; - num3 = num418; - } - } + Vector2 center = projectile.Center; + float maxDistance = 800f; + bool homeIn = false; + projectile.ai[0] += 1f; + if (projectile.ai[0] > 30f) + { + for (int npcIndex = 0; npcIndex < Main.maxNPCs; npcIndex++) + { + NPC npc = Main.npc[npcIndex]; + if (npc.CanBeChasedBy(projectile, false) && !npc.wet) + { + float extraDistance = (npc.width / 2) + (npc.height / 2); - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 300); - } + bool canHit = true; + if (extraDistance < maxDistance) + canHit = Collision.CanHit(projectile.Center, 1, 1, npc.Center, 1, 1); - public override void OnHitPvp(Player target, int damage, bool crit) - { - target.AddBuff(ModContent.BuffType(), 300); - } - } + if (Vector2.Distance(npc.Center, projectile.Center) < (maxDistance + extraDistance) && canHit) + { + center = npc.Center; + homeIn = true; + break; + } + } + } + } + if (!homeIn) + { + center.X = projectile.Center.X + projectile.velocity.X * 100f; + center.Y = projectile.Center.Y + projectile.velocity.Y * 100f; + } + float speed = 10f; + float velocityTweak = 0.14f; + Vector2 projPos = projectile.Center; + Vector2 velocity = center - projPos; + float targetDist = velocity.Length(); + targetDist = speed / targetDist; + velocity.X *= targetDist; + velocity.Y *= targetDist; + if (projectile.velocity.X < velocity.X) + { + projectile.velocity.X += velocityTweak; + if (projectile.velocity.X < 0f && velocity.X > 0f) + { + projectile.velocity.X += velocityTweak * 2f; + } + } + else if (projectile.velocity.X > velocity.X) + { + projectile.velocity.X -= velocityTweak; + if (projectile.velocity.X > 0f && velocity.X < 0f) + { + projectile.velocity.X -= velocityTweak * 2f; + } + } + if (projectile.velocity.Y < velocity.Y) + { + projectile.velocity.Y += velocityTweak; + if (projectile.velocity.Y < 0f && velocity.Y > 0f) + { + projectile.velocity.Y += velocityTweak * 2f; + } + } + else if (projectile.velocity.Y > velocity.Y) + { + projectile.velocity.Y -= velocityTweak; + if (projectile.velocity.Y > 0f && velocity.Y < 0f) + { + projectile.velocity.Y -= velocityTweak * 2f; + } + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (projectile.velocity.X != oldVelocity.X) + { + projectile.velocity.X = -oldVelocity.X; + } + if (projectile.velocity.Y != oldVelocity.Y) + { + projectile.velocity.Y = -oldVelocity.Y; + } + return false; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture = Main.projectileTexture[projectile.type]; + int frameHeight = texture.Height / Main.projFrames[projectile.type]; + int drawStart = frameHeight * 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, drawStart, texture.Width, frameHeight)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture.Width / 2f, (float)frameHeight / 2f), projectile.scale, spriteEffects, 0f); + return false; + } + + public override void Kill(int timeLeft) + { + for (int i = 0; i < 2; i++) + { + int plague = Dust.NewDust(projectile.position, projectile.width, projectile.height, 89, projectile.velocity.X, projectile.velocity.Y, 50, default, 1f); + Main.dust[plague].noGravity = true; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 300); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 300); + } + } } diff --git a/Projectiles/Rogue/PlaguenadeProj.cs b/Projectiles/Rogue/PlaguenadeProj.cs index 904eaf1d33..3ff3bbec5e 100644 --- a/Projectiles/Rogue/PlaguenadeProj.cs +++ b/Projectiles/Rogue/PlaguenadeProj.cs @@ -32,14 +32,14 @@ namespace CalamityMod.Projectiles.Rogue projectile.ai[0] = 5f; if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) { - projectile.velocity.X = projectile.velocity.X * 0.97f; - if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) + projectile.velocity.X *= 0.97f; + if (projectile.velocity.X > -0.01f && projectile.velocity.X < 0.01f) { projectile.velocity.X = 0f; projectile.netUpdate = true; } } - projectile.velocity.Y = projectile.velocity.Y + 0.2f; + projectile.velocity.Y += 0.2f; } projectile.rotation += projectile.velocity.X * 0.1f; if (projectile.velocity.Y > 16f) @@ -72,45 +72,47 @@ namespace CalamityMod.Projectiles.Rogue { if (projectile.owner == Main.myPlayer) { - for (int num639 = 0; num639 < (projectile.Calamity().stealthStrike ? 28 : 20); num639++) + Player player = Main.player[projectile.owner]; + int projAmt = projectile.Calamity().stealthStrike ? 28 : 20; + for (int projIndex = 0; projIndex < projAmt; projIndex++) { float speedX = (float)Main.rand.Next(-35, 36) * 0.02f; float speedY = (float)Main.rand.Next(-35, 36) * 0.02f; - Projectile.NewProjectile(projectile.position.X, projectile.position.Y, speedX, speedY, ModContent.ProjectileType(), Main.player[projectile.owner].beeDamage(projectile.damage), Main.player[projectile.owner].beeKB(0f), Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(projectile.position.X, projectile.position.Y, speedX, speedY, ModContent.ProjectileType(), player.beeDamage(projectile.damage), player.beeKB(0f), projectile.owner, 0f, 0f); } + Main.PlaySound(SoundID.Item14, projectile.position); + if (projectile.Calamity().stealthStrike) + { + projectile.position = projectile.Center; + projectile.width = projectile.height = 75; + } + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.Damage(); + for (int i = 0; i < 10; i++) + { + int smoke = Dust.NewDust(projectile.position, projectile.width, projectile.height, 31, 0f, 0f, 100, default, 2f); + Main.dust[smoke].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[smoke].scale = 0.5f; + Main.dust[smoke].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int j = 0; j < 15; j++) + { + int plague = Dust.NewDust(projectile.position, projectile.width, projectile.height, 89, 0f, 0f, 100, default, 3f); + Main.dust[plague].noGravity = true; + Main.dust[plague].velocity *= 5f; + int fire = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Fire, 0f, 0f, 100, default, 2f); + Main.dust[fire].velocity *= 2f; + } + CalamityUtils.ExplosionGores(projectile.Center, 3); } - Main.PlaySound(SoundID.Item14, projectile.position); - if (projectile.Calamity().stealthStrike) - { - projectile.position = projectile.Center; - projectile.width = projectile.height = 75; - } - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - for (int num621 = 0; num621 < 20; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default, 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 < 30; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 89, 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, 6, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - CalamityUtils.ExplosionGores(projectile, 3); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Rogue/Prismalline2.cs b/Projectiles/Rogue/Prismalline2.cs index a9e4662186..f989130189 100644 --- a/Projectiles/Rogue/Prismalline2.cs +++ b/Projectiles/Rogue/Prismalline2.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { @@ -20,7 +21,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.penetrate = 1; projectile.aiStyle = 113; projectile.timeLeft = 60; - aiType = 598; + aiType = ProjectileID.BoneJavelin; projectile.Calamity().rogue = true; } diff --git a/Projectiles/Rogue/Prismalline3.cs b/Projectiles/Rogue/Prismalline3.cs index 1c4eeb32e2..5fc4d6946c 100644 --- a/Projectiles/Rogue/Prismalline3.cs +++ b/Projectiles/Rogue/Prismalline3.cs @@ -25,10 +25,10 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(135f); if (projectile.spriteDirection == -1) { - projectile.rotation -= 1.57f; + projectile.rotation -= MathHelper.PiOver2; } CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 300f, 25f, 20f); } @@ -49,16 +49,10 @@ namespace CalamityMod.Projectiles.Rogue if (projectile.ai[0] == 1f) { int shardCount = Main.rand.Next(1,4); - for (int num252 = 0; num252 < shardCount; num252++) + for (int s = 0; s < shardCount; s++) { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - int shard = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, ModContent.ProjectileType(), projectile.damage / 3, 0f, projectile.owner, 0f, 0f); + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); + int shard = Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), projectile.damage / 3, 0f, projectile.owner, 0f, 0f); Main.projectile[shard].Calamity().forceRogue = true; Main.projectile[shard].penetrate = 1; } diff --git a/Projectiles/Rogue/PrismallineProj.cs b/Projectiles/Rogue/PrismallineProj.cs index 280539286c..a1fab9f455 100644 --- a/Projectiles/Rogue/PrismallineProj.cs +++ b/Projectiles/Rogue/PrismallineProj.cs @@ -48,21 +48,15 @@ namespace CalamityMod.Projectiles.Rogue { for (int i = 0; i < numProj + 1; i++) { - Vector2 speed = new Vector2((float)Main.rand.Next(-50, 51), (float)Main.rand.Next(-50, 51)); - while (speed.X == 0f && speed.Y == 0f) - { - speed = new Vector2((float)Main.rand.Next(-50, 51), (float)Main.rand.Next(-50, 51)); - } - speed.Normalize(); - speed *= (float)Main.rand.Next(30, 61) * 0.1f * 2f; + Vector2 velocity = CalamityUtils.RandomVelocity(50f, 30f, 60f, 0.2f); if (numSpecProj < 2 && !hitEnemy) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, speed.X, speed.Y, ModContent.ProjectileType(), (int)(projectile.damage * 1.25), projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 1.1), projectile.knockBack, projectile.owner, 0f, 0f); ++numSpecProj; } else { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, speed.X, speed.Y, ModContent.ProjectileType(), (int)(projectile.damage * 0.75), projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.75), projectile.knockBack, projectile.owner, 0f, 0f); } } } @@ -71,28 +65,16 @@ namespace CalamityMod.Projectiles.Rogue int shardCount = Main.rand.Next(2,5); for (int num252 = 0; num252 < shardCount; num252++) { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - int shard = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, ModContent.ProjectileType(), projectile.damage / 2, 0f, projectile.owner, 0f, 0f); + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); + int shard = Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), projectile.damage / 2, 0f, projectile.owner, 0f, 0f); Main.projectile[shard].Calamity().forceRogue = true; Main.projectile[shard].usesLocalNPCImmunity = true; Main.projectile[shard].localNPCHitCooldown = 10; } for (int i = 0; i < numProj + 1; i++) { - Vector2 speed = new Vector2((float)Main.rand.Next(-50, 51), (float)Main.rand.Next(-50, 51)); - while (speed.X == 0f && speed.Y == 0f) - { - speed = new Vector2((float)Main.rand.Next(-50, 51), (float)Main.rand.Next(-50, 51)); - } - speed.Normalize(); - speed *= (float)Main.rand.Next(30, 61) * 0.1f * 2f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, speed.X, speed.Y, ModContent.ProjectileType(), (int)(projectile.damage * 1.25), projectile.knockBack, projectile.owner, 1f, 0f); + Vector2 velocity = CalamityUtils.RandomVelocity(50f, 30f, 60f, 0.2f); + Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 1.15), projectile.knockBack, projectile.owner, 1f, 0f); } } } @@ -116,16 +98,10 @@ namespace CalamityMod.Projectiles.Rogue if (projectile.Calamity().stealthStrike) { int shardCount = Main.rand.Next(1,4); - for (int num252 = 0; num252 < shardCount; num252++) + for (int s = 0; s < shardCount; s++) { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - int shard = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, ModContent.ProjectileType(), projectile.damage / 2, 0f, projectile.owner, 0f, 0f); + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); + int shard = Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), projectile.damage / 2, 0f, projectile.owner, 0f, 0f); Main.projectile[shard].Calamity().forceRogue = true; Main.projectile[shard].penetrate = 1; } diff --git a/Projectiles/Rogue/ProfanedPartisanproj.cs b/Projectiles/Rogue/ProfanedPartisanproj.cs index 992f348aa5..f5f60cf019 100644 --- a/Projectiles/Rogue/ProfanedPartisanproj.cs +++ b/Projectiles/Rogue/ProfanedPartisanproj.cs @@ -1,16 +1,15 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Rogue { public class ProfanedPartisanproj : ModProjectile { - public int stealthStrikeTimer = 0; - public override void SetStaticDefaults() { DisplayName.SetDefault("Profaned Partisan"); @@ -64,9 +63,9 @@ namespace CalamityMod.Projectiles.Rogue drawOriginOffsetY = 2; } - if (Main.rand.Next(3) == 0) + if (Main.rand.NextBool(3)) { - int d = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, projectile.velocity.X, projectile.velocity.Y, 100, default(Color), 1.1f); + int d = Dust.NewDust(projectile.position, projectile.width, projectile.height, (int)CalamityDusts.ProfanedFire, projectile.velocity.X, projectile.velocity.Y, 100, default(Color), 1.1f); Main.dust[d].position = projectile.Center; Main.dust[d].velocity *= 0.3f; Main.dust[d].velocity += projectile.velocity * 0.85f; @@ -75,13 +74,11 @@ namespace CalamityMod.Projectiles.Rogue if (projectile.Calamity().stealthStrike) //Stealth strike { - Vector2 spearposition = new Vector2(projectile.Center.X + Main.rand.NextFloat(-15f, 15f), projectile.Center.Y + Main.rand.NextFloat(-15f, 15f)); - Vector2 spearspeed = new Vector2(projectile.velocity.X, projectile.velocity.Y); - stealthStrikeTimer++; - if (stealthStrikeTimer >= 18) + Vector2 spearPosition = new Vector2(projectile.Center.X + Main.rand.NextFloat(-15f, 15f), projectile.Center.Y + Main.rand.NextFloat(-15f, 15f)); + Vector2 spearSpeed = projectile.velocity; + if (projectile.timeLeft % 18 == 0) { - Projectile.NewProjectile(spearposition, spearspeed, ModContent.ProjectileType(), projectile.damage/10, projectile.knockBack, projectile.owner, 0f, 0f); - stealthStrikeTimer = 0; + Projectile.NewProjectile(spearPosition, spearSpeed, ModContent.ProjectileType(), projectile.damage / 10, projectile.knockBack * 0.1f, projectile.owner); } } } @@ -90,11 +87,10 @@ namespace CalamityMod.Projectiles.Rogue { for (int i = 0; i < 20; i++) { - Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 50, default(Color), 2.6f); + Dust.NewDust(projectile.position, projectile.width, projectile.height, (int)CalamityDusts.ProfanedFire, 0f, 0f, 50, default(Color), 2.6f); } Main.PlaySound(SoundID.Item45, projectile.position); - Vector2 explode = new Vector2(0f, 0f); - Projectile.NewProjectile(projectile.Center, explode, ModContent.ProjectileType(), projectile.damage/2, projectile.knockBack * 1.3f, projectile.owner); + Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage / 2, projectile.knockBack * 0.5f, projectile.owner); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Rogue/ProfanedPartisanspear.cs b/Projectiles/Rogue/ProfanedPartisanspear.cs index d69ca6b7e3..79c8b1d30d 100644 --- a/Projectiles/Rogue/ProfanedPartisanspear.cs +++ b/Projectiles/Rogue/ProfanedPartisanspear.cs @@ -53,32 +53,28 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 120); - if (projectile.ai[1] != 1f) - { - projectile.velocity.X = -projectile.velocity.X; - projectile.velocity.Y = -projectile.velocity.Y; - projectile.ai[1] = 1f; - projectile.ai[0] = 1f; - projectile.extraUpdates = 2; - if (projectile.timeLeft > 280) - projectile.timeLeft = 280; - } + OnHitEffects(); } public override void OnHitPvp(Player target, int damage, bool crit) { target.AddBuff(ModContent.BuffType(), 120); + OnHitEffects(); + } + + private void OnHitEffects() + { if (projectile.ai[1] != 1f) { - projectile.velocity.X = -projectile.velocity.X; - projectile.velocity.Y = -projectile.velocity.Y; + projectile.velocity.X *= -1f; + projectile.velocity.Y *= -1f; projectile.ai[1] = 1f; projectile.ai[0] = 1f; projectile.extraUpdates = 2; if (projectile.timeLeft > 280) projectile.timeLeft = 280; } - } + } public override void AI() { @@ -88,8 +84,6 @@ namespace CalamityMod.Projectiles.Rogue timer++; if (timer >= 5) projectile.penetrate = 1; - float pcx = projectile.Center.X; - float pcy = projectile.Center.Y; if (timer >= 10) { CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 800f, 7f, 20f); diff --git a/Projectiles/Rogue/RegulusRiotProj.cs b/Projectiles/Rogue/RegulusRiotProj.cs index 2ba65c9912..862e1f579d 100644 --- a/Projectiles/Rogue/RegulusRiotProj.cs +++ b/Projectiles/Rogue/RegulusRiotProj.cs @@ -96,6 +96,7 @@ namespace CalamityMod.Projectiles.Rogue targetCenter = npcCenter; homeIn = true; targetIndex = npcIndex; + break; } } } diff --git a/Projectiles/Rogue/SandDollarStealth.cs b/Projectiles/Rogue/SandDollarStealth.cs index d92e588b1d..4986c1cac4 100644 --- a/Projectiles/Rogue/SandDollarStealth.cs +++ b/Projectiles/Rogue/SandDollarStealth.cs @@ -28,44 +28,28 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { + OnHitEffects(); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + OnHitEffects(); + } + + private void OnHitEffects() + { int coralAmt = Main.rand.Next(1, 4); if (projectile.owner == Main.myPlayer && projectile.Calamity().stealthStrike) { for (int coralCount = 0; coralCount < coralAmt; coralCount++) { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - int coral = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, ModContent.ProjectileType(), projectile.damage / 3, 0f, projectile.owner, 0f, 0f); + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); + int coral = Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), projectile.damage / 3, 0f, projectile.owner, 0f, 0f); Main.projectile[coral].Calamity().forceRogue = true; } } } - public override void OnHitPvp(Player target, int damage, bool crit) - { - int coralAmt = Main.rand.Next(1, 4); - if (projectile.owner == Main.myPlayer && projectile.Calamity().stealthStrike) - { - for (int coralCount = 0; coralCount < coralAmt; coralCount++) - { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - int coral = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, ModContent.ProjectileType(), projectile.damage / 3, 0f, projectile.owner, 0f, 0f); - Main.projectile[coral].Calamity().forceRogue = true; - } - } - } - public override bool OnTileCollide(Vector2 oldVelocity) { projectile.ai[0] += 0.1f; diff --git a/Projectiles/Rogue/ScourgeVenomCloud.cs b/Projectiles/Rogue/ScourgeVenomCloud.cs index c874e06e43..81c622266b 100644 --- a/Projectiles/Rogue/ScourgeVenomCloud.cs +++ b/Projectiles/Rogue/ScourgeVenomCloud.cs @@ -1,7 +1,8 @@ +using CalamityMod.Buffs.DamageOverTime; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Rogue { @@ -10,7 +11,7 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Venom Cloud"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[projectile.type] = 10; } public override void SetDefaults() @@ -30,41 +31,37 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { + projectile.ai[0] += 1f; projectile.frameCounter++; - if (projectile.frameCounter > 9) + if (projectile.frameCounter > 6) { projectile.frame++; projectile.frameCounter = 0; } - if (projectile.frame > 3) - { - projectile.frame = 0; - } + if (projectile.ai[0] < 219f) //255 - frameCounter tick * number of disippation frames + { + if (projectile.frame >= 4) + { + projectile.frame = 0; + } + } + else if (projectile.owner == Main.myPlayer && projectile.frame >= Main.projFrames[projectile.type]) + { + projectile.Kill(); + } projectile.velocity *= 0.98f; - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 120f) - { - if (projectile.alpha < 255) - { - projectile.alpha += 5; - if (projectile.alpha > 255) - { - projectile.alpha = 255; - } - } - else if (projectile.owner == Main.myPlayer) - { - projectile.Kill(); - } - } - else if (projectile.alpha > 80) + if (projectile.alpha > 110) { projectile.alpha -= 30; - if (projectile.alpha < 80) + if (projectile.alpha < 110) { - projectile.alpha = 80; + projectile.alpha = 110; } } + if (Math.Abs(projectile.velocity.X) > 0.1f) + { + projectile.spriteDirection = -projectile.direction; + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Rogue/ScourgeVenomCloud.png b/Projectiles/Rogue/ScourgeVenomCloud.png index 412c5607a5..2a1c0b9502 100644 Binary files a/Projectiles/Rogue/ScourgeVenomCloud.png and b/Projectiles/Rogue/ScourgeVenomCloud.png differ diff --git a/Projectiles/Rogue/ScourgeoftheDesertProj.cs b/Projectiles/Rogue/ScourgeoftheDesertProj.cs index 58bb1eeed1..d1b4a88457 100644 --- a/Projectiles/Rogue/ScourgeoftheDesertProj.cs +++ b/Projectiles/Rogue/ScourgeoftheDesertProj.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.height = 26; projectile.friendly = true; projectile.aiStyle = 113; - aiType = 598; + aiType = ProjectileID.BoneJavelin; projectile.penetrate = 3; projectile.Calamity().rogue = true; } diff --git a/Projectiles/Rogue/ScourgeoftheSeasProjectile.cs b/Projectiles/Rogue/ScourgeoftheSeasProjectile.cs index f2563bde7e..33a18cf336 100644 --- a/Projectiles/Rogue/ScourgeoftheSeasProjectile.cs +++ b/Projectiles/Rogue/ScourgeoftheSeasProjectile.cs @@ -66,7 +66,7 @@ namespace CalamityMod.Projectiles.Rogue Main.PlaySound(SoundID.Item14, projectile.position); for (int dustIndex = 0; dustIndex < 8; dustIndex++) { - int dusty = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 85, 0f, 0f, 100, default, 1f); + int dusty = Dust.NewDust(projectile.position, projectile.width, projectile.height, 85, 0f, 0f, 100, default, 1f); Main.dust[dusty].velocity *= 1f; } if (projectile.owner == Main.myPlayer) @@ -74,9 +74,7 @@ namespace CalamityMod.Projectiles.Rogue int cloudNumber = Main.rand.Next(2, 6); for (int cloudIndex = 0; cloudIndex < cloudNumber; cloudIndex++) { - Vector2 velocity = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - velocity.Normalize(); - velocity *= (float)Main.rand.Next(10, 201) * 0.01f; + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 10f, 200f, 0.01f); Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.25), 1f, projectile.owner, 0f, projectile.Calamity().stealthStrike ? 1f : 0f); } } diff --git a/Projectiles/Rogue/SeafoamBombProj.cs b/Projectiles/Rogue/SeafoamBombProj.cs index 5faa863b09..f2b34c0c49 100644 --- a/Projectiles/Rogue/SeafoamBombProj.cs +++ b/Projectiles/Rogue/SeafoamBombProj.cs @@ -47,7 +47,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.NewProjectile(posX, posY, 0f, 0f, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.4), 0f, projectile.owner, 0f, 0f); } - CalamityUtils.ExplosionGores(projectile, (projectile.Calamity().stealthStrike ? 6 : 3)); + CalamityUtils.ExplosionGores(projectile.Center, (projectile.Calamity().stealthStrike ? 6 : 3)); } } } diff --git a/Projectiles/Rogue/ShatteredSunScorchedBlade.cs b/Projectiles/Rogue/ShatteredSunScorchedBlade.cs index 6227275058..2120ecd134 100644 --- a/Projectiles/Rogue/ShatteredSunScorchedBlade.cs +++ b/Projectiles/Rogue/ShatteredSunScorchedBlade.cs @@ -62,10 +62,10 @@ namespace CalamityMod.Projectiles.Rogue int timesToSpawnDust = projectile.Calamity().stealthStrike ? 2 : 1; for (int i = 0; i < timesToSpawnDust; i++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 127, 0f, 0f, 100, default, projectile.Calamity().stealthStrike ? 1.8f : 1.3f); + int num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 127, 0f, 0f, 100, default, projectile.Calamity().stealthStrike ? 1.8f : 1.3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 127, 0f, 0f, 100, default, projectile.Calamity().stealthStrike ? 1.8f : 1.3f); + num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 127, 0f, 0f, 100, default, projectile.Calamity().stealthStrike ? 1.8f : 1.3f); Main.dust[num624].velocity *= 2f; } } @@ -191,7 +191,7 @@ namespace CalamityMod.Projectiles.Rogue 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); + int num622 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -201,14 +201,14 @@ namespace CalamityMod.Projectiles.Rogue } 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); + int num624 = Dust.NewDust(projectile.position, 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); + num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - CalamityUtils.ExplosionGores(projectile, 3); + CalamityUtils.ExplosionGores(projectile.Center, 3); } } } diff --git a/Projectiles/Rogue/SnapClamProj.cs b/Projectiles/Rogue/SnapClamProj.cs index 1a50dbc8f0..74731836aa 100644 --- a/Projectiles/Rogue/SnapClamProj.cs +++ b/Projectiles/Rogue/SnapClamProj.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.spriteDirection = projectile.direction; } //Sticky Behaviour - CalamityUtils.StickyProjAI(projectile, 15); + projectile.StickyProjAI(15); if (openClam && !onEnemy) { projectile.frame = 1; @@ -62,7 +62,7 @@ namespace CalamityMod.Projectiles.Rogue if (openClam) { onEnemy = true; - CalamityUtils.ModifyHitNPCSticky(projectile, 2, false); + projectile.ModifyHitNPCSticky(2, false); } } diff --git a/Projectiles/Rogue/SnapClamStealth.cs b/Projectiles/Rogue/SnapClamStealth.cs index c7b893f59c..7b1fc44adf 100644 --- a/Projectiles/Rogue/SnapClamStealth.cs +++ b/Projectiles/Rogue/SnapClamStealth.cs @@ -50,7 +50,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.spriteDirection = projectile.direction; } //Sticky Behaviour - CalamityUtils.StickyProjAI(projectile, 15); + projectile.StickyProjAI(15); if (openClam && !onEnemy) { projectile.frame = 1; @@ -66,7 +66,7 @@ namespace CalamityMod.Projectiles.Rogue if (openClam) { onEnemy = true; - CalamityUtils.ModifyHitNPCSticky(projectile, 5, false); + projectile.ModifyHitNPCSticky(5, false); } } diff --git a/Projectiles/Rogue/StellarKnifeProj.cs b/Projectiles/Rogue/StellarKnifeProj.cs index 23ee2f5efa..6bc326dd0d 100644 --- a/Projectiles/Rogue/StellarKnifeProj.cs +++ b/Projectiles/Rogue/StellarKnifeProj.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Projectiles.Rogue if (projectile.ai[0] == 1f) { projectile.ai[0] = 0f; - projectile.damage = (int)((double) projectile.damage * (projectile.ai[1] == 1f ? 0.9f : 0.75f)); + projectile.damage = (int)(projectile.damage * (projectile.ai[1] == 1f ? 0.9f : 0.75f)); projectile.ai[1] = 0f; } projectile.ai[1] += 0.75f; diff --git a/Projectiles/Rogue/StickyBol.cs b/Projectiles/Rogue/StickyBol.cs index 047cbe81ff..13627e9af6 100644 --- a/Projectiles/Rogue/StickyBol.cs +++ b/Projectiles/Rogue/StickyBol.cs @@ -1,4 +1,5 @@ using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -27,74 +28,30 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { - int Alpha = 175; - Color newColor = new Color(0, 80, (int) byte.MaxValue, 100); + Color color = new Color(0, 80, 255, 100); if (Main.rand.NextBool(12)) { - Vector2 vector2 = projectile.velocity * (float) Main.rand.Next(6) / 6f; - int num = 6; - Dust.NewDust(projectile.position + Vector2.One * 6f, projectile.width - num * 2, projectile.height - num * 2, 4, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, Alpha, newColor, 1.2f); + Dust.NewDust(projectile.position + Vector2.One * 6f, projectile.width - 12, projectile.height - 12, 4, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 175, color, 1.2f); } //Sticky Behaviour - CalamityUtils.StickyProjAI(projectile, 10); + projectile.StickyProjAI(10); if (projectile.ai[0] != 1f) { - try - { - int num223 = (int)(projectile.position.X / 16f) - 1; - int num224 = (int)((projectile.position.X + (float)projectile.width) / 16f) + 2; - int num225 = (int)(projectile.position.Y / 16f) - 1; - int num226 = (int)((projectile.position.Y + (float)projectile.height) / 16f) + 2; - if (num223 < 0) - { - num223 = 0; - } - if (num224 > Main.maxTilesX) - { - num224 = Main.maxTilesX; - } - if (num225 < 0) - { - num225 = 0; - } - if (num226 > Main.maxTilesY) - { - num226 = Main.maxTilesY; - } - for (int num227 = num223; num227 < num224; num227++) - { - for (int num228 = num225; num228 < num226; num228++) - { - if (Main.tile[num227, num228] != null && Main.tile[num227, num228].nactive() && (Main.tileSolid[(int)Main.tile[num227, num228].type] || (Main.tileSolidTop[(int)Main.tile[num227, num228].type] && Main.tile[num227, num228].frameY == 0))) - { - Vector2 vector19; - vector19.X = (float)(num227 * 16); - vector19.Y = (float)(num228 * 16); - if (projectile.position.X + (float)projectile.width - 4f > vector19.X && projectile.position.X + 4f < vector19.X + 16f && projectile.position.Y + (float)projectile.height - 4f > vector19.Y && projectile.position.Y + 4f < vector19.Y + 16f) - { - projectile.velocity.X = 0f; - projectile.velocity.Y = -0.2f; - } - } - } - } - } catch - { - } + projectile.StickToTiles(true, false); projectile.localAI[1] += 1f; if (projectile.localAI[1] > 10f) { projectile.localAI[1] = 10f; if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) { - projectile.velocity.X = projectile.velocity.X * 0.97f; - if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) + projectile.velocity.X *= 0.97f; + if (Math.Abs(projectile.velocity.X) < 0.01f) { projectile.velocity.X = 0f; projectile.netUpdate = true; } } - projectile.velocity.Y = projectile.velocity.Y + 0.2f; + projectile.velocity.Y += 0.2f; } projectile.rotation += projectile.velocity.X * 0.1f; } @@ -102,7 +59,7 @@ namespace CalamityMod.Projectiles.Rogue public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - CalamityUtils.ModifyHitNPCSticky(projectile, 5, true); + projectile.ModifyHitNPCSticky(5, true); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) diff --git a/Projectiles/Rogue/SupernovaBomb.cs b/Projectiles/Rogue/SupernovaBomb.cs index 09f49bc211..6d0552505d 100644 --- a/Projectiles/Rogue/SupernovaBomb.cs +++ b/Projectiles/Rogue/SupernovaBomb.cs @@ -1,5 +1,3 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -50,14 +48,14 @@ namespace CalamityMod.Projectiles.Rogue projectile.ai[0] = 10f; if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) { - projectile.velocity.X = projectile.velocity.X * 0.97f; - if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) + projectile.velocity.X *= 0.97f; + if (Math.Abs(projectile.velocity.X) < 0.01f) { projectile.velocity.X = 0f; projectile.netUpdate = true; } } - projectile.velocity.Y = projectile.velocity.Y + 0.2f; + projectile.velocity.Y += 0.2f; } //rotation @@ -70,7 +68,7 @@ namespace CalamityMod.Projectiles.Rogue { if (projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0f, 2f, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.8), projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0f, 2f, ModContent.ProjectileType(), (int)(projectile.damage * 0.8), projectile.knockBack, projectile.owner, 0f, 0f); } } } @@ -85,87 +83,64 @@ namespace CalamityMod.Projectiles.Rogue Main.PlaySound(SoundID.Item14, projectile.position); //spawn projectiles - int num251 = Main.rand.Next(3, 5); + int projAmt = Main.rand.Next(3, 5); if (projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - for (int num252 = 0; num252 < num251; num252++) + Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + for (int i = 0; i < projAmt; i++) { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.6), 0f, projectile.owner, 0f, 0f); + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); + Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.6), 0f, projectile.owner, 0f, 0f); } - float spread = 60f * 0.0174f; + float spread = MathHelper.Pi / 3f; double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; double deltaAngle = spread / 6f; double offsetAngle; - int i; - for (i = 0; i < 3; i++) + for (int i = 0; i < 3; i++) { offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 2f), (float)(Math.Cos(offsetAngle) * 2f), ModContent.ProjectileType(), (int)((double)projectile.damage * 0.5), projectile.knockBack, projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 2f), (float)(-Math.Cos(offsetAngle) * 2f), ModContent.ProjectileType(), (int)((double)projectile.damage * 0.5), projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 2f), (float)(Math.Cos(offsetAngle) * 2f), ModContent.ProjectileType(), (int)(projectile.damage * 0.5), projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 2f), (float)(-Math.Cos(offsetAngle) * 2f), ModContent.ProjectileType(), (int)(projectile.damage * 0.5), projectile.knockBack, projectile.owner, 0f, 0f); } } //dust effects - int num298 = Main.rand.NextBool(2) ? 107 : 234; + int dustType = Main.rand.NextBool(2) ? 107 : 234; if (Main.rand.NextBool(4)) { - num298 = 269; + dustType = 269; } - for (int num621 = 0; num621 < 5; num621++) + for (int d = 0; d < 5; d++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num298, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int exo = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, 0f, 0f, 100, default, 2f); + Main.dust[exo].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; + Main.dust[exo].scale = 0.5f; + Main.dust[exo].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 9; num623++) + for (int d = 0; d < 9; d++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 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, 6, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int fire = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Fire, 0f, 0f, 100, default, 3f); + Main.dust[fire].noGravity = true; + Main.dust[fire].velocity *= 5f; + fire = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Fire, 0f, 0f, 100, default, 2f); + Main.dust[fire].velocity *= 2f; } //gore cloud effects - CalamityUtils.ExplosionGores(projectile, 3); + CalamityUtils.ExplosionGores(projectile.Center, 3); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 30); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.Ichor, 120); + target.ExoDebuffs(); } public override void OnHitPvp(Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 30); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.Ichor, 120); + target.ExoDebuffs(); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Rogue/SupernovaBoom.cs b/Projectiles/Rogue/SupernovaBoom.cs index 6af43f0920..6cbb60b03d 100644 --- a/Projectiles/Rogue/SupernovaBoom.cs +++ b/Projectiles/Rogue/SupernovaBoom.cs @@ -3,8 +3,6 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; namespace CalamityMod.Projectiles.Rogue { public class SupernovaBoom : ModProjectile @@ -98,28 +96,12 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 30); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.Ichor, 120); + target.ExoDebuffs(); } public override void OnHitPvp(Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 30); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.Ichor, 120); + target.ExoDebuffs(); } } } diff --git a/Projectiles/Rogue/SupernovaHoming.cs b/Projectiles/Rogue/SupernovaHoming.cs index 98c15fc61a..b1631a0873 100644 --- a/Projectiles/Rogue/SupernovaHoming.cs +++ b/Projectiles/Rogue/SupernovaHoming.cs @@ -2,8 +2,6 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Rogue { @@ -107,28 +105,12 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 30); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.Ichor, 120); + target.ExoDebuffs(); } public override void OnHitPvp(Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 30); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.Ichor, 120); + target.ExoDebuffs(); } } } diff --git a/Projectiles/Rogue/SupernovaSpike.cs b/Projectiles/Rogue/SupernovaSpike.cs index 512e8781ab..e6d3859eb4 100644 --- a/Projectiles/Rogue/SupernovaSpike.cs +++ b/Projectiles/Rogue/SupernovaSpike.cs @@ -2,8 +2,6 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Rogue { @@ -63,28 +61,12 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 30); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.Ichor, 120); + target.ExoDebuffs(); } public override void OnHitPvp(Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 30); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.Ichor, 120); + target.ExoDebuffs(); } internal static void Visuals(Projectile projectile, ref Color c) diff --git a/Projectiles/Rogue/SylvanSlash.cs b/Projectiles/Rogue/SylvanSlash.cs index b4ee547382..8c5abd3973 100644 --- a/Projectiles/Rogue/SylvanSlash.cs +++ b/Projectiles/Rogue/SylvanSlash.cs @@ -19,7 +19,6 @@ namespace CalamityMod.Projectiles.Rogue { projectile.width = 30; projectile.height = 30; - aiType = ProjectileID.FrostWave; projectile.friendly = true; projectile.ignoreWater = true; projectile.Calamity().rogue = true; diff --git a/Projectiles/Rogue/TheSyringeProj.cs b/Projectiles/Rogue/TheSyringeProj.cs index 8564f3c43b..1694cd1276 100644 --- a/Projectiles/Rogue/TheSyringeProj.cs +++ b/Projectiles/Rogue/TheSyringeProj.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.Calamity().rogue = true; projectile.ignoreWater = true; projectile.aiStyle = 1; - aiType = 242; + aiType = ProjectileID.BulletHighVelocity; projectile.penetrate = 1; projectile.timeLeft = 600; } @@ -70,21 +70,15 @@ namespace CalamityMod.Projectiles.Rogue { Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 89, projectile.oldVelocity.X, projectile.oldVelocity.Y); } - int num251 = Main.rand.Next(1, 3); + int fireAmt = Main.rand.Next(1, 3); if (projectile.owner == Main.myPlayer) { - for (int num252 = 0; num252 < num251; num252++) + for (int f = 0; f < fireAmt; f++) { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, ModContent.ProjectileType(), (int)(projectile.damage * 0.5), 0f, Main.myPlayer, 0f, 0f); + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); + Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.5), 0f, Main.myPlayer, 0f, 0f); } - for (int index = 0; index < 2; ++index) + for (int s = 0; s < 2; ++s) { float SpeedX = -projectile.velocity.X * Main.rand.Next(40, 70) * 0.01f + Main.rand.Next(-20, 21) * 0.4f; float SpeedY = -projectile.velocity.Y * Main.rand.Next(40, 70) * 0.01f + Main.rand.Next(-20, 21) * 0.4f; @@ -93,12 +87,12 @@ namespace CalamityMod.Projectiles.Rogue } if (projectile.owner == Main.myPlayer && projectile.ai[1] == 1) { - for (int num639 = 0; num639 < 5; num639++) + for (int b = 0; b < 5; b++) { float speedX = (float)Main.rand.Next(-35, 36) * 0.02f; float speedY = (float)Main.rand.Next(-35, 36) * 0.02f; - int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, speedX, speedY, ModContent.ProjectileType(), (int)(projectile.damage * 0.5), 0f, Main.myPlayer, 0f, 0f); - Main.projectile[proj].penetrate = 1; + int bee = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, speedX, speedY, ModContent.ProjectileType(), (int)(projectile.damage * 0.5), 0f, Main.myPlayer, 0f, 0f); + Main.projectile[bee].penetrate = 1; } } } diff --git a/Projectiles/Rogue/TotalityFire.cs b/Projectiles/Rogue/TotalityFire.cs index 22e8b7f468..627421cb0f 100644 --- a/Projectiles/Rogue/TotalityFire.cs +++ b/Projectiles/Rogue/TotalityFire.cs @@ -1,4 +1,5 @@ using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using System; using Terraria; using Terraria.ID; @@ -8,10 +9,14 @@ namespace CalamityMod.Projectiles.Rogue { public class TotalityFire : ModProjectile { + private bool initialized = false; + public override void SetStaticDefaults() { DisplayName.SetDefault("Fire"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[projectile.type] = 3; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; } public override void SetDefaults() @@ -24,31 +29,34 @@ namespace CalamityMod.Projectiles.Rogue projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = -1; projectile.Calamity().rogue = true; - projectile.alpha = 100; } public override void AI() { //make it face the way it's going - if (projectile.ai[1] == 1f) + if (projectile.ai[1] > 0f) { - projectile.rotation += projectile.velocity.X * 0.1f; - projectile.rotation = -projectile.velocity.X * 0.05f; + projectile.rotation = -projectile.velocity.X * 0.05f + MathHelper.PiOver2; } else { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + ((3 * MathHelper.Pi) / 2); - projectile.spriteDirection = ((projectile.velocity.X > 0f) ? -1 : 1); + projectile.rotation = projectile.velocity.ToRotation(); } + projectile.ai[1]--; //frames + if (!initialized) + { + initialized = true; + projectile.frame = Main.rand.Next(Main.projFrames[projectile.type]); + } projectile.frameCounter++; if (projectile.frameCounter > 6) { projectile.frame++; projectile.frameCounter = 0; } - if (projectile.frame > 3) + if (projectile.frame >= Main.projFrames[projectile.type]) { projectile.frame = 0; } @@ -56,15 +64,15 @@ namespace CalamityMod.Projectiles.Rogue //movement if (projectile.velocity.X != projectile.velocity.X) { - projectile.velocity.X = projectile.velocity.X * -0.1f; + projectile.velocity.X *= -0.1f; } if (projectile.velocity.X != projectile.velocity.X) { - projectile.velocity.X = projectile.velocity.X * -0.5f; + projectile.velocity.X *= -0.5f; } if (projectile.velocity.Y != projectile.velocity.Y && projectile.velocity.Y > 1f) { - projectile.velocity.Y = projectile.velocity.Y * -0.5f; + projectile.velocity.Y *= -0.5f; } projectile.ai[0] += 1f; if (projectile.ai[0] > 5f) @@ -72,21 +80,29 @@ namespace CalamityMod.Projectiles.Rogue projectile.ai[0] = 5f; if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) { - projectile.velocity.X = projectile.velocity.X * 0.97f; - if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) + projectile.velocity.X *= 0.97f; + if (projectile.velocity.X > -0.01f && projectile.velocity.X < 0.01f) { projectile.velocity.X = 0f; projectile.netUpdate = true; } } - projectile.velocity.Y = projectile.velocity.Y + 0.2f; + projectile.velocity.Y += 0.2f; + } + if (projectile.velocity.Y < 0.25f && projectile.velocity.Y > 0.15f) + { + projectile.velocity.X *= 0.8f; + } + if (projectile.velocity.Y > 16f) + { + projectile.velocity.Y = 16f; } //dust if (Main.rand.NextBool(4)) { - int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 6, 0f, 0f, 100, default, 1f); - Dust dust = Main.dust[num199]; + int fire = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Fire, 0f, 0f, 100, default, 1f); + Dust dust = Main.dust[fire]; dust.position.X -= 2f; dust.position.Y += 2f; dust.scale += (float)Main.rand.Next(50) * 0.01f; @@ -95,31 +111,19 @@ namespace CalamityMod.Projectiles.Rogue } if (Main.rand.NextBool(10)) { - int num200 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 6, 0f, 0f, 100, default, 1f); - Dust dust = Main.dust[num200]; + int fire = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Fire, 0f, 0f, 100, default, 1f); + Dust dust = Main.dust[fire]; dust.position.X -= 2f; dust.position.Y += 2f; dust.scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; dust.noGravity = true; dust.velocity *= 0.1f; } - if ((double)projectile.velocity.Y < 0.25 && (double)projectile.velocity.Y > 0.15) - { - projectile.velocity.X = projectile.velocity.X * 0.8f; - } - if (projectile.velocity.Y > 16f) - { - projectile.velocity.Y = 16f; - } } public override bool OnTileCollide(Vector2 oldVelocity) { - projectile.ai[1] = 1f; - if (projectile.penetrate == 0) - { - projectile.Kill(); - } + projectile.ai[1] = 10f; return false; } @@ -132,5 +136,11 @@ namespace CalamityMod.Projectiles.Rogue { target.AddBuff(BuffID.OnFire, 120); } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } } } diff --git a/Projectiles/Rogue/TotalityFire.png b/Projectiles/Rogue/TotalityFire.png index 2313a2e798..2d6cfab7f2 100644 Binary files a/Projectiles/Rogue/TotalityFire.png and b/Projectiles/Rogue/TotalityFire.png differ diff --git a/Projectiles/Rogue/TotalityFlask.cs b/Projectiles/Rogue/TotalityFlask.cs index 6336f8aac1..c78562fb18 100644 --- a/Projectiles/Rogue/TotalityFlask.cs +++ b/Projectiles/Rogue/TotalityFlask.cs @@ -25,13 +25,13 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { - if (projectile.Calamity().stealthStrike == true) + if (projectile.Calamity().stealthStrike) { if (projectile.timeLeft % 10 == 0) { if (projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0f, projectile.velocity.Y * 0f, ModContent.ProjectileType(), (int)(projectile.damage * 0.6), projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(projectile.damage * 0.6), projectile.knockBack, projectile.owner, 0f, 0f); } } } @@ -62,35 +62,29 @@ namespace CalamityMod.Projectiles.Rogue Main.projectile[meltdown].Center = projectile.Center; //makes it centered because it's not without this Vector2 vector2 = new Vector2(20f, 20f); - for (int index = 0; index < 5; ++index) + for (int d = 0; d < 5; ++d) Dust.NewDust(projectile.Center - vector2 / 2f, (int) vector2.X, (int) vector2.Y, 191, 0.0f, 0.0f, 0, Color.Red, 1f); - for (int index1 = 0; index1 < 10; ++index1) + for (int d = 0; d < 10; ++d) { int index2 = Dust.NewDust(projectile.Center - vector2 / 2f, (int) vector2.X, (int) vector2.Y, 31, 0.0f, 0.0f, 100, new Color(), 1.5f); Dust dust = Main.dust[index2]; dust.velocity *= 1.4f; } - for (int index1 = 0; index1 < 20; ++index1) + for (int d = 0; d < 20; ++d) { - int index2 = Dust.NewDust(projectile.Center - vector2 / 2f, (int) vector2.X, (int) vector2.Y, 6, 0.0f, 0.0f, 100, new Color(), 2.5f); + int index2 = Dust.NewDust(projectile.Center - vector2 / 2f, (int) vector2.X, (int) vector2.Y, DustID.Fire, 0.0f, 0.0f, 100, new Color(), 2.5f); Dust dust1 = Main.dust[index2]; dust1.noGravity = true; dust1.velocity *= 5f; - int index3 = Dust.NewDust(projectile.Center - vector2 / 2f, (int) vector2.X, (int) vector2.Y, 6, 0.0f, 0.0f, 100, new Color(), 1.5f); + int index3 = Dust.NewDust(projectile.Center - vector2 / 2f, (int) vector2.X, (int) vector2.Y, DustID.Fire, 0.0f, 0.0f, 100, new Color(), 1.5f); Dust dust2 = Main.dust[index3]; dust2.velocity *= 3f; } - int num251 = Main.rand.Next(2, 4); - for (int num252 = 0; num252 < num251; num252++) + int tarAmt = Main.rand.Next(2, 4); + for (int t = 0; t < tarAmt; t++) { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, ModContent.ProjectileType(), (int)(projectile.damage * 0.3), 0f, Main.myPlayer, 0f, 0f); + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); + Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.3), 0f, Main.myPlayer, 0f, 0f); } } } diff --git a/Projectiles/Rogue/TotalityTar.cs b/Projectiles/Rogue/TotalityTar.cs index 6ea14ec9df..6e6d7fa30d 100644 --- a/Projectiles/Rogue/TotalityTar.cs +++ b/Projectiles/Rogue/TotalityTar.cs @@ -1,4 +1,5 @@ using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -28,15 +29,15 @@ namespace CalamityMod.Projectiles.Rogue { if (projectile.velocity.X != projectile.velocity.X) { - projectile.velocity.X = projectile.velocity.X * -0.1f; + projectile.velocity.X *= -0.1f; } if (projectile.velocity.X != projectile.velocity.X) { - projectile.velocity.X = projectile.velocity.X * -0.5f; + projectile.velocity.X *= -0.5f; } if (projectile.velocity.Y != projectile.velocity.Y && projectile.velocity.Y > 1f) { - projectile.velocity.Y = projectile.velocity.Y * -0.5f; + projectile.velocity.Y *= -0.5f; } projectile.ai[0] += 1f; if (projectile.ai[0] > 5f) @@ -44,19 +45,19 @@ namespace CalamityMod.Projectiles.Rogue projectile.ai[0] = 5f; if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) { - projectile.velocity.X = projectile.velocity.X * 0.97f; - if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) + projectile.velocity.X *= 0.97f; + if (Math.Abs(projectile.velocity.X) < 0.01f) { projectile.velocity.X = 0f; projectile.netUpdate = true; } } - projectile.velocity.Y = projectile.velocity.Y + 0.2f; + projectile.velocity.Y += 0.2f; } projectile.rotation += projectile.velocity.X * 0.1f; - if ((double)projectile.velocity.Y < 0.25 && (double)projectile.velocity.Y > 0.15) + if (projectile.velocity.Y < 0.25f && projectile.velocity.Y > 0.15f) { - projectile.velocity.X = projectile.velocity.X * 0.8f; + projectile.velocity.X *= 0.8f; } projectile.rotation = -projectile.velocity.X * 0.05f; if (projectile.velocity.Y > 16f) @@ -90,31 +91,25 @@ namespace CalamityMod.Projectiles.Rogue { int index2 = Dust.NewDust(projectile.Center - vector2 / 2f, (int) vector2.X, (int) vector2.Y, 31, 0.0f, 0.0f, 100, new Color(), 1.5f); Dust dust = Main.dust[index2]; - dust.velocity = dust.velocity * 1.4f; + dust.velocity *= 1.4f; } for (int index1 = 0; index1 < 10; ++index1) { - int index2 = Dust.NewDust(projectile.Center - vector2 / 2f, (int) vector2.X, (int) vector2.Y, 6, 0.0f, 0.0f, 100, new Color(), 2.5f); - Main.dust[index2].noGravity = true; + int index2 = Dust.NewDust(projectile.Center - vector2 / 2f, (int) vector2.X, (int) vector2.Y, DustID.Fire, 0.0f, 0.0f, 100, new Color(), 2.5f); Dust dust1 = Main.dust[index2]; - dust1.velocity = dust1.velocity * 5f; - int index3 = Dust.NewDust(projectile.Center - vector2 / 2f, (int) vector2.X, (int) vector2.Y, 6, 0.0f, 0.0f, 100, new Color(), 1.5f); + dust1.noGravity = true; + dust1.velocity *= 5f; + int index3 = Dust.NewDust(projectile.Center - vector2 / 2f, (int) vector2.X, (int) vector2.Y, DustID.Fire, 0.0f, 0.0f, 100, new Color(), 1.5f); Dust dust2 = Main.dust[index3]; - dust2.velocity = dust2.velocity * 3f; + dust2.velocity *= 3f; } - int num251 = Main.rand.Next(2, 4); + int fireAmt = Main.rand.Next(2, 4); if (projectile.owner == Main.myPlayer) { - for (int num252 = 0; num252 < num251; num252++) + for (int f = 0; f < fireAmt; f++) { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - int fire = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, ModContent.ProjectileType(), projectile.damage, 1f, Main.myPlayer, 0f, 0f); + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); + Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), projectile.damage, 1f, Main.myPlayer, 0f, 0f); } } } diff --git a/Projectiles/Rogue/ToxicantTwisterTwoPointZero.cs b/Projectiles/Rogue/ToxicantTwisterTwoPointZero.cs index e49e7434ed..b7535085c7 100644 --- a/Projectiles/Rogue/ToxicantTwisterTwoPointZero.cs +++ b/Projectiles/Rogue/ToxicantTwisterTwoPointZero.cs @@ -11,6 +11,7 @@ namespace CalamityMod.Projectiles.Rogue public class ToxicantTwisterTwoPointZero : ModProjectile { private int lifeTime = 300; + private int targetIndex = -1; public override void SetStaticDefaults() { @@ -23,10 +24,9 @@ namespace CalamityMod.Projectiles.Rogue projectile.height = 46; projectile.friendly = true; projectile.tileCollide = false; - projectile.penetrate = 5; + projectile.penetrate = -1; projectile.timeLeft = lifeTime; projectile.Calamity().rogue = true; - projectile.extraUpdates = 1; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 12; } @@ -35,7 +35,7 @@ namespace CalamityMod.Projectiles.Rogue { if (projectile.Calamity().stealthStrike) { - if (projectile.timeLeft % 50f == 0f) + if (projectile.timeLeft % 20 == 0) { for (int i = 0; i < 2; i++) { @@ -57,10 +57,7 @@ namespace CalamityMod.Projectiles.Rogue Main.PlaySound(SoundID.Item7, projectile.position); } - // Returns after 2.5 seconds in the air - if (projectile.timeLeft < lifeTime - 150) - projectile.ai[0] = 1f; - + projectile.ai[1]++; if (projectile.ai[0] != 0f) { float returnSpeed = 30f; @@ -109,16 +106,41 @@ namespace CalamityMod.Projectiles.Rogue if (projectile.Hitbox.Intersects(owner.Hitbox)) projectile.Kill(); } + else if (projectile.ai[1] > 40f) + { + NPC closestTarget = projectile.Center.ClosestNPCAt(1769f, true, true); + if (closestTarget != null) + { + projectile.extraUpdates = 1; + targetIndex = closestTarget.whoAmI; + float inertia = 20f; + float homingVelocity = projectile.Calamity().stealthStrike ? 30f : 20f; + Vector2 homeInVector = projectile.DirectionTo(closestTarget.Center); + if (homeInVector.HasNaNs()) + homeInVector = Vector2.UnitY; + + projectile.velocity = (projectile.velocity * inertia + homeInVector * homingVelocity) / (inertia + 1f); + } + } else { - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 600f, 20f, 20f); + projectile.velocity *= 0.985f; } } + public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + if (projectile.ai[1] <= 40f && projectile.ai[0] != 1f) + { + damage /= 3; + } + } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (projectile.penetrate < 3) + if (targetIndex == target.whoAmI) projectile.ai[0] = 1f; + target.AddBuff(ModContent.BuffType(), 180); Main.PlaySound(SoundID.Item20, projectile.position); for (int k = 0; k < 10; k++) @@ -131,8 +153,7 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitPvp(Player target, int damage, bool crit) { - if (projectile.penetrate < 3) - projectile.ai[0] = 1f; + projectile.ai[0] = 1f; target.AddBuff(ModContent.BuffType(), 180); Main.PlaySound(SoundID.Item20, projectile.position); for (int k = 0; k < 10; k++) diff --git a/Projectiles/Rogue/TurbulanceProjectile.cs b/Projectiles/Rogue/TurbulanceProjectile.cs index 91a3065856..a4bf1741d7 100644 --- a/Projectiles/Rogue/TurbulanceProjectile.cs +++ b/Projectiles/Rogue/TurbulanceProjectile.cs @@ -9,8 +9,6 @@ namespace CalamityMod.Projectiles.Rogue { public class TurbulanceProjectile : ModProjectile { - public int stealthStrikeTimer = 0; - public override void SetStaticDefaults() { DisplayName.SetDefault("Turbulance"); @@ -20,10 +18,8 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; + projectile.width = projectile.height = 20; projectile.friendly = true; - projectile.penetrate = 1; projectile.timeLeft = 600; projectile.extraUpdates = 2; projectile.ignoreWater = true; @@ -33,37 +29,29 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { - if (projectile.ai[0] < 0.2f) - { - projectile.ai[0] += 0.1f; - } - else - { - projectile.tileCollide = true; - } + projectile.ai[0]++; + projectile.tileCollide = projectile.ai[0] < 2f; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(135f); if (projectile.spriteDirection == -1) { - projectile.rotation -= 1.57f; + projectile.rotation -= MathHelper.PiOver2; } - if (Main.rand.Next(5) == 0) + if (Main.rand.NextBool(5)) { Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 187, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 100, new Color(53, Main.DiscoG, 255)); } - if (Main.rand.Next(5) == 0) + if (Main.rand.NextBool(5)) { Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 16, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); } if (projectile.Calamity().stealthStrike) //Stealth strike { - stealthStrikeTimer++; - if (stealthStrikeTimer >= 14) + if (projectile.timeLeft % 14 == 0) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack / 2, projectile.owner, 1f, 1f); - stealthStrikeTimer = 0; + Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, projectile.knockBack / 2, projectile.owner, 1f, 1f); } } } @@ -78,57 +66,30 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (projectile.owner == Main.myPlayer) - { - for (int num252 = 0; num252 < 4; num252++) - { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, ModContent.ProjectileType(), projectile.damage / 3, projectile.knockBack / 3, Main.myPlayer, 0f, (crit ? 1f /*homing*/: 0f/*not homing*/)); - } - } + OnHitEffects(crit); } public override void OnHitPvp(Player target, int damage, bool crit) { - if (projectile.owner == Main.myPlayer) - { - for (int num252 = 0; num252 < 4; num252++) - { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, ModContent.ProjectileType(), projectile.damage / 3, projectile.knockBack / 3, Main.myPlayer, 0f, (crit ? 1f /*homing*/: 0f/*not homing*/)); - } - } + OnHitEffects(crit); } public override bool OnTileCollide(Vector2 oldVelocity) { + OnHitEffects(false); + return true; + } + + private void OnHitEffects(bool homeIn) + { if (projectile.owner == Main.myPlayer) { - for (int num252 = 0; num252 < 4; num252++) - { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, ModContent.ProjectileType(), projectile.damage / 3, projectile.knockBack / 3, Main.myPlayer, 0f, 0f); - } + for (int w = 0; w < 4; w++) + { + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); + Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), projectile.damage / 3, projectile.knockBack / 3, Main.myPlayer, 0f, (homeIn ? 1f : 0f)); + } } - return true; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Rogue/UmbraphileBoom.cs b/Projectiles/Rogue/UmbraphileBoom.cs index d06797acad..eb6d987646 100644 --- a/Projectiles/Rogue/UmbraphileBoom.cs +++ b/Projectiles/Rogue/UmbraphileBoom.cs @@ -6,97 +6,101 @@ using Terraria.ModLoader; using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Rogue { - public class UmbraphileBoom : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Explosion"); - } + public class UmbraphileBoom : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosion"); + } - public override void SetDefaults() - { - projectile.width = 60; - projectile.height = 60; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 5; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = -1; + public override void SetDefaults() + { + projectile.width = 60; + projectile.height = 60; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.timeLeft = 5; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = -1; projectile.Calamity().rogue = true; - } + } - public override void Kill(int timeLeft) - { - int dustType = Main.rand.NextBool(2) ? 246 : 176; - bool flag15 = false; - bool flag16 = false; - if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) - { - flag16 = true; - } - if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) - { - flag16 = true; - } - if (flag15 && flag16) - { - projectile.Kill(); - } - float num461 = 25f; - if (projectile.ai[0] > 180f) - { - num461 -= (projectile.ai[0] - 180f) / 2f; - } - if (num461 <= 0f) - { - num461 = 0f; - projectile.Kill(); - } - num461 *= 0.7f; - projectile.ai[0] += 4f; - int num462 = 0; - while ((float)num462 < num461) - { - float num463 = (float)Main.rand.Next(-10, 11); - float num464 = (float)Main.rand.Next(-10, 11); - float num465 = (float)Main.rand.Next(3, 9); - float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); - num466 = num465 / num466; - num463 *= num466; - num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 100, default, 1f); - Dust dust = Main.dust[num467]; - dust.noGravity = true; - dust.position.X = projectile.Center.X; - dust.position.Y = projectile.Center.Y; - dust.position.X += (float)Main.rand.Next(-10, 11); - dust.position.Y += (float)Main.rand.Next(-10, 11); - dust.velocity.X = num463; - dust.velocity.Y = num464; - num462++; - } - return; - } + public override void Kill(int timeLeft) + { + int dustType = Main.rand.NextBool(2) ? 246 : 176; + bool flag15 = false; + bool flag16 = false; + if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) + { + flag15 = true; + } + if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) + { + flag15 = true; + } + if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) + { + flag16 = true; + } + if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) + { + flag16 = true; + } + if (flag15 && flag16) + { + projectile.Kill(); + } + float num461 = 25f; + if (projectile.ai[0] > 180f) + { + num461 -= (projectile.ai[0] - 180f) / 2f; + } + if (num461 <= 0f) + { + num461 = 0f; + projectile.Kill(); + } + num461 *= 0.7f; + projectile.ai[0] += 4f; + int num462 = 0; + while ((float)num462 < num461) + { + float num463 = (float)Main.rand.Next(-10, 11); + float num464 = (float)Main.rand.Next(-10, 11); + float num465 = (float)Main.rand.Next(3, 9); + float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); + num466 = num465 / num466; + num463 *= num466; + num464 *= num466; + int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 100, default, 1f); + Dust dust = Main.dust[num467]; + dust.noGravity = true; + dust.position.X = projectile.Center.X; + dust.position.Y = projectile.Center.Y; + dust.position.X += (float)Main.rand.Next(-10, 11); + dust.position.Y += (float)Main.rand.Next(-10, 11); + dust.velocity.X = num463; + dust.velocity.Y = num464; + num462++; + } + return; + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Daybreak, 180); - target.AddBuff(ModContent.BuffType(), 180); - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (Main.dayTime || Main.rand.NextBool(3)) //100% during day, 33.33% chance at night + target.AddBuff(BuffID.Daybreak, 60); - public override void OnHitPvp(Player target, int damage, bool crit) - { - target.AddBuff(ModContent.BuffType(), 180); - } - } + if (!Main.dayTime || Main.rand.NextBool(3)) //100% at night, 33.33% chance during day + target.AddBuff(ModContent.BuffType(), 60); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + if (!Main.dayTime || Main.rand.NextBool(3)) //100% at night, 33.33% chance during day + target.AddBuff(ModContent.BuffType(), 60); + } + } } diff --git a/Projectiles/Rogue/UrchinStingerProj.cs b/Projectiles/Rogue/UrchinStingerProj.cs index 950f535ec0..5b4c05f8b4 100644 --- a/Projectiles/Rogue/UrchinStingerProj.cs +++ b/Projectiles/Rogue/UrchinStingerProj.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Rogue { if (projectile.Calamity().stealthStrike) { - CalamityUtils.StickyProjAI(projectile, 15); + projectile.StickyProjAI(15); projectile.localAI[1]++; if (projectile.localAI[1] <= 20f && projectile.ai[0] != 1f) { @@ -63,7 +63,7 @@ namespace CalamityMod.Projectiles.Rogue if (projectile.Calamity().stealthStrike) { projdmg = projectile.damage; - CalamityUtils.ModifyHitNPCSticky(projectile,4, false); + projectile.ModifyHitNPCSticky(4, false); } } diff --git a/Projectiles/Rogue/ValariBoomerang.cs b/Projectiles/Rogue/ValariBoomerang.cs index c112d88487..4e0e029242 100644 --- a/Projectiles/Rogue/ValariBoomerang.cs +++ b/Projectiles/Rogue/ValariBoomerang.cs @@ -94,25 +94,25 @@ namespace CalamityMod.Projectiles.Rogue // Home back in on the player. if (projectile.velocity.X < xDist) { - projectile.velocity.X = projectile.velocity.X + acceleration; + projectile.velocity.X += acceleration; if (projectile.velocity.X < 0f && xDist > 0f) projectile.velocity.X += acceleration; } else if (projectile.velocity.X > xDist) { - projectile.velocity.X = projectile.velocity.X - acceleration; + projectile.velocity.X -= acceleration; if (projectile.velocity.X > 0f && xDist < 0f) projectile.velocity.X -= acceleration; } if (projectile.velocity.Y < yDist) { - projectile.velocity.Y = projectile.velocity.Y + acceleration; + projectile.velocity.Y += acceleration; if (projectile.velocity.Y < 0f && yDist > 0f) projectile.velocity.Y += acceleration; } else if (projectile.velocity.Y > yDist) { - projectile.velocity.Y = projectile.velocity.Y - acceleration; + projectile.velocity.Y -= acceleration; if (projectile.velocity.Y > 0f && yDist < 0f) projectile.velocity.Y -= acceleration; } @@ -125,27 +125,26 @@ namespace CalamityMod.Projectiles.Rogue } } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + private void OnHitEffects() { //Start homing at player if you hit an enemy projectile.ai[0] = 1; - int num251 = Main.rand.Next(2, 4); + int icicleAmt = Main.rand.Next(2, 4); if (projectile.owner == Main.myPlayer) { - for (int num252 = 0; num252 < num251; num252++) + for (int i = 0; i < icicleAmt; i++) { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - int shard = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, (Main.rand.NextBool(2) ? ModContent.ProjectileType() : ModContent.ProjectileType()), projectile.damage / 3, 0f, projectile.owner, 0f, 0f); + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); + int shard = Projectile.NewProjectile(projectile.Center, velocity, (Main.rand.NextBool(2) ? ModContent.ProjectileType() : ModContent.ProjectileType()), projectile.damage / 3, 0f, projectile.owner, 0f, 0f); } } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + OnHitEffects(); target.AddBuff(BuffID.Frostburn, 240); target.AddBuff(ModContent.BuffType(), 240); if (Main.rand.NextBool(5)) @@ -154,25 +153,7 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitPvp(Player target, int damage, bool crit) { - //Start homing at player if you hit someone - projectile.ai[0] = 1; - - int num251 = Main.rand.Next(2, 4); - if (projectile.owner == Main.myPlayer) - { - for (int num252 = 0; num252 < num251; num252++) - { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - int shard = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, (Main.rand.NextBool(2) ? ModContent.ProjectileType() : ModContent.ProjectileType()), projectile.damage / 3, 0f, projectile.owner, 0f, 0f); - } - } - + OnHitEffects(); target.AddBuff(BuffID.Frostburn, 240); target.AddBuff(ModContent.BuffType(), 240); if (Main.rand.NextBool(5)) diff --git a/Projectiles/Rogue/ValedictionBoomerang.cs b/Projectiles/Rogue/ValedictionBoomerang.cs index 1e2e86dba7..c4d6044ff8 100644 --- a/Projectiles/Rogue/ValedictionBoomerang.cs +++ b/Projectiles/Rogue/ValedictionBoomerang.cs @@ -9,191 +9,172 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { - public class ValedictionBoomerang : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Scythe"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public class ValedictionBoomerang : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Valediction"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 70; - projectile.height = 70; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.extraUpdates = 3; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 15; - projectile.Calamity().rogue = true; - } + public override void SetDefaults() + { + projectile.width = projectile.height = 70; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.extraUpdates = 3; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 15; + projectile.Calamity().rogue = true; + } - public override void AI() - { + public override void AI() + { Player player = Main.player[projectile.owner]; - if (projectile.soundDelay == 0) - { - projectile.soundDelay = 8; - Main.PlaySound(SoundID.Item7, projectile.position); - } - if (projectile.ai[0] == 0f) - { - projectile.ai[1] += 1f; - if (projectile.ai[1] >= 60f) - { - projectile.ai[0] = 1f; - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - else - { + if (projectile.soundDelay == 0) + { + projectile.soundDelay = 8; + Main.PlaySound(SoundID.Item7, projectile.position); + } + if (projectile.ai[0] == 0f) + { + projectile.ai[1] += 1f; + if (projectile.ai[1] >= 60f) + { + projectile.ai[0] = 1f; + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + else + { CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 400f, 20f, 20f); - } - } - else - { - float returnSpeed = 30f; - float num43 = 5f; - Vector2 projPos = 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) - projPos.X; - float yDist = player.position.Y + (float)(player.height / 2) - projPos.Y; - float playerDist = (float)Math.Sqrt((double)(xDist * xDist + yDist * yDist)); - if (playerDist > 3000f) - { - projectile.Kill(); - } - playerDist = returnSpeed / playerDist; - xDist *= playerDist; - yDist *= playerDist; - if (projectile.velocity.X < xDist) - { - projectile.velocity.X = projectile.velocity.X + num43; - if (projectile.velocity.X < 0f && xDist > 0f) - { - projectile.velocity.X = projectile.velocity.X + num43; - } - } - else if (projectile.velocity.X > xDist) - { - projectile.velocity.X = projectile.velocity.X - num43; - if (projectile.velocity.X > 0f && xDist < 0f) - { - projectile.velocity.X = projectile.velocity.X - num43; - } - } - if (projectile.velocity.Y < yDist) - { - projectile.velocity.Y = projectile.velocity.Y + num43; - if (projectile.velocity.Y < 0f && yDist > 0f) - { - projectile.velocity.Y = projectile.velocity.Y + num43; - } - } - else if (projectile.velocity.Y > yDist) - { - projectile.velocity.Y = projectile.velocity.Y - num43; - if (projectile.velocity.Y > 0f && yDist < 0f) - { - projectile.velocity.Y = projectile.velocity.Y - num43; - } - } - if (Main.myPlayer == projectile.owner) - { - Rectangle projHitbox = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); - Rectangle playerHitbox = new Rectangle((int)player.position.X, (int)player.position.Y, player.width, player.height); - if (projHitbox.Intersects(playerHitbox)) - { - projectile.Kill(); - } - } - } - projectile.rotation += 0.5f; - } + } + } + else + { + float returnSpeed = 30f; + float acceleration = 5f; + Vector2 projVector = player.Center - projectile.Center; + float playerDist = projVector.Length(); + if (playerDist > 3000f) + { + projectile.Kill(); + } + playerDist = returnSpeed / playerDist; + projVector.X *= playerDist; + projVector.Y *= playerDist; + if (projectile.velocity.X < projVector.X) + { + projectile.velocity.X += acceleration; + if (projectile.velocity.X < 0f && projVector.X > 0f) + { + projectile.velocity.X += acceleration; + } + } + else if (projectile.velocity.X > projVector.X) + { + projectile.velocity.X -= acceleration; + if (projectile.velocity.X > 0f && projVector.X < 0f) + { + projectile.velocity.X -= acceleration; + } + } + if (projectile.velocity.Y < projVector.Y) + { + projectile.velocity.Y += acceleration; + if (projectile.velocity.Y < 0f && projVector.Y > 0f) + { + projectile.velocity.Y += acceleration; + } + } + else if (projectile.velocity.Y > projVector.Y) + { + projectile.velocity.Y -= acceleration; + if (projectile.velocity.Y > 0f && projVector.Y < 0f) + { + projectile.velocity.Y -= acceleration; + } + } + if (Main.myPlayer == projectile.owner) + { + Rectangle projHitbox = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); + Rectangle playerHitbox = new Rectangle((int)player.position.X, (int)player.position.Y, player.width, player.height); + if (projHitbox.Intersects(playerHitbox)) + { + projectile.Kill(); + } + } + } + projectile.rotation += 0.5f; + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } + 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(), 600); + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 600); + OnHitEffects(); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 600); + OnHitEffects(); + } + + private void OnHitEffects() + { int typhoonAmt = 3; if (projectile.owner == Main.myPlayer && projectile.Calamity().stealthStrike) { - Main.PlaySound(SoundID.Item84, projectile.position); - for (int typhoonCount = 0; typhoonCount < typhoonAmt; typhoonCount++) + Main.PlaySound(SoundID.Item84, projectile.position); + for (int typhoonCount = 0; typhoonCount < typhoonAmt; typhoonCount++) { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) + Vector2 velocity = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + while (velocity.X == 0f && velocity.Y == 0f) { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + velocity = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - int typhoon = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, ModContent.ProjectileType(), projectile.damage / 2, 0f, projectile.owner, 0f, 0f); - Main.projectile[typhoon].Calamity().forceRogue = true; - Main.projectile[typhoon].usesLocalNPCImmunity = true; - Main.projectile[typhoon].localNPCHitCooldown = 10; + velocity.Normalize(); + velocity *= (float)Main.rand.Next(70, 101) * 0.1f; + Projectile typhoon = Projectile.NewProjectileDirect(projectile.Center, velocity, ModContent.ProjectileType(), projectile.damage / 2, 0f, projectile.owner); + typhoon.Calamity().forceRogue = true; + typhoon.usesLocalNPCImmunity = true; + typhoon.localNPCHitCooldown = 10; } } - } + } - public override void OnHitPvp(Player target, int damage, bool crit) - { - target.AddBuff(ModContent.BuffType(), 600); - int typhoonAmt = 3; - if (projectile.owner == Main.myPlayer && projectile.Calamity().stealthStrike) + public override void Kill(int timeLeft) + { + Main.PlaySound(SoundID.Item21, projectile.position); + projectile.position = projectile.Center; + projectile.width = projectile.height = 100; + projectile.Center = projectile.position; + for (int d = 0; d < 5; d++) { - Main.PlaySound(SoundID.Item84, projectile.position); - for (int typhoonCount = 0; typhoonCount < typhoonAmt; typhoonCount++) + int water = Dust.NewDust(projectile.position, projectile.width, projectile.height, 33, 0f, 0f, 100, default, 2f); + Main.dust[water].velocity *= 3f; + if (Main.rand.NextBool(2)) { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - int typhoon = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, ModContent.ProjectileType(), projectile.damage / 3, 0f, projectile.owner, 0f, 1f); - Main.projectile[typhoon].Calamity().forceRogue = true; - Main.projectile[typhoon].usesLocalNPCImmunity = true; - Main.projectile[typhoon].localNPCHitCooldown = 10; + Main.dust[water].scale = 0.5f; + Main.dust[water].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(SoundID.Item21, projectile.position); - projectile.position.X = projectile.position.X + (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); - projectile.width = 100; - projectile.height = 100; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num621 = 0; num621 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 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 < 8; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 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, 33, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } - } + for (int d = 0; d < 8; d++) + { + int water = Dust.NewDust(projectile.position, projectile.width, projectile.height, 33, 0f, 0f, 100, default, 3f); + Main.dust[water].noGravity = true; + Main.dust[water].velocity *= 5f; + water = Dust.NewDust(projectile.position, projectile.width, projectile.height, 33, 0f, 0f, 100, default, 2f); + Main.dust[water].velocity *= 2f; + } + } + } } diff --git a/Projectiles/Rogue/WulfrumKnifeProj.png b/Projectiles/Rogue/WulfrumKnifeProj.png index aab1bf448c..94ca6dcea6 100644 Binary files a/Projectiles/Rogue/WulfrumKnifeProj.png and b/Projectiles/Rogue/WulfrumKnifeProj.png differ diff --git a/Projectiles/Rogue/XerocPitchforkProjectile.png b/Projectiles/Rogue/XerocPitchforkProjectile.png deleted file mode 100644 index 5ff0fa6cf6..0000000000 Binary files a/Projectiles/Rogue/XerocPitchforkProjectile.png and /dev/null differ diff --git a/Projectiles/Summon/ApexShark.cs b/Projectiles/Summon/ApexShark.cs index 3a062aa18b..d42ac52fac 100644 --- a/Projectiles/Summon/ApexShark.cs +++ b/Projectiles/Summon/ApexShark.cs @@ -133,7 +133,7 @@ namespace CalamityMod.Projectiles.Summon } } } - else + if (!flag25) { for (int num645 = 0; num645 < Main.maxNPCs; num645++) { diff --git a/Projectiles/Summon/AstrageldonSummon.cs b/Projectiles/Summon/AstrageldonSummon.cs index f399ab6542..eeb30a3c4f 100644 --- a/Projectiles/Summon/AstrageldonSummon.cs +++ b/Projectiles/Summon/AstrageldonSummon.cs @@ -41,7 +41,7 @@ namespace CalamityMod.Projectiles.Summon projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 10; projectile.aiStyle = 26; - aiType = 266; + aiType = ProjectileID.BabySlime; } public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough) diff --git a/Projectiles/Summon/AstralProbeRound.cs b/Projectiles/Summon/AstralProbeRound.cs index 85e23d5049..09f08b9890 100644 --- a/Projectiles/Summon/AstralProbeRound.cs +++ b/Projectiles/Summon/AstralProbeRound.cs @@ -35,22 +35,18 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { Lighting.AddLight(projectile.Center, 0.3f, 0.5f, 0.1f); - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; if (Main.rand.NextBool(3)) { - int randomDust = Main.rand.Next(2); - if (randomDust == 0) - { - randomDust = ModContent.DustType(); - } - else - { - randomDust = ModContent.DustType(); - } - int num137 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 1, 1, randomDust, 0f, 0f, 0, default, 0.5f); - Main.dust[num137].alpha = projectile.alpha; - Main.dust[num137].velocity *= 0f; - Main.dust[num137].noGravity = true; + int randomDust = Utils.SelectRandom(Main.rand, new int[] + { + ModContent.DustType(), + ModContent.DustType() + }); + int astral = Dust.NewDust(projectile.position, 1, 1, randomDust, 0f, 0f, 0, default, 0.5f); + Main.dust[astral].alpha = projectile.alpha; + Main.dust[astral].velocity *= 0f; + Main.dust[astral].noGravity = true; } float num472 = projectile.Center.X; float num473 = projectile.Center.Y; @@ -61,9 +57,9 @@ namespace CalamityMod.Projectiles.Summon NPC npc = Main.npc[Main.player[projectile.owner].MinionAttackTargetNPC]; if (npc.CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, npc.Center, 1, 1)) { - float num476 = npc.position.X + (float)(npc.width / 2); - float num477 = npc.position.Y + (float)(npc.height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + float num476 = npc.Center.X; + float num477 = npc.Center.Y; + float num478 = Math.Abs(projectile.Center.X - num476) + Math.Abs(projectile.Center.Y - num477); if (num478 < num474) { num474 = num478; @@ -73,7 +69,24 @@ namespace CalamityMod.Projectiles.Summon } } } - else + else if (projectile.ai[0] != -1f && Main.npc[(int)projectile.ai[0]].active) + { + NPC npc = Main.npc[(int)projectile.ai[0]]; + if (npc.CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, npc.Center, 1, 1)) + { + float num476 = npc.Center.X; + float num477 = npc.Center.Y; + float num478 = Math.Abs(projectile.Center.X - num476) + Math.Abs(projectile.Center.Y - num477); + if (num478 < num474) + { + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + if (!flag17) { for (int target = 0; target < Main.npc.Length; target++) { diff --git a/Projectiles/Summon/AstralProbeSummon.cs b/Projectiles/Summon/AstralProbeSummon.cs index 7277e5b73d..1dc3e65293 100644 --- a/Projectiles/Summon/AstralProbeSummon.cs +++ b/Projectiles/Summon/AstralProbeSummon.cs @@ -11,6 +11,7 @@ namespace CalamityMod.Projectiles.Summon public class AstralProbeSummon : ModProjectile { private double rotation = 0; + private double rotationVariation = 0; public override void SetStaticDefaults() { @@ -41,28 +42,30 @@ namespace CalamityMod.Projectiles.Summon { projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) + + rotationVariation = Main.rand.NextDouble() * 0.015; + + int dustAmt = 36; + for (int dustIndex = 0; dustIndex < dustAmt; dustIndex++) { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, (Main.rand.NextBool(2) ? ModContent.DustType() : ModContent.DustType()), vector7.X * 1.75f, vector7.Y * 1.75f, 100, default, 1.1f); - Main.dust[num228].noGravity = true; - Main.dust[num228].velocity = vector7; + Vector2 dustSource = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; + dustSource = dustSource.RotatedBy((double)((float)(dustIndex - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + projectile.Center; + Vector2 dustVel = dustSource - projectile.Center; + int astral = Dust.NewDust(dustSource + dustVel, 0, 0, (Main.rand.NextBool(2) ? ModContent.DustType() : ModContent.DustType()), dustVel.X * 1.75f, dustVel.Y * 1.75f, 100, default, 1.1f); + Main.dust[astral].noGravity = true; + Main.dust[astral].velocity = dustVel; } projectile.localAI[0] += 1f; } if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) { int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); + projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); projectile.damage = damage2; } - bool flag64 = projectile.type == ModContent.ProjectileType(); + bool correctMinion = projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); - if (flag64) + if (correctMinion) { if (player.dead) { @@ -73,87 +76,60 @@ namespace CalamityMod.Projectiles.Summon projectile.timeLeft = 2; } } - float num633 = 1000f; - float num634 = 1300f; - float num635 = 2600f; - float num636 = 700f; - Vector2 vector46 = projectile.position; - bool flag25 = false; + float range = 1000f; + Vector2 targetVec = projectile.position; + bool foundTarget = false; + int targetIndex = -1; if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; if (npc.CanBeChasedBy(projectile, false)) { - float num646 = Vector2.Distance(npc.Center, projectile.Center); - if (!flag25 && num646 < num633) + float npcDist = Vector2.Distance(npc.Center, projectile.Center); + if (!foundTarget && npcDist < range) { - vector46 = npc.Center; - flag25 = true; + targetVec = npc.Center; + foundTarget = true; + targetIndex = npc.whoAmI; } } } - else + if (!foundTarget) { - for (int num645 = 0; num645 < Main.npc.Length; num645++) + for (int num645 = 0; num645 < Main.maxNPCs; num645++) { - NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false)) + NPC npc = Main.npc[num645]; + if (npc.CanBeChasedBy(projectile, false)) { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); - if (!flag25 && num646 < num633) + float npcDist = Vector2.Distance(npc.Center, projectile.Center); + if (!foundTarget && npcDist < range) { - num633 = num646; - vector46 = nPC2.Center; - flag25 = true; + targetVec = npc.Center; + foundTarget = true; + targetIndex = num645; } } } } Vector2 vector = player.Center - projectile.Center; - projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); - if (flag25) + if (foundTarget) { - projectile.rotation = projectile.rotation.AngleLerp((vector46 - projectile.Center).ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.ToRadians(180) * projectile.direction), 0.1f); - projectile.spriteDirection *= -1; + projectile.spriteDirection = projectile.direction = ((targetVec.X - projectile.Center.X) > 0).ToDirectionInt(); + projectile.rotation = projectile.rotation.AngleTowards(projectile.AngleTo(targetVec) + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi), 0.1f); } else { - projectile.rotation = projectile.rotation.AngleLerp(vector.ToRotation() - (projectile.spriteDirection == 1 ? 0f : MathHelper.ToRadians(180) * projectile.direction), 0.1f); + projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); + projectile.rotation = projectile.rotation.AngleLerp(vector.ToRotation() - (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi * projectile.direction), 0.1f); } projectile.Center = player.Center + new Vector2(80, 0).RotatedBy(rotation); - rotation += 0.03; + rotation += 0.03 + rotationVariation; if (rotation >= 360) { rotation = 0; } projectile.velocity.X = (vector.X > 0f) ? -0.000001f : 0f; - 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) - { - bool flag26 = false; - if (!flag26) - { - flag26 = projectile.ai[0] == 1f; - } - Vector2 center2 = projectile.Center; - Vector2 vector48 = player.Center - center2 + new Vector2(0f, -120f); - float num651 = vector48.Length(); - if (num651 < num636 && flag26) - { - projectile.ai[0] = 0f; - projectile.netUpdate = true; - } - } if (projectile.ai[1] > 0f) { projectile.ai[1] += (float)Main.rand.Next(1, 3); @@ -163,29 +139,23 @@ namespace CalamityMod.Projectiles.Summon projectile.ai[1] = 0f; projectile.netUpdate = true; } - if (projectile.ai[0] == 0f) - { - float scaleFactor3 = 6f; - int num658 = ModContent.ProjectileType(); - if (flag25 && projectile.ai[1] == 0f && vector46 != projectile.position) - { - Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 12, 0.5f, 0f); - projectile.ai[1] += 1f; - if (Main.myPlayer == projectile.owner) - { - Vector2 value19 = vector46 - projectile.Center; - value19.Normalize(); - value19 *= scaleFactor3; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value19.X, value19.Y, num658, projectile.damage, 0f, Main.myPlayer, 0f, 0f); - projectile.netUpdate = true; - } - } - } + float speedMult = 6f; + int projType = ModContent.ProjectileType(); + if (foundTarget && projectile.ai[1] == 0f && targetVec != projectile.position) + { + Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 12, 0.5f, 0f); + projectile.ai[1] += 1f; + if (Main.myPlayer == projectile.owner) + { + Vector2 velocity = targetVec - projectile.Center; + velocity.Normalize(); + velocity *= speedMult; + Projectile.NewProjectile(projectile.Center, velocity, projType, projectile.damage, 0f, projectile.owner, targetIndex, 0f); + projectile.netUpdate = true; + } + } } - public override bool CanDamage() - { - return false; - } + public override bool CanDamage() => false; } } diff --git a/Projectiles/Summon/AstralProbeSummon.png b/Projectiles/Summon/AstralProbeSummon.png index e08f7efc9e..ccb3aa427d 100644 Binary files a/Projectiles/Summon/AstralProbeSummon.png and b/Projectiles/Summon/AstralProbeSummon.png differ diff --git a/Projectiles/Summon/AureusBomber.cs b/Projectiles/Summon/AureusBomber.cs index a4be169099..1347dfcbc3 100644 --- a/Projectiles/Summon/AureusBomber.cs +++ b/Projectiles/Summon/AureusBomber.cs @@ -82,7 +82,7 @@ namespace CalamityMod.Projectiles.Summon float idleDistance = vectorToIdlePosition.Length(); //dust effects - if (Main.rand.Next(10) == 0) + if (Main.rand.NextBool(10)) { int index = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0.0f, 0.0f, 100, Color.Transparent, 2f); Main.dust[index].velocity *= 0.3f; diff --git a/Projectiles/Summon/BabyPlaguebringer.cs b/Projectiles/Summon/BabyPlaguebringer.cs index 8355493836..24154ac42b 100644 --- a/Projectiles/Summon/BabyPlaguebringer.cs +++ b/Projectiles/Summon/BabyPlaguebringer.cs @@ -101,7 +101,7 @@ namespace CalamityMod.Projectiles.Summon } } } - else + if (!flag25) { for (int num645 = 0; num645 < Main.maxNPCs; num645++) { diff --git a/Projectiles/Summon/BlackHawkBullet.cs b/Projectiles/Summon/BlackHawkBullet.cs index 74930940bf..71969f4126 100644 --- a/Projectiles/Summon/BlackHawkBullet.cs +++ b/Projectiles/Summon/BlackHawkBullet.cs @@ -28,6 +28,7 @@ namespace CalamityMod.Projectiles.Summon aiType = ProjectileID.BulletHighVelocity; projectile.penetrate = 1; projectile.timeLeft = 600; + projectile.tileCollide = false; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) @@ -35,5 +36,7 @@ namespace CalamityMod.Projectiles.Summon CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); return false; } + + public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, 200); } } diff --git a/Projectiles/Summon/BlackHawkSummon.cs b/Projectiles/Summon/BlackHawkSummon.cs index c0974c50fd..b507f288dd 100644 --- a/Projectiles/Summon/BlackHawkSummon.cs +++ b/Projectiles/Summon/BlackHawkSummon.cs @@ -122,7 +122,7 @@ namespace CalamityMod.Projectiles.Summon } } } - else + if (!foundTarget) { for (int npcIndex = 0; npcIndex < Main.maxNPCs; npcIndex++) { @@ -241,7 +241,7 @@ namespace CalamityMod.Projectiles.Summon projectile.ai[1] += Main.rand.Next(1, 4); } //Set the minion to be ready for attack - if (projectile.ai[1] > 90f) + if (projectile.ai[1] > 130f) { projectile.ai[1] = 0f; projectile.netUpdate = true; diff --git a/Projectiles/Summon/BloodClotMinion.cs b/Projectiles/Summon/BloodClotMinion.cs index 982d7bd55b..122ab949fa 100644 --- a/Projectiles/Summon/BloodClotMinion.cs +++ b/Projectiles/Summon/BloodClotMinion.cs @@ -121,7 +121,7 @@ namespace CalamityMod.Projectiles.Summon } } } - else + if (!flag19) { for (int num542 = 0; num542 < Main.maxNPCs; num542++) { diff --git a/Projectiles/Summon/BrimstoneElementalMinion.cs b/Projectiles/Summon/BrimstoneElementalMinion.cs index a80580b3e7..5b45e67e2d 100644 --- a/Projectiles/Summon/BrimstoneElementalMinion.cs +++ b/Projectiles/Summon/BrimstoneElementalMinion.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - DisplayName.SetDefault("Big Busty Rose"); + DisplayName.SetDefault("Brimstone Elemental"); Main.projFrames[projectile.type] = 4; ProjectileID.Sets.MinionSacrificable[projectile.type] = true; ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; @@ -96,7 +96,7 @@ namespace CalamityMod.Projectiles.Summon float num = (float)Main.rand.Next(90, 111) * 0.01f; num *= Main.essScale; Lighting.AddLight(projectile.Center, 1.25f * num, 0f * num, 0.5f * num); - if ((double)Math.Abs(projectile.velocity.X) > 0.2) + if (Math.Abs(projectile.velocity.X) > 0.2f) { projectile.spriteDirection = -projectile.direction; } @@ -126,7 +126,7 @@ namespace CalamityMod.Projectiles.Summon } } } - else + if (!flag25) { for (int num645 = 0; num645 < Main.maxNPCs; num645++) { @@ -197,11 +197,16 @@ namespace CalamityMod.Projectiles.Summon projectile.ai[1] = 0f; projectile.netUpdate = true; } + + // Prevent firing immediately + if (projectile.localAI[0] < 120f) + projectile.localAI[0] += 1f; + if (projectile.ai[0] == 0f) { float scaleFactor3 = 14f; int num658 = ModContent.ProjectileType(); - if (flag25 && projectile.ai[1] == 0f) + if (flag25 && projectile.ai[1] == 0f && projectile.localAI[0] >= 120f) { projectile.ai[1] += 1f; if (Main.myPlayer == projectile.owner && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, vector46, 0, 0)) diff --git a/Projectiles/Summon/CalamariInk.cs b/Projectiles/Summon/CalamariInk.cs index c0c366f779..5ee1bbd833 100644 --- a/Projectiles/Summon/CalamariInk.cs +++ b/Projectiles/Summon/CalamariInk.cs @@ -60,12 +60,26 @@ namespace CalamityMod.Projectiles.Summon } } } - else + else if (Main.npc[(int)projectile.ai[0]].active && projectile.ai[0] != -1f) + { + NPC npc = Main.npc[(int)projectile.ai[0]]; + if (npc.CanBeChasedBy(projectile, false)) + { + float dist = (projectile.Center - npc.Center).Length(); + if (dist < maxHomingRange) + { + targetIdx = (int)projectile.ai[0]; + maxHomingRange = dist; + hasHomingTarget = true; + } + } + } + if (!hasHomingTarget) { for (int i = 0; i < Main.npc.Length; ++i) { NPC npc = Main.npc[i]; - if (npc == null || !npc.active) + if (npc is null || !npc.active) continue; if (npc.CanBeChasedBy(projectile, false)) diff --git a/Projectiles/Summon/CalamariMinion.cs b/Projectiles/Summon/CalamariMinion.cs index e7d201fed8..1dc958cacf 100644 --- a/Projectiles/Summon/CalamariMinion.cs +++ b/Projectiles/Summon/CalamariMinion.cs @@ -141,6 +141,7 @@ namespace CalamityMod.Projectiles.Summon Vector2 center = Main.player[projectile.owner].Center; Vector2 value = new Vector2(0.5f); value.Y = 0f; + int targetIndex = -1; if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; @@ -152,11 +153,11 @@ namespace CalamityMod.Projectiles.Summon { vector = vector2; flag = true; - int num11 = npc.whoAmI; + targetIndex = npc.whoAmI; } } } - else + if (!flag) { for (int k = 0; k < Main.maxNPCs; k++) { @@ -170,6 +171,7 @@ namespace CalamityMod.Projectiles.Summon num10 = num13; vector = vector3; flag = true; + targetIndex = k; } } } @@ -321,7 +323,7 @@ namespace CalamityMod.Projectiles.Summon Vector2 vector7 = vector - projectile.Center; vector7.Normalize(); vector7 *= scaleFactor4; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y + 20, vector7.X, vector7.Y, num28, projectile.damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y + 20, vector7.X, vector7.Y, num28, projectile.damage, 0f, Main.myPlayer, targetIndex, 0f); projectile.netUpdate = true; } } diff --git a/Projectiles/Summon/Calamitamini.cs b/Projectiles/Summon/Calamitamini.cs index 7ac5313243..cf84bd6ab6 100644 --- a/Projectiles/Summon/Calamitamini.cs +++ b/Projectiles/Summon/Calamitamini.cs @@ -11,6 +11,11 @@ namespace CalamityMod.Projectiles.Summon { public class Calamitamini : ModProjectile { + public const float Range = 1300f; + public const float SeparationAnxietyMin = 1500f; + public const float SeparationAnxietyMax = 3200f; + public const float SafeDist = 200f; + public override void SetStaticDefaults() { DisplayName.SetDefault("Calamitamini"); @@ -61,10 +66,10 @@ namespace CalamityMod.Projectiles.Summon player.MinionDamage()); projectile.damage = damage2; } - float num633 = 700f; - float num634 = 1100f; - float num635 = 2400f; - float num636 = 150f; + float num633 = Range; + float num634 = SeparationAnxietyMin; + float num635 = SeparationAnxietyMax; + float num636 = SafeDist; bool flag64 = projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (flag64) @@ -109,7 +114,7 @@ namespace CalamityMod.Projectiles.Summon } } } - else + if (!flag25) { for (int num645 = 0; num645 < Main.maxNPCs; num645++) { @@ -166,14 +171,14 @@ namespace CalamityMod.Projectiles.Summon float num650 = 6f; if (flag26) { - num650 = 15f; + num650 = 18f; } Vector2 center2 = projectile.Center; Vector2 vector48 = player.Center - center2 + new Vector2(0f, -60f); float num651 = vector48.Length(); - if (num651 > 200f && num650 < 8f) + if (num651 > 200f && num650 < 10f) { - num650 = 8f; + num650 = 10f; } if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) { diff --git a/Projectiles/Summon/Cataclymini.cs b/Projectiles/Summon/Cataclymini.cs index c3dfac0236..dd725c2304 100644 --- a/Projectiles/Summon/Cataclymini.cs +++ b/Projectiles/Summon/Cataclymini.cs @@ -61,10 +61,10 @@ namespace CalamityMod.Projectiles.Summon player.MinionDamage()); projectile.damage = damage2; } - float num633 = 700f; - float num634 = 1100f; - float num635 = 2400f; - float num636 = 150f; + float num633 = Calamitamini.Range; + float num634 = Calamitamini.SeparationAnxietyMin; + float num635 = Calamitamini.SeparationAnxietyMax; + float num636 = Calamitamini.SafeDist; bool flag64 = projectile.type == ModContent.ProjectileType(); if (flag64) { @@ -108,7 +108,7 @@ namespace CalamityMod.Projectiles.Summon } } } - else + if (!flag25) { for (int num645 = 0; num645 < Main.maxNPCs; num645++) { @@ -165,14 +165,14 @@ namespace CalamityMod.Projectiles.Summon float num650 = 6f; if (flag26) { - num650 = 15f; + num650 = 18f; } Vector2 center2 = projectile.Center; Vector2 vector48 = player.Center - center2 + new Vector2(0f, -60f); float num651 = vector48.Length(); - if (num651 > 200f && num650 < 8f) + if (num651 > 200f && num650 < 10f) { - num650 = 8f; + num650 = 10f; } if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) { @@ -181,8 +181,8 @@ namespace CalamityMod.Projectiles.Summon } if (num651 > 2000f) { - projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); + projectile.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) diff --git a/Projectiles/Summon/Catastromini.cs b/Projectiles/Summon/Catastromini.cs index 3232dff49a..c3c17ef818 100644 --- a/Projectiles/Summon/Catastromini.cs +++ b/Projectiles/Summon/Catastromini.cs @@ -86,7 +86,7 @@ namespace CalamityMod.Projectiles.Summon projectile.frame = 0; } - projectile.ChargingMinionAI(700f, 1100f, 2400f, 150f, 0, 40f, 8f, -4f, 40f, 8f, false, true); + projectile.ChargingMinionAI(Calamitamini.Range, Calamitamini.SeparationAnxietyMin, Calamitamini.SeparationAnxietyMax, Calamitamini.SafeDist, 0, 40f, 8f, -4f, 40f, 8f, false, true); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Summon/CausticStaffSummon.cs b/Projectiles/Summon/CausticStaffSummon.cs index 6b8c0ea620..5043c3727e 100644 --- a/Projectiles/Summon/CausticStaffSummon.cs +++ b/Projectiles/Summon/CausticStaffSummon.cs @@ -175,7 +175,12 @@ namespace CalamityMod.Projectiles.Summon for (int index = 0; index < projectile.whoAmI; ++index) { Projectile proj = Main.projectile[index]; - if (proj.active && proj.owner == projectile.owner && proj.type == projectile.type) + + // Short circuits to make the loop as fast as possible + if (!proj.active || proj.owner != projectile.owner || !proj.minion) + continue; + + if (proj.type == projectile.type) ++minionPosition; } playerPos.X -= 10f * player.direction; diff --git a/Projectiles/Summon/ChaosFlame.cs b/Projectiles/Summon/ChaosFlame.cs index 0fbd4ef2c0..a657dfb348 100644 --- a/Projectiles/Summon/ChaosFlame.cs +++ b/Projectiles/Summon/ChaosFlame.cs @@ -1,4 +1,5 @@ using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,7 +11,9 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Chaos Flame"); - ProjectileID.Sets.MinionShot[projectile.type] = true; + Main.projFrames[projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; } public override void SetDefaults() @@ -27,18 +30,27 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { + projectile.rotation = projectile.velocity.ToRotation(); + if (projectile.frameCounter++ % 4 == 0) + { + projectile.frame++; + } + if (projectile.frame >= Main.projFrames[projectile.type]) + { + projectile.frame = 0; + } + Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.5f / 255f, (255 - projectile.alpha) * 0.25f / 255f, (255 - projectile.alpha) * 0f / 255f); if (projectile.localAI[0] == 0f) { - Main.PlaySound(SoundID.Item20, (int)projectile.position.X, (int)projectile.position.Y); + projectile.scale = 1f - Main.rand.NextFloat() * 0.5f; projectile.localAI[0] += 1f; } - for (int num457 = 0; num457 < 5; num457++) + if (Main.rand.NextBool(4)) { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 127, 0f, 0f, 100, default, 1.2f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; + int flame = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, Main.rand.NextBool(3) ? 16 : 174, 0f, 0f); + Main.dust[flame].noGravity = true; + Main.dust[flame].velocity *= 0f; } } @@ -46,5 +58,14 @@ namespace CalamityMod.Projectiles.Summon { target.AddBuff(BuffID.OnFire, 180); } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + if (projectile.timeLeft == 300) + return false; + + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + return false; + } } } diff --git a/Projectiles/Summon/ChaosFlame.png b/Projectiles/Summon/ChaosFlame.png index 831f72cfc8..5a1fe37e31 100644 Binary files a/Projectiles/Summon/ChaosFlame.png and b/Projectiles/Summon/ChaosFlame.png differ diff --git a/Projectiles/Summon/ChaosSpirit.cs b/Projectiles/Summon/ChaosSpirit.cs index d5f5a683f7..3f611ea370 100644 --- a/Projectiles/Summon/ChaosSpirit.cs +++ b/Projectiles/Summon/ChaosSpirit.cs @@ -86,12 +86,13 @@ namespace CalamityMod.Projectiles.Summon { projectile.frame = 0; } + bool reversedGravity = player.gravDir == -1f; 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) + if (reversedGravity) { - projectile.position.Y = projectile.position.Y + 120f; - projectile.rotation = 3.14f; + projectile.position.Y += 120f; + projectile.rotation = MathHelper.Pi; } else { @@ -99,6 +100,7 @@ namespace CalamityMod.Projectiles.Summon } projectile.position.X = (float)(int)projectile.position.X; projectile.position.Y = (float)(int)projectile.position.Y; + if (projectile.owner == Main.myPlayer) { if (projectile.ai[0] != 0f) @@ -106,63 +108,80 @@ namespace CalamityMod.Projectiles.Summon projectile.ai[0] -= 1f; return; } - bool flag18 = false; - float num506 = projectile.Center.X; - float num507 = projectile.Center.Y; - float num508 = 1000f; - if (player.HasMinionAttackTargetNPC) - { - NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) - { - float num539 = npc.position.X + (float)(npc.width / 2); - float num540 = npc.position.Y + (float)(npc.height / 2); - float num541 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num539) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num540); - if (num541 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) - { - num506 = num539; - num507 = num540; - flag18 = true; - } - } - } - else - { - for (int num512 = 0; num512 < Main.maxNPCs; num512++) - { - if (Main.npc[num512].CanBeChasedBy(projectile, false)) - { - float num513 = Main.npc[num512].position.X + (float)(Main.npc[num512].width / 2); - float num514 = Main.npc[num512].position.Y + (float)(Main.npc[num512].height / 2); - float num515 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num513) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num514); - if (num515 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[num512].position, Main.npc[num512].width, Main.npc[num512].height)) - { - num508 = num515; - num506 = num513; - num507 = num514; - flag18 = true; - } - } - } - } + bool foundTarget = false; + Vector2 targetVec = projectile.Center; + Vector2 half = new Vector2(0.5f); + float range = 1000f; + int targetIndex = -1; + if (player.HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) + { + Vector2 sizeCheck = npc.position + npc.Size * half; + float npcDist = Vector2.Distance(sizeCheck, targetVec); + if (npcDist < range && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + { + range = npcDist; + targetVec = sizeCheck; + foundTarget = true; + targetIndex = npc.whoAmI; + } + } + } + if (!foundTarget) + { + for (int k = 0; k < Main.maxNPCs; k++) + { + NPC npc = Main.npc[k]; + if (npc.CanBeChasedBy(projectile, false)) + { + Vector2 sizeCheck = npc.position + npc.Size * half; + float npcDist = Vector2.Distance(sizeCheck, targetVec); + if (npcDist < range && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + { + range = npcDist; + targetVec = sizeCheck; + foundTarget = true; + targetIndex = k; + } + } + } + } float yAdjust = player.gravDir == -1f ? 0f : 10f; - if (flag18) + if (foundTarget && targetIndex != -1) { - float num516 = num506; - float num517 = num507; - num506 -= projectile.Center.X; - num507 -= projectile.Center.Y; - int projectileType = ModContent.ProjectileType(); - float num403 = Main.rand.Next(14, 19); //modify the speed the projectile are shot. Lower number = slower projectile. - Vector2 vector29 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num404 = num516 - vector29.X; - float num405 = num517 - vector29.Y; - float num406 = (float)Math.Sqrt((double)(num404 * num404 + num405 * num405)); - num406 = num403 / num406; - num404 *= num406; - num405 *= num406; - Projectile.NewProjectile(projectile.Center.X - 4f, projectile.Center.Y - yAdjust, num404, num405, projectileType, projectile.damage, 5f, projectile.owner, 0f, 0f); - projectile.ai[0] = 38f; + int projectileType = ModContent.ProjectileType(); + //If the target is above the minion, fire directly at it at double speed + if (reversedGravity ? (Main.npc[targetIndex].Bottom.Y > projectile.Top.Y) : (Main.npc[targetIndex].Bottom.Y < projectile.Top.Y)) + { + Vector2 source = new Vector2(projectile.Center.X - 4f, projectile.Center.Y - yAdjust); + float speed = Main.rand.Next(14, 19); //modify the speed the projectile are shot. Lower number = slower projectile. + Vector2 velocity = targetVec - projectile.Center; + float targetDist = velocity.Length(); + targetDist = speed / targetDist; + velocity.X *= targetDist; + velocity.Y *= targetDist; + Projectile.NewProjectile(source, velocity, projectileType, projectile.damage, 5f, projectile.owner, 0f, 0f); + Main.PlaySound(SoundID.Item20, projectile.position); + projectile.ai[0] = 10f; + } + //Otherwise, fire away like a volcano + else + { + int amount = Main.rand.Next(2, 4); //2 to 3 + for (int i = 0; i < amount; i++) + { + float velocityX = Main.rand.NextFloat(-10f, 10f); + float velocityY = Main.rand.NextFloat(-10f, -7f); + if (reversedGravity) + velocityY *= -1f; + int flame = Projectile.NewProjectile(projectile.oldPosition.X + (projectile.width / 2), projectile.oldPosition.Y + (projectile.height / 2), velocityX, velocityY, projectileType, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[flame].aiStyle = 1; + } + Main.PlaySound(SoundID.Item20, projectile.position); + projectile.ai[0] = 20f; + } } //doesn't look good @@ -176,14 +195,8 @@ namespace CalamityMod.Projectiles.Summon } } - public override Color? GetAlpha(Color lightColor) - { - return new Color(200, 200, 200, 200); - } + public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, 200); - public override bool CanDamage() - { - return false; - } + public override bool CanDamage() => false; } } diff --git a/Projectiles/Summon/CinderBlossom.cs b/Projectiles/Summon/CinderBlossom.cs index 07467a2734..26a9de3aab 100644 --- a/Projectiles/Summon/CinderBlossom.cs +++ b/Projectiles/Summon/CinderBlossom.cs @@ -47,10 +47,10 @@ namespace CalamityMod.Projectiles.Summon projectile.timeLeft = 2; } } - projectile.Center = Main.player[projectile.owner].Center + Vector2.UnitY * (Main.player[projectile.owner].gfxOffY - 60f); - if (Main.player[projectile.owner].gravDir == -1f) + projectile.Center = player.Center + Vector2.UnitY * (player.gfxOffY - 60f); + if (player.gravDir == -1f) { - projectile.position.Y += 140f; + projectile.position.Y += 120f; } projectile.position.X = (int)projectile.position.X; projectile.position.Y = (int)projectile.position.Y; diff --git a/Projectiles/Summon/CloudElementalMinion.cs b/Projectiles/Summon/CloudElementalMinion.cs index 757990b8bf..28ae075ac1 100644 --- a/Projectiles/Summon/CloudElementalMinion.cs +++ b/Projectiles/Summon/CloudElementalMinion.cs @@ -101,7 +101,7 @@ namespace CalamityMod.Projectiles.Summon projectile.frame = 0; } - projectile.ChargingMinionAI(500f, 800f, 1200f, 400f, 0, 30f, 8f, -4f, 40f, 8f, false, true); + projectile.ChargingMinionAI(500f, 800f, 1200f, 400f, 0, 30f, 8f, -4f, 40f, 8f, false, true, 1); } } } diff --git a/Projectiles/Summon/CosmicBlast.cs b/Projectiles/Summon/CosmicBlast.cs index ed589327a3..d648e78b7d 100644 --- a/Projectiles/Summon/CosmicBlast.cs +++ b/Projectiles/Summon/CosmicBlast.cs @@ -1,5 +1,3 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -32,7 +30,8 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + Player player = Main.player[projectile.owner]; + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; projectile.frameCounter++; if (projectile.frameCounter > 4) { @@ -56,11 +55,27 @@ namespace CalamityMod.Projectiles.Summon float num474 = 1200f; bool flag17 = false; int target = (int)projectile.ai[0]; - if (Main.npc[target].CanBeChasedBy(projectile, false)) + if (player.HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) + { + float num476 = npc.position.X + (float)(npc.width / 2); + float num477 = npc.position.Y + (float)(npc.height / 2); + float num478 = Math.Abs(projectile.Center.X - num476) + Math.Abs(projectile.Center.Y - num477); + if (num478 < num474) + { + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + else if (Main.npc[target].CanBeChasedBy(projectile, false)) { float num476 = Main.npc[target].position.X + (float)(Main.npc[target].width / 2); float num477 = Main.npc[target].position.Y + (float)(Main.npc[target].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + float num478 = Math.Abs(projectile.Center.X - num476) + Math.Abs(projectile.Center.Y - num477); if (num478 < num474) { num472 = num476; @@ -68,6 +83,28 @@ namespace CalamityMod.Projectiles.Summon flag17 = true; } } + if (!flag17) + { + for (int i = 0; i < Main.maxNPCs; ++i) + { + NPC npc = Main.npc[i]; + if (npc is null || !npc.active) + continue; + + if (npc.CanBeChasedBy(projectile, false)) + { + float num476 = npc.position.X + (float)(npc.width / 2); + float num477 = npc.position.Y + (float)(npc.height / 2); + float num478 = Math.Abs(projectile.Center.X - num476) + Math.Abs(projectile.Center.Y - num477); + if (num478 < num474) + { + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + } if (flag17) { float num483 = 40f; @@ -90,15 +127,12 @@ namespace CalamityMod.Projectiles.Summon public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 30); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.Ichor, 120); + target.ExoDebuffs(); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.ExoDebuffs(); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Summon/CosmicBlastBig.cs b/Projectiles/Summon/CosmicBlastBig.cs index fb140b945c..48f0203e43 100644 --- a/Projectiles/Summon/CosmicBlastBig.cs +++ b/Projectiles/Summon/CosmicBlastBig.cs @@ -1,5 +1,3 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using System; using Terraria; @@ -30,6 +28,7 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { + Player player = Main.player[projectile.owner]; if (projectile.soundDelay == 0) { projectile.soundDelay = 20 + Main.rand.Next(40); @@ -70,11 +69,27 @@ namespace CalamityMod.Projectiles.Summon float num474 = 600f; bool flag17 = false; int target = (int)projectile.ai[0]; - if (Main.npc[target].CanBeChasedBy(projectile, false)) + if (player.HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) + { + float num476 = npc.position.X + (float)(npc.width / 2); + float num477 = npc.position.Y + (float)(npc.height / 2); + float num478 = Math.Abs(projectile.Center.X - num476) + Math.Abs(projectile.Center.Y - num477); + if (num478 < num474) + { + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + else if (Main.npc[target].CanBeChasedBy(projectile, false)) { float num476 = Main.npc[target].position.X + (float)(Main.npc[target].width / 2); float num477 = Main.npc[target].position.Y + (float)(Main.npc[target].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + float num478 = Math.Abs(projectile.Center.X - num476) + Math.Abs(projectile.Center.Y - num477); if (num478 < num474) { num472 = num476; @@ -82,6 +97,28 @@ namespace CalamityMod.Projectiles.Summon flag17 = true; } } + if (!flag17) + { + for (int i = 0; i < Main.maxNPCs; ++i) + { + NPC npc = Main.npc[i]; + if (npc is null || !npc.active) + continue; + + if (npc.CanBeChasedBy(projectile, false)) + { + float num476 = npc.position.X + (float)(npc.width / 2); + float num477 = npc.position.Y + (float)(npc.height / 2); + float num478 = Math.Abs(projectile.Center.X - num476) + Math.Abs(projectile.Center.Y - num477); + if (num478 < num474) + { + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + } if (flag17) { float num483 = 45f; @@ -104,15 +141,12 @@ namespace CalamityMod.Projectiles.Summon public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 30); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.Ichor, 120); + target.ExoDebuffs(); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.ExoDebuffs(); } public override void Kill(int timeLeft) diff --git a/Projectiles/Summon/CosmicEnergySpiral.cs b/Projectiles/Summon/CosmicEnergySpiral.cs index 64fe2da558..3ee918c8bb 100644 --- a/Projectiles/Summon/CosmicEnergySpiral.cs +++ b/Projectiles/Summon/CosmicEnergySpiral.cs @@ -195,9 +195,9 @@ namespace CalamityMod.Projectiles.Summon float num397 = projectile.position.Y; float num398 = 1200f; bool flag11 = false; - for (int num399 = 0; num399 < 200; num399++) + for (int num399 = 0; num399 < Main.maxNPCs; num399++) { - if (Main.npc[num399].CanBeChasedBy(projectile, true)) + if (Main.npc[num399].CanBeChasedBy(projectile, false)) { float num400 = Main.npc[num399].position.X + (float)(Main.npc[num399].width / 2); float num401 = Main.npc[num399].position.Y + (float)(Main.npc[num399].height / 2); @@ -214,24 +214,17 @@ namespace CalamityMod.Projectiles.Summon if (flag11) { Main.PlaySound(SoundID.Item105, (int)projectile.position.X, (int)projectile.position.Y); - int num251 = Main.rand.Next(5, 8); - for (int num252 = 0; num252 < num251; num252++) + int blastAmt = Main.rand.Next(5, 8); + for (int b = 0; b < blastAmt; b++) { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.5), 2f, projectile.owner, (float)target, 0f); + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); + Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.5), 2f, projectile.owner, (float)target, 0f); } - float num403 = 15f; - Vector2 vector29 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num404 = num396 - vector29.X; - float num405 = num397 - vector29.Y; + float speed = 15f; + float num404 = num396 - projectile.Center.X; + float num405 = num397 - projectile.Center.Y; float num406 = (float)Math.Sqrt((double)(num404 * num404 + num405 * num405)); - num406 = num403 / num406; + num406 = speed / num406; num404 *= num406; num405 *= num406; Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, num404, num405, ModContent.ProjectileType(), projectile.damage, 3f, projectile.owner, (float)target, 0f); diff --git a/Projectiles/Summon/CosmicViperHomingRocket.cs b/Projectiles/Summon/CosmicViperHomingRocket.cs index 0c7f58939b..31c43114e3 100644 --- a/Projectiles/Summon/CosmicViperHomingRocket.cs +++ b/Projectiles/Summon/CosmicViperHomingRocket.cs @@ -71,7 +71,21 @@ namespace CalamityMod.Projectiles.Summon } } } - else + else if (Main.npc[(int)projectile.ai[0]].active && projectile.ai[0] != -1f) + { + NPC npc = Main.npc[(int)projectile.ai[0]]; + if (npc.CanBeChasedBy(projectile, false)) + { + float extraDistance = (float)(npc.width / 2) + (float)(npc.height / 2); + + if (Vector2.Distance(npc.Center, projectile.Center) < (maxDistance + extraDistance)) + { + center = npc.Center; + homeIn = true; + } + } + } + if (!homeIn) { for (int i = 0; i < Main.maxNPCs; i++) { diff --git a/Projectiles/Summon/CosmicViperSplittingRocket.cs b/Projectiles/Summon/CosmicViperSplittingRocket.cs index c02d45b6e2..96eb17d447 100644 --- a/Projectiles/Summon/CosmicViperSplittingRocket.cs +++ b/Projectiles/Summon/CosmicViperSplittingRocket.cs @@ -62,7 +62,7 @@ namespace CalamityMod.Projectiles.Summon } speed.Normalize(); speed *= (float)Main.rand.Next(30, 61) * 0.1f * 2f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, speed.X, speed.Y, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.25), projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, speed.X, speed.Y, ModContent.ProjectileType(), (int)(projectile.damage * 0.25), projectile.knockBack, projectile.owner, 0f, 0f); } } Main.PlaySound(SoundID.Item14, (int)projectile.position.X, (int)projectile.position.Y); @@ -76,7 +76,42 @@ namespace CalamityMod.Projectiles.Summon } } } - else + else if (Main.npc[(int)projectile.ai[0]].active && projectile.ai[0] != -1f) + { + NPC npc = Main.npc[(int)projectile.ai[0]]; + if (npc.CanBeChasedBy(projectile, false)) + { + float extraDistance = (float)(npc.width / 2) + (float)(npc.height / 2); + + if (Vector2.Distance(npc.Center, projectile.Center) < (explode + extraDistance)) + { + int numProj = 4; + if (projectile.owner == Main.myPlayer) + { + for (int i = 0; i < numProj; i++) + { + Vector2 speed = new Vector2((float)Main.rand.Next(-50, 51), (float)Main.rand.Next(-50, 51)); + while (speed.X == 0f && speed.Y == 0f) + { + speed = new Vector2((float)Main.rand.Next(-50, 51), (float)Main.rand.Next(-50, 51)); + } + speed.Normalize(); + speed *= (float)Main.rand.Next(30, 61) * 0.1f * 2f; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, speed.X, speed.Y, ModContent.ProjectileType(), (int)(projectile.damage * 0.25), projectile.knockBack, projectile.owner, 0f, 0f); + } + } + Main.PlaySound(SoundID.Item14, (int)projectile.position.X, (int)projectile.position.Y); + projectile.Kill(); + return; + } + else if (Vector2.Distance(npc.Center, projectile.Center) < (maxDistance + extraDistance)) + { + center = npc.Center; + homeIn = true; + } + } + } + if (!homeIn) { for (int npcIndex = 0; npcIndex < Main.maxNPCs; npcIndex++) { diff --git a/Projectiles/Summon/CosmicViperSummon.cs b/Projectiles/Summon/CosmicViperSummon.cs index 48d29995ab..460e7dadfc 100644 --- a/Projectiles/Summon/CosmicViperSummon.cs +++ b/Projectiles/Summon/CosmicViperSummon.cs @@ -97,6 +97,7 @@ namespace CalamityMod.Projectiles.Summon float detectRange = 700f; Vector2 targetVec = projectile.position; bool foundTarget = false; + int targetIndex = -1; if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; @@ -108,10 +109,11 @@ namespace CalamityMod.Projectiles.Summon detectRange = targetDist; targetVec = npc.Center; foundTarget = true; + targetIndex = npc.whoAmI; } } } - else + if (!foundTarget) { for (int npcIndex = 0; npcIndex < Main.maxNPCs; npcIndex++) { @@ -124,6 +126,7 @@ namespace CalamityMod.Projectiles.Summon detectRange = targetDist; targetVec = npc.Center; foundTarget = true; + targetIndex = npcIndex; } } } @@ -261,7 +264,7 @@ namespace CalamityMod.Projectiles.Summon velocity.Y += Main.rand.NextFloat(-30f, 30f) * 0.05f; velocity.X += Main.rand.NextFloat(-30f, 30f) * 0.05f; - Projectile.NewProjectile(projectile.Center, velocity, projType, (int)(projectile.damage * dmgMult), projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center, velocity, projType, (int)(projectile.damage * dmgMult), projectile.knockBack, projectile.owner, targetIndex, 0f); projectile.netUpdate = true; } } diff --git a/Projectiles/Summon/CosmilampMinion.cs b/Projectiles/Summon/CosmilampMinion.cs index 17203f10dc..acc142b16c 100644 --- a/Projectiles/Summon/CosmilampMinion.cs +++ b/Projectiles/Summon/CosmilampMinion.cs @@ -115,7 +115,7 @@ namespace CalamityMod.Projectiles.Summon } } } - else + if (!flag19) { for (int num542 = 0; num542 < Main.maxNPCs; num542++) { diff --git a/Projectiles/Summon/DaedalusCrystal.cs b/Projectiles/Summon/DaedalusCrystal.cs index fe02d3ce27..7bd5688e0c 100644 --- a/Projectiles/Summon/DaedalusCrystal.cs +++ b/Projectiles/Summon/DaedalusCrystal.cs @@ -75,19 +75,18 @@ namespace CalamityMod.Projectiles.Summon projectile.damage = damage2; } Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.35f / 255f, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0.75f / 255f); - projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2) + Main.player[projectile.owner].gfxOffY - 60f; - if (Main.player[projectile.owner].gravDir == -1f) + projectile.Center = player.Center + Vector2.UnitY * (player.gfxOffY - 60f); + if (player.gravDir == -1f) { - projectile.position.Y = projectile.position.Y + 120f; - projectile.rotation = 3.14f; + projectile.position.Y += 120f; + projectile.rotation = MathHelper.Pi; } else { projectile.rotation = 0f; } - projectile.position.X = (float)(int)projectile.position.X; - projectile.position.Y = (float)(int)projectile.position.Y; + projectile.position.X = (int)projectile.position.X; + projectile.position.Y = (int)projectile.position.Y; float num395 = (float)Main.mouseTextColor / 200f - 0.35f; num395 *= 0.2f; projectile.scale = num395 + 0.95f; @@ -118,7 +117,7 @@ namespace CalamityMod.Projectiles.Summon } } } - else + if (!flag18) { for (int num512 = 0; num512 < Main.maxNPCs; num512++) { diff --git a/Projectiles/Summon/DankCreeperMinion.cs b/Projectiles/Summon/DankCreeperMinion.cs index 0b171bea53..e90f537e7e 100644 --- a/Projectiles/Summon/DankCreeperMinion.cs +++ b/Projectiles/Summon/DankCreeperMinion.cs @@ -107,7 +107,7 @@ namespace CalamityMod.Projectiles.Summon } } } - else + if (!flag19) { for (int num542 = 0; num542 < Main.maxNPCs; num542++) { diff --git a/Projectiles/Summon/DormantBrimseekerBab.cs b/Projectiles/Summon/DormantBrimseekerBab.cs index ff9228c5b2..e9c08e0989 100644 --- a/Projectiles/Summon/DormantBrimseekerBab.cs +++ b/Projectiles/Summon/DormantBrimseekerBab.cs @@ -168,7 +168,7 @@ namespace CalamityMod.Projectiles.Summon if ((projectile.ai[0] > 0f && projectile.ai[0] <= MaxChargeTime && projectile.velocity.Length() >= 8f) || SeekingTarget) { Texture2D projectileTexture = ModContent.GetTexture(Texture); - Texture2D flameTexture = Main.extraTexture[55]; + Texture2D flameTexture = Main.extraTexture[ExtrasID.MeteorHeadFlame]; SpriteEffects spriteEffects = SpriteEffects.None; if (projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; diff --git a/Projectiles/Summon/Dreadmine.cs b/Projectiles/Summon/Dreadmine.cs index 8fc84be450..3f1566d0e4 100644 --- a/Projectiles/Summon/Dreadmine.cs +++ b/Projectiles/Summon/Dreadmine.cs @@ -140,7 +140,7 @@ namespace CalamityMod.Projectiles.Summon } } } - else + if (!flag49) { for (int num949 = 0; num949 < Main.npc.Length; num949++) { @@ -186,7 +186,7 @@ namespace CalamityMod.Projectiles.Summon Main.PlaySound(SoundID.Item14, (int)projectile.position.X, (int)projectile.position.Y); for (int num621 = 0; num621 < 20; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 31, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -196,13 +196,13 @@ namespace CalamityMod.Projectiles.Summon } for (int num623 = 0; num623 < 30; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 6, 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, 6, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 6, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - CalamityUtils.ExplosionGores(projectile, 3); + CalamityUtils.ExplosionGores(projectile.Center, 3); } } } diff --git a/Projectiles/Summon/DreadmineTurret.cs b/Projectiles/Summon/DreadmineTurret.cs index eac916c79e..efe4bb76c8 100644 --- a/Projectiles/Summon/DreadmineTurret.cs +++ b/Projectiles/Summon/DreadmineTurret.cs @@ -63,7 +63,7 @@ namespace CalamityMod.Projectiles.Summon if (Main.rand.NextBool(15)) { int num = 0; - for (int i = 0; i < Main.projectile.Length; i++) + for (int i = 0; i < Main.maxProjectiles; i++) { if (Main.projectile[i].active && Main.projectile[i].owner == Main.myPlayer && Main.projectile[i].type == ModContent.ProjectileType()) { @@ -108,7 +108,7 @@ namespace CalamityMod.Projectiles.Summon } if (flag) { - for (int k = 0; k < 1000; k++) + for (int k = 0; k < Main.maxProjectiles; k++) { if (Main.projectile[k].active && Main.projectile[k].owner == Main.myPlayer && Main.projectile[k].type == ModContent.ProjectileType() && (center - Main.projectile[k].Center).Length() < 48f) diff --git a/Projectiles/Summon/EndoCooperBody.cs b/Projectiles/Summon/EndoCooperBody.cs index 17e694bac3..9294fffd71 100644 --- a/Projectiles/Summon/EndoCooperBody.cs +++ b/Projectiles/Summon/EndoCooperBody.cs @@ -179,7 +179,7 @@ namespace CalamityMod.Projectiles.Summon } } } - else + if (!gotoenemy) { for (int num645 = 0; num645 < Main.maxNPCs; num645++) { diff --git a/Projectiles/Summon/EndoHydraBody.cs b/Projectiles/Summon/EndoHydraBody.cs index 2330afe3e8..46aebd9e56 100644 --- a/Projectiles/Summon/EndoHydraBody.cs +++ b/Projectiles/Summon/EndoHydraBody.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Projectiles.Summon { public class EndoHydraBody : ModProjectile { - public const float DistanceToCheck = 1350f; + public const float DistanceToCheck = 1600f; public override void SetStaticDefaults() { DisplayName.SetDefault("Hydra Body"); diff --git a/Projectiles/Summon/EndoHydraHead.cs b/Projectiles/Summon/EndoHydraHead.cs index 3c5837deba..38707d10be 100644 --- a/Projectiles/Summon/EndoHydraHead.cs +++ b/Projectiles/Summon/EndoHydraHead.cs @@ -90,7 +90,7 @@ namespace CalamityMod.Projectiles.Summon { Projectile.NewProjectile(projectile.Center, 6f * projectile.DirectionTo(Main.npc[(int)body.ai[0]].Center), - ModContent.ProjectileType(), projectile.damage, 2f, projectile.owner); + ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); } if (projectile.ai[1] % 40f >= 33f) diff --git a/Projectiles/Summon/EndoIceShard.cs b/Projectiles/Summon/EndoIceShard.cs index 90f8f87571..965991c921 100644 --- a/Projectiles/Summon/EndoIceShard.cs +++ b/Projectiles/Summon/EndoIceShard.cs @@ -80,7 +80,7 @@ namespace CalamityMod.Projectiles.Summon } } } - else + if (!hasHomingTarget) { for (int i = 0; i < Main.npc.Length; ++i) { diff --git a/Projectiles/Summon/EnergyOrb.cs b/Projectiles/Summon/EnergyOrb.cs index 419c224307..8f324ed043 100644 --- a/Projectiles/Summon/EnergyOrb.cs +++ b/Projectiles/Summon/EnergyOrb.cs @@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Summon } } } - else + if (!flag17) { for (int num475 = 0; num475 < Main.maxNPCs; num475++) { diff --git a/Projectiles/Summon/FlameBlast.cs b/Projectiles/Summon/FlameBlast.cs index 8f2869d03f..3339600f83 100644 --- a/Projectiles/Summon/FlameBlast.cs +++ b/Projectiles/Summon/FlameBlast.cs @@ -29,6 +29,7 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { + Player player = Main.player[projectile.owner]; if (count == 0f) { Main.PlaySound(SoundID.Item73, projectile.position); @@ -72,11 +73,27 @@ namespace CalamityMod.Projectiles.Summon float num474 = 300f; bool flag17 = false; int target = (int)projectile.ai[0]; - if (Main.npc[target].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[target].Center, 1, 1)) + if (player.HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) + { + float num476 = npc.position.X + (float)(npc.width / 2); + float num477 = npc.position.Y + (float)(npc.height / 2); + float num478 = Math.Abs(projectile.Center.X - num476) + Math.Abs(projectile.Center.Y - num477); + if (num478 < num474) + { + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + else if (Main.npc[target].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[target].Center, 1, 1)) { float num476 = Main.npc[target].position.X + (float)(Main.npc[target].width / 2); float num477 = Main.npc[target].position.Y + (float)(Main.npc[target].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + float num478 = Math.Abs(projectile.Center.X - num476) + Math.Abs(projectile.Center.Y - num477); if (num478 < num474) { num472 = num476; @@ -84,6 +101,28 @@ namespace CalamityMod.Projectiles.Summon flag17 = true; } } + if (!flag17) + { + for (int i = 0; i < Main.maxNPCs; ++i) + { + NPC npc = Main.npc[i]; + if (npc is null || !npc.active) + continue; + + if (npc.CanBeChasedBy(projectile, false)) + { + float num476 = npc.position.X + (float)(npc.width / 2); + float num477 = npc.position.Y + (float)(npc.height / 2); + float num478 = Math.Abs(projectile.Center.X - num476) + Math.Abs(projectile.Center.Y - num477); + if (num478 < num474) + { + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + } if (flag17) { float num483 = 25f; diff --git a/Projectiles/Summon/FlameBurst.cs b/Projectiles/Summon/FlameBurst.cs index e544b740bf..795bf3520a 100644 --- a/Projectiles/Summon/FlameBurst.cs +++ b/Projectiles/Summon/FlameBurst.cs @@ -29,6 +29,7 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { + Player player = Main.player[projectile.owner]; if (count == 0f) { Main.PlaySound(SoundID.Item73, projectile.position); @@ -72,11 +73,27 @@ namespace CalamityMod.Projectiles.Summon float num474 = 1200f; bool flag17 = false; int target = (int)projectile.ai[0]; - if (Main.npc[target].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[target].Center, 1, 1)) + if (player.HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) + { + float num476 = npc.position.X + (float)(npc.width / 2); + float num477 = npc.position.Y + (float)(npc.height / 2); + float num478 = Math.Abs(projectile.Center.X - num476) + Math.Abs(projectile.Center.Y - num477); + if (num478 < num474) + { + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + else if (Main.npc[target].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[target].Center, 1, 1)) { float num476 = Main.npc[target].position.X + (float)(Main.npc[target].width / 2); float num477 = Main.npc[target].position.Y + (float)(Main.npc[target].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + float num478 = Math.Abs(projectile.Center.X - num476) + Math.Abs(projectile.Center.Y - num477); if (num478 < num474) { num472 = num476; @@ -84,6 +101,28 @@ namespace CalamityMod.Projectiles.Summon flag17 = true; } } + if (!flag17) + { + for (int i = 0; i < Main.maxNPCs; ++i) + { + NPC npc = Main.npc[i]; + if (npc is null || !npc.active) + continue; + + if (npc.CanBeChasedBy(projectile, false)) + { + float num476 = npc.position.X + (float)(npc.width / 2); + float num477 = npc.position.Y + (float)(npc.height / 2); + float num478 = Math.Abs(projectile.Center.X - num476) + Math.Abs(projectile.Center.Y - num477); + if (num478 < num474) + { + num472 = num476; + num473 = num477; + flag17 = true; + } + } + } + } if (flag17) { float num483 = 20f; diff --git a/Projectiles/Summon/ForbiddenCircletEater.cs b/Projectiles/Summon/ForbiddenCircletEater.cs index dc793f422f..90ef9f9969 100644 --- a/Projectiles/Summon/ForbiddenCircletEater.cs +++ b/Projectiles/Summon/ForbiddenCircletEater.cs @@ -88,7 +88,7 @@ namespace CalamityMod.Projectiles.Summon } } } - else + if (!flag10) { for (int num376 = 0; num376 < Main.maxNPCs; num376++) { diff --git a/Projectiles/Summon/FrostBlossom.cs b/Projectiles/Summon/FrostBlossom.cs index 5b560e459e..6f0b771a20 100644 --- a/Projectiles/Summon/FrostBlossom.cs +++ b/Projectiles/Summon/FrostBlossom.cs @@ -49,10 +49,10 @@ namespace CalamityMod.Projectiles.Summon projectile.timeLeft = 2; } } - projectile.Center = Main.player[projectile.owner].Center + Vector2.UnitY * (Main.player[projectile.owner].gfxOffY - 60f); - if (Main.player[projectile.owner].gravDir == -1f) + projectile.Center = player.Center + Vector2.UnitY * (player.gfxOffY - 60f); + if (player.gravDir == -1f) { - projectile.position.Y += 140f; + projectile.position.Y += 120f; projectile.rotation = MathHelper.Pi; } else diff --git a/Projectiles/Summon/FrostMistFriendly.cs b/Projectiles/Summon/FrostMistFriendly.cs index b80a01a5a3..2742d3a92d 100644 --- a/Projectiles/Summon/FrostMistFriendly.cs +++ b/Projectiles/Summon/FrostMistFriendly.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Mist"); - Main.projFrames[projectile.type] = 6; + Main.projFrames[projectile.type] = 8; ProjectileID.Sets.MinionShot[projectile.type] = true; } @@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Summon projectile.frame++; projectile.frameCounter = 0; } - if (projectile.frame > 3) + if (projectile.frame >= Main.projFrames[projectile.type]) { projectile.frame = 0; } diff --git a/Projectiles/Summon/FrostMistFriendly.png b/Projectiles/Summon/FrostMistFriendly.png index 8349afb42d..ef17040dd0 100644 Binary files a/Projectiles/Summon/FrostMistFriendly.png and b/Projectiles/Summon/FrostMistFriendly.png differ diff --git a/Projectiles/Summon/FungalClumpMinion.cs b/Projectiles/Summon/FungalClumpMinion.cs index 56c2114325..b48421bd07 100644 --- a/Projectiles/Summon/FungalClumpMinion.cs +++ b/Projectiles/Summon/FungalClumpMinion.cs @@ -142,7 +142,7 @@ namespace CalamityMod.Projectiles.Summon } } //If no npc is specifically targetted, check through the entire array - else + if (!npcFound) { for (int npcIndex = 0; npcIndex < Main.maxNPCs; npcIndex++) { @@ -260,6 +260,8 @@ namespace CalamityMod.Projectiles.Summon { return; } + if (healAmt > 50f) + healAmt = 50f; CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], healAmt, ModContent.ProjectileType(), 1200f, 1f); } diff --git a/Projectiles/Summon/GastricBelcher.cs b/Projectiles/Summon/GastricBelcher.cs index e189e999c6..cb0bb7b127 100644 --- a/Projectiles/Summon/GastricBelcher.cs +++ b/Projectiles/Summon/GastricBelcher.cs @@ -131,7 +131,7 @@ namespace CalamityMod.Projectiles.Summon } } } - else + if (!foundTarget) { for (int npcIndex = 0; npcIndex < Main.maxNPCs; npcIndex++) { diff --git a/Projectiles/Summon/GiantIbanRobotOfDoom.cs b/Projectiles/Summon/GiantIbanRobotOfDoom.cs index 97bf416ef4..796598232d 100644 --- a/Projectiles/Summon/GiantIbanRobotOfDoom.cs +++ b/Projectiles/Summon/GiantIbanRobotOfDoom.cs @@ -68,7 +68,6 @@ namespace CalamityMod.Projectiles.Summon projectile.timeLeft *= 5; projectile.tileCollide = false; projectile.alpha = 255; - projectile.Calamity().rogue = true; projectile.usesIDStaticNPCImmunity = true; projectile.idStaticNPCHitCooldown = 11; } diff --git a/Projectiles/Summon/GigaFlareFriendly.cs b/Projectiles/Summon/GigaFlareFriendly.cs index 6b99b1aa30..3629f9c71b 100644 --- a/Projectiles/Summon/GigaFlareFriendly.cs +++ b/Projectiles/Summon/GigaFlareFriendly.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Summon float num473 = projectile.Center.Y; float num474 = 400f; bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) + for (int num475 = 0; num475 < Main.maxNPCs; num475++) { if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) { @@ -93,10 +93,9 @@ namespace CalamityMod.Projectiles.Summon double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; double deltaAngle = spread / 8f; double offsetAngle; - int i; if (projectile.owner == Main.myPlayer) { - for (i = 0; i < 2; i++) + for (int i = 0; i < 2; i++) { offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); @@ -112,7 +111,7 @@ namespace CalamityMod.Projectiles.Summon projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); for (int num621 = 0; num621 < 20; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -122,13 +121,13 @@ namespace CalamityMod.Projectiles.Summon } for (int num623 = 0; num623 < 35; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(projectile.position, 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); + num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - CalamityUtils.ExplosionGores(projectile, 3); + CalamityUtils.ExplosionGores(projectile.Center, 3); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Summon/HauntedDishes.cs b/Projectiles/Summon/HauntedDishes.cs index d02acf13f2..70ffa18b50 100644 --- a/Projectiles/Summon/HauntedDishes.cs +++ b/Projectiles/Summon/HauntedDishes.cs @@ -355,7 +355,7 @@ namespace CalamityMod.Projectiles.Summon { projectile.ai[1] = attackCooldown; double num11 = 12.0; - Vector2 vector2 = new Vector2(projectile.position.X + (float) projectile.width * 0.5f, (float) ((double) projectile.position.Y + (double) (projectile.height / 2) - 8.0)); + Vector2 vector2 = new Vector2(projectile.Center.X, projectile.Center.Y - 8f); float num12 = num5 - vector2.X + (float) Main.rand.Next(-10, 11); float num14 = (float) ((double) (Math.Abs(num12) * 0.1f) * (double) Main.rand.Next(0, 100) * (1.0 / 1000.0)); float num15 = num6 - vector2.Y + (float) Main.rand.Next(-10, 11) - num14; diff --git a/Projectiles/Summon/HermitCrabMinion.cs b/Projectiles/Summon/HermitCrabMinion.cs index 6e7e375163..58aa77bc25 100644 --- a/Projectiles/Summon/HermitCrabMinion.cs +++ b/Projectiles/Summon/HermitCrabMinion.cs @@ -124,7 +124,7 @@ namespace CalamityMod.Projectiles.Summon } } } - else + if (!chaseNPC) { for (int num645 = 0; num645 < Main.maxNPCs; num645++) { diff --git a/Projectiles/Summon/HerringMinion.cs b/Projectiles/Summon/HerringMinion.cs index 36d87f9dba..ea46870676 100644 --- a/Projectiles/Summon/HerringMinion.cs +++ b/Projectiles/Summon/HerringMinion.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Herring"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[projectile.type] = 8; ProjectileID.Sets.MinionSacrificable[projectile.type] = true; ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; } @@ -74,7 +74,7 @@ namespace CalamityMod.Projectiles.Summon projectile.frame++; projectile.frameCounter = 0; } - if (projectile.frame > 3) + if (projectile.frame >= Main.projFrames[projectile.type]) { projectile.frame = 0; } diff --git a/Projectiles/Summon/HerringMinion.png b/Projectiles/Summon/HerringMinion.png index 9d384c9345..5e8bef7fba 100644 Binary files a/Projectiles/Summon/HerringMinion.png and b/Projectiles/Summon/HerringMinion.png differ diff --git a/Projectiles/Summon/Hive.cs b/Projectiles/Summon/Hive.cs index a5ef59097b..9ff8667a41 100644 --- a/Projectiles/Summon/Hive.cs +++ b/Projectiles/Summon/Hive.cs @@ -59,6 +59,8 @@ namespace CalamityMod.Projectiles.Summon projectile.velocity.Y = 10f; } + projectile.StickToTiles(false, false); + int target = 0; float num633 = 800f; Vector2 vector46 = projectile.position; @@ -77,7 +79,7 @@ namespace CalamityMod.Projectiles.Summon } } } - else + if (!flag25) { for (int num645 = 0; num645 < Main.maxNPCs; num645++) { @@ -112,18 +114,8 @@ namespace CalamityMod.Projectiles.Summon } } - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; - } + public override bool OnTileCollide(Vector2 oldVelocity) => false; - public override bool CanDamage() - { - return false; - } + public override bool CanDamage() => false; } } diff --git a/Projectiles/Summon/Hiveling.cs b/Projectiles/Summon/Hiveling.cs index 018f06728e..fb4b693fb2 100644 --- a/Projectiles/Summon/Hiveling.cs +++ b/Projectiles/Summon/Hiveling.cs @@ -32,6 +32,7 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { + Player player = Main.player[projectile.owner]; projectile.frameCounter++; if (projectile.frameCounter > 3) { @@ -50,11 +51,28 @@ namespace CalamityMod.Projectiles.Summon float num474 = 1200f; bool homeIn = false; int target = (int)projectile.ai[0]; - if (Main.npc[target].CanBeChasedBy(projectile, false)) + + if (player.HasMinionAttackTargetNPC) { - float num476 = Main.npc[target].position.X + (float)(Main.npc[target].width / 2); - float num477 = Main.npc[target].position.Y + (float)(Main.npc[target].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) + { + float num476 = npc.Center.X; + float num477 = npc.Center.Y; + float num478 = Math.Abs(projectile.Center.X - num476) + Math.Abs(projectile.Center.Y - num477); + if (num478 < num474) + { + centerX = num476; + centerY = num477; + homeIn = true; + } + } + } + else if (Main.npc[target].CanBeChasedBy(projectile, false)) + { + float num476 = Main.npc[target].Center.X; + float num477 = Main.npc[target].Center.Y; + float num478 = Math.Abs(projectile.Center.X - num476) + Math.Abs(projectile.Center.Y - num477); if (num478 < num474) { centerX = num476; @@ -62,6 +80,28 @@ namespace CalamityMod.Projectiles.Summon homeIn = true; } } + if (!homeIn) + { + for (int i = 0; i < Main.maxNPCs; ++i) + { + NPC npc = Main.npc[i]; + if (npc is null || !npc.active) + continue; + + if (npc.CanBeChasedBy(projectile, false)) + { + float num476 = npc.Center.X; + float num477 = npc.Center.Y; + float num478 = Math.Abs(projectile.Center.X - num476) + Math.Abs(projectile.Center.Y - num477); + if (num478 < num474) + { + centerX = num476; + centerY = num477; + homeIn = true; + } + } + } + } if (homeIn) { float num483 = 10f; diff --git a/Projectiles/Summon/HowlsHeartFireball.cs b/Projectiles/Summon/HowlsHeartFireball.cs index 6c640d5fd7..8dc31d65be 100644 --- a/Projectiles/Summon/HowlsHeartFireball.cs +++ b/Projectiles/Summon/HowlsHeartFireball.cs @@ -45,6 +45,7 @@ namespace CalamityMod.Projectiles.Summon Vector2 center = projectile.Center; float maxDistance = 500f; bool homeIn = false; + int target = (int)projectile.ai[0]; if (player.HasMinionAttackTargetNPC) { @@ -64,7 +65,23 @@ namespace CalamityMod.Projectiles.Summon } } } - else + else if (Main.npc[target].CanBeChasedBy(projectile, false)) + { + NPC npc = Main.npc[target]; + + float extraDistance = (npc.width / 2) + (npc.height / 2); + + bool canHit = true; + if (extraDistance < maxDistance) + canHit = Collision.CanHit(projectile.Center, 1, 1, npc.Center, 1, 1); + + if (Vector2.Distance(npc.Center, projectile.Center) < (maxDistance + extraDistance) && canHit) + { + center = npc.Center; + homeIn = true; + } + } + if (!homeIn) { for (int i = 0; i < Main.maxNPCs; i++) { diff --git a/Projectiles/Summon/HowlsHeartHowl.cs b/Projectiles/Summon/HowlsHeartHowl.cs index caf409d2de..e1db603533 100644 --- a/Projectiles/Summon/HowlsHeartHowl.cs +++ b/Projectiles/Summon/HowlsHeartHowl.cs @@ -93,6 +93,7 @@ namespace CalamityMod.Projectiles.Summon Vector2 targetPos = projectile.position; float maxRange = 900f; bool foundEnemy = false; + int targetIndex = -1; //If the player has targetted an enemy, choose that one NPC target = projectile.OwnerMinionAttackTargetNPC; if (target != null && target.CanBeChasedBy(projectile, false)) @@ -103,6 +104,7 @@ namespace CalamityMod.Projectiles.Summon maxRange = targetDist; targetPos = target.Center; foundEnemy = true; + targetIndex = target.whoAmI; } } //else, search through all available NPCs @@ -119,6 +121,7 @@ namespace CalamityMod.Projectiles.Summon maxRange = targetDist; targetPos = npc.Center; foundEnemy = true; + targetIndex = index; } } } @@ -272,7 +275,7 @@ namespace CalamityMod.Projectiles.Summon targetVec.Normalize(); targetVec *= speedMult; Main.PlaySound(SoundID.Item20, projectile.position); - int fireball = Projectile.NewProjectile(projectile.Center, targetVec, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + int fireball = Projectile.NewProjectile(projectile.Center, targetVec, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, targetIndex, 0f); Main.projectile[fireball].netUpdate = true; Main.projectile[fireball].frame = Main.rand.Next(4); projectile.netUpdate = true; diff --git a/Projectiles/Summon/LanternFlame.cs b/Projectiles/Summon/LanternFlame.cs index 6605f77c63..4a83651bd5 100644 --- a/Projectiles/Summon/LanternFlame.cs +++ b/Projectiles/Summon/LanternFlame.cs @@ -70,7 +70,7 @@ namespace CalamityMod.Projectiles.Summon } } } - else + if (!flag17) { for (int num475 = 0; num475 < Main.npc.Length; num475++) { diff --git a/Projectiles/Summon/LuxorsGiftSummon.cs b/Projectiles/Summon/LuxorsGiftSummon.cs index 29066770e9..4345c84869 100644 --- a/Projectiles/Summon/LuxorsGiftSummon.cs +++ b/Projectiles/Summon/LuxorsGiftSummon.cs @@ -96,7 +96,7 @@ namespace CalamityMod.Projectiles.Summon projectile.ChargingMinionAI(700f, 1000f, 2200f, 150f, 0, 40f, 9f, -4f, 40f, 9f, true, true); - projectile.rotation = projectile.velocity.ToRotation() + 1.57f; + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; } public override Color? GetAlpha(Color lightColor) diff --git a/Projectiles/Summon/MagicAxe.cs b/Projectiles/Summon/MagicAxe.cs index c1c75c88fd..1b0a2be506 100644 --- a/Projectiles/Summon/MagicAxe.cs +++ b/Projectiles/Summon/MagicAxe.cs @@ -41,176 +41,22 @@ namespace CalamityMod.Projectiles.Summon 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; - projectile.MinionAntiClump(); - if (projectile.ai[1] <= 30) + counter++; + if (counter == 30) + { + projectile.netUpdate = true; + } + else if (counter < 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 = MagicHat.Range; - 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 (!homeIn && num646 < homingRange) - { - 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 (!homeIn && num646 < homingRange) - { - 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; - } - } - } + + projectile.ChargingMinionAI(MagicHat.Range, 1200f, 2500f, 400f, 1, 30f, 24f, -12f, 30f, 16f, true, true, 3); } - public override Color? GetAlpha(Color lightColor) - { - return new Color(0, 255, 111, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) => new Color(0, 255, 111, projectile.alpha); public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { diff --git a/Projectiles/Summon/MagicBat.cs b/Projectiles/Summon/MagicBat.cs index ed58a72851..651e618f1d 100644 --- a/Projectiles/Summon/MagicBat.cs +++ b/Projectiles/Summon/MagicBat.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver4; } public override Color? GetAlpha(Color lightColor) diff --git a/Projectiles/Summon/MagicBird.cs b/Projectiles/Summon/MagicBird.cs index 60d1c89402..64b185c573 100644 --- a/Projectiles/Summon/MagicBird.cs +++ b/Projectiles/Summon/MagicBird.cs @@ -35,29 +35,29 @@ namespace CalamityMod.Projectiles.Summon { projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); - projectile.frameCounter++; + + projectile.frameCounter++; if (projectile.frameCounter > 6) { projectile.frame++; - projectile.frameCounter = 0; + projectile.frameCounter = 0; } if (projectile.frame >= 7) { projectile.frame = 0; } - projectile.ai[0]++; - projectile.ai[1]++; - if (projectile.ai[0] >= 20f) + + if (projectile.ai[0]++ % 20f == 0f) { 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) + if (projectile.ai[1]++ > 30f) HomingAI(); + //Fade in if (projectile.alpha > 0) { @@ -89,12 +89,12 @@ namespace CalamityMod.Projectiles.Summon } } } - else + if (!hasHomingTarget) { for (int i = 0; i < Main.npc.Length; ++i) { NPC npc = Main.npc[i]; - if (npc == null || !npc.active) + if (npc is null || !npc.active) continue; if (npc.CanBeChasedBy(projectile, false)) @@ -130,10 +130,7 @@ namespace CalamityMod.Projectiles.Summon } } - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, 239, 0, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) => new Color(255, 239, 0, projectile.alpha); public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { diff --git a/Projectiles/Summon/MagicBullet.cs b/Projectiles/Summon/MagicBullet.cs index 5e92de59ea..f87517bbc9 100644 --- a/Projectiles/Summon/MagicBullet.cs +++ b/Projectiles/Summon/MagicBullet.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -60,5 +61,7 @@ namespace CalamityMod.Projectiles.Summon { return new Color(189, 51, 164, projectile.alpha); } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.timeLeft < 600; } } diff --git a/Projectiles/Summon/MagicHammer.cs b/Projectiles/Summon/MagicHammer.cs index afddf9d1a4..d1740b14db 100644 --- a/Projectiles/Summon/MagicHammer.cs +++ b/Projectiles/Summon/MagicHammer.cs @@ -44,15 +44,22 @@ namespace CalamityMod.Projectiles.Summon projectile.alpha = 50; } } + projectile.rotation += 0.075f; - if (counter <= 30) + + counter++; + if (counter == 30) + { + projectile.netUpdate = true; + } + else if (counter < 30) { - counter++; return; } - int num716 = -1; - Vector2 vector59 = projectile.Center; - float num717 = MagicHat.Range; + + int targetIndex = -1; + Vector2 targetVec = projectile.Center; + float maxDistance = MagicHat.Range; if (projectile.localAI[0] > 0f) { projectile.localAI[0] -= 1f; @@ -63,39 +70,35 @@ namespace CalamityMod.Projectiles.Summon 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))) + if (npc.CanBeChasedBy(projectile, false) && (projectile.ai[0] == 0f || projectile.ai[0] == player.MinionAttackTargetNPC + 1f)) { - Vector2 center4 = npc.Center; - float num719 = Vector2.Distance(center4, vector59); - if (num719 < num717) + float targetDist = Vector2.Distance(npc.Center, targetVec); + if (targetDist < maxDistance) { - num717 = num719; - vector59 = center4; - num716 = player.MinionAttackTargetNPC; + targetVec = npc.Center; + targetIndex = player.MinionAttackTargetNPC; } } } else { - for (int num718 = 0; num718 < Main.npc.Length; num718++) + for (int i = 0; i < Main.npc.Length; i++) { - NPC nPC6 = Main.npc[num718]; - if (nPC6.CanBeChasedBy(projectile, false) && (projectile.ai[0] == 0f || projectile.ai[0] == (float)(num718 + 1))) + NPC npc = Main.npc[i]; + if (npc.CanBeChasedBy(projectile, false) && (projectile.ai[0] == 0f || projectile.ai[0] == i + 1f)) { - Vector2 center4 = nPC6.Center; - float num719 = Vector2.Distance(center4, vector59); - if (num719 < num717) + float targetDist = Vector2.Distance(npc.Center, targetVec); + if (targetDist < maxDistance) { - num717 = num719; - vector59 = center4; - num716 = num718; + targetVec = npc.Center; + targetIndex = i; } } } } - if (num716 >= 0) + if (targetIndex >= 0) { - projectile.ai[0] = (float)(num716 + 1); + projectile.ai[0] = targetIndex + 1f; projectile.netUpdate = true; } } @@ -103,40 +106,39 @@ namespace CalamityMod.Projectiles.Summon { projectile.localAI[0] = 30f; } - bool flag32 = false; + bool canHome = 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) + int target = (int)(projectile.ai[0] - 1f); + NPC npc = Main.npc[target]; + if (npc.CanBeChasedBy(projectile, false) && npc.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 < MagicHat.Range * 1.25f) + float targetDist = Vector2.Distance(npc.Center, targetVec); + if (targetDist < maxDistance * 1.25f) { - flag32 = true; - vector59 = Main.npc[num720].Center; + canHome = true; + targetVec = npc.Center; } } else { projectile.ai[0] = 0f; - flag32 = false; + canHome = false; projectile.netUpdate = true; } } - if (flag32) + if (canHome) { - Vector2 v = vector59 - projectile.Center; - float num724 = projectile.velocity.ToRotation(); - float num725 = v.ToRotation(); - float num726 = num725 - num724; - num726 = MathHelper.WrapAngle(num726); - projectile.velocity = projectile.velocity.RotatedBy(num726 * 0.25, default); + Vector2 velocity = targetVec - projectile.Center; + float trajectory = projectile.velocity.ToRotation(); + float target = velocity.ToRotation(); + float rotateAmt = target - trajectory; + rotateAmt = MathHelper.WrapAngle(rotateAmt); + projectile.velocity = projectile.velocity.RotatedBy(rotateAmt * 0.25, default); } - float num727 = projectile.velocity.Length(); + float speed = projectile.velocity.Length(); projectile.velocity.Normalize(); - projectile.velocity *= num727 + 0.0025f; + projectile.velocity *= speed + 0.0025f; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) @@ -145,10 +147,7 @@ namespace CalamityMod.Projectiles.Summon return false; } - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, 56, 0, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) => new Color(255, 56, 0, projectile.alpha); public override void Kill(int timeLeft) { diff --git a/Projectiles/Summon/MagicHat.cs b/Projectiles/Summon/MagicHat.cs index a94b6fe174..d9f6ba8ee1 100644 --- a/Projectiles/Summon/MagicHat.cs +++ b/Projectiles/Summon/MagicHat.cs @@ -57,24 +57,23 @@ namespace CalamityMod.Projectiles.Summon } //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; + projectile.Center = player.Center + Vector2.UnitY * (player.gfxOffY - 60f); if (player.gravDir == -1f) { - projectile.position.Y = projectile.position.Y + 150f; + projectile.position.Y += 120f; projectile.rotation = MathHelper.Pi; } else { projectile.rotation = 0f; } - projectile.position.X = (float)(int)projectile.position.X; - projectile.position.Y = (float)(int)projectile.position.Y; + projectile.position.X = (int)projectile.position.X; + projectile.position.Y = (int)projectile.position.Y; //Change the summons scale size a little bit to make it pulse in and out - float num395 = (float)Main.mouseTextColor / 200f - 0.35f; - num395 *= 0.2f; - projectile.scale = num395 + 0.95f; + float scalar = (float)Main.mouseTextColor / 200f - 0.35f; + scalar *= 0.2f; + projectile.scale = scalar + 0.95f; //on summon dust and flexible damage if (projectile.localAI[0] == 0f) @@ -97,54 +96,30 @@ namespace CalamityMod.Projectiles.Summon projectile.damage = damage2; } - //finding an enemy, then shooting projectiles at it + //finding an enemy, then shooting projectiles if it's detected if (projectile.owner == Main.myPlayer) { - float projPosX = projectile.position.X; - float projPosY = projectile.position.Y; float detectionRange = Range; 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; - } - } - } - } + + for (int i = 0; i < Main.maxNPCs; i++) + { + NPC npc = Main.npc[i]; + if (npc.CanBeChasedBy(projectile, false)) + { + float extraDistance = (npc.width / 2) + (npc.height / 2); + + if (Vector2.Distance(npc.Center, projectile.Center) < (detectionRange + extraDistance)) + { + enemyDetected = true; + break; + } + } + } if (enemyDetected) { projectile.ai[1] += 1f; - if ((projectile.ai[1] % 5f) == 0f) + if (projectile.ai[1] % 5f == 0f) { int amount = Main.rand.Next(1, 2); for (int i = 0; i < amount; i++) @@ -159,7 +134,7 @@ namespace CalamityMod.Projectiles.Summon }); 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); + Projectile.NewProjectile(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), velocityX, velocityY, projType, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); } } } diff --git a/Projectiles/Summon/MagicRifle.cs b/Projectiles/Summon/MagicRifle.cs index e59667cb4c..8f20a75ca5 100644 --- a/Projectiles/Summon/MagicRifle.cs +++ b/Projectiles/Summon/MagicRifle.cs @@ -9,7 +9,6 @@ namespace CalamityMod.Projectiles.Summon public class MagicRifle : ModProjectile { private int counter = 0; - private bool canHome = false; public override void SetStaticDefaults() { DisplayName.SetDefault("Rifle"); @@ -39,11 +38,16 @@ namespace CalamityMod.Projectiles.Summon projectile.MinionAntiClump(); //Try not to do anything at first - if (counter <= 30) + counter++; + if (counter == 30) { - counter++; - canHome = true; + projectile.netUpdate = true; } + else if (counter < 30) + { + return; + } + float homingRange = MagicHat.Range; Vector2 targetVec = projectile.position; Vector2 half = new Vector2(0.5f); @@ -52,7 +56,7 @@ namespace CalamityMod.Projectiles.Summon if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false) && canHome) + if (npc.CanBeChasedBy(projectile, false)) { //Adding a check on the NPC's size allows it to target big things like Providence Vector2 sizeCheck = npc.position + npc.Size * half; @@ -66,12 +70,12 @@ namespace CalamityMod.Projectiles.Summon } } } - else + if (!foundTarget) { for (int npcIndex = 0; npcIndex < Main.maxNPCs; npcIndex++) { NPC npc = Main.npc[npcIndex]; - if (npc.CanBeChasedBy(projectile, false) && canHome) + if (npc.CanBeChasedBy(projectile, false)) { Vector2 sizeCheck = npc.position + npc.Size * half; float targetDist = Vector2.Distance(npc.Center, projectile.Center); diff --git a/Projectiles/Summon/MagicUmbrella.cs b/Projectiles/Summon/MagicUmbrella.cs index 6ee1a99dbe..71cbd42f06 100644 --- a/Projectiles/Summon/MagicUmbrella.cs +++ b/Projectiles/Summon/MagicUmbrella.cs @@ -10,7 +10,6 @@ namespace CalamityMod.Projectiles.Summon public class MagicUmbrella : ModProjectile { private int counter = 0; - private bool canHome = false; public override void SetStaticDefaults() { DisplayName.SetDefault("Umbrella"); @@ -38,182 +37,22 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - Player player = Main.player[projectile.owner]; projectile.rotation += 0.075f; projectile.alpha -= 50; - float num633 = MagicHat.Range; - float num634 = 1600f; - float num635 = 2200f; - float num636 = 150f; - projectile.MinionAntiClump(); - if (counter <= 30) + counter++; + if (counter == 30) { - counter++; - canHome = true; + projectile.netUpdate = true; } - else + else if (counter < 30) { - canHome = true; + return; } - 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 (!flag25 && num646 < num633) - { - 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 (!flag25 && num646 < num633) - { - 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; - } - } - } + + projectile.ChargingMinionAI(MagicHat.Range, 1600f, 2200f, 150f, 0, 40f, 9f, -4f, 40f, 9f, true, true); } - public override Color? GetAlpha(Color lightColor) - { - return new Color(75, 255, 255, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) => new Color(75, 255, 255, projectile.alpha); public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { @@ -235,21 +74,7 @@ namespace CalamityMod.Projectiles.Summon { if (Main.rand.NextBool(4)) { - 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)(projectile.damage * Main.rand.NextFloat(0.3f, 0.6f)), projectile.knockBack * Main.rand.NextFloat(0.7f, 1f), projectile.owner, 0f, 0f); - } + SpawnBaseballBats(target.Center); } } @@ -257,22 +82,26 @@ namespace CalamityMod.Projectiles.Summon { if (Main.rand.NextBool(4)) { - 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)(projectile.damage * Main.rand.NextFloat(0.3f, 0.6f)), projectile.knockBack * Main.rand.NextFloat(0.7f, 1f), projectile.owner, 0f, 0f); - } + SpawnBaseballBats(target.Center); } } + + private void SpawnBaseballBats(Vector2 targetPos) + { + for (int n = 0; n < Main.rand.Next(1, 3); n++) //1 to 2 baseball bats + { + float x = targetPos.X + Main.rand.Next(-400, 401); + float y = targetPos.Y - Main.rand.Next(500, 801); + Vector2 source = new Vector2(x, y); + Vector2 velocity = targetPos - source; + velocity.X += Main.rand.Next(-100, 101); + float speed = 29f; + float targetDist = velocity.Length(); + targetDist = speed / targetDist; + velocity.X *= targetDist; + velocity.Y *= targetDist; + Projectile.NewProjectile(source, velocity, ModContent.ProjectileType(), (int)(projectile.damage * Main.rand.NextFloat(0.3f, 0.6f)), projectile.knockBack * Main.rand.NextFloat(0.7f, 1f), projectile.owner, 0f, 0f); + } + } } } diff --git a/Projectiles/Summon/MechwormBody.cs b/Projectiles/Summon/MechwormBody.cs index d2f81ece1d..e79811ec5c 100644 --- a/Projectiles/Summon/MechwormBody.cs +++ b/Projectiles/Summon/MechwormBody.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Projectiles.Summon projectile.timeLeft *= 5; projectile.minion = true; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 4; + projectile.localNPCHitCooldown = 5; } public override void AI() diff --git a/Projectiles/Summon/MechwormBody2.cs b/Projectiles/Summon/MechwormBody2.cs index 7b80be9216..db459d37b3 100644 --- a/Projectiles/Summon/MechwormBody2.cs +++ b/Projectiles/Summon/MechwormBody2.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Projectiles.Summon projectile.timeLeft *= 5; projectile.minion = true; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 4; + projectile.localNPCHitCooldown = 5; } public override void AI() diff --git a/Projectiles/Summon/MechwormHead.cs b/Projectiles/Summon/MechwormHead.cs index b3c30b126c..ea44caeb92 100644 --- a/Projectiles/Summon/MechwormHead.cs +++ b/Projectiles/Summon/MechwormHead.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Projectiles.Summon projectile.timeLeft *= 5; projectile.minion = true; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 4; + projectile.localNPCHitCooldown = 5; } public override void AI() diff --git a/Projectiles/Summon/MechwormTail.cs b/Projectiles/Summon/MechwormTail.cs index 7da8598496..27b8e896f8 100644 --- a/Projectiles/Summon/MechwormTail.cs +++ b/Projectiles/Summon/MechwormTail.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Projectiles.Summon projectile.timeLeft *= 5; projectile.minion = true; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 4; + projectile.localNPCHitCooldown = 5; } public override void AI() diff --git a/Projectiles/Summon/MidnightSunBeam.cs b/Projectiles/Summon/MidnightSunBeam.cs index 9bbc978cb7..987dbf137b 100644 --- a/Projectiles/Summon/MidnightSunBeam.cs +++ b/Projectiles/Summon/MidnightSunBeam.cs @@ -30,6 +30,8 @@ namespace CalamityMod.Projectiles.Summon projectile.alpha = 255; projectile.penetrate = -1; projectile.tileCollide = false; + projectile.minion = true; + projectile.minionSlots = 0f; projectile.timeLeft = TrueTimeLeft; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 6; diff --git a/Projectiles/Summon/MidnightSunLaser.cs b/Projectiles/Summon/MidnightSunLaser.cs index 58d85e89d1..3027455004 100644 --- a/Projectiles/Summon/MidnightSunLaser.cs +++ b/Projectiles/Summon/MidnightSunLaser.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Summon projectile.minionSlots = 0f; projectile.ignoreWater = true; projectile.aiStyle = 1; - aiType = 242; + aiType = ProjectileID.BulletHighVelocity; projectile.penetrate = 1; projectile.timeLeft = 600; } diff --git a/Projectiles/Summon/MidnightSunSkyBeam.cs b/Projectiles/Summon/MidnightSunSkyBeam.cs index 6c3d5b5132..c8f86e8e5a 100644 --- a/Projectiles/Summon/MidnightSunSkyBeam.cs +++ b/Projectiles/Summon/MidnightSunSkyBeam.cs @@ -30,6 +30,8 @@ namespace CalamityMod.Projectiles.Summon projectile.alpha = 255; projectile.penetrate = -1; projectile.tileCollide = false; + projectile.minion = true; + projectile.minionSlots = 0f; projectile.timeLeft = TrueTimeLeft; projectile.usesIDStaticNPCImmunity = true; projectile.idStaticNPCHitCooldown = 30; diff --git a/Projectiles/Summon/MiniGuardianAttack.cs b/Projectiles/Summon/MiniGuardianAttack.cs index 33161fc7c2..047bedfc93 100644 --- a/Projectiles/Summon/MiniGuardianAttack.cs +++ b/Projectiles/Summon/MiniGuardianAttack.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Summon 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); + Vector2 vector43 = projectile.Center; float num551 = num535 - vector43.X; float num552 = num536 - vector43.Y; float num553 = (float)Math.Sqrt((double)(num551 * num551 + num552 * num552)); @@ -85,9 +85,9 @@ namespace CalamityMod.Projectiles.Summon 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; + Vector2 vector3 = projectile.Center; + float num18 = Main.player[projectile.owner].Center.X - vector3.X; + float num19 = Main.player[projectile.owner].Center.Y - 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); diff --git a/Projectiles/Summon/MiniGuardianDefense.cs b/Projectiles/Summon/MiniGuardianDefense.cs index 1adb554fc5..5719d88996 100644 --- a/Projectiles/Summon/MiniGuardianDefense.cs +++ b/Projectiles/Summon/MiniGuardianDefense.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Summon 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); + Vector2 vector43 = projectile.Center; float num551 = num535 - vector43.X; float num552 = num536 - vector43.Y; float num553 = (float)Math.Sqrt((double)(num551 * num551 + num552 * num552)); @@ -83,9 +83,9 @@ namespace CalamityMod.Projectiles.Summon 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; + Vector2 vector3 = projectile.Center; + float num18 = Main.player[projectile.owner].Center.X - vector3.X; + float num19 = Main.player[projectile.owner].Center.Y - 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); diff --git a/Projectiles/Summon/MiniSandShark.cs b/Projectiles/Summon/MiniSandShark.cs index 6add2fa1fc..a48187bf90 100644 --- a/Projectiles/Summon/MiniSandShark.cs +++ b/Projectiles/Summon/MiniSandShark.cs @@ -59,10 +59,8 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, spriteEffects, 0f); + Texture2D texture = Main.projectileTexture[projectile.type]; + Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, 0, texture.Width, texture.Height)), projectile.GetAlpha(lightColor), projectile.rotation, texture.Size() / 2f, projectile.scale, spriteEffects, 0f); return false; } diff --git a/Projectiles/Summon/OldDukeHeadCorpse.cs b/Projectiles/Summon/OldDukeHeadCorpse.cs index c46a72e220..1b8c893917 100644 --- a/Projectiles/Summon/OldDukeHeadCorpse.cs +++ b/Projectiles/Summon/OldDukeHeadCorpse.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Summon player.MinionDamage()); projectile.damage = trueDamage; } - NPC target = projectile.Center.MinionHoming(845f, player); + NPC target = projectile.Center.MinionHoming(845f, player, false); // No sense in targeting something below this sentry. if (target != null) { @@ -72,6 +72,8 @@ namespace CalamityMod.Projectiles.Summon { projectile.velocity.Y = 10f; } + + projectile.StickToTiles(false, false); } public override bool CanDamage() => false; diff --git a/Projectiles/Summon/OldDukeSharkVomit.cs b/Projectiles/Summon/OldDukeSharkVomit.cs index 3d74d06225..83bb554838 100644 --- a/Projectiles/Summon/OldDukeSharkVomit.cs +++ b/Projectiles/Summon/OldDukeSharkVomit.cs @@ -1,5 +1,7 @@ using CalamityMod.Dusts; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -34,7 +36,16 @@ namespace CalamityMod.Projectiles.Summon projectile.alpha = 255 - (int)(255 * projectile.ai[0] / 10f); } projectile.velocity.Y += 0.2f; - projectile.rotation = projectile.velocity.ToRotation(); + if (projectile.velocity.X < 0f) + { + projectile.spriteDirection = -1; + projectile.rotation = (float)Math.Atan2((double)-(double)projectile.velocity.Y, (double)-(double)projectile.velocity.X); + } + else + { + projectile.spriteDirection = 1; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + } //Homing if (projectile.ai[0] > 20f) HomingAI(); @@ -52,7 +63,7 @@ namespace CalamityMod.Projectiles.Summon if (npc.CanBeChasedBy(projectile, false)) { float dist = (projectile.Center - npc.Center).Length(); - if (dist < maxHomingRange) + if (dist < maxHomingRange && Collision.CanHit(projectile.Center, projectile.width, projectile.height, npc.Center, npc.width, npc.height)) { targetIdx = player.MinionAttackTargetNPC; maxHomingRange = dist; @@ -60,18 +71,18 @@ namespace CalamityMod.Projectiles.Summon } } } - else + if (!hasHomingTarget) { for (int i = 0; i < Main.npc.Length; ++i) { NPC npc = Main.npc[i]; - if (npc == null || !npc.active) + if (npc is null || !npc.active) continue; if (npc.CanBeChasedBy(projectile, false)) { float dist = (projectile.Center - npc.Center).Length(); - if (dist < maxHomingRange) + if (dist < maxHomingRange && Collision.CanHit(projectile.Center, projectile.width, projectile.height, npc.Center, npc.width, npc.height)) { targetIdx = i; maxHomingRange = dist; @@ -91,6 +102,14 @@ namespace CalamityMod.Projectiles.Summon } } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + SpriteEffects spriteEffects = projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Texture2D texture = Main.projectileTexture[projectile.type]; + Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, 0, texture.Width, texture.Height)), projectile.GetAlpha(lightColor), projectile.rotation, texture.Size() / 2f, projectile.scale, spriteEffects, 0f); + return false; + } + public override void Kill(int timeLeft) { for (int i = 0; i < Main.rand.Next(28, 41); i++) diff --git a/Projectiles/Summon/PhantomGuy.cs b/Projectiles/Summon/PhantomGuy.cs index 4f1247aec7..0f8d79935f 100644 --- a/Projectiles/Summon/PhantomGuy.cs +++ b/Projectiles/Summon/PhantomGuy.cs @@ -93,7 +93,7 @@ namespace CalamityMod.Projectiles.Summon } } } - else + if (!flag25) { for (int num645 = 0; num645 < Main.maxNPCs; num645++) { diff --git a/Projectiles/Summon/PinkButterfly.cs b/Projectiles/Summon/PinkButterfly.cs index 7f9af97df4..322ec34f58 100644 --- a/Projectiles/Summon/PinkButterfly.cs +++ b/Projectiles/Summon/PinkButterfly.cs @@ -100,6 +100,7 @@ namespace CalamityMod.Projectiles.Summon } Vector2 vector46 = projectile.position; bool flag25 = false; + int targetIndex = -1; if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; @@ -110,10 +111,11 @@ namespace CalamityMod.Projectiles.Summon { vector46 = npc.Center; flag25 = true; + targetIndex = npc.whoAmI; } } } - else + if (!flag25) { for (int num645 = 0; num645 < Main.maxNPCs; num645++) { @@ -126,6 +128,7 @@ namespace CalamityMod.Projectiles.Summon num633 = num646; vector46 = nPC2.Center; flag25 = true; + targetIndex = num645; } } } @@ -235,7 +238,7 @@ namespace CalamityMod.Projectiles.Summon for (int i = 0; i < numProj + 1; i++) { Vector2 perturbedSpeed = value19.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, projectileType, projectile.damage / 2, projectile.knockBack * 0.5f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, projectileType, projectile.damage / 2, projectile.knockBack * 0.5f, projectile.owner, targetIndex, 0f); } projectile.netUpdate = true; } diff --git a/Projectiles/Summon/PlagueBeeSmall.cs b/Projectiles/Summon/PlagueBeeSmall.cs index 8ae6a5c1c7..498bfc334a 100644 --- a/Projectiles/Summon/PlagueBeeSmall.cs +++ b/Projectiles/Summon/PlagueBeeSmall.cs @@ -26,120 +26,120 @@ namespace CalamityMod.Projectiles.Summon projectile.minion = true; } - public override void AI() - { - if (projectile.velocity.X > 0f) - { - projectile.spriteDirection = projectile.direction = 1; - } - else if (projectile.velocity.X < 0f) - { - projectile.spriteDirection = projectile.direction = -1; - } - projectile.rotation = projectile.velocity.X * 0.05f; - projectile.frameCounter++; - if (projectile.frameCounter >= 3) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame >= 3) - { - projectile.frame = 0; - } - float num373 = projectile.position.X; - float num374 = projectile.position.Y; - float num375 = 1000f; - bool flag10 = false; - projectile.ai[0] += 1f; - if (projectile.ai[0] > 30f) - { - projectile.ai[0] = 30f; + public override void AI() + { + if (projectile.owner != Main.myPlayer) + projectile.Kill(); + + projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); + projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); + projectile.rotation += projectile.spriteDirection * MathHelper.ToRadians(45f); + + projectile.frameCounter++; + if (projectile.frameCounter >= 3) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= Main.projFrames[projectile.type]) + { + projectile.frame = 0; + } + + Vector2 center = projectile.Center; + float maxDistance = 800f; + bool homeIn = false; + projectile.ai[0] += 1f; + if (projectile.ai[0] > 30f) + { Player player = Main.player[projectile.owner]; if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false) && (!npc.wet || projectile.type == 307)) + if (npc.CanBeChasedBy(projectile, false) && !npc.wet) { - float num377 = npc.position.X + (float)(npc.width / 2); - float num378 = npc.position.Y + (float)(npc.height / 2); - float num379 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num377) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num378); - if (num379 < 800f && num379 < num375 && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + float extraDistance = (npc.width / 2) + (npc.height / 2); + + bool canHit = true; + if (extraDistance < maxDistance) + canHit = Collision.CanHit(projectile.Center, 1, 1, npc.Center, 1, 1); + + if (Vector2.Distance(npc.Center, projectile.Center) < (maxDistance + extraDistance) && canHit) { - num375 = num379; - num373 = num377; - num374 = num378; - flag10 = true; + center = npc.Center; + homeIn = true; } } } else { - for (int num376 = 0; num376 < Main.maxNPCs; num376++) + for (int npcIndex = 0; npcIndex < Main.maxNPCs; npcIndex++) { - if (Main.npc[num376].CanBeChasedBy(projectile, false) && (!Main.npc[num376].wet || projectile.type == 307)) + NPC npc = Main.npc[npcIndex]; + if (npc.CanBeChasedBy(projectile, false) && !npc.wet) { - float num377 = Main.npc[num376].position.X + (float)(Main.npc[num376].width / 2); - float num378 = Main.npc[num376].position.Y + (float)(Main.npc[num376].height / 2); - float num379 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num377) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num378); - if (num379 < 800f && num379 < num375 && Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[num376].position, Main.npc[num376].width, Main.npc[num376].height)) + float extraDistance = (npc.width / 2) + (npc.height / 2); + + bool canHit = true; + if (extraDistance < maxDistance) + canHit = Collision.CanHit(projectile.Center, 1, 1, npc.Center, 1, 1); + + if (Vector2.Distance(npc.Center, projectile.Center) < (maxDistance + extraDistance) && canHit) { - num375 = num379; - num373 = num377; - num374 = num378; - flag10 = true; + center = npc.Center; + homeIn = true; + break; } } } } - } - if (!flag10) - { - num373 = projectile.position.X + (float)(projectile.width / 2) + projectile.velocity.X * 100f; - num374 = projectile.position.Y + (float)(projectile.height / 2) + projectile.velocity.Y * 100f; - } - float num380 = 10f; - float num381 = 0.14f; - Vector2 vector30 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num382 = num373 - vector30.X; - float num383 = num374 - vector30.Y; - float num384 = (float)Math.Sqrt((double)(num382 * num382 + num383 * num383)); - num384 = num380 / num384; - num382 *= num384; - num383 *= num384; - if (projectile.velocity.X < num382) - { - projectile.velocity.X = projectile.velocity.X + num381; - if (projectile.velocity.X < 0f && num382 > 0f) - { - projectile.velocity.X = projectile.velocity.X + num381 * 2f; - } - } - else if (projectile.velocity.X > num382) - { - projectile.velocity.X = projectile.velocity.X - num381; - if (projectile.velocity.X > 0f && num382 < 0f) - { - projectile.velocity.X = projectile.velocity.X - num381 * 2f; - } - } - if (projectile.velocity.Y < num383) - { - projectile.velocity.Y = projectile.velocity.Y + num381; - if (projectile.velocity.Y < 0f && num383 > 0f) - { - projectile.velocity.Y = projectile.velocity.Y + num381 * 2f; - } - } - else if (projectile.velocity.Y > num383) - { - projectile.velocity.Y = projectile.velocity.Y - num381; - if (projectile.velocity.Y > 0f && num383 < 0f) - { - projectile.velocity.Y = projectile.velocity.Y - num381 * 2f; - } - } - } + } + if (!homeIn) + { + center.X = projectile.Center.X + projectile.velocity.X * 100f; + center.Y = projectile.Center.Y + projectile.velocity.Y * 100f; + } + float speed = 10f; + float velocityTweak = 0.14f; + Vector2 projPos = projectile.Center; + Vector2 velocity = center - projPos; + float targetDist = velocity.Length(); + targetDist = speed / targetDist; + velocity.X *= targetDist; + velocity.Y *= targetDist; + if (projectile.velocity.X < velocity.X) + { + projectile.velocity.X += velocityTweak; + if (projectile.velocity.X < 0f && velocity.X > 0f) + { + projectile.velocity.X += velocityTweak * 2f; + } + } + else if (projectile.velocity.X > velocity.X) + { + projectile.velocity.X -= velocityTweak; + if (projectile.velocity.X > 0f && velocity.X < 0f) + { + projectile.velocity.X -= velocityTweak * 2f; + } + } + if (projectile.velocity.Y < velocity.Y) + { + projectile.velocity.Y += velocityTweak; + if (projectile.velocity.Y < 0f && velocity.Y > 0f) + { + projectile.velocity.Y += velocityTweak * 2f; + } + } + else if (projectile.velocity.Y > velocity.Y) + { + projectile.velocity.Y -= velocityTweak; + if (projectile.velocity.Y > 0f && velocity.Y < 0f) + { + projectile.velocity.Y -= velocityTweak * 2f; + } + } + } public override bool OnTileCollide(Vector2 oldVelocity) { @@ -154,26 +154,26 @@ namespace CalamityMod.Projectiles.Summon return false; } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture = Main.projectileTexture[projectile.type]; + int frameHeight = texture.Height / Main.projFrames[projectile.type]; + int drawStart = frameHeight * 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, drawStart, texture.Width, frameHeight)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture.Width / 2f, (float)frameHeight / 2f), projectile.scale, spriteEffects, 0f); + return false; + } - public override void Kill(int timeLeft) - { - int num3; - for (int num418 = 0; num418 < 3; num418 = num3 + 1) - { - int num419 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 89, projectile.velocity.X, projectile.velocity.Y, 50, default, 1f); - Main.dust[num419].noGravity = true; - Main.dust[num419].scale = 1f; - num3 = num418; - } - } + public override void Kill(int timeLeft) + { + for (int i = 0; i < 2; i++) + { + int plague = Dust.NewDust(projectile.position, projectile.width, projectile.height, 89, projectile.velocity.X, projectile.velocity.Y, 50, default, 1f); + Main.dust[plague].noGravity = true; + } + } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { diff --git a/Projectiles/Summon/PlaguePrincess.cs b/Projectiles/Summon/PlaguePrincess.cs index b8fd4170ea..3217086e3b 100644 --- a/Projectiles/Summon/PlaguePrincess.cs +++ b/Projectiles/Summon/PlaguePrincess.cs @@ -194,7 +194,7 @@ namespace CalamityMod.Projectiles.Summon } } } - else + if (!targetFound) { for (int num645 = 0; num645 < Main.maxNPCs; num645++) { diff --git a/Projectiles/Summon/PlaguebringerSummon.cs b/Projectiles/Summon/PlaguebringerSummon.cs index 0f5a496e48..d889f46310 100644 --- a/Projectiles/Summon/PlaguebringerSummon.cs +++ b/Projectiles/Summon/PlaguebringerSummon.cs @@ -86,7 +86,7 @@ namespace CalamityMod.Projectiles.Summon int buffType = ModContent.BuffType(); float range = auraRange; - bool dealDamage = auraCounter++ % 60 == 0; + bool dealDamage = auraCounter++ % 60 == 59; int dmg = projectile.damage; if (projectile.owner == Main.myPlayer) { diff --git a/Projectiles/Summon/PlantSeed.cs b/Projectiles/Summon/PlantSeed.cs index 09548cff50..09ba64cec6 100644 --- a/Projectiles/Summon/PlantSeed.cs +++ b/Projectiles/Summon/PlantSeed.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Summon projectile.minionSlots = 0f; projectile.ignoreWater = true; projectile.aiStyle = 1; - aiType = 242; + aiType = ProjectileID.BulletHighVelocity; projectile.penetrate = 1; projectile.timeLeft = 600; } @@ -56,5 +56,10 @@ namespace CalamityMod.Projectiles.Summon { target.AddBuff(BuffID.Poisoned, 60); } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Poisoned, 60); + } } } diff --git a/Projectiles/Summon/PlantSeedGreen.cs b/Projectiles/Summon/PlantSeedGreen.cs index 54e75d676a..78a91fef24 100644 --- a/Projectiles/Summon/PlantSeedGreen.cs +++ b/Projectiles/Summon/PlantSeedGreen.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Summon projectile.minionSlots = 0f; projectile.ignoreWater = true; projectile.aiStyle = 1; - aiType = 242; + aiType = ProjectileID.BulletHighVelocity; projectile.penetrate = 1; projectile.timeLeft = 600; } @@ -55,6 +55,15 @@ namespace CalamityMod.Projectiles.Summon public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(BuffID.Poisoned, 180); + if (projectile.ai[1] == 1f) + target.AddBuff(BuffID.Venom, 180); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Poisoned, 180); + if (projectile.ai[1] == 1f) + target.AddBuff(BuffID.Venom, 180); } } } diff --git a/Projectiles/Summon/PlantSporeCloud.cs b/Projectiles/Summon/PlantSporeCloud.cs new file mode 100644 index 0000000000..e260a8449c --- /dev/null +++ b/Projectiles/Summon/PlantSporeCloud.cs @@ -0,0 +1,70 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class PlantSporeCloud : ModProjectile + { + private int counter = 0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spore Cloud"); + ProjectileID.Sets.MinionShot[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 32; + projectile.height = 32; + projectile.friendly = true; + projectile.alpha = 60; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.minion = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 30; + } + + public override void AI() + { + projectile.velocity.X *= 0.985f; + projectile.velocity.Y *= 0.985f; + projectile.rotation += projectile.direction * 0.05f; + + if (counter % 5 == 0) + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 107, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + + counter++; + if (counter > 300) + projectile.alpha += 5; + if (projectile.alpha >= 255) + projectile.Kill(); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + if (projectile.ai[0] == 1f) + tex = ModContent.GetTexture("CalamityMod/Projectiles/Summon/PlantSporeCloud2"); + if (projectile.ai[0] == 2f) + tex = ModContent.GetTexture("CalamityMod/Projectiles/Summon/PlantSporeCloud3"); + + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Poisoned, 180); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Poisoned, 180); + } + } +} diff --git a/Projectiles/Summon/PlantSporeCloud.png b/Projectiles/Summon/PlantSporeCloud.png new file mode 100644 index 0000000000..c8ac75bf7f Binary files /dev/null and b/Projectiles/Summon/PlantSporeCloud.png differ diff --git a/Projectiles/Summon/PlantSporeCloud2.png b/Projectiles/Summon/PlantSporeCloud2.png new file mode 100644 index 0000000000..230cd387e9 Binary files /dev/null and b/Projectiles/Summon/PlantSporeCloud2.png differ diff --git a/Projectiles/Summon/PlantSporeCloud3.png b/Projectiles/Summon/PlantSporeCloud3.png new file mode 100644 index 0000000000..297365d2a5 Binary files /dev/null and b/Projectiles/Summon/PlantSporeCloud3.png differ diff --git a/Projectiles/Summon/PlantSummon.cs b/Projectiles/Summon/PlantSummon.cs index 6c790344dc..0e2390794d 100644 --- a/Projectiles/Summon/PlantSummon.cs +++ b/Projectiles/Summon/PlantSummon.cs @@ -1,6 +1,7 @@ using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using System; using Terraria; using Terraria.ID; @@ -10,7 +11,12 @@ namespace CalamityMod.Projectiles.Summon { public class PlantSummon : ModProjectile { + private bool initialized = false; private bool enraged = false; + private int pinkSeed = ModContent.ProjectileType(); + private int greenSeed = ModContent.ProjectileType(); + private int thornBall = ModContent.ProjectileType(); + private int sporeClouds = ModContent.ProjectileType(); public override void SetStaticDefaults() { @@ -18,6 +24,7 @@ namespace CalamityMod.Projectiles.Summon Main.projFrames[projectile.type] = 8; ProjectileID.Sets.MinionSacrificable[projectile.type] = true; ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + ProjectileID.Sets.NeedsUUID[projectile.type] = true; } public override void SetDefaults() @@ -27,7 +34,7 @@ namespace CalamityMod.Projectiles.Summon projectile.netImportant = true; projectile.friendly = true; projectile.ignoreWater = true; - projectile.minionSlots = 2f; + projectile.minionSlots = 3f; projectile.timeLeft = 18000; projectile.penetrate = -1; projectile.tileCollide = false; @@ -42,8 +49,9 @@ namespace CalamityMod.Projectiles.Summon { Player player = Main.player[projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); + CalamityGlobalProjectile modProj = projectile.Calamity(); - if (player.statLife <= (int)((double)player.statLifeMax2 * 0.5)) + if (player.statLife <= (int)(player.statLifeMax2 * 0.75)) { if (Main.myPlayer == projectile.owner) { @@ -56,11 +64,367 @@ namespace CalamityMod.Projectiles.Summon projectile.extraUpdates = 0; } - projectile.frameCounter++; - if (projectile.frameCounter > 8) + Framing(); + + if (!initialized) + { + modProj.spawnedPlayerMinionDamageValue = player.MinionDamage(); + modProj.spawnedPlayerMinionProjectileDamageValue = projectile.damage; + SpawnDust(); + SpawnTentacles(); + initialized = true; + } + if (player.MinionDamage() != modProj.spawnedPlayerMinionDamageValue) + { + int damage2 = (int)((float)modProj.spawnedPlayerMinionProjectileDamageValue / + modProj.spawnedPlayerMinionDamageValue * player.MinionDamage()); + projectile.damage = damage2; + } + + bool correctMinion = projectile.type == ModContent.ProjectileType(); + player.AddBuff(ModContent.BuffType(), 3600); + if (correctMinion) + { + if (player.dead) + { + modPlayer.plantera = false; + } + if (modPlayer.plantera) + { + projectile.timeLeft = 2; + } + } + + float range = 1000f; + Vector2 half = new Vector2(0.5f); + + //shouldn't need anti clump because there can only be one + + if (!enraged) + { + if (projectile.ai[0] >= 2f) + projectile.ai[0] = 0f; + Vector2 targetVec = projectile.position; + bool foundTarget = false; + if (player.HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) + { + Vector2 sizeCheck = npc.position + npc.Size * half; + float npcDist = Vector2.Distance(npc.Center, projectile.Center); + if (!foundTarget && npcDist < range) + { + range = npcDist; + targetVec = sizeCheck; + foundTarget = true; + } + } + } + else + { + for (int i = 0; i < Main.maxNPCs; i++) + { + NPC npc = Main.npc[i]; + if (npc.CanBeChasedBy(projectile, false)) + { + Vector2 sizeCheck = npc.position + npc.Size * half; + float npcDist = Vector2.Distance(npc.Center, projectile.Center); + if (!foundTarget && npcDist < range) + { + range = npcDist; + targetVec = sizeCheck; + foundTarget = true; + } + } + } + } + + CheckIfShouldReturnToPlayer(foundTarget); + + if (foundTarget && projectile.ai[0] == 0f) + { + StayCertainDistFromTarget(targetVec); + } + else + { + PassiveAI(); + } + + HandleRotation(foundTarget, targetVec); + + IncrementAttackCounter(); + if (projectile.ai[0] == 0f) + { + float projSpeed = 6f; + int projType = Main.rand.NextBool(2) ? greenSeed : pinkSeed; + int projDmg = (int)(projectile.damage * 0.7f); + float speedMult = 1f; + if (Main.rand.NextBool(4)) + { + projType = thornBall; + } + if (projType == thornBall) + { + speedMult = 2f; + projDmg = (int)(projectile.damage * 1.2f); + } + if (projectile.ai[1] == 0f && foundTarget && range < 500f) + { + Main.PlaySound(SoundID.Item20, projectile.position); + projectile.ai[1] += 1f; + if (Main.myPlayer == projectile.owner) + { + Vector2 velocity = targetVec - projectile.Center; + if (projType != thornBall && Main.rand.NextBool(3)) + { + FireShotgun(velocity, 0.7f); + } + else + { + velocity.Normalize(); + velocity *= projSpeed; + velocity *= speedMult; + Projectile.NewProjectile(projectile.Center, velocity, projType, projDmg, projectile.knockBack, projectile.owner, 0f, 0f); + } + projectile.netUpdate = true; + } + } + } + } + else //enraged + { + bool charging = false; + if (projectile.ai[0] == 2f) + { + projectile.ai[1] += 1f; + projectile.extraUpdates = 1; + if (projectile.ai[1] > 30f) + { + projectile.ai[1] = 1f; + projectile.ai[0] = 0f; + projectile.extraUpdates = 0; + projectile.numUpdates = 0; + projectile.netUpdate = true; + } + else + { + charging = true; + } + } + if (charging) + { + return; + } + Vector2 targetVec = projectile.position; + bool foundTarget = false; + if (player.HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) + { + Vector2 sizeCheck = npc.position + npc.Size * half; + float npcDist = Vector2.Distance(npc.Center, projectile.Center); + if (!foundTarget && npcDist < range) + { + range = npcDist; + targetVec = sizeCheck; + foundTarget = true; + } + } + } + if (!foundTarget) + { + for (int num645 = 0; num645 < Main.maxNPCs; num645++) + { + NPC npc = Main.npc[num645]; + if (npc.CanBeChasedBy(projectile, false)) + { + Vector2 sizeCheck = npc.position + npc.Size * half; + float npcDist = Vector2.Distance(npc.Center, projectile.Center); + if (!foundTarget && npcDist < range) + { + range = npcDist; + targetVec = sizeCheck; + foundTarget = true; + } + } + } + } + + HandleRotation(foundTarget, targetVec); + + CheckIfShouldReturnToPlayer(foundTarget); + + if (foundTarget && projectile.ai[0] == 0f) + { + StayCertainDistFromTarget(targetVec); + } + else + { + PassiveAI(); + } + IncrementAttackCounter(); + if (projectile.ai[0] == 0f) + { + if (projectile.ai[1] == 0f && foundTarget && range < 500f) + { + projectile.ai[1] += 1f; + if (Main.myPlayer == projectile.owner) + { + projectile.ai[0] = 2f; + Vector2 whereIsTarget = targetVec - projectile.Center; + whereIsTarget.Normalize(); + int projType = thornBall; + if (Main.rand.NextBool(2)) + { + Vector2 projVelocity = whereIsTarget * 2f; + int projDmg = (int)(projectile.damage * 1.5f); + Projectile.NewProjectile(projectile.Center, projVelocity, projType, projDmg, projectile.knockBack, projectile.owner, 0f, 1f); + } + if (Main.rand.NextBool(3)) + { + FireShotgun(whereIsTarget, 0.8f); + } + float chargeSpeed = 8f; + projectile.velocity = whereIsTarget * chargeSpeed; + projectile.netUpdate = true; + } + } + } + } + } + + private void CheckIfShouldReturnToPlayer(bool targetLocated) + { + Player player = Main.player[projectile.owner]; + float separationAnxietyDist = 1300f; + if (targetLocated) + { + separationAnxietyDist = 2600f; + } + if (Vector2.Distance(player.Center, projectile.Center) > separationAnxietyDist) + { + projectile.ai[0] = 1f; + projectile.netUpdate = true; + } + } + + private void StayCertainDistFromTarget(Vector2 whereIsTarget) + { + Vector2 targetPos = whereIsTarget - projectile.Center; + float targetDist = targetPos.Length(); + targetPos.Normalize(); + if (targetDist > 200f) + { + float speedMult = 8f; + targetPos *= speedMult; + projectile.velocity = (projectile.velocity * 40f + targetPos) / 41f; + } + else + { + float reverseSpeedMult = 4f; + targetPos *= -reverseSpeedMult; + projectile.velocity = (projectile.velocity * 40f + targetPos) / 41f; + } + } + + private void PassiveAI() + { + Player player = Main.player[projectile.owner]; + bool returningToPlayer = false; + if (!returningToPlayer) + { + returningToPlayer = projectile.ai[0] == 1f; + } + float returnSpeed = 12f; + if (returningToPlayer) + { + returnSpeed = 30f; + } + Vector2 playerVec = player.Center - projectile.Center + new Vector2(0f, -120f); + float playerDist = playerVec.Length(); + if (playerDist > 200f && returnSpeed < 16f) + { + returnSpeed = 16f; + } + if (playerDist < 600f && returningToPlayer) + { + 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) + { + playerVec.Normalize(); + playerVec *= returnSpeed; + projectile.velocity = (projectile.velocity * 40f + playerVec) / 41f; + } + else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) + { + projectile.velocity.X = -0.15f; + projectile.velocity.Y = -0.05f; + } + } + + private void IncrementAttackCounter() + { + 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; + } + } + + private void FireShotgun(Vector2 whereIsTarget, float attackMult) + { + whereIsTarget.Normalize(); + float projSpeedMult = 3f; + int projType = pinkSeed; + if (Main.rand.NextBool(2) && CalamityUtils.CountProjectiles(sporeClouds) < 9) + { + projType = sporeClouds; + projSpeedMult = 10f; + } + else + { + projType = Main.rand.NextBool(2) ? greenSeed : pinkSeed; + } + int projDmg = (int)(projectile.damage * attackMult); + Vector2 projVelocity = whereIsTarget * projSpeedMult; + for (int i = -8; i <= 8; i += 8) + { + Vector2 perturbedSpeed = projVelocity.RotatedBy(MathHelper.ToRadians(i)); + Projectile.NewProjectile(projectile.Center, perturbedSpeed, projType, projDmg, projectile.knockBack * attackMult, projectile.owner, Main.rand.Next(3), 1f); + } + } + + private void HandleRotation(bool targetFound, Vector2 whereIsTarget) + { + if (targetFound && !enraged) + { + projectile.rotation = projectile.rotation.AngleTowards(projectile.AngleTo(whereIsTarget) + MathHelper.Pi, 0.1f); + } + else + { + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.Pi; + } + } + + private void Framing() + { + if (projectile.frameCounter++ % 8 == 7) { projectile.frame++; - projectile.frameCounter = 0; } if (!enraged) { @@ -76,387 +440,59 @@ namespace CalamityMod.Projectiles.Summon projectile.frame = 4; } } + } - if (projectile.localAI[0] == 0f) - { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) - { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 107, vector7.X * 1.75f, vector7.Y * 1.75f, 100, default, 1.1f); - Main.dust[num228].noGravity = true; - Main.dust[num228].velocity = vector7; - } - projectile.localAI[0] += 1f; - } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - projectile.damage = damage2; - } - - bool flag64 = projectile.type == ModContent.ProjectileType(); - player.AddBuff(ModContent.BuffType(), 3600); - if (flag64) - { - if (player.dead) - { - modPlayer.plantera = false; - } - if (modPlayer.plantera) - { - projectile.timeLeft = 2; - } - } - - float num633 = 1000f; - float num634 = 1300f; - float num635 = 2600f; - float num636 = 600f; - - //idle movement - projectile.MinionAntiClump(); - - if (!enraged) + private void SpawnDust() + { + int dustAmt = 36; + for (int dustIndex = 0; dustIndex < dustAmt; dustIndex++) { - if (projectile.ai[0] >= 2f) - projectile.ai[0] = 0f; - Vector2 vector46 = projectile.position; - bool flag25 = false; - Vector2 value = new Vector2(0.5f); - if (player.HasMinionAttackTargetNPC) + Vector2 source = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; + source = source.RotatedBy((double)((float)(dustIndex - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + projectile.Center; + Vector2 dustVel = source - projectile.Center; + int terra = Dust.NewDust(source + dustVel, 0, 0, 107, dustVel.X * 1.75f, dustVel.Y * 1.75f, 100, default, 1.1f); + Main.dust[terra].noGravity = true; + Main.dust[terra].velocity = dustVel; + } + } + + private void SpawnTentacles() + { + if (projectile.owner == Main.myPlayer) + { + int tentacleAmt = 6; + for (int tentacleIndex = 0; tentacleIndex < tentacleAmt; tentacleIndex++) { - NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) - { - Vector2 vector2 = npc.position + npc.Size * value; - float num646 = Vector2.Distance(npc.Center, projectile.Center); - if (!flag25 && num646 < num633) - { - num633 = num646; - vector46 = vector2; - flag25 = true; - } - } - } - else - { - for (int num645 = 0; num645 < Main.maxNPCs; num645++) - { - NPC npc = Main.npc[num645]; - if (npc.CanBeChasedBy(projectile, false)) - { - Vector2 vector2 = npc.position + npc.Size * value; - float num646 = Vector2.Distance(npc.Center, projectile.Center); - if (!flag25 && num646 < num633) - { - num633 = num646; - vector46 = vector2; - 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.rotation = projectile.rotation.AngleTowards(projectile.AngleTo(vector46) + MathHelper.Pi, 0.1f); - } - else - { - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.Pi; - } - 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 = (Main.rand.NextBool(2) ? ModContent.ProjectileType() : ModContent.ProjectileType()); - int projDmg = (int)(projectile.damage * 0.7f); - float speedMult = 1f; - if (Main.rand.NextBool(4)) - { - projType = ModContent.ProjectileType(); - } - if (projType == ModContent.ProjectileType()) - { - speedMult = 2f; - projDmg = (int)(projectile.damage * 1.2f); - } - if (projectile.ai[1] == 0f && flag25 && num633 < 500f) - { - Main.PlaySound(SoundID.Item20, projectile.position); - projectile.ai[1] += 1f; - if (Main.myPlayer == projectile.owner) - { - Vector2 value19 = vector46 - projectile.Center; - value19.Normalize(); - value19 *= scaleFactor3; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value19.X * speedMult, value19.Y * speedMult, projType, projDmg, 0f, projectile.owner, 0f, 0f); - projectile.netUpdate = true; - } - } + Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, tentacleIndex, Projectile.GetByUUID(projectile.owner, projectile.whoAmI)); } } - else //enraged - { - bool flag24 = false; - if (projectile.ai[0] == 2f) - { - projectile.ai[1] += 1f; - projectile.extraUpdates = 1; - if (projectile.ai[1] > 30f) - { - projectile.ai[1] = 1f; - projectile.ai[0] = 0f; - projectile.extraUpdates = 0; - projectile.numUpdates = 0; - projectile.netUpdate = true; - } - else - { - flag24 = true; - } - } - if (flag24) - { - return; - } - Vector2 vector46 = projectile.position; - bool flag25 = false; - Vector2 value = new Vector2(0.5f); - if (player.HasMinionAttackTargetNPC) - { - NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) - { - Vector2 vector2 = npc.position + npc.Size * value; - float num646 = Vector2.Distance(npc.Center, projectile.Center); - if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) - { - num633 = num646; - vector46 = vector2; - flag25 = true; - } - } - } - else - { - for (int num645 = 0; num645 < Main.maxNPCs; num645++) - { - NPC npc = Main.npc[num645]; - if (npc.CanBeChasedBy(projectile, false)) - { - Vector2 vector2 = npc.position + npc.Size * value; - float num646 = Vector2.Distance(npc.Center, projectile.Center); - if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) - { - num633 = num646; - vector46 = vector2; - flag25 = true; - } - } - } - } - if (flag25) - { - projectile.rotation = (vector46 - projectile.Center).ToRotation() + 3.14159274f; - } - else - { - projectile.rotation = projectile.velocity.ToRotation() + 3.14159274f; - } - float num647 = num634; - if (flag25) - { - num647 = num635; - } - if (Vector2.Distance(player.Center, projectile.Center) > num647) - { - projectile.ai[0] = 1f; - projectile.netUpdate = true; - } - if (flag25 && projectile.ai[0] == 0f) - { - Vector2 vector47 = vector46 - projectile.Center; - float num648 = vector47.Length(); - vector47.Normalize(); - if (num648 > 200f) - { - float scaleFactor2 = 8f; - vector47 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - else - { - float num649 = 4f; - vector47 *= -num649; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - } - else - { - bool flag26 = false; - if (!flag26) - { - flag26 = projectile.ai[0] == 1f; - } - float num650 = 6f; - if (flag26) - { - num650 = 15f; - } - Vector2 center2 = projectile.Center; - Vector2 vector48 = player.Center - center2 + new Vector2(0f, -60f); - float num651 = vector48.Length(); - if (num651 > 200f && num650 < 8f) - { - num650 = 8f; - } - if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.ai[0] = 0f; - projectile.netUpdate = true; - } - if (num651 > 2000f) - { - projectile.position.X = 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(); - if (Main.rand.NextBool(2)) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value20.X * 2f, value20.Y * 2f, ModContent.ProjectileType(), (int)(projectile.damage * 1.5f), 0f, Main.myPlayer, 0f, 0f); - } - projectile.velocity = value20 * 8f; - projectile.netUpdate = true; - } - } - } - } - } + } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(BuffID.Poisoned, 300); + target.AddBuff(BuffID.Venom, 300); } - public override bool CanDamage() + public override void OnHitPvp(Player target, int damage, bool crit) { - return enraged == true; + target.AddBuff(BuffID.Poisoned, 300); + target.AddBuff(BuffID.Venom, 300); + } + + public override bool CanDamage() => enraged; + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture = Main.projectileTexture[projectile.type]; + 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; } } } diff --git a/Projectiles/Summon/PlantTentacle.cs b/Projectiles/Summon/PlantTentacle.cs new file mode 100644 index 0000000000..7764aeb626 --- /dev/null +++ b/Projectiles/Summon/PlantTentacle.cs @@ -0,0 +1,251 @@ +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 PlantTentacle : ModProjectile + { + private bool initialized = false; + private int counter = 0; + private float desiredDistance = 150f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Tentacle"); + Main.projFrames[projectile.type] = 4; + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 22; + projectile.height = 24; + projectile.netImportant = true; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.minionSlots = 0f; + projectile.timeLeft = 18000; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.timeLeft *= 5; + projectile.minion = true; + projectile.usesIDStaticNPCImmunity = true; + projectile.idStaticNPCHitCooldown = 12; + } + + public override void AI() + { + Player player = Main.player[projectile.owner]; + if (projectile.ai[1] < 0 || projectile.ai[1] >= Main.maxProjectiles) + { + projectile.Kill(); + return; + } + // If something has gone wrong with either the tentacle or the host plant, destroy the proj. + Projectile hostPlant = Main.projectile[(int)projectile.ai[1]]; + if (projectile.type != ModContent.ProjectileType() || !hostPlant.active || hostPlant.type != ModContent.ProjectileType()) + { + projectile.Kill(); + return; + } + + if (projectile.frameCounter++ % 6 == 0) + { + projectile.frame++; + } + if (projectile.frame >= Main.projFrames[projectile.type]) + { + projectile.frame = 0; + } + + if (!initialized) + { + projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + initialized = true; + } + if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int trueDamage = (int)(projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); + projectile.damage = trueDamage; + } + + if (player.Calamity().plantera) + { + projectile.timeLeft = 2; + } + + projectile.rotation = (projectile.Center - hostPlant.Center).ToRotation() + MathHelper.Pi; + + projectile.MinionAntiClump(1f); + + counter++; + if (counter % 30 == 0) //changes every half second + { + desiredDistance = Main.rand.NextFloat(175f, 225f); + } + Vector2 targetPos = hostPlant.Center - projectile.Center; + float targetDist = targetPos.Length(); + targetPos.Normalize(); + if (targetDist > desiredDistance) + { + float speedMult = 10f; + speedMult += (targetDist - desiredDistance) * 0.2f; //+0.2f for every 1f away from the desired distance + targetPos *= speedMult; + projectile.velocity = (projectile.velocity * 40f + targetPos) / 41f; + } + else + { + float reverseSpeedMult = 5f; + targetPos *= -reverseSpeedMult; + projectile.velocity = (projectile.velocity * 40f + targetPos) / 41f; + } + + if (targetDist > 2000f) + { + projectile.position.X = hostPlant.Center.X - (float)(projectile.width / 2); + projectile.position.Y = hostPlant.Center.Y - (float)(projectile.height / 2); + projectile.netUpdate = true; + } + + if (projectile.ai[0] >= 3f) + { + if (hostPlant.Center.X - projectile.Center.X > 0) + { + projectile.velocity.X += 0.05f; + } + } + else + { + if (hostPlant.Center.X - projectile.Center.X < 0) + { + projectile.velocity.X -= 0.05f; + } + } + + if (projectile.ai[0] % 2f == 0f) + { + if (hostPlant.Center.Y - projectile.Center.Y > 0) + { + projectile.velocity.Y += 0.05f; + } + } + else + { + if (hostPlant.Center.Y - projectile.Center.Y < 0) + { + projectile.velocity.Y -= 0.05f; + } + } + } + + public override void Kill(int timeLeft) + { + for (int i = 0; i < 10; i++) + { + Dust.NewDust(projectile.position, projectile.width, projectile.height, 107); + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + if (projectile.ai[1] < 0 || projectile.ai[1] >= Main.maxProjectiles) + { + return false; + } + + // If something has gone wrong with either the tentacle or the host plant, return. + Projectile hostPlant = Main.projectile[(int)projectile.ai[1]]; + if (projectile.type != ModContent.ProjectileType() || !hostPlant.active || hostPlant.type != ModContent.ProjectileType()) + { + return false; + } + + Vector2 source = hostPlant.Center; + Color transparent = Microsoft.Xna.Framework.Color.Transparent; + Texture2D chain = ModContent.GetTexture("CalamityMod/ExtraTextures/Chains/PlantationChain"); + Vector2 goal = projectile.Center; + Rectangle? sourceRectangle = null; + float textureHeight = (float)chain.Height; + Vector2 drawVector = source - goal; + float rotation = (float)Math.Atan2((double)drawVector.Y, (double)drawVector.X) - MathHelper.PiOver2; + bool shouldDraw = true; + if (float.IsNaN(goal.X) && float.IsNaN(goal.Y)) + { + shouldDraw = false; + } + if (float.IsNaN(drawVector.X) && float.IsNaN(drawVector.Y)) + { + shouldDraw = false; + } + while (shouldDraw) + { + if (drawVector.Length() < textureHeight + 1f) + { + shouldDraw = false; + } + else + { + Vector2 value2 = drawVector; + value2.Normalize(); + goal += value2 * textureHeight; + drawVector = source - goal; + Color color = Lighting.GetColor((int)goal.X / 16, (int)(goal.Y / 16f)); + Main.spriteBatch.Draw(chain, goal - Main.screenPosition, sourceRectangle, color, rotation, chain.Size() / 2f, 1f, SpriteEffects.None, 0f); + } + } + return true; + } + + //It draws the host plant in here in order to have it draw over the tentacles + public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) + { + //Only 1 tentacle needs to draw this, the last one spawned because it's latest in the projectile array. + if (projectile.ai[0] < 5) + { + return; + } + + if (projectile.ai[1] < 0 || projectile.ai[1] >= Main.maxProjectiles) + { + return; + } + + // If something has gone wrong with either the tentacle or the host plant, return. + Projectile hostPlant = Main.projectile[(int)projectile.ai[1]]; + if (projectile.type != ModContent.ProjectileType() || !hostPlant.active || hostPlant.type != ModContent.ProjectileType()) + { + return; + } + + Texture2D texture = Main.projectileTexture[hostPlant.type]; + int height = texture.Height / Main.projFrames[hostPlant.type]; + int frameHeight = height * hostPlant.frame; + SpriteEffects spriteEffects = SpriteEffects.None; + if (hostPlant.spriteDirection == -1) + spriteEffects = SpriteEffects.FlipHorizontally; + Color color = Lighting.GetColor((int)hostPlant.Center.X / 16, (int)(hostPlant.Center.Y / 16f)); + + Main.spriteBatch.Draw(texture, hostPlant.Center - Main.screenPosition + new Vector2(0f, hostPlant.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, frameHeight, texture.Width, height)), color, hostPlant.rotation, new Vector2((float)texture.Width / 2f, (float)height / 2f), hostPlant.scale, spriteEffects, 0f); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Poisoned, 120); + target.AddBuff(BuffID.Venom, 120); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Poisoned, 120); + target.AddBuff(BuffID.Venom, 120); + } + } +} diff --git a/Projectiles/Summon/PlantTentacle.png b/Projectiles/Summon/PlantTentacle.png new file mode 100644 index 0000000000..78dbdaa9f6 Binary files /dev/null and b/Projectiles/Summon/PlantTentacle.png differ diff --git a/Projectiles/Summon/PlantThornBall.cs b/Projectiles/Summon/PlantThornBall.cs index 76e3d07270..07f4c8293b 100644 --- a/Projectiles/Summon/PlantThornBall.cs +++ b/Projectiles/Summon/PlantThornBall.cs @@ -17,7 +17,6 @@ namespace CalamityMod.Projectiles.Summon { projectile.width = 30; projectile.height = 30; - projectile.scale = 0.75f; projectile.friendly = true; projectile.penetrate = 3; projectile.timeLeft = 300; @@ -52,6 +51,15 @@ namespace CalamityMod.Projectiles.Summon public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(BuffID.Poisoned, 180); + if (projectile.ai[1] == 1f) + target.AddBuff(BuffID.Venom, 180); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Poisoned, 180); + if (projectile.ai[1] == 1f) + target.AddBuff(BuffID.Venom, 180); } } } diff --git a/Projectiles/Summon/PlantThornBall.png b/Projectiles/Summon/PlantThornBall.png index 2b5de4b6ae..b2ea5197ee 100644 Binary files a/Projectiles/Summon/PlantThornBall.png and b/Projectiles/Summon/PlantThornBall.png differ diff --git a/Projectiles/Summon/PrincessMissile.cs b/Projectiles/Summon/PrincessMissile.cs index 43765b9c89..ef67769255 100644 --- a/Projectiles/Summon/PrincessMissile.cs +++ b/Projectiles/Summon/PrincessMissile.cs @@ -61,13 +61,13 @@ namespace CalamityMod.Projectiles.Summon } else if (Main.rand.NextBool(4)) { - int num252 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default, 0.5f); + int num252 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 31, 0f, 0f, 100, default, 0.5f); Main.dust[num252].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[num252].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f; Main.dust[num252].noGravity = true; Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2)).RotatedBy((double)projectile.rotation, default) * 1.1f; Main.rand.Next(2); - num252 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 1f); + num252 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 6, 0f, 0f, 100, default, 1f); Main.dust[num252].scale = 1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[num252].noGravity = true; Main.dust[num252].position = projectile.Center + new Vector2(0f, (float)(-(float)projectile.height / 2 - 6)).RotatedBy((double)projectile.rotation, default) * 1.1f; @@ -98,7 +98,7 @@ namespace CalamityMod.Projectiles.Summon Main.PlaySound(SoundID.Item14, projectile.position); for (int num621 = 0; num621 < 8; num621++) { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 89, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 89, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -108,13 +108,13 @@ namespace CalamityMod.Projectiles.Summon } for (int num623 = 0; num623 < 10; num623++) { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 89, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 89, 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, 89, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 89, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - CalamityUtils.ExplosionGores(projectile, 3); + CalamityUtils.ExplosionGores(projectile.Center, 3); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Summon/ProfanedEnergy.cs b/Projectiles/Summon/ProfanedEnergy.cs index 7896ddc29c..a13f89d86e 100644 --- a/Projectiles/Summon/ProfanedEnergy.cs +++ b/Projectiles/Summon/ProfanedEnergy.cs @@ -1,3 +1,4 @@ +using CalamityMod.Dusts; using Microsoft.Xna.Framework; using System; using Terraria; @@ -45,24 +46,27 @@ namespace CalamityMod.Projectiles.Summon { projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - Main.PlaySound(SoundID.Item20, projectile.position); - for (int num621 = 0; num621 < 5; num621++) + Main.PlaySound(SoundID.Item20, projectile.Center); + for (int i = 0; i < 5; i++) { - int num622 = Dust.NewDust(new Vector2(projectile.Center.X, projectile.Center.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int holy = Dust.NewDust(projectile.Center, projectile.width, projectile.height, (int)CalamityDusts.ProfanedFire, 0f, 0f, 100, default, 2f); + Main.dust[holy].velocity *= 3f; + Main.dust[holy].position = projectile.Center; if (Main.rand.NextBool(2)) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[holy].scale = 0.5f; + Main.dust[holy].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 10; num623++) + for (int j = 0; j < 10; j++) { - int num624 = Dust.NewDust(new Vector2(projectile.Center.X, projectile.Center.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.Center.X, projectile.Center.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int fire = Dust.NewDust(projectile.Center, projectile.width, projectile.height, 246, 0f, 0f, 100, default, 3f); + Main.dust[fire].noGravity = true; + Main.dust[fire].velocity *= 5f; + Main.dust[fire].position = projectile.Center; + fire = Dust.NewDust(projectile.Center, projectile.width, projectile.height, 246, 0f, 0f, 100, default, 2f); + Main.dust[fire].velocity *= 2f; + Main.dust[fire].position = projectile.Center; } count += 1f; } @@ -87,13 +91,13 @@ namespace CalamityMod.Projectiles.Summon int target = 0; if (player.HasMinionAttackTargetNPC) { - NPC npc = Main.npc[Main.player[projectile.owner].MinionAttackTargetNPC]; + NPC npc = Main.npc[player.MinionAttackTargetNPC]; if (npc.CanBeChasedBy(projectile, false)) { - float num539 = npc.position.X + (float)(npc.width / 2); - float num540 = npc.position.Y + (float)(npc.height / 2); - float num541 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num539) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num540); - if (num541 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + float num539 = npc.Center.X; + float num540 = npc.Center.Y; + float num541 = Math.Abs(projectile.Center.X - num539) + Math.Abs(projectile.Center.Y - num540); + if (num541 < num508 && Collision.CanHit(projectile.Center, projectile.width, projectile.height, npc.Center, npc.width, npc.height)) { num506 = num539; num507 = num540; @@ -102,7 +106,7 @@ namespace CalamityMod.Projectiles.Summon } } } - else + if (!flag18) { for (int num512 = 0; num512 < Main.maxNPCs; num512++) { @@ -136,21 +140,17 @@ namespace CalamityMod.Projectiles.Summon { projectile.spriteDirection = -1; } - int projectileType = Main.rand.Next(2); - if (projectileType == 0) - { - projectileType = ModContent.ProjectileType(); - } - else - { - projectileType = ModContent.ProjectileType(); - } - float num403 = Main.rand.Next(20, 30); //modify the speed the projectile are shot. Lower number = slower projectile. + int projectileType = Utils.SelectRandom(Main.rand, new int[] + { + ModContent.ProjectileType(), + ModContent.ProjectileType() + }); + float speed = Main.rand.Next(20, 30); //modify the speed the projectile are shot. Lower number = slower projectile. Vector2 vector29 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); float num404 = num516 - vector29.X; float num405 = num517 - vector29.Y; float num406 = (float)Math.Sqrt((double)(num404 * num404 + num405 * num405)); - num406 = num403 / num406; + num406 = speed / num406; num404 *= num406; num405 *= num406; Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, num404, num405, projectileType, projectile.damage, projectile.knockBack, projectile.owner, (float)target, 0f); diff --git a/Projectiles/Summon/PurpleButterfly.cs b/Projectiles/Summon/PurpleButterfly.cs index 0927822a9d..69aacc2f67 100644 --- a/Projectiles/Summon/PurpleButterfly.cs +++ b/Projectiles/Summon/PurpleButterfly.cs @@ -105,7 +105,7 @@ namespace CalamityMod.Projectiles.Summon public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 6; + target.immune[projectile.owner] = 8; } } } diff --git a/Projectiles/Summon/RadiantResolutionAura.cs b/Projectiles/Summon/RadiantResolutionAura.cs index cd6bd7719b..718b0202de 100644 --- a/Projectiles/Summon/RadiantResolutionAura.cs +++ b/Projectiles/Summon/RadiantResolutionAura.cs @@ -36,10 +36,10 @@ namespace CalamityMod.Projectiles.Summon 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); + bool isCorrectProjectile = projectile.type == ModContent.ProjectileType(); if (isCorrectProjectile) { if (player.dead) @@ -72,8 +72,17 @@ namespace CalamityMod.Projectiles.Summon float allocatedSlots = projectile.ai[0]; projectile.rotation += MathHelper.ToRadians(3f) + MathHelper.ToRadians(allocatedSlots * 0.85f); - int radiantOrbDamage = (int)(projectile.damage * Math.Log(allocatedSlots + 1f, 1.414214)); - int radiantOrbAppearRate = (int)(124 * Math.Pow(0.9, allocatedSlots)); + float damageMult = (float)Math.Log(allocatedSlots, 3) + 1f; + + //Softcap the mult after 9 slots + float newMult = damageMult; + if (newMult > 3f) + { + newMult = ((damageMult - 3f) * 0.1f) + 3f; + } + + int radiantOrbDamage = (int)(projectile.damage * newMult); + int radiantOrbAppearRate = (int)(130 * Math.Pow(0.9, allocatedSlots)); if (radiantOrbAppearRate < 7) radiantOrbAppearRate = 7; @@ -87,9 +96,9 @@ namespace CalamityMod.Projectiles.Summon { if (projectile.ai[1] % 35 == 34) { - for (int i = 0; i < 3; i++) + for (int i = 0; i < 2; i++) { - float angle = MathHelper.Lerp(-MathHelper.ToRadians(30f), MathHelper.ToRadians(30f), i / 3f); + float angle = MathHelper.Lerp(-MathHelper.ToRadians(20f), MathHelper.ToRadians(20f), i / 2f); Projectile.NewProjectile(projectile.Center, projectile.DirectionTo(potentialTarget.Center).RotatedBy(angle) * 15f, ModContent.ProjectileType(), radiantOrbDamage / 2, projectile.knockBack, projectile.owner); } @@ -98,9 +107,9 @@ namespace CalamityMod.Projectiles.Summon { Projectile.NewProjectile(projectile.Center + Utils.NextVector2Unit(Main.rand) * Main.rand.NextFloat(100f, 360f), projectile.DirectionTo(potentialTarget.Center) * 2f, ModContent.ProjectileType(), radiantOrbDamage, projectile.knockBack * 4f, projectile.owner); - for (int i = 0; i < 4; i++) + for (int i = 0; i < 3; i++) { - float angle = MathHelper.Lerp(-MathHelper.ToRadians(40f), MathHelper.ToRadians(40f), i / 4f); + float angle = MathHelper.Lerp(-MathHelper.ToRadians(30f), MathHelper.ToRadians(30f), i / 3f); Projectile.NewProjectile(projectile.Center, projectile.DirectionTo(potentialTarget.Center).RotatedBy(angle) * 19f, ModContent.ProjectileType(), radiantOrbDamage / 2, projectile.knockBack, projectile.owner); } diff --git a/Projectiles/Summon/RadiantResolutionFire.cs b/Projectiles/Summon/RadiantResolutionFire.cs index e069758014..97f276bef3 100644 --- a/Projectiles/Summon/RadiantResolutionFire.cs +++ b/Projectiles/Summon/RadiantResolutionFire.cs @@ -15,15 +15,12 @@ namespace CalamityMod.Projectiles.Summon public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; + projectile.width = projectile.height = 10; projectile.friendly = true; - projectile.penetrate = 1; projectile.light = 1f; projectile.timeLeft = 300; projectile.minion = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 4; + projectile.tileCollide = false; } public override void AI() @@ -41,15 +38,13 @@ namespace CalamityMod.Projectiles.Summon 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; + CalamityGlobalProjectile.ExpandHitboxBy(projectile, 60); + projectile.maxPenetrate = projectile.penetrate = -1; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; + projectile.localNPCHitCooldown = 10; + projectile.damage /= 3; projectile.Damage(); - Main.PlaySound(SoundID.Item14, projectile.position); + Main.PlaySound(SoundID.Item14, projectile.Center); for (int i = 0; i < 20; i++) { Dust dust = Dust.NewDustPerfect(projectile.Center, (int)CalamityDusts.ProfanedFire); diff --git a/Projectiles/Summon/ReaverOrb.cs b/Projectiles/Summon/ReaverOrb.cs index 4ccf243923..9a8949e334 100644 --- a/Projectiles/Summon/ReaverOrb.cs +++ b/Projectiles/Summon/ReaverOrb.cs @@ -75,12 +75,12 @@ namespace CalamityMod.Projectiles.Summon projectile.damage = damage2; } Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 1f / 255f, (255 - projectile.alpha) * 0f / 255f); - projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2) + Main.player[projectile.owner].gfxOffY - 60f; - if (Main.player[projectile.owner].gravDir == -1f) + projectile.position.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 + 120f; - projectile.rotation = 3.14f; + projectile.rotation = MathHelper.Pi; } else { @@ -95,35 +95,28 @@ namespace CalamityMod.Projectiles.Summon projectile.ai[0] -= 1f; return; } - bool flag18 = false; - float num508 = 600f; - for (int num512 = 0; num512 < Main.maxNPCs; num512++) + bool foundTarget = false; + float maxDist = 600f; + for (int i = 0; i < Main.maxNPCs; i++) { - if (Main.npc[num512].CanBeChasedBy(projectile, false)) + NPC npc = Main.npc[i]; + if (npc.CanBeChasedBy(projectile, false)) { - float num513 = Main.npc[num512].position.X + (float)(Main.npc[num512].width / 2); - float num514 = Main.npc[num512].position.Y + (float)(Main.npc[num512].height / 2); - float num515 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num513) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num514); - if (num515 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[num512].position, Main.npc[num512].width, Main.npc[num512].height)) + if (Vector2.Distance(projectile.Center, npc.Center) < maxDist && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) { - num508 = num515; - flag18 = true; + foundTarget = true; + break; } } } - if (flag18) + if (foundTarget) { - int num251 = Main.rand.Next(4, 9); - for (int num252 = 0; num252 < num251; num252++) + int projAmt = Main.rand.Next(4, 9); + for (int u = 0; u < projAmt; u++) { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(90, 121) * 0.1f; - int spore = Projectile.NewProjectile(projectile.Center.X - 4f, projectile.Center.Y, value15.X, value15.Y, ProjectileID.SporeGas + Main.rand.Next(3), projectile.damage, 1.5f, projectile.owner, 0f, 0f); + Vector2 source = new Vector2(projectile.Center.X - 4f, projectile.Center.Y); + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 90f, 120f); + int spore = Projectile.NewProjectile(source, velocity, ProjectileID.SporeGas + Main.rand.Next(3), projectile.damage, 1.5f, projectile.owner, 0f, 0f); Main.projectile[spore].minionSlots = 0f; Main.projectile[spore].Calamity().forceMinion = true; Main.projectile[spore].usesLocalNPCImmunity = true; diff --git a/Projectiles/Summon/SakuraBullet.cs b/Projectiles/Summon/SakuraBullet.cs index d742786f82..06852ff327 100644 --- a/Projectiles/Summon/SakuraBullet.cs +++ b/Projectiles/Summon/SakuraBullet.cs @@ -51,12 +51,26 @@ namespace CalamityMod.Projectiles.Summon } } } - else + else if (projectile.ai[0] != -1f) + { + NPC npc = Main.npc[(int)projectile.ai[0]]; + if ((npc.CanBeChasedBy(projectile, false) || npc.type == NPCID.DukeFishron) && npc.active) + { + float extraDistance = (npc.width / 2) + (npc.height / 2); + + if (Vector2.Distance(npc.Center, projectile.Center) < (maxDistance + extraDistance)) + { + center = npc.Center; + homeIn = true; + } + } + } + if (!homeIn) { for (int i = 0; i < Main.maxNPCs; i++) { NPC npc = Main.npc[i]; - if ((npc.CanBeChasedBy(projectile, false) || npc.type == NPCID.DukeFishron) && npc.active) + if ((npc.CanBeChasedBy(projectile, false) || (npc.type == NPCID.DukeFishron && (!npc.dontTakeDamage || npc.ai[0] > 9f))) && npc.active) { float extraDistance = (npc.width / 2) + (npc.height / 2); diff --git a/Projectiles/Summon/SandElementalHealer.cs b/Projectiles/Summon/SandElementalHealer.cs index ffa5c68efd..7085205f54 100644 --- a/Projectiles/Summon/SandElementalHealer.cs +++ b/Projectiles/Summon/SandElementalHealer.cs @@ -15,8 +15,8 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - DisplayName.SetDefault("Oxy's Waifu"); - Main.projFrames[projectile.type] = 5; + DisplayName.SetDefault("Sand Healer"); + Main.projFrames[projectile.type] = 6; Main.projPet[projectile.type] = true; ProjectileID.Sets.MinionSacrificable[projectile.type] = true; } @@ -44,15 +44,17 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - bool flag64 = projectile.type == ModContent.ProjectileType(); Player player = Main.player[projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); + if (!modPlayer.sandBoobWaifu && !modPlayer.allWaifus) { projectile.active = false; return; } - if (flag64) + + bool correctMinion = projectile.type == ModContent.ProjectileType(); + if (correctMinion) { if (player.dead) { @@ -63,17 +65,18 @@ namespace CalamityMod.Projectiles.Summon projectile.timeLeft = 2; } } + dust--; if (dust >= 0) { projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - int num501 = 50; - for (int num502 = 0; num502 < num501; num502++) + int dustAmt = 50; + for (int d = 0; d < dustAmt; d++) { - int num503 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 32, 0f, 0f, 0, default, 1f); - Main.dust[num503].velocity *= 2f; - Main.dust[num503].scale *= 1.15f; + int sand = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 32, 0f, 0f, 0, default, 1f); + Main.dust[sand].velocity *= 2f; + Main.dust[sand].scale *= 1.15f; } } if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) @@ -83,80 +86,76 @@ namespace CalamityMod.Projectiles.Summon player.MinionDamage()); projectile.damage = damage2; } + projectile.frameCounter++; if (projectile.frameCounter > 16) { projectile.frame++; projectile.frameCounter = 0; } - if (projectile.frame > 3) + if (projectile.frame >= Main.projFrames[projectile.type]) { projectile.frame = 0; } - if ((double)Math.Abs(projectile.velocity.X) > 0.2) + + if (Math.Abs(projectile.velocity.X) > 0.2f) { projectile.spriteDirection = -projectile.direction; } - float num636 = 100f; //150 - float num = (float)Main.rand.Next(90, 111) * 0.01f; - num *= Main.essScale; - Lighting.AddLight(projectile.Center, 0.7f * num, 0.6f * num, 0f * num); + + float lightScalar = (float)Main.rand.Next(90, 111) * 0.01f; + lightScalar *= Main.essScale; + Lighting.AddLight(projectile.Center, 0.7f * lightScalar, 0.6f * lightScalar, 0f * lightScalar); + projectile.MinionAntiClump(); + if (Vector2.Distance(player.Center, projectile.Center) > 400f) { projectile.ai[0] = 1f; projectile.tileCollide = false; projectile.netUpdate = true; } - bool flag26 = false; - if (!flag26) + + float safeDist = 100f; //150 + bool returning = false; + if (!returning) { - flag26 = projectile.ai[0] == 1f; + returning = projectile.ai[0] == 1f; } - float num650 = 7f; //6 - if (flag26) + float returnSpeed = 7f; //6 + if (returning) { - num650 = 18f; //15 + returnSpeed = 18f; //15 } - Vector2 center2 = projectile.Center; - Vector2 vector48 = player.Center - center2 + new Vector2(-250f, -60f); //-60 - float num651 = vector48.Length(); - if (num651 > 200f && num650 < 10f) //200 and 8 + Vector2 playerVec = player.Center - projectile.Center + new Vector2(-250f, -60f); //-60 + float playerDist = playerVec.Length(); + if (playerDist > 200f && returnSpeed < 10f) //200 and 8 { - num650 = 10f; //8 + returnSpeed = 10f; //8 } - if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + if (playerDist < safeDist && returning && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) { projectile.ai[0] = 0f; projectile.netUpdate = true; } - if (num651 > 2000f) + 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 (num651 > 70f) + if (playerDist > 70f) { - vector48.Normalize(); - vector48 *= num650; - projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; + playerVec.Normalize(); + playerVec *= returnSpeed; + projectile.velocity = (projectile.velocity * 40f + playerVec) / 41f; } else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) { projectile.velocity.X = -0.22f; projectile.velocity.Y = -0.12f; } - projectile.frameCounter++; - if (projectile.frameCounter > 16) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 4) - { - projectile.frame = 0; - } + if (projectile.ai[1] > 0f) { projectile.ai[1] += (float)Main.rand.Next(1, 4); @@ -172,25 +171,25 @@ namespace CalamityMod.Projectiles.Summon } if (projectile.ai[0] == 0f) { - int num658 = ModContent.ProjectileType(); + int healProj = ModContent.ProjectileType(); if (projectile.ai[1] == 0f && projectile.localAI[0] >= 120f) { projectile.ai[1] += 1f; if (Main.myPlayer == projectile.owner && player.statLife < player.statLifeMax2) { Main.PlaySound(SoundID.Dig, (int)projectile.position.X, (int)projectile.position.Y, 6); - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) + int dustAmt = 36; + for (int d = 0; d < dustAmt; d++) { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 107, vector7.X * 1.5f, vector7.Y * 1.5f, 100, new Color(0, 200, 0), 1f); - Main.dust[num228].noGravity = true; - Main.dust[num228].noLight = true; - Main.dust[num228].velocity = vector7; + Vector2 source = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; + source = source.RotatedBy((double)((float)(d - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + projectile.Center; + Vector2 dustVel = source - projectile.Center; + int green = Dust.NewDust(source + dustVel, 0, 0, 107, dustVel.X * 1.5f, dustVel.Y * 1.5f, 100, new Color(0, 200, 0), 1f); + Main.dust[green].noGravity = true; + Main.dust[green].noLight = true; + Main.dust[green].velocity = dustVel; } - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, -6f, num658, 0, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, -6f, healProj, 0, 0f, Main.myPlayer, 0f, 0f); } } } diff --git a/Projectiles/Summon/SandElementalHealer.png b/Projectiles/Summon/SandElementalHealer.png index 44c0f7eb77..b058b8fff2 100644 Binary files a/Projectiles/Summon/SandElementalHealer.png and b/Projectiles/Summon/SandElementalHealer.png differ diff --git a/Projectiles/Summon/SandElementalMinion.cs b/Projectiles/Summon/SandElementalMinion.cs index 2f60590d2d..b9793548d7 100644 --- a/Projectiles/Summon/SandElementalMinion.cs +++ b/Projectiles/Summon/SandElementalMinion.cs @@ -82,7 +82,7 @@ namespace CalamityMod.Projectiles.Summon player.MinionDamage()); projectile.damage = damage2; } - if ((double)Math.Abs(projectile.velocity.X) > 0.2) + if (Math.Abs(projectile.velocity.X) > 0.2f) { projectile.spriteDirection = -projectile.direction; } @@ -117,7 +117,7 @@ namespace CalamityMod.Projectiles.Summon } } } - else + if (!flag25) { for (int num645 = 0; num645 < Main.maxNPCs; num645++) { @@ -241,11 +241,16 @@ namespace CalamityMod.Projectiles.Summon projectile.ai[1] = 0f; projectile.netUpdate = true; } + + // Prevent firing immediately + if (projectile.localAI[0] < 120f) + projectile.localAI[0] += 1f; + if (projectile.ai[0] == 0f) { float scaleFactor3 = 11f; int num658 = ModContent.ProjectileType(); - if (flag25 && projectile.ai[1] == 0f) + if (flag25 && projectile.ai[1] == 0f && projectile.localAI[0] >= 120f) { projectile.ai[1] += 1f; if (Main.myPlayer == projectile.owner && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, vector46, 0, 0)) diff --git a/Projectiles/Summon/SandElementalMinion.png b/Projectiles/Summon/SandElementalMinion.png index 22e16e792d..a0b71ad531 100644 Binary files a/Projectiles/Summon/SandElementalMinion.png and b/Projectiles/Summon/SandElementalMinion.png differ diff --git a/Projectiles/Summon/SandnadoMinion.cs b/Projectiles/Summon/SandnadoMinion.cs index 059388b415..c39f019a34 100644 --- a/Projectiles/Summon/SandnadoMinion.cs +++ b/Projectiles/Summon/SandnadoMinion.cs @@ -79,7 +79,7 @@ namespace CalamityMod.Projectiles.Summon } projectile.MinionAntiClump(0.1f); Vector2 vector = projectile.position; - float num10 = 1200f; + float num10 = 1800f; bool flag = false; if (Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) { @@ -115,7 +115,7 @@ namespace CalamityMod.Projectiles.Summon } } } - else + if (!flag) { for (int k = 0; k < Main.maxNPCs; k++) { @@ -133,10 +133,10 @@ namespace CalamityMod.Projectiles.Summon } } } - float num16 = 1000f; + float num16 = 1200f; if (flag) { - num16 = 2500f; + num16 = 3000f; } if (Vector2.Distance(player.Center, projectile.Center) > num16) { @@ -191,8 +191,9 @@ namespace CalamityMod.Projectiles.Summon } if (num23 > 2000f) { - projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.width / 2); + projectile.position.X = player.Center.X - (float)(projectile.width / 2); + projectile.position.Y = player.Center.Y - (float)(projectile.width / 2); + projectile.netUpdate = true; } if (Math.Abs(vector6.X) > 40f || Math.Abs(vector6.Y) > 10f) { @@ -242,7 +243,7 @@ namespace CalamityMod.Projectiles.Summon projectile.ai[1] += 1f; } } - if (projectile.ai[1] > 60f) + if (projectile.ai[1] > 75f) { projectile.ai[1] = 0f; projectile.netUpdate = true; diff --git a/Projectiles/Summon/Shellfish.cs b/Projectiles/Summon/Shellfish.cs index 8f0f6249e4..6143ba4ff0 100644 --- a/Projectiles/Summon/Shellfish.cs +++ b/Projectiles/Summon/Shellfish.cs @@ -60,9 +60,17 @@ namespace CalamityMod.Projectiles.Summon } spawnDust = false; } - bool flag64 = projectile.type == ModContent.ProjectileType(); + if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int damage2 = (int)((float)modProj.spawnedPlayerMinionProjectileDamageValue / + modProj.spawnedPlayerMinionDamageValue * + player.MinionDamage()); + projectile.damage = damage2; + } + + bool correctMinion = projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); - if (flag64) + if (correctMinion) { if (player.dead) { @@ -73,6 +81,7 @@ namespace CalamityMod.Projectiles.Summon projectile.timeLeft = 2; } } + projectile.frameCounter++; if (projectile.frameCounter > 3) { @@ -83,19 +92,10 @@ namespace CalamityMod.Projectiles.Summon { projectile.frame = 0; } + if (projectile.ai[0] == 0f) { - //lineColor == 1 means it is spawned from Mollusk Armor rather than the weapon - projectile.damage = (int)((modProj.lineColor == 1 ? 140f : 70f) * player.MinionDamage()); - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)((float)modProj.spawnedPlayerMinionProjectileDamageValue / - modProj.spawnedPlayerMinionDamageValue * - player.MinionDamage()); - projectile.damage = damage2; - } projectile.ai[1] += 1f; - Vector2 vector46 = projectile.position; if (!fly) { projectile.tileCollide = true; @@ -104,7 +104,7 @@ namespace CalamityMod.Projectiles.Summon float playerDistance = vector48.Length(); if (projectile.velocity.Y == 0f && (projectile.velocity.X != 0f || playerDistance > 200f)) { - switch (Main.rand.Next(1, 3)) + switch (Main.rand.Next(1, 4)) { case 1: @@ -121,7 +121,7 @@ namespace CalamityMod.Projectiles.Summon } } projectile.velocity.Y += 0.3f; - float num633 = 1000f; + float maxDistance = 1000f; bool chaseNPC = false; float npcPositionX = 0f; if (player.HasMinionAttackTargetNPC) @@ -129,29 +129,25 @@ namespace CalamityMod.Projectiles.Summon NPC npc = Main.npc[player.MinionAttackTargetNPC]; if (npc.CanBeChasedBy(projectile, false)) { - float num646 = Vector2.Distance(npc.Center, projectile.Center); - if (!chaseNPC && num646 < num633) + float npcDist = Vector2.Distance(npc.Center, projectile.Center); + if (!chaseNPC && npcDist < maxDistance) { - num633 = num646; - vector46 = npc.Center; - npcPositionX = npc.position.X; + npcPositionX = npc.Center.X; chaseNPC = true; } } } - else + if (!chaseNPC) { - for (int num645 = 0; num645 < Main.maxNPCs; num645++) + for (int index = 0; index < Main.maxNPCs; index++) { - NPC npcTarget = Main.npc[num645]; + NPC npcTarget = Main.npc[index]; if (npcTarget.CanBeChasedBy(projectile, false)) { - float num646 = Vector2.Distance(npcTarget.Center, projectile.Center); - if (!chaseNPC && num646 < num633) + float npcDist = Vector2.Distance(npcTarget.Center, projectile.Center); + if (!chaseNPC && npcDist < maxDistance) { - num633 = num646; - vector46 = npcTarget.Center; - npcPositionX = npcTarget.position.X; + npcPositionX = npcTarget.Center.X; chaseNPC = true; } } @@ -211,7 +207,7 @@ namespace CalamityMod.Projectiles.Summon { if (player.position.X - projectile.position.X > 0f) { - switch (Main.rand.Next(1, 3)) + switch (Main.rand.Next(1, 4)) { case 1: projectile.velocity.X += 0.05f; @@ -233,7 +229,7 @@ namespace CalamityMod.Projectiles.Summon } else { - switch (Main.rand.Next(1, 3)) + switch (Main.rand.Next(1, 4)) { case 1: projectile.velocity.X -= 0.05f; @@ -260,7 +256,7 @@ namespace CalamityMod.Projectiles.Summon { if (projectile.velocity.X > 0.5f) { - switch (Main.rand.Next(1, 3)) + switch (Main.rand.Next(1, 4)) { case 1: projectile.velocity.X -= 0.05f; @@ -277,7 +273,7 @@ namespace CalamityMod.Projectiles.Summon } else if (projectile.velocity.X < -0.5f) { - switch (Main.rand.Next(1, 3)) + switch (Main.rand.Next(1, 4)) { case 1: projectile.velocity.X += 0.05f; @@ -302,12 +298,11 @@ namespace CalamityMod.Projectiles.Summon } else if (fly) { - Vector2 center2 = projectile.Center; - Vector2 vector48 = player.Center - center2 + new Vector2(0f, 0f); - float playerDistance = vector48.Length(); - vector48.Normalize(); - vector48 *= 14f; - projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; + Vector2 playerVec = player.Center - projectile.Center + new Vector2(0f, 0f); + float playerDistance = playerVec.Length(); + playerVec.Normalize(); + playerVec *= 14f; + projectile.velocity = (projectile.velocity * 40f + playerVec) / 41f; projectile.rotation = projectile.velocity.X * 0.03f; if (playerDistance > 1500f) @@ -336,11 +331,11 @@ namespace CalamityMod.Projectiles.Summon } } } - if ((double)projectile.velocity.X > 0.25) + if (projectile.velocity.X > 0.25f) { projectile.spriteDirection = -1; } - else if ((double)projectile.velocity.X < -0.25) + else if (projectile.velocity.X < -0.25f) { projectile.spriteDirection = 1; } @@ -349,37 +344,36 @@ namespace CalamityMod.Projectiles.Summon { projectile.rotation = 0; projectile.tileCollide = false; - int num988 = 10; - bool flag54 = false; - bool flag55 = false; + bool breakAway = false; + bool spawnDust = false; projectile.localAI[0] += 1f; if (projectile.localAI[0] % 30f == 0f) { - flag55 = true; + spawnDust = true; } - int num989 = (int)projectile.ai[1]; - if (projectile.localAI[0] >= (float)(60000 * num988)) //tryna make it stay on there "forever" without glitching + int npcIndex = (int)projectile.ai[1]; + if (projectile.localAI[0] >= 600000f) //tryna make it stay on there "forever" without glitching { - flag54 = true; + breakAway = true; } - else if (num989 < 0 || num989 >= Main.maxNPCs) + else if (npcIndex < 0 || npcIndex >= Main.maxNPCs) { - flag54 = true; + breakAway = true; } - else if (Main.npc[num989].active && !Main.npc[num989].dontTakeDamage && Main.npc[num989].defense < 9999) + else if (Main.npc[npcIndex].active && !Main.npc[npcIndex].dontTakeDamage && Main.npc[npcIndex].defense < 9999) { - projectile.Center = Main.npc[num989].Center - projectile.velocity * 2f; - projectile.gfxOffY = Main.npc[num989].gfxOffY; - if (flag55) + projectile.Center = Main.npc[npcIndex].Center - projectile.velocity * 2f; + projectile.gfxOffY = Main.npc[npcIndex].gfxOffY; + if (spawnDust) { - Main.npc[num989].HitEffect(0, 1.0); + Main.npc[npcIndex].HitEffect(0, 1.0); } } else { - flag54 = true; + breakAway = true; } - if (flag54) + if (breakAway) { projectile.ai[0] = 0f; projectile.velocity.X = 0f; @@ -390,60 +384,71 @@ namespace CalamityMod.Projectiles.Summon public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { + Player player = Main.player[projectile.owner]; Rectangle myRect = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); + if (projectile.owner == Main.myPlayer) { - for (int i = 0; i < Main.maxNPCs; i++) + for (int npcIndex = 0; npcIndex < Main.maxNPCs; npcIndex++) { - if (Main.npc[i].active && !Main.npc[i].dontTakeDamage && Main.npc[i].defense < 9999 && - ((projectile.friendly && (!Main.npc[i].friendly || projectile.type == 318 || (Main.npc[i].type == NPCID.Guide && projectile.owner < 255 && Main.player[projectile.owner].killGuide) || (Main.npc[i].type == NPCID.Clothier && projectile.owner < 255 && Main.player[projectile.owner].killClothier))) || - (projectile.hostile && Main.npc[i].friendly && !Main.npc[i].dontTakeDamageFromHostiles)) && (projectile.owner < 0 || Main.npc[i].immune[projectile.owner] == 0 || projectile.maxPenetrate == 1)) + NPC npc = Main.npc[npcIndex]; + //covers most edge cases like voodoo dolls + if (npc.active && !npc.dontTakeDamage && npc.defense < 9999 && + ((projectile.friendly && (!npc.friendly || (npc.type == NPCID.Guide && projectile.owner < Main.maxPlayers && player.killGuide) || (npc.type == NPCID.Clothier && projectile.owner < Main.maxPlayers && player.killClothier))) || + (projectile.hostile && npc.friendly && !npc.dontTakeDamageFromHostiles)) && (projectile.owner < 0 || npc.immune[projectile.owner] == 0 || projectile.maxPenetrate == 1)) { - if (Main.npc[i].noTileCollide || !projectile.ownerHitCheck || projectile.CanHit(Main.npc[i])) + if (npc.noTileCollide || !projectile.ownerHitCheck || projectile.CanHit(npc)) { - bool flag3; - if (Main.npc[i].type == NPCID.SolarCrawltipedeTail) + bool stickingToNPC; + //Solar Crawltipede tail has special collision + if (npc.type == NPCID.SolarCrawltipedeTail) { - Rectangle rect = Main.npc[i].getRect(); + Rectangle rect = npc.getRect(); int num5 = 8; rect.X -= num5; rect.Y -= num5; rect.Width += num5 * 2; rect.Height += num5 * 2; - flag3 = projectile.Colliding(myRect, rect); + stickingToNPC = projectile.Colliding(myRect, rect); } else { - flag3 = projectile.Colliding(myRect, Main.npc[i].getRect()); + stickingToNPC = projectile.Colliding(myRect, npc.getRect()); } - if (flag3) + if (stickingToNPC) { - if (Main.npc[i].reflectingProjectiles && projectile.CanReflect()) + //reflect projectile if the npc can reflect it (like Selenians) + if (npc.reflectingProjectiles && projectile.CanReflect()) { - Main.npc[i].ReflectProjectile(projectile.whoAmI); + npc.ReflectProjectile(projectile.whoAmI); return; } + + //let the projectile know it is sticking and the npc it is sticking too projectile.ai[0] = 1f; - projectile.ai[1] = (float)i; - projectile.velocity = (Main.npc[i].Center - projectile.Center) * 0.75f; + projectile.ai[1] = (float)npcIndex; + + //follow the NPC + projectile.velocity = (npc.Center - projectile.Center) * 0.75f; + projectile.netUpdate = true; - projectile.StatusNPC(i); - projectile.damage = 0; - int num28 = 10; - Point[] array2 = new Point[num28]; - int num29 = 0; - for (int l = 0; l < Main.projectile.Length; l++) + + //Count how many projectiles are attached, delete as necessary + Point[] array2 = new Point[10]; + int projCount = 0; + for (int projIndex = 0; projIndex < Main.maxProjectiles; projIndex++) { - if (l != projectile.whoAmI && Main.projectile[l].active && Main.projectile[l].owner == Main.myPlayer && Main.projectile[l].type == projectile.type && Main.projectile[l].ai[0] == 1f && Main.projectile[l].ai[1] == (float)i) + Projectile proj = Main.projectile[projIndex]; + if (projIndex != projectile.whoAmI && proj.active && proj.owner == Main.myPlayer && proj.type == projectile.type && proj.ai[0] == 1f && proj.ai[1] == (float)npcIndex) { - array2[num29++] = new Point(l, Main.projectile[l].timeLeft); - if (num29 >= array2.Length) + array2[projCount++] = new Point(projIndex, proj.timeLeft); + if (projCount >= array2.Length) { break; } } } - if (num29 >= array2.Length) + if (projCount >= array2.Length) { int num30 = 0; for (int m = 1; m < array2.Length; m++) @@ -471,14 +476,7 @@ namespace CalamityMod.Projectiles.Summon return null; } - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; - } + public override bool CanDamage() => projectile.ai[0] == 0f; public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { diff --git a/Projectiles/Summon/SilvaCrystal.cs b/Projectiles/Summon/SilvaCrystal.cs index c5282b01c8..b6261124df 100644 --- a/Projectiles/Summon/SilvaCrystal.cs +++ b/Projectiles/Summon/SilvaCrystal.cs @@ -67,19 +67,18 @@ namespace CalamityMod.Projectiles.Summon projectile.timeLeft = 2; } } - projectile.position.X = player.Center.X - (float)(projectile.width / 2); - projectile.position.Y = player.Center.Y - (float)(projectile.height / 2) + player.gfxOffY - 60f; + projectile.Center = player.Center + Vector2.UnitY * (player.gfxOffY - 60f); if (player.gravDir == -1f) { - projectile.position.Y = projectile.position.Y + 120f; - projectile.rotation = 3.14f; + projectile.position.Y += 120f; + projectile.rotation = MathHelper.Pi; } else { projectile.rotation = 0f; } - projectile.position.X = (float)(int)projectile.position.X; - projectile.position.Y = (float)(int)projectile.position.Y; + projectile.position.X = (int)projectile.position.X; + projectile.position.Y = (int)projectile.position.Y; float num1072 = 1500f; projectile.velocity = Vector2.Zero; projectile.alpha -= 5; diff --git a/Projectiles/Summon/SirenSongFriendly.png b/Projectiles/Summon/SirenSongFriendly.png index c2832ae6e8..1738907123 100644 Binary files a/Projectiles/Summon/SirenSongFriendly.png and b/Projectiles/Summon/SirenSongFriendly.png differ diff --git a/Projectiles/Summon/SiriusMinion.cs b/Projectiles/Summon/SiriusMinion.cs index 3631108e70..a90ae92670 100644 --- a/Projectiles/Summon/SiriusMinion.cs +++ b/Projectiles/Summon/SiriusMinion.cs @@ -7,157 +7,149 @@ using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Summon { - public class SiriusMinion : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sirius"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } + public class SiriusMinion : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sirius"); + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } - public override void SetDefaults() - { - projectile.width = 38; - projectile.height = 48; - 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 SetDefaults() + { + projectile.width = 38; + projectile.height = 48; + 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, 1f, 0.5f, 5f); - bool flag64 = projectile.type == ModContent.ProjectileType(); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); - player.AddBuff(ModContent.BuffType(), 3600); - if (flag64) - { - if (player.dead) - { - modPlayer.sirius = false; - } - if (modPlayer.sirius) - { - projectile.timeLeft = 2; - } - } - projectile.minionSlots = projectile.ai[0]; - 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 = 3.14f; - } - else - { - projectile.rotation = 0f; - } - projectile.position.X = (float)(int)projectile.position.X; - projectile.position.Y = (float)(int)projectile.position.Y; - float num395 = (float)Main.mouseTextColor / 200f - 0.35f; - num395 *= 0.2f; - projectile.scale = num395 + 0.95f; - if (projectile.localAI[0] == 0f) - { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - int num501 = 50; - for (int num502 = 0; num502 < num501; num502++) - { - int num503 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 20, 0f, 0f, 0, default, 1f); - Main.dust[num503].velocity *= 2f; - Main.dust[num503].scale *= 1.15f; - } - projectile.localAI[0] += 1f; - } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - projectile.damage = damage2; - } - if (projectile.owner == Main.myPlayer) - { - if (projectile.ai[1] != 0f) - { - projectile.ai[1] -= 1f; - return; - } - float num396 = projectile.position.X; - float num397 = projectile.position.Y; - float minDistance = 7000f; - bool flag11 = false; - if (player.HasMinionAttackTargetNPC) - { - NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) - { - float num539 = npc.position.X + (float)(npc.width / 2); - float num540 = npc.position.Y + (float)(npc.height / 2); - float num541 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num539) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num540); - if (num541 < minDistance) - { - num396 = num539; - num397 = num540; - flag11 = true; - } - } - } - else - { - for (int num399 = 0; num399 < Main.npc.Length; num399++) - { - if (Main.npc[num399].CanBeChasedBy(projectile, false)) - { - float num400 = Main.npc[num399].position.X + (float)(Main.npc[num399].width / 2); - float num401 = Main.npc[num399].position.Y + (float)(Main.npc[num399].height / 2); - float num402 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num400) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num401); - if (num402 < minDistance) - { - minDistance = num402; - num396 = num400; - num397 = num401; - flag11 = true; - } - } - } - } - if (flag11) - { - float num403 = 15f; - Vector2 vector29 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num404 = num396 - vector29.X; - float num405 = num397 - vector29.Y; - float num406 = (float)Math.Sqrt((double)(num404 * num404 + num405 * num405)); - num406 = num403 / num406; - num404 *= num406; - num405 *= num406; + public override void AI() + { + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + + bool correctMinion = projectile.type == ModContent.ProjectileType(); + if (correctMinion) + { + if (player.dead) + { + modPlayer.sirius = false; + } + if (modPlayer.sirius) + { + projectile.timeLeft = 2; + } + } + player.AddBuff(ModContent.BuffType(), 3600); + + projectile.minionSlots = projectile.ai[0]; + Lighting.AddLight(projectile.Center, 1f, 0.5f, 5f); + + projectile.Center = player.Center + Vector2.UnitY * (player.gfxOffY - 60f); + if (player.gravDir == -1f) + { + projectile.position.Y += 120f; + projectile.rotation = MathHelper.Pi; + } + else + { + projectile.rotation = 0f; + } + projectile.position.X = (int)projectile.position.X; + projectile.position.Y = (int)projectile.position.Y; + + float scalar = (float)Main.mouseTextColor / 200f - 0.35f; + scalar *= 0.2f; + projectile.scale = scalar + 0.95f; + + if (projectile.localAI[0] == 0f) + { + projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + int dustAmt = 50; + for (int d = 0; d < dustAmt; d++) + { + int sirius = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 20, 0f, 0f, 0, default, 1f); + Main.dust[sirius].velocity *= 2f; + Main.dust[sirius].scale *= 1.15f; + } + projectile.localAI[0] += 1f; + } + + if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); + projectile.damage = damage2; + } + if (projectile.owner == Main.myPlayer) + { + if (projectile.ai[1] != 0f) + { + projectile.ai[1] -= 1f; + return; + } + Vector2 targetVec = projectile.position; + float maxDistance = 7000f; + bool hasTarget = false; + if (player.HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) + { + float extraDistance = (npc.width / 2) + (npc.height / 2); + + if (Vector2.Distance(npc.Center, projectile.Center) < (maxDistance + extraDistance)) + { + targetVec = npc.Center; + hasTarget = true; + } + } + } + if (!hasTarget) + { + for (int i = 0; i < Main.maxNPCs; i++) + { + NPC npc = Main.npc[i]; + if (npc.CanBeChasedBy(projectile, false)) + { + float extraDistance = (npc.width / 2) + (npc.height / 2); + + if (Vector2.Distance(npc.Center, projectile.Center) < (maxDistance + extraDistance)) + { + targetVec = npc.Center; + hasTarget = true; + } + } + } + } + if (hasTarget) + { + float projSpeed = 15f; + Vector2 source = new Vector2(projectile.Center.X - 4f, projectile.Center.Y); + Vector2 velocity = targetVec - projectile.Center; + float targetDist = velocity.Length(); + targetDist = projSpeed / targetDist; + velocity.X *= targetDist; + velocity.Y *= targetDist; float damageMult = ((float)Math.Log(projectile.ai[0], MathHelper.E)) + 1f; - int beam = Projectile.NewProjectile(projectile.Center.X - 4f, projectile.Center.Y, num404, num405, ModContent.ProjectileType(), (int)(projectile.damage * damageMult), projectile.knockBack, projectile.owner); + int beam = Projectile.NewProjectile(source, velocity, ModContent.ProjectileType(), (int)(projectile.damage * damageMult), projectile.knockBack, projectile.owner); Main.projectile[beam].penetrate = (int)projectile.ai[0]; - projectile.ai[1] = 30f; - } - } - } + projectile.ai[1] = 30f; + } + } + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(200, 200, 200, 200); - } + public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, 200); - public override bool CanDamage() - { - return false; - } - } + public override bool CanDamage() => false; + } } diff --git a/Projectiles/Summon/SolarGod.cs b/Projectiles/Summon/SolarGod.cs index af68240636..25edbb53b3 100644 --- a/Projectiles/Summon/SolarGod.cs +++ b/Projectiles/Summon/SolarGod.cs @@ -49,19 +49,18 @@ namespace CalamityMod.Projectiles.Summon projectile.timeLeft = 2; } } - projectile.position.X = player.Center.X - (float)(projectile.width / 2); - projectile.position.Y = player.Center.Y - (float)(projectile.height / 2) + player.gfxOffY - 60f; + projectile.Center = player.Center + Vector2.UnitY * (player.gfxOffY - 60f); if (player.gravDir == -1f) { - projectile.position.Y = projectile.position.Y + 150f; - projectile.rotation = 3.14f; + projectile.position.Y += 120f; + projectile.rotation = MathHelper.Pi; } else { projectile.rotation = 0f; } - projectile.position.X = (float)(int)projectile.position.X; - projectile.position.Y = (float)(int)projectile.position.Y; + projectile.position.X = (int)projectile.position.X; + projectile.position.Y = (int)projectile.position.Y; float num395 = (float)Main.mouseTextColor / 200f - 0.35f; num395 *= 0.2f; projectile.scale = num395 + 0.95f; @@ -112,11 +111,11 @@ namespace CalamityMod.Projectiles.Summon } } } - else + if (!flag11) { for (int num399 = 0; num399 < Main.maxNPCs; num399++) { - if (Main.npc[num399].CanBeChasedBy(projectile, true)) + if (Main.npc[num399].CanBeChasedBy(projectile, false)) { float num400 = Main.npc[num399].position.X + (float)(Main.npc[num399].width / 2); float num401 = Main.npc[num399].position.Y + (float)(Main.npc[num399].height / 2); diff --git a/Projectiles/Summon/SolarPixie.cs b/Projectiles/Summon/SolarPixie.cs index 8a253d29cc..4a2288c4e2 100644 --- a/Projectiles/Summon/SolarPixie.cs +++ b/Projectiles/Summon/SolarPixie.cs @@ -49,19 +49,18 @@ namespace CalamityMod.Projectiles.Summon projectile.timeLeft = 2; } } - projectile.position.X = player.Center.X - (float)(projectile.width / 2); - projectile.position.Y = player.Center.Y - (float)(projectile.height / 2) + player.gfxOffY - 60f; + projectile.Center = player.Center + Vector2.UnitY * (player.gfxOffY - 60f); if (player.gravDir == -1f) { - projectile.position.Y = projectile.position.Y + 140f; - projectile.rotation = 3.14f; + projectile.position.Y += 120f; + projectile.rotation = MathHelper.Pi; } else { projectile.rotation = 0f; } - projectile.position.X = (float)(int)projectile.position.X; - projectile.position.Y = (float)(int)projectile.position.Y; + projectile.position.X = (int)projectile.position.X; + projectile.position.Y = (int)projectile.position.Y; float num395 = (float)Main.mouseTextColor / 200f - 0.35f; num395 *= 0.2f; projectile.scale = num395 + 0.95f; @@ -112,11 +111,11 @@ namespace CalamityMod.Projectiles.Summon } } } - else + if (!flag11) { for (int num399 = 0; num399 < Main.maxNPCs; num399++) { - if (Main.npc[num399].CanBeChasedBy(projectile, true)) + if (Main.npc[num399].CanBeChasedBy(projectile, false)) { float num400 = Main.npc[num399].position.X + (float)(Main.npc[num399].width / 2); float num401 = Main.npc[num399].position.Y + (float)(Main.npc[num399].height / 2); diff --git a/Projectiles/Summon/Spikecrag.cs b/Projectiles/Summon/Spikecrag.cs index c047fb1e4f..2d0a91b2c3 100644 --- a/Projectiles/Summon/Spikecrag.cs +++ b/Projectiles/Summon/Spikecrag.cs @@ -60,6 +60,8 @@ namespace CalamityMod.Projectiles.Summon projectile.velocity.Y = 10f; } + projectile.StickToTiles(false, false); + if (projectile.ai[0] > 0f) { projectile.ai[0] -= 1f; @@ -75,9 +77,10 @@ namespace CalamityMod.Projectiles.Summon { float extraDistance = (float)(Main.npc[i].width / 2) + (Main.npc[i].height / 2); - if (Vector2.Distance(Main.npc[i].Center, projectile.Center) < (maxDistance + extraDistance)) + if (Vector2.Distance(Main.npc[i].Center, projectile.Center) < (maxDistance + extraDistance) && Collision.CanHit(projectile.Center, projectile.width, projectile.height, Main.npc[i].Center, Main.npc[i].width, Main.npc[i].height)) { homeIn = true; + break; } } } diff --git a/Projectiles/Summon/Urchin.cs b/Projectiles/Summon/Urchin.cs index 225bfe34ea..930f055101 100644 --- a/Projectiles/Summon/Urchin.cs +++ b/Projectiles/Summon/Urchin.cs @@ -34,7 +34,6 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - bool flag64 = projectile.type == ModContent.ProjectileType(); Player player = Main.player[projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); if (!modPlayer.urchin) @@ -42,7 +41,8 @@ namespace CalamityMod.Projectiles.Summon projectile.active = false; return; } - if (flag64) + bool correctMinion = projectile.type == ModContent.ProjectileType(); + if (correctMinion) { if (player.dead) { @@ -58,12 +58,12 @@ namespace CalamityMod.Projectiles.Summon { projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - int num501 = 50; - for (int num502 = 0; num502 < num501; num502++) + int dustAmt = 50; + for (int d = 0; d < dustAmt; d++) { - int num503 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 179, 0f, 0f, 0, default, 1f); - Main.dust[num503].velocity *= 2f; - Main.dust[num503].scale *= 1.15f; + int index = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 179, 0f, 0f, 0, default, 1f); + Main.dust[index].velocity *= 2f; + Main.dust[index].scale *= 1.15f; } } if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) @@ -73,22 +73,21 @@ namespace CalamityMod.Projectiles.Summon player.MinionDamage()); projectile.damage = damage2; } - float num395 = (float)Main.mouseTextColor / 200f - 0.35f; - num395 *= 0.2f; - projectile.scale = num395 + 0.95f; - projectile.position.X = player.Center.X - (float)(projectile.width / 2); - projectile.position.Y = player.Center.Y - (float)(projectile.height / 2) + player.gfxOffY - 60f; + float scalar = (float)Main.mouseTextColor / 200f - 0.35f; + scalar *= 0.2f; + projectile.scale = scalar + 0.95f; + projectile.Center = player.Center + Vector2.UnitY * (player.gfxOffY - 60f); if (player.gravDir == -1f) { - projectile.position.Y = projectile.position.Y + 120f; - projectile.rotation = 3.14f; + projectile.position.Y += 120f; + projectile.rotation = MathHelper.Pi; } else { projectile.rotation = 0f; } - projectile.position.X = (float)(int)projectile.position.X; - projectile.position.Y = (float)(int)projectile.position.Y; + projectile.position.X = (int)projectile.position.X; + projectile.position.Y = (int)projectile.position.Y; if (projectile.owner == Main.myPlayer) { if (projectile.ai[0] != 0f) @@ -96,35 +95,28 @@ namespace CalamityMod.Projectiles.Summon projectile.ai[0] -= 1f; return; } - bool flag18 = false; - float num508 = 300f; - for (int num512 = 0; num512 < Main.maxNPCs; num512++) + bool foundTarget = false; + float maxDist = 300f; + for (int i = 0; i < Main.maxNPCs; i++) { - if (Main.npc[num512].CanBeChasedBy(projectile, false)) + NPC npc = Main.npc[i]; + if (npc.CanBeChasedBy(projectile, false)) { - float num513 = Main.npc[num512].position.X + (float)(Main.npc[num512].width / 2); - float num514 = Main.npc[num512].position.Y + (float)(Main.npc[num512].height / 2); - float num515 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num513) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num514); - if (num515 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[num512].position, Main.npc[num512].width, Main.npc[num512].height)) + if (Vector2.Distance(projectile.Center, npc.Center) < maxDist && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) { - num508 = num515; - flag18 = true; + foundTarget = true; + break; } } } - if (flag18) + if (foundTarget) { - int num251 = Main.rand.Next(3, 7); - for (int num252 = 0; num252 < num251; num252++) + int projAmt = Main.rand.Next(3, 7); + for (int u = 0; u < projAmt; u++) { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - int spore = Projectile.NewProjectile(projectile.Center.X - 4f, projectile.Center.Y, value15.X, value15.Y, ModContent.ProjectileType(), projectile.damage, 1f, projectile.owner, 0f, 0f); + Vector2 source = new Vector2(projectile.Center.X - 4f, projectile.Center.Y); + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); + int spore = Projectile.NewProjectile(source, velocity, ModContent.ProjectileType(), projectile.damage, 1f, projectile.owner, 0f, 0f); Main.projectile[spore].minion = true; Main.projectile[spore].minionSlots = 0f; } diff --git a/Projectiles/Summon/Valkyrie.cs b/Projectiles/Summon/Valkyrie.cs index 0c492c0bc0..f2f17b540c 100644 --- a/Projectiles/Summon/Valkyrie.cs +++ b/Projectiles/Summon/Valkyrie.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Summon projectile.friendly = true; projectile.ignoreWater = true; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + projectile.localNPCHitCooldown = 20; projectile.minionSlots = 0f; projectile.timeLeft = 18000; projectile.penetrate = -1; diff --git a/Projectiles/Summon/VileFeederProjectile.cs b/Projectiles/Summon/VileFeederProjectile.cs index 1cc1503570..320bb5d722 100644 --- a/Projectiles/Summon/VileFeederProjectile.cs +++ b/Projectiles/Summon/VileFeederProjectile.cs @@ -88,7 +88,7 @@ namespace CalamityMod.Projectiles.Summon } } } - else + if (!flag10) { for (int num376 = 0; num376 < Main.maxNPCs; num376++) { diff --git a/Projectiles/Summon/VileFeederSummon.cs b/Projectiles/Summon/VileFeederSummon.cs index f226988dca..c6b57bde79 100644 --- a/Projectiles/Summon/VileFeederSummon.cs +++ b/Projectiles/Summon/VileFeederSummon.cs @@ -10,70 +10,76 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Summon { - public class VileFeederSummon : ModProjectile - { - private bool spawnDust = true; - private float attackCooldown = 0f; + public class VileFeederSummon : ModProjectile + { + private bool spawnDust = true; private int eaterCooldown = 0; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Baby Eater"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Baby Eater"); + Main.projFrames[projectile.type] = 4; + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minionSlots = 1f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - projectile.minion = true; - } + public override void SetDefaults() + { + projectile.width = projectile.height = 30; + projectile.netImportant = true; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.minionSlots = 1f; + projectile.timeLeft = 18000; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.timeLeft *= 5; + projectile.minion = true; + } - public override void AI() - { - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); + public override void AI() + { + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); - if (spawnDust) - { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) - { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 7, vector7.X * 1.75f, vector7.Y * 1.75f, 100, default, 1.1f); - Main.dust[num228].noGravity = true; - Main.dust[num228].velocity = vector7; - } - spawnDust = false; - } + if (spawnDust) + { + projectile.Calamity().lineColor = -1; + projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + int dustAmt = 36; + for (int d = 0; d < dustAmt; d++) + { + Vector2 source = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; + source = source.RotatedBy((double)((float)(d - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + projectile.Center; + Vector2 dustVel = source - projectile.Center; + int num228 = Dust.NewDust(source + dustVel, 0, 0, 7, dustVel.X * 1.75f, dustVel.Y * 1.75f, 100, default, 1.1f); + Main.dust[num228].noGravity = true; + Main.dust[num228].velocity = dustVel; + } + spawnDust = false; + } + if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue * + player.MinionDamage()); + projectile.damage = damage2; + } - bool correctMinion = projectile.type == ModContent.ProjectileType(); - player.AddBuff(ModContent.BuffType(), 3600); - if (correctMinion) - { - if (player.dead) - { - modPlayer.vileFeeder = false; - } - if (modPlayer.vileFeeder) - { - projectile.timeLeft = 2; - } - } + bool correctMinion = projectile.type == ModContent.ProjectileType(); + player.AddBuff(ModContent.BuffType(), 3600); + if (correctMinion) + { + if (player.dead) + { + modPlayer.vileFeeder = false; + } + if (modPlayer.vileFeeder) + { + projectile.timeLeft = 2; + } + } if (eaterCooldown < 0) eaterCooldown = 0; @@ -82,15 +88,7 @@ namespace CalamityMod.Projectiles.Summon { if (eaterCooldown > 0) eaterCooldown--; - projectile.damage = (int)(VileFeeder.BaseDamage * player.MinionDamage()); - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - projectile.damage = damage2; - } - projectile.MinionAntiClump(); + projectile.ChargingMinionAI(640f, 1100f, 2400f, 150f, 0, 40f, 8f, 4f, 40f, 8f, false, false); projectile.frameCounter++; if (projectile.frameCounter > 3) { @@ -102,199 +100,46 @@ namespace CalamityMod.Projectiles.Summon projectile.frame = 0; } projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(270); - - bool flag24 = false; - if (projectile.ai[0] == 2f) - { - attackCooldown += 1f; - projectile.extraUpdates = 1; - if (attackCooldown > 40f) - { - attackCooldown = 1f; - projectile.ai[0] = 0f; - projectile.extraUpdates = 0; - projectile.numUpdates = 0; - projectile.netUpdate = true; - } - else - { - flag24 = true; - } - } - if (flag24) - { - return; - } - - Vector2 vector46 = projectile.position; - float num633 = 640f; //40 block detection range - bool targetFound = false; - if (player.HasMinionAttackTargetNPC) - { - NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) - { - float npcDist = Vector2.Distance(npc.Center, projectile.Center); - if (npcDist < num633 && !targetFound && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) - { - num633 = npcDist; - vector46 = npc.Center; - targetFound = true; - } - } - } - else - { - for (int num645 = 0; num645 < Main.maxNPCs; num645++) - { - NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false)) - { - float npcDist = Vector2.Distance(nPC2.Center, projectile.Center); - if (npcDist < num633 && !targetFound && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC2.position, nPC2.width, nPC2.height)) - { - num633 = npcDist; - vector46 = nPC2.Center; - targetFound = true; - } - } - } - } - float maxPlayerRange = 1100f; - if (targetFound) - { - maxPlayerRange = 2400f; - } - if (Vector2.Distance(player.Center, projectile.Center) > maxPlayerRange) - { - projectile.ai[0] = 1f; - projectile.netUpdate = true; - } - if (targetFound && projectile.ai[0] == 0f) - { - Vector2 vector47 = vector46 - projectile.Center; - float num648 = vector47.Length(); - vector47.Normalize(); - if (num648 > 200f) - { - float scaleFactor2 = 8f; - vector47 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - else - { - float num649 = 4f; - vector47 *= -num649; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - } - else - { - bool flag26 = false; - if (!flag26) - { - flag26 = projectile.ai[0] == 1f; - } - float num650 = 6f; - if (flag26) - { - num650 = 15f; - } - Vector2 center2 = projectile.Center; - Vector2 vector48 = player.Center - center2 + new Vector2(0f, -60f); - float playerDist = vector48.Length(); - if (playerDist > 200f && num650 < 8f) - { - num650 = 8f; - } - if (playerDist < 150f && 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 (attackCooldown > 0f) - { - attackCooldown += (float)Main.rand.Next(1, 4); - } - if (attackCooldown > 40f) - { - attackCooldown = 0f; - projectile.netUpdate = true; - } - if (projectile.ai[0] == 0f) - { - if (attackCooldown == 0f && targetFound && num633 < 500f) - { - attackCooldown += 1f; - if (Main.myPlayer == projectile.owner) - { - projectile.ai[0] = 2f; - Vector2 value20 = vector46 - projectile.Center; - value20.Normalize(); - projectile.velocity = value20 * 8f; - projectile.netUpdate = true; - } - } - } } else { projectile.frame = 0; - projectile.extraUpdates = 0; - int num988 = 10; - bool flag54 = false; - bool flag55 = false; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] % 30f == 0f) - { - flag55 = true; - } - int npcIndex = (int)projectile.ai[1]; - if (projectile.localAI[0] >= (float)(60000 * num988)) //tryna make it stay on there "forever" without glitching - { - flag54 = true; - } - else if (npcIndex < 0 || npcIndex >= Main.maxNPCs) - { - flag54 = true; - } - else if (Main.npc[npcIndex].active && !Main.npc[npcIndex].dontTakeDamage && Main.npc[npcIndex].defense < 9999) - { - projectile.Center = Main.npc[npcIndex].Center - projectile.velocity * 2f; - projectile.gfxOffY = Main.npc[npcIndex].gfxOffY; - if (flag55) - { - Main.npc[npcIndex].HitEffect(0, 1.0); - } - } - else - { - flag54 = true; - } - if (flag54) - { - projectile.ai[0] = 0f; - projectile.velocity.X = 0f; - projectile.velocity.Y = 0f; - } + projectile.extraUpdates = 0; + bool breakAway = false; + bool spawnDust = false; + projectile.localAI[0] += 1f; + if (projectile.localAI[0] % 30f == 0f) + { + spawnDust = true; + } + int npcIndex = projectile.Calamity().lineColor; + if (projectile.localAI[0] >= 600000f) //tryna make it stay on there "forever" without glitching + { + breakAway = true; + } + else if (npcIndex < 0 || npcIndex >= Main.maxNPCs) + { + breakAway = true; + } + else if (Main.npc[npcIndex].active && !Main.npc[npcIndex].dontTakeDamage && Main.npc[npcIndex].defense < 9999) + { + projectile.Center = Main.npc[npcIndex].Center - projectile.velocity * 2f; + projectile.gfxOffY = Main.npc[npcIndex].gfxOffY; + if (spawnDust) + { + Main.npc[npcIndex].HitEffect(0, 1.0); + } + } + else + { + breakAway = true; + } + if (breakAway) + { + projectile.ai[0] = 0f; + projectile.velocity.X = 0f; + projectile.velocity.Y = 0f; + } if (projectile.owner == Main.myPlayer) { if (eaterCooldown > 0) @@ -309,112 +154,123 @@ namespace CalamityMod.Projectiles.Summon float yVector = (float)Main.rand.Next(-35, 36) * 0.02f; xVector *= 10f; yVector *= 10f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, xVector, yVector, ModContent.ProjectileType(), (int)(VileFeeder.BaseDamage * player.MinionDamage() * 1.25f), projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, xVector, yVector, ModContent.ProjectileType(), (int)(projectile.damage * 1.25f), projectile.knockBack, projectile.owner, 0f, 0f); } eaterCooldown = 80; } } } - } - - public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - Player player = Main.player[projectile.owner]; - Rectangle myRect = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); - if (projectile.owner == Main.myPlayer) - { - for (int i = 0; i < Main.maxNPCs; i++) - { - NPC npc = Main.npc[i]; - if (npc.active && !npc.dontTakeDamage && npc.defense < 9999 && - ((projectile.friendly && (!npc.friendly || (npc.type == NPCID.Guide && projectile.owner < Main.maxPlayers && player.killGuide) || (npc.type == NPCID.Clothier && projectile.owner < Main.maxPlayers && player.killClothier))) && (projectile.owner < 0 || npc.immune[projectile.owner] == 0 || projectile.maxPenetrate == 1))) - { - if (npc.noTileCollide || !projectile.ownerHitCheck || projectile.CanHit(npc)) - { - bool flag3; - if (npc.type == NPCID.SolarCrawltipedeTail) - { - Rectangle rect = npc.getRect(); - int num5 = 8; - rect.X -= num5; - rect.Y -= num5; - rect.Width += num5 * 2; - rect.Height += num5 * 2; - flag3 = projectile.Colliding(myRect, rect); - } - else - { - flag3 = projectile.Colliding(myRect, npc.getRect()); - } - if (flag3) - { - if (npc.reflectingProjectiles && projectile.CanReflect()) - { - npc.ReflectProjectile(projectile.whoAmI); - return; - } - projectile.ai[0] = 3f; - projectile.ai[1] = (float)i; - projectile.velocity = (npc.Center - projectile.Center) * 0.75f; - projectile.netUpdate = true; - projectile.StatusNPC(i); - projectile.damage = 0; - int num28 = 10; - Point[] array2 = new Point[num28]; - int num29 = 0; - for (int l = 0; l < Main.maxProjectiles; l++) - { - Projectile proj = Main.projectile[l]; - if (l != projectile.whoAmI && proj.active && proj.owner == Main.myPlayer && proj.type == projectile.type && proj.ai[0] == 3f && proj.ai[1] == (float)i) - { - array2[num29++] = new Point(l, Main.projectile[l].timeLeft); - if (num29 >= array2.Length) - { - break; - } - } - } - if (num29 >= array2.Length) - { - int num30 = 0; - for (int m = 1; m < array2.Length; m++) - { - if (array2[m].Y < array2[num30].Y) - { - num30 = m; - } - } - Main.projectile[array2[num30].X].Kill(); - } - } - } - } - } - } } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) - { - if (targetHitbox.Width > 8 && targetHitbox.Height > 8) - { - targetHitbox.Inflate(-targetHitbox.Width / 8, -targetHitbox.Height / 8); - } - return null; - } + public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + Player player = Main.player[projectile.owner]; + Rectangle myRect = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - SpriteEffects spriteEffects = projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Texture2D texture = Main.projectileTexture[projectile.type]; - int num214 = texture.Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture.Width / 2f, (float)num214 / 2f), projectile.scale, spriteEffects, 0f); - return false; - } + if (projectile.owner == Main.myPlayer) + { + for (int npcIndex = 0; npcIndex < Main.maxNPCs; npcIndex++) + { + NPC npc = Main.npc[npcIndex]; + //covers most edge cases like voodoo dolls + if (npc.active && !npc.dontTakeDamage && npc.defense < 9999 && + ((projectile.friendly && (!npc.friendly || (npc.type == NPCID.Guide && projectile.owner < Main.maxPlayers && player.killGuide) || (npc.type == NPCID.Clothier && projectile.owner < Main.maxPlayers && player.killClothier))) || + (projectile.hostile && npc.friendly && !npc.dontTakeDamageFromHostiles)) && (projectile.owner < 0 || npc.immune[projectile.owner] == 0 || projectile.maxPenetrate == 1)) + { + if (npc.noTileCollide || !projectile.ownerHitCheck || projectile.CanHit(npc)) + { + bool stickingToNPC; + //Solar Crawltipede tail has special collision + if (npc.type == NPCID.SolarCrawltipedeTail) + { + Rectangle rect = npc.getRect(); + int num5 = 8; + rect.X -= num5; + rect.Y -= num5; + rect.Width += num5 * 2; + rect.Height += num5 * 2; + stickingToNPC = projectile.Colliding(myRect, rect); + } + else + { + stickingToNPC = projectile.Colliding(myRect, npc.getRect()); + } + if (stickingToNPC) + { + //reflect projectile if the npc can reflect it (like Selenians) + if (npc.reflectingProjectiles && projectile.CanReflect()) + { + npc.ReflectProjectile(projectile.whoAmI); + return; + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 0; - } - } + //let the projectile know it is sticking and the npc it is sticking too + projectile.ai[0] = 1f; + projectile.Calamity().lineColor = npcIndex; + + //follow the NPC + projectile.velocity = (npc.Center - projectile.Center) * 0.75f; + + projectile.netUpdate = true; + + //Count how many projectiles are attached, delete as necessary + Point[] array2 = new Point[10]; + int projCount = 0; + for (int projIndex = 0; projIndex < Main.maxProjectiles; projIndex++) + { + Projectile proj = Main.projectile[projIndex]; + if (projIndex != projectile.whoAmI && proj.active && proj.owner == Main.myPlayer && proj.type == projectile.type && proj.ai[0] == 1f && proj.Calamity().lineColor == npcIndex) + { + array2[projCount++] = new Point(projIndex, proj.timeLeft); + if (projCount >= array2.Length) + { + break; + } + } + } + if (projCount >= array2.Length) + { + int num30 = 0; + for (int m = 1; m < array2.Length; m++) + { + if (array2[m].Y < array2[num30].Y) + { + num30 = m; + } + } + Main.projectile[array2[num30].X].Kill(); + } + } + } + } + } + } + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + if (targetHitbox.Width > 8 && targetHitbox.Height > 8) + { + targetHitbox.Inflate(-targetHitbox.Width / 8, -targetHitbox.Height / 8); + } + return null; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + SpriteEffects spriteEffects = projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Texture2D texture = Main.projectileTexture[projectile.type]; + int num214 = texture.Height / Main.projFrames[projectile.type]; + int y6 = num214 * projectile.frame; + Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture.Width / 2f, (float)num214 / 2f), projectile.scale, spriteEffects, 0f); + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 0; + } + + public override bool CanDamage() => projectile.ai[0] != 3f; + } } diff --git a/Projectiles/Summon/WaterElementalMinion.cs b/Projectiles/Summon/WaterElementalMinion.cs index e306f656ce..eb5b6d05b0 100644 --- a/Projectiles/Summon/WaterElementalMinion.cs +++ b/Projectiles/Summon/WaterElementalMinion.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - DisplayName.SetDefault("Siren Lure"); + DisplayName.SetDefault("Anahita"); Main.projFrames[projectile.type] = 6; ProjectileID.Sets.MinionSacrificable[projectile.type] = true; ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; @@ -21,8 +21,8 @@ namespace CalamityMod.Projectiles.Summon public override void SetDefaults() { - projectile.width = 70; - projectile.height = 120; + projectile.width = 100; + projectile.height = 190; projectile.netImportant = true; projectile.friendly = true; projectile.ignoreWater = true; @@ -71,8 +71,7 @@ namespace CalamityMod.Projectiles.Summon if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) { int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); + projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); projectile.damage = damage2; } Lighting.AddLight(projectile.Center, 0f, 0.25f, 1.5f); @@ -82,25 +81,28 @@ namespace CalamityMod.Projectiles.Summon projectile.frame++; projectile.frameCounter = 0; } - if (projectile.frame > 5) + if (projectile.frame >= 6) { projectile.frame = 0; } - projectile.position.X = player.Center.X - (float)(projectile.width / 2); - projectile.position.Y = player.Center.Y - (float)(projectile.height / 2) + player.gfxOffY - 180f; + projectile.Center = player.Center + Vector2.UnitY * (player.gfxOffY - 180f); if (player.gravDir == -1f) { - projectile.position.Y = projectile.position.Y + 360f; - projectile.rotation = 3.14f; + projectile.position.Y += 360f; + projectile.rotation = MathHelper.Pi; } else { projectile.rotation = 0f; } - projectile.position.X = (float)(int)projectile.position.X; - projectile.position.Y = (float)(int)projectile.position.Y; + projectile.position.X = (int)projectile.position.X; + projectile.position.Y = (int)projectile.position.Y; if (projectile.owner == Main.myPlayer) { + // Prevent firing immediately + if (projectile.localAI[0] < 120f) + projectile.localAI[0] += 1f; + if (projectile.ai[0] != 0f) { projectile.ai[0] -= 1f; @@ -126,7 +128,7 @@ namespace CalamityMod.Projectiles.Summon } } } - else + if (!flag18) { for (int num512 = 0; num512 < Main.maxNPCs; num512++) { @@ -145,7 +147,7 @@ namespace CalamityMod.Projectiles.Summon } } } - if (flag18) + if (flag18 && projectile.localAI[0] >= 120f) { float num516 = num506; float num517 = num507; diff --git a/Projectiles/Summon/WaterElementalMinion.png b/Projectiles/Summon/WaterElementalMinion.png index 4823435d44..dc5e4b524f 100644 Binary files a/Projectiles/Summon/WaterElementalMinion.png and b/Projectiles/Summon/WaterElementalMinion.png differ diff --git a/Projectiles/Summon/WaterSpearFriendly.png b/Projectiles/Summon/WaterSpearFriendly.png index b923a9ea8b..a50659774e 100644 Binary files a/Projectiles/Summon/WaterSpearFriendly.png and b/Projectiles/Summon/WaterSpearFriendly.png differ diff --git a/Projectiles/Summon/WulfrumDroid.cs b/Projectiles/Summon/WulfrumDroid.cs index cbc19cb5d6..1f0624e0fa 100644 --- a/Projectiles/Summon/WulfrumDroid.cs +++ b/Projectiles/Summon/WulfrumDroid.cs @@ -15,19 +15,18 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Wulfrum Droid"); - Main.projFrames[projectile.type] = 3; + Main.projFrames[projectile.type] = 12; ProjectileID.Sets.MinionSacrificable[projectile.type] = true; ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; } public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; + projectile.width = 26; + projectile.height = 32; projectile.netImportant = true; projectile.friendly = true; projectile.ignoreWater = true; - //projectile.aiStyle = 62; projectile.minionSlots = 1f; projectile.timeLeft = 18000; projectile.penetrate = -1; @@ -44,24 +43,23 @@ namespace CalamityMod.Projectiles.Summon { projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) + int dustAmt = 36; + for (int dustIndex = 0; dustIndex < dustAmt; dustIndex++) { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 61, vector7.X * 1.1f, vector7.Y * 1.1f, 100, default, 1.4f); - Main.dust[num228].noGravity = true; - Main.dust[num228].noLight = true; - Main.dust[num228].velocity = vector7; + Vector2 source = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; + source = source.RotatedBy((double)((float)(dustIndex - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + projectile.Center; + Vector2 dustVel = source - projectile.Center; + int green = Dust.NewDust(source + dustVel, 0, 0, 61, dustVel.X * 1.1f, dustVel.Y * 1.1f, 100, default, 1.4f); + Main.dust[green].noGravity = true; + Main.dust[green].noLight = true; + Main.dust[green].velocity = dustVel; } dust += 1f; } if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) { int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); + projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); projectile.damage = damage2; } projectile.frameCounter++; @@ -70,13 +68,13 @@ namespace CalamityMod.Projectiles.Summon projectile.frame++; projectile.frameCounter = 0; } - if (projectile.frame >= 3) + if (projectile.frame >= Main.projFrames[projectile.type]) { projectile.frame = 0; } - bool flag64 = projectile.type == ModContent.ProjectileType(); + bool correctMinion = projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); - if (flag64) + if (correctMinion) { if (player.dead) { @@ -88,135 +86,132 @@ namespace CalamityMod.Projectiles.Summon } } projectile.MinionAntiClump(); - Vector2 vector2_3 = projectile.position; - float num7 = 450f; - bool flag = false; - int num8 = -1; + Vector2 targetVector = projectile.position; + float range = 450f; + bool foundTarget = false; + int targetIndex = -1; if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; if (npc.CanBeChasedBy((object) this, false)) { - float num1 = Vector2.Distance(npc.Center, projectile.Center); - if ((!flag && num1 < num7) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + float targetDist = Vector2.Distance(npc.Center, projectile.Center); + if ((!foundTarget && targetDist < range) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) { - num7 = num1; - vector2_3 = npc.Center; - flag = true; - num8 = npc.whoAmI; + range = targetDist; + targetVector = npc.Center; + foundTarget = true; + targetIndex = npc.whoAmI; } } } - if (!flag) + if (!foundTarget) { - for (int index2 = 0; index2 < Main.npc.Length; ++index2) + for (int npcIndex = 0; npcIndex < Main.npc.Length; ++npcIndex) { - NPC npc = Main.npc[index2]; + NPC npc = Main.npc[npcIndex]; if (npc.CanBeChasedBy((object) this, false)) { - float num1 = Vector2.Distance(npc.Center, projectile.Center); - if ((!flag && num1 < num7) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + float targetDist = Vector2.Distance(npc.Center, projectile.Center); + if ((!foundTarget && targetDist < range) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) { - num7 = num1; - vector2_3 = npc.Center; - flag = true; - num8 = index2; + range = targetDist; + targetVector = npc.Center; + foundTarget = true; + targetIndex = npcIndex; } } } } - int num9 = 500; - if (flag) - num9 = 1000; - if ((double) Vector2.Distance(player.Center, projectile.Center) > (double) num9) + float separationAnxietyDist = 500f; + if (foundTarget) + separationAnxietyDist = 1000f; + if (Vector2.Distance(player.Center, projectile.Center) > separationAnxietyDist) { projectile.ai[0] = 1f; projectile.netUpdate = true; } - if ((double) projectile.ai[0] == 1.0) + if (projectile.ai[0] == 1f) projectile.tileCollide = false; - if (flag && (double) projectile.ai[0] == 0.0) + if (foundTarget && projectile.ai[0] == 0f) { - Vector2 vector2_1 = vector2_3 - projectile.Center; - float num1 = vector2_1.Length(); - vector2_1.Normalize(); - if ((double) num1 > 200.0) + Vector2 targetPos = targetVector - projectile.Center; + float targetDist = targetPos.Length(); + targetPos.Normalize(); + if (targetDist > 200f) { - float num2 = 6f; - Vector2 vector2_2 = vector2_1 * num2; - projectile.velocity.X = (float) (((double) projectile.velocity.X * 40.0 + (double) vector2_2.X) / 41.0); - projectile.velocity.Y = (float) (((double) projectile.velocity.Y * 40.0 + (double) vector2_2.Y) / 41.0); + float speed = 6f; + Vector2 goToTarget = targetPos * speed; + projectile.velocity.X = (projectile.velocity.X * 40f + goToTarget.X) / 41f; + projectile.velocity.Y = (projectile.velocity.Y * 40f + goToTarget.Y) / 41f; } - else if ((double) projectile.velocity.Y > -1.0) + else if (projectile.velocity.Y > -1f) projectile.velocity.Y -= 0.1f; } else { if (!Collision.CanHitLine(projectile.Center, 1, 1, player.Center, 1, 1)) projectile.ai[0] = 1f; - float num1 = 6f; - if ((double) projectile.ai[0] == 1.0) - num1 = 15f; - Vector2 center = projectile.Center; - Vector2 vector2_1 = player.Center - center + new Vector2(0.0f, -60f); - float num3 = vector2_1.Length(); - if ((double) num3 > 200.0 && (double) num1 < 9.0) - num1 = 9f; - if ((double) num3 < 100.0 && (double) projectile.ai[0] == 1.0 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + float returnSpeed = 6f; + if (projectile.ai[0] == 1f) + returnSpeed = 15f; + Vector2 playerVec = player.Center - projectile.Center + new Vector2(0f, -60f); + float playerDist = playerVec.Length(); + if (playerDist > 200f && returnSpeed < 9f) + returnSpeed = 9f; + if (playerDist < 100f && projectile.ai[0] == 1f && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) { - projectile.ai[0] = 0.0f; + projectile.ai[0] = 0f; projectile.netUpdate = true; } - if ((double) num3 > 2000.0) + if (playerDist > 2000f) { projectile.position.X = player.Center.X - (float) (projectile.width / 2); projectile.position.Y = player.Center.Y - (float) (projectile.width / 2); + projectile.netUpdate = true; } - else if ((double) num3 > 70.0) + else if (playerDist > 70f) { - vector2_1.Normalize(); - projectile.velocity = (projectile.velocity * 20f + vector2_1 * num1) / 21f; + playerVec.Normalize(); + projectile.velocity = (projectile.velocity * 20f + playerVec * returnSpeed) / 21f; } else { - if ((double) projectile.velocity.X == 0.0 && (double) projectile.velocity.Y == 0.0) + if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) { projectile.velocity.X = -0.15f; projectile.velocity.Y = -0.05f; } - projectile.velocity = projectile.velocity * 1.01f; + projectile.velocity *= 1.01f; } } projectile.rotation = projectile.velocity.X * 0.05f; - if ((double) projectile.velocity.X > 0.0) + if (projectile.velocity.X > 0f) projectile.spriteDirection = projectile.direction = 1; - else if ((double) projectile.velocity.X < 0.0) + else if (projectile.velocity.X < 0f) projectile.spriteDirection = projectile.direction = -1; - if ((double) projectile.ai[1] > 0.0) + if (projectile.ai[1] > 0f) projectile.ai[1] += (float) Main.rand.Next(1, 4); - if ((double) projectile.ai[1] > 90.0) + if (projectile.ai[1] > 90f) { projectile.ai[1] = 0.0f; projectile.netUpdate = true; } - if ((double) projectile.ai[1] != 0.0) + if (projectile.ai[1] != 0f) return; ++projectile.ai[1]; if (Main.myPlayer != projectile.owner) return; - if (!flag) + if (!foundTarget) return; - Vector2 vec = vector2_3 - projectile.Center; - vec.Normalize(); - Vector2 vec2 = vec * 10f; - int bolt = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, vec2.X, vec2.Y, ModContent.ProjectileType(), projectile.damage, 0.0f, Main.myPlayer, 0.0f, 0.0f); + Vector2 velocity = targetVector - projectile.Center; + velocity.Normalize(); + velocity *= 10f; + int bolt = Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); Main.projectile[bolt].netUpdate = true; projectile.netUpdate = true; } - public override bool CanDamage() - { - return false; - } + public override bool CanDamage() => false; } } diff --git a/Projectiles/Summon/WulfrumDroid.png b/Projectiles/Summon/WulfrumDroid.png index c227fdff07..fec767973b 100644 Binary files a/Projectiles/Summon/WulfrumDroid.png and b/Projectiles/Summon/WulfrumDroid.png differ diff --git a/Projectiles/Typeless/AstralSpray.cs b/Projectiles/Typeless/AstralSpray.cs index cde6a93d77..e698101cd7 100644 --- a/Projectiles/Typeless/AstralSpray.cs +++ b/Projectiles/Typeless/AstralSpray.cs @@ -1,7 +1,7 @@ - using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless { @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreAI() { - if (projectile.owner == Main.myPlayer) + if (projectile.owner == Main.myPlayer/* && Main.netMode != NetmodeID.MultiplayerClient*/) { int x = (int)(projectile.Center.X / 16f); int y = (int)(projectile.Center.Y / 16f); diff --git a/Projectiles/Typeless/BlunderBoosterAura.cs b/Projectiles/Typeless/BlunderBoosterAura.cs index 4db065b94e..ac2801a301 100644 --- a/Projectiles/Typeless/BlunderBoosterAura.cs +++ b/Projectiles/Typeless/BlunderBoosterAura.cs @@ -37,6 +37,10 @@ namespace CalamityMod.Projectiles.Typeless public override void AI() { + //Protect against other mod projectile reflection like emode Granite Golems + projectile.friendly = true; + projectile.hostile = false; + projectile.frameCounter++; if (projectile.frameCounter > 3) { diff --git a/Projectiles/Typeless/CirrusBolt.cs b/Projectiles/Typeless/CirrusBolt.cs new file mode 100644 index 0000000000..c9ffb06860 --- /dev/null +++ b/Projectiles/Typeless/CirrusBolt.cs @@ -0,0 +1,39 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Typeless +{ + public class CirrusBolt : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.extraUpdates = 100; + projectile.friendly = true; + projectile.timeLeft = 45; + projectile.magic = true; + projectile.npcProj = true; + } + + public override void AI() + { + if (projectile.timeLeft % 2f == 0f) + { + Vector2 vector33 = projectile.position; + vector33 -= projectile.velocity * 0.25f; + int num448 = Dust.NewDust(vector33, 1, 1, 234, 0f, 0f, 0, default, 1.25f); + Main.dust[num448].position = vector33; + Main.dust[num448].noGravity = true; + Main.dust[num448].noLight = true; + Main.dust[num448].scale = Main.rand.Next(70, 110) * 0.013f; + Main.dust[num448].velocity *= 0.1f; + } + } + } +} diff --git a/Projectiles/Typeless/CirrusBolt.png b/Projectiles/Typeless/CirrusBolt.png new file mode 100644 index 0000000000..15e8775737 Binary files /dev/null and b/Projectiles/Typeless/CirrusBolt.png differ diff --git a/Projectiles/Typeless/CirrusOrb.cs b/Projectiles/Typeless/CirrusOrb.cs new file mode 100644 index 0000000000..86758bc9bf --- /dev/null +++ b/Projectiles/Typeless/CirrusOrb.cs @@ -0,0 +1,30 @@ +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Typeless +{ + public class CirrusOrb : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Orb"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.timeLeft = 30; + projectile.magic = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.npcProj = true; + } + + public override void AI() + { + CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 150f, 6f, 6f, 2, ModContent.ProjectileType()); + } + } +} diff --git a/Projectiles/Boss/CosmicFlameBurst.png b/Projectiles/Typeless/CirrusOrb.png similarity index 100% rename from Projectiles/Boss/CosmicFlameBurst.png rename to Projectiles/Typeless/CirrusOrb.png diff --git a/Projectiles/Typeless/CirrusRay.cs b/Projectiles/Typeless/CirrusRay.cs new file mode 100644 index 0000000000..58fc0fce3c --- /dev/null +++ b/Projectiles/Typeless/CirrusRay.cs @@ -0,0 +1,69 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Typeless +{ + public class CirrusRay : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ray"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.friendly = true; + projectile.magic = true; + projectile.penetrate = 5; + projectile.extraUpdates = 100; + projectile.timeLeft = 300; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 0; + projectile.npcProj = true; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, 0.2f, 0.01f, 0.1f); + projectile.ai[0] += 1f; + if (projectile.ai[0] % 6f == 0f && projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + + if (projectile.ai[0] > 16f && projectile.ai[0] % 2f == 0f) + { + Vector2 source = projectile.position; + int pink = Dust.NewDust(source, 1, 1, 234, 0f, 0f, 0, default, 1.25f); + Main.dust[pink].noGravity = true; + Main.dust[pink].noLight = true; + Main.dust[pink].position = source; + Main.dust[pink].scale = Main.rand.Next(70, 110) * 0.013f; + Main.dust[pink].velocity *= 0.1f; + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + projectile.penetrate--; + if (projectile.penetrate <= 0) + { + projectile.Kill(); + } + else + { + if (projectile.velocity.X != oldVelocity.X) + { + projectile.velocity.X = -oldVelocity.X; + } + if (projectile.velocity.Y != oldVelocity.Y) + { + projectile.velocity.Y = -oldVelocity.Y; + } + } + return false; + } + } +} diff --git a/Projectiles/Typeless/CirrusRay.png b/Projectiles/Typeless/CirrusRay.png new file mode 100644 index 0000000000..15e8775737 Binary files /dev/null and b/Projectiles/Typeless/CirrusRay.png differ diff --git a/Projectiles/Typeless/DarkIce.cs b/Projectiles/Typeless/DarkIce.cs index e0cea56dbb..a2fc890051 100644 --- a/Projectiles/Typeless/DarkIce.cs +++ b/Projectiles/Typeless/DarkIce.cs @@ -20,6 +20,7 @@ namespace CalamityMod.Projectiles.Typeless projectile.ignoreWater = true; projectile.extraUpdates = 1; projectile.coldDamage = true; + projectile.npcProj = true; } public override void SetStaticDefaults() diff --git a/Projectiles/Typeless/FiniteUse/ExplosiveShotgunShell.cs b/Projectiles/Typeless/FiniteUse/ExplosiveShotgunShell.cs index d2b7e7a4f0..b89fd39e36 100644 --- a/Projectiles/Typeless/FiniteUse/ExplosiveShotgunShell.cs +++ b/Projectiles/Typeless/FiniteUse/ExplosiveShotgunShell.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Typeless.FiniteUse projectile.friendly = true; projectile.ignoreWater = true; projectile.aiStyle = 1; - aiType = 242; + aiType = ProjectileID.BulletHighVelocity; projectile.penetrate = 1; projectile.timeLeft = 600; } diff --git a/Projectiles/Typeless/FiniteUse/MagnumRound.cs b/Projectiles/Typeless/FiniteUse/MagnumRound.cs index 42422f79ae..e9d87d18e4 100644 --- a/Projectiles/Typeless/FiniteUse/MagnumRound.cs +++ b/Projectiles/Typeless/FiniteUse/MagnumRound.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Typeless.FiniteUse projectile.friendly = true; projectile.ignoreWater = true; projectile.aiStyle = 1; - aiType = 242; + aiType = ProjectileID.BulletHighVelocity; projectile.penetrate = 1; projectile.timeLeft = 600; } @@ -35,11 +35,6 @@ namespace CalamityMod.Projectiles.Typeless.FiniteUse } if (damage > target.lifeMax / 15 && CalamityPlayer.areThereAnyDamnBosses) damage = target.lifeMax / 15; - if (crit) - { - damage = (int)(damage * 1.25); - knockback *= 1.25f; - } } } } diff --git a/Projectiles/Typeless/GodSlayerShrapnelRound.cs b/Projectiles/Typeless/GodSlayerShrapnelRound.cs index c5384e4247..622dcfeb94 100644 --- a/Projectiles/Typeless/GodSlayerShrapnelRound.cs +++ b/Projectiles/Typeless/GodSlayerShrapnelRound.cs @@ -28,12 +28,12 @@ namespace CalamityMod.Projectiles.Typeless Main.PlaySound(SoundID.Item73, projectile.position); projectile.localAI[0] += 1f; } - for (int num457 = 0; num457 < 3; num457++) + for (int d = 0; d < 3; d++) { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1.2f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; + int cosmilite = Dust.NewDust(projectile.position, projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1.2f); + Main.dust[cosmilite].noGravity = true; + Main.dust[cosmilite].velocity *= 0.5f; + Main.dust[cosmilite].velocity += projectile.velocity * 0.1f; } } @@ -41,17 +41,11 @@ namespace CalamityMod.Projectiles.Typeless { if (projectile.owner == Main.myPlayer) { - int num251 = Main.rand.Next(4, 7); - for (int num252 = 0; num252 < num251; num252++) + int shrapnelAmt = Main.rand.Next(4, 7); + for (int s = 0; s < shrapnelAmt; s++) { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), value15.X, value15.Y, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.3), 0f, projectile.owner, 0f, 0f); + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); + Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.3), 0f, projectile.owner, 0f, 0f); } } } diff --git a/Projectiles/Typeless/KelvinCatalystStar.png b/Projectiles/Typeless/KelvinCatalystStar.png index 63cf056df5..4c9d479f3b 100644 Binary files a/Projectiles/Typeless/KelvinCatalystStar.png and b/Projectiles/Typeless/KelvinCatalystStar.png differ diff --git a/Projectiles/Typeless/NebulaStar.cs b/Projectiles/Typeless/NebulaStar.cs index a2d726d91e..a21ec81a21 100644 --- a/Projectiles/Typeless/NebulaStar.cs +++ b/Projectiles/Typeless/NebulaStar.cs @@ -5,188 +5,42 @@ using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless { - public class NebulaStar : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Star"); - } + public class NebulaStar : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Star"); + } - public override void SetDefaults() - { - projectile.width = 34; - projectile.height = 34; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 3600; - } + public override void SetDefaults() + { + projectile.width = projectile.height = 34; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.timeLeft = 3600; + } - public override void AI() - { - float num944 = 1f - (float)projectile.alpha / 255f; - num944 *= projectile.scale; - Lighting.AddLight(projectile.Center, 0.25f * num944, 0.025f * num944, 0.275f * num944); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 90f) - { - projectile.localAI[0] *= -1f; - } - if (projectile.localAI[0] >= 0f) - { - projectile.scale += 0.003f; - } - else - { - projectile.scale -= 0.003f; - } - projectile.rotation += 0.0025f * projectile.scale; - float num945 = 1f; - float num946 = 1f; - if (projectile.identity % 6 == 0) - { - num946 *= -1f; - } - if (projectile.identity % 6 == 1) - { - num945 *= -1f; - } - if (projectile.identity % 6 == 2) - { - num946 *= -1f; - num945 *= -1f; - } - if (projectile.identity % 6 == 3) - { - num946 = 0f; - } - if (projectile.identity % 6 == 4) - { - num945 = 0f; - } - projectile.localAI[1] += 1f; - if (projectile.localAI[1] > 60f) - { - projectile.localAI[1] = -180f; - } - if (projectile.localAI[1] >= -60f) - { - projectile.velocity.X = projectile.velocity.X + 0.002f * num946; - projectile.velocity.Y = projectile.velocity.Y + 0.002f * num945; - } - else - { - projectile.velocity.X = projectile.velocity.X - 0.002f * num946; - projectile.velocity.Y = projectile.velocity.Y - 0.002f * num945; - } - projectile.ai[0] += 1f; - if (projectile.ai[0] > 5400f) - { - projectile.damage = 0; - projectile.ai[1] = 1f; - if (projectile.alpha < 255) - { - projectile.alpha += 5; - if (projectile.alpha > 255) - { - projectile.alpha = 255; - } - } - else if (projectile.owner == Main.myPlayer) - { - projectile.Kill(); - } - } - else - { - float num947 = (projectile.Center - Main.player[projectile.owner].Center).Length() / 100f; - if (num947 > 4f) - { - num947 *= 1.1f; - } - if (num947 > 5f) - { - num947 *= 1.2f; - } - if (num947 > 6f) - { - num947 *= 1.3f; - } - if (num947 > 7f) - { - num947 *= 1.4f; - } - if (num947 > 8f) - { - num947 *= 1.5f; - } - if (num947 > 9f) - { - num947 *= 1.6f; - } - if (num947 > 10f) - { - num947 *= 1.7f; - } - projectile.ai[0] += num947; - if (projectile.alpha > 50) - { - projectile.alpha -= 10; - if (projectile.alpha < 50) - { - projectile.alpha = 50; - } - } - } - bool flag49 = false; - Vector2 center12 = new Vector2(0f, 0f); - float num948 = 600f; - for (int num949 = 0; num949 < Main.maxNPCs; num949++) - { - if (Main.npc[num949].CanBeChasedBy(projectile, false)) - { - float num950 = Main.npc[num949].position.X + (float)(Main.npc[num949].width / 2); - float num951 = Main.npc[num949].position.Y + (float)(Main.npc[num949].height / 2); - float num952 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num950) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num951); - if (num952 < num948) - { - num948 = num952; - center12 = Main.npc[num949].Center; - flag49 = true; - } - } - } - if (flag49) - { - Vector2 vector101 = center12 - projectile.Center; - vector101.Normalize(); - vector101 *= 0.75f; - projectile.velocity = (projectile.velocity * 10f + vector101) / 11f; - return; - } - if ((double)projectile.velocity.Length() > 0.2) - { - projectile.velocity *= 0.98f; - } - } + public override void AI() + { + projectile.SporeSacAI(); + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - if (projectile.owner == Main.myPlayer && projectile.ai[1] == 0f) - { - Vector2 value10 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - value10.Normalize(); - value10 *= 0.3f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value10.X, value10.Y, ModContent.ProjectileType(), projectile.damage, 0f, projectile.owner, 0f, 0f); - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (projectile.owner == Main.myPlayer && projectile.ai[1] == 0f) + { + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 1f, 1f, 0.3f); + Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), projectile.damage, 0f, projectile.owner, 0f, 0f); + } + } - public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) - { - Rectangle frame = new Rectangle(0, 0, Main.projectileTexture[projectile.type].Width, Main.projectileTexture[projectile.type].Height); - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Typeless/NebulaStarGlow"), projectile.Center - Main.screenPosition, frame, Color.White, projectile.rotation, projectile.Size / 2, 1f, SpriteEffects.None, 0f); - } - } + public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) + { + Rectangle frame = new Rectangle(0, 0, Main.projectileTexture[projectile.type].Width, Main.projectileTexture[projectile.type].Height); + spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Typeless/NebulaStarGlow"), projectile.Center - Main.screenPosition, frame, Color.White, projectile.rotation, projectile.Size / 2, 1f, SpriteEffects.None, 0f); + } + } } diff --git a/Projectiles/Typeless/OmegaBlueTentacle.cs b/Projectiles/Typeless/OmegaBlueTentacle.cs index c855387dae..24bdf104aa 100644 --- a/Projectiles/Typeless/OmegaBlueTentacle.cs +++ b/Projectiles/Typeless/OmegaBlueTentacle.cs @@ -232,8 +232,8 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp/*.PointWrap*/, DepthStencilState.Default, RasterizerState.CullNone, null, Main.GameViewMatrix.ZoomMatrix); + spriteBatch.End(); + spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); GameShaders.Armor.ApplySecondary(Main.player[projectile.owner].cBody, Main.player[projectile.owner], new DrawData?()); projectile.rotation = (projectile.Center - segment[5]).ToRotation(); @@ -245,8 +245,8 @@ namespace CalamityMod.Projectiles.Typeless } Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), texture2D13.Bounds, projectile.GetAlpha(lightColor), projectile.rotation, texture2D13.Bounds.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); - Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, RasterizerState.CullCounterClockwise, null, Main.GameViewMatrix.ZoomMatrix); + spriteBatch.End(); + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); return false; } } diff --git a/Projectiles/Typeless/ReaverSpore.cs b/Projectiles/Typeless/ReaverSpore.cs new file mode 100644 index 0000000000..fb2d03a80c --- /dev/null +++ b/Projectiles/Typeless/ReaverSpore.cs @@ -0,0 +1,68 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class ReaverSpore : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spore"); + } + + public override void SetDefaults() + { + projectile.width = projectile.height = 16; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.alpha = 255; + projectile.timeLeft = 3600; + projectile.tileCollide = false; + projectile.ignoreWater = true; + } + + public override void AI() + { + projectile.SporeSacAI(); + } + + public override void Kill(int timeLeft) + { + if (projectile.owner == Main.myPlayer) + { + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 1f, 1f, 0.3f); + int gas = Projectile.NewProjectile(projectile.Center, velocity, ProjectileID.SporeGas + Main.rand.Next(3), projectile.damage, 0f, projectile.owner); + Main.projectile[gas].usesLocalNPCImmunity = true; + Main.projectile[gas].localNPCHitCooldown = 30; + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture; + switch (projectile.ai[0]) + { + case 1f: texture = ModContent.GetTexture("CalamityMod/Projectiles/Typeless/ReaverSpore2"); + break; + default: texture = Main.projectileTexture[projectile.type]; + break; + } + Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, texture.Width, texture.Height)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2(texture.Width / 2f, texture.Height / 2f), projectile.scale, SpriteEffects.None, 0f); + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Poisoned, 60 * Main.rand.Next(5, 11)); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Poisoned, 60 * Main.rand.Next(5, 11)); + } + } +} diff --git a/Projectiles/Typeless/ReaverSpore.png b/Projectiles/Typeless/ReaverSpore.png new file mode 100644 index 0000000000..02c53c1a78 Binary files /dev/null and b/Projectiles/Typeless/ReaverSpore.png differ diff --git a/Projectiles/Typeless/ReaverSpore2.png b/Projectiles/Typeless/ReaverSpore2.png new file mode 100644 index 0000000000..235e4f51cc Binary files /dev/null and b/Projectiles/Typeless/ReaverSpore2.png differ diff --git a/Projectiles/Typeless/SabatonSlam.cs b/Projectiles/Typeless/SabatonSlam.cs index d3706be6c3..83fefd68d1 100644 --- a/Projectiles/Typeless/SabatonSlam.cs +++ b/Projectiles/Typeless/SabatonSlam.cs @@ -1,8 +1,8 @@ +using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; -using Terraria.ModLoader; -using CalamityMod.Dusts; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless { @@ -11,7 +11,7 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { projectile.width = 10; - projectile.height = 50; + projectile.height = 35; projectile.friendly = true; projectile.timeLeft = 300; projectile.tileCollide = true; @@ -31,12 +31,15 @@ namespace CalamityMod.Projectiles.Typeless public override bool OnTileCollide(Vector2 oldVelocity) { - //Spawns the shockwave - Projectile.NewProjectile(projectile.position.X + 25, projectile.position.Y + 25, 0f, 0f, ModContent.ProjectileType(), 300, 12, projectile.owner); - Main.PlaySound(SoundID.Item14, projectile.position); Player player = Main.player[projectile.owner]; - player.Calamity().gSabatonFall = 0; - projectile.Kill(); + //Spawns the shockwave + if (Main.myPlayer == projectile.owner) + { + Projectile.NewProjectile(projectile.position.X + 25, projectile.position.Y + 25, 0f, 0f, ModContent.ProjectileType(), (int)(300 * player.AverageDamage()), 12, projectile.owner); + Main.PlaySound(SoundID.Item14, projectile.position); + player.Calamity().gSabatonFall = 0; + projectile.Kill(); + } //Pretty things for (int dustexplode = 0; dustexplode < 360; dustexplode++) { diff --git a/Projectiles/Typeless/Seashell.cs b/Projectiles/Typeless/Seashell.cs index 7ca2b090d1..834dade7b2 100644 --- a/Projectiles/Typeless/Seashell.cs +++ b/Projectiles/Typeless/Seashell.cs @@ -1,4 +1,5 @@ using Microsoft.Xna.Framework; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless { @@ -17,7 +18,7 @@ namespace CalamityMod.Projectiles.Typeless projectile.penetrate = 2; projectile.aiStyle = 3; projectile.timeLeft = 300; - aiType = 52; + aiType = ProjectileID.WoodenBoomerang; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 10; } diff --git a/Projectiles/Typeless/SkyFlareFriendly.cs b/Projectiles/Typeless/SkyFlareFriendly.cs index c96538d061..185f408433 100644 --- a/Projectiles/Typeless/SkyFlareFriendly.cs +++ b/Projectiles/Typeless/SkyFlareFriendly.cs @@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Typeless 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); + int num622 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -71,13 +71,13 @@ namespace CalamityMod.Projectiles.Typeless } 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); + int num624 = Dust.NewDust(projectile.position, 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); + num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - CalamityUtils.ExplosionGores(projectile, 3); + CalamityUtils.ExplosionGores(projectile.Center, 3); } } } diff --git a/Projectiles/Typeless/StarStruckWaterBottle.cs b/Projectiles/Typeless/StarStruckWaterBottle.cs index c68aca2b40..2f45c6cbb8 100644 --- a/Projectiles/Typeless/StarStruckWaterBottle.cs +++ b/Projectiles/Typeless/StarStruckWaterBottle.cs @@ -38,10 +38,10 @@ namespace CalamityMod.Projectiles.Typeless { Main.PlaySound(SoundID.Shatter, (int) projectile.position.X, (int) projectile.position.Y, 1, 1f, 0.0f); for (int index = 0; index < 5; ++index) - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 13, 0f, 0f, 0, new Color(), 1f); + Dust.NewDust(projectile.position, projectile.width, projectile.height, 13, 0f, 0f, 0, new Color(), 1f); for (int index1 = 0; index1 < 30; ++index1) { - int index2 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, ModContent.DustType(), 0f, -2f, 0, new Color(), 1.1f); + int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, ModContent.DustType(), 0f, -2f, 0, new Color(), 1.1f); Dust dust = Main.dust[index2]; dust.alpha = 100; dust.velocity.X *= 1.5f; diff --git a/Projectiles/Typeless/StickyFeatherAero.cs b/Projectiles/Typeless/StickyFeatherAero.cs index 759e899d89..4c526b30c3 100644 --- a/Projectiles/Typeless/StickyFeatherAero.cs +++ b/Projectiles/Typeless/StickyFeatherAero.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Typeless projectile.penetrate = 3; projectile.alpha = 255; projectile.aiStyle = 93; - aiType = 514; + aiType = ProjectileID.NailFriendly; } public override void AI() diff --git a/Projectiles/Typeless/TeslaAura.cs b/Projectiles/Typeless/TeslaAura.cs index 36832c2751..cfacfc2047 100644 --- a/Projectiles/Typeless/TeslaAura.cs +++ b/Projectiles/Typeless/TeslaAura.cs @@ -39,6 +39,10 @@ namespace CalamityMod.Projectiles.Typeless public override void AI() { + //Protect against other mod projectile reflection like emode Granite Golems + projectile.friendly = true; + projectile.hostile = false; + projectile.frameCounter++; if (projectile.frameCounter > 3) { diff --git a/Projectiles/Typeless/TheDeadlyMicrobeProjectile.cs b/Projectiles/Typeless/TheDeadlyMicrobeProjectile.cs index 2882484679..f4815e83ce 100644 --- a/Projectiles/Typeless/TheDeadlyMicrobeProjectile.cs +++ b/Projectiles/Typeless/TheDeadlyMicrobeProjectile.cs @@ -6,201 +6,56 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless { - public class TheDeadlyMicrobeProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Star"); - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 3600; - } - - public override void AI() - { - float num944 = 1f - (float)projectile.alpha / 255f; - num944 *= projectile.scale; - Lighting.AddLight(projectile.Center, 0.25f * num944, 0.025f * num944, 0.275f * num944); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 90f) - { - projectile.localAI[0] *= -1f; - } - if (projectile.localAI[0] >= 0f) - { - projectile.scale += 0.003f; - } - else - { - projectile.scale -= 0.003f; - } - projectile.rotation += 0.0025f * projectile.scale; - float num945 = 1f; - float num946 = 1f; - if (projectile.identity % 6 == 0) - { - num946 *= -1f; - } - if (projectile.identity % 6 == 1) - { - num945 *= -1f; - } - if (projectile.identity % 6 == 2) - { - num946 *= -1f; - num945 *= -1f; - } - if (projectile.identity % 6 == 3) - { - num946 = 0f; - } - if (projectile.identity % 6 == 4) - { - num945 = 0f; - } - projectile.localAI[1] += 1f; - if (projectile.localAI[1] > 60f) - { - projectile.localAI[1] = -180f; - } - if (projectile.localAI[1] >= -60f) - { - projectile.velocity.X = projectile.velocity.X + 0.002f * num946; - projectile.velocity.Y = projectile.velocity.Y + 0.002f * num945; - } - else - { - projectile.velocity.X = projectile.velocity.X - 0.002f * num946; - projectile.velocity.Y = projectile.velocity.Y - 0.002f * num945; - } - projectile.ai[0] += 1f; - if (projectile.ai[0] > 5400f) - { - projectile.damage = 0; - projectile.ai[1] = 1f; - if (projectile.alpha < 255) - { - projectile.alpha += 5; - if (projectile.alpha > 255) - { - projectile.alpha = 255; - } - } - else if (projectile.owner == Main.myPlayer) - { - projectile.Kill(); - } - } - else - { - float num947 = (projectile.Center - Main.player[projectile.owner].Center).Length() / 100f; - if (num947 > 4f) - { - num947 *= 1.1f; - } - if (num947 > 5f) - { - num947 *= 1.2f; - } - if (num947 > 6f) - { - num947 *= 1.3f; - } - if (num947 > 7f) - { - num947 *= 1.4f; - } - if (num947 > 8f) - { - num947 *= 1.5f; - } - if (num947 > 9f) - { - num947 *= 1.6f; - } - if (num947 > 10f) - { - num947 *= 1.7f; - } - projectile.ai[0] += num947; - if (projectile.alpha > 50) - { - projectile.alpha -= 10; - if (projectile.alpha < 50) - { - projectile.alpha = 50; - } - } - } - bool flag49 = false; - Vector2 center12 = new Vector2(0f, 0f); - float num948 = 600f; - for (int num949 = 0; num949 < 200; num949++) - { - if (Main.npc[num949].CanBeChasedBy(projectile, false)) - { - float num950 = Main.npc[num949].position.X + (float)(Main.npc[num949].width / 2); - float num951 = Main.npc[num949].position.Y + (float)(Main.npc[num949].height / 2); - float num952 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num950) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num951); - if (num952 < num948) - { - num948 = num952; - center12 = Main.npc[num949].Center; - flag49 = true; - } - } - } - if (flag49) - { - Vector2 vector101 = center12 - projectile.Center; - vector101.Normalize(); - vector101 *= 0.75f; - projectile.velocity = (projectile.velocity * 10f + vector101) / 11f; - return; - } - if ((double)projectile.velocity.Length() > 0.2) - { - projectile.velocity *= 0.98f; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.CursedInferno, 90); - } - - public override void OnHitPvp(Player target, int damage, bool crit) - { - target.AddBuff(BuffID.CursedInferno, 90); + public class TheDeadlyMicrobeProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Microbe"); } - public override void Kill(int timeLeft) - { - projectile.position = projectile.Center; - projectile.width = projectile.height = 56; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) - { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 44, vector7.X, vector7.Y, 100, default, 0.5f); - Main.dust[num228].noGravity = true; - Main.dust[num228].noLight = true; - Main.dust[num228].velocity = vector7; - } - projectile.Damage(); - } - } + public override void SetDefaults() + { + projectile.width = projectile.height = 14; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.timeLeft = 3600; + } + + public override void AI() + { + projectile.SporeSacAI(); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.CursedInferno, 90); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.CursedInferno, 90); + } + + public override void Kill(int timeLeft) + { + CalamityGlobalProjectile.ExpandHitboxBy(projectile, 56); + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + int dustAmt = 36; + for (int d = 0; d < dustAmt; d++) + { + Vector2 source = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; + source = source.RotatedBy((double)((float)(d - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + projectile.Center; + Vector2 dustVel = source - projectile.Center; + int index = Dust.NewDust(source + dustVel, 0, 0, 44, dustVel.X, dustVel.Y, 100, default, 0.5f); + Main.dust[index].noGravity = true; + Main.dust[index].noLight = true; + Main.dust[index].velocity = dustVel; + } + projectile.Damage(); + } + } } diff --git a/Projectiles/Typeless/WaterConvertor.cs b/Projectiles/Typeless/WaterConvertor.cs index c0d20765af..63ec125038 100644 --- a/Projectiles/Typeless/WaterConvertor.cs +++ b/Projectiles/Typeless/WaterConvertor.cs @@ -1,5 +1,6 @@ using CalamityMod.World; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless { @@ -28,7 +29,7 @@ namespace CalamityMod.Projectiles.Typeless public void ConvertShit(Projectile projectile) { - if (projectile.owner == Main.myPlayer) + if (projectile.owner == Main.myPlayer/* && Main.netMode != NetmodeID.MultiplayerClient*/) { int x = (int)(projectile.Center.X / 16f); int y = (int)(projectile.Center.Y / 16f); diff --git a/Projectiles/Typeless/WulfrumBobber.cs b/Projectiles/Typeless/WulfrumBobber.cs index 2668a7b540..f178c2fbf2 100644 --- a/Projectiles/Typeless/WulfrumBobber.cs +++ b/Projectiles/Typeless/WulfrumBobber.cs @@ -24,8 +24,7 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDrawExtras(SpriteBatch spriteBatch) { - Player player = Main.player[projectile.owner]; - CalamityUtils.DrawFishingLine(projectile, ModContent.ItemType(), new Color(200, 200, 200, 100)); + CalamityUtils.DrawFishingLine(projectile, ModContent.ItemType(), new Color(200, 200, 200, 100), 38, 28f); return false; } } diff --git a/Projectiles/Typeless/WulfrumBobber.png b/Projectiles/Typeless/WulfrumBobber.png index 7d03394d6f..19d0f06aea 100644 Binary files a/Projectiles/Typeless/WulfrumBobber.png and b/Projectiles/Typeless/WulfrumBobber.png differ diff --git a/Projectiles/Typeless/XerocBlast.cs b/Projectiles/Typeless/XerocBlast.cs index 498481348e..3a1db33347 100644 --- a/Projectiles/Typeless/XerocBlast.cs +++ b/Projectiles/Typeless/XerocBlast.cs @@ -71,7 +71,7 @@ namespace CalamityMod.Projectiles.Typeless num466 = num465 / num466; num463 *= num466; num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 58, 0f, 0f, 100, default, 1f); + int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 62, 0f, 0f, 100, default, 1f); Dust dust = Main.dust[num467]; dust.noGravity = true; dust.position.X = projectile.Center.X; diff --git a/Projectiles/Typeless/XerocBubble.cs b/Projectiles/Typeless/XerocBubble.cs index 4503b2e48d..986923299c 100644 --- a/Projectiles/Typeless/XerocBubble.cs +++ b/Projectiles/Typeless/XerocBubble.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Projectiles.Typeless { for (int num468 = 0; num468 < 1; num468++) { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 58, 0f, 0f, 100, default, 1f); + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 62, 0f, 0f, 100, default, 1f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; } diff --git a/Projectiles/Typeless/XerocBubble.png b/Projectiles/Typeless/XerocBubble.png index 637b8391b1..1c0aafc145 100644 Binary files a/Projectiles/Typeless/XerocBubble.png and b/Projectiles/Typeless/XerocBubble.png differ diff --git a/Projectiles/Typeless/XerocFire.cs b/Projectiles/Typeless/XerocFire.cs index 1cb3dbfa08..f3d8d7e5f1 100644 --- a/Projectiles/Typeless/XerocFire.cs +++ b/Projectiles/Typeless/XerocFire.cs @@ -41,8 +41,8 @@ namespace CalamityMod.Projectiles.Typeless projectile.ai[0] = 5f; if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) { - projectile.velocity.X = projectile.velocity.X * 0.97f; - if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) + projectile.velocity.X *= 0.97f; + if (projectile.velocity.X > -0.01f && projectile.velocity.X < 0.01f) { projectile.velocity.X = 0f; projectile.netUpdate = true; @@ -51,16 +51,9 @@ namespace CalamityMod.Projectiles.Typeless projectile.velocity.Y = projectile.velocity.Y + 0.2f; } projectile.rotation += projectile.velocity.X * 0.1f; - int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 58, 0f, 0f, 100, default, 0.75f); - Dust dust = Main.dust[num199]; - dust.position.X -= 2f; - dust.position.Y += 2f; - dust.scale += (float)Main.rand.Next(50) * 0.01f; - dust.noGravity = true; - dust.velocity.Y -= 2f; - if (Main.rand.NextBool(2)) + if (Main.rand.NextBool(3)) { - int num200 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 58, 0f, 0f, 100, default, 0.75f); + int num200 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 62, 0f, 0f, 100, default, 0.75f); Dust dust2 = Main.dust[num200]; dust2.position.X -= 2f; dust2.position.Y += 2f; @@ -68,9 +61,19 @@ namespace CalamityMod.Projectiles.Typeless dust2.noGravity = true; dust2.velocity *= 0.1f; } - if ((double)projectile.velocity.Y < 0.25 && (double)projectile.velocity.Y > 0.15) + else + { + int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 62, 0f, 0f, 100, default, 0.75f); + Dust dust = Main.dust[num199]; + dust.position.X -= 2f; + dust.position.Y += 2f; + dust.scale += (float)Main.rand.Next(50) * 0.01f; + dust.noGravity = true; + dust.velocity.Y -= 2f; + } + if (projectile.velocity.Y < 0.25f && projectile.velocity.Y > 0.15f) { - projectile.velocity.X = projectile.velocity.X * 0.8f; + projectile.velocity.X *= 0.8f; } projectile.rotation = -projectile.velocity.X * 0.05f; if (projectile.velocity.Y > 16f) diff --git a/Projectiles/Typeless/XerocFire.png b/Projectiles/Typeless/XerocFire.png index 28f94674d6..297ed01ef2 100644 Binary files a/Projectiles/Typeless/XerocFire.png and b/Projectiles/Typeless/XerocFire.png differ diff --git a/Projectiles/Typeless/XerocOrb.cs b/Projectiles/Typeless/XerocOrb.cs index 5a7607f9da..00a76b1ba2 100644 --- a/Projectiles/Typeless/XerocOrb.cs +++ b/Projectiles/Typeless/XerocOrb.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Typeless public override void AI() { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 58, 0f, 0f, 100, default, 2f); + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 62, 0f, 0f, 100, default, 2f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 400f, 7f, 20f); diff --git a/Projectiles/Typeless/XerocOrb.png b/Projectiles/Typeless/XerocOrb.png index 15e8775737..c1fdbf1381 100644 Binary files a/Projectiles/Typeless/XerocOrb.png and b/Projectiles/Typeless/XerocOrb.png differ diff --git a/Projectiles/Typeless/XerocStar.cs b/Projectiles/Typeless/XerocStar.cs index 285ed3a9b2..511f7f198e 100644 --- a/Projectiles/Typeless/XerocStar.cs +++ b/Projectiles/Typeless/XerocStar.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Typeless { for (int num468 = 0; num468 < 1; num468++) { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 58, 0f, 0f, 100, default, 2f); + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 62, 0f, 0f, 100, default, 2f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; } diff --git a/Projectiles/Typeless/XerocStar.png b/Projectiles/Typeless/XerocStar.png index 454174ef8a..3ccaa4660b 100644 Binary files a/Projectiles/Typeless/XerocStar.png and b/Projectiles/Typeless/XerocStar.png differ diff --git a/Projectiles/Typeless/YanmeisKnifeSlash.cs b/Projectiles/Typeless/YanmeisKnifeSlash.cs new file mode 100644 index 0000000000..599ff27179 --- /dev/null +++ b/Projectiles/Typeless/YanmeisKnifeSlash.cs @@ -0,0 +1,113 @@ +using CalamityMod.Buffs.StatBuffs; +using CalamityMod.Buffs.StatDebuffs; +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class YanmeisKnifeSlash : ModProjectile + { + // This is a rather weird thing, but it's what the patron asked for. + public static readonly Func CanRecieveCoolEffectsFrom = (npc) => npc.boss || CalamityMod.bossMinionList.Contains(npc.type); + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Yanmei's Knife"); + Main.projFrames[projectile.type] = 5; + } + + public override void SetDefaults() + { + projectile.width = 180; + projectile.height = 96; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.ownerHitCheck = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 20; + projectile.Calamity().trueMelee = true; + } + + public override void AI() + { + Player player = Main.player[projectile.owner]; + + // Frames and crap + projectile.frameCounter++; + if (projectile.frameCounter % 7 == 0) + { + projectile.frame++; + if (projectile.frame >= Main.projFrames[projectile.type]) + projectile.Kill(); + } + + // Create idle light and dust. + Vector2 origin = projectile.Center + projectile.velocity * 3f; + Lighting.AddLight(origin, 0f, 1.5f, 0.1f); + + Vector2 playerRotatedPoint = player.RotatedRelativePoint(player.MountedCenter, true); + + // Rotation and directioning. + float velocityAngle = projectile.velocity.ToRotation(); + projectile.rotation = velocityAngle + (projectile.spriteDirection == -1).ToInt() * MathHelper.Pi; + projectile.direction = (Math.Cos(velocityAngle) > 0).ToDirectionInt(); + + // Positioning close to the end of the player's arm. + projectile.position = playerRotatedPoint - projectile.Size * 0.5f + velocityAngle.ToRotationVector2() * 80f; + + // Sprite and player directioning. + projectile.spriteDirection = projectile.direction; + player.ChangeDir(projectile.direction); + + // Prevents the projectile from dying + projectile.timeLeft = 2; + + // Player item-based field manipulation. + player.itemRotation = (projectile.velocity * projectile.direction).ToRotation(); + player.heldProj = projectile.whoAmI; + player.itemTime = 2; + player.itemAnimation = 2; + } + + public void HandleAttachmentMovement(Player player, Vector2 playerRotatedPoint) + { + float speed = 1f; + if (player.ActiveItem().shoot == projectile.type) + { + speed = player.ActiveItem().shootSpeed * projectile.scale; + } + Vector2 newVelocity = (Main.MouseWorld - playerRotatedPoint).SafeNormalize(Vector2.UnitX * player.direction) * speed; + + // Sync if a velocity component changes. + if (projectile.velocity.X != newVelocity.X || projectile.velocity.Y != newVelocity.Y) + { + projectile.netUpdate = true; + } + projectile.velocity = newVelocity; + } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (!CanRecieveCoolEffectsFrom(target)) + return; + target.AddBuff(ModContent.BuffType(), 600); + if (!Main.dedServ) + { + for (int i = 0; i < 60; i++) + { + Dust dust = Dust.NewDustDirect(Main.player[projectile.owner].position, Main.player[projectile.owner].width, Main.player[projectile.owner].height, 267); + dust.position.X += Main.rand.NextFloat(-16f, 16f); + dust.color = Main.hslToRgb(Main.rand.NextFloat(0.26f, 0.37f), 1f, 0.75f); + dust.velocity = Main.rand.NextVector2Circular(24f, 24f); + dust.scale = Main.rand.NextFloat(1.4f, 1.8f); + dust.noGravity = true; + } + } + Main.PlaySound(SoundID.Zombie, Main.player[projectile.owner].Center, 104); + Main.player[projectile.owner].AddBuff(ModContent.BuffType(), 600); + } + public override Color? GetAlpha(Color lightColor) => new Color(0, 215, 0, 0); + } +} diff --git a/Projectiles/Typeless/YanmeisKnifeSlash.png b/Projectiles/Typeless/YanmeisKnifeSlash.png new file mode 100644 index 0000000000..e0b03d728c Binary files /dev/null and b/Projectiles/Typeless/YanmeisKnifeSlash.png differ diff --git a/Schematics/AutoGeneratedContent/AstralBeaconSchematic.cs b/Schematics/AutoGeneratedContent/AstralBeaconSchematic.cs new file mode 100644 index 0000000000..d000f806ef --- /dev/null +++ b/Schematics/AutoGeneratedContent/AstralBeaconSchematic.cs @@ -0,0 +1,631 @@ +using CalamityMod.Walls; +using Microsoft.Xna.Framework; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Tiles.Astral; +using CalamityMod.Tiles.Ores; + +namespace CalamityMod.Schematics.AutoGeneratedContent +{ + public class AstralBeaconSchematic + { + [GeneratedCode("ScreenCaptureToSchematic", "1.0.1")] + public static ColorTileMap GetMap() + { + var tile1 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 0, 0, 0); + var tile2 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(0, 54).UseHeaders(0, 0, 0, 32); + var tile3 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(36, 72).UseHeaders(0, 16, 0, 32); + var tile4 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(54, 0).UseHeaders(0, 32, 0, 32); + var tile5 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(54, 126).UseHeaders(0, 16, 0, 32); + var tile6 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(0, 18).UseHeaders(0, 16, 0, 32); + var tile7 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(0, 72).UseHeaders(0, 0, 0, 32); + var tile8 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(72, 54).UseHeaders(0, 32, 0, 32); + var tile9 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 0, 108).UseFrame(54, 144).UseHeaders(0, 16, 3, 32); + var tile10 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 0, 0).UseFrame(18, 18).UseHeaders(0, 0, 0, 32); + var tile11 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 0, 0).UseFrame(54, 18).UseHeaders(0, 32, 0, 32); + var tile12 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 36, 36).UseFrame(0, 36).UseHeaders(0, 33, 1, 32); + var tile13 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 360, 0).UseFrame(0, 18).UseHeaders(0, 26, 0, 32); + var tile14 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 36, 36).UseFrame(0, 18).UseHeaders(0, 17, 1, 32); + var tile15 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 360, 0).UseHeaders(0, 10, 0, 32); + var tile16 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 36, 36).UseHeaders(0, 1, 1, 32); + var tile17 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 360, 0).UseFrame(0, 36).UseHeaders(0, 42, 0, 32); + var tile18 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 36, 36).UseFrame(0, 72).UseHeaders(0, 1, 1, 32); + var tile19 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(0, 36).UseHeaders(0, 32, 0, 32); + var tile20 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(54, 144).UseHeaders(0, 16, 0, 32); + var tile21 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 108, 0).UseFrame(36, 18).UseHeaders(0, 147, 0, 32); + var tile22 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 108, 36).UseFrame(54, 18).UseHeaders(0, 163, 1, 32); + var tile23 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 252, 36).UseFrame(18, 18).UseHeaders(0, 71, 1, 32); + var tile24 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 396, 72).UseFrame(36, 18).UseHeaders(0, 155, 2, 32); + var tile25 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 108, 36).UseFrame(18, 18).UseHeaders(0, 131, 1, 32); + var tile26 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 252, 72).UseFrame(18, 18).UseHeaders(0, 71, 2, 32); + var tile27 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 72, 36).UseFrame(18, 18).UseHeaders(0, 66, 1, 32); + var tile28 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 108, 36).UseFrame(36, 18).UseHeaders(0, 147, 1, 32); + var tile29 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 72, 36).UseFrame(36, 18).UseHeaders(0, 82, 1, 32); + var tile30 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 252, 72).UseFrame(36, 18).UseHeaders(0, 87, 2, 32); + var tile31 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 72, 36).UseFrame(54, 18).UseHeaders(0, 98, 1, 32); + var tile32 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 108, 36).UseFrame(54, 36).UseHeaders(0, 163, 1, 32); + var tile33 = new TileDefinitionStructure(TileID.Trees).UseFrame(66, 0).UseHeaders(0, 0, 0, 32); + var tile34 = new TileDefinitionStructure(TileID.Trees).UseFrame(44, 242).UseHeaders(0, 0, 0, 32); + var tile35 = new TileDefinitionStructure(TileID.Trees).UseFrame(44, 132).UseHeaders(0, 0, 0, 32); + var tile36 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(18, 0).UseHeaders(0, 0, 0, 32); + var tile37 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 0, 108).UseFrame(18, 18).UseHeaders(0, 0, 3, 32); + var tile38 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 0, 36).UseFrame(18, 18).UseHeaders(0, 64, 1, 32); + var tile39 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 36, 36).UseFrame(36, 18).UseHeaders(0, 17, 1, 32); + var tile40 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 360, 0).UseFrame(18, 18).UseHeaders(0, 10, 0, 32); + var tile41 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 288, 36).UseFrame(36, 18).UseHeaders(0, 152, 1, 32); + var tile42 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 396, 72).UseFrame(54, 18).UseHeaders(0, 171, 2, 32); + var tile43 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 288, 36).UseFrame(54, 18).UseHeaders(0, 168, 1, 32); + var tile44 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 288, 36).UseFrame(18, 18).UseHeaders(0, 136, 1, 32); + var tile45 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 396, 72).UseFrame(18, 18).UseHeaders(0, 139, 2, 32); + var tile46 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 396, 72).UseFrame(54, 36).UseHeaders(0, 171, 2, 32); + var tile47 = new TileDefinitionStructure(TileID.Trees).UseFrame(22, 198).UseHeaders(0, 0, 0, 32); + var tile48 = new TileDefinitionStructure(TileID.Trees).UseFrame(88, 0).UseHeaders(0, 0, 0, 32); + var tile49 = new TileDefinitionStructure(TileID.Trees).UseFrame(22, 0).UseHeaders(0, 0, 0, 32); + var tile50 = new TileDefinitionStructure(TileID.Trees).UseFrame(0, 22).UseHeaders(0, 0, 0, 32); + var tile51 = new TileDefinitionStructure(TileID.Trees).UseFrame(44, 110).UseHeaders(0, 0, 0, 32); + var tile52 = new TileDefinitionStructure(TileID.Trees).UseFrame(22, 88).UseHeaders(0, 0, 0, 32); + var tile53 = new TileDefinitionStructure(TileID.Trees).UseFrame(110, 66).UseHeaders(0, 0, 0, 32); + var tile54 = new TileDefinitionStructure(TileID.Trees).UseFrame(22, 66).UseHeaders(0, 0, 0, 32); + var tile55 = new TileDefinitionStructure(TileID.Trees).UseFrame(0, 44).UseHeaders(0, 0, 0, 32); + var tile56 = new TileDefinitionStructure(TileID.Trees).UseHeaders(0, 0, 0, 32); + var tile57 = new TileDefinitionStructure(TileID.Trees).UseFrame(66, 132).UseHeaders(0, 0, 0, 32); + var tile58 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 36, 0).UseFrame(54, 18).UseHeaders(0, 33, 0, 32); + var tile59 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 288, 72).UseFrame(18, 18).UseHeaders(0, 136, 2, 32); + var tile60 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 288, 72).UseFrame(36, 18).UseHeaders(0, 152, 2, 32); + var tile61 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 36, 36).UseFrame(18, 18).UseHeaders(0, 1, 1, 32); + var tile62 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 360, 0).UseFrame(54, 18).UseHeaders(0, 42, 0, 32); + var tile63 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 36, 36).UseFrame(54, 18).UseHeaders(0, 33, 1, 32); + var tile64 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 360, 0).UseFrame(36, 18).UseHeaders(0, 26, 0, 32); + var tile65 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 252, 72).UseFrame(54, 18).UseHeaders(0, 103, 2, 32); + var tile66 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 108, 36).UseFrame(36, 36).UseHeaders(0, 147, 1, 32); + var tile67 = new TileDefinitionStructure(TileID.Trees).UseFrame(66, 220).UseHeaders(0, 0, 0, 32); + var tile68 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(126, 0).UseHeaders(0, 0, 0, 32); + var tile69 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 108, 0).UseFrame(54, 18).UseHeaders(0, 163, 0, 32); + var tile70 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 252, 36).UseFrame(36, 18).UseHeaders(0, 87, 1, 32); + var tile71 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 396, 0).UseFrame(18, 18).UseHeaders(0, 11, 0, 32); + var tile72 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 396, 36).UseFrame(18, 18).UseHeaders(0, 75, 1, 32); + var tile73 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 216, 36).UseFrame(54, 18).UseHeaders(0, 38, 1, 32); + var tile74 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(36, 0).UseHeaders(0, 16, 0, 32); + var tile75 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 72, 0).UseFrame(36, 18).UseHeaders(0, 82, 0, 32); + var tile76 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 360, 72).UseFrame(36, 18).UseHeaders(0, 154, 2, 32); + var tile77 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 360, 36).UseFrame(18, 18).UseHeaders(0, 74, 1, 32); + var tile78 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 360, 36).UseFrame(54, 18).UseHeaders(0, 106, 1, 32); + var tile79 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 288, 36).UseFrame(18, 36).UseHeaders(0, 136, 1, 32); + var tile80 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 72, 0).UseFrame(18, 18).UseHeaders(0, 66, 0, 32); + var tile81 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 216, 72).UseFrame(18, 18).UseHeaders(0, 6, 2, 32); + var tile82 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 0, 72).UseFrame(36, 18).UseHeaders(0, 144, 2, 32); + var tile83 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 360, 0).UseFrame(54, 36).UseHeaders(0, 42, 0, 32); + var tile84 = new TileDefinitionStructure(TileID.Trees).UseFrame(66, 22).UseHeaders(0, 0, 0, 32); + var tile85 = new TileDefinitionStructure(TileID.Trees).UseFrame(44, 198).UseHeaders(0, 0, 0, 32); + var tile86 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 216, 36).UseFrame(18, 18).UseHeaders(0, 6, 1, 32); + var tile87 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 396, 36).UseFrame(36, 18).UseHeaders(0, 91, 1, 32); + var tile88 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 144, 72).UseFrame(36, 18).UseHeaders(0, 148, 2, 32); + var tile89 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 144, 36).UseFrame(54, 18).UseHeaders(0, 100, 1, 32); + var tile90 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 144, 36).UseFrame(36, 18).UseHeaders(0, 84, 1, 32); + var tile91 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 144, 72).UseFrame(18, 18).UseHeaders(0, 132, 2, 32); + var tile92 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 0, 72).UseFrame(54, 18).UseHeaders(0, 160, 2, 32); + var tile93 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 144, 144).UseFrame(54, 18).UseHeaders(0, 164, 4, 32); + var tile94 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 72, 36).UseFrame(54, 36).UseHeaders(0, 98, 1, 32); + var tile95 = new TileDefinitionStructure(TileID.Trees).UseFrame(0, 110).UseHeaders(0, 0, 0, 32); + var tile96 = new TileDefinitionStructure(TileID.Trees).UseFrame(66, 66).UseHeaders(0, 0, 0, 32); + var tile97 = new TileDefinitionStructure(TileID.Trees).UseFrame(0, 66).UseHeaders(0, 0, 0, 32); + var tile98 = new TileDefinitionStructure(TileID.Trees).UseFrame(0, 132).UseHeaders(0, 0, 0, 32); + var tile99 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 108, 36).UseFrame(18, 18).UseHeaders(0, 131, 1, 32); + var tile100 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 108, 144).UseFrame(54, 18).UseHeaders(0, 99, 4, 32); + var tile101 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(18, 18).UseHeaders(0, 32, 0, 32); + var tile102 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(18, 18).UseHeaders(0, 16, 0, 32); + var tile103 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(162, 126).UseHeaders(0, 0, 0, 32); + var tile104 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(36, 180).UseHeaders(0, 32, 0, 32); + var tile105 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 72, 0).UseFrame(54, 18).UseHeaders(0, 98, 0, 32); + var tile106 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 144, 36).UseFrame(18, 18).UseHeaders(0, 68, 1, 32); + var tile107 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 144, 0).UseFrame(18, 18).UseHeaders(0, 4, 0, 32); + var tile108 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 288, 36).UseFrame(36, 36).UseHeaders(0, 152, 1, 32); + var tile109 = new TileDefinitionStructure(TileID.Trees).UseFrame(66, 242).UseHeaders(0, 0, 0, 32); + var tile110 = new TileDefinitionStructure(TileID.Trees).UseFrame(66, 198).UseHeaders(0, 0, 0, 32); + var tile111 = new TileDefinitionStructure(TileID.Trees).UseFrame(22, 132).UseHeaders(0, 0, 0, 32); + var tile112 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 180, 144).UseFrame(18, 18).UseHeaders(0, 133, 4, 32); + var tile113 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(144, 54).UseHeaders(0, 32, 0, 32); + var tile114 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(18, 18).UseHeaders(0, 0, 0, 32); + var tile115 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 108, 108).UseFrame(36, 18).UseHeaders(0, 83, 3, 32); + var tile116 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 36, 72).UseFrame(18, 18).UseHeaders(0, 1, 2, 32); + var tile117 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 324, 72).UseFrame(54, 18).UseHeaders(0, 169, 2, 32); + var tile118 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 360, 0).UseFrame(18, 36).UseHeaders(0, 10, 0, 32); + var tile119 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 108, 72).UseFrame(54, 18).UseHeaders(0, 163, 2, 32); + var tile120 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 252, 144).UseFrame(18, 18).UseHeaders(0, 71, 4, 32); + var tile121 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 180, 108).UseFrame(54, 18).UseHeaders(0, 165, 3, 32); + var tile122 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 180, 72).UseFrame(36, 18).UseHeaders(0, 149, 2, 32); + var tile123 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 0, 144).UseFrame(54, 18).UseHeaders(0, 32, 4, 32); + var tile124 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 72, 36).UseFrame(18, 36).UseHeaders(0, 66, 1, 32); + var tile125 = new TileDefinitionStructure(TileID.Trees).UseFrame(44, 220).UseHeaders(0, 0, 0, 32); + var tile126 = new TileDefinitionStructure(TileID.Trees).UseFrame(44, 154).UseHeaders(0, 0, 0, 32); + var tile127 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 72, 72).UseFrame(18, 18).UseHeaders(0, 66, 2, 32); + var tile128 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 432, 0).UseFrame(18, 18).UseHeaders(0, 12, 0, 32); + var tile129 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 108, 108).UseFrame(54, 18).UseHeaders(0, 99, 3, 32); + var tile130 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 252, 108).UseFrame(36, 18).UseHeaders(0, 87, 3, 32); + var tile131 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 288, 36).UseFrame(54, 36).UseHeaders(0, 168, 1, 32); + var tile132 = new TileDefinitionStructure(TileID.Trees).UseFrame(22, 242).UseHeaders(0, 0, 0, 32); + var tile133 = new TileDefinitionStructure(TileID.Trees).UseFrame(44, 88).UseHeaders(0, 0, 0, 32); + var tile134 = new TileDefinitionStructure(TileID.Trees).UseFrame(22, 44).UseHeaders(0, 0, 0, 32); + var tile135 = new TileDefinitionStructure(TileID.Trees).UseFrame(88, 132).UseHeaders(0, 0, 0, 32); + var tile136 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 180, 144).UseFrame(54, 18).UseHeaders(0, 165, 4, 32); + var tile137 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(180, 144).UseHeaders(0, 16, 0, 32); + var tile138 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(198, 180).UseHeaders(0, 32, 0, 32); + var tile139 = new TileDefinitionStructure(TileID.Trees).UseFrame(88, 110).UseHeaders(0, 0, 0, 32); + var tile140 = new TileDefinitionStructure(TileID.Trees).UseFrame(88, 66).UseHeaders(0, 0, 0, 32); + var tile141 = new TileDefinitionStructure(TileID.Trees).UseFrame(22, 154).UseHeaders(0, 0, 0, 32); + var tile142 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 252, 144).UseFrame(54, 18).UseHeaders(0, 103, 4, 32); + var tile143 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 288, 0).UseFrame(36, 18).UseHeaders(0, 152, 0, 32); + var tile144 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 0, 0).UseFrame(36, 18).UseHeaders(0, 16, 0, 32); + var tile145 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 0, 144).UseFrame(18, 18).UseHeaders(0, 0, 4, 32); + var tile146 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 36, 36).UseFrame(54, 36).UseHeaders(0, 33, 1, 32); + var tile147 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 252, 144).UseFrame(36, 18).UseHeaders(0, 87, 4, 32); + var tile148 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 180, 108).UseFrame(36, 18).UseHeaders(0, 149, 3, 32); + var tile149 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 144, 0).UseFrame(36, 18).UseHeaders(0, 20, 0, 32); + var tile150 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 108, 36).UseFrame(18, 36).UseHeaders(0, 131, 1, 32); + var tile151 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 432, 36).UseFrame(36, 18).UseHeaders(0, 92, 1, 32); + var tile152 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 108, 108).UseFrame(198, 18).UseHeaders(0, 83, 3, 32); + var tile153 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 144, 36).UseFrame(198, 18).UseHeaders(0, 84, 1, 32); + var tile154 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 396, 72).UseFrame(36, 36).UseHeaders(0, 155, 2, 32); + var tile155 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(144, 72).UseHeaders(0, 32, 0, 32); + var tile156 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(18, 0).UseHeaders(0, 16, 0, 32); + var tile157 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(0, 162).UseHeaders(0, 32, 0, 32); + var tile158 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(180, 126).UseHeaders(0, 0, 0, 32); + var tile159 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(180, 162).UseHeaders(0, 32, 0, 32); + var tile160 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(198, 162).UseHeaders(0, 16, 0, 32); + var tile161 = new TileDefinitionStructure(TileID.Trees).UseFrame(22, 22).UseHeaders(0, 0, 0, 32); + var tile162 = new TileDefinitionStructure(TileID.Trees).UseFrame(22, 110).UseHeaders(0, 0, 0, 32); + var tile163 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(108, 72).UseHeaders(0, 0, 0, 32); + var tile164 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 144, 108).UseFrame(18, 18).UseHeaders(0, 132, 3, 32); + var tile165 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 0, 36).UseFrame(36, 18).UseHeaders(0, 80, 1, 32); + var tile166 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 396, 108).UseFrame(216, 18).UseHeaders(0, 155, 3, 32); + var tile167 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(18, 0).UseHeaders(0, 32, 0, 32); + var tile168 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 72, 108).UseFrame(18, 18).UseHeaders(0, 66, 3, 32); + var tile169 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 1056); + var tile170 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(0, 18).UseHeaders(0, 32, 0, 32); + var tile171 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 36, 0).UseFrame(18, 18).UseHeaders(0, 1, 0, 32); + var tile172 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 36, 36).UseFrame(18, 36).UseHeaders(0, 1, 1, 32); + var tile173 = new TileDefinitionStructure(ModContent.TileType()).UseSlope(2).UseHeaders(0, 0, 0, 8224); + var tile174 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 396, 72).UseFrame(18, 36).UseHeaders(0, 139, 2, 32); + var tile175 = new TileDefinitionStructure(ModContent.TileType()).UseSlope(2).UseHeaders(0, 32, 0, 8224); + var tile176 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(0, 18).UseHeaders(0, 16, 0, 32); + var tile177 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(144, 54).UseHeaders(0, 0, 0, 32); + var tile178 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 396, 0).UseFrame(36, 18).UseHeaders(0, 27, 0, 32); + var tile179 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 72, 36).UseFrame(36, 18).UseHeaders(0, 82, 1, 32); + var tile180 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 252, 36).UseFrame(54, 18).UseHeaders(0, 103, 1, 32); + var tile181 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 36, 36).UseFrame(36, 36).UseHeaders(0, 17, 1, 32); + var tile182 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(0, 18).UseHeaders(0, 0, 0, 32); + var tile183 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(0, 36).UseSlope(4).UseHeaders(0, 32, 0, 16416); + var tile184 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(144, 54).UseHeaders(0, 16, 0, 32); + var tile185 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 72, 108).UseFrame(54, 18).UseHeaders(0, 98, 3, 32); + var tile186 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 144, 0).UseFrame(54, 18).UseHeaders(0, 36, 0, 32); + var tile187 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 144, 72).UseFrame(198, 36).UseHeaders(0, 164, 2, 32); + var tile188 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(54, 0).UseSlope(1).UseHeaders(0, 0, 0, 4128); + var tile189 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(54, 18).UseHeaders(0, 0, 0, 32); + var tile190 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(180, 54).UseHeaders(0, 0, 0, 32); + var tile191 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(126, 54).UseHeaders(0, 16, 0, 32); + var tile192 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(144, 36).UseHeaders(0, 32, 0, 32); + var tile193 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(0, 36).UseHeaders(0, 32, 0, 32); + var tile194 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32); + var tile195 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 36, 144).UseFrame(18, 18).UseHeaders(0, 1, 4, 32); + var tile196 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(198, 144).UseHeaders(0, 0, 0, 32); + var tile197 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(36, 0).UseSlope(1).UseHeaders(0, 0, 0, 4128); + var tile198 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(36, 18).UseHeaders(0, 16, 0, 32); + var tile199 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(126, 54).UseHeaders(0, 32, 0, 32); + var tile200 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(18, 36).UseHeaders(0, 32, 0, 32); + var tile201 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 72, 108).UseFrame(36, 18).UseHeaders(0, 82, 3, 32); + var tile202 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(36, 0).UseHeaders(0, 0, 0, 32); + var tile203 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(144, 36).UseHeaders(0, 0, 0, 32); + var tile204 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(126, 36).UseHeaders(0, 32, 0, 32); + var tile205 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(36, 18).UseHeaders(0, 32, 0, 32); + var tile206 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(36, 18).UseHeaders(0, 0, 0, 32); + var tile207 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 36, 0).UseFrame(36, 18).UseHeaders(0, 17, 0, 32); + var tile208 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32); + var tile209 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(0, 18).UseHeaders(0, 0, 0, 32); + var tile210 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(0, 36).UseHeaders(0, 0, 0, 32); + var tile211 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(0, 54).UseHeaders(0, 0, 0, 32); + var tile212 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(36, 36).UseSlope(3).UseHeaders(0, 16, 0, 12320); + var tile213 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(36, 0).UseSlope(1).UseHeaders(0, 32, 0, 4128); + var tile214 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(126, 54).UseHeaders(0, 0, 0, 32); + var tile215 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 0, 72).UseFrame(18, 18).UseHeaders(0, 128, 2, 32); + var tile216 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 288, 72).UseFrame(54, 18).UseHeaders(0, 168, 2, 32); + var tile217 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(18, 0).UseHeaders(0, 0, 0, 32); + var tile218 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(18, 18).UseHeaders(0, 0, 0, 32); + var tile219 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(18, 36).UseHeaders(0, 0, 0, 32); + var tile220 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(18, 54).UseHeaders(0, 0, 0, 32); + var tile221 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(18, 0).UseHeaders(0, 0, 0, 32); + var tile222 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(18, 36).UseHeaders(0, 0, 0, 32); + var tile223 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 0, 108).UseFrame(36, 18).UseHeaders(0, 16, 3, 32); + var tile224 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 396, 0).UseFrame(54, 18).UseHeaders(0, 43, 0, 32); + var tile225 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(36, 0).UseHeaders(0, 0, 0, 32); + var tile226 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(36, 18).UseHeaders(0, 0, 0, 32); + var tile227 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(36, 36).UseHeaders(0, 0, 0, 32); + var tile228 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(36, 54).UseHeaders(0, 0, 0, 32); + var tile229 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 288, 0).UseFrame(54, 18).UseHeaders(0, 168, 0, 32); + var tile230 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 180, 72).UseFrame(54, 18).UseHeaders(0, 165, 2, 32); + var tile231 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 360, 72).UseFrame(18, 18).UseHeaders(0, 138, 2, 32); + var tile232 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(54, 0).UseHeaders(0, 0, 0, 32); + var tile233 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(54, 18).UseHeaders(0, 0, 0, 32); + var tile234 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(54, 36).UseHeaders(0, 0, 0, 32); + var tile235 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(54, 54).UseHeaders(0, 0, 0, 32); + var tile236 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 216, 72).UseFrame(36, 18).UseHeaders(0, 22, 2, 32); + var tile237 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(72, 0).UseHeaders(0, 0, 0, 32); + var tile238 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(72, 18).UseHeaders(0, 0, 0, 32); + var tile239 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(72, 36).UseHeaders(0, 0, 0, 32); + var tile240 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(72, 54).UseHeaders(0, 0, 0, 32); + var tile241 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(0, 36).UseSlope(4).UseHeaders(0, 16, 0, 16416); + var tile242 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(126, 36).UseHeaders(0, 0, 0, 32); + var tile243 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(144, 36).UseHeaders(0, 16, 0, 32); + var tile244 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(36, 36).UseSlope(3).UseHeaders(0, 32, 0, 12320); + var tile245 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(36, 0).UseSlope(1).UseHeaders(0, 16, 0, 4128); + var tile246 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 0, 36).UseFrame(54, 18).UseHeaders(0, 96, 1, 32); + var tile247 = new TileDefinitionStructure(ModContent.TileType()).UseSlope(2).UseHeaders(0, 16, 0, 8224); + var tile248 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(36, 0).UseHeaders(0, 16, 0, 32); + var tile249 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 396, 36).UseFrame(54, 18).UseHeaders(0, 107, 1, 32); + var tile250 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(54, 0).UseSlope(2).UseHeaders(0, 32, 0, 8224); + var tile251 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(180, 54).UseHeaders(0, 32, 0, 32); + var tile252 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(36, 0).UseHeaders(0, 16, 0, 1056); + var tile253 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 252, 0).UseFrame(54, 18).UseHeaders(0, 103, 0, 32); + var tile254 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 360, 72).UseFrame(54, 18).UseHeaders(0, 170, 2, 32); + var tile255 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 108, 108).UseFrame(18, 18).UseHeaders(0, 67, 3, 32); + var tile256 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 144, 72).UseFrame(18, 306).UseHeaders(0, 164, 2, 32); + var tile257 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 144, 72).UseFrame(54, 18).UseHeaders(0, 164, 2, 32); + var tile258 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 396, 108).UseFrame(36, 18).UseHeaders(0, 155, 3, 32); + var tile259 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 396, 108).UseFrame(18, 18).UseHeaders(0, 139, 3, 32); + var tile260 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(252, 36).UseHeaders(0, 16, 0, 32); + var tile261 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 216, 36).UseFrame(36, 18).UseHeaders(0, 22, 1, 32); + var tile262 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(36, 54).UseHeaders(0, 32, 0, 32); + var tile263 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(162, 36).UseHeaders(0, 32, 0, 32); + var tile264 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(90, 0).UseHeaders(0, 0, 0, 32); + var tile265 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(126, 72).UseHeaders(0, 16, 0, 32); + var tile266 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 216, 0).UseFrame(36, 18).UseHeaders(0, 22, 0, 32); + var tile267 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 180, 0).UseFrame(18, 18).UseHeaders(0, 5, 0, 32); + var tile268 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 216, 72).UseFrame(54, 18).UseHeaders(0, 38, 2, 32); + var tile269 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 144, 0).UseFrame(18, 270).UseHeaders(0, 4, 0, 32); + var tile270 = new TileDefinitionStructure(TileID.Trees).UseFrame(66, 44).UseHeaders(0, 0, 0, 32); + var tile271 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 324, 0).UseFrame(18, 18).UseHeaders(0, 9, 0, 32); + var tile272 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 36, 108).UseFrame(36, 18).UseHeaders(0, 17, 3, 32); + var tile273 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 72, 144).UseFrame(54, 18).UseHeaders(0, 98, 4, 32); + var tile274 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 144, 144).UseFrame(18, 18).UseHeaders(0, 132, 4, 32); + var tile275 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32); + var tile276 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 180, 108).UseFrame(18, 18).UseHeaders(0, 133, 3, 32); + var tile277 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 108, 0).UseFrame(18, 18).UseHeaders(0, 131, 0, 32); + var tile278 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 36, 72).UseFrame(54, 18).UseHeaders(0, 33, 2, 32); + var tile279 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(54, 54).UseSlope(1).UseHeaders(0, 16, 0, 4128); + var tile280 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(36, 108).UseHeaders(0, 0, 0, 32); + var tile281 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 0, 108).UseFrame(54, 18).UseHeaders(0, 32, 3, 32); + var tile282 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 72, 72).UseFrame(54, 18).UseHeaders(0, 98, 2, 32); + var tile283 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 360, 108).UseFrame(36, 18).UseHeaders(0, 90, 3, 32); + var tile284 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(144, 126).UseHeaders(0, 0, 0, 32); + var tile285 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(54, 18).UseHeaders(0, 32, 0, 32); + var tile286 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 72, 144).UseFrame(36, 18).UseHeaders(0, 82, 4, 32); + var tile287 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(144, 144).UseHeaders(0, 16, 0, 32); + var tile288 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(108, 198).UseHeaders(0, 0, 0, 32); + var tile289 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(90, 54).UseHeaders(0, 32, 0, 1056); + var tile290 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(36, 180).UseHeaders(0, 32, 0, 32); + var tile291 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 360, 36).UseFrame(36, 18).UseHeaders(0, 90, 1, 32); + var tile292 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 72, 36).UseFrame(144, 198).UseHeaders(0, 98, 1, 32); + var tile293 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(54, 54).UseHeaders(0, 16, 0, 1056); + var tile294 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(72, 0).UseHeaders(0, 0, 0, 32); + var tile295 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 108, 36).UseFrame(72, 36).UseHeaders(0, 163, 1, 32); + var tile296 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 288, 36).UseFrame(72, 0).UseHeaders(0, 136, 1, 32); + var tile297 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 396, 72).UseFrame(72, 18).UseHeaders(0, 155, 2, 32); + var tile298 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 288, 36).UseFrame(72, 18).UseHeaders(0, 152, 1, 32); + var tile299 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 396, 72).UseFrame(72, 36).UseHeaders(0, 171, 2, 32); + var tile300 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 108, 36).UseFrame(72, 0).UseHeaders(0, 131, 1, 32); + var tile301 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 396, 72).UseFrame(72, 0).UseHeaders(0, 139, 2, 32); + var tile302 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 108, 36).UseFrame(72, 18).UseHeaders(0, 147, 1, 32); + var tile303 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 288, 36).UseFrame(72, 36).UseHeaders(0, 168, 1, 32); + var tile304 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 396, 72).UseFrame(18, 72).UseHeaders(0, 139, 2, 32); + Dictionary colorTileMap = new Dictionary() + { + { new Color(255, 255, 255), tile1}, + { new Color(22, 190, 82), tile2}, + { new Color(77, 171, 121), tile3}, + { new Color(227, 189, 85), tile4}, + { new Color(113, 89, 16), tile5}, + { new Color(107, 51, 16), tile6}, + { new Color(18, 113, 232), tile7}, + { new Color(72, 174, 103), tile8}, + { new Color(67, 153, 27), tile9}, + { new Color(169, 151, 91), tile10}, + { new Color(114, 25, 160), tile11}, + { new Color(212, 85, 23), tile12}, + { new Color(22, 119, 41), tile13}, + { new Color(71, 156, 64), tile14}, + { new Color(55, 15, 126), tile15}, + { new Color(27, 142, 189), tile16}, + { new Color(47, 178, 214), tile17}, + { new Color(58, 117, 140), tile18}, + { new Color(163, 167, 133), tile19}, + { new Color(149, 211, 36), tile20}, + { new Color(55, 164, 19), tile21}, + { new Color(29, 112, 163), tile22}, + { new Color(181, 156, 3), tile23}, + { new Color(249, 84, 187), tile24}, + { new Color(231, 203, 213), tile25}, + { new Color(168, 17, 159), tile26}, + { new Color(233, 39, 10), tile27}, + { new Color(94, 122, 229), tile28}, + { new Color(133, 56, 163), tile29}, + { new Color(19, 49, 174), tile30}, + { new Color(145, 129, 164), tile31}, + { new Color(4, 15, 248), tile32}, + { new Color(44, 25, 158), tile33}, + { new Color(219, 101, 241), tile34}, + { new Color(185, 53, 93), tile35}, + { new Color(26, 83, 170), tile36}, + { new Color(183, 251, 150), tile37}, + { new Color(229, 171, 171), tile38}, + { new Color(25, 216, 41), tile39}, + { new Color(46, 151, 56), tile40}, + { new Color(255, 162, 107), tile41}, + { new Color(85, 103, 211), tile42}, + { new Color(23, 226, 187), tile43}, + { new Color(220, 123, 247), tile44}, + { new Color(1, 13, 193), tile45}, + { new Color(25, 164, 69), tile46}, + { new Color(135, 106, 229), tile47}, + { new Color(249, 91, 53), tile48}, + { new Color(23, 172, 213), tile49}, + { new Color(248, 234, 54), tile50}, + { new Color(206, 254, 129), tile51}, + { new Color(101, 219, 195), tile52}, + { new Color(133, 100, 205), tile53}, + { new Color(137, 3, 112), tile54}, + { new Color(238, 218, 128), tile55}, + { new Color(158, 227, 158), tile56}, + { new Color(234, 0, 52), tile57}, + { new Color(228, 166, 45), tile58}, + { new Color(82, 5, 71), tile59}, + { new Color(54, 61, 187), tile60}, + { new Color(254, 30, 247), tile61}, + { new Color(132, 13, 124), tile62}, + { new Color(118, 155, 49), tile63}, + { new Color(254, 147, 64), tile64}, + { new Color(119, 253, 103), tile65}, + { new Color(117, 10, 128), tile66}, + { new Color(181, 121, 200), tile67}, + { new Color(55, 14, 234), tile68}, + { new Color(2, 234, 88), tile69}, + { new Color(84, 19, 214), tile70}, + { new Color(123, 79, 39), tile71}, + { new Color(18, 139, 229), tile72}, + { new Color(120, 105, 205), tile73}, + { new Color(3, 40, 72), tile74}, + { new Color(108, 235, 109), tile75}, + { new Color(244, 108, 168), tile76}, + { new Color(197, 221, 250), tile77}, + { new Color(199, 128, 195), tile78}, + { new Color(242, 199, 16), tile79}, + { new Color(13, 130, 35), tile80}, + { new Color(36, 33, 136), tile81}, + { new Color(91, 130, 67), tile82}, + { new Color(24, 101, 114), tile83}, + { new Color(129, 252, 161), tile84}, + { new Color(179, 178, 80), tile85}, + { new Color(128, 202, 34), tile86}, + { new Color(124, 14, 125), tile87}, + { new Color(175, 142, 53), tile88}, + { new Color(219, 180, 207), tile89}, + { new Color(99, 31, 195), tile90}, + { new Color(213, 107, 231), tile91}, + { new Color(169, 223, 7), tile92}, + { new Color(192, 16, 105), tile93}, + { new Color(42, 219, 7), tile94}, + { new Color(53, 68, 225), tile95}, + { new Color(89, 19, 206), tile96}, + { new Color(114, 114, 252), tile97}, + { new Color(237, 144, 116), tile98}, + { new Color(165, 116, 146), tile99}, + { new Color(83, 128, 206), tile100}, + { new Color(115, 181, 69), tile101}, + { new Color(175, 172, 145), tile102}, + { new Color(185, 9, 210), tile103}, + { new Color(73, 192, 186), tile104}, + { new Color(185, 82, 50), tile105}, + { new Color(117, 121, 74), tile106}, + { new Color(83, 129, 160), tile107}, + { new Color(1, 240, 173), tile108}, + { new Color(198, 231, 218), tile109}, + { new Color(115, 4, 106), tile110}, + { new Color(116, 108, 143), tile111}, + { new Color(154, 182, 38), tile112}, + { new Color(194, 134, 151), tile113}, + { new Color(79, 160, 10), tile114}, + { new Color(251, 41, 178), tile115}, + { new Color(66, 52, 62), tile116}, + { new Color(65, 47, 250), tile117}, + { new Color(71, 255, 255), tile118}, + { new Color(45, 114, 197), tile119}, + { new Color(151, 232, 196), tile120}, + { new Color(182, 70, 5), tile121}, + { new Color(103, 212, 83), tile122}, + { new Color(42, 30, 156), tile123}, + { new Color(12, 179, 243), tile124}, + { new Color(179, 3, 224), tile125}, + { new Color(150, 5, 199), tile126}, + { new Color(251, 132, 179), tile127}, + { new Color(156, 49, 212), tile128}, + { new Color(112, 45, 109), tile129}, + { new Color(144, 109, 68), tile130}, + { new Color(97, 43, 157), tile131}, + { new Color(210, 152, 90), tile132}, + { new Color(5, 148, 84), tile133}, + { new Color(94, 23, 21), tile134}, + { new Color(161, 53, 124), tile135}, + { new Color(6, 148, 251), tile136}, + { new Color(30, 151, 108), tile137}, + { new Color(254, 155, 100), tile138}, + { new Color(17, 26, 20), tile139}, + { new Color(49, 247, 167), tile140}, + { new Color(230, 153, 177), tile141}, + { new Color(87, 171, 135), tile142}, + { new Color(86, 224, 106), tile143}, + { new Color(134, 145, 113), tile144}, + { new Color(114, 156, 108), tile145}, + { new Color(158, 250, 251), tile146}, + { new Color(87, 105, 153), tile147}, + { new Color(113, 114, 214), tile148}, + { new Color(215, 98, 143), tile149}, + { new Color(56, 193, 126), tile150}, + { new Color(69, 211, 157), tile151}, + { new Color(172, 120, 125), tile152}, + { new Color(100, 74, 138), tile153}, + { new Color(244, 176, 179), tile154}, + { new Color(144, 151, 5), tile155}, + { new Color(251, 139, 255), tile156}, + { new Color(247, 115, 32), tile157}, + { new Color(25, 217, 141), tile158}, + { new Color(14, 116, 39), tile159}, + { new Color(218, 128, 72), tile160}, + { new Color(248, 29, 31), tile161}, + { new Color(236, 65, 189), tile162}, + { new Color(212, 198, 36), tile163}, + { new Color(238, 57, 176), tile164}, + { new Color(113, 98, 184), tile165}, + { new Color(229, 224, 218), tile166}, + { new Color(208, 220, 215), tile167}, + { new Color(144, 64, 78), tile168}, + { new Color(94, 44, 250), tile169}, + { new Color(15, 157, 3), tile170}, + { new Color(86, 137, 201), tile171}, + { new Color(66, 252, 147), tile172}, + { new Color(148, 164, 86), tile173}, + { new Color(72, 39, 196), tile174}, + { new Color(219, 9, 57), tile175}, + { new Color(111, 167, 119), tile176}, + { new Color(212, 40, 148), tile177}, + { new Color(77, 10, 164), tile178}, + { new Color(112, 104, 220), tile179}, + { new Color(208, 142, 20), tile180}, + { new Color(195, 196, 40), tile181}, + { new Color(32, 152, 176), tile182}, + { new Color(230, 47, 102), tile183}, + { new Color(37, 81, 60), tile184}, + { new Color(131, 136, 180), tile185}, + { new Color(19, 181, 55), tile186}, + { new Color(21, 238, 132), tile187}, + { new Color(130, 58, 116), tile188}, + { new Color(111, 8, 127), tile189}, + { new Color(37, 209, 147), tile190}, + { new Color(182, 195, 22), tile191}, + { new Color(66, 133, 98), tile192}, + { new Color(156, 186, 113), tile193}, + { new Color(136, 137, 120), tile194}, + { new Color(17, 174, 215), tile195}, + { new Color(87, 201, 130), tile196}, + { new Color(239, 93, 179), tile197}, + { new Color(165, 187, 159), tile198}, + { new Color(144, 64, 137), tile199}, + { new Color(179, 176, 143), tile200}, + { new Color(48, 192, 93), tile201}, + { new Color(210, 111, 142), tile202}, + { new Color(37, 65, 2), tile203}, + { new Color(82, 118, 250), tile204}, + { new Color(198, 140, 101), tile205}, + { new Color(11, 112, 139), tile206}, + { new Color(157, 23, 63), tile207}, + { new Color(253, 54, 116), tile208}, + { new Color(224, 17, 7), tile209}, + { new Color(118, 178, 68), tile210}, + { new Color(216, 232, 10), tile211}, + { new Color(225, 88, 201), tile212}, + { new Color(27, 63, 63), tile213}, + { new Color(73, 50, 136), tile214}, + { new Color(127, 157, 230), tile215}, + { new Color(185, 222, 47), tile216}, + { new Color(58, 132, 207), tile217}, + { new Color(253, 21, 152), tile218}, + { new Color(80, 51, 137), tile219}, + { new Color(232, 241, 93), tile220}, + { new Color(134, 174, 143), tile221}, + { new Color(190, 121, 142), tile222}, + { new Color(239, 228, 52), tile223}, + { new Color(156, 240, 49), tile224}, + { new Color(76, 84, 229), tile225}, + { new Color(182, 125, 153), tile226}, + { new Color(142, 39, 51), tile227}, + { new Color(216, 60, 46), tile228}, + { new Color(116, 218, 210), tile229}, + { new Color(113, 145, 36), tile230}, + { new Color(63, 51, 77), tile231}, + { new Color(225, 194, 131), tile232}, + { new Color(249, 193, 35), tile233}, + { new Color(88, 201, 249), tile234}, + { new Color(251, 158, 147), tile235}, + { new Color(158, 177, 193), tile236}, + { new Color(178, 153, 181), tile237}, + { new Color(240, 90, 202), tile238}, + { new Color(42, 174, 114), tile239}, + { new Color(97, 73, 158), tile240}, + { new Color(187, 125, 83), tile241}, + { new Color(15, 92, 189), tile242}, + { new Color(227, 106, 145), tile243}, + { new Color(98, 188, 188), tile244}, + { new Color(118, 54, 93), tile245}, + { new Color(57, 221, 158), tile246}, + { new Color(154, 214, 41), tile247}, + { new Color(17, 191, 247), tile248}, + { new Color(110, 79, 216), tile249}, + { new Color(131, 183, 20), tile250}, + { new Color(16, 152, 119), tile251}, + { new Color(133, 156, 76), tile252}, + { new Color(166, 235, 65), tile253}, + { new Color(214, 186, 71), tile254}, + { new Color(47, 80, 221), tile255}, + { new Color(248, 122, 36), tile256}, + { new Color(109, 241, 208), tile257}, + { new Color(211, 198, 114), tile258}, + { new Color(117, 170, 190), tile259}, + { new Color(91, 161, 13), tile260}, + { new Color(228, 96, 179), tile261}, + { new Color(125, 81, 36), tile262}, + { new Color(69, 240, 153), tile263}, + { new Color(17, 147, 242), tile264}, + { new Color(93, 195, 28), tile265}, + { new Color(226, 225, 110), tile266}, + { new Color(26, 117, 212), tile267}, + { new Color(180, 22, 197), tile268}, + { new Color(67, 60, 209), tile269}, + { new Color(5, 15, 242), tile270}, + { new Color(141, 74, 73), tile271}, + { new Color(51, 242, 89), tile272}, + { new Color(147, 178, 254), tile273}, + { new Color(184, 179, 137), tile274}, + { new Color(138, 92, 94), tile275}, + { new Color(222, 118, 3), tile276}, + { new Color(85, 146, 200), tile277}, + { new Color(79, 65, 43), tile278}, + { new Color(56, 47, 74), tile279}, + { new Color(237, 57, 20), tile280}, + { new Color(82, 63, 225), tile281}, + { new Color(166, 131, 72), tile282}, + { new Color(168, 42, 208), tile283}, + { new Color(195, 78, 46), tile284}, + { new Color(112, 97, 194), tile285}, + { new Color(75, 41, 185), tile286}, + { new Color(103, 101, 198), tile287}, + { new Color(206, 175, 125), tile288}, + { new Color(42, 62, 9), tile289}, + { new Color(30, 250, 194), tile290}, + { new Color(14, 166, 121), tile291}, + { new Color(233, 102, 116), tile292}, + { new Color(168, 228, 216), tile293}, + { new Color(21, 54, 76), tile294}, + { new Color(50, 146, 68), tile295}, + { new Color(154, 223, 223), tile296}, + { new Color(105, 237, 5), tile297}, + { new Color(144, 134, 212), tile298}, + { new Color(78, 132, 143), tile299}, + { new Color(99, 124, 69), tile300}, + { new Color(62, 137, 47), tile301}, + { new Color(14, 180, 168), tile302}, + { new Color(181, 134, 250), tile303}, + { new Color(78, 163, 69), tile304}, + }; + return new ColorTileMap(colorTileMap); + } + } +} diff --git a/Schematics/AutoGeneratedContent/AstralBeaconSchematic.png b/Schematics/AutoGeneratedContent/AstralBeaconSchematic.png new file mode 100644 index 0000000000..f5dc290c3a Binary files /dev/null and b/Schematics/AutoGeneratedContent/AstralBeaconSchematic.png differ diff --git a/Schematics/AutoGeneratedContent/ResearchFacility2Schematic.cs b/Schematics/AutoGeneratedContent/ResearchFacility2Schematic.cs new file mode 100644 index 0000000000..ab3c5f807e --- /dev/null +++ b/Schematics/AutoGeneratedContent/ResearchFacility2Schematic.cs @@ -0,0 +1,541 @@ +using CalamityMod.Tiles; +using Microsoft.Xna.Framework; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Tiles.DraedonStructures; +using CalamityMod.Walls.DraedonStructures; + +namespace CalamityMod.Schematics.AutoGeneratedContent +{ + public class ResearchFacility2Schematic + { + [GeneratedCode("ScreenCaptureToSchematic", "1.0.2")] + public static ColorTileMap GetMap() + { + var tile1 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 0, 0, 0); + var tile2 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 8224).UseFrame(36, 54); + var tile3 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(0, 18); + var tile4 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32); + var tile5 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 16416).UseFrame(0, 72); + var tile6 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 8224).UseFrame(36, 54); + var tile7 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(0, 18); + var tile8 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 16416).UseFrame(36, 72); + var tile9 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(306, 72); + var tile10 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 3, 32).UseFrame(72, 18).UseWall((ushort)ModContent.WallType(), 72, 108); + var tile11 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 0, 0); + var tile12 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 80, 1, 32).UseFrame(72, 18).UseWall((ushort)ModContent.WallType(), 0, 36); + var tile13 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 4, 32).UseFrame(72, 18).UseWall((ushort)ModContent.WallType(), 72, 144); + var tile14 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(54, 72); + var tile15 = new TileDefinitionStructure(TileID.ClosedDoor).UseHeaders(0, 0, 0, 32).UseFrame(0, 756); + var tile16 = new TileDefinitionStructure(TileID.ClosedDoor).UseHeaders(0, 0, 0, 32).UseFrame(0, 774); + var tile17 = new TileDefinitionStructure(TileID.ClosedDoor).UseHeaders(0, 0, 0, 32).UseFrame(0, 792); + var tile18 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 0); + var tile19 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(54, 18); + var tile20 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(36, 36); + var tile21 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 8224).UseFrame(0, 54); + var tile22 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(306, 72); + var tile23 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 148, 3, 12320).UseFrame(54, 72).UseWall((ushort)ModContent.WallType(), 144, 108); + var tile24 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 1, 0).UseWall((ushort)ModContent.WallType(), 36, 36); + var tile25 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 1, 0).UseWall((ushort)ModContent.WallType(), 72, 36); + var tile26 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 74, 1, 0).UseWall((ushort)ModContent.WallType(), 360, 36); + var tile27 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 1, 0).UseWall((ushort)ModContent.WallType(), 72, 36); + var tile28 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 64, 1, 0).UseWall((ushort)ModContent.WallType(), 0, 36); + var tile29 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 64, 1, 0).UseWall((ushort)ModContent.WallType(), 0, 36); + var tile30 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 0, 0, 0).UseWall((ushort)WallID.SapphireGemspark, 0, 0); + var tile31 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 103, 3, 32).UseFrame(54, 0).UseWall((ushort)WallID.SapphireGemspark, 252, 108); + var tile32 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 18); + var tile33 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(54, 36); + var tile34 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(306, 72); + var tile35 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 2, 0).UseWall((ushort)ModContent.WallType(), 288, 72); + var tile36 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 1, 0).UseWall((ushort)ModContent.WallType(), 108, 36); + var tile37 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 2, 0).UseWall((ushort)ModContent.WallType(), 288, 72); + var tile38 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 2, 0).UseWall((ushort)WallID.SapphireGemspark, 72, 72); + var tile39 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 8224).UseFrame(72, 54); + var tile40 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 3, 12320).UseFrame(54, 72).UseWall((ushort)ModContent.WallType(), 72, 108); + var tile41 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 1, 0).UseWall((ushort)ModContent.WallType(), 108, 36); + var tile42 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 1, 0).UseWall((ushort)ModContent.WallType(), 252, 36); + var tile43 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 139, 2, 0).UseWall((ushort)ModContent.WallType(), 396, 72); + var tile44 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 6, 1, 0).UseWall((ushort)ModContent.WallType(), 216, 36); + var tile45 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 139, 2, 0).UseWall((ushort)ModContent.WallType(), 396, 72); + var tile46 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 1, 0).UseWall((ushort)ModContent.WallType(), 288, 36); + var tile47 = new TileDefinitionStructure(TileID.FishingCrate).UseHeaders(0, 75, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 396, 36); + var tile48 = new TileDefinitionStructure(TileID.FishingCrate).UseHeaders(0, 66, 2, 32).UseFrame(36, 18).UseWall((ushort)WallID.SapphireGemspark, 72, 72); + var tile49 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(54, 0); + var tile50 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 36); + var tile51 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(270, 72); + var tile52 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 36); + var tile53 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 1, 0, 32).UseFrame(0, 540).UseWall((ushort)ModContent.WallType(), 36, 0); + var tile54 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 66, 1, 32).UseFrame(0, 558).UseWall((ushort)ModContent.WallType(), 72, 36); + var tile55 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 1, 0).UseWall((ushort)ModContent.WallType(), 36, 36); + var tile56 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 10, 0, 0).UseWall((ushort)ModContent.WallType(), 360, 0); + var tile57 = new TileDefinitionStructure(TileID.FishingCrate).UseHeaders(0, 131, 1, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 108, 36); + var tile58 = new TileDefinitionStructure(TileID.FishingCrate).UseHeaders(0, 131, 2, 32).UseFrame(54, 18).UseWall((ushort)WallID.SapphireGemspark, 108, 72); + var tile59 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(36, 0); + var tile60 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(54, 0); + var tile61 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(252, 54); + var tile62 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 3, 12320).UseFrame(18, 72).UseWall((ushort)ModContent.WallType(), 72, 108); + var tile63 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 6, 2, 0).UseWall((ushort)ModContent.WallType(), 216, 72); + var tile64 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 2, 0).UseWall((ushort)ModContent.WallType(), 252, 72); + var tile65 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 3, 12320).UseFrame(18, 72).UseWall((ushort)ModContent.WallType(), 72, 108); + var tile66 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 1, 0).UseWall((ushort)ModContent.WallType(), 288, 36); + var tile67 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 139, 2, 0).UseWall((ushort)ModContent.WallType(), 396, 72); + var tile68 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 1, 0).UseWall((ushort)ModContent.WallType(), 72, 36); + var tile69 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 288, 36); + var tile70 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 11, 0, 0).UseWall((ushort)ModContent.WallType(), 396, 0); + var tile71 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 1, 0).UseWall((ushort)ModContent.WallType(), 108, 36); + var tile72 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 1, 0).UseWall((ushort)ModContent.WallType(), 252, 36); + var tile73 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 1, 0).UseWall((ushort)ModContent.WallType(), 36, 36); + var tile74 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 2, 0).UseWall((ushort)ModContent.WallType(), 72, 72); + var tile75 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(54, 36); + var tile76 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 0, 0).UseWall((ushort)ModContent.WallType(), 108, 0); + var tile77 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 10, 0, 0).UseWall((ushort)ModContent.WallType(), 360, 0); + var tile78 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseWall((ushort)ModContent.WallType(), 360, 72); + var tile79 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 74, 1, 0).UseWall((ushort)ModContent.WallType(), 360, 36); + var tile80 = new TileDefinitionStructure(TileID.Lamps).UseHeaders(0, 138, 2, 32).UseFrame(0, 216).UseWall((ushort)ModContent.WallType(), 360, 72); + var tile81 = new TileDefinitionStructure(TileID.Lamps).UseHeaders(0, 131, 1, 32).UseFrame(0, 234).UseWall((ushort)ModContent.WallType(), 108, 36); + var tile82 = new TileDefinitionStructure(TileID.Lamps).UseHeaders(0, 1, 2, 32).UseFrame(0, 252).UseWall((ushort)WallID.SapphireGemspark, 36, 72); + var tile83 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(90, 54); + var tile84 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(36, 0); + var tile85 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 0, 0).UseWall((ushort)ModContent.WallType(), 72, 0); + var tile86 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseWall((ushort)ModContent.WallType(), 72, 36); + var tile87 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 6, 2, 0).UseWall((ushort)ModContent.WallType(), 216, 72); + var tile88 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 2, 0).UseWall((ushort)WallID.SapphireGemspark, 252, 72); + var tile89 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 64, 1, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 0, 36); + var tile90 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 4, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 0, 144); + var tile91 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 3, 12320).UseFrame(54, 72).UseWall((ushort)ModContent.WallType(), 0, 108); + var tile92 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 6, 1, 0).UseWall((ushort)ModContent.WallType(), 216, 36); + var tile93 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 32).UseWall((ushort)ModContent.WallType(), 396, 36); + var tile94 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 108, 36); + var tile95 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseWall((ushort)ModContent.WallType(), 288, 36); + var tile96 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 1, 0).UseWall((ushort)ModContent.WallType(), 252, 36); + var tile97 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 11, 0, 0).UseWall((ushort)ModContent.WallType(), 396, 0); + var tile98 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 1, 0).UseWall((ushort)ModContent.WallType(), 252, 36); + var tile99 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 2, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 36, 72); + var tile100 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 0, 0).UseWall((ushort)ModContent.WallType(), 108, 0); + var tile101 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 74, 1, 0).UseWall((ushort)ModContent.WallType(), 360, 36); + var tile102 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 72, 36); + var tile103 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 72, 36); + var tile104 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 1, 32).UseWall((ushort)ModContent.WallType(), 360, 36); + var tile105 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 10, 0, 0).UseWall((ushort)ModContent.WallType(), 360, 0); + var tile106 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 74, 1, 0).UseWall((ushort)ModContent.WallType(), 360, 36); + var tile107 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 2, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 72, 72); + var tile108 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(270, 72); + var tile109 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 72, 36); + var tile110 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 2, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 252, 72); + var tile111 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseWall((ushort)ModContent.WallType(), 72, 36); + var tile112 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 2, 0).UseWall((ushort)ModContent.WallType(), 252, 72); + var tile113 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 1, 0).UseWall((ushort)ModContent.WallType(), 36, 36); + var tile114 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 2, 32).UseFrame(18, 54).UseWall((ushort)ModContent.WallType(), 36, 72); + var tile115 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 0); + var tile116 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 132, 3, 12320).UseFrame(18, 72).UseWall((ushort)ModContent.WallType(), 144, 108); + var tile117 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 75, 1, 0).UseWall((ushort)ModContent.WallType(), 396, 36); + var tile118 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseWall((ushort)ModContent.WallType(), 252, 36); + var tile119 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 11, 0, 0).UseWall((ushort)ModContent.WallType(), 396, 0); + var tile120 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 1, 0).UseWall((ushort)WallID.SapphireGemspark, 36, 36); + var tile121 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 6, 1, 0).UseWall((ushort)ModContent.WallType(), 216, 36); + var tile122 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 2, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 108, 72); + var tile123 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(144, 72); + var tile124 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseWall((ushort)ModContent.WallType(), 360, 72); + var tile125 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 1, 0).UseWall((ushort)WallID.SapphireGemspark, 108, 36); + var tile126 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 10, 0, 0).UseWall((ushort)ModContent.WallType(), 360, 0); + var tile127 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 2, 0).UseWall((ushort)ModContent.WallType(), 36, 72); + var tile128 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(108, 72); + var tile129 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 0, 0).UseWall((ushort)ModContent.WallType(), 36, 0); + var tile130 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseWall((ushort)ModContent.WallType(), 36, 36); + var tile131 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 1, 0).UseWall((ushort)ModContent.WallType(), 72, 36); + var tile132 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 2, 0).UseWall((ushort)ModContent.WallType(), 72, 72); + var tile133 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 66, 0, 32).UseFrame(0, 540).UseWall((ushort)ModContent.WallType(), 72, 0); + var tile134 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 139, 2, 32).UseFrame(0, 558).UseWall((ushort)ModContent.WallType(), 396, 72); + var tile135 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 8224).UseFrame(144, 0).UseWall((ushort)ModContent.WallType(), 72, 36); + var tile136 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 1, 0).UseWall((ushort)ModContent.WallType(), 288, 36); + var tile137 = new TileDefinitionStructure(TileID.Extractinator).UseHeaders(0, 131, 1, 32).UseWall((ushort)WallID.SapphireGemspark, 108, 36); + var tile138 = new TileDefinitionStructure(TileID.Extractinator).UseHeaders(0, 136, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 288, 36); + var tile139 = new TileDefinitionStructure(TileID.Extractinator).UseHeaders(0, 66, 2, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 72, 72); + var tile140 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(126, 72); + var tile141 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 132, 3, 12320).UseFrame(18, 72).UseWall((ushort)ModContent.WallType(), 144, 108); + var tile142 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 138, 2, 0).UseWall((ushort)ModContent.WallType(), 360, 72); + var tile143 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 8224).UseFrame(144, 0).UseWall((ushort)ModContent.WallType(), 108, 36); + var tile144 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 1, 0).UseWall((ushort)ModContent.WallType(), 36, 36); + var tile145 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 138, 2, 0).UseWall((ushort)ModContent.WallType(), 360, 72); + var tile146 = new TileDefinitionStructure(TileID.Extractinator).UseHeaders(0, 131, 1, 32).UseFrame(18, 0).UseWall((ushort)WallID.SapphireGemspark, 108, 36); + var tile147 = new TileDefinitionStructure(TileID.Extractinator).UseHeaders(0, 74, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 360, 36); + var tile148 = new TileDefinitionStructure(TileID.Extractinator).UseHeaders(0, 66, 2, 32).UseFrame(18, 36).UseWall((ushort)ModContent.WallType(), 72, 72); + var tile149 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(216, 0).UseWall((ushort)ModContent.WallType(), 36, 36); + var tile150 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 6, 2, 0).UseWall((ushort)ModContent.WallType(), 216, 72); + var tile151 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 1, 0).UseWall((ushort)ModContent.WallType(), 72, 36); + var tile152 = new TileDefinitionStructure(TileID.Extractinator).UseHeaders(0, 6, 2, 32).UseFrame(36, 0).UseWall((ushort)WallID.SapphireGemspark, 216, 72); + var tile153 = new TileDefinitionStructure(TileID.Extractinator).UseHeaders(0, 131, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 108, 36); + var tile154 = new TileDefinitionStructure(TileID.Extractinator).UseHeaders(0, 131, 2, 32).UseFrame(36, 36).UseWall((ushort)ModContent.WallType(), 108, 72); + var tile155 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 0, 0).UseWall((ushort)ModContent.WallType(), 108, 0); + var tile156 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 32).UseWall((ushort)ModContent.WallType(), 396, 36); + var tile157 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 138, 2, 0).UseWall((ushort)ModContent.WallType(), 360, 72); + var tile158 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 138, 2, 0).UseWall((ushort)ModContent.WallType(), 360, 72); + var tile159 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 360, 72); + var tile160 = new TileDefinitionStructure(TileID.Extractinator).UseHeaders(0, 138, 2, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 360, 72); + var tile161 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(36, 36); + var tile162 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 32).UseWall((ushort)ModContent.WallType(), 288, 72); + var tile163 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 72, 36); + var tile164 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseWall((ushort)ModContent.WallType(), 108, 36); + var tile165 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseWall((ushort)ModContent.WallType(), 108, 36); + var tile166 = new TileDefinitionStructure(TileID.Extractinator).UseHeaders(0, 136, 2, 32).UseFrame(36, 0).UseWall((ushort)WallID.SapphireGemspark, 288, 72); + var tile167 = new TileDefinitionStructure(TileID.Extractinator).UseHeaders(0, 66, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 72, 36); + var tile168 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 72, 36); + var tile169 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 216, 36); + var tile170 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseWall((ushort)ModContent.WallType(), 252, 36); + var tile171 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 75, 1, 0).UseWall((ushort)ModContent.WallType(), 396, 36); + var tile172 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 1, 0).UseWall((ushort)WallID.SapphireGemspark, 72, 36); + var tile173 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 360, 0); + var tile174 = new TileDefinitionStructure(TileID.GlassKiln).UseHeaders(0, 1, 1, 32).UseWall((ushort)WallID.SapphireGemspark, 36, 36); + var tile175 = new TileDefinitionStructure(TileID.GlassKiln).UseHeaders(0, 74, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 360, 36); + var tile176 = new TileDefinitionStructure(TileID.GlassKiln).UseHeaders(0, 131, 2, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 108, 72); + var tile177 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 2, 0).UseWall((ushort)ModContent.WallType(), 252, 72); + var tile178 = new TileDefinitionStructure(TileID.GlassKiln).UseHeaders(0, 136, 2, 32).UseFrame(18, 0).UseWall((ushort)WallID.SapphireGemspark, 288, 72); + var tile179 = new TileDefinitionStructure(TileID.GlassKiln).UseHeaders(0, 66, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 72, 36); + var tile180 = new TileDefinitionStructure(TileID.GlassKiln).UseHeaders(0, 131, 2, 32).UseFrame(18, 36).UseWall((ushort)ModContent.WallType(), 108, 72); + var tile181 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseFrame(234, 0).UseWall((ushort)ModContent.WallType(), 396, 72); + var tile182 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 1, 0).UseWall((ushort)ModContent.WallType(), 252, 36); + var tile183 = new TileDefinitionStructure(TileID.GlassKiln).UseHeaders(0, 66, 1, 32).UseFrame(36, 0).UseWall((ushort)WallID.SapphireGemspark, 72, 36); + var tile184 = new TileDefinitionStructure(TileID.GlassKiln).UseHeaders(0, 6, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 216, 36); + var tile185 = new TileDefinitionStructure(TileID.GlassKiln).UseHeaders(0, 66, 2, 32).UseFrame(36, 36).UseWall((ushort)ModContent.WallType(), 72, 72); + var tile186 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 4128).UseFrame(18, 54); + var tile187 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(288, 72); + var tile188 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 3, 16416).UseFrame(0, 72).UseWall((ushort)ModContent.WallType(), 36, 108); + var tile189 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 36, 36); + var tile190 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 216, 72); + var tile191 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 1, 0).UseWall((ushort)ModContent.WallType(), 108, 36); + var tile192 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 32).UseWall((ushort)ModContent.WallType(), 216, 36); + var tile193 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseWall((ushort)ModContent.WallType(), 360, 0); + var tile194 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 138, 2, 0).UseWall((ushort)ModContent.WallType(), 360, 72); + var tile195 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(270, 54); + var tile196 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 3, 16416).UseFrame(0, 72).UseWall((ushort)ModContent.WallType(), 36, 108); + var tile197 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 6, 2, 0).UseWall((ushort)WallID.SapphireGemspark, 216, 72); + var tile198 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 2, 8224).UseFrame(144, 0).UseWall((ushort)ModContent.WallType(), 36, 72); + var tile199 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 4128).UseFrame(90, 54); + var tile200 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(252, 72); + var tile201 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseWall((ushort)ModContent.WallType(), 396, 72); + var tile202 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 36, 36); + var tile203 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 1, 0).UseWall((ushort)ModContent.WallType(), 288, 36); + var tile204 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 2, 32).UseFrame(72, 54).UseWall((ushort)ModContent.WallType(), 72, 72); + var tile205 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 0, 0).UseWall((ushort)ModContent.WallType(), 72, 0); + var tile206 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 36, 36); + var tile207 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 2, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 108, 72); + var tile208 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 67, 3, 16416).UseFrame(0, 72).UseWall((ushort)ModContent.WallType(), 108, 108); + var tile209 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 108, 36); + var tile210 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 72, 72); + var tile211 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 4, 0, 8224).UseFrame(144, 0).UseWall((ushort)ModContent.WallType(), 144, 0); + var tile212 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 165, 4, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 180, 144); + var tile213 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 0, 0).UseWall((ushort)ModContent.WallType(), 72, 0); + var tile214 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 360, 36); + var tile215 = new TileDefinitionStructure(TileID.Lamps).UseHeaders(0, 74, 1, 32).UseFrame(0, 216).UseWall((ushort)ModContent.WallType(), 360, 36); + var tile216 = new TileDefinitionStructure(TileID.Lamps).UseHeaders(0, 1, 2, 32).UseFrame(0, 252).UseWall((ushort)ModContent.WallType(), 36, 72); + var tile217 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(0, 54); + var tile218 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(288, 72); + var tile219 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 133, 3, 16416).UseFrame(0, 72).UseWall((ushort)ModContent.WallType(), 180, 108); + var tile220 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 2, 0).UseWall((ushort)ModContent.WallType(), 288, 72); + var tile221 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 6, 2, 0).UseWall((ushort)ModContent.WallType(), 216, 72); + var tile222 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 2, 0).UseWall((ushort)ModContent.WallType(), 36, 72); + var tile223 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 165, 3, 16416).UseFrame(72, 72).UseWall((ushort)ModContent.WallType(), 180, 108); + var tile224 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(36, 18); + var tile225 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 4128).UseFrame(54, 54); + var tile226 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(252, 72); + var tile227 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 131, 0, 32).UseFrame(0, 540).UseWall((ushort)ModContent.WallType(), 108, 0); + var tile228 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 1, 1, 32).UseFrame(0, 558).UseWall((ushort)ModContent.WallType(), 36, 36); + var tile229 = new TileDefinitionStructure(TileID.FishingCrate).UseHeaders(0, 131, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 108, 36); + var tile230 = new TileDefinitionStructure(TileID.FishingCrate).UseHeaders(0, 138, 2, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 360, 72); + var tile231 = new TileDefinitionStructure(TileID.FishingCrate).UseHeaders(0, 131, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 108, 36); + var tile232 = new TileDefinitionStructure(TileID.FishingCrate).UseHeaders(0, 131, 2, 32).UseFrame(36, 18).UseWall((ushort)WallID.SapphireGemspark, 108, 72); + var tile233 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(288, 72); + var tile234 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 3, 16416).UseFrame(72, 72).UseWall((ushort)ModContent.WallType(), 36, 108); + var tile235 = new TileDefinitionStructure(TileID.FishingCrate).UseHeaders(0, 71, 2, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 252, 72); + var tile236 = new TileDefinitionStructure(TileID.FishingCrate).UseHeaders(0, 131, 1, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 108, 36); + var tile237 = new TileDefinitionStructure(TileID.FishingCrate).UseHeaders(0, 1, 2, 32).UseFrame(54, 18).UseWall((ushort)WallID.SapphireGemspark, 36, 72); + var tile238 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 83, 3, 16416).UseFrame(36, 72).UseWall((ushort)ModContent.WallType(), 108, 108); + var tile239 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 2, 0).UseWall((ushort)WallID.SapphireGemspark, 36, 72); + var tile240 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 68, 1, 0).UseWall((ushort)ModContent.WallType(), 144, 36); + var tile241 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 132, 2, 0).UseWall((ushort)ModContent.WallType(), 144, 72); + var tile242 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 4, 0, 0).UseWall((ushort)ModContent.WallType(), 144, 0); + var tile243 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 132, 2, 0).UseWall((ushort)ModContent.WallType(), 144, 72); + var tile244 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 4, 0, 0).UseWall((ushort)ModContent.WallType(), 144, 0); + var tile245 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 67, 4, 0).UseWall((ushort)WallID.SapphireGemspark, 108, 144); + var tile246 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(0, 36); + var tile247 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(72, 72); + var tile248 = new TileDefinitionStructure(TileID.OpenDoor).UseHeaders(0, 0, 0, 32).UseFrame(0, 756); + var tile249 = new TileDefinitionStructure(TileID.OpenDoor).UseHeaders(0, 0, 0, 32).UseFrame(0, 774); + var tile250 = new TileDefinitionStructure(TileID.OpenDoor).UseHeaders(0, 0, 0, 32).UseFrame(0, 792); + var tile251 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(72, 0); + var tile252 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(72, 18); + var tile253 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 12320).UseFrame(18, 72); + var tile254 = new TileDefinitionStructure(TileID.OpenDoor).UseHeaders(0, 0, 0, 32).UseFrame(18, 756); + var tile255 = new TileDefinitionStructure(TileID.OpenDoor).UseHeaders(0, 0, 0, 32).UseFrame(18, 774); + var tile256 = new TileDefinitionStructure(TileID.OpenDoor).UseHeaders(0, 0, 0, 32).UseFrame(18, 792); + var tile257 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 4128).UseFrame(90, 54); + var tile258 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(72, 36); + var tile259 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 12320).UseFrame(54, 72); + Dictionary colorTileMap = new Dictionary() + { + { new Color(0, 0, 0), tile1 }, + { new Color(35, 221, 125), tile2 }, + { new Color(112, 142, 86), tile3 }, + { new Color(23, 118, 69), tile4 }, + { new Color(113, 15, 65), tile5 }, + { new Color(158, 132, 110), tile6 }, + { new Color(195, 110, 40), tile7 }, + { new Color(217, 59, 120), tile8 }, + { new Color(17, 189, 14), tile9 }, + { new Color(24, 208, 83), tile10 }, + { new Color(105, 118, 33), tile11 }, + { new Color(179, 158, 172), tile12 }, + { new Color(23, 154, 161), tile13 }, + { new Color(4, 124, 200), tile14 }, + { new Color(42, 151, 79), tile15 }, + { new Color(13, 153, 244), tile16 }, + { new Color(58, 91, 39), tile17 }, + { new Color(69, 103, 174), tile18 }, + { new Color(252, 239, 246), tile19 }, + { new Color(155, 17, 31), tile20 }, + { new Color(111, 88, 189), tile21 }, + { new Color(2, 173, 0), tile22 }, + { new Color(36, 189, 112), tile23 }, + { new Color(148, 134, 233), tile24 }, + { new Color(204, 191, 242), tile25 }, + { new Color(95, 175, 163), tile26 }, + { new Color(41, 3, 36), tile27 }, + { new Color(25, 221, 117), tile28 }, + { new Color(44, 36, 14), tile29 }, + { new Color(114, 183, 174), tile30 }, + { new Color(181, 124, 137), tile31 }, + { new Color(130, 148, 36), tile32 }, + { new Color(11, 39, 233), tile33 }, + { new Color(79, 233, 220), tile34 }, + { new Color(132, 166, 213), tile35 }, + { new Color(62, 121, 168), tile36 }, + { new Color(188, 156, 64), tile37 }, + { new Color(83, 114, 13), tile38 }, + { new Color(251, 86, 122), tile39 }, + { new Color(72, 214, 137), tile40 }, + { new Color(241, 177, 5), tile41 }, + { new Color(194, 222, 9), tile42 }, + { new Color(95, 73, 42), tile43 }, + { new Color(205, 84, 136), tile44 }, + { new Color(185, 217, 26), tile45 }, + { new Color(71, 149, 55), tile46 }, + { new Color(160, 238, 171), tile47 }, + { new Color(102, 182, 27), tile48 }, + { new Color(110, 98, 10), tile49 }, + { new Color(123, 135, 62), tile50 }, + { new Color(170, 195, 81), tile51 }, + { new Color(96, 94, 55), tile52 }, + { new Color(214, 193, 199), tile53 }, + { new Color(203, 222, 47), tile54 }, + { new Color(125, 238, 71), tile55 }, + { new Color(183, 153, 152), tile56 }, + { new Color(243, 179, 193), tile57 }, + { new Color(66, 167, 232), tile58 }, + { new Color(222, 138, 251), tile59 }, + { new Color(234, 83, 123), tile60 }, + { new Color(255, 228, 194), tile61 }, + { new Color(236, 35, 145), tile62 }, + { new Color(55, 89, 123), tile63 }, + { new Color(226, 112, 211), tile64 }, + { new Color(111, 212, 15), tile65 }, + { new Color(123, 233, 199), tile66 }, + { new Color(211, 182, 201), tile67 }, + { new Color(113, 135, 212), tile68 }, + { new Color(125, 103, 27), tile69 }, + { new Color(105, 130, 211), tile70 }, + { new Color(59, 236, 110), tile71 }, + { new Color(76, 203, 249), tile72 }, + { new Color(108, 145, 203), tile73 }, + { new Color(182, 128, 63), tile74 }, + { new Color(29, 16, 66), tile75 }, + { new Color(237, 210, 211), tile76 }, + { new Color(216, 98, 161), tile77 }, + { new Color(52, 22, 156), tile78 }, + { new Color(178, 142, 92), tile79 }, + { new Color(237, 110, 187), tile80 }, + { new Color(117, 206, 214), tile81 }, + { new Color(168, 167, 131), tile82 }, + { new Color(101, 35, 8), tile83 }, + { new Color(22, 14, 87), tile84 }, + { new Color(252, 29, 54), tile85 }, + { new Color(137, 84, 119), tile86 }, + { new Color(145, 143, 148), tile87 }, + { new Color(72, 144, 32), tile88 }, + { new Color(50, 6, 214), tile89 }, + { new Color(209, 154, 61), tile90 }, + { new Color(157, 127, 34), tile91 }, + { new Color(15, 64, 178), tile92 }, + { new Color(105, 116, 104), tile93 }, + { new Color(190, 136, 175), tile94 }, + { new Color(202, 193, 83), tile95 }, + { new Color(73, 56, 249), tile96 }, + { new Color(102, 40, 57), tile97 }, + { new Color(229, 91, 223), tile98 }, + { new Color(39, 45, 61), tile99 }, + { new Color(182, 118, 160), tile100 }, + { new Color(173, 147, 137), tile101 }, + { new Color(202, 121, 143), tile102 }, + { new Color(53, 236, 220), tile103 }, + { new Color(131, 32, 223), tile104 }, + { new Color(14, 210, 6), tile105 }, + { new Color(229, 126, 207), tile106 }, + { new Color(205, 232, 206), tile107 }, + { new Color(221, 106, 113), tile108 }, + { new Color(4, 183, 35), tile109 }, + { new Color(67, 232, 18), tile110 }, + { new Color(117, 179, 254), tile111 }, + { new Color(200, 17, 244), tile112 }, + { new Color(37, 255, 72), tile113 }, + { new Color(195, 20, 75), tile114 }, + { new Color(28, 227, 7), tile115 }, + { new Color(89, 214, 137), tile116 }, + { new Color(216, 65, 175), tile117 }, + { new Color(110, 232, 141), tile118 }, + { new Color(210, 208, 41), tile119 }, + { new Color(23, 198, 193), tile120 }, + { new Color(108, 241, 4), tile121 }, + { new Color(201, 14, 109), tile122 }, + { new Color(224, 70, 193), tile123 }, + { new Color(17, 191, 126), tile124 }, + { new Color(134, 10, 212), tile125 }, + { new Color(130, 192, 134), tile126 }, + { new Color(106, 170, 225), tile127 }, + { new Color(154, 107, 166), tile128 }, + { new Color(99, 7, 202), tile129 }, + { new Color(113, 245, 65), tile130 }, + { new Color(203, 14, 56), tile131 }, + { new Color(135, 86, 34), tile132 }, + { new Color(70, 83, 213), tile133 }, + { new Color(154, 120, 144), tile134 }, + { new Color(199, 198, 129), tile135 }, + { new Color(48, 231, 222), tile136 }, + { new Color(185, 79, 16), tile137 }, + { new Color(162, 173, 28), tile138 }, + { new Color(224, 210, 133), tile139 }, + { new Color(94, 102, 6), tile140 }, + { new Color(163, 111, 80), tile141 }, + { new Color(128, 70, 177), tile142 }, + { new Color(70, 255, 179), tile143 }, + { new Color(177, 59, 109), tile144 }, + { new Color(177, 208, 49), tile145 }, + { new Color(80, 210, 165), tile146 }, + { new Color(36, 50, 31), tile147 }, + { new Color(235, 183, 165), tile148 }, + { new Color(48, 40, 97), tile149 }, + { new Color(28, 167, 132), tile150 }, + { new Color(156, 232, 236), tile151 }, + { new Color(206, 247, 9), tile152 }, + { new Color(64, 71, 127), tile153 }, + { new Color(208, 234, 232), tile154 }, + { new Color(43, 8, 20), tile155 }, + { new Color(163, 240, 221), tile156 }, + { new Color(235, 143, 255), tile157 }, + { new Color(224, 57, 52), tile158 }, + { new Color(230, 183, 184), tile159 }, + { new Color(170, 79, 29), tile160 }, + { new Color(79, 41, 88), tile161 }, + { new Color(47, 20, 82), tile162 }, + { new Color(128, 227, 216), tile163 }, + { new Color(40, 15, 139), tile164 }, + { new Color(37, 84, 71), tile165 }, + { new Color(55, 192, 175), tile166 }, + { new Color(145, 141, 56), tile167 }, + { new Color(132, 49, 23), tile168 }, + { new Color(132, 188, 175), tile169 }, + { new Color(184, 231, 63), tile170 }, + { new Color(80, 149, 247), tile171 }, + { new Color(98, 128, 192), tile172 }, + { new Color(144, 252, 243), tile173 }, + { new Color(193, 34, 13), tile174 }, + { new Color(4, 194, 127), tile175 }, + { new Color(116, 187, 228), tile176 }, + { new Color(236, 175, 246), tile177 }, + { new Color(8, 24, 193), tile178 }, + { new Color(229, 203, 248), tile179 }, + { new Color(65, 170, 88), tile180 }, + { new Color(162, 199, 251), tile181 }, + { new Color(153, 215, 122), tile182 }, + { new Color(148, 195, 211), tile183 }, + { new Color(134, 166, 196), tile184 }, + { new Color(187, 208, 106), tile185 }, + { new Color(42, 128, 110), tile186 }, + { new Color(151, 16, 1), tile187 }, + { new Color(203, 203, 55), tile188 }, + { new Color(73, 72, 124), tile189 }, + { new Color(53, 124, 181), tile190 }, + { new Color(199, 79, 81), tile191 }, + { new Color(155, 30, 90), tile192 }, + { new Color(18, 107, 235), tile193 }, + { new Color(5, 223, 247), tile194 }, + { new Color(17, 101, 9), tile195 }, + { new Color(49, 76, 72), tile196 }, + { new Color(86, 187, 75), tile197 }, + { new Color(138, 169, 154), tile198 }, + { new Color(86, 215, 251), tile199 }, + { new Color(195, 79, 143), tile200 }, + { new Color(253, 94, 70), tile201 }, + { new Color(30, 191, 87), tile202 }, + { new Color(115, 32, 177), tile203 }, + { new Color(16, 24, 21), tile204 }, + { new Color(131, 145, 48), tile205 }, + { new Color(9, 186, 102), tile206 }, + { new Color(46, 23, 251), tile207 }, + { new Color(52, 222, 193), tile208 }, + { new Color(106, 61, 165), tile209 }, + { new Color(183, 68, 70), tile210 }, + { new Color(94, 78, 27), tile211 }, + { new Color(91, 8, 129), tile212 }, + { new Color(177, 242, 166), tile213 }, + { new Color(177, 190, 44), tile214 }, + { new Color(151, 70, 162), tile215 }, + { new Color(53, 7, 24), tile216 }, + { new Color(105, 77, 29), tile217 }, + { new Color(149, 149, 56), tile218 }, + { new Color(148, 201, 128), tile219 }, + { new Color(132, 180, 129), tile220 }, + { new Color(177, 188, 219), tile221 }, + { new Color(106, 177, 201), tile222 }, + { new Color(249, 39, 136), tile223 }, + { new Color(175, 88, 199), tile224 }, + { new Color(192, 124, 88), tile225 }, + { new Color(207, 156, 151), tile226 }, + { new Color(30, 52, 54), tile227 }, + { new Color(140, 77, 247), tile228 }, + { new Color(41, 201, 185), tile229 }, + { new Color(227, 199, 63), tile230 }, + { new Color(1, 44, 62), tile231 }, + { new Color(36, 0, 2), tile232 }, + { new Color(80, 45, 149), tile233 }, + { new Color(217, 60, 224), tile234 }, + { new Color(144, 186, 245), tile235 }, + { new Color(86, 213, 24), tile236 }, + { new Color(223, 196, 44), tile237 }, + { new Color(232, 102, 127), tile238 }, + { new Color(75, 36, 110), tile239 }, + { new Color(228, 65, 232), tile240 }, + { new Color(16, 22, 95), tile241 }, + { new Color(72, 173, 43), tile242 }, + { new Color(136, 155, 124), tile243 }, + { new Color(85, 126, 111), tile244 }, + { new Color(2, 69, 248), tile245 }, + { new Color(86, 252, 146), tile246 }, + { new Color(2, 210, 243), tile247 }, + { new Color(160, 3, 2), tile248 }, + { new Color(19, 25, 198), tile249 }, + { new Color(191, 217, 219), tile250 }, + { new Color(147, 107, 235), tile251 }, + { new Color(173, 200, 37), tile252 }, + { new Color(128, 71, 13), tile253 }, + { new Color(201, 206, 58), tile254 }, + { new Color(155, 137, 70), tile255 }, + { new Color(188, 229, 32), tile256 }, + { new Color(135, 245, 40), tile257 }, + { new Color(220, 226, 110), tile258 }, + { new Color(244, 111, 18), tile259 }, + }; + return new ColorTileMap(colorTileMap); + } + } +} diff --git a/Schematics/AutoGeneratedContent/ResearchFacility2Schematic.png b/Schematics/AutoGeneratedContent/ResearchFacility2Schematic.png new file mode 100644 index 0000000000..19a1f43979 Binary files /dev/null and b/Schematics/AutoGeneratedContent/ResearchFacility2Schematic.png differ diff --git a/Schematics/AutoGeneratedContent/ResearchFacilitySchematic.cs b/Schematics/AutoGeneratedContent/ResearchFacilitySchematic.cs new file mode 100644 index 0000000000..f946e6fe19 --- /dev/null +++ b/Schematics/AutoGeneratedContent/ResearchFacilitySchematic.cs @@ -0,0 +1,553 @@ +using CalamityMod.Tiles; +using CalamityMod.Tiles.FurniturePlaguedPlate; +using CalamityMod.Tiles.FurnitureStratus; +using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Walls; +using Microsoft.Xna.Framework; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Schematics.AutoGeneratedContent +{ + public class ResearchFacilitySchematic + { + [GeneratedCode("ScreenCaptureToSchematic", "1.0.1")] + public static ColorTileMap GetMap() + { + var tile1 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 0, 0, 0); + var tile2 = new TileDefinitionStructure(TileID.MartianConduitPlating).UseFrame(36, 54).UseSlope(2).UseHeaders(0, 16, 0, 8224); + var tile3 = new TileDefinitionStructure(TileID.MartianConduitPlating).UseFrame(0, 18).UseHeaders(0, 16, 0, 32); + var tile4 = new TileDefinitionStructure(TileID.MartianConduitPlating).UseHeaders(0, 0, 0, 32); + var tile5 = new TileDefinitionStructure(TileID.MartianConduitPlating).UseFrame(0, 72).UseSlope(4).UseHeaders(0, 0, 0, 16416); + var tile6 = new TileDefinitionStructure(TileID.MartianConduitPlating).UseFrame(72, 72).UseSlope(4).UseHeaders(0, 32, 0, 16416); + var tile7 = new TileDefinitionStructure(TileID.MartianConduitPlating).UseFrame(72, 54).UseSlope(2).UseHeaders(0, 32, 0, 8224); + var tile8 = new TileDefinitionStructure(TileID.MartianConduitPlating).UseFrame(54, 18).UseHeaders(0, 32, 0, 32); + var tile9 = new TileDefinitionStructure(TileID.MartianConduitPlating).UseFrame(72, 0).UseHeaders(0, 0, 0, 32); + var tile10 = new TileDefinitionStructure(TileID.MartianConduitPlating).UseFrame(72, 18).UseHeaders(0, 16, 0, 32); + var tile11 = new TileDefinitionStructure(TileID.MartianConduitPlating).UseFrame(72, 36).UseHeaders(0, 32, 0, 32); + var tile12 = new TileDefinitionStructure(TileID.MartianConduitPlating).UseFrame(54, 72).UseHeaders(0, 16, 0, 32); + var tile13 = new TileDefinitionStructure(TileID.OpenDoor).UseFrame(0, 1080).UseHeaders(0, 0, 0, 32); + var tile14 = new TileDefinitionStructure(TileID.OpenDoor).UseFrame(0, 1098).UseHeaders(0, 0, 0, 32); + var tile15 = new TileDefinitionStructure(TileID.OpenDoor).UseFrame(0, 1116).UseHeaders(0, 0, 0, 32); + var tile16 = new TileDefinitionStructure(TileID.MartianConduitPlating).UseFrame(36, 0).UseHeaders(0, 16, 0, 32); + var tile17 = new TileDefinitionStructure(TileID.MartianConduitPlating).UseFrame(36, 18).UseHeaders(0, 16, 0, 32); + var tile18 = new TileDefinitionStructure(TileID.MartianConduitPlating).UseFrame(18, 36).UseHeaders(0, 0, 0, 32); + var tile19 = new TileDefinitionStructure(TileID.MartianConduitPlating).UseFrame(18, 18).UseHeaders(0, 0, 0, 32); + var tile20 = new TileDefinitionStructure(TileID.MartianConduitPlating).UseFrame(90, 72).UseSlope(3).UseHeaders(0, 32, 0, 12320); + var tile21 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.MartianConduit, 0, 108).UseHeaders(0, 0, 3, 0); + var tile22 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.MartianConduit, 0, 36).UseHeaders(0, 64, 1, 0); + var tile23 = new TileDefinitionStructure(TileID.Dirt, false).UseWall((ushort)ModContent.WallType(), 0, 36).UseHeaders(0, 64, 1, 0); + var tile24 = new TileDefinitionStructure(TileID.Dirt, false).UseWall((ushort)ModContent.WallType(), 0, 0).UseHeaders(0, 0, 0, 0); + var tile25 = new TileDefinitionStructure(TileID.Dirt, false).UseWall((ushort)ModContent.WallType(), 0, 72).UseHeaders(0, 128, 2, 0); + var tile26 = new TileDefinitionStructure(TileID.OpenDoor).UseWall(WallID.MartianConduit, 0, 36).UseFrame(18, 1080).UseHeaders(0, 64, 1, 32); + var tile27 = new TileDefinitionStructure(TileID.OpenDoor).UseWall(WallID.MartianConduit, 0, 0).UseFrame(18, 1098).UseHeaders(0, 0, 0, 32); + var tile28 = new TileDefinitionStructure(TileID.OpenDoor).UseWall(WallID.SapphireGemspark, 0, 72).UseFrame(18, 1116).UseHeaders(0, 128, 2, 32); + var tile29 = new TileDefinitionStructure(TileID.MartianConduitPlating).UseWall(WallID.SapphireGemspark, 144, 144).UseFrame(36, 0).UseHeaders(0, 148, 4, 32); + var tile30 = new TileDefinitionStructure(TileID.MartianConduitPlating).UseFrame(36, 36).UseHeaders(0, 16, 0, 32); + var tile31 = new TileDefinitionStructure(TileID.MartianConduitPlating).UseFrame(18, 72).UseSlope(3).UseHeaders(0, 0, 0, 12320); + var tile32 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.MartianConduit, 72, 108).UseHeaders(0, 66, 3, 0); + var tile33 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.MartianConduit, 216, 72).UseHeaders(0, 6, 2, 0); + var tile34 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.MartianConduit, 72, 36).UseHeaders(0, 66, 1, 0); + var tile35 = new TileDefinitionStructure(TileID.Dirt, false).UseWall((ushort)ModContent.WallType(), 108, 36).UseHeaders(0, 131, 1, 0); + var tile36 = new TileDefinitionStructure(TileID.Dirt, false).UseWall((ushort)ModContent.WallType(), 216, 72).UseHeaders(0, 6, 2, 0); + var tile37 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.MartianConduit, 36, 36).UseHeaders(0, 1, 1, 0); + var tile38 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.SapphireGemspark, 108, 36).UseHeaders(0, 131, 1, 0); + var tile39 = new TileDefinitionStructure(TileID.MartianConduitPlating).UseWall(WallID.SapphireGemspark, 36, 72).UseFrame(36, 0).UseHeaders(0, 17, 2, 32); + var tile40 = new TileDefinitionStructure(TileID.MartianConduitPlating).UseFrame(0, 54).UseSlope(2).UseHeaders(0, 0, 0, 8224); + var tile41 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.MartianConduit, 396, 36).UseHeaders(0, 75, 1, 0); + var tile42 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.MartianConduit, 252, 36).UseHeaders(0, 71, 1, 0); + var tile43 = new TileDefinitionStructure(TileID.Dirt, false).UseWall((ushort)ModContent.WallType(), 396, 0).UseHeaders(0, 11, 0, 0); + var tile44 = new TileDefinitionStructure(TileID.Dirt, false).UseWall((ushort)ModContent.WallType(), 36, 36).UseHeaders(0, 1, 1, 0); + var tile45 = new TileDefinitionStructure(TileID.Dirt, false).UseWall((ushort)ModContent.WallType(), 252, 36).UseHeaders(0, 71, 1, 0); + var tile46 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.MartianConduit, 396, 72).UseHeaders(0, 139, 2, 0); + var tile47 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.MartianConduit, 108, 36).UseHeaders(0, 131, 1, 0); + var tile48 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.SapphireGemspark, 216, 36).UseHeaders(0, 6, 1, 0); + var tile49 = new TileDefinitionStructure(TileID.MartianConduitPlating).UseWall(WallID.SapphireGemspark, 72, 72).UseFrame(18, 0).UseHeaders(0, 66, 2, 32); + var tile50 = new TileDefinitionStructure(TileID.MartianConduitPlating).UseFrame(54, 0).UseHeaders(0, 32, 0, 32); + var tile51 = new TileDefinitionStructure(ModContent.TileType()).UseWall(WallID.MartianConduit, 0, 108).UseHeaders(0, 0, 3, 32); + var tile52 = new TileDefinitionStructure(ModContent.TileType()).UseWall(WallID.MartianConduit, 360, 36).UseFrame(0, 18).UseHeaders(0, 74, 1, 32); + var tile53 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.MartianConduit, 360, 36).UseHeaders(0, 74, 1, 0); + var tile54 = new TileDefinitionStructure(TileID.Dirt, false).UseWall((ushort)ModContent.WallType(), 72, 36).UseHeaders(0, 66, 1, 0); + var tile55 = new TileDefinitionStructure(TileID.Dirt, false).UseWall((ushort)ModContent.WallType(), 360, 36).UseHeaders(0, 74, 1, 0); + var tile56 = new TileDefinitionStructure(ModContent.TileType()).UseWall(WallID.MartianConduit, 108, 36).UseHeaders(0, 131, 1, 32); + var tile57 = new TileDefinitionStructure(ModContent.TileType()).UseWall(WallID.MartianConduit, 72, 36).UseFrame(0, 18).UseHeaders(0, 66, 1, 32); + var tile58 = new TileDefinitionStructure(ModContent.TileType()).UseWall(WallID.SapphireGemspark, 360, 0).UseFrame(0, 36).UseHeaders(0, 10, 0, 32); + var tile59 = new TileDefinitionStructure(TileID.MartianConduitPlating).UseWall(WallID.SapphireGemspark, 72, 36).UseFrame(54, 0).UseHeaders(0, 98, 1, 32); + var tile60 = new TileDefinitionStructure(TileID.MartianConduitPlating).UseWall(WallID.SapphireGemspark, 288, 108).UseFrame(18, 18).UseHeaders(0, 136, 3, 32); + var tile61 = new TileDefinitionStructure(TileID.MartianConduitPlating).UseFrame(54, 36).UseHeaders(0, 32, 0, 32); + var tile62 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.MartianConduit, 36, 0).UseHeaders(0, 1, 0, 0); + var tile63 = new TileDefinitionStructure(TileID.Dirt, false).UseWall((ushort)ModContent.WallType(), 288, 72).UseHeaders(0, 136, 2, 0); + var tile64 = new TileDefinitionStructure(ModContent.TileType()).UseWall(WallID.MartianConduit, 108, 36).UseFrame(18, 0).UseHeaders(0, 131, 1, 32); + var tile65 = new TileDefinitionStructure(ModContent.TileType()).UseWall(WallID.MartianConduit, 216, 72).UseFrame(18, 18).UseHeaders(0, 6, 2, 32); + var tile66 = new TileDefinitionStructure(ModContent.TileType()).UseWall(WallID.SapphireGemspark, 72, 36).UseFrame(18, 36).UseHeaders(0, 66, 1, 32); + var tile67 = new TileDefinitionStructure(TileID.MartianConduitPlating).UseWall(WallID.SapphireGemspark, 36, 72).UseFrame(18, 0).UseHeaders(0, 1, 2, 32); + var tile68 = new TileDefinitionStructure(TileID.MartianConduitPlating).UseFrame(18, 0).UseHeaders(0, 0, 0, 32); + var tile69 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.MartianConduit, 144, 108).UseHeaders(0, 132, 3, 0); + var tile70 = new TileDefinitionStructure(TileID.Platforms).UseWall((ushort)ModContent.WallType(), 396, 72).UseFrame(36, 252).UseHeaders(0, 139, 2, 32); + var tile71 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.MartianConduit, 288, 36).UseHeaders(0, 136, 1, 0); + var tile72 = new TileDefinitionStructure(TileID.Dirt, false).UseWall((ushort)ModContent.WallType(), 288, 36).UseHeaders(0, 136, 1, 0); + var tile73 = new TileDefinitionStructure(ModContent.TileType()).UseWall(WallID.MartianConduit, 396, 36).UseFrame(36, 0).UseHeaders(0, 75, 1, 32); + var tile74 = new TileDefinitionStructure(ModContent.TileType()).UseWall(WallID.MartianConduit, 72, 36).UseFrame(36, 18).UseHeaders(0, 66, 1, 32); + var tile75 = new TileDefinitionStructure(ModContent.TileType()).UseWall(WallID.SapphireGemspark, 216, 36).UseFrame(36, 36).UseHeaders(0, 6, 1, 32); + var tile76 = new TileDefinitionStructure(TileID.MartianConduitPlating).UseWall(WallID.SapphireGemspark, 72, 72).UseFrame(36, 0).UseHeaders(0, 82, 2, 32); + var tile77 = new TileDefinitionStructure(TileID.MartianConduitPlating).UseFrame(54, 72).UseSlope(3).UseHeaders(0, 16, 0, 12320); + var tile78 = new TileDefinitionStructure(TileID.Dirt, false).UseWall((ushort)ModContent.WallType(), 360, 72).UseHeaders(0, 138, 2, 0); + var tile79 = new TileDefinitionStructure(TileID.Platforms).UseWall((ushort)ModContent.WallType(), 36, 36).UseFrame(0, 252).UseHeaders(0, 1, 1, 32); + var tile80 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.SapphireGemspark, 360, 72).UseHeaders(0, 138, 2, 0); + var tile81 = new TileDefinitionStructure(TileID.MartianConduitPlating).UseWall(WallID.SapphireGemspark, 36, 72).UseFrame(18, 54).UseHeaders(0, 1, 2, 32); + var tile82 = new TileDefinitionStructure(ModContent.TileType()).UseWall(WallID.MartianConduit, 216, 0).UseHeaders(0, 6, 0, 32); + var tile83 = new TileDefinitionStructure(ModContent.TileType()).UseWall(WallID.MartianConduit, 36, 36).UseFrame(0, 18).UseHeaders(0, 1, 1, 32); + var tile84 = new TileDefinitionStructure(TileID.Platforms).UseWall((ushort)ModContent.WallType(), 72, 36).UseFrame(0, 252).UseHeaders(0, 66, 1, 32); + var tile85 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.MartianConduit, 288, 72).UseHeaders(0, 136, 2, 0); + var tile86 = new TileDefinitionStructure(TileID.Dirt, false).UseWall((ushort)ModContent.WallType(), 252, 72).UseHeaders(0, 71, 2, 0); + var tile87 = new TileDefinitionStructure(TileID.Platforms).UseWall(WallID.SapphireGemspark, 36, 72).UseFrame(180, 252).UseSlope(1).UseHeaders(0, 1, 2, 4128); + var tile88 = new TileDefinitionStructure(TileID.MartianConduitPlating).UseWall((ushort)ModContent.WallType(), 288, 0).UseFrame(18, 18).UseHeaders(0, 136, 0, 32); + var tile89 = new TileDefinitionStructure(TileID.MartianConduitPlating).UseWall((ushort)ModContent.WallType(), 144, 144).UseFrame(18, 72).UseSlope(3).UseHeaders(0, 132, 4, 12320); + var tile90 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32); + var tile91 = new TileDefinitionStructure(ModContent.TileType()).UseWall(WallID.MartianConduit, 108, 0).UseFrame(0, 18).UseHeaders(0, 131, 0, 32); + var tile92 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 36, 36).UseFrame(0, 36).UseHeaders(0, 1, 1, 32); + var tile93 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 288, 36).UseFrame(0, 54).UseHeaders(0, 136, 1, 32); + var tile94 = new TileDefinitionStructure(TileID.Platforms).UseWall((ushort)ModContent.WallType(), 396, 0).UseFrame(0, 252).UseHeaders(0, 11, 0, 32); + var tile95 = new TileDefinitionStructure(TileID.Dirt, false).UseWall((ushort)ModContent.WallType(), 216, 36).UseHeaders(0, 6, 1, 0); + var tile96 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.SapphireGemspark, 396, 0).UseHeaders(0, 11, 0, 0); + var tile97 = new TileDefinitionStructure(TileID.MartianConduitPlating).UseWall(WallID.SapphireGemspark, 0, 144).UseFrame(36, 0).UseHeaders(0, 16, 4, 32); + var tile98 = new TileDefinitionStructure(TileID.Dirt, false).UseWall((ushort)ModContent.WallType(), 36, 0).UseHeaders(0, 1, 0, 0); + var tile99 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 0, 72).UseFrame(18, 0).UseHeaders(0, 128, 2, 32); + var tile100 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 36, 36).UseFrame(18, 18).UseHeaders(0, 1, 1, 32); + var tile101 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 72, 36).UseFrame(18, 36).UseHeaders(0, 66, 1, 32); + var tile102 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 360, 36).UseFrame(18, 54).UseHeaders(0, 74, 1, 32); + var tile103 = new TileDefinitionStructure(TileID.Platforms).UseWall((ushort)ModContent.WallType(), 108, 36).UseFrame(0, 252).UseHeaders(0, 131, 1, 32); + var tile104 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 72, 36).UseFrame(180, 54).UseHeaders(0, 82, 1, 32); + var tile105 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 360, 36).UseHeaders(0, 74, 1, 32); + var tile106 = new TileDefinitionStructure(ModContent.TileType()).UseWall(WallID.MartianConduit, 108, 36).UseFrame(0, 18).UseHeaders(0, 131, 1, 32); + var tile107 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.MartianConduit, 360, 0).UseHeaders(0, 10, 0, 0); + var tile108 = new TileDefinitionStructure(TileID.Dirt, false).UseWall((ushort)ModContent.WallType(), 72, 0).UseHeaders(0, 66, 0, 0); + var tile109 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 36, 36).UseFrame(36, 0).UseHeaders(0, 1, 1, 32); + var tile110 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 108, 36).UseFrame(36, 18).UseHeaders(0, 131, 1, 32); + var tile111 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 252, 72).UseFrame(36, 36).UseHeaders(0, 71, 2, 32); + var tile112 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 108, 36).UseFrame(36, 54).UseHeaders(0, 131, 1, 32); + var tile113 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.SapphireGemspark, 72, 36).UseHeaders(0, 66, 1, 0); + var tile114 = new TileDefinitionStructure(TileID.MartianConduitPlating).UseWall(WallID.SapphireGemspark, 108, 72).UseFrame(54, 0).UseHeaders(0, 163, 2, 32); + var tile115 = new TileDefinitionStructure(TileID.Platforms).UseWall((ushort)ModContent.WallType(), 396, 72).UseFrame(0, 252).UseHeaders(0, 139, 2, 32); + var tile116 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.MartianConduit, 216, 36).UseHeaders(0, 6, 1, 0); + var tile117 = new TileDefinitionStructure(TileID.MartianConduitPlating).UseWall(WallID.SapphireGemspark, 108, 72).UseFrame(54, 0).UseHeaders(0, 163, 2, 1056); + var tile118 = new TileDefinitionStructure(TileID.Dirt, false).UseWall((ushort)ModContent.WallType(), 360, 0).UseHeaders(0, 10, 0, 0); + var tile119 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.MartianConduit, 360, 72).UseHeaders(0, 138, 2, 0); + var tile120 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.MartianConduit, 252, 72).UseHeaders(0, 71, 2, 0); + var tile121 = new TileDefinitionStructure(TileID.Platforms).UseWall((ushort)ModContent.WallType(), 108, 36).UseFrame(144, 252).UseSlope(2).UseHeaders(0, 131, 1, 8224); + var tile122 = new TileDefinitionStructure(TileID.MartianConduitPlating).UseWall(WallID.SapphireGemspark, 180, 144).UseFrame(54, 0).UseHeaders(0, 165, 4, 1056); + var tile123 = new TileDefinitionStructure(ModContent.TileType()).UseWall(WallID.MartianConduit, 72, 0).UseHeaders(0, 66, 0, 32); + var tile124 = new TileDefinitionStructure(ModContent.TileType()).UseWall(WallID.Glass, 36, 36).UseFrame(0, 18).UseHeaders(0, 1, 1, 32); + var tile125 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.Glass, 252, 36).UseHeaders(0, 71, 1, 0); + var tile126 = new TileDefinitionStructure(TileID.Dirt, false).UseWall((ushort)ModContent.WallType(), 396, 36).UseHeaders(0, 75, 1, 0); + var tile127 = new TileDefinitionStructure(TileID.Platforms).UseWall(WallID.Glass, 36, 36).UseFrame(144, 252).UseSlope(2).UseHeaders(0, 1, 1, 8224); + var tile128 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.Glass, 288, 36).UseHeaders(0, 136, 1, 0); + var tile129 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.Glass, 396, 0).UseHeaders(0, 11, 0, 0); + var tile130 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.Glass, 108, 36).UseHeaders(0, 131, 1, 0); + var tile131 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 72, 36).UseHeaders(0, 66, 1, 32); + var tile132 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 216, 36).UseFrame(0, 18).UseHeaders(0, 6, 1, 32); + var tile133 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 108, 72).UseFrame(0, 36).UseHeaders(0, 131, 2, 32); + var tile134 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.Glass, 36, 36).UseHeaders(0, 1, 1, 0); + var tile135 = new TileDefinitionStructure(ModContent.TileType()).UseWall(WallID.Glass, 360, 72).UseHeaders(0, 138, 2, 32); + var tile136 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 72, 36).UseFrame(0, 18).UseHeaders(0, 66, 1, 32); + var tile137 = new TileDefinitionStructure(TileID.Platforms).UseWall(WallID.Glass, 108, 36).UseFrame(216, 252).UseHeaders(0, 131, 1, 32); + var tile138 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.Glass, 360, 72).UseHeaders(0, 138, 2, 0); + var tile139 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.Glass, 360, 36).UseHeaders(0, 74, 1, 0); + var tile140 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 108, 36).UseFrame(18, 0).UseHeaders(0, 131, 1, 32); + var tile141 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 360, 0).UseFrame(18, 18).UseHeaders(0, 10, 0, 32); + var tile142 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 108, 72).UseFrame(18, 36).UseHeaders(0, 131, 2, 32); + var tile143 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.Glass, 216, 72).UseHeaders(0, 6, 2, 0); + var tile144 = new TileDefinitionStructure(ModContent.TileType()).UseWall(WallID.Glass, 108, 36).UseFrame(18, 0).UseHeaders(0, 131, 1, 32); + var tile145 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 108, 36).UseFrame(18, 18).UseHeaders(0, 131, 1, 32); + var tile146 = new TileDefinitionStructure(TileID.Platforms).UseWall(WallID.Glass, 216, 72).UseFrame(0, 252).UseHeaders(0, 6, 2, 32); + var tile147 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.Glass, 72, 36).UseHeaders(0, 66, 1, 0); + var tile148 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.Glass, 288, 72).UseHeaders(0, 136, 2, 0); + var tile149 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 288, 72).UseFrame(36, 0).UseHeaders(0, 136, 2, 32); + var tile150 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 108, 36).UseFrame(36, 18).UseHeaders(0, 131, 1, 32); + var tile151 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 108, 72).UseFrame(36, 36).UseHeaders(0, 131, 2, 32); + var tile152 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.MartianConduit, 72, 0).UseHeaders(0, 66, 0, 0); + var tile153 = new TileDefinitionStructure(ModContent.TileType()).UseWall(WallID.Glass, 288, 36).UseFrame(36, 0).UseHeaders(0, 136, 1, 32); + var tile154 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 396, 36).UseFrame(36, 18).UseHeaders(0, 75, 1, 32); + var tile155 = new TileDefinitionStructure(TileID.Platforms).UseWall(WallID.Glass, 36, 36).UseFrame(0, 252).UseHeaders(0, 1, 1, 32); + var tile156 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.Glass, 216, 36).UseHeaders(0, 6, 1, 0); + var tile157 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.MartianConduit, 396, 0).UseHeaders(0, 11, 0, 0); + var tile158 = new TileDefinitionStructure(TileID.MartianConduitPlating).UseWall(WallID.SapphireGemspark, 288, 108).UseFrame(18, 0).UseHeaders(0, 136, 3, 1056); + var tile159 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.Glass, 360, 0).UseHeaders(0, 10, 0, 0); + var tile160 = new TileDefinitionStructure(TileID.Platforms).UseWall(WallID.Glass, 108, 36).UseFrame(36, 252).UseHeaders(0, 131, 1, 32); + var tile161 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 108, 36).UseHeaders(0, 131, 1, 32); + var tile162 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 108, 36).UseFrame(0, 18).UseHeaders(0, 131, 1, 32); + var tile163 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 144, 0).UseFrame(0, 36).UseHeaders(0, 4, 0, 32); + var tile164 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 108, 72).UseFrame(0, 54).UseHeaders(0, 131, 2, 32); + var tile165 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.Glass, 252, 72).UseHeaders(0, 71, 2, 0); + var tile166 = new TileDefinitionStructure(ModContent.TileType()).UseWall(WallID.Glass, 108, 36).UseHeaders(0, 131, 1, 32); + var tile167 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 108, 36).UseFrame(0, 18).UseHeaders(0, 131, 1, 32); + var tile168 = new TileDefinitionStructure(TileID.Platforms).UseWall(WallID.Glass, 288, 72).UseFrame(0, 252).UseHeaders(0, 136, 2, 32); + var tile169 = new TileDefinitionStructure(ModContent.TileType()).UseWall(WallID.Glass, 72, 36).UseHeaders(0, 66, 1, 32); + var tile170 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 72, 36).UseFrame(18, 0).UseHeaders(0, 66, 1, 32); + var tile171 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 36, 72).UseFrame(18, 18).UseHeaders(0, 1, 2, 32); + var tile172 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(18, 36).UseHeaders(0, 0, 0, 32); + var tile173 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 288, 144).UseFrame(18, 54).UseHeaders(0, 136, 4, 32); + var tile174 = new TileDefinitionStructure(ModContent.TileType()).UseWall(WallID.Glass, 216, 36).UseFrame(18, 0).UseHeaders(0, 6, 1, 32); + var tile175 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 396, 72).UseFrame(18, 18).UseHeaders(0, 139, 2, 32); + var tile176 = new TileDefinitionStructure(TileID.Platforms).UseWall(WallID.Glass, 396, 36).UseFrame(0, 252).UseHeaders(0, 75, 1, 32); + var tile177 = new TileDefinitionStructure(TileID.Dirt, false).UseWall((ushort)ModContent.WallType(), 396, 72).UseHeaders(0, 139, 2, 0); + var tile178 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 396, 36).UseFrame(36, 0).UseHeaders(0, 75, 1, 32); + var tile179 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 72, 36).UseFrame(36, 18).UseHeaders(0, 66, 1, 32); + var tile180 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 0, 36).UseFrame(36, 36).UseHeaders(0, 64, 1, 32); + var tile181 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 108, 72).UseFrame(36, 54).UseHeaders(0, 131, 2, 32); + var tile182 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.MartianConduit, 108, 0).UseHeaders(0, 131, 0, 0); + var tile183 = new TileDefinitionStructure(TileID.Dirt, false).UseWall((ushort)ModContent.WallType(), 36, 36).UseFrame(-1, -1).UseHeaders(0, 1, 1, 0); + var tile184 = new TileDefinitionStructure(TileID.Platforms).UseWall(WallID.Glass, 72, 36).UseFrame(0, 252).UseHeaders(0, 66, 1, 32); + var tile185 = new TileDefinitionStructure(TileID.Platforms).UseWall(WallID.Glass, 72, 36).UseFrame(18, 252).UseHeaders(0, 66, 1, 32); + var tile186 = new TileDefinitionStructure(TileID.MartianConduitPlating).UseWall(WallID.SapphireGemspark, 216, 108).UseFrame(18, 0).UseHeaders(0, 6, 3, 1056); + var tile187 = new TileDefinitionStructure(ModContent.TileType()).UseWall(WallID.Glass, 72, 36).UseHeaders(0, 66, 1, 32); + var tile188 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 108, 36).UseFrame(0, 18).UseHeaders(0, 131, 1, 32); + var tile189 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 216, 72).UseFrame(0, 18).UseHeaders(0, 6, 2, 32); + var tile190 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 72, 72).UseFrame(0, 54).UseHeaders(0, 66, 2, 32); + var tile191 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.MartianConduit, 36, 108).UseHeaders(0, 1, 3, 0); + var tile192 = new TileDefinitionStructure(ModContent.TileType()).UseWall(WallID.Glass, 288, 36).UseFrame(18, 0).UseHeaders(0, 136, 1, 32); + var tile193 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 396, 36).UseFrame(18, 18).UseHeaders(0, 75, 1, 32); + var tile194 = new TileDefinitionStructure(TileID.Platforms).UseWall(WallID.Glass, 108, 36).UseFrame(0, 252).UseHeaders(0, 131, 1, 32); + var tile195 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.Glass, 396, 36).UseHeaders(0, 75, 1, 0); + var tile196 = new TileDefinitionStructure(ModContent.TileType()).UseWall(WallID.MartianConduit, 396, 0).UseFrame(18, 0).UseHeaders(0, 11, 0, 32); + var tile197 = new TileDefinitionStructure(ModContent.TileType()).UseWall(WallID.MartianConduit, 72, 36).UseFrame(18, 18).UseHeaders(0, 66, 1, 32); + var tile198 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 252, 36).UseFrame(18, 36).UseHeaders(0, 71, 1, 32); + var tile199 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 72, 72).UseFrame(18, 54).UseHeaders(0, 66, 2, 32); + var tile200 = new TileDefinitionStructure(TileID.MartianConduitPlating).UseFrame(90, 54).UseSlope(1).UseHeaders(0, 32, 0, 4128); + var tile201 = new TileDefinitionStructure(ModContent.TileType()).UseWall(WallID.Glass, 360, 72).UseFrame(36, 0).UseHeaders(0, 138, 2, 32); + var tile202 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 36, 36).UseFrame(36, 18).UseHeaders(0, 1, 1, 32); + var tile203 = new TileDefinitionStructure(TileID.Platforms).UseWall(WallID.Glass, 36, 36).UseFrame(234, 252).UseHeaders(0, 1, 1, 32); + var tile204 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 72, 36).UseFrame(36, 0).UseHeaders(0, 66, 1, 32); + var tile205 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 360, 72).UseFrame(36, 36).UseHeaders(0, 138, 2, 32); + var tile206 = new TileDefinitionStructure(ModContent.TileType()).UseWall(WallID.MartianConduit, 36, 0).UseHeaders(0, 1, 0, 32); + var tile207 = new TileDefinitionStructure(ModContent.TileType()).UseWall(WallID.Glass, 216, 72).UseFrame(0, 18).UseHeaders(0, 6, 2, 32); + var tile208 = new TileDefinitionStructure(TileID.Platforms).UseWall(WallID.Glass, 252, 72).UseFrame(180, 252).UseSlope(1).UseHeaders(0, 71, 2, 4128); + var tile209 = new TileDefinitionStructure(TileID.MartianConduitPlating).UseWall(WallID.SapphireGemspark, 0, 144).UseFrame(36, 0).UseHeaders(0, 16, 4, 1056); + var tile210 = new TileDefinitionStructure(TileID.Platforms).UseWall((ushort)ModContent.WallType(), 288, 36).UseFrame(180, 252).UseSlope(1).UseHeaders(0, 136, 1, 4128); + var tile211 = new TileDefinitionStructure(TileID.Platforms).UseWall(WallID.MartianConduit, 72, 36).UseFrame(0, 252).UseHeaders(0, 66, 1, 32); + var tile212 = new TileDefinitionStructure(TileID.MartianConduitPlating).UseWall(WallID.SapphireGemspark, 36, 72).UseFrame(54, 0).UseHeaders(0, 33, 2, 1056); + var tile213 = new TileDefinitionStructure(TileID.MartianConduitPlating).UseFrame(54, 54).UseSlope(1).UseHeaders(0, 16, 0, 4128); + var tile214 = new TileDefinitionStructure(TileID.MartianConduitPlating).UseFrame(36, 72).UseSlope(4).UseHeaders(0, 16, 0, 16416); + var tile215 = new TileDefinitionStructure(TileID.Platforms).UseWall(WallID.MartianConduit, 36, 36).UseFrame(0, 252).UseHeaders(0, 1, 1, 32); + var tile216 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.SapphireGemspark, 36, 36).UseHeaders(0, 1, 1, 0); + var tile217 = new TileDefinitionStructure(TileID.MartianConduitPlating).UseWall(WallID.SapphireGemspark, 72, 72).UseFrame(54, 0).UseHeaders(0, 98, 2, 1056); + var tile218 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 396, 36).UseHeaders(0, 75, 1, 32); + var tile219 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 36, 36).UseFrame(0, 18).UseHeaders(0, 1, 1, 32); + var tile220 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 252, 36).UseFrame(0, 36).UseHeaders(0, 71, 1, 32); + var tile221 = new TileDefinitionStructure(TileID.Dirt, false).UseWall((ushort)ModContent.WallType(), 108, 0).UseHeaders(0, 131, 0, 0); + var tile222 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 36, 36).UseFrame(18, 0).UseHeaders(0, 1, 1, 32); + var tile223 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 36, 36).UseFrame(18, 18).UseHeaders(0, 1, 1, 32); + var tile224 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 360, 0).UseFrame(18, 36).UseHeaders(0, 10, 0, 32); + var tile225 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 108, 36).UseFrame(162, 54).UseHeaders(0, 131, 1, 32); + var tile226 = new TileDefinitionStructure(ModContent.TileType()).UseWall(WallID.MartianConduit, 72, 36).UseFrame(0, 18).UseHeaders(0, 66, 1, 32); + var tile227 = new TileDefinitionStructure(TileID.MartianConduitPlating).UseFrame(18, 54).UseSlope(1).UseHeaders(0, 0, 0, 4128); + var tile228 = new TileDefinitionStructure(TileID.MartianConduitPlating).UseWall((ushort)ModContent.WallType(), 108, 108).UseFrame(0, 72).UseSlope(4).UseHeaders(0, 67, 3, 16416); + var tile229 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 72, 36).UseFrame(36, 0).UseHeaders(0, 66, 1, 32); + var tile230 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 216, 72).UseFrame(36, 18).UseHeaders(0, 6, 2, 32); + var tile231 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 108, 36).UseFrame(36, 36).UseHeaders(0, 131, 1, 32); + var tile232 = new TileDefinitionStructure(TileID.MartianConduitPlating).UseWall(WallID.SapphireGemspark, 36, 72).UseFrame(54, 0).UseHeaders(0, 33, 2, 32); + var tile233 = new TileDefinitionStructure(ModContent.TileType()).UseWall(WallID.MartianConduit, 36, 108).UseHeaders(0, 1, 3, 32); + var tile234 = new TileDefinitionStructure(ModContent.TileType()).UseWall(WallID.MartianConduit, 396, 72).UseFrame(0, 18).UseHeaders(0, 139, 2, 32); + var tile235 = new TileDefinitionStructure(TileID.Platforms).UseWall(WallID.MartianConduit, 396, 72).UseFrame(0, 252).UseHeaders(0, 139, 2, 32); + var tile236 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.SapphireGemspark, 252, 36).UseHeaders(0, 71, 1, 0); + var tile237 = new TileDefinitionStructure(TileID.Platforms).UseWall(WallID.SapphireGemspark, 396, 36).UseFrame(144, 252).UseSlope(2).UseHeaders(0, 75, 1, 8224); + var tile238 = new TileDefinitionStructure(TileID.MartianConduitPlating).UseWall(WallID.SapphireGemspark, 180, 144).UseFrame(54, 0).UseHeaders(0, 165, 4, 32); + var tile239 = new TileDefinitionStructure(TileID.Platforms).UseWall(WallID.MartianConduit, 72, 36).UseFrame(18, 252).UseHeaders(0, 66, 1, 32); + var tile240 = new TileDefinitionStructure(TileID.MartianConduitPlating).UseWall(WallID.SapphireGemspark, 36, 72).UseFrame(0, 54).UseHeaders(0, 1, 2, 32); + var tile241 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.MartianConduit, 180, 108).UseHeaders(0, 133, 3, 0); + var tile242 = new TileDefinitionStructure(TileID.MartianConduitPlating).UseWall(WallID.SapphireGemspark, 108, 72).UseFrame(18, 0).UseHeaders(0, 131, 2, 32); + var tile243 = new TileDefinitionStructure(ModContent.TileType()).UseWall(WallID.MartianConduit, 108, 108).UseHeaders(0, 67, 3, 32); + var tile244 = new TileDefinitionStructure(ModContent.TileType()).UseWall(WallID.MartianConduit, 360, 0).UseFrame(0, 18).UseHeaders(0, 10, 0, 32); + var tile245 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 360, 72).UseHeaders(0, 138, 2, 32); + var tile246 = new TileDefinitionStructure(ModContent.TileType()).UseWall(WallID.MartianConduit, 72, 36).UseFrame(0, 18).UseHeaders(0, 66, 1, 32); + var tile247 = new TileDefinitionStructure(ModContent.TileType()).UseWall(WallID.MartianConduit, 72, 36).UseFrame(0, 36).UseHeaders(0, 66, 1, 32); + var tile248 = new TileDefinitionStructure(ModContent.TileType()).UseWall(WallID.SapphireGemspark, 360, 0).UseFrame(0, 54).UseHeaders(0, 10, 0, 32); + var tile249 = new TileDefinitionStructure(ModContent.TileType()).UseWall((ushort)ModContent.WallType(), 36, 36).UseFrame(18, 0).UseHeaders(0, 1, 1, 32); + var tile250 = new TileDefinitionStructure(ModContent.TileType()).UseWall(WallID.MartianConduit, 36, 36).UseFrame(18, 18).UseHeaders(0, 1, 1, 32); + var tile251 = new TileDefinitionStructure(ModContent.TileType()).UseWall(WallID.MartianConduit, 252, 72).UseFrame(18, 36).UseHeaders(0, 71, 2, 32); + var tile252 = new TileDefinitionStructure(ModContent.TileType()).UseWall(WallID.SapphireGemspark, 108, 36).UseFrame(18, 54).UseHeaders(0, 131, 1, 32); + var tile253 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.MartianConduit, 108, 108).UseHeaders(0, 67, 3, 0); + var tile254 = new TileDefinitionStructure(TileID.MartianConduitPlating).UseWall(WallID.SapphireGemspark, 108, 72).UseFrame(36, 0).UseHeaders(0, 147, 2, 32); + var tile255 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.MartianConduit, 144, 36).UseHeaders(0, 68, 1, 0); + var tile256 = new TileDefinitionStructure(TileID.Dirt, false).UseWall((ushort)ModContent.WallType(), 144, 0).UseHeaders(0, 4, 0, 0); + var tile257 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.MartianConduit, 144, 0).UseHeaders(0, 4, 0, 0); + var tile258 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.SapphireGemspark, 144, 36).UseHeaders(0, 68, 1, 0); + var tile259 = new TileDefinitionStructure(TileID.MartianConduitPlating).UseWall(WallID.SapphireGemspark, 108, 144).UseFrame(36, 0).UseHeaders(0, 83, 4, 32); + var tile260 = new TileDefinitionStructure(TileID.MartianConduitPlating).UseWall((ushort)ModContent.WallType(), 432, 0).UseFrame(0, 18).UseHeaders(0, 28, 0, 32); + var tile261 = new TileDefinitionStructure(TileID.MartianConduitPlating).UseFrame(0, 72).UseHeaders(0, 0, 0, 32); + var tile262 = new TileDefinitionStructure(TileID.ClosedDoor).UseFrame(0, 1080).UseHeaders(0, 0, 0, 32); + var tile263 = new TileDefinitionStructure(TileID.ClosedDoor).UseFrame(0, 1098).UseHeaders(0, 0, 0, 32); + var tile264 = new TileDefinitionStructure(TileID.ClosedDoor).UseFrame(0, 1116).UseHeaders(0, 0, 0, 32); + Dictionary colorTileMap = new Dictionary() + { + { new Color(255, 255, 255), tile1}, + { new Color(24, 40, 82), tile2}, + { new Color(112, 140, 156), tile3}, + { new Color(51, 229, 115), tile4}, + { new Color(141, 92, 219), tile5}, + { new Color(238, 156, 189), tile6}, + { new Color(179, 209, 228), tile7}, + { new Color(126, 39, 38), tile8}, + { new Color(252, 25, 91), tile9}, + { new Color(174, 219, 216), tile10}, + { new Color(18, 49, 36), tile11}, + { new Color(173, 117, 15), tile12}, + { new Color(104, 112, 202), tile13}, + { new Color(231, 196, 199), tile14}, + { new Color(152, 43, 19), tile15}, + { new Color(251, 181, 100), tile16}, + { new Color(172, 109, 6), tile17}, + { new Color(176, 41, 244), tile18}, + { new Color(189, 53, 218), tile19}, + { new Color(216, 28, 15), tile20}, + { new Color(247, 194, 177), tile21}, + { new Color(196, 32, 179), tile22}, + { new Color(78, 224, 230), tile23}, + { new Color(204, 134, 44), tile24}, + { new Color(242, 203, 12), tile25}, + { new Color(29, 230, 252), tile26}, + { new Color(18, 1, 99), tile27}, + { new Color(247, 1, 109), tile28}, + { new Color(209, 97, 8), tile29}, + { new Color(47, 239, 63), tile30}, + { new Color(52, 143, 83), tile31}, + { new Color(187, 240, 2), tile32}, + { new Color(22, 212, 10), tile33}, + { new Color(96, 172, 212), tile34}, + { new Color(125, 223, 230), tile35}, + { new Color(218, 190, 93), tile36}, + { new Color(231, 160, 79), tile37}, + { new Color(221, 198, 27), tile38}, + { new Color(171, 0, 192), tile39}, + { new Color(67, 242, 190), tile40}, + { new Color(170, 31, 240), tile41}, + { new Color(166, 151, 246), tile42}, + { new Color(217, 54, 218), tile43}, + { new Color(10, 7, 17), tile44}, + { new Color(241, 178, 85), tile45}, + { new Color(143, 121, 34), tile46}, + { new Color(134, 247, 163), tile47}, + { new Color(171, 71, 79), tile48}, + { new Color(240, 87, 201), tile49}, + { new Color(56, 16, 240), tile50}, + { new Color(65, 211, 225), tile51}, + { new Color(76, 181, 140), tile52}, + { new Color(228, 214, 72), tile53}, + { new Color(240, 1, 135), tile54}, + { new Color(130, 221, 153), tile55}, + { new Color(61, 235, 20), tile56}, + { new Color(198, 28, 134), tile57}, + { new Color(158, 188, 251), tile58}, + { new Color(26, 255, 215), tile59}, + { new Color(161, 182, 64), tile60}, + { new Color(45, 160, 38), tile61}, + { new Color(234, 201, 52), tile62}, + { new Color(48, 165, 252), tile63}, + { new Color(200, 170, 162), tile64}, + { new Color(217, 150, 246), tile65}, + { new Color(28, 40, 106), tile66}, + { new Color(182, 178, 107), tile67}, + { new Color(181, 114, 243), tile68}, + { new Color(105, 162, 22), tile69}, + { new Color(229, 49, 181), tile70}, + { new Color(180, 67, 32), tile71}, + { new Color(7, 194, 96), tile72}, + { new Color(96, 152, 19), tile73}, + { new Color(101, 13, 69), tile74}, + { new Color(23, 253, 113), tile75}, + { new Color(228, 196, 37), tile76}, + { new Color(5, 254, 214), tile77}, + { new Color(109, 235, 4), tile78}, + { new Color(212, 120, 46), tile79}, + { new Color(50, 128, 38), tile80}, + { new Color(29, 75, 116), tile81}, + { new Color(70, 19, 103), tile82}, + { new Color(130, 210, 211), tile83}, + { new Color(149, 187, 144), tile84}, + { new Color(86, 80, 165), tile85}, + { new Color(38, 157, 116), tile86}, + { new Color(130, 133, 222), tile87}, + { new Color(240, 224, 50), tile88}, + { new Color(223, 71, 87), tile89}, + { new Color(27, 51, 74), tile90}, + { new Color(49, 46, 23), tile91}, + { new Color(237, 71, 194), tile92}, + { new Color(208, 208, 234), tile93}, + { new Color(10, 97, 242), tile94}, + { new Color(82, 111, 67), tile95}, + { new Color(70, 23, 154), tile96}, + { new Color(94, 174, 218), tile97}, + { new Color(186, 176, 250), tile98}, + { new Color(72, 44, 107), tile99}, + { new Color(66, 103, 204), tile100}, + { new Color(15, 102, 158), tile101}, + { new Color(136, 100, 141), tile102}, + { new Color(120, 105, 9), tile103}, + { new Color(227, 85, 205), tile104}, + { new Color(137, 119, 35), tile105}, + { new Color(235, 158, 112), tile106}, + { new Color(239, 152, 47), tile107}, + { new Color(189, 188, 132), tile108}, + { new Color(112, 118, 125), tile109}, + { new Color(29, 164, 27), tile110}, + { new Color(86, 142, 104), tile111}, + { new Color(29, 250, 251), tile112}, + { new Color(83, 201, 11), tile113}, + { new Color(182, 205, 174), tile114}, + { new Color(145, 123, 89), tile115}, + { new Color(12, 48, 57), tile116}, + { new Color(215, 92, 141), tile117}, + { new Color(250, 83, 207), tile118}, + { new Color(156, 82, 169), tile119}, + { new Color(26, 24, 237), tile120}, + { new Color(15, 91, 196), tile121}, + { new Color(237, 140, 198), tile122}, + { new Color(101, 107, 125), tile123}, + { new Color(40, 152, 213), tile124}, + { new Color(101, 57, 202), tile125}, + { new Color(129, 44, 65), tile126}, + { new Color(43, 99, 70), tile127}, + { new Color(68, 69, 72), tile128}, + { new Color(141, 92, 59), tile129}, + { new Color(153, 129, 168), tile130}, + { new Color(81, 57, 176), tile131}, + { new Color(29, 166, 114), tile132}, + { new Color(234, 163, 239), tile133}, + { new Color(146, 167, 196), tile134}, + { new Color(187, 174, 196), tile135}, + { new Color(183, 149, 25), tile136}, + { new Color(4, 27, 37), tile137}, + { new Color(104, 239, 180), tile138}, + { new Color(167, 203, 21), tile139}, + { new Color(124, 95, 48), tile140}, + { new Color(139, 204, 234), tile141}, + { new Color(212, 215, 94), tile142}, + { new Color(37, 71, 147), tile143}, + { new Color(88, 151, 136), tile144}, + { new Color(82, 152, 188), tile145}, + { new Color(129, 136, 151), tile146}, + { new Color(131, 214, 198), tile147}, + { new Color(33, 148, 101), tile148}, + { new Color(130, 233, 73), tile149}, + { new Color(252, 118, 218), tile150}, + { new Color(92, 109, 67), tile151}, + { new Color(191, 7, 219), tile152}, + { new Color(218, 231, 215), tile153}, + { new Color(101, 146, 77), tile154}, + { new Color(134, 172, 132), tile155}, + { new Color(156, 21, 86), tile156}, + { new Color(248, 37, 67), tile157}, + { new Color(126, 248, 137), tile158}, + { new Color(105, 105, 55), tile159}, + { new Color(132, 81, 237), tile160}, + { new Color(20, 40, 209), tile161}, + { new Color(184, 251, 41), tile162}, + { new Color(69, 147, 144), tile163}, + { new Color(225, 167, 161), tile164}, + { new Color(191, 29, 67), tile165}, + { new Color(121, 155, 231), tile166}, + { new Color(225, 230, 211), tile167}, + { new Color(242, 4, 80), tile168}, + { new Color(151, 222, 116), tile169}, + { new Color(186, 85, 157), tile170}, + { new Color(163, 85, 149), tile171}, + { new Color(233, 81, 105), tile172}, + { new Color(123, 206, 177), tile173}, + { new Color(90, 87, 130), tile174}, + { new Color(198, 22, 126), tile175}, + { new Color(161, 190, 219), tile176}, + { new Color(70, 239, 206), tile177}, + { new Color(80, 163, 107), tile178}, + { new Color(26, 33, 36), tile179}, + { new Color(129, 33, 28), tile180}, + { new Color(180, 139, 61), tile181}, + { new Color(242, 62, 82), tile182}, + { new Color(11, 214, 204), tile183}, + { new Color(217, 253, 204), tile184}, + { new Color(54, 135, 142), tile185}, + { new Color(80, 44, 237), tile186}, + { new Color(210, 245, 31), tile187}, + { new Color(153, 115, 102), tile188}, + { new Color(207, 83, 178), tile189}, + { new Color(42, 206, 47), tile190}, + { new Color(68, 250, 172), tile191}, + { new Color(148, 165, 204), tile192}, + { new Color(69, 211, 216), tile193}, + { new Color(43, 150, 232), tile194}, + { new Color(15, 108, 242), tile195}, + { new Color(1, 25, 27), tile196}, + { new Color(221, 202, 245), tile197}, + { new Color(55, 175, 43), tile198}, + { new Color(253, 27, 23), tile199}, + { new Color(214, 35, 235), tile200}, + { new Color(160, 225, 7), tile201}, + { new Color(157, 148, 2), tile202}, + { new Color(32, 162, 225), tile203}, + { new Color(193, 11, 89), tile204}, + { new Color(21, 166, 95), tile205}, + { new Color(55, 137, 7), tile206}, + { new Color(116, 205, 57), tile207}, + { new Color(150, 76, 4), tile208}, + { new Color(58, 13, 75), tile209}, + { new Color(129, 150, 138), tile210}, + { new Color(181, 110, 175), tile211}, + { new Color(237, 139, 180), tile212}, + { new Color(225, 114, 215), tile213}, + { new Color(239, 225, 118), tile214}, + { new Color(58, 27, 191), tile215}, + { new Color(155, 34, 8), tile216}, + { new Color(204, 198, 145), tile217}, + { new Color(16, 98, 85), tile218}, + { new Color(177, 10, 148), tile219}, + { new Color(2, 99, 135), tile220}, + { new Color(183, 158, 11), tile221}, + { new Color(87, 12, 156), tile222}, + { new Color(169, 39, 26), tile223}, + { new Color(170, 85, 23), tile224}, + { new Color(47, 132, 236), tile225}, + { new Color(195, 91, 49), tile226}, + { new Color(69, 158, 235), tile227}, + { new Color(66, 180, 208), tile228}, + { new Color(248, 165, 11), tile229}, + { new Color(90, 60, 129), tile230}, + { new Color(31, 222, 15), tile231}, + { new Color(80, 56, 66), tile232}, + { new Color(107, 227, 15), tile233}, + { new Color(34, 241, 250), tile234}, + { new Color(238, 33, 112), tile235}, + { new Color(122, 224, 221), tile236}, + { new Color(104, 238, 174), tile237}, + { new Color(99, 189, 196), tile238}, + { new Color(156, 116, 234), tile239}, + { new Color(58, 94, 102), tile240}, + { new Color(144, 79, 235), tile241}, + { new Color(153, 138, 119), tile242}, + { new Color(8, 222, 76), tile243}, + { new Color(170, 87, 120), tile244}, + { new Color(34, 34, 173), tile245}, + { new Color(240, 84, 146), tile246}, + { new Color(96, 125, 196), tile247}, + { new Color(45, 241, 77), tile248}, + { new Color(211, 188, 33), tile249}, + { new Color(75, 180, 195), tile250}, + { new Color(88, 48, 132), tile251}, + { new Color(168, 145, 162), tile252}, + { new Color(15, 85, 150), tile253}, + { new Color(249, 114, 2), tile254}, + { new Color(145, 190, 150), tile255}, + { new Color(53, 65, 154), tile256}, + { new Color(23, 171, 32), tile257}, + { new Color(87, 218, 225), tile258}, + { new Color(162, 99, 93), tile259}, + { new Color(157, 198, 206), tile260}, + { new Color(86, 189, 42), tile261}, + { new Color(137, 81, 39), tile262}, + { new Color(244, 121, 144), tile263}, + { new Color(11, 225, 255), tile264}, + }; + return new ColorTileMap(colorTileMap); + } + } +} diff --git a/Schematics/AutoGeneratedContent/ResearchFacilitySchematic.png b/Schematics/AutoGeneratedContent/ResearchFacilitySchematic.png new file mode 100644 index 0000000000..a9a0bc85b7 Binary files /dev/null and b/Schematics/AutoGeneratedContent/ResearchFacilitySchematic.png differ diff --git a/Schematics/AutoGeneratedContent/Workshop2Schematic.cs b/Schematics/AutoGeneratedContent/Workshop2Schematic.cs new file mode 100644 index 0000000000..e9462d5482 --- /dev/null +++ b/Schematics/AutoGeneratedContent/Workshop2Schematic.cs @@ -0,0 +1,741 @@ +using CalamityMod.Tiles; +using CalamityMod.Tiles.DraedonStructures; +using CalamityMod.Walls.DraedonStructures; +using Microsoft.Xna.Framework; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Schematics.AutoGeneratedContent +{ + public class Workshop2Schematic + { + [GeneratedCode("ScreenCaptureToSchematic", "1.0.2")] + public static ColorTileMap GetMap() + { + var tile1 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 0, 0, 0); + var tile2 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 8224).UseFrame(72, 54); + var tile3 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(288, 0); + var tile4 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(90, 18); + var tile5 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(90, 0); + var tile6 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(90, 36); + var tile7 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(288, 18); + var tile8 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32); + var tile9 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 16416).UseFrame(36, 72); + var tile10 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(54, 54); + var tile11 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(90, 72); + var tile12 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 132, 3, 0).UseWall((ushort)ModContent.WallType(), 144, 108); + var tile13 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 128, 2, 0).UseWall((ushort)ModContent.WallType(), 0, 72); + var tile14 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 0, 0, 0).UseWall((ushort)ModContent.WallType(), 0, 0); + var tile15 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 101, 1, 2144).UseFrame(162, 36).UseWall((ushort)ModContent.WallType(), 180, 36).MakeActuated(); + var tile16 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 133, 2, 0).UseWall((ushort)ModContent.WallType(), 180, 72); + var tile17 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 96, 1, 4128).UseFrame(90, 54).UseWall((ushort)ModContent.WallType(), 0, 36); + var tile18 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 148, 4, 32).UseFrame(72, 18).UseWall((ushort)ModContent.WallType(), 144, 144); + var tile19 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 8224).UseFrame(72, 54); + var tile20 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(288, 0); + var tile21 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 164, 3, 12320).UseFrame(144, 54).UseWall((ushort)ModContent.WallType(), 144, 108); + var tile22 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 2, 0).UseWall((ushort)ModContent.WallType(), 288, 72); + var tile23 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 1, 0).UseWall((ushort)ModContent.WallType(), 36, 36); + var tile24 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 4, 0).UseWall((ushort)ModContent.WallType(), 36, 144); + var tile25 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 2144).UseFrame(108, 72).MakeActuated(); + var tile26 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 0, 0).UseWall((ushort)ModContent.WallType(), 36, 0); + var tile27 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 2, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 36, 72); + var tile28 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(162, 0); + var tile29 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(54, 0); + var tile30 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(36, 36); + var tile31 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 3, 0).UseWall((ushort)ModContent.WallType(), 36, 108); + var tile32 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 2, 0).UseWall((ushort)ModContent.WallType(), 36, 72); + var tile33 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 3, 2144).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 72, 108).MakeActuated(); + var tile34 = new TileDefinitionStructure(TileID.FishingCrate).UseHeaders(0, 133, 2, 32).UseWall((ushort)ModContent.WallType(), 180, 72); + var tile35 = new TileDefinitionStructure(TileID.FishingCrate).UseHeaders(0, 75, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 396, 36); + var tile36 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 32).UseWall((ushort)ModContent.WallType(), 72, 72); + var tile37 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(108, 72); + var tile38 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(36, 0); + var tile39 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 36); + var tile40 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 0, 0, 32).UseFrame(0, 540); + var tile41 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 1, 0, 32).UseFrame(0, 558).UseWall((ushort)ModContent.WallType(), 36, 0); + var tile42 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 4, 2144).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 288, 144).MakeActuated(); + var tile43 = new TileDefinitionStructure(TileID.FishingCrate).UseHeaders(0, 0, 0, 32).UseFrame(18, 0); + var tile44 = new TileDefinitionStructure(TileID.FishingCrate).UseHeaders(0, 1, 0, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 36, 0); + var tile45 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 2, 32).UseWall((ushort)ModContent.WallType(), 36, 72); + var tile46 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(126, 72); + var tile47 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(288, 36); + var tile48 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 148, 3, 12320).UseFrame(54, 72).UseWall((ushort)ModContent.WallType(), 144, 108); + var tile49 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 64, 1, 0).UseWall((ushort)ModContent.WallType(), 0, 36); + var tile50 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 2, 0).UseWall((ushort)ModContent.WallType(), 252, 72); + var tile51 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 1, 0).UseWall((ushort)ModContent.WallType(), 72, 36); + var tile52 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 5, 0, 0).UseWall((ushort)ModContent.WallType(), 180, 0); + var tile53 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 2, 2144).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 108, 72).MakeActuated(); + var tile54 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 2, 32).UseWall((ushort)ModContent.WallType(), 36, 72); + var tile55 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(144, 72); + var tile56 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(36, 0); + var tile57 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 0, 2144).UseFrame(108, 0).UseWall((ushort)ModContent.WallType(), 72, 0).MakeActuated(); + var tile58 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 43, 0, 2144).UseFrame(90, 36).UseWall((ushort)ModContent.WallType(), 396, 0).MakeActuated(); + var tile59 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 2144).UseFrame(90, 0).UseWall((ushort)ModContent.WallType(), 108, 36).MakeActuated(); + var tile60 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 2, 2144).UseFrame(90, 36).UseWall((ushort)ModContent.WallType(), 108, 72).MakeActuated(); + var tile61 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 2144).UseFrame(90, 36).MakeActuated(); + var tile62 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 140, 2, 2144).UseFrame(18, 72).UseWall((ushort)ModContent.WallType(), 432, 72).MakeActuated(); + var tile63 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(72, 0); + var tile64 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 0, 0).UseWall((ushort)ModContent.WallType(), 108, 0); + var tile65 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 1, 0).UseWall((ushort)ModContent.WallType(), 72, 36); + var tile66 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 133, 3, 0).UseWall((ushort)ModContent.WallType(), 180, 108); + var tile67 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 32).UseFrame(234, 0).UseWall((ushort)ModContent.WallType(), 72, 72); + var tile68 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(306, 36); + var tile69 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 16416).UseFrame(36, 72); + var tile70 = new TileDefinitionStructure(TileID.Lamps).UseHeaders(0, 0, 0, 32).UseFrame(0, 216); + var tile71 = new TileDefinitionStructure(TileID.Lamps).UseHeaders(0, 0, 0, 32).UseFrame(0, 234); + var tile72 = new TileDefinitionStructure(TileID.Lamps).UseHeaders(0, 0, 0, 32).UseFrame(0, 252); + var tile73 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(36, 54); + var tile74 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(0, 18); + var tile75 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 16416).UseFrame(72, 72); + var tile76 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(72, 54); + var tile77 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 1, 0).UseWall((ushort)ModContent.WallType(), 108, 36); + var tile78 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 6, 2, 0).UseWall((ushort)ModContent.WallType(), 216, 72); + var tile79 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 8224).UseFrame(144, 0); + var tile80 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 76, 1, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 432, 36); + var tile81 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 4128).UseFrame(18, 54); + var tile82 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(288, 72); + var tile83 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 16416).UseFrame(0, 72); + var tile84 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 8224).UseFrame(0, 54); + var tile85 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(270, 72); + var tile86 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 18); + var tile87 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(54, 18); + var tile88 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(36, 36); + var tile89 = new TileDefinitionStructure(TileID.TallGateOpen).UseHeaders(0, 0, 0, 32); + var tile90 = new TileDefinitionStructure(TileID.TallGateOpen).UseHeaders(0, 0, 0, 32).UseFrame(0, 20); + var tile91 = new TileDefinitionStructure(TileID.TallGateOpen).UseHeaders(0, 0, 0, 32).UseFrame(0, 38); + var tile92 = new TileDefinitionStructure(TileID.TallGateOpen).UseHeaders(0, 0, 0, 32).UseFrame(0, 56); + var tile93 = new TileDefinitionStructure(TileID.TallGateOpen).UseHeaders(0, 0, 0, 32).UseFrame(0, 74); + var tile94 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 0); + var tile95 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(270, 54); + var tile96 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 0, 0).UseWall((ushort)ModContent.WallType(), 72, 0); + var tile97 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 68, 1, 0).UseWall((ushort)ModContent.WallType(), 144, 36); + var tile98 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 2, 0).UseWall((ushort)ModContent.WallType(), 108, 72); + var tile99 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 8224).UseFrame(144, 0); + var tile100 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 73, 1, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 324, 36); + var tile101 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 4128).UseFrame(54, 54); + var tile102 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(288, 54); + var tile103 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(270, 72); + var tile104 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(36, 18); + var tile105 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(252, 54); + var tile106 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 3, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 72, 108); + var tile107 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 12320).UseFrame(90, 72).UseWall((ushort)ModContent.WallType(), 0, 0); + var tile108 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 128, 2, 0).UseWall((ushort)ModContent.WallType(), 0, 72); + var tile109 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 128, 2, 4128).UseFrame(18, 54).UseWall((ushort)ModContent.WallType(), 0, 72); + var tile110 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 4, 32).UseFrame(72, 18).UseWall((ushort)ModContent.WallType(), 72, 144); + var tile111 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(288, 54); + var tile112 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 140, 2, 0).UseWall((ushort)ModContent.WallType(), 432, 72); + var tile113 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 0, 0).UseWall((ushort)ModContent.WallType(), 108, 0); + var tile114 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 0, 0).UseWall((ushort)ModContent.WallType(), 36, 0); + var tile115 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 64, 1, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 0, 36); + var tile116 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 4128).UseFrame(90, 54).UseWall((ushort)ModContent.WallType(), 0, 0); + var tile117 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 96, 1, 32).UseFrame(72, 36).UseWall((ushort)ModContent.WallType(), 0, 36); + var tile118 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 4, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 0, 144); + var tile119 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(72, 36); + var tile120 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 3, 12320).UseFrame(90, 72).UseWall((ushort)ModContent.WallType(), 72, 108); + var tile121 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 1, 0).UseWall((ushort)ModContent.WallType(), 108, 36); + var tile122 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 10, 0, 0).UseWall((ushort)ModContent.WallType(), 360, 0); + var tile123 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 132, 2, 0).UseWall((ushort)ModContent.WallType(), 144, 72); + var tile124 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 4, 0, 32).UseWall((ushort)ModContent.WallType(), 144, 0); + var tile125 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseFrame(0, 16).UseWall((ushort)ModContent.WallType(), 360, 72); + var tile126 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(0, 32).UseWall((ushort)ModContent.WallType(), 36, 36); + var tile127 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(0, 48).UseWall((ushort)ModContent.WallType(), 108, 36); + var tile128 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 2, 32).UseFrame(162, 0).UseWall((ushort)ModContent.WallType(), 108, 72); + var tile129 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 0, 0).UseWall((ushort)ModContent.WallType(), 72, 0); + var tile130 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 64, 1, 0).UseWall((ushort)ModContent.WallType(), 0, 36); + var tile131 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 5, 0, 32).UseFrame(216, 0).UseWall((ushort)ModContent.WallType(), 180, 0); + var tile132 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 2, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 252, 72); + var tile133 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 1, 0).UseWall((ushort)ModContent.WallType(), 36, 36); + var tile134 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 4, 0, 32).UseFrame(0, 54).UseWall((ushort)ModContent.WallType(), 144, 0); + var tile135 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 64, 1, 12320).UseFrame(108, 54).UseWall((ushort)ModContent.WallType(), 0, 36); + var tile136 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 2, 0).UseWall((ushort)ModContent.WallType(), 36, 72); + var tile137 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(16, 0); + var tile138 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 0, 32).UseFrame(16, 16).UseWall((ushort)ModContent.WallType(), 36, 0); + var tile139 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(16, 32).UseWall((ushort)ModContent.WallType(), 72, 36); + var tile140 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 32).UseFrame(16, 48).UseWall((ushort)ModContent.WallType(), 288, 72); + var tile141 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 2, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 72, 72); + var tile142 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 3, 0).UseWall((ushort)ModContent.WallType(), 72, 108); + var tile143 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 0, 0, 0).UseWall((ushort)ModContent.WallType(), 0, 0); + var tile144 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 1, 0).UseWall((ushort)ModContent.WallType(), 36, 36); + var tile145 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 1, 0).UseWall((ushort)ModContent.WallType(), 288, 36); + var tile146 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 2, 0).UseWall((ushort)ModContent.WallType(), 72, 72); + var tile147 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32); + var tile148 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 0, 0).UseWall((ushort)ModContent.WallType(), 72, 0); + var tile149 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 139, 2, 0).UseWall((ushort)ModContent.WallType(), 396, 72); + var tile150 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 68, 1, 0).UseWall((ushort)ModContent.WallType(), 144, 36); + var tile151 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 132, 2, 0).UseWall((ushort)ModContent.WallType(), 144, 72); + var tile152 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 1, 0).UseWall((ushort)ModContent.WallType(), 36, 36); + var tile153 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 72, 72); + var tile154 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(144, 72); + var tile155 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 67, 3, 0).UseWall((ushort)ModContent.WallType(), 108, 108); + var tile156 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 11, 0, 0).UseWall((ushort)ModContent.WallType(), 396, 0); + var tile157 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 1, 0).UseWall((ushort)ModContent.WallType(), 72, 36); + var tile158 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 4, 0, 0).UseWall((ushort)ModContent.WallType(), 144, 0); + var tile159 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 133, 2, 0).UseWall((ushort)ModContent.WallType(), 180, 72); + var tile160 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 133, 2, 32).UseFrame(32, 0).UseWall((ushort)ModContent.WallType(), 180, 72); + var tile161 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 32).UseFrame(32, 16).UseWall((ushort)ModContent.WallType(), 216, 36); + var tile162 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseFrame(32, 32).UseWall((ushort)ModContent.WallType(), 396, 72); + var tile163 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(32, 48).UseWall((ushort)ModContent.WallType(), 36, 36); + var tile164 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 2, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 36, 72); + var tile165 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 138, 2, 0).UseWall((ushort)ModContent.WallType(), 360, 72); + var tile166 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 1, 0).UseWall((ushort)ModContent.WallType(), 36, 36); + var tile167 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 69, 1, 32).UseWall((ushort)ModContent.WallType(), 180, 36); + var tile168 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 2, 0).UseWall((ushort)ModContent.WallType(), 72, 72); + var tile169 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 67, 3, 0).UseWall((ushort)ModContent.WallType(), 108, 108); + var tile170 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 87, 3, 32).UseFrame(216, 18).UseWall((ushort)ModContent.WallType(), 252, 108); + var tile171 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 0, 0, 32).UseFrame(0, 558); + var tile172 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(48, 0); + var tile173 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 3, 32).UseFrame(48, 16).UseWall((ushort)ModContent.WallType(), 36, 108); + var tile174 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 132, 2, 32).UseFrame(48, 32).UseWall((ushort)ModContent.WallType(), 144, 72); + var tile175 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(48, 48).UseWall((ushort)ModContent.WallType(), 72, 36); + var tile176 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 2, 32).UseFrame(216, 36).UseWall((ushort)ModContent.WallType(), 72, 72); + var tile177 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 2, 0).UseWall((ushort)ModContent.WallType(), 72, 72); + var tile178 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32); + var tile179 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 4, 0).UseWall((ushort)ModContent.WallType(), 288, 144); + var tile180 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(54, 0); + var tile181 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 0, 0).UseWall((ushort)ModContent.WallType(), 108, 0); + var tile182 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 2, 32).UseFrame(72, 54).UseWall((ushort)ModContent.WallType(), 36, 72); + var tile183 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(306, 54); + var tile184 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 0, 0).UseWall((ushort)ModContent.WallType(), 36, 0); + var tile185 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 1, 0).UseWall((ushort)ModContent.WallType(), 288, 36); + var tile186 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 2, 0).UseWall((ushort)ModContent.WallType(), 36, 72); + var tile187 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 6, 4, 0).UseWall((ushort)ModContent.WallType(), 216, 144); + var tile188 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 0, 0).UseWall((ushort)ModContent.WallType(), 72, 0); + var tile189 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 2, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 72, 72); + var tile190 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 1, 32).UseWall((ushort)ModContent.WallType(), 360, 36); + var tile191 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 2, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 108, 72); + var tile192 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 4, 0).UseWall((ushort)ModContent.WallType(), 252, 144); + var tile193 = new TileDefinitionStructure(TileID.FishingCrate).UseHeaders(0, 0, 0, 32); + var tile194 = new TileDefinitionStructure(TileID.FishingCrate).UseHeaders(0, 0, 0, 32).UseFrame(0, 18); + var tile195 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 108, 36); + var tile196 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 72, 36); + var tile197 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 64, 1, 32).UseWall((ushort)ModContent.WallType(), 0, 36); + var tile198 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 2, 0).UseWall((ushort)ModContent.WallType(), 108, 72); + var tile199 = new TileDefinitionStructure(TileID.FishingCrate).UseHeaders(0, 6, 0, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 216, 0); + var tile200 = new TileDefinitionStructure(TileID.FishingCrate).UseHeaders(0, 132, 4, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 144, 144); + var tile201 = new TileDefinitionStructure(TileID.FishingCrate).UseHeaders(0, 0, 0, 32).UseFrame(36, 0); + var tile202 = new TileDefinitionStructure(TileID.FishingCrate).UseHeaders(0, 66, 0, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 72, 0); + var tile203 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 2, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 36, 72); + var tile204 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 137, 2, 0).UseWall((ushort)ModContent.WallType(), 324, 72); + var tile205 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 6, 1, 0).UseWall((ushort)ModContent.WallType(), 216, 36); + var tile206 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 139, 2, 0).UseWall((ushort)ModContent.WallType(), 396, 72); + var tile207 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseWall((ushort)ModContent.WallType(), 108, 36); + var tile208 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 1, 0).UseWall((ushort)ModContent.WallType(), 288, 36); + var tile209 = new TileDefinitionStructure(TileID.FishingCrate).UseHeaders(0, 0, 0, 32).UseFrame(18, 18); + var tile210 = new TileDefinitionStructure(TileID.FishingCrate).UseHeaders(0, 1, 0, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 36, 0); + var tile211 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 4, 32).UseWall((ushort)ModContent.WallType(), 0, 144); + var tile212 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 3, 0).UseWall((ushort)ModContent.WallType(), 72, 108); + var tile213 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 11, 0, 0).UseWall((ushort)ModContent.WallType(), 396, 0); + var tile214 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 0, 0).UseWall((ushort)ModContent.WallType(), 252, 0); + var tile215 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 69, 1, 0).UseWall((ushort)ModContent.WallType(), 180, 36); + var tile216 = new TileDefinitionStructure(TileID.FishingCrate).UseHeaders(0, 69, 1, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 180, 36); + var tile217 = new TileDefinitionStructure(TileID.FishingCrate).UseHeaders(0, 66, 1, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 72, 36); + var tile218 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 2, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 108, 72); + var tile219 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 1, 0).UseWall((ushort)ModContent.WallType(), 108, 36); + var tile220 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseWall((ushort)ModContent.WallType(), 36, 36); + var tile221 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 67, 4, 0).UseWall((ushort)ModContent.WallType(), 108, 144); + var tile222 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 6, 0, 0).UseWall((ushort)ModContent.WallType(), 216, 0); + var tile223 = new TileDefinitionStructure(TileID.FishingCrate).UseHeaders(0, 0, 0, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 0, 0); + var tile224 = new TileDefinitionStructure(TileID.FishingCrate).UseHeaders(0, 138, 2, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 360, 72); + var tile225 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 132, 2, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 144, 72); + var tile226 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 138, 2, 0).UseWall((ushort)ModContent.WallType(), 360, 72); + var tile227 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 1, 2144).UseFrame(72, 54).UseWall((ushort)ModContent.WallType(), 36, 36).MakeActuated(); + var tile228 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 2144).UseFrame(90, 18).MakeActuated(); + var tile229 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 2144).UseFrame(90, 0).MakeActuated(); + var tile230 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 0, 2144).UseFrame(108, 54).UseWall((ushort)ModContent.WallType(), 36, 0).MakeActuated(); + var tile231 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 32).UseFrame(18, 54).UseWall((ushort)ModContent.WallType(), 72, 72); + var tile232 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 1, 0).UseWall((ushort)ModContent.WallType(), 72, 36); + var tile233 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 32).UseWall((ushort)ModContent.WallType(), 72, 72); + var tile234 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(162, 0); + var tile235 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 1, 0, 32).UseFrame(0, 540).UseWall((ushort)ModContent.WallType(), 36, 0); + var tile236 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 66, 1, 32).UseFrame(0, 558).UseWall((ushort)ModContent.WallType(), 72, 36); + var tile237 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 2144).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 36, 36).MakeActuated(); + var tile238 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32); + var tile239 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 132, 3, 32).UseFrame(0, 16).UseWall((ushort)ModContent.WallType(), 144, 108); + var tile240 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(0, 32).UseWall((ushort)ModContent.WallType(), 0, 0); + var tile241 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 32).UseFrame(0, 48).UseWall((ushort)ModContent.WallType(), 288, 72); + var tile242 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 32).UseFrame(162, 0).UseWall((ushort)ModContent.WallType(), 72, 72); + var tile243 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 75, 1, 0).UseWall((ushort)ModContent.WallType(), 396, 36); + var tile244 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 132, 2, 32).UseWall((ushort)ModContent.WallType(), 144, 72); + var tile245 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 64, 1, 0).UseWall((ushort)ModContent.WallType(), 0, 36); + var tile246 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 133, 2, 0).UseWall((ushort)ModContent.WallType(), 180, 72); + var tile247 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 69, 1, 0).UseWall((ushort)ModContent.WallType(), 180, 36); + var tile248 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 69, 1, 0).UseWall((ushort)ModContent.WallType(), 180, 36); + var tile249 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 68, 1, 0).UseWall((ushort)ModContent.WallType(), 144, 36); + var tile250 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 8224).UseFrame(144, 0).UseWall((ushort)ModContent.WallType(), 216, 36); + var tile251 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 64, 1, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 0, 36); + var tile252 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 1, 0).UseWall((ushort)ModContent.WallType(), 108, 36); + var tile253 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 43, 0, 2144).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 396, 0).MakeActuated(); + var tile254 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 1, 0).UseWall((ushort)ModContent.WallType(), 108, 36); + var tile255 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 5, 0, 0).UseWall((ushort)ModContent.WallType(), 180, 0); + var tile256 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 133, 2, 32).UseFrame(16, 0).UseWall((ushort)ModContent.WallType(), 180, 72); + var tile257 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 32).UseFrame(16, 16).UseWall((ushort)ModContent.WallType(), 216, 36); + var tile258 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 32).UseFrame(16, 32).UseWall((ushort)ModContent.WallType(), 396, 0); + var tile259 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(16, 48).UseWall((ushort)ModContent.WallType(), 36, 36); + var tile260 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 2, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 108, 72); + var tile261 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 133, 3, 0).UseWall((ushort)ModContent.WallType(), 180, 108); + var tile262 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 4, 0, 0).UseWall((ushort)ModContent.WallType(), 144, 0); + var tile263 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 10, 0, 0).UseWall((ushort)ModContent.WallType(), 360, 0); + var tile264 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 4, 0).UseWall((ushort)ModContent.WallType(), 36, 144); + var tile265 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(234, 0); + var tile266 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 32).UseFrame(54, 54).UseWall((ushort)ModContent.WallType(), 72, 36); + var tile267 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 1, 16416).UseFrame(144, 54).UseWall((ushort)ModContent.WallType(), 72, 36); + var tile268 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 74, 1, 0).UseWall((ushort)ModContent.WallType(), 360, 36); + var tile269 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 2144).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 108, 36).MakeActuated(); + var tile270 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 2, 0).UseWall((ushort)ModContent.WallType(), 72, 72); + var tile271 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(32, 0); + var tile272 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 0, 32).UseFrame(32, 16).UseWall((ushort)ModContent.WallType(), 72, 0); + var tile273 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(32, 32).UseWall((ushort)ModContent.WallType(), 72, 36); + var tile274 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(32, 48).UseWall((ushort)ModContent.WallType(), 72, 36); + var tile275 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 2, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 36, 72); + var tile276 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 3, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 72, 108); + var tile277 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 0, 4, 0).UseWall((ushort)ModContent.WallType(), 0, 144); + var tile278 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 8224).UseFrame(0, 54); + var tile279 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 83, 3, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 108, 108); + var tile280 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 68, 1, 32).UseWall((ushort)ModContent.WallType(), 144, 36); + var tile281 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 148, 2, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 144, 72); + var tile282 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 16416).UseFrame(36, 72).UseWall((ushort)ModContent.WallType(), 36, 36); + var tile283 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 2144).UseFrame(216, 0).UseWall((ushort)ModContent.WallType(), 72, 36).MakeActuated(); + var tile284 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(48, 0).UseWall((ushort)ModContent.WallType(), 0, 0); + var tile285 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(48, 16).UseWall((ushort)ModContent.WallType(), 36, 36); + var tile286 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(48, 32).UseWall((ushort)ModContent.WallType(), 72, 36); + var tile287 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseFrame(48, 48).UseWall((ushort)ModContent.WallType(), 216, 72); + var tile288 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 2, 32).UseFrame(216, 36).UseWall((ushort)ModContent.WallType(), 108, 72); + var tile289 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 68, 1, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 144, 36); + var tile290 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(306, 54); + var tile291 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 54); + var tile292 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(252, 72); + var tile293 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 99, 3, 32).UseFrame(270, 54).UseWall((ushort)ModContent.WallType(), 108, 108); + var tile294 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 20, 0, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 144, 0); + var tile295 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 132, 2, 16416).UseFrame(0, 72).UseWall((ushort)ModContent.WallType(), 144, 72); + var tile296 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 100, 1, 8224).UseFrame(72, 54).UseWall((ushort)ModContent.WallType(), 144, 36); + var tile297 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 4, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 36, 144); + var tile298 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(306, 54); + var tile299 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 0, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 36, 0); + var tile300 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 132, 4, 8224).UseFrame(144, 0).UseWall((ushort)ModContent.WallType(), 144, 144); + var tile301 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(306, 72); + var tile302 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 12320).UseFrame(54, 72); + var tile303 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 4128).UseFrame(18, 54); + var tile304 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(252, 72); + var tile305 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(54, 36); + var tile306 = new TileDefinitionStructure(TileID.TallGateClosed).UseHeaders(0, 0, 0, 32); + var tile307 = new TileDefinitionStructure(TileID.TallGateClosed).UseHeaders(0, 0, 0, 32).UseFrame(0, 20); + var tile308 = new TileDefinitionStructure(TileID.TallGateClosed).UseHeaders(0, 0, 0, 32).UseFrame(0, 38); + var tile309 = new TileDefinitionStructure(TileID.TallGateClosed).UseHeaders(0, 0, 0, 32).UseFrame(0, 56); + var tile310 = new TileDefinitionStructure(TileID.TallGateClosed).UseHeaders(0, 0, 0, 32).UseFrame(0, 74); + var tile311 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(252, 54); + var tile312 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 12320).UseFrame(90, 72); + var tile313 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(126, 0); + var tile314 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(90, 36); + var tile315 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 0, 32).UseFrame(90, 18).UseWall((ushort)ModContent.WallType(), 72, 0); + var tile316 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 2, 32).UseFrame(72, 72).UseWall((ushort)ModContent.WallType(), 36, 72); + var tile317 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 32).UseFrame(216, 0).UseWall((ushort)ModContent.WallType(), 72, 72); + var tile318 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(288, 36); + var tile319 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 12320).UseFrame(18, 72); + var tile320 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(72, 18); + var tile321 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 12320).UseFrame(90, 72); + var tile322 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(90, 54); + var tile323 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 132, 3, 0).UseWall((ushort)ModContent.WallType(), 144, 108); + var tile324 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 72, 72); + var tile325 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(54, 0); + var tile326 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 3, 16416).UseFrame(36, 72).UseWall((ushort)ModContent.WallType(), 36, 108); + var tile327 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 360, 0); + var tile328 = new TileDefinitionStructure(TileID.HeavyWorkBench).UseHeaders(0, 132, 4, 32).UseWall((ushort)ModContent.WallType(), 144, 144); + var tile329 = new TileDefinitionStructure(TileID.HeavyWorkBench).UseHeaders(0, 0, 0, 32).UseFrame(0, 18); + var tile330 = new TileDefinitionStructure(TileID.HeavyWorkBench).UseHeaders(0, 131, 0, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 108, 0); + var tile331 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 2, 32).UseWall((ushort)ModContent.WallType(), 108, 72); + var tile332 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 0); + var tile333 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(54, 36); + var tile334 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 131, 0, 32).UseFrame(0, 540).UseWall((ushort)ModContent.WallType(), 108, 0); + var tile335 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 6, 2, 32).UseFrame(0, 558).UseWall((ushort)ModContent.WallType(), 216, 72); + var tile336 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 108, 36); + var tile337 = new TileDefinitionStructure(TileID.HeavyWorkBench).UseHeaders(0, 71, 2, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 252, 72); + var tile338 = new TileDefinitionStructure(TileID.HeavyWorkBench).UseHeaders(0, 0, 0, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 0, 0); + var tile339 = new TileDefinitionStructure(TileID.HeavyWorkBench).UseHeaders(0, 131, 1, 32).UseFrame(18, 36).UseWall((ushort)ModContent.WallType(), 108, 36); + var tile340 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 216, 36); + var tile341 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 75, 1, 0).UseWall((ushort)ModContent.WallType(), 396, 36); + var tile342 = new TileDefinitionStructure(TileID.HeavyWorkBench).UseHeaders(0, 131, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 108, 36); + var tile343 = new TileDefinitionStructure(TileID.HeavyWorkBench).UseHeaders(0, 6, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 216, 36); + var tile344 = new TileDefinitionStructure(TileID.HeavyWorkBench).UseHeaders(0, 75, 1, 32).UseFrame(36, 36).UseWall((ushort)ModContent.WallType(), 396, 36); + var tile345 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(306, 0); + var tile346 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 3, 16416).UseFrame(126, 54).UseWall((ushort)ModContent.WallType(), 36, 108); + var tile347 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 42, 0, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 360, 0); + var tile348 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 2, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 108, 72); + var tile349 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(216, 0); + var tile350 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(0, 54); + var tile351 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(72, 72); + var tile352 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 133, 3, 0).UseWall((ushort)ModContent.WallType(), 180, 108); + var tile353 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 164, 2, 32).UseFrame(216, 36).UseWall((ushort)ModContent.WallType(), 144, 72); + var tile354 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 164, 2, 8224).UseFrame(72, 54).UseWall((ushort)ModContent.WallType(), 144, 72); + var tile355 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 165, 4, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 180, 144); + var tile356 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 4128).UseFrame(90, 54); + var tile357 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(306, 0); + var tile358 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(306, 18); + var tile359 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 12320).UseFrame(18, 72); + Dictionary colorTileMap = new Dictionary() + { + { new Color(0, 0, 0), tile1 }, + { new Color(114, 195, 225), tile2 }, + { new Color(226, 74, 12), tile3 }, + { new Color(228, 243, 191), tile4 }, + { new Color(144, 205, 196), tile5 }, + { new Color(39, 4, 64), tile6 }, + { new Color(112, 181, 57), tile7 }, + { new Color(106, 30, 171), tile8 }, + { new Color(8, 54, 212), tile9 }, + { new Color(26, 140, 167), tile10 }, + { new Color(233, 4, 18), tile11 }, + { new Color(173, 222, 58), tile12 }, + { new Color(173, 194, 45), tile13 }, + { new Color(67, 215, 12), tile14 }, + { new Color(71, 99, 37), tile15 }, + { new Color(6, 22, 237), tile16 }, + { new Color(28, 144, 14), tile17 }, + { new Color(209, 119, 142), tile18 }, + { new Color(75, 230, 38), tile19 }, + { new Color(191, 106, 140), tile20 }, + { new Color(13, 199, 189), tile21 }, + { new Color(100, 250, 238), tile22 }, + { new Color(172, 226, 239), tile23 }, + { new Color(138, 121, 66), tile24 }, + { new Color(19, 44, 222), tile25 }, + { new Color(44, 34, 187), tile26 }, + { new Color(133, 1, 31), tile27 }, + { new Color(230, 253, 252), tile28 }, + { new Color(153, 23, 141), tile29 }, + { new Color(132, 98, 248), tile30 }, + { new Color(20, 238, 88), tile31 }, + { new Color(161, 54, 15), tile32 }, + { new Color(79, 226, 104), tile33 }, + { new Color(55, 89, 52), tile34 }, + { new Color(254, 146, 22), tile35 }, + { new Color(203, 190, 74), tile36 }, + { new Color(176, 31, 195), tile37 }, + { new Color(106, 57, 104), tile38 }, + { new Color(109, 38, 202), tile39 }, + { new Color(193, 203, 227), tile40 }, + { new Color(96, 40, 127), tile41 }, + { new Color(246, 117, 139), tile42 }, + { new Color(233, 113, 246), tile43 }, + { new Color(206, 221, 63), tile44 }, + { new Color(82, 77, 167), tile45 }, + { new Color(234, 232, 106), tile46 }, + { new Color(230, 205, 88), tile47 }, + { new Color(67, 212, 67), tile48 }, + { new Color(53, 169, 180), tile49 }, + { new Color(239, 51, 15), tile50 }, + { new Color(69, 141, 23), tile51 }, + { new Color(133, 215, 49), tile52 }, + { new Color(180, 7, 28), tile53 }, + { new Color(138, 226, 77), tile54 }, + { new Color(83, 225, 65), tile55 }, + { new Color(131, 24, 235), tile56 }, + { new Color(192, 130, 61), tile57 }, + { new Color(95, 218, 253), tile58 }, + { new Color(139, 29, 84), tile59 }, + { new Color(60, 193, 204), tile60 }, + { new Color(215, 250, 62), tile61 }, + { new Color(230, 137, 79), tile62 }, + { new Color(39, 205, 118), tile63 }, + { new Color(118, 54, 225), tile64 }, + { new Color(78, 92, 235), tile65 }, + { new Color(11, 239, 242), tile66 }, + { new Color(1, 177, 145), tile67 }, + { new Color(200, 47, 177), tile68 }, + { new Color(210, 230, 179), tile69 }, + { new Color(26, 250, 186), tile70 }, + { new Color(220, 119, 69), tile71 }, + { new Color(80, 179, 232), tile72 }, + { new Color(14, 109, 88), tile73 }, + { new Color(241, 91, 74), tile74 }, + { new Color(116, 74, 76), tile75 }, + { new Color(92, 17, 125), tile76 }, + { new Color(17, 127, 45), tile77 }, + { new Color(97, 58, 16), tile78 }, + { new Color(58, 14, 203), tile79 }, + { new Color(140, 20, 162), tile80 }, + { new Color(155, 13, 211), tile81 }, + { new Color(188, 153, 190), tile82 }, + { new Color(155, 253, 169), tile83 }, + { new Color(3, 252, 130), tile84 }, + { new Color(154, 15, 85), tile85 }, + { new Color(70, 84, 229), tile86 }, + { new Color(100, 117, 213), tile87 }, + { new Color(53, 8, 122), tile88 }, + { new Color(140, 123, 61), tile89 }, + { new Color(53, 22, 164), tile90 }, + { new Color(28, 129, 88), tile91 }, + { new Color(181, 86, 78), tile92 }, + { new Color(119, 184, 176), tile93 }, + { new Color(142, 193, 19), tile94 }, + { new Color(212, 14, 131), tile95 }, + { new Color(170, 199, 43), tile96 }, + { new Color(186, 243, 186), tile97 }, + { new Color(230, 40, 158), tile98 }, + { new Color(205, 102, 4), tile99 }, + { new Color(88, 47, 30), tile100 }, + { new Color(129, 101, 231), tile101 }, + { new Color(4, 230, 122), tile102 }, + { new Color(41, 229, 185), tile103 }, + { new Color(7, 207, 155), tile104 }, + { new Color(52, 214, 180), tile105 }, + { new Color(193, 97, 250), tile106 }, + { new Color(247, 225, 179), tile107 }, + { new Color(17, 122, 34), tile108 }, + { new Color(234, 54, 89), tile109 }, + { new Color(186, 231, 239), tile110 }, + { new Color(73, 31, 136), tile111 }, + { new Color(145, 13, 91), tile112 }, + { new Color(44, 207, 39), tile113 }, + { new Color(9, 129, 225), tile114 }, + { new Color(113, 179, 36), tile115 }, + { new Color(30, 177, 81), tile116 }, + { new Color(234, 12, 5), tile117 }, + { new Color(10, 97, 77), tile118 }, + { new Color(106, 111, 235), tile119 }, + { new Color(196, 26, 175), tile120 }, + { new Color(32, 111, 253), tile121 }, + { new Color(202, 189, 175), tile122 }, + { new Color(19, 163, 201), tile123 }, + { new Color(89, 148, 145), tile124 }, + { new Color(210, 238, 96), tile125 }, + { new Color(210, 160, 198), tile126 }, + { new Color(253, 203, 133), tile127 }, + { new Color(7, 208, 218), tile128 }, + { new Color(234, 63, 190), tile129 }, + { new Color(58, 38, 158), tile130 }, + { new Color(111, 104, 181), tile131 }, + { new Color(119, 232, 18), tile132 }, + { new Color(227, 167, 245), tile133 }, + { new Color(116, 11, 13), tile134 }, + { new Color(136, 144, 120), tile135 }, + { new Color(115, 55, 115), tile136 }, + { new Color(237, 152, 206), tile137 }, + { new Color(36, 199, 78), tile138 }, + { new Color(41, 24, 158), tile139 }, + { new Color(34, 223, 126), tile140 }, + { new Color(241, 217, 125), tile141 }, + { new Color(43, 233, 44), tile142 }, + { new Color(219, 91, 5), tile143 }, + { new Color(78, 238, 249), tile144 }, + { new Color(209, 136, 192), tile145 }, + { new Color(120, 127, 63), tile146 }, + { new Color(98, 119, 7), tile147 }, + { new Color(74, 76, 141), tile148 }, + { new Color(207, 75, 161), tile149 }, + { new Color(103, 78, 207), tile150 }, + { new Color(115, 192, 200), tile151 }, + { new Color(118, 131, 49), tile152 }, + { new Color(144, 93, 167), tile153 }, + { new Color(76, 151, 220), tile154 }, + { new Color(109, 158, 170), tile155 }, + { new Color(213, 83, 62), tile156 }, + { new Color(141, 177, 153), tile157 }, + { new Color(95, 192, 104), tile158 }, + { new Color(119, 166, 140), tile159 }, + { new Color(239, 91, 158), tile160 }, + { new Color(139, 116, 12), tile161 }, + { new Color(53, 219, 45), tile162 }, + { new Color(49, 90, 5), tile163 }, + { new Color(143, 231, 34), tile164 }, + { new Color(152, 22, 223), tile165 }, + { new Color(43, 221, 174), tile166 }, + { new Color(227, 250, 247), tile167 }, + { new Color(98, 217, 156), tile168 }, + { new Color(54, 19, 0), tile169 }, + { new Color(95, 255, 220), tile170 }, + { new Color(165, 160, 1), tile171 }, + { new Color(8, 193, 34), tile172 }, + { new Color(207, 55, 195), tile173 }, + { new Color(124, 163, 249), tile174 }, + { new Color(57, 254, 201), tile175 }, + { new Color(118, 198, 169), tile176 }, + { new Color(136, 75, 201), tile177 }, + { new Color(222, 12, 97), tile178 }, + { new Color(166, 40, 155), tile179 }, + { new Color(112, 255, 199), tile180 }, + { new Color(45, 209, 90), tile181 }, + { new Color(41, 233, 71), tile182 }, + { new Color(32, 143, 85), tile183 }, + { new Color(188, 91, 165), tile184 }, + { new Color(234, 103, 86), tile185 }, + { new Color(254, 41, 219), tile186 }, + { new Color(210, 191, 77), tile187 }, + { new Color(86, 215, 180), tile188 }, + { new Color(18, 199, 148), tile189 }, + { new Color(160, 98, 152), tile190 }, + { new Color(135, 94, 56), tile191 }, + { new Color(251, 79, 210), tile192 }, + { new Color(159, 16, 21), tile193 }, + { new Color(130, 85, 54), tile194 }, + { new Color(84, 203, 239), tile195 }, + { new Color(36, 243, 165), tile196 }, + { new Color(10, 167, 255), tile197 }, + { new Color(191, 157, 63), tile198 }, + { new Color(122, 214, 250), tile199 }, + { new Color(166, 22, 33), tile200 }, + { new Color(178, 128, 45), tile201 }, + { new Color(189, 53, 252), tile202 }, + { new Color(108, 238, 23), tile203 }, + { new Color(132, 95, 25), tile204 }, + { new Color(198, 79, 105), tile205 }, + { new Color(22, 2, 11), tile206 }, + { new Color(196, 237, 212), tile207 }, + { new Color(239, 149, 186), tile208 }, + { new Color(153, 199, 193), tile209 }, + { new Color(249, 129, 121), tile210 }, + { new Color(216, 248, 249), tile211 }, + { new Color(243, 208, 213), tile212 }, + { new Color(9, 150, 150), tile213 }, + { new Color(243, 184, 4), tile214 }, + { new Color(141, 133, 72), tile215 }, + { new Color(230, 249, 77), tile216 }, + { new Color(213, 100, 211), tile217 }, + { new Color(238, 226, 40), tile218 }, + { new Color(77, 195, 234), tile219 }, + { new Color(115, 35, 109), tile220 }, + { new Color(59, 114, 109), tile221 }, + { new Color(158, 172, 102), tile222 }, + { new Color(31, 210, 127), tile223 }, + { new Color(148, 12, 107), tile224 }, + { new Color(117, 208, 53), tile225 }, + { new Color(207, 98, 16), tile226 }, + { new Color(114, 178, 205), tile227 }, + { new Color(115, 36, 28), tile228 }, + { new Color(165, 233, 22), tile229 }, + { new Color(208, 166, 13), tile230 }, + { new Color(234, 150, 115), tile231 }, + { new Color(40, 183, 69), tile232 }, + { new Color(151, 238, 217), tile233 }, + { new Color(225, 198, 39), tile234 }, + { new Color(206, 64, 87), tile235 }, + { new Color(103, 121, 17), tile236 }, + { new Color(243, 126, 96), tile237 }, + { new Color(218, 0, 112), tile238 }, + { new Color(159, 200, 78), tile239 }, + { new Color(80, 249, 194), tile240 }, + { new Color(80, 79, 43), tile241 }, + { new Color(114, 170, 118), tile242 }, + { new Color(248, 76, 25), tile243 }, + { new Color(239, 55, 116), tile244 }, + { new Color(55, 145, 236), tile245 }, + { new Color(166, 165, 227), tile246 }, + { new Color(197, 62, 112), tile247 }, + { new Color(5, 220, 40), tile248 }, + { new Color(172, 15, 149), tile249 }, + { new Color(2, 137, 238), tile250 }, + { new Color(247, 71, 245), tile251 }, + { new Color(22, 145, 119), tile252 }, + { new Color(251, 91, 150), tile253 }, + { new Color(224, 110, 44), tile254 }, + { new Color(247, 3, 70), tile255 }, + { new Color(236, 163, 111), tile256 }, + { new Color(132, 249, 35), tile257 }, + { new Color(107, 138, 186), tile258 }, + { new Color(82, 74, 114), tile259 }, + { new Color(3, 198, 155), tile260 }, + { new Color(225, 246, 195), tile261 }, + { new Color(42, 248, 240), tile262 }, + { new Color(126, 32, 0), tile263 }, + { new Color(117, 170, 73), tile264 }, + { new Color(77, 228, 207), tile265 }, + { new Color(68, 13, 217), tile266 }, + { new Color(225, 192, 107), tile267 }, + { new Color(38, 125, 143), tile268 }, + { new Color(203, 140, 188), tile269 }, + { new Color(58, 195, 70), tile270 }, + { new Color(4, 248, 148), tile271 }, + { new Color(251, 255, 119), tile272 }, + { new Color(104, 204, 11), tile273 }, + { new Color(86, 109, 130), tile274 }, + { new Color(111, 15, 78), tile275 }, + { new Color(217, 29, 166), tile276 }, + { new Color(234, 14, 60), tile277 }, + { new Color(153, 33, 6), tile278 }, + { new Color(47, 186, 121), tile279 }, + { new Color(51, 95, 108), tile280 }, + { new Color(51, 68, 93), tile281 }, + { new Color(185, 112, 178), tile282 }, + { new Color(180, 82, 229), tile283 }, + { new Color(88, 219, 65), tile284 }, + { new Color(206, 139, 82), tile285 }, + { new Color(233, 183, 110), tile286 }, + { new Color(65, 241, 110), tile287 }, + { new Color(22, 79, 181), tile288 }, + { new Color(9, 106, 214), tile289 }, + { new Color(142, 203, 69), tile290 }, + { new Color(254, 52, 109), tile291 }, + { new Color(158, 34, 41), tile292 }, + { new Color(37, 181, 158), tile293 }, + { new Color(155, 36, 203), tile294 }, + { new Color(193, 146, 50), tile295 }, + { new Color(251, 203, 150), tile296 }, + { new Color(179, 70, 3), tile297 }, + { new Color(10, 242, 109), tile298 }, + { new Color(254, 29, 244), tile299 }, + { new Color(167, 175, 5), tile300 }, + { new Color(220, 38, 134), tile301 }, + { new Color(159, 89, 166), tile302 }, + { new Color(211, 47, 104), tile303 }, + { new Color(41, 195, 1), tile304 }, + { new Color(208, 165, 204), tile305 }, + { new Color(163, 85, 189), tile306 }, + { new Color(130, 14, 159), tile307 }, + { new Color(64, 218, 133), tile308 }, + { new Color(65, 244, 66), tile309 }, + { new Color(255, 160, 5), tile310 }, + { new Color(52, 126, 6), tile311 }, + { new Color(152, 191, 254), tile312 }, + { new Color(68, 33, 56), tile313 }, + { new Color(140, 39, 155), tile314 }, + { new Color(45, 138, 130), tile315 }, + { new Color(2, 58, 77), tile316 }, + { new Color(161, 90, 199), tile317 }, + { new Color(55, 36, 161), tile318 }, + { new Color(102, 155, 75), tile319 }, + { new Color(0, 94, 101), tile320 }, + { new Color(100, 212, 143), tile321 }, + { new Color(98, 245, 69), tile322 }, + { new Color(251, 55, 229), tile323 }, + { new Color(205, 94, 52), tile324 }, + { new Color(132, 246, 230), tile325 }, + { new Color(3, 19, 80), tile326 }, + { new Color(2, 63, 185), tile327 }, + { new Color(245, 93, 69), tile328 }, + { new Color(62, 253, 89), tile329 }, + { new Color(100, 50, 36), tile330 }, + { new Color(179, 67, 194), tile331 }, + { new Color(211, 40, 83), tile332 }, + { new Color(12, 202, 149), tile333 }, + { new Color(61, 6, 2), tile334 }, + { new Color(103, 211, 252), tile335 }, + { new Color(147, 178, 45), tile336 }, + { new Color(186, 98, 136), tile337 }, + { new Color(250, 254, 31), tile338 }, + { new Color(171, 110, 118), tile339 }, + { new Color(74, 36, 247), tile340 }, + { new Color(235, 150, 5), tile341 }, + { new Color(193, 26, 26), tile342 }, + { new Color(113, 176, 206), tile343 }, + { new Color(147, 247, 72), tile344 }, + { new Color(187, 197, 56), tile345 }, + { new Color(183, 142, 138), tile346 }, + { new Color(72, 171, 74), tile347 }, + { new Color(43, 170, 207), tile348 }, + { new Color(156, 184, 69), tile349 }, + { new Color(163, 39, 185), tile350 }, + { new Color(221, 194, 165), tile351 }, + { new Color(157, 81, 112), tile352 }, + { new Color(252, 165, 185), tile353 }, + { new Color(225, 33, 1), tile354 }, + { new Color(95, 39, 107), tile355 }, + { new Color(63, 63, 56), tile356 }, + { new Color(230, 244, 224), tile357 }, + { new Color(236, 1, 121), tile358 }, + { new Color(173, 191, 236), tile359 }, + }; + return new ColorTileMap(colorTileMap); + } + } +} diff --git a/Schematics/AutoGeneratedContent/Workshop2Schematic.png b/Schematics/AutoGeneratedContent/Workshop2Schematic.png new file mode 100644 index 0000000000..b5907e5892 Binary files /dev/null and b/Schematics/AutoGeneratedContent/Workshop2Schematic.png differ diff --git a/Schematics/AutoGeneratedContent/WorkshopSchematic.cs b/Schematics/AutoGeneratedContent/WorkshopSchematic.cs new file mode 100644 index 0000000000..004198a83d --- /dev/null +++ b/Schematics/AutoGeneratedContent/WorkshopSchematic.cs @@ -0,0 +1,576 @@ +using CalamityMod.Tiles; +using CalamityMod.Tiles.FurniturePlaguedPlate; +using Microsoft.Xna.Framework; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Schematics.AutoGeneratedContent +{ + public class WorkshopSchematic + { + [GeneratedCode("ScreenCaptureToSchematic", "1.0.1")] + public static ColorTileMap GetMap() + { + var tile1 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 0, 0, 0); + var tile2 = new TileDefinitionStructure(TileID.TinPlating).UseFrame(72, 144).UseSlope(2).UseHeaders(0, 0, 0, 8224); + var tile3 = new TileDefinitionStructure(TileID.TinPlating).UseFrame(0, 36).UseHeaders(0, 16, 0, 32); + var tile4 = new TileDefinitionStructure(TileID.TinPlating).UseFrame(90, 18).UseHeaders(0, 16, 0, 32); + var tile5 = new TileDefinitionStructure(TileID.TinPlating).UseFrame(90, 0).UseHeaders(0, 16, 0, 32); + var tile6 = new TileDefinitionStructure(TileID.TinPlating).UseFrame(90, 126).UseHeaders(0, 32, 0, 32); + var tile7 = new TileDefinitionStructure(TileID.TinPlating).UseFrame(90, 36).UseHeaders(0, 0, 0, 32); + var tile8 = new TileDefinitionStructure(TileID.TinPlating).UseFrame(90, 18).UseHeaders(0, 32, 0, 32); + var tile9 = new TileDefinitionStructure(TileID.TinPlating).UseHeaders(0, 0, 0, 32); + var tile10 = new TileDefinitionStructure(TileID.TinPlating).UseFrame(0, 126).UseHeaders(0, 0, 0, 32); + var tile11 = new TileDefinitionStructure(TileID.TinPlating).UseFrame(72, 72).UseSlope(4).UseHeaders(0, 0, 0, 16416); + var tile12 = new TileDefinitionStructure(TileID.TinPlating).UseFrame(36, 0).UseHeaders(0, 32, 0, 32); + var tile13 = new TileDefinitionStructure(TileID.TinPlating).UseFrame(18, 36).UseHeaders(0, 16, 0, 32); + var tile14 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.TinPlating, 0, 108).UseHeaders(0, 0, 3, 0); + var tile15 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.TinPlating, 0, 36).UseHeaders(0, 64, 1, 0); + var tile16 = new TileDefinitionStructure(TileID.TinPlating).UseWall(WallID.TinPlating, 0, 144).UseFrame(18, 54).UseSlope(1).UseHeaders(0, 0, 4, 4128); + var tile17 = new TileDefinitionStructure(TileID.TinPlating).UseFrame(72, 18).UseHeaders(0, 16, 0, 32); + var tile18 = new TileDefinitionStructure(TileID.TinPlating).UseFrame(18, 36).UseHeaders(0, 32, 0, 32); + var tile19 = new TileDefinitionStructure(TileID.TinPlating).UseFrame(72, 54).UseSlope(2).UseHeaders(0, 0, 0, 8224); + var tile20 = new TileDefinitionStructure(TileID.TinPlating).UseFrame(36, 18).UseHeaders(0, 0, 0, 32); + var tile21 = new TileDefinitionStructure(TileID.TinPlating).UseWall(WallID.TinPlating, 144, 108).UseFrame(18, 72).UseSlope(3).UseHeaders(0, 132, 3, 12320); + var tile22 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.TinPlating, 0, 0).UseHeaders(0, 0, 0, 0); + var tile23 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.TinPlating, 0, 180).UseHeaders(0, 192, 5, 0); + var tile24 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.TinPlating, 396, 72).UseHeaders(0, 139, 2, 0); + var tile25 = new TileDefinitionStructure(TileID.FishingCrate).UseWall(WallID.TinPlating, 72, 36).UseFrame(36, 0).UseHeaders(0, 66, 1, 32); + var tile26 = new TileDefinitionStructure(TileID.FishingCrate).UseWall(WallID.TinPlating, 216, 36).UseFrame(36, 18).UseHeaders(0, 6, 1, 32); + var tile27 = new TileDefinitionStructure(TileID.Platforms).UseWall(WallID.TinPlating, 72, 216).UseFrame(54, 162).UseHeaders(0, 194, 6, 32); + var tile28 = new TileDefinitionStructure(TileID.TinPlating).UseFrame(108, 72).UseHeaders(0, 16, 0, 32); + var tile29 = new TileDefinitionStructure(TileID.TinPlating).UseFrame(18, 0).UseHeaders(0, 32, 0, 32); + var tile30 = new TileDefinitionStructure(TileID.TinPlating).UseFrame(54, 126).UseHeaders(0, 0, 0, 32); + var tile31 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.TinPlating, 36, 108).UseHeaders(0, 1, 3, 0); + var tile32 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.TinPlating, 72, 180).UseHeaders(0, 194, 5, 0); + var tile33 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.TinPlating, 144, 72).UseHeaders(0, 132, 2, 0); + var tile34 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.TinPlating, 144, 36).UseHeaders(0, 68, 1, 0); + var tile35 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.TinPlating, 36, 36).UseHeaders(0, 1, 1, 0); + var tile36 = new TileDefinitionStructure(TileID.FishingCrate).UseWall(WallID.TinPlating, 144, 180).UseFrame(54, 0).UseHeaders(0, 196, 5, 32); + var tile37 = new TileDefinitionStructure(TileID.FishingCrate).UseWall(WallID.TinPlating, 360, 72).UseFrame(54, 18).UseHeaders(0, 138, 2, 32); + var tile38 = new TileDefinitionStructure(TileID.Platforms).UseWall(WallID.TinPlating, 72, 72).UseFrame(0, 162).UseHeaders(0, 66, 2, 32); + var tile39 = new TileDefinitionStructure(TileID.TinPlating).UseFrame(144, 72).UseHeaders(0, 16, 0, 32); + var tile40 = new TileDefinitionStructure(TileID.TinPlating).UseFrame(36, 36).UseHeaders(0, 0, 0, 32); + var tile41 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32); + var tile42 = new TileDefinitionStructure(ModContent.TileType()).UseWall(WallID.TinPlating, 432, 36).UseFrame(0, 18).UseHeaders(0, 76, 1, 32); + var tile43 = new TileDefinitionStructure(TileID.SteampunkBoiler).UseWall(WallID.TinPlating, 216, 144).UseHeaders(0, 6, 4, 32); + var tile44 = new TileDefinitionStructure(TileID.SteampunkBoiler).UseFrame(0, 18).UseHeaders(0, 0, 0, 32); + var tile45 = new TileDefinitionStructure(TileID.SteampunkBoiler).UseWall(WallID.TinPlating, 36, 0).UseFrame(0, 36).UseHeaders(0, 1, 0, 32); + var tile46 = new TileDefinitionStructure(TileID.TinPlating).UseFrame(108, 72).UseHeaders(0, 0, 0, 32); + var tile47 = new TileDefinitionStructure(TileID.TinPlating).UseFrame(54, 0).UseHeaders(0, 0, 0, 32); + var tile48 = new TileDefinitionStructure(TileID.TinPlating).UseWall(WallID.TinPlating, 324, 180).UseFrame(54, 72).UseSlope(3).UseHeaders(0, 201, 5, 12320); + var tile49 = new TileDefinitionStructure(TileID.SteampunkBoiler).UseWall(WallID.TinPlating, 180, 108).UseFrame(18, 0).UseHeaders(0, 133, 3, 32); + var tile50 = new TileDefinitionStructure(TileID.SteampunkBoiler).UseWall(WallID.TinPlating, 180, 36).UseFrame(18, 18).UseHeaders(0, 69, 1, 32); + var tile51 = new TileDefinitionStructure(TileID.SteampunkBoiler).UseWall(WallID.TinPlating, 216, 36).UseFrame(18, 36).UseHeaders(0, 6, 1, 32); + var tile52 = new TileDefinitionStructure(TileID.Platforms).UseWall(WallID.TinPlating, 108, 180).UseFrame(0, 162).UseHeaders(0, 195, 5, 32); + var tile53 = new TileDefinitionStructure(TileID.Platforms).UseFrame(36, 162).UseHeaders(0, 0, 0, 32); + var tile54 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.TinPlating, 72, 0).UseHeaders(0, 66, 0, 0); + var tile55 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.TinPlating, 216, 108).UseHeaders(0, 6, 3, 0); + var tile56 = new TileDefinitionStructure(TileID.SteampunkBoiler).UseFrame(36, 0).UseHeaders(0, 0, 0, 32); + var tile57 = new TileDefinitionStructure(TileID.SteampunkBoiler).UseFrame(36, 18).UseHeaders(0, 0, 0, 32); + var tile58 = new TileDefinitionStructure(TileID.SteampunkBoiler).UseWall(WallID.TinPlating, 108, 0).UseFrame(36, 36).UseHeaders(0, 131, 0, 32); + var tile59 = new TileDefinitionStructure(TileID.Platforms).UseWall(WallID.TinPlating, 108, 144).UseFrame(0, 162).UseHeaders(0, 67, 4, 32); + var tile60 = new TileDefinitionStructure(TileID.TinPlating).UseFrame(144, 72).UseHeaders(0, 0, 0, 32); + var tile61 = new TileDefinitionStructure(TileID.Platforms).UseFrame(72, 162).UseHeaders(0, 0, 0, 32); + var tile62 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.TinPlating, 252, 144).UseHeaders(0, 71, 4, 0); + var tile63 = new TileDefinitionStructure(TileID.Platforms).UseWall(WallID.TinPlating, 216, 144).UseFrame(144, 162).UseSlope(2).UseHeaders(0, 6, 4, 8224); + var tile64 = new TileDefinitionStructure(TileID.Platforms).UseFrame(234, 162).UseHeaders(0, 0, 0, 32); + var tile65 = new TileDefinitionStructure(TileID.TinPlating).UseFrame(18, 0).UseHeaders(0, 16, 0, 32); + var tile66 = new TileDefinitionStructure(TileID.TinPlating).UseFrame(36, 72).UseSlope(4).UseHeaders(0, 16, 0, 16416); + var tile67 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32); + var tile68 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(0, 18).UseHeaders(0, 0, 0, 32); + var tile69 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(0, 36).UseHeaders(0, 0, 0, 32); + var tile70 = new TileDefinitionStructure(TileID.TinPlating).UseFrame(36, 54).UseHeaders(0, 0, 0, 32); + var tile71 = new TileDefinitionStructure(TileID.TinPlating).UseHeaders(0, 16, 0, 32); + var tile72 = new TileDefinitionStructure(TileID.TinPlating).UseFrame(0, 18).UseHeaders(0, 16, 0, 32); + var tile73 = new TileDefinitionStructure(TileID.TinPlating).UseFrame(0, 72).UseSlope(4).UseHeaders(0, 32, 0, 16416); + var tile74 = new TileDefinitionStructure(TileID.TinPlating).UseFrame(0, 54).UseHeaders(0, 32, 0, 32); + var tile75 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.TinPlating, 180, 216).UseHeaders(0, 197, 6, 0); + var tile76 = new TileDefinitionStructure(TileID.Platforms).UseFrame(144, 162).UseSlope(2).UseHeaders(0, 0, 0, 8224); + var tile77 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.TinPlating, 432, 0).UseHeaders(0, 12, 0, 0); + var tile78 = new TileDefinitionStructure(TileID.Platforms).UseFrame(180, 162).UseSlope(1).UseHeaders(0, 0, 0, 4128); + var tile79 = new TileDefinitionStructure(TileID.TinPlating).UseWall(WallID.TinPlating, 324, 72).UseFrame(18, 54).UseSlope(1).UseHeaders(0, 169, 2, 4128); + var tile80 = new TileDefinitionStructure(TileID.TinPlating).UseFrame(54, 108).UseHeaders(0, 32, 0, 32); + var tile81 = new TileDefinitionStructure(TileID.TinPlating).UseFrame(0, 54).UseSlope(2).UseHeaders(0, 32, 0, 8224); + var tile82 = new TileDefinitionStructure(TileID.TinPlating).UseFrame(54, 18).UseHeaders(0, 32, 0, 32); + var tile83 = new TileDefinitionStructure(TileID.TinPlating).UseFrame(36, 18).UseHeaders(0, 32, 0, 32); + var tile84 = new TileDefinitionStructure(TileID.TallGateOpen).UseHeaders(0, 0, 0, 32); + var tile85 = new TileDefinitionStructure(TileID.TallGateOpen).UseFrame(0, 20).UseHeaders(0, 0, 0, 32); + var tile86 = new TileDefinitionStructure(TileID.TallGateOpen).UseFrame(0, 38).UseHeaders(0, 0, 0, 32); + var tile87 = new TileDefinitionStructure(TileID.TallGateOpen).UseFrame(0, 56).UseHeaders(0, 0, 0, 32); + var tile88 = new TileDefinitionStructure(TileID.TallGateOpen).UseFrame(0, 74).UseHeaders(0, 0, 0, 32); + var tile89 = new TileDefinitionStructure(TileID.TinPlating).UseFrame(36, 18).UseHeaders(0, 16, 0, 32); + var tile90 = new TileDefinitionStructure(TileID.TinPlating).UseFrame(0, 72).UseSlope(4).UseHeaders(0, 16, 0, 16416); + var tile91 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.TinPlating, 216, 216).UseHeaders(0, 198, 6, 0); + var tile92 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.TinPlating, 252, 0).UseHeaders(0, 71, 0, 0); + var tile93 = new TileDefinitionStructure(TileID.Platforms).UseWall(WallID.TinPlating, 144, 0).UseFrame(180, 162).UseSlope(1).UseHeaders(0, 4, 0, 4128); + var tile94 = new TileDefinitionStructure(TileID.TinPlating).UseWall(WallID.TinPlating, 72, 216).UseFrame(54, 54).UseSlope(1).UseHeaders(0, 210, 6, 4128); + var tile95 = new TileDefinitionStructure(TileID.TinPlating).UseFrame(18, 18).UseHeaders(0, 32, 0, 32); + var tile96 = new TileDefinitionStructure(TileID.TinPlating).UseFrame(0, 126).UseHeaders(0, 16, 0, 32); + var tile97 = new TileDefinitionStructure(TileID.TinPlating).UseFrame(54, 18).UseHeaders(0, 16, 0, 32); + var tile98 = new TileDefinitionStructure(TileID.TinPlating).UseFrame(18, 18).UseHeaders(0, 16, 0, 32); + var tile99 = new TileDefinitionStructure(TileID.TinPlating).UseFrame(72, 126).UseHeaders(0, 16, 0, 32); + var tile100 = new TileDefinitionStructure(TileID.TinPlating).UseFrame(90, 72).UseSlope(3).UseHeaders(0, 16, 0, 12320); + var tile101 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.TinPlating, 288, 0).UseHeaders(0, 136, 0, 0); + var tile102 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.TinPlating, 180, 0).UseHeaders(0, 5, 0, 0); + var tile103 = new TileDefinitionStructure(TileID.TinPlating).UseWall(WallID.TinPlating, 144, 144).UseFrame(18, 54).UseSlope(1).UseHeaders(0, 132, 4, 4128); + var tile104 = new TileDefinitionStructure(TileID.TinPlating).UseFrame(54, 36).UseHeaders(0, 32, 0, 32); + var tile105 = new TileDefinitionStructure(TileID.TinPlating).UseFrame(108, 72).UseHeaders(0, 32, 0, 32); + var tile106 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.TinPlating, 324, 0).UseHeaders(0, 9, 0, 0); + var tile107 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32); + var tile108 = new TileDefinitionStructure(TileID.Platforms).UseWall(WallID.TinPlating, 324, 108).UseFrame(216, 162).UseHeaders(0, 9, 3, 32); + var tile109 = new TileDefinitionStructure(TileID.Platforms).UseWall(WallID.TinPlating, 432, 36).UseFrame(180, 162).UseSlope(1).UseHeaders(0, 76, 1, 4128); + var tile110 = new TileDefinitionStructure(TileID.TinPlating).UseFrame(18, 54).UseSlope(1).UseHeaders(0, 0, 0, 4128); + var tile111 = new TileDefinitionStructure(TileID.TinPlating).UseFrame(18, 18).UseHeaders(0, 0, 0, 32); + var tile112 = new TileDefinitionStructure(TileID.TinPlating).UseWall(WallID.TinPlating, 0, 108).UseFrame(18, 72).UseSlope(3).UseHeaders(0, 0, 3, 12320); + var tile113 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.TinPlating, 180, 36).UseHeaders(0, 69, 1, 0); + var tile114 = new TileDefinitionStructure(TileID.FishingCrate).UseWall(WallID.TinPlating, 432, 36).UseHeaders(0, 76, 1, 32); + var tile115 = new TileDefinitionStructure(TileID.FishingCrate).UseFrame(0, 18).UseHeaders(0, 0, 0, 32); + var tile116 = new TileDefinitionStructure(TileID.FishingCrate).UseWall(WallID.TinPlating, 72, 0).UseHeaders(0, 66, 0, 32); + var tile117 = new TileDefinitionStructure(TileID.FishingCrate).UseWall(WallID.TinPlating, 36, 72).UseFrame(0, 18).UseHeaders(0, 1, 2, 32); + var tile118 = new TileDefinitionStructure(TileID.TinPlating).UseFrame(36, 0).UseHeaders(0, 16, 0, 32); + var tile119 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.TinPlating, 36, 144).UseHeaders(0, 1, 4, 0); + var tile120 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(18, 0).UseHeaders(0, 0, 0, 32); + var tile121 = new TileDefinitionStructure(TileID.Platforms).UseFrame(0, 162).UseHeaders(0, 0, 0, 32); + var tile122 = new TileDefinitionStructure(TileID.Platforms).UseWall(WallID.TinPlating, 324, 0).UseFrame(180, 162).UseSlope(1).UseHeaders(0, 9, 0, 4128); + var tile123 = new TileDefinitionStructure(TileID.TinPlating).UseWall(WallID.TinPlating, 72, 108).UseFrame(90, 162).UseSlope(3).UseHeaders(0, 66, 3, 12320); + var tile124 = new TileDefinitionStructure(TileID.FishingCrate).UseFrame(18, 0).UseHeaders(0, 0, 0, 32); + var tile125 = new TileDefinitionStructure(TileID.FishingCrate).UseFrame(18, 18).UseHeaders(0, 0, 0, 32); + var tile126 = new TileDefinitionStructure(TileID.FishingCrate).UseWall(WallID.TinPlating, 72, 0).UseFrame(18, 0).UseHeaders(0, 66, 0, 32); + var tile127 = new TileDefinitionStructure(TileID.FishingCrate).UseWall(WallID.TinPlating, 36, 72).UseFrame(18, 18).UseHeaders(0, 1, 2, 32); + var tile128 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.TinPlating, 0, 144).UseHeaders(0, 0, 4, 0); + var tile129 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.TinPlating, 108, 0).UseHeaders(0, 131, 0, 0); + var tile130 = new TileDefinitionStructure(TileID.Platforms).UseWall(WallID.TinPlating, 72, 144).UseFrame(180, 162).UseSlope(1).UseHeaders(0, 66, 4, 4128); + var tile131 = new TileDefinitionStructure(TileID.TinPlating).UseFrame(144, 72).UseHeaders(0, 32, 0, 32); + var tile132 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.TinPlating, 216, 0).UseHeaders(0, 6, 0, 0); + var tile133 = new TileDefinitionStructure(TileID.FishingCrate).UseWall(WallID.TinPlating, 360, 180).UseHeaders(0, 202, 5, 32); + var tile134 = new TileDefinitionStructure(TileID.FishingCrate).UseWall(WallID.TinPlating, 180, 144).UseFrame(0, 18).UseHeaders(0, 133, 4, 32); + var tile135 = new TileDefinitionStructure(TileID.TinPlating).UseFrame(54, 90).UseHeaders(0, 16, 0, 32); + var tile136 = new TileDefinitionStructure(TileID.TinPlating).UseFrame(54, 36).UseHeaders(0, 16, 0, 32); + var tile137 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.TinPlating, 144, 0).UseHeaders(0, 4, 0, 0); + var tile138 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.TinPlating, 252, 108).UseHeaders(0, 71, 3, 0); + var tile139 = new TileDefinitionStructure(ModContent.TileType()).UseWall(WallID.TinPlating, 360, 108).UseFrame(18, 0).UseHeaders(0, 74, 3, 32); + var tile140 = new TileDefinitionStructure(TileID.TinkerersWorkbench).UseWall(WallID.TinPlating, 36, 108).UseHeaders(0, 1, 3, 32); + var tile141 = new TileDefinitionStructure(TileID.TinkerersWorkbench).UseWall(WallID.TinPlating, 252, 72).UseFrame(0, 18).UseHeaders(0, 71, 2, 32); + var tile142 = new TileDefinitionStructure(TileID.TinPlating).UseWall(WallID.TinPlating, 0, 0).UseFrame(216, 0).UseHeaders(0, 0, 0, 32); + var tile143 = new TileDefinitionStructure(ModContent.TileType()).UseWall(WallID.TinPlating, 72, 72).UseHeaders(0, 66, 2, 32); + var tile144 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(0, 18).UseHeaders(0, 0, 0, 32); + var tile145 = new TileDefinitionStructure(TileID.FishingCrate).UseWall(WallID.TinPlating, 252, 144).UseFrame(18, 0).UseHeaders(0, 71, 4, 32); + var tile146 = new TileDefinitionStructure(TileID.TinPlating).UseFrame(36, 0).UseHeaders(0, 0, 0, 32); + var tile147 = new TileDefinitionStructure(TileID.TinkerersWorkbench).UseFrame(18, 0).UseHeaders(0, 0, 0, 32); + var tile148 = new TileDefinitionStructure(TileID.TinkerersWorkbench).UseWall(WallID.TinPlating, 36, 216).UseFrame(18, 18).UseHeaders(0, 193, 6, 32); + var tile149 = new TileDefinitionStructure(TileID.Platforms).UseWall(WallID.TinPlating, 144, 72).UseFrame(54, 162).UseHeaders(0, 132, 2, 32); + var tile150 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.TinPlating, 108, 144).UseHeaders(0, 67, 4, 0); + var tile151 = new TileDefinitionStructure(TileID.Solidifier).UseHeaders(0, 0, 0, 32); + var tile152 = new TileDefinitionStructure(TileID.Solidifier).UseWall(WallID.TinPlating, 432, 36).UseFrame(0, 18).UseHeaders(0, 76, 1, 32); + var tile153 = new TileDefinitionStructure(TileID.Solidifier).UseFrame(0, 36).UseHeaders(0, 0, 0, 32); + var tile154 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.TinPlating, 324, 36).UseHeaders(0, 73, 1, 0); + var tile155 = new TileDefinitionStructure(TileID.TinkerersWorkbench).UseFrame(36, 0).UseHeaders(0, 0, 0, 32); + var tile156 = new TileDefinitionStructure(TileID.TinkerersWorkbench).UseFrame(36, 18).UseHeaders(0, 0, 0, 32); + var tile157 = new TileDefinitionStructure(TileID.Solidifier).UseFrame(18, 0).UseHeaders(0, 0, 0, 32); + var tile158 = new TileDefinitionStructure(TileID.Solidifier).UseFrame(18, 18).UseHeaders(0, 0, 0, 32); + var tile159 = new TileDefinitionStructure(TileID.Solidifier).UseFrame(18, 36).UseHeaders(0, 0, 0, 32); + var tile160 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32); + var tile161 = new TileDefinitionStructure(ModContent.TileType()).UseWall(WallID.TinPlating, 432, 36).UseFrame(0, 18).UseHeaders(0, 76, 1, 32); + var tile162 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.TinPlating, 324, 108).UseHeaders(0, 9, 3, 0); + var tile163 = new TileDefinitionStructure(TileID.Platforms).UseWall(WallID.TinPlating, 324, 0).UseFrame(0, 162).UseHeaders(0, 9, 0, 32); + var tile164 = new TileDefinitionStructure(TileID.Solidifier).UseFrame(36, 0).UseHeaders(0, 0, 0, 32); + var tile165 = new TileDefinitionStructure(TileID.Solidifier).UseWall(WallID.TinPlating, 252, 0).UseFrame(36, 18).UseHeaders(0, 71, 0, 32); + var tile166 = new TileDefinitionStructure(TileID.Solidifier).UseWall(WallID.TinPlating, 0, 144).UseFrame(36, 36).UseHeaders(0, 0, 4, 32); + var tile167 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.TinPlating, 36, 216).UseHeaders(0, 193, 6, 0); + var tile168 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.TinPlating, 144, 144).UseHeaders(0, 132, 4, 0); + var tile169 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(18, 0).UseHeaders(0, 0, 0, 32); + var tile170 = new TileDefinitionStructure(ModContent.TileType()).UseFrame(18, 18).UseHeaders(0, 0, 0, 32); + var tile171 = new TileDefinitionStructure(ModContent.TileType()).UseWall(WallID.TinPlating, 0, 216).UseHeaders(0, 192, 6, 32); + var tile172 = new TileDefinitionStructure(TileID.Platforms).UseWall(WallID.TinPlating, 288, 36).UseFrame(0, 162).UseHeaders(0, 136, 1, 32); + var tile173 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.TinPlating, 72, 144).UseHeaders(0, 66, 4, 0); + var tile174 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.TinPlating, 216, 144).UseHeaders(0, 6, 4, 0); + var tile175 = new TileDefinitionStructure(TileID.TinPlating).UseFrame(18, 36).UseHeaders(0, 0, 0, 32); + var tile176 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.TinPlating, 144, 216).UseHeaders(0, 196, 6, 0); + var tile177 = new TileDefinitionStructure(TileID.FishingCrate).UseFrame(36, 0).UseHeaders(0, 0, 0, 32); + var tile178 = new TileDefinitionStructure(TileID.FishingCrate).UseFrame(36, 18).UseHeaders(0, 0, 0, 32); + var tile179 = new TileDefinitionStructure(ModContent.TileType()).UseWall(WallID.TinPlating, 108, 108).UseFrame(18, 0).UseHeaders(0, 67, 3, 32); + var tile180 = new TileDefinitionStructure(TileID.Platforms).UseWall(WallID.TinPlating, 360, 0).UseFrame(0, 162).UseHeaders(0, 10, 0, 32); + var tile181 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.TinPlating, 108, 180).UseHeaders(0, 195, 5, 0); + var tile182 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.TinPlating, 288, 144).UseHeaders(0, 136, 4, 0); + var tile183 = new TileDefinitionStructure(TileID.TinPlating).UseFrame(54, 90).UseHeaders(0, 0, 0, 32); + var tile184 = new TileDefinitionStructure(TileID.FishingCrate).UseFrame(54, 0).UseHeaders(0, 0, 0, 32); + var tile185 = new TileDefinitionStructure(TileID.FishingCrate).UseFrame(54, 18).UseHeaders(0, 0, 0, 32); + var tile186 = new TileDefinitionStructure(TileID.FishingCrate).UseWall(WallID.TinPlating, 324, 0).UseFrame(54, 18).UseHeaders(0, 9, 0, 32); + var tile187 = new TileDefinitionStructure(TileID.Platforms).UseWall(WallID.TinPlating, 36, 0).UseFrame(72, 162).UseHeaders(0, 1, 0, 32); + var tile188 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.TinPlating, 72, 72).UseHeaders(0, 66, 2, 0); + var tile189 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.TinPlating, 36, 72).UseHeaders(0, 1, 2, 0); + var tile190 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.TinPlating, 360, 108).UseHeaders(0, 74, 3, 0); + var tile191 = new TileDefinitionStructure(TileID.Anvils).UseFrame(36, 0).UseHeaders(0, 0, 0, 32); + var tile192 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.TinPlating, 72, 108).UseHeaders(0, 66, 3, 0); + var tile193 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.TinPlating, 396, 0).UseHeaders(0, 11, 0, 0); + var tile194 = new TileDefinitionStructure(ModContent.TileType()).UseWall(WallID.TinPlating, 0, 180).UseFrame(18, 0).UseHeaders(0, 192, 5, 32); + var tile195 = new TileDefinitionStructure(TileID.TinPlating).UseWall(WallID.TinPlating, 288, 36).UseFrame(162, 0).UseHeaders(0, 152, 1, 32); + var tile196 = new TileDefinitionStructure(TileID.FishingCrate).UseHeaders(0, 0, 0, 32); + var tile197 = new TileDefinitionStructure(TileID.FishingCrate).UseWall(WallID.TinPlating, 216, 144).UseFrame(0, 18).UseHeaders(0, 6, 4, 32); + var tile198 = new TileDefinitionStructure(TileID.Anvils).UseFrame(54, 0).UseHeaders(0, 0, 0, 32); + var tile199 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.TinPlating, 432, 180).UseHeaders(0, 204, 5, 0); + var tile200 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.TinPlating, 144, 180).UseHeaders(0, 196, 5, 0); + var tile201 = new TileDefinitionStructure(TileID.Platforms).UseWall(WallID.TinPlating, 72, 36).UseFrame(144, 162).UseSlope(2).UseHeaders(0, 66, 1, 8224); + var tile202 = new TileDefinitionStructure(TileID.TinPlating).UseWall(WallID.TinPlating, 360, 0).UseFrame(144, 72).UseHeaders(0, 26, 0, 32); + var tile203 = new TileDefinitionStructure(TileID.FishingCrate).UseWall(WallID.TinPlating, 0, 108).UseFrame(54, 18).UseHeaders(0, 0, 3, 32); + var tile204 = new TileDefinitionStructure(TileID.FishingCrate).UseWall(WallID.TinPlating, 0, 180).UseFrame(18, 0).UseHeaders(0, 192, 5, 32); + var tile205 = new TileDefinitionStructure(TileID.FishingCrate).UseWall(WallID.TinPlating, 108, 72).UseFrame(18, 18).UseHeaders(0, 131, 2, 32); + var tile206 = new TileDefinitionStructure(TileID.TinPlating).UseFrame(54, 90).UseHeaders(0, 32, 0, 32); + var tile207 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.TinPlating, 72, 36).UseHeaders(0, 66, 1, 0); + var tile208 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.TinPlating, 108, 108).UseHeaders(0, 67, 3, 0); + var tile209 = new TileDefinitionStructure(TileID.TinPlating).UseWall(WallID.TinPlating, 144, 0).UseFrame(18, 0).UseHeaders(0, 36, 0, 32); + var tile210 = new TileDefinitionStructure(TileID.TinPlating).UseWall(WallID.TinPlating, 144, 36).UseFrame(36, 72).UseSlope(4).UseHeaders(0, 68, 1, 16416); + var tile211 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.TinPlating, 216, 72).UseHeaders(0, 6, 2, 0); + var tile212 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.TinPlating, 288, 36).UseHeaders(0, 136, 1, 0); + var tile213 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.TinPlating, 216, 36).UseHeaders(0, 6, 1, 0); + var tile214 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.TinPlating, 396, 180).UseHeaders(0, 203, 5, 0); + var tile215 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.TinPlating, 108, 36).UseHeaders(0, 131, 1, 0); + var tile216 = new TileDefinitionStructure(TileID.Platforms).UseWall(WallID.TinPlating, 0, 36).UseFrame(144, 162).UseSlope(2).UseHeaders(0, 64, 1, 8224); + var tile217 = new TileDefinitionStructure(TileID.TinPlating).UseWall(WallID.TinPlating, 216, 108).UseFrame(72, 54).UseSlope(2).UseHeaders(0, 38, 3, 8224); + var tile218 = new TileDefinitionStructure(TileID.TinPlating).UseFrame(0, 18).UseHeaders(0, 32, 0, 32); + var tile219 = new TileDefinitionStructure(TileID.TinPlating).UseFrame(54, 108).UseHeaders(0, 16, 0, 32); + var tile220 = new TileDefinitionStructure(TileID.TinPlating).UseWall(WallID.TinPlating, 36, 108).UseFrame(72, 72).UseSlope(4).UseHeaders(0, 17, 3, 16416); + var tile221 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.TinPlating, 180, 180).UseHeaders(0, 197, 5, 0); + var tile222 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.TinPlating, 108, 72).UseHeaders(0, 131, 2, 0); + var tile223 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.TinPlating, 252, 36).UseHeaders(0, 71, 1, 0); + var tile224 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.TinPlating, 360, 0).UseHeaders(0, 10, 0, 0); + var tile225 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.TinPlating, 360, 72).UseHeaders(0, 138, 2, 0); + var tile226 = new TileDefinitionStructure(TileID.Platforms).UseWall(WallID.TinPlating, 36, 36).UseFrame(144, 162).UseSlope(2).UseHeaders(0, 1, 1, 8224); + var tile227 = new TileDefinitionStructure(TileID.TinPlating).UseWall(WallID.TinPlating, 108, 216).UseFrame(36, 54).UseSlope(2).UseHeaders(0, 227, 6, 8224); + var tile228 = new TileDefinitionStructure(TileID.TinPlating).UseFrame(72, 126).UseHeaders(0, 0, 0, 32); + var tile229 = new TileDefinitionStructure(TileID.TinPlating).UseWall(WallID.TinPlating, 36, 108).UseFrame(72, 72).UseSlope(4).UseHeaders(0, 33, 3, 16416); + var tile230 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.TinPlating, 288, 108).UseHeaders(0, 136, 3, 0); + var tile231 = new TileDefinitionStructure(TileID.TinPlating).UseWall(WallID.TinPlating, 180, 144).UseFrame(0, 54).UseSlope(2).UseHeaders(0, 133, 4, 8224); + var tile232 = new TileDefinitionStructure(TileID.TinPlating).UseFrame(54, 108).UseHeaders(0, 0, 0, 32); + var tile233 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.TinPlating, 36, 0).UseHeaders(0, 1, 0, 0); + var tile234 = new TileDefinitionStructure(TileID.TinPlating).UseWall(WallID.TinPlating, 36, 144).UseFrame(0, 54).UseSlope(2).UseHeaders(0, 33, 4, 8224); + var tile235 = new TileDefinitionStructure(TileID.TinPlating).UseFrame(18, 72).UseSlope(3).UseHeaders(0, 32, 0, 12320); + var tile236 = new TileDefinitionStructure(TileID.TinPlating).UseFrame(18, 54).UseSlope(1).UseHeaders(0, 16, 0, 4128); + var tile237 = new TileDefinitionStructure(TileID.TallGateClosed).UseHeaders(0, 0, 0, 32); + var tile238 = new TileDefinitionStructure(TileID.TallGateClosed).UseFrame(0, 20).UseHeaders(0, 0, 0, 32); + var tile239 = new TileDefinitionStructure(TileID.TallGateClosed).UseFrame(0, 38).UseHeaders(0, 0, 0, 32); + var tile240 = new TileDefinitionStructure(TileID.TallGateClosed).UseFrame(0, 56).UseHeaders(0, 0, 0, 32); + var tile241 = new TileDefinitionStructure(TileID.TallGateClosed).UseFrame(0, 74).UseHeaders(0, 0, 0, 32); + var tile242 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.TinPlating, 396, 108).UseHeaders(0, 139, 3, 0); + var tile243 = new TileDefinitionStructure(TileID.Platforms).UseWall(WallID.TinPlating, 36, 0).UseFrame(180, 162).UseSlope(1).UseHeaders(0, 1, 0, 4128); + var tile244 = new TileDefinitionStructure(TileID.Platforms).UseWall(WallID.TinPlating, 108, 180).UseFrame(216, 162).UseHeaders(0, 195, 5, 32); + var tile245 = new TileDefinitionStructure(TileID.TinPlating).UseFrame(90, 162).UseSlope(3).UseHeaders(0, 0, 0, 12320); + var tile246 = new TileDefinitionStructure(TileID.TinPlating).UseFrame(90, 144).UseHeaders(0, 0, 0, 32); + var tile247 = new TileDefinitionStructure(TileID.TinPlating).UseFrame(72, 36).UseHeaders(0, 0, 0, 32); + var tile248 = new TileDefinitionStructure(TileID.TinPlating).UseFrame(72, 18).UseHeaders(0, 32, 0, 32); + var tile249 = new TileDefinitionStructure(TileID.TinPlating).UseFrame(18, 72).UseSlope(3).UseHeaders(0, 0, 0, 12320); + var tile250 = new TileDefinitionStructure(TileID.TinPlating).UseFrame(90, 54).UseHeaders(0, 16, 0, 32); + var tile251 = new TileDefinitionStructure(TileID.TinPlating).UseFrame(54, 72).UseSlope(3).UseHeaders(0, 16, 0, 12320); + var tile252 = new TileDefinitionStructure(TileID.Dirt, false).UseWall(WallID.TinPlating, 0, 216).UseHeaders(0, 192, 6, 0); + var tile253 = new TileDefinitionStructure(TileID.Platforms).UseFrame(54, 162).UseHeaders(0, 0, 0, 32); + var tile254 = new TileDefinitionStructure(TileID.TinPlating).UseWall(WallID.TinPlating, 108, 108).UseFrame(36, 72).UseSlope(4).UseHeaders(0, 99, 3, 16416); + var tile255 = new TileDefinitionStructure(TileID.HeavyWorkBench).UseWall(WallID.TinPlating, 0, 108).UseHeaders(0, 0, 3, 32); + var tile256 = new TileDefinitionStructure(TileID.HeavyWorkBench).UseWall(WallID.TinPlating, 252, 72).UseFrame(0, 18).UseHeaders(0, 71, 2, 32); + var tile257 = new TileDefinitionStructure(TileID.HeavyWorkBench).UseWall(WallID.TinPlating, 36, 36).UseFrame(0, 36).UseHeaders(0, 1, 1, 32); + var tile258 = new TileDefinitionStructure(TileID.Platforms).UseFrame(18, 162).UseHeaders(0, 0, 0, 32); + var tile259 = new TileDefinitionStructure(TileID.TinPlating).UseFrame(54, 0).UseHeaders(0, 32, 0, 32); + var tile260 = new TileDefinitionStructure(ModContent.TileType()).UseWall(WallID.TinPlating, 108, 0).UseHeaders(0, 131, 0, 32); + var tile261 = new TileDefinitionStructure(ModContent.TileType()).UseWall(WallID.TinPlating, 72, 72).UseFrame(0, 18).UseHeaders(0, 66, 2, 32); + var tile262 = new TileDefinitionStructure(TileID.HeavyWorkBench).UseWall(WallID.TinPlating, 108, 0).UseFrame(18, 0).UseHeaders(0, 131, 0, 32); + var tile263 = new TileDefinitionStructure(TileID.HeavyWorkBench).UseWall(WallID.TinPlating, 144, 36).UseFrame(18, 18).UseHeaders(0, 68, 1, 32); + var tile264 = new TileDefinitionStructure(TileID.HeavyWorkBench).UseWall(WallID.TinPlating, 216, 36).UseFrame(18, 36).UseHeaders(0, 6, 1, 32); + var tile265 = new TileDefinitionStructure(TileID.TinPlating).UseFrame(54, 126).UseHeaders(0, 16, 0, 32); + var tile266 = new TileDefinitionStructure(TileID.HeavyWorkBench).UseWall(WallID.TinPlating, 216, 144).UseFrame(36, 0).UseHeaders(0, 6, 4, 32); + var tile267 = new TileDefinitionStructure(TileID.HeavyWorkBench).UseFrame(36, 18).UseHeaders(0, 0, 0, 32); + var tile268 = new TileDefinitionStructure(TileID.HeavyWorkBench).UseWall(WallID.TinPlating, 108, 0).UseFrame(36, 36).UseHeaders(0, 131, 0, 32); + var tile269 = new TileDefinitionStructure(TileID.TinPlating).UseWall(WallID.TinPlating, 36, 108).UseFrame(0, 72).UseSlope(4).UseHeaders(0, 1, 3, 16416); + var tile270 = new TileDefinitionStructure(TileID.Platforms).UseWall(WallID.TinPlating, 108, 144).UseFrame(72, 162).UseHeaders(0, 67, 4, 32); + var tile271 = new TileDefinitionStructure(TileID.TinPlating).UseWall(WallID.TinPlating, 36, 144).UseFrame(72, 54).UseSlope(2).UseHeaders(0, 33, 4, 8224); + var tile272 = new TileDefinitionStructure(TileID.TinPlating).UseFrame(90, 144).UseSlope(1).UseHeaders(0, 0, 0, 4128); + var tile273 = new TileDefinitionStructure(TileID.TinPlating).UseFrame(90, 0).UseHeaders(0, 0, 0, 32); + var tile274 = new TileDefinitionStructure(TileID.TinPlating).UseFrame(90, 126).UseHeaders(0, 0, 0, 32); + var tile275 = new TileDefinitionStructure(TileID.TinPlating).UseFrame(90, 36).UseHeaders(0, 16, 0, 32); + var tile276 = new TileDefinitionStructure(TileID.TinPlating).UseFrame(90, 18).UseHeaders(0, 0, 0, 32); + var tile277 = new TileDefinitionStructure(TileID.TinPlating).UseFrame(72, 0).UseHeaders(0, 0, 0, 32); + Dictionary colorTileMap = new Dictionary() + { + { new Color(255, 255, 255), tile1}, + { new Color(152, 63, 155), tile2}, + { new Color(99, 69, 55), tile3}, + { new Color(184, 180, 156), tile4}, + { new Color(8, 157, 200), tile5}, + { new Color(123, 132, 180), tile6}, + { new Color(64, 68, 245), tile7}, + { new Color(65, 235, 135), tile8}, + { new Color(7, 39, 173), tile9}, + { new Color(69, 72, 148), tile10}, + { new Color(174, 138, 19), tile11}, + { new Color(187, 13, 135), tile12}, + { new Color(243, 207, 22), tile13}, + { new Color(26, 87, 82), tile14}, + { new Color(24, 83, 115), tile15}, + { new Color(134, 60, 66), tile16}, + { new Color(110, 114, 158), tile17}, + { new Color(170, 31, 238), tile18}, + { new Color(249, 116, 249), tile19}, + { new Color(248, 145, 23), tile20}, + { new Color(238, 30, 253), tile21}, + { new Color(162, 9, 42), tile22}, + { new Color(136, 77, 143), tile23}, + { new Color(64, 136, 181), tile24}, + { new Color(158, 38, 237), tile25}, + { new Color(162, 40, 151), tile26}, + { new Color(20, 128, 235), tile27}, + { new Color(106, 214, 213), tile28}, + { new Color(246, 3, 106), tile29}, + { new Color(36, 193, 153), tile30}, + { new Color(142, 251, 61), tile31}, + { new Color(254, 44, 56), tile32}, + { new Color(85, 117, 74), tile33}, + { new Color(73, 253, 239), tile34}, + { new Color(178, 45, 234), tile35}, + { new Color(232, 12, 249), tile36}, + { new Color(0, 86, 75), tile37}, + { new Color(97, 228, 16), tile38}, + { new Color(44, 131, 71), tile39}, + { new Color(39, 172, 6), tile40}, + { new Color(191, 99, 139), tile41}, + { new Color(246, 178, 140), tile42}, + { new Color(119, 160, 249), tile43}, + { new Color(180, 77, 178), tile44}, + { new Color(77, 202, 130), tile45}, + { new Color(251, 183, 169), tile46}, + { new Color(235, 13, 246), tile47}, + { new Color(113, 36, 106), tile48}, + { new Color(78, 44, 23), tile49}, + { new Color(44, 209, 168), tile50}, + { new Color(241, 46, 201), tile51}, + { new Color(67, 138, 154), tile52}, + { new Color(99, 188, 122), tile53}, + { new Color(93, 113, 108), tile54}, + { new Color(255, 76, 9), tile55}, + { new Color(152, 19, 25), tile56}, + { new Color(142, 48, 203), tile57}, + { new Color(158, 59, 158), tile58}, + { new Color(15, 78, 63), tile59}, + { new Color(32, 168, 133), tile60}, + { new Color(117, 74, 206), tile61}, + { new Color(81, 195, 30), tile62}, + { new Color(233, 9, 64), tile63}, + { new Color(232, 151, 251), tile64}, + { new Color(46, 142, 156), tile65}, + { new Color(138, 113, 215), tile66}, + { new Color(97, 181, 24), tile67}, + { new Color(253, 158, 160), tile68}, + { new Color(220, 83, 242), tile69}, + { new Color(42, 52, 60), tile70}, + { new Color(90, 67, 20), tile71}, + { new Color(245, 231, 38), tile72}, + { new Color(158, 174, 136), tile73}, + { new Color(234, 175, 10), tile74}, + { new Color(217, 165, 153), tile75}, + { new Color(208, 111, 173), tile76}, + { new Color(2, 133, 220), tile77}, + { new Color(103, 191, 242), tile78}, + { new Color(108, 119, 171), tile79}, + { new Color(45, 116, 112), tile80}, + { new Color(44, 190, 212), tile81}, + { new Color(4, 142, 84), tile82}, + { new Color(230, 57, 166), tile83}, + { new Color(117, 235, 195), tile84}, + { new Color(79, 118, 6), tile85}, + { new Color(14, 36, 248), tile86}, + { new Color(7, 12, 227), tile87}, + { new Color(68, 40, 175), tile88}, + { new Color(95, 242, 131), tile89}, + { new Color(34, 136, 111), tile90}, + { new Color(122, 112, 57), tile91}, + { new Color(24, 190, 240), tile92}, + { new Color(53, 212, 23), tile93}, + { new Color(68, 233, 54), tile94}, + { new Color(7, 140, 153), tile95}, + { new Color(25, 24, 72), tile96}, + { new Color(235, 94, 83), tile97}, + { new Color(179, 37, 104), tile98}, + { new Color(140, 231, 150), tile99}, + { new Color(37, 164, 155), tile100}, + { new Color(208, 196, 176), tile101}, + { new Color(54, 251, 123), tile102}, + { new Color(137, 54, 184), tile103}, + { new Color(22, 217, 80), tile104}, + { new Color(224, 195, 34), tile105}, + { new Color(172, 61, 155), tile106}, + { new Color(22, 70, 217), tile107}, + { new Color(59, 54, 42), tile108}, + { new Color(28, 199, 74), tile109}, + { new Color(209, 139, 214), tile110}, + { new Color(89, 15, 47), tile111}, + { new Color(124, 115, 37), tile112}, + { new Color(133, 208, 145), tile113}, + { new Color(29, 143, 226), tile114}, + { new Color(144, 213, 133), tile115}, + { new Color(2, 210, 98), tile116}, + { new Color(70, 223, 170), tile117}, + { new Color(251, 15, 94), tile118}, + { new Color(193, 149, 142), tile119}, + { new Color(134, 25, 51), tile120}, + { new Color(48, 184, 170), tile121}, + { new Color(225, 189, 201), tile122}, + { new Color(32, 100, 79), tile123}, + { new Color(253, 38, 108), tile124}, + { new Color(9, 248, 182), tile125}, + { new Color(247, 170, 97), tile126}, + { new Color(164, 25, 244), tile127}, + { new Color(232, 138, 171), tile128}, + { new Color(44, 93, 0), tile129}, + { new Color(209, 186, 221), tile130}, + { new Color(150, 255, 183), tile131}, + { new Color(94, 237, 214), tile132}, + { new Color(55, 175, 23), tile133}, + { new Color(188, 226, 110), tile134}, + { new Color(19, 73, 185), tile135}, + { new Color(61, 241, 22), tile136}, + { new Color(167, 202, 235), tile137}, + { new Color(45, 225, 255), tile138}, + { new Color(62, 72, 45), tile139}, + { new Color(254, 181, 95), tile140}, + { new Color(200, 78, 169), tile141}, + { new Color(113, 102, 39), tile142}, + { new Color(181, 171, 10), tile143}, + { new Color(223, 191, 251), tile144}, + { new Color(73, 232, 55), tile145}, + { new Color(134, 213, 65), tile146}, + { new Color(242, 238, 108), tile147}, + { new Color(233, 41, 240), tile148}, + { new Color(242, 105, 29), tile149}, + { new Color(183, 31, 165), tile150}, + { new Color(169, 57, 250), tile151}, + { new Color(184, 243, 147), tile152}, + { new Color(196, 161, 226), tile153}, + { new Color(145, 136, 69), tile154}, + { new Color(11, 199, 11), tile155}, + { new Color(239, 227, 249), tile156}, + { new Color(200, 183, 115), tile157}, + { new Color(235, 11, 198), tile158}, + { new Color(243, 222, 37), tile159}, + { new Color(185, 127, 252), tile160}, + { new Color(9, 254, 140), tile161}, + { new Color(101, 54, 134), tile162}, + { new Color(1, 145, 244), tile163}, + { new Color(163, 194, 51), tile164}, + { new Color(95, 97, 102), tile165}, + { new Color(38, 221, 97), tile166}, + { new Color(228, 2, 134), tile167}, + { new Color(36, 238, 103), tile168}, + { new Color(50, 189, 45), tile169}, + { new Color(51, 197, 21), tile170}, + { new Color(110, 10, 33), tile171}, + { new Color(230, 135, 138), tile172}, + { new Color(185, 166, 145), tile173}, + { new Color(133, 238, 82), tile174}, + { new Color(4, 36, 245), tile175}, + { new Color(63, 140, 170), tile176}, + { new Color(95, 204, 0), tile177}, + { new Color(195, 212, 124), tile178}, + { new Color(118, 229, 15), tile179}, + { new Color(36, 51, 120), tile180}, + { new Color(88, 205, 204), tile181}, + { new Color(223, 52, 183), tile182}, + { new Color(17, 121, 217), tile183}, + { new Color(220, 108, 55), tile184}, + { new Color(208, 95, 19), tile185}, + { new Color(51, 32, 202), tile186}, + { new Color(114, 243, 48), tile187}, + { new Color(130, 211, 248), tile188}, + { new Color(20, 171, 54), tile189}, + { new Color(165, 111, 162), tile190}, + { new Color(122, 148, 115), tile191}, + { new Color(24, 44, 33), tile192}, + { new Color(134, 36, 239), tile193}, + { new Color(62, 45, 19), tile194}, + { new Color(209, 131, 96), tile195}, + { new Color(201, 242, 116), tile196}, + { new Color(105, 67, 197), tile197}, + { new Color(69, 178, 64), tile198}, + { new Color(71, 214, 249), tile199}, + { new Color(211, 203, 137), tile200}, + { new Color(129, 108, 9), tile201}, + { new Color(55, 97, 215), tile202}, + { new Color(196, 184, 51), tile203}, + { new Color(242, 172, 251), tile204}, + { new Color(218, 51, 197), tile205}, + { new Color(29, 176, 80), tile206}, + { new Color(151, 75, 184), tile207}, + { new Color(193, 60, 44), tile208}, + { new Color(221, 53, 226), tile209}, + { new Color(51, 208, 85), tile210}, + { new Color(40, 178, 89), tile211}, + { new Color(102, 189, 192), tile212}, + { new Color(10, 154, 34), tile213}, + { new Color(136, 4, 58), tile214}, + { new Color(65, 118, 150), tile215}, + { new Color(201, 107, 126), tile216}, + { new Color(122, 42, 37), tile217}, + { new Color(168, 60, 127), tile218}, + { new Color(208, 191, 48), tile219}, + { new Color(221, 89, 43), tile220}, + { new Color(245, 145, 231), tile221}, + { new Color(222, 201, 250), tile222}, + { new Color(162, 115, 118), tile223}, + { new Color(5, 19, 22), tile224}, + { new Color(46, 15, 70), tile225}, + { new Color(125, 128, 197), tile226}, + { new Color(150, 19, 202), tile227}, + { new Color(99, 185, 165), tile228}, + { new Color(48, 127, 118), tile229}, + { new Color(218, 149, 253), tile230}, + { new Color(143, 44, 64), tile231}, + { new Color(246, 146, 115), tile232}, + { new Color(83, 99, 173), tile233}, + { new Color(156, 39, 247), tile234}, + { new Color(8, 116, 23), tile235}, + { new Color(15, 122, 44), tile236}, + { new Color(56, 83, 63), tile237}, + { new Color(107, 70, 69), tile238}, + { new Color(97, 146, 215), tile239}, + { new Color(65, 174, 74), tile240}, + { new Color(131, 200, 222), tile241}, + { new Color(120, 117, 230), tile242}, + { new Color(213, 55, 125), tile243}, + { new Color(211, 42, 28), tile244}, + { new Color(24, 250, 236), tile245}, + { new Color(211, 90, 68), tile246}, + { new Color(142, 32, 4), tile247}, + { new Color(73, 161, 66), tile248}, + { new Color(190, 36, 230), tile249}, + { new Color(250, 149, 255), tile250}, + { new Color(155, 17, 181), tile251}, + { new Color(98, 24, 95), tile252}, + { new Color(25, 143, 254), tile253}, + { new Color(48, 57, 66), tile254}, + { new Color(175, 101, 40), tile255}, + { new Color(34, 83, 76), tile256}, + { new Color(89, 141, 56), tile257}, + { new Color(147, 178, 141), tile258}, + { new Color(69, 57, 38), tile259}, + { new Color(155, 186, 81), tile260}, + { new Color(0, 219, 162), tile261}, + { new Color(125, 55, 25), tile262}, + { new Color(103, 181, 225), tile263}, + { new Color(141, 186, 203), tile264}, + { new Color(69, 94, 231), tile265}, + { new Color(194, 154, 59), tile266}, + { new Color(25, 155, 209), tile267}, + { new Color(153, 161, 7), tile268}, + { new Color(199, 8, 94), tile269}, + { new Color(40, 29, 222), tile270}, + { new Color(56, 125, 212), tile271}, + { new Color(173, 48, 93), tile272}, + { new Color(159, 50, 46), tile273}, + { new Color(15, 186, 158), tile274}, + { new Color(107, 204, 211), tile275}, + { new Color(108, 77, 84), tile276}, + { new Color(165, 131, 159), tile277}, + }; + return new ColorTileMap(colorTileMap); + } + } +} diff --git a/Schematics/AutoGeneratedContent/WorkshopSchematic.png b/Schematics/AutoGeneratedContent/WorkshopSchematic.png new file mode 100644 index 0000000000..8018089b8e Binary files /dev/null and b/Schematics/AutoGeneratedContent/WorkshopSchematic.png differ diff --git a/Schematics/ColorTileMap.cs b/Schematics/ColorTileMap.cs new file mode 100644 index 0000000000..f8ae2f2a43 --- /dev/null +++ b/Schematics/ColorTileMap.cs @@ -0,0 +1,16 @@ +using Microsoft.Xna.Framework; +using System.Collections.Generic; + +namespace CalamityMod.Schematics +{ + public class ColorTileMap + { + internal readonly Dictionary Map = new Dictionary(); + public ColorTileMap(Dictionary colorTileMap) + { + Map = colorTileMap; + } + // For general convenience and as a means of mitigating the key check every time. + public TileDefinitionStructure this[Color key] => Map.ContainsKey(key) ? Map[key] : TileDefinitionStructure.AirDefinition; + } +} diff --git a/Schematics/SchematicLoader.cs b/Schematics/SchematicLoader.cs new file mode 100644 index 0000000000..96cc4afed8 --- /dev/null +++ b/Schematics/SchematicLoader.cs @@ -0,0 +1,80 @@ +using CalamityMod.Schematics.AutoGeneratedContent; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Schematics +{ + public static class SchematicLoader + { + #region Fields + internal static Dictionary TileMaps = new Dictionary(); + internal static Dictionary PilePlacementMaps = new Dictionary(); + public delegate void PilePlacementFunction(int x, int y, Rectangle placeInArea); + #endregion + + #region Loading/Unloading + internal static void LoadEverything() + { + PilePlacementMaps = new Dictionary(); + TileMaps = new Dictionary + { + // Texture loading does not require a .png at the end of the path string. + ["Workshop"] = LoadSchematicCodeAndTexture(typeof(WorkshopSchematic), "Schematics/AutoGeneratedContent/WorkshopSchematic"), + ["Workshop 2"] = LoadSchematicCodeAndTexture(typeof(Workshop2Schematic), "Schematics/AutoGeneratedContent/Workshop2Schematic"), + ["Research Facility"] = LoadSchematicCodeAndTexture(typeof(ResearchFacilitySchematic), "Schematics/AutoGeneratedContent/ResearchFacilitySchematic"), + ["Research Facility 2"] = LoadSchematicCodeAndTexture(typeof(ResearchFacility2Schematic), "Schematics/AutoGeneratedContent/ResearchFacility2Schematic"), + ["Astral Beacon"] = LoadSchematicCodeAndTexture(typeof(AstralBeaconSchematic), "Schematics/AutoGeneratedContent/AstralBeaconSchematic") + }; + } + internal static void UnloadEverything() + { + TileMaps = null; + PilePlacementMaps = null; + } + #endregion + + #region Texture and Code to Tile + internal static MethodInfo SeekSchematicLoaderInType(Type toSearch) + { + // Checks if the method has a GeneratedCode attribute with a specific tool. + // This should always be the case as it is added by default with the auto-generated code. + bool isSuitableMethod(MethodInfo method) + { + GeneratedCodeAttribute generatedCodeAttribute = method.GetCustomAttribute(typeof(GeneratedCodeAttribute)) as GeneratedCodeAttribute; + + if (generatedCodeAttribute == null) + return false; + return generatedCodeAttribute.Tool.ToLower() == "screencapturetoschematic"; + } + MethodInfo[] appropriateMethodsFound = toSearch.GetMethods(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static); + MethodInfo match = appropriateMethodsFound.First(isSuitableMethod); + if (match == null) + throw new NullReferenceException($"Could not load any methods from {toSearch.FullName} that are appropriately marked to be used for schematic loading."); + return match; + } + internal static Tile[,] LoadSchematicCodeAndTexture(Type schematicType, string texturePath) + { + ColorTileMap map = (ColorTileMap)SeekSchematicLoaderInType(schematicType).Invoke(null, null); + Texture2D schemanticTexture = ModContent.GetTexture($"CalamityMod/{texturePath}"); + + Tile[,] tiles = new Tile[schemanticTexture.Width, schemanticTexture.Height]; + Color[,] colors = schemanticTexture.GetColorsFromTexture(); + for (int x = 0; x < schemanticTexture.Width; x++) + { + for (int y = 0; y < schemanticTexture.Height; y++) + { + tiles[x, y] = map[colors[x, y]].SpecifiedTile; + } + } + return tiles; + } + #endregion + } +} diff --git a/Schematics/TileDefinitionStructure.cs b/Schematics/TileDefinitionStructure.cs new file mode 100644 index 0000000000..503934a5ac --- /dev/null +++ b/Schematics/TileDefinitionStructure.cs @@ -0,0 +1,71 @@ +using System; +using Terraria; + +namespace CalamityMod.Schematics +{ + public enum LiquidState + { + Water, + Lava, + Honey + } + // This class exists to make tile creation easier when creating schematic maps. + public class TileDefinitionStructure + { + public Tile SpecifiedTile { get; private set; } = new Tile(); + public Action SpecialAction { get; private set; } = null; + public static readonly TileDefinitionStructure AirDefinition = new TileDefinitionStructure(0, false); + + // Don't remove this just because another constructor with a default argument exists. It seems the CodeDOM isn't smart enough to work with the other constructor. + public TileDefinitionStructure(int type) + { + SpecifiedTile.type = (ushort)type; + SpecifiedTile.liquid = 0; + SpecifiedTile.active(true); + } + public TileDefinitionStructure(ushort type, bool active = true) + { + SpecifiedTile.type = type; + SpecifiedTile.liquid = 0; + SpecifiedTile.active(active); + } + public TileDefinitionStructure UseWall(ushort wallType, int xFrame, int yFrame) + { + SpecifiedTile.wall = wallType; + SpecifiedTile.wallFrameX(xFrame); + SpecifiedTile.wallFrameY(yFrame); + return this; + } + public TileDefinitionStructure UseSlope(byte slope) + { + SpecifiedTile.slope(slope); + return this; + } + public TileDefinitionStructure UseFrame(short frameX, short frameY) + { + SpecifiedTile.frameX = frameX; + SpecifiedTile.frameY = frameY; + return this; + } + public TileDefinitionStructure UseHeaders(byte header1, byte header2, byte header3, ushort header4) + { + SpecifiedTile.bTileHeader = header1; + SpecifiedTile.bTileHeader2 = header2; + SpecifiedTile.bTileHeader3 = header3; + SpecifiedTile.sTileHeader = header4; + return this; + } + public TileDefinitionStructure UseLiquid(LiquidState liquidType, byte liquidAmount) + { + SpecifiedTile.liquid = liquidAmount; + SpecifiedTile.lava(liquidType == LiquidState.Lava); + SpecifiedTile.honey(liquidType == LiquidState.Honey); + return this; + } + public TileDefinitionStructure MakeActuated() + { + SpecifiedTile.inActive(true); + return this; + } + } +} diff --git a/Schematics/TilePlacementHelpers.cs b/Schematics/TilePlacementHelpers.cs new file mode 100644 index 0000000000..55c481437f --- /dev/null +++ b/Schematics/TilePlacementHelpers.cs @@ -0,0 +1,125 @@ +using CalamityMod.TileEntities; +using CalamityMod.Tiles; +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using static CalamityMod.Schematics.SchematicLoader; + +namespace CalamityMod.Schematics +{ + public static class SchematicPlacementHelpers + { + public enum PlacementAnchorType + { + TopLeft, + TopRight, + Center, + BottomLeft, + BottomRight, + } + internal static void HandleNullTile(ref Tile tile) + { + ushort wall = tile.wall; + tile = new Tile + { + wall = wall + }; + } + public static void PlaceStructure(string mapKey, Point placementPosition, PlacementAnchorType placementAnchor, Action chestInteraction = null, bool preserveWalls = true) + { + PilePlacementMaps.TryGetValue(mapKey, out PilePlacementFunction pilePlacementFunction); + Tile[,] tiles = TileMaps[mapKey]; + ushort[,] oldWalls = new ushort[tiles.GetLength(0), tiles.GetLength(1)]; + int xOffset = placementPosition.X; + int yOffset = placementPosition.Y; + // Top-left is the default for terraria. There is no need to include it in this switch. + switch (placementAnchor) + { + case PlacementAnchorType.TopRight: + xOffset += tiles.GetLength(0); + break; + case PlacementAnchorType.Center: + xOffset += tiles.GetLength(0) / 2; + yOffset += tiles.GetLength(1) / 2; + break; + case PlacementAnchorType.BottomLeft: + yOffset += tiles.GetLength(1); + break; + case PlacementAnchorType.BottomRight: + xOffset += tiles.GetLength(0); + yOffset += tiles.GetLength(1); + break; + } + oldWalls = new ushort[tiles.GetLength(0), tiles.GetLength(1)]; + for (int x = 0; x < tiles.GetLength(0); x++) + { + for (int y = 0; y < tiles.GetLength(1); y++) + { + Tile tile = Main.tile[x + xOffset, y + yOffset]; + oldWalls[x, y] = tile.wall; + + // Attempting to break chests causes the game to attempt to infinitely recurse in an attempt to break the tile, resulting in a stack overflow. + if (tile.type == TileID.Containers) + continue; + WorldGen.KillTile(x + xOffset, y + yOffset); + } + } + for (int x = 0; x < tiles.GetLength(0); x++) + { + for (int y = 0; y < tiles.GetLength(1); y++) + { + if (WorldGen.InWorld(x + xOffset, y + yOffset)) + { + var modTile = TileLoader.GetTile(tiles[x, y].type); + bool isChest = tiles[x, y].type == TileID.Containers || (modTile != null && modTile.chest != ""); + + // If the determined tile type is a chest, define it appropriately. + if (isChest) + { + if (tiles[x, y].frameX == 0 && tiles[x, y].frameY == 0) + { + Chest chest = PlaceChest(x + xOffset, y + yOffset, tiles[x, y].type); + chestInteraction?.Invoke(chest); + } + } + if (tiles[x, y].type == ModContent.TileType()) + { + WorldGen.PlaceTile(x, y, tiles[x, y].type); + } + + Main.tile[x + xOffset, y + yOffset] = (Tile)tiles[x, y].Clone(); + + // If specified, preserve walls if they're not not being overrided and there's no active tile in its place. + if (preserveWalls && oldWalls[x, y] != 0 && tiles[x, y].wall == 0) + { + Main.tile[x + xOffset, y + yOffset].wall = oldWalls[x, y]; + } + + Rectangle placeInArea = new Rectangle(x, y, tiles.GetLength(0), tiles.GetLength(1)); + + // Dictionary.TryGetValue returns null if the specified key is not present. + pilePlacementFunction?.Invoke(x + xOffset, y + yOffset, placeInArea); + } + } + } + } + public static Chest PlaceChest(int x, int y, int chestType) + { + int chestIndex = Chest.FindEmptyChest(x, y, chestType); + Main.chest[chestIndex] = new Chest() + { + x = x, + y = y + }; + Main.chest[chestIndex].item = new Item[Main.chest[chestIndex].item.Length]; + for (int i = 0; i < Main.chest[chestIndex].item.Length; i++) + { + Main.chest[chestIndex].item[i] = new Item(); + } + return Main.chest[chestIndex]; + } + } +} diff --git a/Sounds/Custom/BrimstoneMonsterSpawn.cs b/Sounds/Custom/BrimstoneMonsterSpawn.cs new file mode 100644 index 0000000000..a36de799cf --- /dev/null +++ b/Sounds/Custom/BrimstoneMonsterSpawn.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom +{ + public class BrimstoneMonsterSpawn : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Custom/BrimstoneMonsterSpawn.ogg b/Sounds/Custom/BrimstoneMonsterSpawn.ogg new file mode 100644 index 0000000000..820dfa8180 Binary files /dev/null and b/Sounds/Custom/BrimstoneMonsterSpawn.ogg differ diff --git a/Sounds/Custom/DevourerAttack.cs b/Sounds/Custom/DevourerAttack.cs new file mode 100644 index 0000000000..07ce5c166f --- /dev/null +++ b/Sounds/Custom/DevourerAttack.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom +{ + public class DevourerAttack : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Custom/DevourerAttack.ogg b/Sounds/Custom/DevourerAttack.ogg new file mode 100644 index 0000000000..d680f9a984 Binary files /dev/null and b/Sounds/Custom/DevourerAttack.ogg differ diff --git a/Sounds/Custom/SlimeGodExit.cs b/Sounds/Custom/SlimeGodExit.cs new file mode 100644 index 0000000000..5aca87dbd2 --- /dev/null +++ b/Sounds/Custom/SlimeGodExit.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom +{ + public class SlimeGodExit : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Custom/SlimeGodExit.ogg b/Sounds/Custom/SlimeGodExit.ogg new file mode 100644 index 0000000000..2762c5ceac Binary files /dev/null and b/Sounds/Custom/SlimeGodExit.ogg differ diff --git a/Sounds/Custom/SlimeGodPossession.cs b/Sounds/Custom/SlimeGodPossession.cs new file mode 100644 index 0000000000..fc846aaeb3 --- /dev/null +++ b/Sounds/Custom/SlimeGodPossession.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom +{ + public class SlimeGodPossession : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Custom/SlimeGodPossession.ogg b/Sounds/Custom/SlimeGodPossession.ogg new file mode 100644 index 0000000000..858780ffbb Binary files /dev/null and b/Sounds/Custom/SlimeGodPossession.ogg differ diff --git a/Sounds/Item/PwnagehammerHoming.cs b/Sounds/Item/PwnagehammerHoming.cs new file mode 100644 index 0000000000..341f6d9b99 --- /dev/null +++ b/Sounds/Item/PwnagehammerHoming.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Item +{ + public class PwnagehammerHoming : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Item/PwnagehammerHoming.ogg b/Sounds/Item/PwnagehammerHoming.ogg new file mode 100644 index 0000000000..808b8619cf Binary files /dev/null and b/Sounds/Item/PwnagehammerHoming.ogg differ diff --git a/Sounds/Item/PwnagehammerSound.cs b/Sounds/Item/PwnagehammerSound.cs new file mode 100644 index 0000000000..7bc2da6813 --- /dev/null +++ b/Sounds/Item/PwnagehammerSound.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Item +{ + public class PwnagehammerSound : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Item/PwnagehammerSound.ogg b/Sounds/Item/PwnagehammerSound.ogg new file mode 100644 index 0000000000..d27268a073 Binary files /dev/null and b/Sounds/Item/PwnagehammerSound.ogg differ diff --git a/TileEntities/TEBaseTurret.cs b/TileEntities/TEBaseTurret.cs new file mode 100644 index 0000000000..f92b359ffe --- /dev/null +++ b/TileEntities/TEBaseTurret.cs @@ -0,0 +1,132 @@ +using CalamityMod.Projectiles.Enemy; +using CalamityMod.Tiles; +using Microsoft.Xna.Framework; +using System; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.TileEntities +{ + public abstract class TEBaseTurret : ModTileEntity + { + public int Time; + public int Direction; + public float Rotation; + public virtual float MaxAngleOffestShootPrompt => MathHelper.ToRadians(35f); + public abstract int ShootWaitTime { get; } + public abstract int ShootRate { get; } + public abstract int ProjectileDamage { get; } + public abstract float ShootSpeed { get; } + public abstract float ShootSpawnOffset { get; } + public abstract float ProjectileKnockback { get; } + public abstract int TileType { get; } + public abstract int ProjectileShot { get; } + public abstract Vector2 ShootCoordsOffset { get; } + public abstract float TargetDistanceCheck { get; } + public void SyncTile() + { + NetMessage.SendData(MessageID.TileEntitySharing, -1, -1, null, ID, Position.X, Position.Y); + } + public virtual int AttemptToLocatePlayer(Vector2 shootTargetCoords) + { + int playerIndex = -1; + for (int i = 0; i < Main.player.Length; i++) + { + // Ignore dead/inactive players. They are irrelevant since we're supposed to target a player. + if (!Main.player[i].active || Main.player[i].dead) + continue; + if (Main.player[i].Distance(shootTargetCoords) < TargetDistanceCheck) + { + playerIndex = i; + break; + } + } + return playerIndex; + } + public virtual void AttemptToFireAtPlayer(int playerIndex, Vector2 shootTargetCoords) + { + Player player = Main.player[playerIndex]; + float angleToTarget = (player.Center - shootTargetCoords).ToRotation(); + float idealAngle = angleToTarget + (Direction == -1).ToInt() * MathHelper.Pi; + + // Adjust the rotation before waiting, and then firing. + if (Time % ShootRate < ShootRate - ShootWaitTime) + { + AimTowardsPlayer(playerIndex, shootTargetCoords, angleToTarget, ref idealAngle); + SyncTile(); // The stupid rotation/direction doesn't sync otherwise. Don't ask me why. + } + + // If at the end of the shoot cycle, and the angle offset isn't too far away, fire at the player. + // Think of the angle offset as how close the turret is to aiming 100% perfectly at the player. + if (Time % ShootRate == ShootRate - 1 && Math.Abs(MathHelper.WrapAngle(idealAngle - Rotation)) < MaxAngleOffestShootPrompt) + { + ShootProjectile(shootTargetCoords); + SyncTile(); + } + } + public virtual void AimTowardsPlayer(int playerIndex, Vector2 shootTargetCoords, float angleToTarget, ref float idealAngle) + { + Player player = Main.player[playerIndex]; + int idealDirection = (player.Center.X - shootTargetCoords.X > 0).ToDirectionInt(); + + // Adjust the direction if the turret should do so, along with the angle. + if (Direction != idealDirection) + { + Direction = idealDirection; + idealAngle = angleToTarget + (Direction == -1).ToInt() * MathHelper.Pi; + Rotation = Rotation.AngleLerp(idealAngle, 0.4f); // Get a head start in rotating towards the ideal angle. + } + Rotation = Rotation.AngleLerp(idealAngle, 0.1f); + } + public virtual void ShootProjectile(Vector2 shootCoords) + { + float adjustedAngle = Rotation - (Direction == -1).ToInt() * MathHelper.Pi; + Vector2 velocity = adjustedAngle.ToRotationVector2() * ShootSpeed; + Projectile.NewProjectileDirect(shootCoords + adjustedAngle.ToRotationVector2() * ShootSpawnOffset, velocity, ProjectileShot, ProjectileDamage, ProjectileKnockback); + } + public override bool ValidTile(int i, int j) + { + Tile tile = Main.tile[i, j]; + return tile.active() && tile.type == TileType; + } + public override void Update() + { + Vector2 positionWorldCoords = Position.ToVector2() * 16f; + Vector2 shootTargetCoords = positionWorldCoords + ShootCoordsOffset; + int playerIndex = AttemptToLocatePlayer(shootTargetCoords); + if (playerIndex != -1) + { + AttemptToFireAtPlayer(playerIndex, shootTargetCoords); + Time++; + } + else + { + Rotation = Rotation.AngleLerp(0f, 0.25f); + } + } + public override int Hook_AfterPlacement(int i, int j, int type, int style, int direction) + { + if (Main.netMode == NetmodeID.MultiplayerClient) + { + NetMessage.SendTileSquare(Main.myPlayer, i, j, 3); + NetMessage.SendData(MessageID.TileEntityPlacement, -1, -1, null, i, j, Type, 0f, 0, 0, 0); + return -1; + } + return Place(i, j); + } + public override void NetSend(BinaryWriter writer, bool lightSend) + { + writer.Write(Time); + writer.Write(Direction); + writer.Write(Rotation); + } + public override void NetReceive(BinaryReader reader, bool lightReceive) + { + Time = reader.ReadInt32(); + Direction = reader.ReadInt32(); + Rotation = reader.ReadSingle(); + } + } +} diff --git a/TileEntities/TEDraedonFieldGenerator.cs b/TileEntities/TEDraedonFieldGenerator.cs new file mode 100644 index 0000000000..4126d7a4d2 --- /dev/null +++ b/TileEntities/TEDraedonFieldGenerator.cs @@ -0,0 +1,75 @@ +using CalamityMod.Projectiles.Enemy; +using CalamityMod.Tiles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.TileEntities +{ + public class TEDraedonFieldGenerator : ModTileEntity + { + public int Time; + public int ActiveTimer; + public const int ActiveTimerMax = 45; + public override bool ValidTile(int i, int j) + { + Tile tile = Main.tile[i, j]; + return tile.active() && tile.type == ModContent.TileType(); + } + public override void Update() + { + Player player = Main.player[Player.FindClosest(Position.ToVector2() * 16, 1, 1)]; + Vector2 positionWorldCoords = Position.ToVector2() * 16f; + if (Vector2.Distance(player.Center, positionWorldCoords) < 960f && !player.dead) + { + if (ActiveTimer < ActiveTimerMax) + ActiveTimer++; + Time++; + + if (Time % 40 == 39) + { + float speed = 5f; + Vector2 aimOffset = (player.velocity + player.oldVelocity) * 0.5f * player.Distance(positionWorldCoords) / (speed * speed); + Vector2 velocity = Vector2.Normalize(player.Center - positionWorldCoords + aimOffset) * speed; + Projectile.NewProjectileDirect(positionWorldCoords, velocity, ModContent.ProjectileType(), 27, 4f); + } + if (Time % 95 == 94) + { + for (int i = 0; i < 9; i++) + { + float angle = i / 9f * MathHelper.TwoPi; + Projectile.NewProjectileDirect(positionWorldCoords, Vector2.Normalize(player.Center - positionWorldCoords).RotatedBy(angle) * 7f, ModContent.ProjectileType(), 27, 4f); + } + } + } + else if (ActiveTimer > 0) + { + ActiveTimer--; + ClientToServerSync(); + } + } + public override int Hook_AfterPlacement(int i, int j, int type, int style, int direction) + { + if (Main.netMode == NetmodeID.MultiplayerClient) + { + NetMessage.SendTileSquare(Main.myPlayer, i, j, 3); + NetMessage.SendData(MessageID.TileEntityPlacement, -1, -1, null, i, j, Type, 0f, 0, 0, 0); + return -1; + } + return Place(i, j); + } + public void ClientToServerSync() + { + if (Main.netMode != NetmodeID.SinglePlayer) + { + var netMessage = CalamityMod.Instance.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.DraedonFieldGeneratorSync); + netMessage.Write(Main.LocalPlayer.Calamity().CurrentlyViewedCharger.ID); + netMessage.Write(Time); + netMessage.Write(ActiveTimer); + netMessage.Send(); + } + } + } +} diff --git a/TileEntities/TEDraedonFuelFactory.cs b/TileEntities/TEDraedonFuelFactory.cs new file mode 100644 index 0000000000..eeb25fb214 --- /dev/null +++ b/TileEntities/TEDraedonFuelFactory.cs @@ -0,0 +1,89 @@ +using CalamityMod.Items; +using CalamityMod.Tiles; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ModLoader.IO; + +namespace CalamityMod.TileEntities +{ + public class TEDraedonFuelFactory : ModTileEntity + { + public int Time; + public Item HeldItem = new Item(); + public void SyncTile() + { + NetMessage.SendData(MessageID.TileEntitySharing, -1, -1, null, ID, Position.X, Position.Y); + } + public override bool ValidTile(int i, int j) + { + Tile tile = Main.tile[i, j]; + return tile.active() && tile.type == ModContent.TileType(); + } + public override void Update() + { + if (HeldItem.type != ModContent.ItemType()) + { + HeldItem.SetDefaults(ModContent.ItemType()); + HeldItem.stack = 0; + } + + Time++; + bool rightTimeToMakeCell = Time % 5 == 4 && Main.tileFrame[Main.tile[Position.X, Position.Y].type] == 43; + if (HeldItem.stack < HeldItem.maxStack && rightTimeToMakeCell) + { + HeldItem.stack++; + } + SyncTile(); + } + public override void OnKill() + { + if (Main.LocalPlayer.Calamity().CurrentlyViewedFactory == this) + Main.LocalPlayer.Calamity().CurrentlyViewedFactory = null; + } + public override int Hook_AfterPlacement(int i, int j, int type, int style, int direction) + { + if (Main.netMode == NetmodeID.MultiplayerClient) + { + NetMessage.SendTileSquare(Main.myPlayer, i, j, 3); + NetMessage.SendData(MessageID.TileEntityPlacement, -1, -1, null, i, j, Type, 0f, 0, 0, 0); + return -1; + } + return Place(i, j); + } + public override TagCompound Save() + { + return new TagCompound + { + ["Type"] = HeldItem.type, + ["Stack"] = HeldItem.stack, + ["Prefix"] = HeldItem.prefix, + ["NetID"] = HeldItem.active && HeldItem.stack > 0 ? HeldItem.netID : 0, + }; + } + public override void Load(TagCompound tag) + { + HeldItem.type = tag.GetInt("Type"); + HeldItem.stack = tag.GetInt("Stack"); + HeldItem.prefix = tag.GetByte("Prefix"); + HeldItem.netID = tag.GetInt("NetID"); + } + public override void NetSend(BinaryWriter writer, bool lightSend) + { + writer.Write(Time); + writer.Write(HeldItem.type); + writer.Write(HeldItem.stack); + writer.Write(HeldItem.active && HeldItem.stack > 0 ? HeldItem.netID : 0); + writer.Write(HeldItem.prefix); + } + public override void NetReceive(BinaryReader reader, bool lightReceive) + { + Time = reader.ReadInt32(); + HeldItem.type = reader.ReadInt32(); + HeldItem.stack = reader.ReadInt32(); + HeldItem.netID = reader.ReadInt32(); + HeldItem.prefix = reader.ReadByte(); + } + } +} diff --git a/TileEntities/TEDraedonItemCharger.cs b/TileEntities/TEDraedonItemCharger.cs new file mode 100644 index 0000000000..3ea5b1c28d --- /dev/null +++ b/TileEntities/TEDraedonItemCharger.cs @@ -0,0 +1,249 @@ +using CalamityMod.Items; +using CalamityMod.Items.Weapons.DraedonsArsenal; +using CalamityMod.Tiles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ModLoader.IO; + +namespace CalamityMod.TileEntities +{ + public class TEDraedonItemCharger : ModTileEntity + { + #region Spark Class + public class Spark + { + public int Steps; + public Vector2 Start; + public Vector2 End; + public Vector2 CurrentPosition; + public Vector2 Velocity; + public Vector2[] OldPositions = new Vector2[15]; + public const float SparkSpeed = 3.25f; + public void Update() + { + if (Steps > 12) + { + Velocity = Vector2.Lerp(Velocity, Vector2.Normalize(End - CurrentPosition) * SparkSpeed, 0.15f); + } + else if (Main.rand.NextBool(5)) + { + Velocity = Vector2.Normalize(End - CurrentPosition).RotatedByRandom(0.3f) * SparkSpeed; + } + + CurrentPosition += Velocity; + for (int i = OldPositions.Length - 1; i > 0; i--) + { + OldPositions[i] = OldPositions[i - 1]; + } + OldPositions[0] = CurrentPosition; + Steps++; + } + public bool ShouldDestroy() + { + for (int i = 0; i < OldPositions.Length; i++) + { + if (Vector2.Distance(End, OldPositions[i]) > 10f) + return false; + } + return true; + } + } + #endregion + + #region Fields + public int Time; + public int Charge; + public int ActiveTimer; + public int DepositWithdrawCooldown; + public Item FuelItem = new Item(); + public Item ItemBeingCharged = new Item(); + public Spark[] Sparks = new Spark[9]; + public const int TotalSparkUpdatesPerFrame = 3; + public const int ActiveTimerMax = 30; + + #endregion + + public void ClientToServerSync() + { + if (Main.netMode != NetmodeID.SinglePlayer) + { + var netMessage = CalamityMod.Instance.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.DraedonChargerSync); + netMessage.Write(Main.LocalPlayer.Calamity().CurrentlyViewedCharger.ID); + netMessage.Write(FuelItem.type); + netMessage.Write(FuelItem.stack); + netMessage.Write(ItemBeingCharged.type); + netMessage.Write(ItemBeingCharged.stack); + netMessage.Write(Charge); + netMessage.Write(ActiveTimer); + netMessage.Send(); + } + } + public void AttemptToCreateNewSpark() + { + int i = 0; + while (Sparks[i] != null) + { + i++; + if (i >= Sparks.Length) + break; + } + if (i < Sparks.Length) + { + Sparks[i] = new Spark() + { + CurrentPosition = FuelItem.position, + Start = FuelItem.position + Main.rand.NextBool(2).ToDirectionInt() * Vector2.UnitX * 32f, + End = ItemBeingCharged.position + Utils.RandomVector2(Main.rand, -16f, 16f) * new Vector2(1f, 0.2f), + Velocity = Vector2.Normalize(ItemBeingCharged.position - FuelItem.position).RotatedBy(Main.rand.NextFloat(0.9f, 1.4f) * Main.rand.NextBool(2).ToDirectionInt()) * Spark.SparkSpeed + }; + } + } + public void DrawAllSparks(SpriteBatch spriteBatch) + { + Texture2D tinySparkTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/RedLightningTexture"); + for (int i = 0; i < Sparks.Length; i++) + { + if (Sparks[i] == null) + continue; + Spark spark = Sparks[i]; + + for (int j = 0; j < TotalSparkUpdatesPerFrame; j++) + { + spark.Update(); + } + + DelegateMethods.c_1 = Color.White; + DelegateMethods.f_1 = 1f; + for (int j = 0; j < spark.OldPositions.Length - 1; j++) + { + float scale = (float)Math.Sin(j / (float)spark.OldPositions.Length * MathHelper.Pi) * 2f; + scale = MathHelper.Clamp(scale, 0.25f, 2f) * 0.1f; + if (spark.OldPositions[j] != Vector2.Zero && + spark.OldPositions[j + 1] != Vector2.Zero) + { + Utils.DrawLaser(spriteBatch, tinySparkTexture, spark.OldPositions[j] - Main.screenPosition, spark.OldPositions[j + 1] - Main.screenPosition, new Vector2(scale), new Utils.LaserLineFraming(DelegateMethods.LightningLaserDraw)); + } + } + if (spark.ShouldDestroy()) + { + Sparks[i] = null; + } + } + } + public override bool ValidTile(int i, int j) + { + Tile tile = Main.tile[i, j]; + return tile.active() && tile.type == ModContent.TileType() && tile.frameX == 0 && tile.frameY == 0; + } + public override void Update() + { + Time++; + if (Time % 60 == 0) + { + ClientToServerSync(); + } + if (FuelItem.stack > 0 && + ItemBeingCharged.stack > 0 && + Charge < ItemBeingCharged.Calamity().ChargeMax) + { + if (Time % 25 == 0) + { + for (int i = 0; i < Main.rand.Next(1, 3 + 1); i++) + { + AttemptToCreateNewSpark(); + } + Main.PlaySound(SoundID.Item15, FuelItem.position); + Charge++; + FuelItem.stack--; + ClientToServerSync(); + } + if (ActiveTimer < ActiveTimerMax) + ActiveTimer++; + } + else if (ActiveTimer > 0) ActiveTimer--; + + if (DepositWithdrawCooldown > 0) + DepositWithdrawCooldown--; + } + public override void OnKill() + { + if (Main.LocalPlayer.Calamity().CurrentlyViewedCharger == this) + Main.LocalPlayer.Calamity().CurrentlyViewedCharger = null; + base.OnKill(); + } + public override int Hook_AfterPlacement(int i, int j, int type, int style, int direction) + { + if (Main.netMode == NetmodeID.MultiplayerClient) + { + NetMessage.SendTileSquare(Main.myPlayer, i, j, 5); + NetMessage.SendData(MessageID.TileEntityPlacement, -1, -1, null, i, j, Type, 0f, 0, 0, 0); + return -1; + } + return Place(i, j); + } + public override void NetSend(BinaryWriter writer, bool lightSend) + { + writer.Write(ID); + writer.Write(FuelItem.type); + writer.Write(FuelItem.stack); + writer.Write(ItemBeingCharged.type); + writer.Write(ItemBeingCharged.stack); + writer.Write(Charge); + writer.Write(ActiveTimer); + } + public override void NetReceive(BinaryReader reader, bool lightReceive) + { + ID = reader.ReadInt32(); + FuelItem.type = reader.ReadInt32(); + FuelItem.SetDefaults(FuelItem.type); + FuelItem.stack = reader.ReadInt32(); + ItemBeingCharged.type = reader.ReadInt32(); + ItemBeingCharged.SetDefaults(FuelItem.type); + ItemBeingCharged.stack = reader.ReadInt32(); + Charge = reader.ReadInt32(); + ActiveTimer = reader.ReadInt32(); + } + public override TagCompound Save() + { + return new TagCompound + { + ["ID"] = ID, // Don't ask me why, but the ID doesn't get saved in MP otherwise. + ["TypeFuel"] = FuelItem.type, + ["StackFuel"] = FuelItem.stack, + ["PrefixFuel"] = FuelItem.prefix, + ["NetIDFuel"] = FuelItem.active && FuelItem.stack > 0 ? FuelItem.netID : 0, + + ["TypeNotFuel"] = ItemBeingCharged.type, + ["StackNotFuel"] = ItemBeingCharged.stack, + ["PrefixNotFuel"] = ItemBeingCharged.prefix, + ["Charge"] = Charge, + ["NetIDNotFuel"] = ItemBeingCharged.active && FuelItem.stack > 0 ? FuelItem.netID : 0 + }; + } + public override void Load(TagCompound tag) + { + ID = tag.GetInt("ID"); + FuelItem = new Item(); + FuelItem.SetDefaults(tag.GetInt("TypeFuel")); + FuelItem.stack = tag.GetInt("StackFuel"); + FuelItem.prefix = tag.GetByte("PrefixFuel"); + FuelItem.netID = tag.GetInt("NetIDFuel"); + + ItemBeingCharged.SetDefaults(tag.GetInt("TypeNotFuel")); + ItemBeingCharged.stack = tag.GetInt("StackNotFuel"); + ItemBeingCharged.prefix = tag.GetByte("PrefixNotFuel"); + if (ItemBeingCharged.type > ItemID.Count) + { + Charge = tag.GetInt("Charge"); + } + ItemBeingCharged.netID = tag.GetInt("NetIDNotFuel"); + } + } +} diff --git a/TileEntities/TEDraedonTurret.cs b/TileEntities/TEDraedonTurret.cs new file mode 100644 index 0000000000..5308f62065 --- /dev/null +++ b/TileEntities/TEDraedonTurret.cs @@ -0,0 +1,21 @@ +using CalamityMod.Projectiles.Enemy; +using CalamityMod.Tiles; +using Microsoft.Xna.Framework; +using Terraria.ModLoader; + +namespace CalamityMod.TileEntities +{ + public class TEDraedonTurret : TEBaseTurret + { + public override int ShootWaitTime => 15; + public override int ShootRate => 60; + public override int ProjectileDamage => 20; + public override float ShootSpeed => 5f; + public override float ShootSpawnOffset => 32f; + public override float ProjectileKnockback => 3f; + public override int TileType => ModContent.TileType(); + public override int ProjectileShot => ModContent.ProjectileType(); + public override Vector2 ShootCoordsOffset => new Vector2(22f + 4f * Direction, -2f); + public override float TargetDistanceCheck => 600f; + } +} diff --git a/Tiles/AgedSecurityChestTile.cs b/Tiles/AgedSecurityChestTile.cs new file mode 100644 index 0000000000..9e8c6c9866 --- /dev/null +++ b/Tiles/AgedSecurityChestTile.cs @@ -0,0 +1,72 @@ +using CalamityMod.Items.Placeables.Furniture; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles +{ + public class AgedSecurityChestTile : ModTile + { + public override void SetDefaults() + { + this.SetUpChest(); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Aged Security Chest"); + AddMapEntry(new Color(130, 119, 115), name, MapChestName); + disableSmartCursor = true; + adjTiles = new int[] { TileID.Containers }; + chest = "Aged Security Chest"; + chestDrop = ModContent.ItemType(); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 226, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override bool HasSmartInteract() => true; + + public string MapChestName(string name, int i, int j) + { + int left = i; + int top = j; + Tile tile = Main.tile[i, j]; + + if (tile.frameX % 36 != 0) + left--; + if (tile.frameY != 0) + top--; + + int chest = Chest.FindChest(left, top); + if (Main.chest[chest].name == "") + return name; + else + return name + ": " + Main.chest[chest].name; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 32, 32, chestDrop); + Chest.DestroyChest(i, j); + } + + public override bool NewRightClick(int i, int j) => CalamityUtils.ChestRightClick(i, j); + + public override void MouseOver(int i, int j) + { + CalamityUtils.ChestMouseOver("Security Chest", i, j); + } + + public override void MouseOverFar(int i, int j) + { + CalamityUtils.ChestMouseFar("Security Chest", i, j); + } + } +} diff --git a/Tiles/AgedSecurityChestTile.png b/Tiles/AgedSecurityChestTile.png new file mode 100644 index 0000000000..3a38afbe0f Binary files /dev/null and b/Tiles/AgedSecurityChestTile.png differ diff --git a/Tiles/AgedSecurityChestTile_Highlight.png b/Tiles/AgedSecurityChestTile_Highlight.png new file mode 100644 index 0000000000..a6039e3351 Binary files /dev/null and b/Tiles/AgedSecurityChestTile_Highlight.png differ diff --git a/Tiles/Astral/AstralBeacon.cs b/Tiles/Astral/AstralBeacon.cs new file mode 100644 index 0000000000..44369421e9 --- /dev/null +++ b/Tiles/Astral/AstralBeacon.cs @@ -0,0 +1,107 @@ +using CalamityMod.Dusts; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Furniture; +using CalamityMod.Items.SummonItems; +using CalamityMod.NPCs.AstrumDeus; +using CalamityMod.Projectiles.Boss; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Astral +{ + public class AstralBeacon : ModTile + { + public const int Width = 5; + public const int Height = 4; + public static readonly Color FailColor = new Color(237, 93, 83); + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileSpelunker[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style5x4); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Astral Beacon"); + AddMapEntry(new Color(128, 128, 158), name); + disableSmartCursor = true; + minPick = 200; + } + + public override bool CanExplode(int i, int j) => false; + + public override bool CreateDust(int i, int j, ref int type) + { + type = Utils.SelectRandom(Main.rand, ModContent.DustType(), ModContent.DustType()); + return true; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, Width * 16, Height * 16, ModContent.ItemType()); + } + + public override bool NewRightClick(int i, int j) + { + Tile tile = Main.tile[i, j]; + + int left = i - tile.frameX / 18; + int top = j - tile.frameY / 18; + + if (!Main.LocalPlayer.HasItem(ModContent.ItemType()) && + !Main.LocalPlayer.HasItem(ModContent.ItemType())) + return true; + + if (NPC.AnyNPCs(ModContent.NPCType())) + return true; + + if (CalamityUtils.CountProjectiles(ModContent.ProjectileType()) > 0) + return true; + + bool usingStarcore = Main.LocalPlayer.HasItem(ModContent.ItemType()); + + if (Main.dayTime) + { + string localizationKey = "Mods.CalamityMod.DeusAltarRejectNightText"; + if (Main.netMode == NetmodeID.SinglePlayer) + Main.NewText(Language.GetTextValue(localizationKey), FailColor); + else if (Main.netMode == NetmodeID.Server) + NetMessage.BroadcastChatMessage(NetworkText.FromKey(localizationKey), FailColor); + return false; + } + + Vector2 ritualSpawnPosition = new Vector2(left + Width / 2, top).ToWorldCoordinates(); + ritualSpawnPosition += new Vector2(0f, -24f); + + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ProvidenceHolyRay"), ritualSpawnPosition); + Projectile.NewProjectile(ritualSpawnPosition, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Main.myPlayer); + + if (!usingStarcore) + Main.LocalPlayer.ConsumeItem(ModContent.ItemType(), true); + + return true; + } + + public override void MouseOver(int i, int j) + { + Main.LocalPlayer.showItemIcon2 = ModContent.ItemType(); + if (Main.LocalPlayer.HasItem(ModContent.ItemType())) + Main.LocalPlayer.showItemIcon2 = ModContent.ItemType(); + Main.LocalPlayer.noThrow = 2; + Main.LocalPlayer.showItemIcon = true; + } + + public override void MouseOverFar(int i, int j) + { + Main.LocalPlayer.showItemIcon2 = ModContent.ItemType(); + if (Main.LocalPlayer.HasItem(ModContent.ItemType())) + Main.LocalPlayer.showItemIcon2 = ModContent.ItemType(); + Main.LocalPlayer.noThrow = 2; + Main.LocalPlayer.showItemIcon = true; + } + } +} diff --git a/Tiles/Astral/AstralBeacon.png b/Tiles/Astral/AstralBeacon.png index 7b09be4247..d0ad4159fc 100644 Binary files a/Tiles/Astral/AstralBeacon.png and b/Tiles/Astral/AstralBeacon.png differ diff --git a/Tiles/CalamityGlobalTile.cs b/Tiles/CalamityGlobalTile.cs index 1137bed448..9b857347ce 100644 --- a/Tiles/CalamityGlobalTile.cs +++ b/Tiles/CalamityGlobalTile.cs @@ -11,6 +11,7 @@ using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System.Collections.Generic; +using System.Linq; using System.Reflection; using Terraria; using Terraria.ID; @@ -525,5 +526,23 @@ namespace CalamityMod.Tiles return new int[0]; } - } + public override bool CanKillTile(int i, int j, int type, ref bool blockDamaged) + { + int[] indestructableTiles = new int[] + { + ModContent.TileType(), + ModContent.TileType(), + ModContent.TileType() + }; + // Prevent tiles below an astral beacon from being destroyed. + if (CalamityUtils.ParanoidTileRetrieval(i, j - 1).active() && + CalamityUtils.ParanoidTileRetrieval(i, j).type != + CalamityUtils.ParanoidTileRetrieval(i, j - 1).type && + indestructableTiles.Contains(CalamityUtils.ParanoidTileRetrieval(i, j - 1).type)) + { + return false; + } + return base.CanKillTile(i, j, type, ref blockDamaged); + } + } } diff --git a/Tiles/CellFabricator.png b/Tiles/CellFabricator.png new file mode 100644 index 0000000000..f0f6b924f9 Binary files /dev/null and b/Tiles/CellFabricator.png differ diff --git a/Tiles/Cinderplate.png b/Tiles/Cinderplate.png deleted file mode 100644 index 60f5cc7b5a..0000000000 Binary files a/Tiles/Cinderplate.png and /dev/null differ diff --git a/Tiles/CinderplateGlow.png b/Tiles/CinderplateGlow.png deleted file mode 100644 index dc283bcfb7..0000000000 Binary files a/Tiles/CinderplateGlow.png and /dev/null differ diff --git a/Tiles/DraeHolo.png b/Tiles/DraeHolo.png new file mode 100644 index 0000000000..ef477c4f79 Binary files /dev/null and b/Tiles/DraeHolo.png differ diff --git a/Tiles/DraedonFactoryFieldGenerator.cs b/Tiles/DraedonFactoryFieldGenerator.cs new file mode 100644 index 0000000000..1ef04a2e0c --- /dev/null +++ b/Tiles/DraedonFactoryFieldGenerator.cs @@ -0,0 +1,127 @@ +using CalamityMod.TileEntities; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.DataStructures; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class DraedonFactoryFieldGenerator : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = false; + Main.tileWaterDeath[Type] = false; + TileObjectData.newTile.CopyFrom(TileObjectData.Style1x1); + TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(ModContent.GetInstance().Hook_AfterPlacement, -1, 0, true); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Field Generator"); + AddMapEntry(new Color(53, 49, 52), name); + minPick = 65; + } + + public TEDraedonFieldGenerator RetrieveTileEntity(int i, int j) + { + int determinedID = ModContent.GetInstance().Find(i, j); + if (determinedID == -1 || !(TileEntity.ByID[determinedID] is TEDraedonFieldGenerator)) + { + ModTileEntity modTileEntity = ModTileEntity.ConstructFromType(ModContent.GetInstance().type); + modTileEntity.Position = new Point16(i, j); + modTileEntity.ID = TileEntity.AssignNewID(); + modTileEntity.type = ModContent.GetInstance().type; + TileEntity.ByID[modTileEntity.ID] = modTileEntity; + TileEntity.ByPosition[modTileEntity.Position] = modTileEntity; + determinedID = modTileEntity.ID; + } + return (TEDraedonFieldGenerator)TileEntity.ByID[determinedID]; + } + + public override bool CanExplode(int i, int j) => false; + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 226); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + TEDraedonFieldGenerator charger = RetrieveTileEntity(i, j); + Color drawColor = Color.Lerp(new Color(73, 68, 72), Color.Cyan, Utils.InverseLerp(0f, TEDraedonFieldGenerator.ActiveTimerMax, charger.ActiveTimer, true)); + + int xPos = Main.tile[i, j].frameX; + int yPos = Main.tile[i, j].frameY; + Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/DraedonFactoryFieldGeneratorGlow"); + Vector2 screenOffset = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + screenOffset; + Tile trackTile = Main.tile[i, j]; + if (!trackTile.halfBrick() && trackTile.slope() == 0) + { + spriteBatch.Draw(glowmask, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColor, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + else if (trackTile.halfBrick()) + { + spriteBatch.Draw(glowmask, drawOffset + new Vector2(0f, 8f), new Rectangle?(new Rectangle(xPos, yPos, 18, 8)), drawColor, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + + Vector2 positionWorldCoords = new Vector2(i, j) * 16f; + Player player = Main.player[Player.FindClosest(positionWorldCoords, 1, 1)]; + if (player.Distance(positionWorldCoords) < 1600f) + { + Texture2D laserTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/RedLightningTexture"); + Vector2[] pointsToDraw = new Vector2[65]; + for (int k = 0; k < pointsToDraw.Length; k++) + { + float angle = k / (float)pointsToDraw.Length * MathHelper.TwoPi; + pointsToDraw[k] = angle.ToRotationVector2() * 1000f; + pointsToDraw[k] += drawOffset; + pointsToDraw[k] += Main.rand.NextVector2Circular(1f, 1f); + + angle = (k + 1) % pointsToDraw.Length / (float)pointsToDraw.Length * MathHelper.TwoPi; + pointsToDraw[(k + 1) % pointsToDraw.Length] = angle.ToRotationVector2() * 1000f; + pointsToDraw[(k + 1) % pointsToDraw.Length] += drawOffset; + pointsToDraw[(k + 1) % pointsToDraw.Length] += Main.rand.NextVector2Circular(1f, 1f); + + if (trackTile.halfBrick()) + pointsToDraw[k] += Vector2.UnitY * 8f; + if (trackTile.halfBrick()) + pointsToDraw[(k + 1) % pointsToDraw.Length] += Vector2.UnitY * 8f; + + DelegateMethods.c_1 = Color.Cyan; + DelegateMethods.f_1 = 1f; + DelegateMethods.c_1 *= Utils.InverseLerp(1600f, 1000f, Math.Abs(positionWorldCoords.X - player.Center.X), true) * + Utils.InverseLerp(1000f, 660f, Math.Abs(positionWorldCoords.Y - player.Center.Y), true); + DelegateMethods.f_1 *= Utils.InverseLerp(1600f, 1000f, Math.Abs(positionWorldCoords.X - player.Center.X), true) * + Utils.InverseLerp(1000f, 660f, Math.Abs(positionWorldCoords.Y - player.Center.Y), true); + Utils.DrawLaser(spriteBatch, laserTexture, pointsToDraw[k], pointsToDraw[(k + 1) % pointsToDraw.Length], new Vector2(0.3f), new Utils.LaserLineFraming(DelegateMethods.LightningLaserDraw)); + + DelegateMethods.c_1 = Color.White * 0.7f; + DelegateMethods.f_1 = 0.7f; + DelegateMethods.c_1 *= Utils.InverseLerp(1600f, 1000f, Math.Abs(positionWorldCoords.X - player.Center.X), true) * + Utils.InverseLerp(1000f, 660f, Math.Abs(positionWorldCoords.Y - player.Center.Y), true); + DelegateMethods.f_1 *= Utils.InverseLerp(1600f, 1000f, Math.Abs(positionWorldCoords.X - player.Center.X), true) * + Utils.InverseLerp(1000f, 660f, Math.Abs(positionWorldCoords.Y - player.Center.Y), true); + Utils.DrawLaser(spriteBatch, laserTexture, pointsToDraw[k], pointsToDraw[(k + 1) % pointsToDraw.Length], new Vector2(0.6f), new Utils.LaserLineFraming(DelegateMethods.LightningLaserDraw)); + } + } + } + + public override void KillTile(int i, int j, ref bool fail, ref bool effectOnly, ref bool noItem) + { + TEDraedonFieldGenerator generator = RetrieveTileEntity(i, j); + generator.Kill(i, j); + } + } +} diff --git a/Tiles/DraedonFactoryFieldGenerator.png b/Tiles/DraedonFactoryFieldGenerator.png new file mode 100644 index 0000000000..b7a19a3bdd Binary files /dev/null and b/Tiles/DraedonFactoryFieldGenerator.png differ diff --git a/Tiles/DraedonFactoryFieldGeneratorGlow.png b/Tiles/DraedonFactoryFieldGeneratorGlow.png new file mode 100644 index 0000000000..ae6117f78e Binary files /dev/null and b/Tiles/DraedonFactoryFieldGeneratorGlow.png differ diff --git a/Tiles/DraedonFuelFactory.cs b/Tiles/DraedonFuelFactory.cs new file mode 100644 index 0000000000..64f8205019 --- /dev/null +++ b/Tiles/DraedonFuelFactory.cs @@ -0,0 +1,154 @@ +using CalamityMod.Items.Placeables; +using CalamityMod.TileEntities; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class DraedonFuelFactory : ModTile + { + public const int CellCreationDelay = 600; + public const int TotalFrames = 45; + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileTable[Type] = true; + Main.tileLavaDeath[Type] = true; + Main.tileWaterDeath[Type] = false; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.Width = 4; + TileObjectData.newTile.Height = 4; + TileObjectData.newTile.Origin = new Point16(0, 3); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16 }; + TileObjectData.newTile.CoordinatePadding = 0; + TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(ModContent.GetInstance().Hook_AfterPlacement, -1, 0, true); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Fuel Factory"); + AddMapEntry(new Color(67, 72, 81), name); + animationFrameHeight = 68; + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 226); + return false; + } + + public override bool HasSmartInteract() => true; + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 32, 32, ModContent.ItemType()); + int left = i - Main.tile[i, j].frameX % 64 / 16; + int top = j - Main.tile[i, j].frameY % 64 / 16; + + TEDraedonFuelFactory factory = (TEDraedonFuelFactory)TileEntity.ByID[ModContent.GetInstance().Find(left, top)]; + if (factory.HeldItem.stack > 0) + { + Item.NewItem(new Vector2(i, j) * 16f, factory.HeldItem.type, factory.HeldItem.stack); + } + factory.Kill(left, top); + } + + public override void AnimateTile(ref int frame, ref int frameCounter) + { + frameCounter++; + + // After CellCreationDelay frames, start the fuel cell generation animation, and make one at the end. + // Otherwise, just continue waiting. + if (frameCounter % (CellCreationDelay + TotalFrames * 5 + 5) >= CellCreationDelay) + { + if (frameCounter % 5 == 4) + { + frame++; + if (frame >= TotalFrames) + { + frame = 0; + } + } + } + else + { + frame = TotalFrames - 1; + } + } + + public override bool NewRightClick(int i, int j) + { + int left = i - Main.tile[i, j].frameX % 64 / 16; + int top = j - Main.tile[i, j].frameY % 64 / 16; + + Player player = Main.LocalPlayer; + TEDraedonFuelFactory factory = (TEDraedonFuelFactory)TileEntity.ByID[ModContent.GetInstance().Find(left, top)]; + Main.mouseRightRelease = false; + + if (player.sign >= 0) + { + Main.PlaySound(SoundID.MenuClose); + player.sign = -1; + Main.editSign = false; + Main.npcChatText = ""; + } + if (Main.editChest) + { + Main.PlaySound(SoundID.MenuTick); + Main.editChest = false; + Main.npcChatText = ""; + } + if (player.Calamity().CurrentlyViewedFactory == factory) + { + player.Calamity().CurrentlyViewedFactory = null; + player.Calamity().CurrentlyViewedFactoryX = player.Calamity().CurrentlyViewedFactoryY = -1; + Main.PlaySound(SoundID.MenuClose); + } + else + { + // Ensure that the UI position is always centered and above the tile. + player.Calamity().CurrentlyViewedFactoryX = left * 16 + 16; + player.Calamity().CurrentlyViewedFactoryY = top * 16; + + player.Calamity().CurrentlyViewedFactory = factory; + + Main.playerInventory = true; + Main.recBigList = false; + Main.PlaySound(player.Calamity().CurrentlyViewedFactory == null ? SoundID.MenuOpen : SoundID.MenuTick); + } + + Recipe.FindRecipes(); + return true; + } + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) + { + int xPos = Main.tile[i, j].frameX; + int yPos = Main.tile[i, j].frameY; + Tile trackTile = Main.tile[i, j]; + xPos += Main.tileFrame[trackTile.type] / 15 * 64; + yPos += Main.tileFrame[trackTile.type] % 15 * 68; + Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/DraedonFuelFactory"); + Vector2 offset = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + offset; + Color drawColor = Lighting.GetColor(i, j); + + if (!trackTile.halfBrick() && trackTile.slope() == 0) + spriteBatch.Draw(glowmask, drawOffset, new Rectangle(xPos, yPos, 16, 16), drawColor, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + else if (trackTile.halfBrick()) + spriteBatch.Draw(glowmask, drawOffset + Vector2.UnitY * 8f, new Rectangle(xPos, yPos, 16, 16), drawColor, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + return false; + } + } +} diff --git a/Tiles/DraedonFuelFactory.png b/Tiles/DraedonFuelFactory.png new file mode 100644 index 0000000000..eddd1360b3 Binary files /dev/null and b/Tiles/DraedonFuelFactory.png differ diff --git a/Tiles/DraedonHologram.cs b/Tiles/DraedonHologram.cs new file mode 100644 index 0000000000..fdd4fe1e02 --- /dev/null +++ b/Tiles/DraedonHologram.cs @@ -0,0 +1,94 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; +using Terraria.ObjectData; +using Terraria.DataStructures; +using Microsoft.Xna.Framework.Graphics; + +namespace CalamityMod.Tiles +{ + public class DraedonHologram : ModTile + { + public bool CloseToPlayer = false; + public const int Width = 6; + public const int Height = 7; + public const int IdleFrames = 8; + public const int TalkingFrames = 8; + public const int FrameCount = IdleFrames + TalkingFrames; + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style6x3); + TileObjectData.newTile.Height = 7; + TileObjectData.newTile.Origin = new Point16(3, 6); + TileObjectData.newTile.CoordinateHeights = new int[TileObjectData.newTile.Height]; + TileObjectData.newTile.CoordinatePadding = 0; + for (int i = 0; i < TileObjectData.newTile.CoordinateHeights.Length; i++) + { + TileObjectData.newTile.CoordinateHeights[i] = 16; + } + TileObjectData.addTile(Type); + animationFrameHeight = 112; + + soundType = SoundID.Tink; + dustType = 229; + minPick = 100; + AddMapEntry(new Color(99, 131, 199)); + } + public override void NearbyEffects(int i, int j, bool closer) + { + CloseToPlayer = closer; + } + public override void AnimateTile(ref int frame, ref int frameCounter) + { + if (frameCounter++ % 6 == 5) + { + frame++; + if (frame >= (!CloseToPlayer ? 5 : FrameCount)) + { + if (!CloseToPlayer && frame > 8) + frame = 7; + else + frame = !CloseToPlayer ? 0 : TalkingFrames; + } + } + } + public override bool NewRightClick(int i, int j) + { + Player player = Main.LocalPlayer; + if (player.Calamity().CurrentlyViewedHologramX == -1 || + player.Calamity().CurrentlyViewedHologramY == -1) + { + Main.PlaySound(SoundID.Chat, -1, -1, 1, 1f, 0f); + player.Calamity().CurrentlyViewedHologramX = i; + player.Calamity().CurrentlyViewedHologramY = j; + player.talkNPC = -1; + } + else + { + player.Calamity().CurrentlyViewedHologramX = player.Calamity().CurrentlyViewedHologramY = -1; + } + return true; + } + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) + { + int xPos = Main.tile[i, j].frameX; + int yPos = Main.tile[i, j].frameY; + Tile trackTile = Main.tile[i, j]; + xPos += Main.tileFrame[trackTile.type] / 8 * 96; + yPos += Main.tileFrame[trackTile.type] % 8 * 112; + Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/DraedonHologram"); + Vector2 offset = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + offset; + Color drawColor = Lighting.GetColor(i, j); + + if (!trackTile.halfBrick() && trackTile.slope() == 0) + spriteBatch.Draw(glowmask, drawOffset, new Rectangle(xPos, yPos, 16, 16), drawColor, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + else if (trackTile.halfBrick()) + spriteBatch.Draw(glowmask, drawOffset + Vector2.UnitY * 8f, new Rectangle(xPos, yPos, 16, 16), drawColor, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + return false; + } + } +} diff --git a/Tiles/DraedonHologram.png b/Tiles/DraedonHologram.png new file mode 100644 index 0000000000..5e33cfac6e Binary files /dev/null and b/Tiles/DraedonHologram.png differ diff --git a/Tiles/DraedonItemCharger.cs b/Tiles/DraedonItemCharger.cs new file mode 100644 index 0000000000..15681d4322 --- /dev/null +++ b/Tiles/DraedonItemCharger.cs @@ -0,0 +1,138 @@ +using CalamityMod.Items.Placeables; +using CalamityMod.TileEntities; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class DraedonItemCharger : ModTile + { + public const int Width = 3; + public const int Height = 2; + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = true; + Main.tileWaterDeath[Type] = false; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); + TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(ModContent.GetInstance().Hook_AfterPlacement, -1, 0, true); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Item Charger"); + AddMapEntry(new Color(67, 72, 81), name); + } + + public TEDraedonItemCharger RetrieveTileEntity(int i, int j) + { + int left = i - Main.tile[i, j].frameX % (Width * 18) / 18; + int top = j - Main.tile[i, j].frameY % (Height * 18) / 18; + if (!TileEntity.ByPosition.ContainsKey(new Point16(left, top))) + { + TileEntity.ByPosition[new Point16(left, top)] = ModTileEntity.ConstructFromType(ModContent.TileEntityType()); + } + return (TEDraedonItemCharger)TileEntity.ByPosition[new Point16(left, top)]; + } + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 226); + return false; + } + + public override bool HasSmartInteract() => true; + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 32, 32, ModContent.ItemType()); + int left = i - Main.tile[i, j].frameX % (Width * 18) / 18; + int top = j - Main.tile[i, j].frameY % (Height * 18) / 18; + + TEDraedonItemCharger charger = RetrieveTileEntity(i, j); + if (charger.FuelItem.stack > 0) + { + Item.NewItem(new Vector2(i, j) * 16f, charger.FuelItem.type, charger.FuelItem.stack); + } + if (charger.ItemBeingCharged.stack > 0) + { + int idx = Item.NewItem(new Vector2(i, j) * 16f, charger.ItemBeingCharged.type, charger.ItemBeingCharged.stack); + Main.item[idx].Calamity().CurrentCharge = charger.Charge; + } + charger.Kill(left, top); + } + + public override bool NewRightClick(int i, int j) + { + int left = i - Main.tile[i, j].frameX % (Width * 18) / 18; + int top = j - Main.tile[i, j].frameY % (Height * 18) / 18; + Player player = Main.LocalPlayer; + + TEDraedonItemCharger charger = RetrieveTileEntity(i, j); + Main.mouseRightRelease = false; + + if (player.sign >= 0) + { + Main.PlaySound(SoundID.MenuClose); + player.sign = -1; + Main.editSign = false; + Main.npcChatText = ""; + } + if (Main.editChest) + { + Main.PlaySound(SoundID.MenuTick); + Main.editChest = false; + Main.npcChatText = ""; + } + if (player.Calamity().CurrentlyViewedCharger == charger) + { + player.Calamity().CurrentlyViewedCharger = null; + player.Calamity().CurrentlyViewedChargerX = player.Calamity().CurrentlyViewedChargerY = -1; + Main.PlaySound(SoundID.MenuClose); + } + else + { + player.Calamity().CurrentlyViewedChargerX = left * 16; + player.Calamity().CurrentlyViewedChargerY = top * 16; + + player.Calamity().CurrentlyViewedCharger = charger; + + Main.playerInventory = true; + Main.recBigList = false; + Main.PlaySound(player.Calamity().CurrentlyViewedCharger == null ? SoundID.MenuOpen : SoundID.MenuTick); + } + + Recipe.FindRecipes(); + return true; + } + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + TEDraedonItemCharger charger = RetrieveTileEntity(i, j); + Color drawColor = Color.Lerp(Color.Red, Color.MediumSpringGreen, Utils.InverseLerp(0f, TEDraedonItemCharger.ActiveTimerMax, charger.ActiveTimer, true)); + + int xFrame = Main.tile[i, j].frameX; + int yFrame = Main.tile[i, j].frameY; + Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/DraedonItemChargerGlow"); + Vector2 screenOffset = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + screenOffset; + Tile trackTile = Main.tile[i, j]; + if (!trackTile.halfBrick() && trackTile.slope() == 0) + { + Main.spriteBatch.Draw(glowmask, drawOffset, new Rectangle?(new Rectangle(xFrame, yFrame, 18, 18)), drawColor, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + else if (trackTile.halfBrick()) + { + Main.spriteBatch.Draw(glowmask, drawOffset + new Vector2(0f, 8f), new Rectangle?(new Rectangle(xFrame, yFrame, 18, 8)), drawColor, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + } + } +} diff --git a/Tiles/DraedonItemCharger.png b/Tiles/DraedonItemCharger.png new file mode 100644 index 0000000000..0b97d8dd8e Binary files /dev/null and b/Tiles/DraedonItemCharger.png differ diff --git a/Tiles/DraedonItemChargerGlow.png b/Tiles/DraedonItemChargerGlow.png new file mode 100644 index 0000000000..974d778b03 Binary files /dev/null and b/Tiles/DraedonItemChargerGlow.png differ diff --git a/Tiles/DraedonStructures/HazardChevronPanels.cs b/Tiles/DraedonStructures/HazardChevronPanels.cs new file mode 100644 index 0000000000..5f95b7ac8c --- /dev/null +++ b/Tiles/DraedonStructures/HazardChevronPanels.cs @@ -0,0 +1,29 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Tiles.DraedonStructures +{ + public class HazardChevronPanels : ModTile + { + public override void SetDefaults() + { + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; + + CalamityUtils.MergeWithGeneral(Type); + + soundType = SoundID.Tink; + dustType = 19; + minPick = 30; + drop = ModContent.ItemType (); + AddMapEntry(new Color(163, 150, 73)); + } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + return TileFraming.BetterGemsparkFraming(i, j, resetFrame); + } + } +} diff --git a/Tiles/DraedonStructures/HazardChevronPanels.png b/Tiles/DraedonStructures/HazardChevronPanels.png new file mode 100644 index 0000000000..7598fa3acf Binary files /dev/null and b/Tiles/DraedonStructures/HazardChevronPanels.png differ diff --git a/Tiles/DraedonStructures/LaboratoryPanels.cs b/Tiles/DraedonStructures/LaboratoryPanels.cs new file mode 100644 index 0000000000..22297c8826 --- /dev/null +++ b/Tiles/DraedonStructures/LaboratoryPanels.cs @@ -0,0 +1,25 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Tiles.DraedonStructures +{ + public class LaboratoryPanels : ModTile + { + public override void SetDefaults() + { + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; + Main.tileMergeDirt[Type] = true; + + CalamityUtils.MergeWithGeneral(Type); + + soundType = SoundID.Tink; + dustType = 109; + minPick = 30; + drop = ModContent.ItemType(); + AddMapEntry(new Color(36, 35, 37)); + } + } +} diff --git a/Tiles/DraedonStructures/LaboratoryPanels.png b/Tiles/DraedonStructures/LaboratoryPanels.png new file mode 100644 index 0000000000..b2bd3aed59 Binary files /dev/null and b/Tiles/DraedonStructures/LaboratoryPanels.png differ diff --git a/Tiles/DraedonStructures/LaboratoryPipePlating.cs b/Tiles/DraedonStructures/LaboratoryPipePlating.cs new file mode 100644 index 0000000000..f7423ffdec --- /dev/null +++ b/Tiles/DraedonStructures/LaboratoryPipePlating.cs @@ -0,0 +1,30 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Tiles.DraedonStructures +{ + public class LaboratoryPipePlating : ModTile + { + public override void SetDefaults() + { + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; + + CalamityUtils.MergeWithGeneral(Type); + + soundType = SoundID.Tink; + dustType = 32; + minPick = 30; + drop = ModContent.ItemType(); + AddMapEntry(new Color(91, 64, 56)); + } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType()); + return false; + } + } +} diff --git a/Tiles/DraedonStructures/LaboratoryPipePlating.png b/Tiles/DraedonStructures/LaboratoryPipePlating.png new file mode 100644 index 0000000000..e08b08c66d Binary files /dev/null and b/Tiles/DraedonStructures/LaboratoryPipePlating.png differ diff --git a/Tiles/DraedonStructures/LaboratoryPlating.cs b/Tiles/DraedonStructures/LaboratoryPlating.cs new file mode 100644 index 0000000000..6a13105be9 --- /dev/null +++ b/Tiles/DraedonStructures/LaboratoryPlating.cs @@ -0,0 +1,29 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Tiles.DraedonStructures +{ + public class LaboratoryPlating : ModTile + { + public override void SetDefaults() + { + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; + + CalamityUtils.MergeWithGeneral(Type); + + soundType = SoundID.Tink; + dustType = 30; + minPick = 30; + drop = ModContent.ItemType (); + AddMapEntry(new Color(162, 157, 150)); + } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + return TileFraming.BetterGemsparkFraming(i, j, resetFrame); + } + } +} diff --git a/Tiles/DraedonStructures/LaboratoryPlating.png b/Tiles/DraedonStructures/LaboratoryPlating.png new file mode 100644 index 0000000000..78f8635bf0 Binary files /dev/null and b/Tiles/DraedonStructures/LaboratoryPlating.png differ diff --git a/Tiles/DraedonStructures/LaboratoryShelf.cs b/Tiles/DraedonStructures/LaboratoryShelf.cs new file mode 100644 index 0000000000..91623dd0e2 --- /dev/null +++ b/Tiles/DraedonStructures/LaboratoryShelf.cs @@ -0,0 +1,26 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.DraedonStructures +{ + public class LaboratoryShelf : ModTile + { + public override void SetDefaults() + { + this.SetUpPlatform(); + soundType = SoundID.Tink; + dustType = 30; + AddMapEntry(new Color(97, 87, 86)); + drop = ModContent.ItemType(); + disableSmartCursor = true; + adjTiles = new int[] { TileID.Platforms }; + } + + public override void PostSetDefaults() + { + Main.tileNoSunLight[Type] = false; + } + } +} diff --git a/Tiles/DraedonStructures/LaboratoryShelf.png b/Tiles/DraedonStructures/LaboratoryShelf.png new file mode 100644 index 0000000000..502930196a Binary files /dev/null and b/Tiles/DraedonStructures/LaboratoryShelf.png differ diff --git a/Tiles/DraedonStructures/RustedPipes.cs b/Tiles/DraedonStructures/RustedPipes.cs new file mode 100644 index 0000000000..d2eb2ebc8e --- /dev/null +++ b/Tiles/DraedonStructures/RustedPipes.cs @@ -0,0 +1,29 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Tiles.DraedonStructures +{ + public class RustedPipes : ModTile + { + public override void SetDefaults() + { + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; + Main.tileMerge[Type][ModContent.TileType()] = true; + + soundType = SoundID.Item; + soundStyle = 52; + dustType = 32; + minPick = 30; + drop = ModContent.ItemType(); + AddMapEntry(new Color(128, 90, 77)); + } + + public override void PlaceInWorld(int i, int j, Item item) + { + Main.PlaySound(SoundID.Item,i * 16, j * 16, 52, 0.75f, -0.5f); + } + } +} diff --git a/Tiles/DraedonStructures/RustedPipes.png b/Tiles/DraedonStructures/RustedPipes.png new file mode 100644 index 0000000000..0c2932e484 Binary files /dev/null and b/Tiles/DraedonStructures/RustedPipes.png differ diff --git a/Tiles/DraedonStructures/RustedPlating.cs b/Tiles/DraedonStructures/RustedPlating.cs new file mode 100644 index 0000000000..7c3f0d7770 --- /dev/null +++ b/Tiles/DraedonStructures/RustedPlating.cs @@ -0,0 +1,29 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Tiles.DraedonStructures +{ + public class RustedPlating : ModTile + { + public override void SetDefaults() + { + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; + + CalamityUtils.MergeWithGeneral(Type); + + soundType = SoundID.Tink; + dustType = 32; + minPick = 30; + drop = ModContent.ItemType(); + AddMapEntry(new Color(128, 90, 77)); + } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + return TileFraming.BetterGemsparkFraming(i, j, resetFrame); + } + } +} diff --git a/Tiles/DraedonStructures/RustedPlating.png b/Tiles/DraedonStructures/RustedPlating.png new file mode 100644 index 0000000000..585792143b Binary files /dev/null and b/Tiles/DraedonStructures/RustedPlating.png differ diff --git a/Tiles/DraedonStructures/RustedShelf.cs b/Tiles/DraedonStructures/RustedShelf.cs new file mode 100644 index 0000000000..a902efd115 --- /dev/null +++ b/Tiles/DraedonStructures/RustedShelf.cs @@ -0,0 +1,26 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.DraedonStructures +{ + public class RustedShelf : ModTile + { + public override void SetDefaults() + { + this.SetUpPlatform(); + soundType = SoundID.Tink; + dustType = 32; + AddMapEntry(new Color(128, 90, 77)); + drop = ModContent.ItemType(); + disableSmartCursor = true; + adjTiles = new int[] { TileID.Platforms }; + } + + public override void PostSetDefaults() + { + Main.tileNoSunLight[Type] = false; + } + } +} diff --git a/Tiles/DraedonStructures/RustedShelf.png b/Tiles/DraedonStructures/RustedShelf.png new file mode 100644 index 0000000000..6ebc8cbe19 Binary files /dev/null and b/Tiles/DraedonStructures/RustedShelf.png differ diff --git a/Tiles/DraedonTurretTile.cs b/Tiles/DraedonTurretTile.cs new file mode 100644 index 0000000000..f0e44dd1c4 --- /dev/null +++ b/Tiles/DraedonTurretTile.cs @@ -0,0 +1,97 @@ +using CalamityMod.Items.Placeables; +using CalamityMod.TileEntities; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class DraedonTurretTile : ModTile + { + public const int Width = 3; + public const int Height = 2; + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = true; + Main.tileWaterDeath[Type] = false; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); + TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(ModContent.GetInstance().Hook_AfterPlacement, -1, 0, true); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Turret"); + AddMapEntry(new Color(67, 72, 81), name); + soundType = SoundID.Item; + soundStyle = 14; + minPick = 65; + } + + public override bool CanExplode(int i, int j) => false; + + public TEDraedonTurret RetrieveTileEntity(int i, int j) + { + int left = i - Main.tile[i, j].frameX % (Width * 18) / 18; + int top = j - Main.tile[i, j].frameY % (Height * 18) / 18; + int determinedID = ModContent.GetInstance().Find(left, top); + if (determinedID == -1 || !(TileEntity.ByID[determinedID] is TEDraedonTurret)) + { + ModTileEntity modTileEntity = ModTileEntity.ConstructFromType(ModContent.GetInstance().type); + modTileEntity.Position = new Point16(left, top); + modTileEntity.ID = TileEntity.AssignNewID(); + modTileEntity.type = ModContent.GetInstance().type; + TileEntity.ByID[modTileEntity.ID] = modTileEntity; + TileEntity.ByPosition[modTileEntity.Position] = modTileEntity; + determinedID = modTileEntity.ID; + } + return (TEDraedonTurret)TileEntity.ByID[determinedID]; + } + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 226); + return false; + } + + public override bool HasSmartInteract() => true; + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + int left = i - Main.tile[i, j].frameX % (Width * 18) / 18; + int top = j - Main.tile[i, j].frameY % (Height * 18) / 18; + + RetrieveTileEntity(i, j).Kill(left, top); + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + Tile trackTile = Main.tile[i, j]; + if (trackTile.frameX != 36 || trackTile.frameY != 0) + return; + + // This is done so that the turret has priority over, say, trees when drawing. + spriteBatch.End(); + spriteBatch.Begin(SpriteSortMode.Texture, BlendState.AlphaBlend, SamplerState.LinearWrap, DepthStencilState.Default, RasterizerState.CullNone); + + TEDraedonTurret charger = RetrieveTileEntity(i, j); + Color drawColor = Lighting.GetColor(i, j); + + Texture2D drawTexture = ModContent.GetTexture("CalamityMod/Projectiles/DraedonsArsenal/PulseTurret"); + Vector2 screenOffset = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + screenOffset; + drawOffset.Y -= 2f; + drawOffset.X += charger.Direction == -1 ? -10 : 2; + float adjustedAngle = charger.Rotation; + spriteBatch.Draw(drawTexture, drawOffset, null, drawColor, adjustedAngle, drawTexture.Size() * 0.5f, 1f, charger.Direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0.0f); + } + } +} diff --git a/Tiles/DraedonTurretTile.png b/Tiles/DraedonTurretTile.png new file mode 100644 index 0000000000..6c46737713 Binary files /dev/null and b/Tiles/DraedonTurretTile.png differ diff --git a/Tiles/Furniture/BossTrophy.cs b/Tiles/Furniture/BossTrophy.cs index 752e6ce492..e6731142a8 100644 --- a/Tiles/Furniture/BossTrophy.cs +++ b/Tiles/Furniture/BossTrophy.cs @@ -110,6 +110,9 @@ namespace CalamityMod.Tiles.Furniture break; case 26: item = ModContent.ItemType(); + break; + case 27: + item = ModContent.ItemType(); break; } if (item > 0) diff --git a/Tiles/Furniture/BossTrophy.png b/Tiles/Furniture/BossTrophy.png index b521b489bd..3970e3d5cb 100644 Binary files a/Tiles/Furniture/BossTrophy.png and b/Tiles/Furniture/BossTrophy.png differ diff --git a/Tiles/Furniture/CraftingStations/StaticRefiner.cs b/Tiles/Furniture/CraftingStations/StaticRefiner.cs index 7329f743c6..6f976e1670 100644 --- a/Tiles/Furniture/CraftingStations/StaticRefiner.cs +++ b/Tiles/Furniture/CraftingStations/StaticRefiner.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; @@ -19,6 +20,8 @@ namespace CalamityMod.Tiles.Furniture.CraftingStations name.SetDefault("Static Refiner"); AddMapEntry(new Color(191, 142, 111), name); animationFrameHeight = 54; + //also counts as a Solidifier + adjTiles = new int[] { TileID.Solidifier }; } public override bool CreateDust(int i, int j, ref int type) @@ -115,18 +118,4 @@ namespace CalamityMod.Tiles.Furniture.CraftingStations Item.NewItem(i * 16, j * 16, 16, 32, ModContent.ItemType()); } } - - //class ExampleAnimatedTileItem : ModItem - //{ - // public override void SetStaticDefaults() - // { - // DisplayName.SetDefault("Red Firefly in a Bottle"); - // } - - // public override void SetDefaults() - // { - // item.CloneDefaults(ItemID.FireflyinaBottle); - // item.createTile = ModContent.TileType(); - // } - //} } diff --git a/Tiles/FurnitureCosmilite/CosmiliteBasinFlame.png b/Tiles/FurnitureCosmilite/CosmiliteBasinFlame.png new file mode 100644 index 0000000000..4bda7186c9 Binary files /dev/null and b/Tiles/FurnitureCosmilite/CosmiliteBasinFlame.png differ diff --git a/Tiles/FurnitureCosmilite/CosmiliteBasinTile.cs b/Tiles/FurnitureCosmilite/CosmiliteBasinTile.cs index a76b519ecc..78d10a7148 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteBasinTile.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteBasinTile.cs @@ -1,14 +1,18 @@ +using CalamityMod.Dusts; +using CalamityMod.Items.Placeables.FurnitureCosmilite; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; -using CalamityMod.Items.Placeables.FurnitureCosmilite; namespace CalamityMod.Tiles.FurnitureCosmilite { public class CosmiliteBasinTile : ModTile { + int animationFrame = 0; + public override void SetDefaults() { Main.tileLighted[Type] = true; @@ -42,6 +46,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite if (frameCounter >= 6) { frame = (frame + 1) % 6; + animationFrame = frame; frameCounter = 0; } } @@ -67,5 +72,19 @@ namespace CalamityMod.Tiles.FurnitureCosmilite { CalamityUtils.LightHitWire(Type, i, j, 3, 3); } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + CalamityUtils.DrawStaticFlameEffect(ModContent.GetTexture("CalamityMod/Tiles/FurnitureCosmilite/CosmiliteBasinFlame"), i, j, offsetY: animationFrame * animationFrameHeight); + } + + public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref Color drawColor, ref int nextSpecialDrawIndex) + { + Tile tile = Main.tile[i, j]; + if (tile.frameY == 18) + { + CalamityUtils.DrawFlameSparks((int)CalamityDusts.PurpleCosmolite, 5, i, j); + } + } } } \ No newline at end of file diff --git a/Tiles/FurnitureCosmilite/CosmiliteBasinTile.png b/Tiles/FurnitureCosmilite/CosmiliteBasinTile.png index 4abbed3430..cee44a5c37 100644 Binary files a/Tiles/FurnitureCosmilite/CosmiliteBasinTile.png and b/Tiles/FurnitureCosmilite/CosmiliteBasinTile.png differ diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateBasin.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateBasin.cs index 715a6364c9..b347cb7106 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateBasin.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateBasin.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3); TileObjectData.addTile(Type); ModTranslation name = CreateMapEntryName(); - name.SetDefault("Plagued Plate Basin"); + name.SetDefault("Broken Plagued 'Bed'"); AddMapEntry(new Color(191, 142, 111), name); animationFrameHeight = 54; adjTiles = new int[] { TileID.Torches }; diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateBathtub.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateBathtub.cs index 1407f722ed..19408b8b9e 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateBathtub.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateBathtub.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate { this.SetUpBathtub(); ModTranslation name = CreateMapEntryName(); - name.SetDefault("Plagued Plate Bathtub"); + name.SetDefault("Plagued Bathtub"); AddMapEntry(new Color(191, 142, 111), name); animationFrameHeight = 54; } diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateBed.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateBed.cs index b82ca24cdb..49617315ee 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateBed.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateBed.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16 }; TileObjectData.addTile(Type); ModTranslation name = CreateMapEntryName(); - name.SetDefault("Plagued Plate Bed"); + name.SetDefault("Plagued 'Bed'"); AddMapEntry(new Color(191, 142, 111), name); disableSmartCursor = true; adjTiles = new int[] { TileID.Beds }; diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateBookcase.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateBookcase.cs index 795a1f1d4c..d9e45274b3 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateBookcase.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateBookcase.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate { this.SetUpBookcase(); ModTranslation name = CreateMapEntryName(); - name.SetDefault("Plagued Plate Bookcase"); + name.SetDefault("Plagued Bookcase"); AddMapEntry(new Color(191, 142, 111), name); animationFrameHeight = 54; adjTiles = new int[] { TileID.Bookcases }; diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateCandelabra.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateCandelabra.cs index 3bd19e9fe6..03b0b1822f 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateCandelabra.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateCandelabra.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate { this.SetUpCandelabra(); ModTranslation name = CreateMapEntryName(); - name.SetDefault("Plagued Plate Candelabra"); + name.SetDefault("Plagued Candelabra"); AddMapEntry(new Color(191, 142, 111), name); disableSmartCursor = true; adjTiles = new int[] { TileID.Torches }; diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateCandle.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateCandle.cs index 8f09930fe4..6984047344 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateCandle.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateCandle.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate { this.SetUpCandle(); ModTranslation name = CreateMapEntryName(); - name.SetDefault("Plagued Plate Candle"); + name.SetDefault("Plagued Candle"); AddMapEntry(new Color(191, 142, 111), name); disableSmartCursor = true; adjTiles = new int[] { TileID.Torches }; diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateChair.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateChair.cs index fad963fbc4..fb5a52cb4b 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateChair.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateChair.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate { this.SetUpChair(); ModTranslation name = CreateMapEntryName(); - name.SetDefault("Plagued Plate Chair"); + name.SetDefault("Plagued Chair"); AddMapEntry(new Color(191, 142, 111), name); disableSmartCursor = true; adjTiles = new int[] { TileID.Chairs }; diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateChandelier.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateChandelier.cs index 858b3573d8..3b4e6e4908 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateChandelier.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateChandelier.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate { this.SetUpChandelier(); ModTranslation name = CreateMapEntryName(); - name.SetDefault("Plagued Plate Chandelier"); + name.SetDefault("Plagued Chandelier"); AddMapEntry(new Color(191, 142, 111), name); adjTiles = new int[] { TileID.Torches }; } diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateChest.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateChest.cs index 3cb997487f..202022340e 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateChest.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateChest.cs @@ -11,11 +11,11 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate { this.SetUpChest(); ModTranslation name = CreateMapEntryName(); - name.SetDefault("Plagued Plate Chest"); + name.SetDefault("Plagued Chest"); AddMapEntry(new Color(191, 142, 111), name, MapChestName); disableSmartCursor = true; adjTiles = new int[] { TileID.Containers }; - chest = "Plagued Plate Chest"; + chest = "Plagued Chest"; chestDrop = ModContent.ItemType(); } @@ -72,12 +72,12 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate public override void MouseOver(int i, int j) { - CalamityUtils.ChestMouseOver("PlaguedPlate Chest", i, j); + CalamityUtils.ChestMouseOver("Plagued Chest", i, j); } public override void MouseOverFar(int i, int j) { - CalamityUtils.ChestMouseFar("PlaguedPlate Chest", i, j); + CalamityUtils.ChestMouseFar("Plagued Chest", i, j); } } } diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateClock.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateClock.cs index e5561e60ad..2c7cb5285d 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateClock.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateClock.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate { this.SetUpClock(); ModTranslation name = CreateMapEntryName(); - name.SetDefault("Plagued Plate Clock"); + name.SetDefault("Plagued Clock"); AddMapEntry(new Color(191, 142, 111), name); adjTiles = new int[] { TileID.GrandfatherClocks }; } diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateDoorClosed.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateDoorClosed.cs index d963e78f62..597eb93cea 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateDoorClosed.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateDoorClosed.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate { this.SetUpDoorClosed(); ModTranslation name = CreateMapEntryName(); - name.SetDefault("Plagued Plate Door"); + name.SetDefault("Plagued Door"); AddMapEntry(new Color(191, 142, 111), name); disableSmartCursor = true; adjTiles = new int[] { TileID.ClosedDoor }; diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateDoorOpen.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateDoorOpen.cs index 42cccce9ea..8c758742c8 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateDoorOpen.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateDoorOpen.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate { this.SetUpDoorOpen(); ModTranslation name = CreateMapEntryName(); - name.SetDefault("Plagued Plate Door"); + name.SetDefault("Plagued Door"); AddMapEntry(new Color(191, 142, 111), name); disableSmartCursor = true; adjTiles = new int[] { TileID.OpenDoor }; diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateDresser.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateDresser.cs index 4f5605ba8a..103380a6bd 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateDresser.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateDresser.cs @@ -11,11 +11,11 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate { this.SetUpDresser(); ModTranslation name = CreateMapEntryName(); - name.SetDefault("Plagued Plate Dresser"); + name.SetDefault("Plagued Dresser"); AddMapEntry(new Color(191, 142, 111), name); disableSmartCursor = true; adjTiles = new int[] { TileID.Dressers }; - dresser = "Plagued Plate Dresser"; + dresser = "Plagued Dresser"; dresserDrop = ModContent.ItemType(); } diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateLamp.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateLamp.cs index f364ec2d11..719a4f314b 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateLamp.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateLamp.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate { this.SetUpLamp(); ModTranslation name = CreateMapEntryName(); - name.SetDefault("Plagued Plate Lamp"); + name.SetDefault("Plagued Lamp"); AddMapEntry(new Color(191, 142, 111), name); disableSmartCursor = true; diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateLantern.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateLantern.cs index 59d3e00e14..8c1e9f1121 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateLantern.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateLantern.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate { this.SetUpLantern(); ModTranslation name = CreateMapEntryName(); - name.SetDefault("Plagued Plate Lantern"); + name.SetDefault("Plagued Lantern"); AddMapEntry(new Color(191, 142, 111), name); disableSmartCursor = true; diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlatePiano.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlatePiano.cs index a3e021ae19..441a7c2b65 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlatePiano.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlatePiano.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate { this.SetUpPiano(); ModTranslation name = CreateMapEntryName(); - name.SetDefault("Plagued Plate Piano"); + name.SetDefault("Plagued Piano"); AddMapEntry(new Color(191, 142, 111), name); } diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateSink.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateSink.cs index 9a8b223dea..2e4f15ec01 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateSink.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateSink.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate { this.SetUpSink(); ModTranslation name = CreateMapEntryName(); - name.SetDefault("Plagued Plate Sink"); + name.SetDefault("Plagued Sink"); AddMapEntry(new Color(191, 142, 111), name); adjTiles = new int[] { TileID.Sinks }; } diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateSofa.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateSofa.cs index f8f31854b4..475c8e8907 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateSofa.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateSofa.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate { this.SetUpSofa(); ModTranslation name = CreateMapEntryName(); - name.SetDefault("Plagued Plate Sofa"); + name.SetDefault("Plagued Sofa"); AddMapEntry(new Color(191, 142, 111), name); } diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateTable.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateTable.cs index 5cf9adf1c4..f04d26e2f9 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateTable.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateTable.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate { this.SetUpTable(); ModTranslation name = CreateMapEntryName(); - name.SetDefault("Plagued Plate Table"); + name.SetDefault("Plagued Table"); AddMapEntry(new Color(191, 142, 111), name); adjTiles = new int[] { TileID.Tables }; } diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateWorkbench.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateWorkbench.cs index 8270c355f0..6a824f0ec5 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateWorkbench.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateWorkbench.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate { this.SetUpWorkBench(); ModTranslation name = CreateMapEntryName(); - name.SetDefault("Plagued Plate Work Bench"); + name.SetDefault("Plagued Work Bench"); AddMapEntry(new Color(191, 142, 111), name); disableSmartCursor = true; adjTiles = new int[] { TileID.WorkBenches }; diff --git a/Tiles/InactiveDraedonFuelFactory.cs b/Tiles/InactiveDraedonFuelFactory.cs new file mode 100644 index 0000000000..c4b27ceef8 --- /dev/null +++ b/Tiles/InactiveDraedonFuelFactory.cs @@ -0,0 +1,50 @@ +using CalamityMod.Items.Placeables; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class InactiveDraedonFuelFactory : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileTable[Type] = true; + Main.tileLavaDeath[Type] = true; + Main.tileWaterDeath[Type] = false; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.Width = 4; + TileObjectData.newTile.Height = 4; + TileObjectData.newTile.Origin = new Point16(0, 3); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16 }; + TileObjectData.newTile.CoordinatePadding = 0; + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Inactive Fuel Factory"); + AddMapEntry(new Color(67, 72, 81), name); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 226); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 32, 32, ModContent.ItemType()); + } + } +} diff --git a/Tiles/InactiveDraedonFuelFactory.png b/Tiles/InactiveDraedonFuelFactory.png new file mode 100644 index 0000000000..44a65635b3 Binary files /dev/null and b/Tiles/InactiveDraedonFuelFactory.png differ diff --git a/Tiles/MonsterBanner.cs b/Tiles/MonsterBanner.cs index badcf2fa13..b7b751bb1e 100644 --- a/Tiles/MonsterBanner.cs +++ b/Tiles/MonsterBanner.cs @@ -404,6 +404,18 @@ namespace CalamityMod.Tiles case 122: item = "GammaSlimeBanner"; break; + case 123: + item = "WulfrumGyratorBanner"; + break; + case 124: + item = "WulfrumHovercraftBanner"; + break; + case 125: + item = "WulfrumRoverBanner"; + break; + case 126: + item = "WulfrumPylonBanner"; + break; default: return; } @@ -791,6 +803,18 @@ namespace CalamityMod.Tiles case 122: type = "GammaSlime"; break; + case 123: + type = "WulfrumGyrator"; + break; + case 124: + type = "WulfrumHovercraft"; + break; + case 125: + type = "WulfrumRover"; + break; + case 126: + type = "WulfrumPylon"; + break; default: return; } diff --git a/Tiles/MonsterBanner.png b/Tiles/MonsterBanner.png index 7ed76e138c..c458c2b7fa 100644 Binary files a/Tiles/MonsterBanner.png and b/Tiles/MonsterBanner.png differ diff --git a/Tiles/Cinderplate.cs b/Tiles/Plates/Chaosplate.cs similarity index 67% rename from Tiles/Cinderplate.cs rename to Tiles/Plates/Chaosplate.cs index d3d9126417..2e72391f1d 100644 --- a/Tiles/Cinderplate.cs +++ b/Tiles/Plates/Chaosplate.cs @@ -5,9 +5,9 @@ using Terraria; using Terraria.ModLoader; using Terraria.ID; -namespace CalamityMod.Tiles +namespace CalamityMod.Tiles.Plates { - public class Cinderplate : ModTile + public class Chaosplate : ModTile { public override void SetDefaults() { @@ -20,8 +20,8 @@ namespace CalamityMod.Tiles soundType = SoundID.Tink; mineResist = 1f; minPick = 65; - drop = ModContent.ItemType(); - AddMapEntry(new Color(173, 52, 70)); + drop = ModContent.ItemType(); + AddMapEntry(new Color(235, 108, 108)); } public override bool CreateDust(int i, int j, ref int type) @@ -31,14 +31,31 @@ namespace CalamityMod.Tiles return false; } + public override void RandomUpdate(int i, int j) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); + } + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { int xPos = Main.tile[i, j].frameX; int yPos = Main.tile[i, j].frameY; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/CinderplateGlow"); + Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/Plates/ChaosplateGlow"); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; - Color drawColour = GetDrawColour(i, j, new Color(50, 50, 50, 50)); + + // Glowmask 'pulse' effect + Texture2D pulseMap = ModContent.GetTexture("CalamityMod/Tiles/Plates/ChaosplatePulse"); + int factor = (int)Main.time % pulseMap.Width; + Color[] pulseColours = new Color[pulseMap.Width]; + pulseMap.GetData(pulseColours); + float brightness = pulseColours[factor].R / 255f; + int drawBrightness = (int)(40 * brightness) + 10; + Color drawColour = GetDrawColour(i, j, new Color(drawBrightness, drawBrightness, drawBrightness, drawBrightness)); + + // If these tiles cause lag, comment out the pulse effect code and uncomment this: + //Color drawColour = GetDrawColour(i, j, new Color(50, 50, 50, 50)); + Tile trackTile = Main.tile[i, j]; double num6 = Main.time * 0.08; if (!trackTile.halfBrick() && trackTile.slope() == 0) diff --git a/Tiles/Plates/Chaosplate.png b/Tiles/Plates/Chaosplate.png new file mode 100644 index 0000000000..aeb2fc91aa Binary files /dev/null and b/Tiles/Plates/Chaosplate.png differ diff --git a/Tiles/Plates/ChaosplateGlow.png b/Tiles/Plates/ChaosplateGlow.png new file mode 100644 index 0000000000..cccfe956a6 Binary files /dev/null and b/Tiles/Plates/ChaosplateGlow.png differ diff --git a/Tiles/Plates/ChaosplatePulse.png b/Tiles/Plates/ChaosplatePulse.png new file mode 100644 index 0000000000..2fb57b9051 Binary files /dev/null and b/Tiles/Plates/ChaosplatePulse.png differ diff --git a/Tiles/Plates/Cinderplate.cs b/Tiles/Plates/Cinderplate.cs new file mode 100644 index 0000000000..9929c9dda5 --- /dev/null +++ b/Tiles/Plates/Cinderplate.cs @@ -0,0 +1,84 @@ + +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Tiles.Plates +{ + public class Cinderplate : ModTile + { + public override void SetDefaults() + { + Main.tileSolid[Type] = true; + Main.tileMergeDirt[Type] = true; + Main.tileBlockLight[Type] = true; + + CalamityUtils.MergeWithGeneral(Type); + + soundType = SoundID.Tink; + mineResist = 1f; + minPick = 65; + drop = ModContent.ItemType(); + AddMapEntry(new Color(242, 216, 131)); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 6, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + return false; + } + + public override void RandomUpdate(int i, int j) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 6, 0f, 0f, 1, new Color(255, 255, 255), 1f); + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + int xPos = Main.tile[i, j].frameX; + int yPos = Main.tile[i, j].frameY; + Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/Plates/CinderplateGlow"); + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; + + // Glowmask 'pulse' effect + Texture2D pulseMap = ModContent.GetTexture("CalamityMod/Tiles/Plates/CinderplatePulse"); + int factor = (int)Main.time % pulseMap.Width; + Color[] pulseColours = new Color[pulseMap.Width]; + pulseMap.GetData(pulseColours); + float brightness = pulseColours[factor].R / 255f; + int drawBrightness = (int)(40 * brightness) + 10; + Color drawColour = GetDrawColour(i, j, new Color(drawBrightness, drawBrightness, drawBrightness, drawBrightness)); + + // If these tiles cause lag, comment out the pulse effect code and uncomment this: + //Color drawColour = GetDrawColour(i, j, new Color(50, 50, 50, 50)); + + Tile trackTile = Main.tile[i, j]; + double num6 = Main.time * 0.08; + if (!trackTile.halfBrick() && trackTile.slope() == 0) + { + Main.spriteBatch.Draw(glowmask, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + else if (trackTile.halfBrick()) + { + Main.spriteBatch.Draw(glowmask, drawOffset + new Vector2(0f, 8f), new Rectangle?(new Rectangle(xPos, yPos, 18, 8)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + } + + private Color GetDrawColour(int i, int j, Color colour) + { + int colType = Main.tile[i, j].color(); + Color paintCol = WorldGen.paintColor(colType); + if (colType >= 13 && colType <= 24) + { + colour.R = (byte)(paintCol.R / 255f * colour.R); + colour.G = (byte)(paintCol.G / 255f * colour.G); + colour.B = (byte)(paintCol.B / 255f * colour.B); + } + return colour; + } + } +} diff --git a/Tiles/Plates/Cinderplate.png b/Tiles/Plates/Cinderplate.png new file mode 100644 index 0000000000..4b5b43fded Binary files /dev/null and b/Tiles/Plates/Cinderplate.png differ diff --git a/Tiles/Plates/CinderplateGlow.png b/Tiles/Plates/CinderplateGlow.png new file mode 100644 index 0000000000..bbaecf7f25 Binary files /dev/null and b/Tiles/Plates/CinderplateGlow.png differ diff --git a/Tiles/Plates/CinderplatePulse.png b/Tiles/Plates/CinderplatePulse.png new file mode 100644 index 0000000000..e4bcddc1d0 Binary files /dev/null and b/Tiles/Plates/CinderplatePulse.png differ diff --git a/Tiles/Plates/Elumplate.cs b/Tiles/Plates/Elumplate.cs new file mode 100644 index 0000000000..a9543aeee3 --- /dev/null +++ b/Tiles/Plates/Elumplate.cs @@ -0,0 +1,84 @@ + +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Tiles.Plates +{ + public class Elumplate : ModTile + { + public override void SetDefaults() + { + Main.tileSolid[Type] = true; + Main.tileMergeDirt[Type] = true; + Main.tileBlockLight[Type] = true; + + CalamityUtils.MergeWithGeneral(Type); + + soundType = SoundID.Tink; + mineResist = 1f; + minPick = 65; + drop = ModContent.ItemType(); + AddMapEntry(new Color(121, 180, 212)); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 247, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + return false; + } + + public override void RandomUpdate(int i, int j) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 247, 0f, 0f, 1, new Color(255, 255, 255), 1f); + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + int xPos = Main.tile[i, j].frameX; + int yPos = Main.tile[i, j].frameY; + Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/Plates/ElumplateGlow"); + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; + + // Glowmask 'pulse' effect + Texture2D pulseMap = ModContent.GetTexture("CalamityMod/Tiles/Plates/ElumplatePulse"); + int factor = (int)Main.time % pulseMap.Width; + Color[] pulseColours = new Color[pulseMap.Width]; + pulseMap.GetData(pulseColours); + float brightness = pulseColours[factor].R / 255f; + int drawBrightness = (int)(40 * brightness) + 10; + Color drawColour = GetDrawColour(i, j, new Color(drawBrightness, drawBrightness, drawBrightness, drawBrightness)); + + // If these tiles cause lag, comment out the pulse effect code and uncomment this: + //Color drawColour = GetDrawColour(i, j, new Color(50, 50, 50, 50)); + + Tile trackTile = Main.tile[i, j]; + double num6 = Main.time * 0.08; + if (!trackTile.halfBrick() && trackTile.slope() == 0) + { + Main.spriteBatch.Draw(glowmask, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + else if (trackTile.halfBrick()) + { + Main.spriteBatch.Draw(glowmask, drawOffset + new Vector2(0f, 8f), new Rectangle?(new Rectangle(xPos, yPos, 18, 8)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + } + + private Color GetDrawColour(int i, int j, Color colour) + { + int colType = Main.tile[i, j].color(); + Color paintCol = WorldGen.paintColor(colType); + if (colType >= 13 && colType <= 24) + { + colour.R = (byte)(paintCol.R / 255f * colour.R); + colour.G = (byte)(paintCol.G / 255f * colour.G); + colour.B = (byte)(paintCol.B / 255f * colour.B); + } + return colour; + } + } +} diff --git a/Tiles/Plates/Elumplate.png b/Tiles/Plates/Elumplate.png new file mode 100644 index 0000000000..10fd4a2629 Binary files /dev/null and b/Tiles/Plates/Elumplate.png differ diff --git a/Tiles/Plates/ElumplateGlow.png b/Tiles/Plates/ElumplateGlow.png new file mode 100644 index 0000000000..a66090b823 Binary files /dev/null and b/Tiles/Plates/ElumplateGlow.png differ diff --git a/Tiles/Plates/ElumplatePulse.png b/Tiles/Plates/ElumplatePulse.png new file mode 100644 index 0000000000..8ad87197d6 Binary files /dev/null and b/Tiles/Plates/ElumplatePulse.png differ diff --git a/Tiles/Plates/Navyplate.cs b/Tiles/Plates/Navyplate.cs new file mode 100644 index 0000000000..22d78b4f28 --- /dev/null +++ b/Tiles/Plates/Navyplate.cs @@ -0,0 +1,84 @@ + +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Tiles.Plates +{ + public class Navyplate : ModTile + { + public override void SetDefaults() + { + Main.tileSolid[Type] = true; + Main.tileMergeDirt[Type] = true; + Main.tileBlockLight[Type] = true; + + CalamityUtils.MergeWithGeneral(Type); + + soundType = SoundID.Tink; + mineResist = 1f; + minPick = 65; + drop = ModContent.ItemType(); + AddMapEntry(new Color(85, 151, 196)); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 187, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + return false; + } + + public override void RandomUpdate(int i, int j) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 187, 0f, 0f, 1, new Color(255, 255, 255), 1f); + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + int xPos = Main.tile[i, j].frameX; + int yPos = Main.tile[i, j].frameY; + Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/Plates/NavyplateGlow"); + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; + + // Glowmask 'pulse' effect + Texture2D pulseMap = ModContent.GetTexture("CalamityMod/Tiles/Plates/NavyplatePulse"); + int factor = (int)Main.time % pulseMap.Width; + Color[] pulseColours = new Color[pulseMap.Width]; + pulseMap.GetData(pulseColours); + float brightness = pulseColours[factor].R / 255f; + int drawBrightness = (int)(40 * brightness) + 10; + Color drawColour = GetDrawColour(i, j, new Color(drawBrightness, drawBrightness, drawBrightness, drawBrightness)); + + // If these tiles cause lag, comment out the pulse effect code and uncomment this: + //Color drawColour = GetDrawColour(i, j, new Color(50, 50, 50, 50)); + + Tile trackTile = Main.tile[i, j]; + double num6 = Main.time * 0.08; + if (!trackTile.halfBrick() && trackTile.slope() == 0) + { + Main.spriteBatch.Draw(glowmask, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + else if (trackTile.halfBrick()) + { + Main.spriteBatch.Draw(glowmask, drawOffset + new Vector2(0f, 8f), new Rectangle?(new Rectangle(xPos, yPos, 18, 8)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + } + + private Color GetDrawColour(int i, int j, Color colour) + { + int colType = Main.tile[i, j].color(); + Color paintCol = WorldGen.paintColor(colType); + if (colType >= 13 && colType <= 24) + { + colour.R = (byte)(paintCol.R / 255f * colour.R); + colour.G = (byte)(paintCol.G / 255f * colour.G); + colour.B = (byte)(paintCol.B / 255f * colour.B); + } + return colour; + } + } +} diff --git a/Tiles/Plates/Navyplate.png b/Tiles/Plates/Navyplate.png new file mode 100644 index 0000000000..f0e2e5bdc7 Binary files /dev/null and b/Tiles/Plates/Navyplate.png differ diff --git a/Tiles/Plates/NavyplateGlow.png b/Tiles/Plates/NavyplateGlow.png new file mode 100644 index 0000000000..e00fb661fd Binary files /dev/null and b/Tiles/Plates/NavyplateGlow.png differ diff --git a/Tiles/Plates/NavyplatePulse.png b/Tiles/Plates/NavyplatePulse.png new file mode 100644 index 0000000000..3d6fb772f1 Binary files /dev/null and b/Tiles/Plates/NavyplatePulse.png differ diff --git a/Tiles/Plates/PlagueContainmentCells.cs b/Tiles/Plates/PlagueContainmentCells.cs new file mode 100644 index 0000000000..29dfb1d420 --- /dev/null +++ b/Tiles/Plates/PlagueContainmentCells.cs @@ -0,0 +1,89 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Tiles.Plates +{ + public class PlagueContainmentCells : ModTile + { + public override void SetDefaults() + { + Main.tileSolid[Type] = true; + Main.tileMergeDirt[Type] = true; + Main.tileBlockLight[Type] = true; + + CalamityUtils.MergeWithGeneral(Type); + + soundType = SoundID.Tink; + mineResist = 1f; + minPick = 65; + drop = ModContent.ItemType(); + AddMapEntry(new Color(128, 188, 67)); + } + + public override bool CreateDust(int i, int j, ref int type) + { + int dust = Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 89, 0f, 0f, 100, default, 2f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity.Y = -0.15f; + + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + return false; + } + + public override void RandomUpdate(int i, int j) + { + int dust = Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 89, 0f, 0f, 100, default, 2f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity.Y = -0.15f; + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + int xPos = Main.tile[i, j].frameX; + int yPos = Main.tile[i, j].frameY; + Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/Plates/PlagueContainmentCellsGlow"); + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; + + // Glowmask 'pulse' effect + Texture2D pulseMap = ModContent.GetTexture("CalamityMod/Tiles/Plates/PlagueContainmentCellsPulse"); + int factor = (int)Main.time % pulseMap.Width; + Color[] pulseColours = new Color[pulseMap.Width]; + pulseMap.GetData(pulseColours); + float brightness = pulseColours[factor].R / 255f; + int drawBrightness = (int)(40 * brightness) + 10; + Color drawColour = GetDrawColour(i, j, new Color(drawBrightness, drawBrightness, drawBrightness, drawBrightness)); + + // If these tiles cause lag, comment out the pulse effect code and uncomment this: + //Color drawColour = GetDrawColour(i, j, new Color(50, 50, 50, 50)); + + Tile trackTile = Main.tile[i, j]; + double num6 = Main.time * 0.08; + if (!trackTile.halfBrick() && trackTile.slope() == 0) + { + Main.spriteBatch.Draw(glowmask, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + else if (trackTile.halfBrick()) + { + Main.spriteBatch.Draw(glowmask, drawOffset + new Vector2(0f, 8f), new Rectangle?(new Rectangle(xPos, yPos, 18, 8)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + } + + private Color GetDrawColour(int i, int j, Color colour) + { + int colType = Main.tile[i, j].color(); + Color paintCol = WorldGen.paintColor(colType); + if (colType >= 13 && colType <= 24) + { + colour.R = (byte)(paintCol.R / 255f * colour.R); + colour.G = (byte)(paintCol.G / 255f * colour.G); + colour.B = (byte)(paintCol.B / 255f * colour.B); + } + return colour; + } + } +} diff --git a/Tiles/Plates/PlagueContainmentCells.png b/Tiles/Plates/PlagueContainmentCells.png new file mode 100644 index 0000000000..8e263be09a Binary files /dev/null and b/Tiles/Plates/PlagueContainmentCells.png differ diff --git a/Tiles/Plates/PlagueContainmentCellsGlow.png b/Tiles/Plates/PlagueContainmentCellsGlow.png new file mode 100644 index 0000000000..32cb9f8aed Binary files /dev/null and b/Tiles/Plates/PlagueContainmentCellsGlow.png differ diff --git a/Tiles/Plates/PlagueContainmentCellsPulse.png b/Tiles/Plates/PlagueContainmentCellsPulse.png new file mode 100644 index 0000000000..4b36b473c6 Binary files /dev/null and b/Tiles/Plates/PlagueContainmentCellsPulse.png differ diff --git a/Tiles/SecurityChestTile.cs b/Tiles/SecurityChestTile.cs new file mode 100644 index 0000000000..9e1bb85cc5 --- /dev/null +++ b/Tiles/SecurityChestTile.cs @@ -0,0 +1,72 @@ +using CalamityMod.Items.Placeables.Furniture; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles +{ + public class SecurityChestTile : ModTile + { + public override void SetDefaults() + { + this.SetUpChest(); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Security Chest"); + AddMapEntry(new Color(130, 119, 115), name, MapChestName); + disableSmartCursor = true; + adjTiles = new int[] { TileID.Containers }; + chest = "Security Chest"; + chestDrop = ModContent.ItemType(); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 226, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override bool HasSmartInteract() => true; + + public string MapChestName(string name, int i, int j) + { + int left = i; + int top = j; + Tile tile = Main.tile[i, j]; + + if (tile.frameX % 36 != 0) + left--; + if (tile.frameY != 0) + top--; + + int chest = Chest.FindChest(left, top); + if (Main.chest[chest].name == "") + return name; + else + return name + ": " + Main.chest[chest].name; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 32, 32, chestDrop); + Chest.DestroyChest(i, j); + } + + public override bool NewRightClick(int i, int j) => CalamityUtils.ChestRightClick(i, j); + + public override void MouseOver(int i, int j) + { + CalamityUtils.ChestMouseOver("Security Chest", i, j); + } + + public override void MouseOverFar(int i, int j) + { + CalamityUtils.ChestMouseFar("Security Chest", i, j); + } + } +} diff --git a/Tiles/SecurityChestTile.png b/Tiles/SecurityChestTile.png new file mode 100644 index 0000000000..0d0daefcb2 Binary files /dev/null and b/Tiles/SecurityChestTile.png differ diff --git a/Tiles/SecurityChestTile_Highlight.png b/Tiles/SecurityChestTile_Highlight.png new file mode 100644 index 0000000000..fab60b0941 Binary files /dev/null and b/Tiles/SecurityChestTile_Highlight.png differ diff --git a/UI/DraedonHologramChatUI.cs b/UI/DraedonHologramChatUI.cs new file mode 100644 index 0000000000..3f682c0a00 --- /dev/null +++ b/UI/DraedonHologramChatUI.cs @@ -0,0 +1,64 @@ +using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System.Collections.Generic; +using Terraria; + +namespace CalamityMod.UI +{ + public class DraedonHologramChatUI + { + public static List DialogOptions = new List() + { + "Please help. I'm stuck in this hologram machine." + }; + public const float TextPadding = 170f; + public const float TextAreaWidth = 800f; + public const float YOffsetPerLine = 30f; + public static void Draw(SpriteBatch spriteBatch) + { + CalamityPlayer player = Main.LocalPlayer.Calamity(); + if (player.CurrentlyViewedHologramX == -1 || player.CurrentlyViewedHologramY == -1) + return; + + if (string.IsNullOrEmpty(player.CurrentlyViewedHologramText)) + player.CurrentlyViewedHologramText = DialogOptions[Main.rand.Next(DialogOptions.Count)]; + + Color backgroundColor = new Color(200, 200, 200, 200); + string[] dialogLines = Utils.WordwrapString(player.CurrentlyViewedHologramText, Main.fontMouseText, (int)(TextAreaWidth - TextPadding * 2), 10, out int lineCount); + spriteBatch.Draw(Main.chatBackTexture, + new Vector2(Main.screenWidth / 2 - Main.chatBackTexture.Width / 2, 100f), + new Rectangle(0, 0, Main.chatBackTexture.Width, (lineCount + 2) * 30), + backgroundColor, + 0f, + Vector2.Zero, + 1f, + SpriteEffects.None, + 0f); + spriteBatch.Draw(Main.chatBackTexture, + new Vector2(Main.screenWidth / 2 - Main.chatBackTexture.Width / 2, 100 + (lineCount + 2) * 30), + new Rectangle(0, Main.chatBackTexture.Height - 30, Main.chatBackTexture.Width, 30), + backgroundColor, + 0f, + Vector2.Zero, + 1f, + SpriteEffects.None, + 0f); + + for (int i = 0; i < lineCount + 1; i++) + { + if (dialogLines[i] != null) + { + Utils.DrawBorderStringFourWay(spriteBatch, + Main.fontMouseText, + dialogLines[i], + (int)TextPadding + (int)(Main.screenWidth - TextAreaWidth) / 2, + 120 + i * YOffsetPerLine, + Color.Cyan, + Color.Black, + Vector2.Zero); + } + } + } + } +} diff --git a/UI/DraedonsFactoryUI.cs b/UI/DraedonsFactoryUI.cs new file mode 100644 index 0000000000..e9bd2e36b3 --- /dev/null +++ b/UI/DraedonsFactoryUI.cs @@ -0,0 +1,62 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.UI; + +namespace CalamityMod.UI +{ + public class DraedonsFactoryUI + { + public static void Draw(SpriteBatch spriteBatch) + { + if (Main.LocalPlayer.Calamity().CurrentlyViewedFactory != null) + { + Item fuel = Main.LocalPlayer.Calamity().CurrentlyViewedFactory.HeldItem; + Vector2 position = new Vector2(Main.LocalPlayer.Calamity().CurrentlyViewedFactoryX, Main.LocalPlayer.Calamity().CurrentlyViewedFactoryY); + + // Draw the fuel as an inventory slot. + ItemSlot.Draw(spriteBatch, ref fuel, 0, position + new Vector2(0f, -54f) - Main.screenPosition); + + int width = 36, height = 40; + Rectangle mouseRectangle = new Rectangle((int)Main.MouseWorld.X, (int)Main.MouseWorld.Y, 2, 2); + Rectangle drawnItemRectangle = new Rectangle((int)position.X, (int)position.Y - 60, width, height); + if (mouseRectangle.Intersects(drawnItemRectangle) && fuel.stack > 0) + { + Main.HoverItem = fuel.Clone(); + // Take items from the chest if the item is clicked. + bool alreadyUsedItem = UseFuel(ref Main.mouseItem, ref fuel); + if (!alreadyUsedItem) + UseFuel(ref Main.LocalPlayer.inventory[Main.LocalPlayer.selectedItem], ref fuel); + if (Main.netMode == NetmodeID.MultiplayerClient) + { + var netMessage = CalamityMod.Instance.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.DraedonGeneratorStackSync); + netMessage.Write(Main.LocalPlayer.Calamity().CurrentlyViewedFactory.ID); + netMessage.Write(fuel.stack); + netMessage.Send(); + } + Main.blockMouse = Main.LocalPlayer.ActiveItem().pick <= 0; // Block mouse input if hovering over the item UI and not holding a pickaxe. + } + } + } + public static bool UseFuel(ref Item itemToUse, ref Item fuel) + { + if (Main.mouseLeft) + { + Main.playerInventory = true; + Main.recBigList = false; + if (itemToUse.type == fuel.type || itemToUse.type == ItemID.None) + { + itemToUse = fuel.Clone(); + int stack = itemToUse.stack; + itemToUse.SetDefaults(itemToUse.type); + itemToUse.stack = stack; + fuel.stack = 0; + return true; + } + } + return false; + } + } +} diff --git a/UI/DraedonsItemChargerUI.cs b/UI/DraedonsItemChargerUI.cs new file mode 100644 index 0000000000..41620446b1 --- /dev/null +++ b/UI/DraedonsItemChargerUI.cs @@ -0,0 +1,147 @@ +using CalamityMod.Items; +using CalamityMod.TileEntities; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.UI; + +namespace CalamityMod.UI +{ + public class DraedonsItemChargerUI + { + public static int RectangleWidth => (int)(40 / Main.GameViewMatrix.Zoom.X); + public static int RectangleHeight => (int)(40 / Main.GameViewMatrix.Zoom.Y); + public static Vector2 ChargerPosition => new Vector2(Main.LocalPlayer.Calamity().CurrentlyViewedChargerX, Main.LocalPlayer.Calamity().CurrentlyViewedChargerY); + public static Rectangle FuelIconBounds => new Rectangle((int)ChargerPosition.X - RectangleWidth / 2 + 8, (int)ChargerPosition.Y - 54, RectangleWidth, RectangleHeight); + public static Rectangle ChargingItemIconBounds => new Rectangle((int)ChargerPosition.X - RectangleWidth / 2 + 8, (int)ChargerPosition.Y - 94, RectangleWidth, RectangleHeight); + public static void Draw(SpriteBatch spriteBatch) + { + if (Main.LocalPlayer.Calamity().CurrentlyViewedCharger != null) + { + ref TEDraedonItemCharger charger = ref Main.LocalPlayer.Calamity().CurrentlyViewedCharger; + ref int depositWithdrawCooldown = ref charger.DepositWithdrawCooldown; + ref Item itemBeingCharged = ref charger.ItemBeingCharged; + ref Item fuel = ref charger.FuelItem; + + // Draw the fuel as an inventory slot. + ItemSlot.Draw(spriteBatch, ref fuel, 0, ChargerPosition + new Vector2(8f, -54f) - Main.screenPosition); + + // Draw the item being charged as an inventory slot. + ItemSlot.Draw(spriteBatch, ref itemBeingCharged, 0, ChargerPosition + new Vector2(8f, -94f) - Main.screenPosition); + + Rectangle mouseRectangle = new Rectangle((int)Main.MouseWorld.X, (int)Main.MouseWorld.Y, 2, 2); + bool cooldownComplete = depositWithdrawCooldown == 0; + if (Main.netMode != NetmodeID.SinglePlayer) + { + cooldownComplete = Main.time % 7 == 0; + } + if (mouseRectangle.Intersects(FuelIconBounds) && fuel.stack > 0) + Main.HoverItem = fuel.Clone(); + if (mouseRectangle.Intersects(ChargingItemIconBounds) && itemBeingCharged.stack > 0) + { + Main.HoverItem = itemBeingCharged.Clone(); + + // This effect is indeed purely aesthetic. + // Why not just use CurrentCharge instead of some wacky field in the tile entity, you might be asking? + // Well, as it turns out, multiplayer (and NBT tags) don't like taking data from the item. I was attempting to fix the issue for + // nearly 4 hours, to no avail. I'd consider this weird little piece of code here the lesser of two evils. + itemBeingCharged.Calamity().CurrentCharge = charger.Charge; + } + if (Main.mouseLeft && Main.LocalPlayer.itemAnimation == 0) + { + if (mouseRectangle.Intersects(FuelIconBounds)) + { + Main.playerInventory = true; + Main.recBigList = false; + + if (cooldownComplete) + { + if (!UseFuel(ref Main.mouseItem, ref fuel)) + UseFuel(ref Main.LocalPlayer.inventory[Main.LocalPlayer.selectedItem], ref fuel); + } + fuel.position = ChargerPosition + new Vector2(RectangleWidth, RectangleHeight) * 0.5f - Vector2.UnitY * 54f; + + depositWithdrawCooldown = 9; + } + if (mouseRectangle.Intersects(ChargingItemIconBounds)) + { + Main.playerInventory = true; + Main.recBigList = false; + + if (cooldownComplete) + { + if (!UseChargeItem(ref Main.mouseItem, ref itemBeingCharged, ref charger)) + UseChargeItem(ref Main.LocalPlayer.inventory[Main.LocalPlayer.selectedItem], ref itemBeingCharged, ref charger); + } + itemBeingCharged.position = ChargerPosition + new Vector2(RectangleWidth, RectangleHeight) * 0.5f - Vector2.UnitY * 94f; + + depositWithdrawCooldown = 9; + } + charger.ClientToServerSync(); + } + + if (mouseRectangle.Intersects(FuelIconBounds) || mouseRectangle.Intersects(ChargingItemIconBounds)) + { + Main.instance.MouseTextHackZoom(""); // Since HoverItem is active, we don't need to input anything into this method. + } + Main.blockMouse = mouseRectangle.Intersects(FuelIconBounds) || mouseRectangle.Intersects(ChargingItemIconBounds); // Block mouse input if hovering over the item UI but not holding a pickaxe. + Main.blockMouse &= Main.LocalPlayer.ActiveItem().pick <= 0; + + charger.DrawAllSparks(spriteBatch); + } + } + public static bool UseFuel(ref Item itemToUse, ref Item fuel) + { + // Withdraw the stored fuel. + if ((itemToUse.type == ModContent.ItemType() || itemToUse.type == ItemID.None) && fuel.stack > 0) + { + int oldMouseStack = itemToUse.stack; + itemToUse = fuel.Clone(); + itemToUse.SetDefaults(itemToUse.type); + itemToUse.stack = fuel.stack + oldMouseStack; + fuel.stack = 0; + return true; + } + // Deposit fuel. + else if (itemToUse.type == ModContent.ItemType() && itemToUse.stack > 0 && fuel.stack == 0) + { + int oldStack = itemToUse.stack; + fuel = itemToUse.Clone(); + fuel.SetDefaults(fuel.type); + fuel.stack = oldStack; + itemToUse.stack = 0; + return true; + } + return false; + } + public static bool UseChargeItem(ref Item itemToUse, ref Item chargeItem, ref TEDraedonItemCharger charger) + { + // Withdraw the placed item. + if (itemToUse.type == ItemID.None && chargeItem.stack > 0) + { + int oldCharge = charger.Charge; + itemToUse = chargeItem.Clone(); + itemToUse.SetDefaults(itemToUse.type); + itemToUse.Calamity().CurrentCharge = oldCharge; + chargeItem.stack = 0; + return false; + } + // Insert an item. + else if (itemToUse.stack == 1 && chargeItem.stack == 0) + { + if (itemToUse is null || itemToUse.type < ItemID.Count) + return false; + if (!itemToUse.Calamity().Chargeable) + return false; + charger.Charge = itemToUse.Calamity().CurrentCharge; + chargeItem = itemToUse.Clone(); + chargeItem.SetDefaults(chargeItem.type); + itemToUse = new Item(); + return true; + } + return false; + } + } +} diff --git a/UI/DraedonsLogUI.cs b/UI/DraedonsLogUI.cs new file mode 100644 index 0000000000..effde96590 --- /dev/null +++ b/UI/DraedonsLogUI.cs @@ -0,0 +1,189 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; +using System.Linq; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.UI +{ + public class DraedonsLogUI : PopupGUI + { + public int Page = 0; + public int ArrowClickCooldown; + public bool HoveringOverBook = false; + public int TotalLinesPerPage => (int)Math.Ceiling(16 * Main.screenHeight / 1440f - 1); + public const int TextStartOffsetX = 40; + public override void Update() + { + if (Active) + { + if (FadeTime < FadeTimeMax) + FadeTime++; + } + else if (FadeTime > 0) + { + FadeTime--; + } + + if (Main.mouseLeft && !HoveringOverBook && FadeTime >= 30) + { + Page = 0; + Active = false; + } + + if (ArrowClickCooldown > 0) + ArrowClickCooldown--; + HoveringOverBook = false; + } + public override void Draw(SpriteBatch spriteBatch) + { + Texture2D pageTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/DraedonsLogPage"); + float xScale = MathHelper.Lerp(0.004f, 1f, FadeTime / (float)FadeTimeMax); + Vector2 scale = new Vector2(xScale, 1f) * new Vector2(Main.screenWidth, Main.screenHeight) / pageTexture.Size(); + scale *= 0.5f; + + float xResolutionScale = Main.screenWidth / 2560f; + float yResolutionScale = Main.screenHeight / 1440f; + float bookScale = 0.75f; + + scale *= bookScale; + float yPageTop = MathHelper.Lerp(Main.screenHeight * 2, Main.screenHeight * 0.25f, FadeTime / (float)FadeTimeMax); + + Rectangle mouseRectangle = new Rectangle((int)Main.MouseScreen.X, (int)Main.MouseScreen.Y, 2, 2); + for (int i = 0; i < 2; i++) + { + Vector2 drawPosition = new Vector2(Main.screenWidth * 0.5f, yPageTop); + spriteBatch.Draw(pageTexture, + drawPosition, + null, + Color.White, + 0f, + new Vector2(i == 0f ? pageTexture.Width : 0f, 0f), + scale, + i == 0 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, + 0f); + if (!HoveringOverBook) + { + Rectangle pageRectangle = new Rectangle((int)drawPosition.X - (int)(pageTexture.Width * scale.X), (int)yPageTop, (int)(pageTexture.Width * scale.X) * 2, (int)(pageTexture.Height * scale.Y)); + HoveringOverBook = mouseRectangle.Intersects(pageRectangle); + } + } + + string placeholderText = "A GOD DOES NOT FEAR DEATH "; + for (int i = 0; i < 7; i++) + { + placeholderText += placeholderText; + } + + // Create text and arrows. + if (FadeTime >= FadeTimeMax - 4 && Active) + { + int textWidth = (int)(xScale * 2 * pageTexture.Width) - TextStartOffsetX; + textWidth = (int)(textWidth * xResolutionScale); + List dialogLines = Utils.WordwrapString(placeholderText, Main.fontMouseText, textWidth, 250, out _).ToList(); + dialogLines.RemoveAll(text => string.IsNullOrEmpty(text)); + + int totalPages = dialogLines.Count / (TotalLinesPerPage * 2 + 2); + + // Ensure the page number doesn't become nonsensical as a result of a resolution change (such as by resizing the game). + if (Page < 0) + Page = 0; + if (Page > totalPages) + Page = totalPages; + + // Draw arrows. + if (Page > 0) + { + Texture2D pageArrowTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/DraedonsLogArrow"); + Vector2 offset = new Vector2(-(int)(pageTexture.Width * xResolutionScale) * 2 - (int)(36 * xResolutionScale), (int)(pageTexture.Height * yResolutionScale) + (int)(52 * yResolutionScale)); + Vector2 bottomLeft = new Vector2(Main.screenWidth / 2, yPageTop); + bottomLeft += offset; + Rectangle arrowRectangle = new Rectangle((int)bottomLeft.X, (int)bottomLeft.Y, pageArrowTexture.Width, pageArrowTexture.Height); + arrowRectangle.Width = (int)(arrowRectangle.Width * xResolutionScale); + arrowRectangle.Height = (int)(arrowRectangle.Height * yResolutionScale); + if (mouseRectangle.Intersects(arrowRectangle)) + { + pageArrowTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/DraedonsLogArrowHover"); + if (ArrowClickCooldown <= 0 && Main.mouseLeft) + { + Page--; + ArrowClickCooldown = 8; + } + Main.blockMouse = true; + } + + spriteBatch.Draw(pageArrowTexture, + bottomLeft, + null, + Color.White, + 0f, + Vector2.Zero, + new Vector2(xResolutionScale, yResolutionScale), + SpriteEffects.FlipHorizontally, + 0f); + } + if (Page < totalPages) + { + Texture2D pageArrowTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/DraedonsLogArrow"); + Vector2 offset = new Vector2((int)(pageTexture.Width * xResolutionScale) * 2 + (int)(10 * xResolutionScale), (int)(pageTexture.Height * yResolutionScale) + (int)(52 * yResolutionScale)); + Vector2 bottomRight = new Vector2(Main.screenWidth / 2, yPageTop); + bottomRight += offset; + Rectangle arrowRectangle = new Rectangle((int)bottomRight.X, (int)bottomRight.Y, pageArrowTexture.Width, pageArrowTexture.Height); ; + arrowRectangle.Width = (int)(arrowRectangle.Width * xResolutionScale); + arrowRectangle.Height = (int)(arrowRectangle.Height * yResolutionScale); + if (mouseRectangle.Intersects(arrowRectangle)) + { + pageArrowTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/DraedonsLogArrowHover"); + if (ArrowClickCooldown <= 0 && Main.mouseLeft) + { + Page++; + ArrowClickCooldown = 8; + } + Main.blockMouse = true; + } + + spriteBatch.Draw(pageArrowTexture, + bottomRight, + null, + Color.White, + 0f, + Vector2.Zero, + new Vector2(xResolutionScale, yResolutionScale), + SpriteEffects.None, + 0f); + } + int startingLine = Page * (TotalLinesPerPage * 2 + 2); + int endingLine = startingLine + TotalLinesPerPage * 2 + 2; + if (endingLine > dialogLines.Count) + endingLine = dialogLines.Count; + + for (int i = startingLine; i < endingLine; i++) + { + bool onNextPage = i - startingLine > TotalLinesPerPage; + if (dialogLines[i] != null) + { + int textDrawPositionX = (int)(Main.screenWidth / 2 - 50 * xResolutionScale) - (int)(pageTexture.Width * 2 * xResolutionScale); + int textDrawPositionY = (int)(50 * yResolutionScale) + (i - startingLine) * 24 + (int)yPageTop; + if (onNextPage) + { + textDrawPositionX = (int)(Main.screenWidth / 2 + 16 * xResolutionScale) + (int)(TextStartOffsetX * 1.5 * xResolutionScale); + textDrawPositionY = (int)(50 * yResolutionScale) + (i - startingLine - (TotalLinesPerPage + 1)) * 24 + (int)yPageTop; + } + + Color drawColor = Color.Lerp(Color.Cyan, Color.DarkCyan, (float)Math.Cos(i * 0.4) * 0.5f + 0.5f); + Utils.DrawBorderStringFourWay(spriteBatch, + Main.fontMouseText, + dialogLines[i], + textDrawPositionX, + textDrawPositionY, + drawColor, + Color.Black, + Vector2.Zero); + } + } + } + } + } +} diff --git a/UI/PopupGUI.cs b/UI/PopupGUI.cs new file mode 100644 index 0000000000..0725cb805e --- /dev/null +++ b/UI/PopupGUI.cs @@ -0,0 +1,39 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; + +namespace CalamityMod.UI +{ + public abstract class PopupGUI + { + public int FadeTime; + public bool Active; + public virtual int FadeTimeMax { get; set; } = 30; + public virtual void Update() + { + if (Active) + { + if (FadeTime < FadeTimeMax) + FadeTime++; + } + else if (FadeTime > 0) + FadeTime--; + if (Main.mouseLeft && Main.mouseLeftRelease && !Main.blockMouse && FadeTime >= 30) + { + Main.mouseLeftRelease = false; + Main.mouseLeft = false; + Active = false; + } + } + public float GetYTop() => MathHelper.Lerp(Main.screenHeight * 2, Main.screenHeight * 0.25f, FadeTime / (float)FadeTimeMax); + public Vector2 GetScreenAdjustedScale(float textureScale, Texture2D drawTexture) + { + float xScale = MathHelper.Lerp(0.004f, 1f, FadeTime / (float)FadeTimeMax); + Vector2 scale = new Vector2(xScale, 1f) * new Vector2(Main.screenWidth, Main.screenHeight) / drawTexture.Size(); + scale *= 0.5f; + scale *= textureScale; + return scale; + } + public virtual void Draw(SpriteBatch spriteBatch) { } + } +} diff --git a/UI/PopupGUIManager.cs b/UI/PopupGUIManager.cs new file mode 100644 index 0000000000..7f58903d74 --- /dev/null +++ b/UI/PopupGUIManager.cs @@ -0,0 +1,55 @@ +using Microsoft.Xna.Framework.Graphics; +using System.Collections.Generic; +using System.Linq; +using Terraria; + +namespace CalamityMod.UI +{ + public static class PopupGUIManager + { + private static readonly List gUIs = new List(); + public static DraedonsLogUI DraedonLogGUI; + public static bool GUIActive(PopupGUI gui) => gui.Active || gui.FadeTime > 0; + public static bool AnyGUIsActive => gUIs.Any(GUIActive); + public static PopupGUI GetActiveGUI => gUIs.FirstOrDefault(GUIActive); + public static void SuspendAll() + { + DraedonLogGUI.Active = false; + DraedonLogGUI.FadeTime = 0; + } + public static void UpdateAndDraw(SpriteBatch spriteBatch) + { + if (Main.ingameOptionsWindow || Main.inFancyUI) + { + SuspendAll(); + return; + } + if (AnyGUIsActive) + { + Main.playerInventory = false; + if (Main.LocalPlayer.sign > 0 || Main.LocalPlayer.talkNPC > 0) + Main.CloseNPCChatOrSign(); + GetActiveGUI.Update(); + if (GetActiveGUI == null) + return; + if (GetActiveGUI.FadeTime == 1 && !GetActiveGUI.Active) + { + spriteBatch.End(); + spriteBatch.Begin(); + return; + } + GetActiveGUI.Draw(spriteBatch); + } + } + public static void LoadGUIs() + { + DraedonLogGUI = new DraedonsLogUI(); + gUIs.Add(DraedonLogGUI); + } + public static void UnloadGUIs() + { + DraedonLogGUI = null; + gUIs.Clear(); + } + } +} diff --git a/UI/StealthUI.cs b/UI/StealthUI.cs index 84ae2c116c..9a54e251b1 100644 --- a/UI/StealthUI.cs +++ b/UI/StealthUI.cs @@ -20,7 +20,7 @@ namespace CalamityMod.UI DrawPosition.Y = Main.screenHeight / 2 + Main.LocalPlayer.height / 2f + 24f; } CalamityPlayer modPlayer = player.Calamity(); - if (modPlayer.stealthUIAlpha <= 0f || !CalamityConfig.Instance.StealthBar || modPlayer.rogueStealthMax <= 0) + if (modPlayer.stealthUIAlpha <= 0f || !CalamityConfig.Instance.StealthBar || modPlayer.rogueStealthMax <= 0f || !modPlayer.wearingRogueArmor) { if (CalamityConfig.Instance.StealthMeterPosX != DrawPosition.X) { diff --git a/Utilities/CalamityRecipes.cs b/Utilities/CalamityRecipes.cs index 5ce5fa184c..89a2e24768 100644 --- a/Utilities/CalamityRecipes.cs +++ b/Utilities/CalamityRecipes.cs @@ -1032,8 +1032,7 @@ namespace CalamityMod ItemID.SolarFlarePickaxe, ItemID.VortexPickaxe, ItemID.NebulaPickaxe, - ItemID.StardustPickaxe, - ModContent.ItemType() + ItemID.StardustPickaxe }); RecipeGroup.RegisterGroup("LunarPickaxe", group); @@ -1112,7 +1111,8 @@ namespace CalamityMod ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType() + ModContent.ItemType(), + ModContent.ItemType() }); RecipeGroup.RegisterGroup("WingsGroup", group); } diff --git a/Utilities/CalamityUtils.cs b/Utilities/CalamityUtils.cs index b82beac125..76fc91b98b 100644 --- a/Utilities/CalamityUtils.cs +++ b/Utilities/CalamityUtils.cs @@ -1,10 +1,37 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.CalPlayer; using CalamityMod.Items; using CalamityMod.Items.Tools.ClimateChange; using CalamityMod.NPCs; +using CalamityMod.NPCs.AquaticScourge; +using CalamityMod.NPCs.AstrumAureus; +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.HiveMind; +using CalamityMod.NPCs.Leviathan; using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.NPCs.OldDuke; +using CalamityMod.NPCs.Perforator; +using CalamityMod.NPCs.PlaguebringerGoliath; +using CalamityMod.NPCs.Polterghast; +using CalamityMod.NPCs.ProfanedGuardians; using CalamityMod.NPCs.Providence; +using CalamityMod.NPCs.Ravager; +using CalamityMod.NPCs.Signus; +using CalamityMod.NPCs.SlimeGod; +using CalamityMod.NPCs.StormWeaver; +using CalamityMod.NPCs.SupremeCalamitas; +using CalamityMod.NPCs.Yharon; using CalamityMod.Projectiles; +using CalamityMod.Projectiles.Magic; using CalamityMod.Projectiles.Summon; using CalamityMod.Tiles; using CalamityMod.Tiles.Abyss; @@ -70,6 +97,7 @@ namespace CalamityMod public static float AverageDamage(this Player player) => player.allDamage + (player.meleeDamage + player.rangedDamage + player.magicDamage + player.minionDamage + player.Calamity().throwingDamage - 5f) / 5f; public static bool IsUnderwater(this Player player) => Collision.DrownCollision(player.position, player.width, player.height, player.gravDir); + public static bool StandingStill(this Player player, float velocity = 0.05f) => player.velocity.Length() < velocity; public static bool InSpace(this Player player) { float x = Main.maxTilesX / 4200f; @@ -122,6 +150,36 @@ namespace CalamityMod { return player.inventory.Any(item => items.Contains(item.type)); } + public static bool PortableStorageHas(this Player player, params int[] items) + { + bool hasItem = false; + if (player.bank.item.Any(item => items.Contains(item.type))) + hasItem = true; + if (player.bank2.item.Any(item => items.Contains(item.type))) + hasItem = true; + if (player.bank3.item.Any(item => items.Contains(item.type))) + hasItem = true; + return hasItem; + } + + /// + /// Inflict typical exo weapon debuffs in pvp. + /// + /// The Player attacked. + /// Debuff time multiplier if needed. + /// Inflicts debuffs if the target isn't immune. + public static void ExoDebuffs(this Player target, float multiplier = 1f) + { + target.AddBuff(ModContent.BuffType(), (int)(30 * multiplier)); + target.AddBuff(ModContent.BuffType(), (int)(120 * multiplier)); + target.AddBuff(ModContent.BuffType(), (int)(120 * multiplier)); + target.AddBuff(ModContent.BuffType(), (int)(120 * multiplier)); + target.AddBuff(ModContent.BuffType(), (int)(120 * multiplier)); + target.AddBuff(BuffID.CursedInferno, (int)(120 * multiplier)); + target.AddBuff(BuffID.Frostburn, (int)(120 * multiplier)); + target.AddBuff(BuffID.OnFire, (int)(120 * multiplier)); + target.AddBuff(BuffID.Ichor, (int)(120 * multiplier)); + } #endregion #region NPC Utilities @@ -168,13 +226,188 @@ namespace CalamityMod if (customDR.HasValue) npc.Calamity().customDR = true; } + + /// + /// Get the aggression multiplier used for NPCs in Master Mode Calamity rev+ + /// Will also be used to modify certain boss size/scale + /// + /// The NPC that is having its aggression increased, used to modify the base 1.5x aggression multiplier + /// Used to modify the color of this NPC + public static float GetMasterModeNPCAggressionMultiplier(ref Color newColor, int? NPCType = null) + { + /*if (!Main.masterMode) + return 1f;*/ + + /*if (NPCType == ModContent.NPCType()) + { + + } + else if (NPCType == ModContent.NPCType()) + { + + } + else if (NPCType == ModContent.NPCType() || NPCType == ModContent.NPCType()) + { + + } + else if (NPCType == ModContent.NPCType()) + { + + } + else if (NPCType == ModContent.NPCType() || NPCType == ModContent.NPCType() || NPCType == ModContent.NPCType() || NPCType == ModContent.NPCType() || NPCType == ModContent.NPCType()) + { + + } + else if (NPCType == ModContent.NPCType()) + { + + } + else if (NPCType == ModContent.NPCType()) + { + + } + else if (NPCType == ModContent.NPCType()) + { + + } + else if (NPCType == ModContent.NPCType() || NPCType == ModContent.NPCType()) + { + + } + else if (NPCType == ModContent.NPCType() || NPCType == ModContent.NPCType()) + { + + } + else if (NPCType == ModContent.NPCType()) + { + + } + else if (NPCType == ModContent.NPCType()) + { + + } + else if (NPCType == ModContent.NPCType()) + { + + } + else if (NPCType == ModContent.NPCType()) + { + + } + else if (NPCType == ModContent.NPCType()) + { + + } + else if (NPCType == ModContent.NPCType()) + { + + } + else if (NPCType == ModContent.NPCType()) + { + + } + else if (NPCType == ModContent.NPCType()) + { + + } + else if (NPCType == ModContent.NPCType() || NPCType == ModContent.NPCType()) + { + + } + else if (NPCType == ModContent.NPCType()) + { + + } + else if (NPCType == ModContent.NPCType()) + { + + } + else if (NPCType == ModContent.NPCType()) + { + + } + else if (NPCType == ModContent.NPCType() || NPCType == ModContent.NPCType()) + { + + } + else if (NPCType == ModContent.NPCType()) + { + + } + else if (NPCType == ModContent.NPCType()) + { + + } + else + { + switch (NPCType) + { + case NPCID.KingSlime: + case NPCID.EyeofCthulhu: + case NPCID.EaterofWorldsHead: + case NPCID.BrainofCthulhu: + case NPCID.Creeper: + case NPCID.QueenBee: + case NPCID.SkeletronHead: + case NPCID.WallofFlesh: + case NPCID.WallofFleshEye: + case NPCID.Spazmatism: + case NPCID.Retinazer: + case NPCID.TheDestroyer: + case NPCID.SkeletronPrime: + case NPCID.Plantera: + case NPCID.Golem: + case NPCID.GolemHead: + case NPCID.DukeFishron: + case NPCID.CultistBoss: + case NPCID.MoonLordCore: + case NPCID.MoonLordHand: + case NPCID.MoonLordHead: + break; + } + }*/ + + return 1.5f; + } + + /// + /// Get the contact damage for NPCs in Master Mode Calamity rev+ + /// + /// The damage the npc does prior to being multiplied + /// The damage multiplier applied to the npc' contact damage + public static int GetMasterModeContactDamage(int damage, double damageMultiplier) + { + /*if (!Main.masterMode || !CalamityWorld.revenge) + return damage;*/ + + return damage; + + //return (int)(damage * damageMultiplier); + } + + /// + /// Get the damage for projectiles in Master Mode Calamity rev+ + /// + /// The damage the projectile does prior to being multiplied + /// The damage multiplier applied to the projectiles' damage + public static int GetMasterModeProjectileDamage(int damage, double damageMultiplier) + { + /*if (!Main.masterMode || !CalamityWorld.revenge) + return damage;*/ + + return damage; + + //return (int)(damage * damageMultiplier); + } + /// /// Detects nearby hostile NPCs from a given point /// /// The position where we wish to check for nearby NPCs /// Maximum amount of pixels to check around the origin + /// Whether to ignore tiles when finding a target or not /// Whether bosses should be prioritized in targetting or not - public static NPC ClosestNPCAt(this Vector2 origin, float maxDistanceToCheck, bool bossPriority = false) + public static NPC ClosestNPCAt(this Vector2 origin, float maxDistanceToCheck, bool ignoreTiles = true, bool bossPriority = false) { NPC closestTarget = null; float distance = maxDistanceToCheck; @@ -183,14 +416,20 @@ namespace CalamityMod bool bossFound = false; for (int index = 0; index < Main.npc.Length; index++) { - //if we've found a valid boss target, ignore ALL targets which aren't bosses. - if (bossFound && !Main.npc[index].boss) + // If we've found a valid boss target, ignore ALL targets which aren't bosses. + if (bossFound && !(Main.npc[index].boss || Main.npc[index].type == NPCID.WallofFleshEye)) continue; if (Main.npc[index].CanBeChasedBy(null, false)) { - if (Vector2.Distance(origin, Main.npc[index].Center) < distance) + float extraDistance = (Main.npc[index].width / 2) + (Main.npc[index].height / 2); + + bool canHit = true; + if (extraDistance < distance && !ignoreTiles) + canHit = Collision.CanHit(origin, 1, 1, Main.npc[index].Center, 1, 1); + + if (Vector2.Distance(origin, Main.npc[index].Center) < (distance + extraDistance) && canHit) { - if (Main.npc[index].boss) + if (Main.npc[index].boss || Main.npc[index].type == NPCID.WallofFleshEye) bossFound = true; distance = Vector2.Distance(origin, Main.npc[index].Center); closestTarget = Main.npc[index]; @@ -204,7 +443,13 @@ namespace CalamityMod { if (Main.npc[index].CanBeChasedBy(null, false)) { - if (Vector2.Distance(origin, Main.npc[index].Center) < distance) + float extraDistance = (Main.npc[index].width / 2) + (Main.npc[index].height / 2); + + bool canHit = true; + if (extraDistance < distance && !ignoreTiles) + canHit = Collision.CanHit(origin, 1, 1, Main.npc[index].Center, 1, 1); + + if (Vector2.Distance(origin, Main.npc[index].Center) < (distance + extraDistance) && canHit) { distance = Vector2.Distance(origin, Main.npc[index].Center); closestTarget = Main.npc[index]; @@ -220,13 +465,20 @@ namespace CalamityMod /// The position where we wish to check for nearby NPCs /// Maximum amount of pixels to check around the origin /// Owner of the minion - public static NPC MinionHoming(this Vector2 origin, float maxDistanceToCheck, Player owner) + /// Whether to ignore tiles when finding a target or not + public static NPC MinionHoming(this Vector2 origin, float maxDistanceToCheck, Player owner, bool ignoreTiles = true) { - if (owner.HasMinionAttackTargetNPC) + if (owner is null || owner.whoAmI < 0 || owner.whoAmI > Main.maxPlayers || owner.MinionAttackTargetNPC < 0 || owner.MinionAttackTargetNPC > Main.maxNPCs) + return ClosestNPCAt(origin, maxDistanceToCheck, ignoreTiles); + NPC npc = Main.npc[owner.MinionAttackTargetNPC]; + bool canHit = true; + if (!ignoreTiles) + canHit = Collision.CanHit(origin, 1, 1, npc.Center, 1, 1); + if (owner.HasMinionAttackTargetNPC && canHit) { - return Main.npc[owner.MinionAttackTargetNPC]; + return npc; } - return ClosestNPCAt(origin, maxDistanceToCheck); + return ClosestNPCAt(origin, maxDistanceToCheck, ignoreTiles); } /// @@ -288,6 +540,41 @@ namespace CalamityMod } return false; } + + /// + /// Shortcut for the generic boss summon message. + /// + /// The whoAmI index of the summoned npc. + public static void BossAwakenMessage(int npcIndex) + { + string typeName = Main.npc[npcIndex].TypeName; + if (Main.netMode == NetmodeID.SinglePlayer) + { + Main.NewText(Language.GetTextValue("Announcement.HasAwoken", typeName), new Color(175, 75, 255)); + } + else if (Main.netMode == NetmodeID.Server) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey("Announcement.HasAwoken", new object[]{Main.npc[npcIndex].GetTypeNetName()}), new Color(175, 75, 255)); + } + } + + /// Inflict typical exo weapon debuffs. Duration multiplier optional. + /// + /// The NPC attacked. + /// Debuff time multiplier if needed. + /// Inflicts debuffs if they can. + public static void ExoDebuffs(this NPC target, float multiplier = 1f) + { + target.AddBuff(BuffID.Ichor, (int)(120 * multiplier)); + target.AddBuff(BuffID.CursedInferno, (int)(120 * multiplier)); + target.AddBuff(ModContent.BuffType(), (int)(30 * multiplier)); + target.AddBuff(ModContent.BuffType(), (int)(120 * multiplier)); + target.AddBuff(ModContent.BuffType(), (int)(120 * multiplier)); + target.AddBuff(ModContent.BuffType(), (int)(120 * multiplier)); + target.AddBuff(ModContent.BuffType(), (int)(120 * multiplier)); + target.AddBuff(BuffID.Frostburn, (int)(120 * multiplier)); + target.AddBuff(BuffID.OnFire, (int)(120 * multiplier)); + } #endregion #region Item Utilities @@ -506,57 +793,35 @@ namespace CalamityMod #region Projectile Utilities public static int CountProjectiles(int Type) => Main.projectile.Count(proj => proj.type == Type && proj.active); + public static int CountHookProj() => Main.projectile.Count(proj => Main.projHook[proj.type] && proj.ai[0] == 2f && proj.active && proj.owner == Main.myPlayer); + + public static bool IsSummon(this Projectile proj) => proj.minion || proj.sentry || CalamityMod.projectileMinionList.Contains(proj.type) || ProjectileID.Sets.MinionShot[proj.type] || ProjectileID.Sets.SentryShot[proj.type]; + public static void KillAllHostileProjectiles() { - int proj; - for (int x = 0; x < Main.maxProjectiles; x = proj + 1) + for (int x = 0; x < Main.maxProjectiles; x++) { Projectile projectile = Main.projectile[x]; if (projectile.active && projectile.hostile && !projectile.friendly && projectile.damage > 0) { projectile.Kill(); } - proj = x; } } - /// - /// Call this function in the Kill function of your projectile to spawn cloud-like gores. Used primarily for explosions - /// - /// The projectile you're adding explosion clouds to - /// Number of times it loops to spawn gores - public static void ExplosionGores (Projectile projectile, int goreAmt) + public static int FindFirstProjectile(int Type) { - Vector2 goreVec = new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f); - for (int goreIndex = 0; goreIndex < goreAmt; goreIndex++) - { - float velocityMult = 0.33f; - if (goreIndex < (int)(goreAmt/3)) - { - velocityMult = 0.66f; - } - if (goreIndex >= (int)((2*goreAmt)/3)) - { - velocityMult = 1f; - } - int smoke = Gore.NewGore(goreVec, default, Main.rand.Next(61, 64), 1f); - Gore gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X += 1f; - gore.velocity.Y += 1f; - smoke = Gore.NewGore(goreVec, default, Main.rand.Next(61, 64), 1f); - gore.velocity *= velocityMult; - gore.velocity.X -= 1f; - gore.velocity.Y += 1f; - smoke = Gore.NewGore(goreVec, default, Main.rand.Next(61, 64), 1f); - gore.velocity *= velocityMult; - gore.velocity.X += 1f; - gore.velocity.Y -= 1f; - smoke = Gore.NewGore(goreVec, default, Main.rand.Next(61, 64), 1f); - gore.velocity *= velocityMult; - gore.velocity.X -= 1f; - gore.velocity.Y -= 1f; - } + int index = -1; + for (int x = 0; x < Main.maxProjectiles; x++) + { + Projectile proj = Main.projectile[x]; + if (proj.active && proj.type == Type) + { + index = x; + break; + } + } + return index; } /// @@ -564,7 +829,7 @@ namespace CalamityMod /// /// The projectile you're adding sticky behaviour to /// Number of seconds you want a projectile to cling to an NPC - public static void StickyProjAI (Projectile projectile, int timeLeft) + public static void StickyProjAI (this Projectile projectile, int timeLeft) { if (projectile.ai[0] == 1f) { @@ -627,7 +892,7 @@ namespace CalamityMod /// The projectile you're giving sticky behaviour to /// How many projectiles of this type can stick to one enemy /// Decides if you want the projectile to deal damage while its sticked to enemies or not - public static void ModifyHitNPCSticky(Projectile projectile, int maxStick, bool constantDamage) + public static void ModifyHitNPCSticky(this Projectile projectile, int maxStick, bool constantDamage) { Player player = Main.player[projectile.owner]; Rectangle myRect = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); @@ -716,6 +981,138 @@ namespace CalamityMod } } + public static void StickToTiles(this Projectile projectile, bool ignorePlatforms, bool stickToEverything) + { + try + { + int xLeft = (int)(projectile.position.X / 16f) - 1; + int xRight = (int)((projectile.position.X + (float)projectile.width) / 16f) + 2; + int yBottom = (int)(projectile.position.Y / 16f) - 1; + int yTop = (int)((projectile.position.Y + (float)projectile.height) / 16f) + 2; + if (xLeft < 0) + { + xLeft = 0; + } + if (xRight > Main.maxTilesX) + { + xRight = Main.maxTilesX; + } + if (yBottom < 0) + { + yBottom = 0; + } + if (yTop > Main.maxTilesY) + { + yTop = Main.maxTilesY; + } + for (int x = xLeft; x < xRight; x++) + { + for (int y = yBottom; y < yTop; y++) + { + Tile tile = Main.tile[x, y]; + bool platformCheck = true; + if (ignorePlatforms) + platformCheck = !TileID.Sets.Platforms[tile.type] && tile.type != TileID.PlanterBox; + bool tableCheck = false; + if (stickToEverything) + tableCheck = Main.tileSolidTop[tile.type] && tile.frameY == 0; + if (tile != null && tile.nactive() && platformCheck && (Main.tileSolid[tile.type] || tableCheck)) + { + Vector2 tileSize; + tileSize.X = (float)(x * 16); + tileSize.Y = (float)(y * 16); + if (projectile.position.X + (float)projectile.width - 4f > tileSize.X && projectile.position.X + 4f < tileSize.X + 16f && projectile.position.Y + (float)projectile.height - 4f > tileSize.Y && projectile.position.Y + 4f < tileSize.Y + 16f) + { + projectile.velocity.X = 0f; + projectile.velocity.Y = -0.2f; + } + } + } + } + } catch + { + } + } + + public static Projectile ProjectileRain(Vector2 targetPos, float xLimit, float xVariance, float yLimitLower, float yLimitUpper, float projSpeed, int projType, int damage, float knockback, int owner, int forceType = 0, int immunitySetting = 0, int cooldown = 10) + { + float x = targetPos.X + Main.rand.NextFloat(-xLimit, xLimit); + if (projType == ModContent.ProjectileType()) + x = targetPos.X + xLimit; + float y = targetPos.Y - Main.rand.NextFloat(yLimitLower, yLimitUpper); + Vector2 source = new Vector2(x, y); + Vector2 velocity = targetPos - source; + velocity.X += Main.rand.NextFloat(-xVariance, xVariance); + float speed = projSpeed; + float targetDist = velocity.Length(); + targetDist = speed / targetDist; + velocity.X *= targetDist; + velocity.Y *= targetDist; + Projectile proj = Projectile.NewProjectileDirect(source, velocity, projType, damage, knockback, owner, 0f, 0f); + CalamityGlobalProjectile modProj = proj.Calamity(); + if (forceType > 0) + { + switch (forceType) + { + case 1: + modProj.forceMelee = true; + break; + case 2: + modProj.forceRanged = true; + break; + case 3: + modProj.forceMagic = true; + break; + case 4: + modProj.forceMinion = true; + break; + case 5: + modProj.forceRogue = true; + break; + case 6: + modProj.forceTypeless = true; + break; + } + } + if (immunitySetting > 0) + { + switch (forceType) + { + case 1: + proj.usesLocalNPCImmunity = true; + proj.localNPCHitCooldown = cooldown; + proj.usesIDStaticNPCImmunity = false; + break; + case 2: + proj.usesLocalNPCImmunity = false; + proj.idStaticNPCHitCooldown = cooldown; + proj.usesIDStaticNPCImmunity = true; + break; + } + } + return proj; + } + + public static Projectile ProjectileBarrage(Vector2 originVec, Vector2 targetPos, bool fromRight, float xOffsetMin, float xOffsetMax, float yOffsetMin, float yOffsetMax, float projSpeed, int projType, int damage, float knockback, int owner, bool clamped = false, float inaccuracyOffset = 5f) + { + float xPos = originVec.X + Main.rand.NextFloat(xOffsetMin, xOffsetMax) * fromRight.ToDirectionInt(); + float yPos = originVec.Y + Main.rand.NextFloat(yOffsetMin, yOffsetMax) * Main.rand.NextBool().ToDirectionInt(); + Vector2 spawnPosition = new Vector2(xPos, yPos); + Vector2 velocity = targetPos - spawnPosition; + velocity.X += Main.rand.NextFloat(-inaccuracyOffset, inaccuracyOffset); + velocity.Y += Main.rand.NextFloat(-inaccuracyOffset, inaccuracyOffset); + velocity.Normalize(); + velocity *= projSpeed * (clamped ? 150f : 1f); + //This clamp means the spawned projectiles only go at diagnals and are not accurate + if (clamped) + { + velocity.X = MathHelper.Clamp(velocity.X, -15f, 15f); + velocity.Y = MathHelper.Clamp(velocity.Y, -15f, 15f); + } + Projectile proj = Projectile.NewProjectileDirect(spawnPosition, velocity, projType, damage, knockback, owner); + return proj; + } + public static int DamageSoftCap(double dmgInput, int cap) { int newDamage = (int)(dmgInput); @@ -723,9 +1120,174 @@ namespace CalamityMod { newDamage = (int)((dmgInput - cap) * 0.1) + cap; } + if (newDamage < 1) + newDamage = 1; return newDamage; } + public static Vector2 RandomVelocity(float directionMult, float speedLowerLimit, float speedCap, float speedMult = 0.1f) + { + Vector2 velocity = new Vector2(Main.rand.NextFloat(-directionMult, directionMult), Main.rand.NextFloat(-directionMult, directionMult)); + //Rerolling to avoid dividing by zero + while (velocity.X == 0f && velocity.Y == 0f) + { + velocity = new Vector2(Main.rand.NextFloat(-directionMult, directionMult), Main.rand.NextFloat(-directionMult, directionMult)); + } + velocity.Normalize(); + velocity *= Main.rand.NextFloat(speedLowerLimit, speedCap) * speedMult; + return velocity; + } + + public static void SporeSacAI(this Projectile projectile) + { + Player player = Main.player[projectile.owner]; + + float scaleAmt = 1f - (float)projectile.alpha / 255f; + scaleAmt *= projectile.scale; + Lighting.AddLight(projectile.Center, 0.25f * scaleAmt, 0.025f * scaleAmt, 0.275f * scaleAmt); + + projectile.localAI[0] += 1f; + if (projectile.localAI[0] >= 90f) + { + projectile.localAI[0] *= -1f; + } + if (projectile.localAI[0] >= 0f) + { + projectile.scale += 0.003f; + } + else + { + projectile.scale -= 0.003f; + } + projectile.rotation += 0.0025f * projectile.scale; + float yVel = 1f; + float xVel = 1f; + if (projectile.identity % 6 == 0) + { + xVel *= -1f; + } + if (projectile.identity % 6 == 1) + { + yVel *= -1f; + } + if (projectile.identity % 6 == 2) + { + xVel *= -1f; + yVel *= -1f; + } + if (projectile.identity % 6 == 3) + { + xVel = 0f; + } + if (projectile.identity % 6 == 4) + { + yVel = 0f; + } + projectile.localAI[1] += 1f; + if (projectile.localAI[1] > 60f) + { + projectile.localAI[1] = -180f; + } + if (projectile.localAI[1] >= -60f) + { + projectile.velocity.X += 0.002f * xVel; + projectile.velocity.Y += 0.002f * yVel; + } + else + { + projectile.velocity.X -= 0.002f * xVel; + projectile.velocity.Y -= 0.002f * yVel; + } + projectile.ai[0] += 1f; + if (projectile.ai[0] > 5400f) + { + projectile.damage = 0; + projectile.ai[1] = 1f; + if (projectile.alpha < 255) + { + projectile.alpha += 5; + if (projectile.alpha > 255) + { + projectile.alpha = 255; + } + } + else if (projectile.owner == Main.myPlayer) + { + projectile.Kill(); + } + } + else + { + float playerDist = (projectile.Center - player.Center).Length() / 100f; + if (playerDist > 4f) + { + playerDist *= 1.1f; + } + if (playerDist > 5f) + { + playerDist *= 1.2f; + } + if (playerDist > 6f) + { + playerDist *= 1.3f; + } + if (playerDist > 7f) + { + playerDist *= 1.4f; + } + if (playerDist > 8f) + { + playerDist *= 1.5f; + } + if (playerDist > 9f) + { + playerDist *= 1.6f; + } + if (playerDist > 10f) + { + playerDist *= 1.7f; + } + projectile.ai[0] += playerDist; + if (projectile.alpha > 50) + { + projectile.alpha -= 10; + if (projectile.alpha < 50) + { + projectile.alpha = 50; + } + } + } + bool foundTarget = false; + Vector2 targetPos = new Vector2(0f, 0f); + float maxDist = 600f; + for (int i = 0; i < Main.maxNPCs; i++) + { + NPC npc = Main.npc[i]; + if (npc.CanBeChasedBy(projectile, false)) + { + float targetDist = Vector2.Distance(projectile.Center, npc.Center); + if (targetDist < maxDist) + { + targetPos = npc.Center; + foundTarget = true; + break; + } + } + } + if (foundTarget) + { + Vector2 targetVec = targetPos - projectile.Center; + targetVec.Normalize(); + targetVec *= 0.75f; + projectile.velocity = (projectile.velocity * 10f + targetVec) / 11f; + return; + } + if (projectile.velocity.Length() > 0.2f) + { + projectile.velocity *= 0.98f; + } + } + public static void MinionAntiClump(this Projectile projectile, float pushForce = 0.05f) { for (int k = 0; k < Main.maxProjectiles; k++) @@ -753,7 +1315,7 @@ namespace CalamityMod } } - public static void ChargingMinionAI(this Projectile projectile, float range, float maxPlayerDist, float extraMaxPlayerDist, float safeDist, int initialUpdates, float chargeDelayTime, float goToSpeed, float goBackSpeed, float chargeCounterMax, float chargeSpeed, bool tileVision, bool ignoreTilesWhenCharging) + public static void ChargingMinionAI(this Projectile projectile, float range, float maxPlayerDist, float extraMaxPlayerDist, float safeDist, int initialUpdates, float chargeDelayTime, float goToSpeed, float goBackSpeed, float chargeCounterMax, float chargeSpeed, bool tileVision, bool ignoreTilesWhenCharging, int updateDifference = 1) { Player player = Main.player[projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); @@ -766,7 +1328,7 @@ namespace CalamityMod if (projectile.ai[0] == 2f) { projectile.ai[1] += 1f; - projectile.extraUpdates = initialUpdates + (projectile.type == ModContent.ProjectileType() ? 2 : 1); + projectile.extraUpdates = initialUpdates + updateDifference; if (projectile.ai[1] > chargeDelayTime) { projectile.ai[1] = 1f; @@ -813,8 +1375,8 @@ namespace CalamityMod } } } - //If no npc is specifically targetted, check through the entire array - else + //If no npc is specifically targetted or the selected enemy can't be found, check through the entire array + if (!foundTarget) { for (int npcIndex = 0; npcIndex < Main.maxNPCs; npcIndex++) { @@ -2693,12 +3255,13 @@ namespace CalamityMod public static void DrawFishingLine(this Projectile projectile, int fishingRodType, Color poleColor, int xPositionAdditive = 45, float yPositionAdditive = 35f) { Player player = Main.player[projectile.owner]; - if (projectile.bobber && player.ActiveItem().holdStyle > 0) + Item item = Main.mouseItem.IsAir ? player.HeldItem : Main.mouseItem; + if (projectile.bobber && item.holdStyle > 0) { float pPosX = player.MountedCenter.X; float pPosY = player.MountedCenter.Y; pPosY += player.gfxOffY; - int type = player.ActiveItem().type; + int type = item.type; float gravDir = player.gravDir; if (type == fishingRodType) @@ -2949,6 +3512,27 @@ namespace CalamityMod return array; } + /// + /// Retrieves all the colors from a and returns them as a 2D array. + /// + /// The texture to load. + /// + public static Color[,] GetColorsFromTexture(this Texture2D texture) + { + Color[] alignedColors = new Color[texture.Width * texture.Height]; + texture.GetData(alignedColors); // Fills the color array with all the colors in the texture + + Color[,] colors2D = new Color[texture.Width, texture.Height]; + for (int x = 0; x < texture.Width; x++) + { + for (int y = 0; y < texture.Height; y++) + { + colors2D[x, y] = alignedColors[x + y * texture.Width]; + } + } + return colors2D; + } + public static string CombineStrings(params object[] args) { StringBuilder result = new StringBuilder(1024); @@ -3124,6 +3708,45 @@ namespace CalamityMod public static int SecondsToFrames(float seconds) => (int)(seconds * 60); + /// + /// Call this function to spawn explosion clouds at the specified location. Good for when NPCs or projectiles die and need to explode. + /// + /// The spot to spawn the explosion clouds + /// Number of times it loops to spawn gores + public static void ExplosionGores (Vector2 goreSource, int goreAmt) + { + Vector2 source = new Vector2(goreSource.X - 24f, goreSource.Y - 24f); + for (int goreIndex = 0; goreIndex < goreAmt; goreIndex++) + { + float velocityMult = 0.33f; + if (goreIndex < (int)(goreAmt/3)) + { + velocityMult = 0.66f; + } + if (goreIndex >= (int)((2*goreAmt)/3)) + { + velocityMult = 1f; + } + int smoke = Gore.NewGore(source, default, Main.rand.Next(61, 64), 1f); + Gore gore = Main.gore[smoke]; + gore.velocity *= velocityMult; + gore.velocity.X += 1f; + gore.velocity.Y += 1f; + smoke = Gore.NewGore(source, default, Main.rand.Next(61, 64), 1f); + gore.velocity *= velocityMult; + gore.velocity.X -= 1f; + gore.velocity.Y += 1f; + smoke = Gore.NewGore(source, default, Main.rand.Next(61, 64), 1f); + gore.velocity *= velocityMult; + gore.velocity.X += 1f; + gore.velocity.Y -= 1f; + smoke = Gore.NewGore(source, default, Main.rand.Next(61, 64), 1f); + gore.velocity *= velocityMult; + gore.velocity.X -= 1f; + gore.velocity.Y -= 1f; + } + } + // REMOVE THIS IN CALAMITY 1.4, it's a 1.4 Main.cs function public static float GetLerpValue(float from, float to, float t, bool clamped = false) { @@ -3155,6 +3778,20 @@ namespace CalamityMod return (t - from) / (to - from); } + /// + /// Clamps the distance between vectors via normalization. + /// + /// The starting point. + /// The ending point. + /// The maximum possible distance between the two vectors before they get clamped. + public static void DistanceClamp(ref Vector2 start, ref Vector2 end, float maxDistance) + { + if (Vector2.Distance(end, start) > maxDistance) + { + end = start + Vector2.Normalize(end - start) * maxDistance; + } + } + // REMOVE THIS IN CALAMITY 1.4, it's a 1.4 World.cs function public static Rectangle ClampToWorld(Rectangle tileRectangle) { diff --git a/Utilities/Enums.cs b/Utilities/Enums.cs index ee589e1ee3..831072c3f1 100644 --- a/Utilities/Enums.cs +++ b/Utilities/Enums.cs @@ -19,6 +19,7 @@ namespace CalamityMod Developer = 16, Rainbow = 30, RareVariant = 31, - Dedicated = 32 + Dedicated = 32, + DraedonRust = 33, } } diff --git a/Walls/ChaosplateWall.cs b/Walls/ChaosplateWall.cs new file mode 100644 index 0000000000..01256427b8 --- /dev/null +++ b/Walls/ChaosplateWall.cs @@ -0,0 +1,29 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Walls +{ + public class ChaosplateWall : ModWall + { + public override void SetDefaults() + { + Main.wallHouse[Type] = true; + + drop = ModContent.ItemType(); + AddMapEntry(new Color(123, 50, 66)); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Walls/ChaosplateWall.png b/Walls/ChaosplateWall.png new file mode 100644 index 0000000000..5a64d2349e Binary files /dev/null and b/Walls/ChaosplateWall.png differ diff --git a/Walls/CinderplateWall.cs b/Walls/CinderplateWall.cs index 2450e1b777..e5bf705a91 100644 --- a/Walls/CinderplateWall.cs +++ b/Walls/CinderplateWall.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Walls Main.wallHouse[Type] = true; drop = ModContent.ItemType(); - AddMapEntry(new Color(97, 22, 57)); + AddMapEntry(new Color(166, 111, 75)); } public override bool CreateDust(int i, int j, ref int type) diff --git a/Walls/CinderplateWall.png b/Walls/CinderplateWall.png index 8b1513dfdf..4d640f83a9 100644 Binary files a/Walls/CinderplateWall.png and b/Walls/CinderplateWall.png differ diff --git a/Walls/DraedonStructures/HazardChevronWall.cs b/Walls/DraedonStructures/HazardChevronWall.cs new file mode 100644 index 0000000000..f107686fde --- /dev/null +++ b/Walls/DraedonStructures/HazardChevronWall.cs @@ -0,0 +1,24 @@ +using Terraria; +using Microsoft.Xna.Framework; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Walls.DraedonStructures +{ + public class HazardChevronWall : ModWall + { + + public override void SetDefaults() + { + dustType = 19; + drop = ModContent.ItemType(); + Main.wallHouse[Type] = true; + + AddMapEntry(new Color(114, 105, 51)); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Walls/DraedonStructures/HazardChevronWall.png b/Walls/DraedonStructures/HazardChevronWall.png new file mode 100644 index 0000000000..8390af753b Binary files /dev/null and b/Walls/DraedonStructures/HazardChevronWall.png differ diff --git a/Walls/DraedonStructures/LaboratoryPanelWall.cs b/Walls/DraedonStructures/LaboratoryPanelWall.cs new file mode 100644 index 0000000000..a1b019db18 --- /dev/null +++ b/Walls/DraedonStructures/LaboratoryPanelWall.cs @@ -0,0 +1,24 @@ +using Terraria; +using Microsoft.Xna.Framework; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Walls.DraedonStructures +{ + public class LaboratoryPanelWall : ModWall + { + + public override void SetDefaults() + { + dustType = 1; + drop = ModContent.ItemType(); + Main.wallHouse[Type] = true; + + AddMapEntry(new Color(63, 57, 56)); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Walls/DraedonStructures/LaboratoryPanelWall.png b/Walls/DraedonStructures/LaboratoryPanelWall.png new file mode 100644 index 0000000000..397bc23519 Binary files /dev/null and b/Walls/DraedonStructures/LaboratoryPanelWall.png differ diff --git a/Walls/DraedonStructures/LaboratoryPlateBeam.cs b/Walls/DraedonStructures/LaboratoryPlateBeam.cs new file mode 100644 index 0000000000..a3202c1c02 --- /dev/null +++ b/Walls/DraedonStructures/LaboratoryPlateBeam.cs @@ -0,0 +1,24 @@ +using Terraria; +using Microsoft.Xna.Framework; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Walls.DraedonStructures +{ + public class LaboratoryPlateBeam : ModWall + { + + public override void SetDefaults() + { + dustType = 109; + drop = ModContent.ItemType(); + Main.wallHouse[Type] = true; + + AddMapEntry(new Color(48, 45, 46)); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Walls/DraedonStructures/LaboratoryPlateBeam.png b/Walls/DraedonStructures/LaboratoryPlateBeam.png new file mode 100644 index 0000000000..4043fd1702 Binary files /dev/null and b/Walls/DraedonStructures/LaboratoryPlateBeam.png differ diff --git a/Walls/DraedonStructures/LaboratoryPlatePillar.cs b/Walls/DraedonStructures/LaboratoryPlatePillar.cs new file mode 100644 index 0000000000..a9d122697f --- /dev/null +++ b/Walls/DraedonStructures/LaboratoryPlatePillar.cs @@ -0,0 +1,24 @@ +using Terraria; +using Microsoft.Xna.Framework; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Walls.DraedonStructures +{ + public class LaboratoryPlatePillar : ModWall + { + + public override void SetDefaults() + { + dustType = 109; + drop = ModContent.ItemType(); + Main.wallHouse[Type] = true; + + AddMapEntry(new Color(29, 28, 30)); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Walls/DraedonStructures/LaboratoryPlatePillar.png b/Walls/DraedonStructures/LaboratoryPlatePillar.png new file mode 100644 index 0000000000..ccd307c395 Binary files /dev/null and b/Walls/DraedonStructures/LaboratoryPlatePillar.png differ diff --git a/Walls/DraedonStructures/LaboratoryPlatingWall.cs b/Walls/DraedonStructures/LaboratoryPlatingWall.cs new file mode 100644 index 0000000000..0605bf4197 --- /dev/null +++ b/Walls/DraedonStructures/LaboratoryPlatingWall.cs @@ -0,0 +1,24 @@ +using Terraria; +using Microsoft.Xna.Framework; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Walls.DraedonStructures +{ + public class LaboratoryPlatingWall : ModWall + { + + public override void SetDefaults() + { + dustType = 30; + drop = ModContent.ItemType(); + Main.wallHouse[Type] = true; + + AddMapEntry(new Color(105, 102, 98)); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Walls/DraedonStructures/LaboratoryPlatingWall.png b/Walls/DraedonStructures/LaboratoryPlatingWall.png new file mode 100644 index 0000000000..78a153cc54 Binary files /dev/null and b/Walls/DraedonStructures/LaboratoryPlatingWall.png differ diff --git a/Walls/DraedonStructures/RustedPlateBeam.cs b/Walls/DraedonStructures/RustedPlateBeam.cs new file mode 100644 index 0000000000..e03ee628b2 --- /dev/null +++ b/Walls/DraedonStructures/RustedPlateBeam.cs @@ -0,0 +1,24 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Walls.DraedonStructures +{ + public class RustedPlateBeam : ModWall + { + + public override void SetDefaults() + { + dustType = 32; + drop = ModContent.ItemType(); + Main.wallHouse[Type] = true; + + AddMapEntry(new Color(74, 47, 39)); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Walls/DraedonStructures/RustedPlateBeam.png b/Walls/DraedonStructures/RustedPlateBeam.png new file mode 100644 index 0000000000..a74b4151ce Binary files /dev/null and b/Walls/DraedonStructures/RustedPlateBeam.png differ diff --git a/Walls/DraedonStructures/RustedPlatePillar.cs b/Walls/DraedonStructures/RustedPlatePillar.cs new file mode 100644 index 0000000000..c45e84988d --- /dev/null +++ b/Walls/DraedonStructures/RustedPlatePillar.cs @@ -0,0 +1,24 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Walls.DraedonStructures +{ + public class RustedPlatePillar : ModWall + { + + public override void SetDefaults() + { + dustType = 32; + drop = ModContent.ItemType(); + Main.wallHouse[Type] = true; + + AddMapEntry(new Color(99, 71, 60)); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Walls/DraedonStructures/RustedPlatePillar.png b/Walls/DraedonStructures/RustedPlatePillar.png new file mode 100644 index 0000000000..aa071e9121 Binary files /dev/null and b/Walls/DraedonStructures/RustedPlatePillar.png differ diff --git a/Walls/DraedonStructures/RustedPlatingWall.cs b/Walls/DraedonStructures/RustedPlatingWall.cs new file mode 100644 index 0000000000..47dced52ef --- /dev/null +++ b/Walls/DraedonStructures/RustedPlatingWall.cs @@ -0,0 +1,24 @@ +using Terraria; +using Microsoft.Xna.Framework; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Walls.DraedonStructures +{ + public class RustedPlatingWall : ModWall + { + + public override void SetDefaults() + { + dustType = 32; + drop = ModContent.ItemType(); + Main.wallHouse[Type] = true; + + AddMapEntry(new Color(83, 59, 50)); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Walls/DraedonStructures/RustedPlatingWall.png b/Walls/DraedonStructures/RustedPlatingWall.png new file mode 100644 index 0000000000..304d059b83 Binary files /dev/null and b/Walls/DraedonStructures/RustedPlatingWall.png differ diff --git a/Walls/ElumplateWall.cs b/Walls/ElumplateWall.cs new file mode 100644 index 0000000000..5735096903 --- /dev/null +++ b/Walls/ElumplateWall.cs @@ -0,0 +1,29 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Walls +{ + public class ElumplateWall : ModWall + { + public override void SetDefaults() + { + Main.wallHouse[Type] = true; + + drop = ModContent.ItemType(); + AddMapEntry(new Color(79, 117, 138)); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Walls/ElumplateWall.png b/Walls/ElumplateWall.png new file mode 100644 index 0000000000..2a205962de Binary files /dev/null and b/Walls/ElumplateWall.png differ diff --git a/Walls/NavyplateWall.cs b/Walls/NavyplateWall.cs new file mode 100644 index 0000000000..8ec9925d68 --- /dev/null +++ b/Walls/NavyplateWall.cs @@ -0,0 +1,29 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Walls +{ + public class NavyplateWall : ModWall + { + public override void SetDefaults() + { + Main.wallHouse[Type] = true; + + drop = ModContent.ItemType(); + AddMapEntry(new Color(55, 98, 127)); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Walls/NavyplateWall.png b/Walls/NavyplateWall.png new file mode 100644 index 0000000000..5b15b3335f Binary files /dev/null and b/Walls/NavyplateWall.png differ diff --git a/Walls/PlagueContainmentCellsWall.cs b/Walls/PlagueContainmentCellsWall.cs new file mode 100644 index 0000000000..898c53b100 --- /dev/null +++ b/Walls/PlagueContainmentCellsWall.cs @@ -0,0 +1,29 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Walls +{ + public class PlagueContainmentCellsWall : ModWall + { + public override void SetDefaults() + { + Main.wallHouse[Type] = true; + + drop = ModContent.ItemType(); + AddMapEntry(new Color(83, 122, 44)); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Walls/PlagueContainmentCellsWall.png b/Walls/PlagueContainmentCellsWall.png new file mode 100644 index 0000000000..e97e464971 Binary files /dev/null and b/Walls/PlagueContainmentCellsWall.png differ diff --git a/World/Abyss.cs b/World/Abyss.cs index 742014926b..e74b91323e 100644 --- a/World/Abyss.cs +++ b/World/Abyss.cs @@ -35,6 +35,7 @@ namespace CalamityMod.World } } } + public static int BlockDepth { get @@ -56,6 +57,7 @@ namespace CalamityMod.World } } } + public static int YStart = 0; public static readonly List SulphSeaTiles = new List() { @@ -63,12 +65,12 @@ namespace CalamityMod.World ModContent.TileType(), ModContent.TileType() }; + public static void PlaceSulphurSea() { CalamityWorld.abyssSide = Main.dungeonX < Main.maxTilesX / 2; DetermineYStart(); CreateStartingBlock(); - GenerateUpperSea(); CreateWater(); GenerateHardenedSandstone(); RemoveStupidTilesAboveSea(); @@ -159,95 +161,6 @@ namespace CalamityMod.World } #endregion - #region Generating Upper Beach Outline - public static void GenerateUpperSea() - { - int seaStartX = CalamityWorld.abyssSide ? 0 : Main.maxTilesX; - int seaEndX = CalamityWorld.abyssSide ? BiomeWidth : Main.maxTilesX - BiomeWidth; - int xCounter = 80; - float depth = 1f; - int yTop = 0; - while (!Main.tile[seaEndX - 1, yTop].active()) - { - yTop++; - } - yTop += WorldGen.genRand.Next(1, 5); - for (int x = seaEndX - 1; x != seaStartX; x += (CalamityWorld.abyssSide ? -1 : 1)) - { - xCounter++; - if (xCounter < BiomeWidth * 0.05) - { - depth += WorldGen.genRand.Next(10, 20) * 0.2f; - } - else if (xCounter < BiomeWidth * 0.08) - { - depth += WorldGen.genRand.Next(10, 20) * 0.15f; - } - else if (xCounter < BiomeWidth * 0.1) - { - depth += WorldGen.genRand.Next(10, 20) * 0.1f; - } - else if (xCounter < BiomeWidth * 0.15) - { - depth += WorldGen.genRand.Next(10, 20) * 0.07f; - } - else if (xCounter < BiomeWidth * 0.2) - { - depth += WorldGen.genRand.Next(10, 20) * 0.05f; - } - else if (xCounter < BiomeWidth * 0.25) - { - depth += WorldGen.genRand.Next(10, 20) * 0.04f; - } - else if (xCounter < BiomeWidth * 0.325) - { - depth += WorldGen.genRand.Next(10, 20) * 0.03f; - } - else if (xCounter < BiomeWidth * 0.375) - { - depth += WorldGen.genRand.Next(10, 20) * 0.02f; - } - else if (xCounter < BiomeWidth * 0.45) - { - depth += WorldGen.genRand.Next(10, 20) * 0.01f; - } - else if (xCounter < BiomeWidth * 0.6) - { - depth += WorldGen.genRand.Next(10, 20) * 0.005f; - } - else if (xCounter < BiomeWidth * 0.75) - { - depth += WorldGen.genRand.Next(10, 20) * 0.001f; - } - int depthAdditive = WorldGen.genRand.Next(15, 20); - int y = 0; - while (y < yTop + depth + depthAdditive) - { - if (y < yTop + depth * 0.75f - 3f) - { - Main.tile[x, y].active(false); - if (y > yTop) - { - Main.tile[x, y].liquid = 255; - } - else if (y == yTop) - { - Main.tile[x, y].liquid = 127; - } - } - else if (y > yTop && - (Main.tile[x, y].type == (ushort)ModContent.TileType() || - Main.tile[x, y].type == (ushort)ModContent.TileType())) - { - Main.tile[x, y].active(true); - } - Main.tile[x, y].wall = 0; - y++; - } - } - } - #endregion - #region Generating Water public const int PerlinIterations = 1; public const int PerlinOctaves = 4; @@ -752,19 +665,53 @@ namespace CalamityMod.World #endregion #region Removal of stupid Tiles above the Sea + + public static List OtherTilesForSulphSeaToDestroy = new List() + { + TileID.PalmTree, + TileID.Sunflower, + TileID.CorruptThorns, + TileID.CrimtaneThorns, + TileID.CorruptGrass, + TileID.CorruptPlants, + TileID.Stalactite, + TileID.ImmatureHerbs, + TileID.MatureHerbs, + }; + + public static List WallsForSulphSeaToDestroy = new List() + { + WallID.Dirt, + WallID.DirtUnsafe, + WallID.DirtUnsafe1, + WallID.DirtUnsafe2, + WallID.DirtUnsafe3, + WallID.DirtUnsafe4, + WallID.Cave6Unsafe, // Rocky dirt wall + WallID.GrassUnsafe, + WallID.CorruptGrassUnsafe, + WallID.EbonstoneUnsafe, + WallID.CrimstoneUnsafe, + }; public static void RemoveStupidTilesAboveSea() { for (int x = 0; x < BiomeWidth; x++) { int trueX = CalamityWorld.abyssSide ? x : Main.maxTilesX - x; - for (int y = YStart - 100; y < YStart + 60; y++) + for (int y = YStart - 140; y < YStart + 80; y++) { - if (YStartWhitelist.Contains(CalamityUtils.ParanoidTileRetrieval(trueX, y).type)) + int type = CalamityUtils.ParanoidTileRetrieval(trueX, y).type; + if (YStartWhitelist.Contains(type) || + OtherTilesForSulphSeaToDestroy.Contains(type)) { if (Main.tile[trueX, y] == null) Main.tile[trueX, y] = new Tile(); Main.tile[trueX, y].active(false); } + if (WallsForSulphSeaToDestroy.Contains(Main.tile[trueX, y].wall)) + { + Main.tile[trueX, y].wall = 0; + } } } } @@ -810,14 +757,11 @@ namespace CalamityMod.World public static void DetermineYStart() { int maxHeight = 0; - for (int i = 0; i < BiomeWidth - 18; i++) + for (int i = 40; i < BiomeWidth + 30; i++) { - int xCheck = CalamityWorld.abyssSide ? - BiomeWidth - i : - Main.maxTilesX - BiomeWidth + i; + int xCheck = CalamityWorld.abyssSide ? i : Main.maxTilesX - i; int YStart = (int)WorldGen.worldSurfaceLow - 20; // 30 tiles below the absolute lowest a floating island can spawn - while (!Main.tile[xCheck, YStart].active() || !YStartWhitelist.Contains(Main.tile[xCheck, YStart].type) || - Main.tile[xCheck, YStart].type == TileID.LivingWood || Main.tile[xCheck, YStart].type == TileID.LeafBlock) + while (!Main.tile[xCheck, YStart].active() || !YStartWhitelist.Contains(Main.tile[xCheck, YStart].type)) { YStart++; if (YStart > Main.rockLayer - 40) diff --git a/World/CalamityWorld.cs b/World/CalamityWorld.cs index a98ff26869..71c312e6a5 100644 --- a/World/CalamityWorld.cs +++ b/World/CalamityWorld.cs @@ -30,6 +30,7 @@ using CalamityMod.NPCs.StormWeaver; using CalamityMod.NPCs.SupremeCalamitas; using CalamityMod.NPCs.Yharon; using CalamityMod.Projectiles.Boss; +using CalamityMod.Schematics; using CalamityMod.Tiles; using CalamityMod.Tiles.Abyss; using CalamityMod.Tiles.Astral; @@ -60,12 +61,15 @@ namespace CalamityMod.World public static bool dragonScalesBought = false; private const int saveVersion = 0; public static int ArmoredDiggerSpawnCooldown = 0; + public static int MoneyStolenByBandit = 0; + public static int Reforges; //Boss Rush public static bool bossRushActive = false; //Whether Boss Rush is active or not public static bool deactivateStupidFuckingBullshit = false; //Force Boss Rush to inactive public static int bossRushStage = 0; //Boss Rush Stage public static int bossRushSpawnCountdown = 180; //Delay before another Boss Rush boss can spawn + public static int bossRushHostileProjKillCounter = 0; //Death Mode natural boss spawns public static int bossSpawnCountdown = 0; //Death Mode natural boss spawn countdown @@ -133,9 +137,23 @@ namespace CalamityMod.World public static int[] SChestY = new int[10]; public static bool roxShrinePlaced = false; - //Spawned NPCs + //Town NPC bools public static bool spawnedBandit = false; public static bool spawnedCirrus = false; + public static bool foundHomePermafrost = false; + public static bool guideName = false; + public static bool wizardName = false; + public static bool steampunkerName = false; + public static bool stylistName = false; + public static bool witchDoctorName = false; + public static bool taxCollectorName = false; + public static bool pirateName = false; + public static bool mechanicName = false; + public static bool armsDealerName = false; + public static bool dryadName = false; + public static bool nurseName = false; + public static bool anglerName = false; + public static bool clothierName = false; #region Downed Bools public static bool downedBossAny = false; //Any boss @@ -160,7 +178,8 @@ namespace CalamityMod.World public static bool downedSentinel1 = false; // Ceaseless Void public static bool downedSentinel2 = false; // Storm Weaver public static bool downedSentinel3 = false; // Signus, Envoy of the Devourer - public static bool downedPolterghast = false; + public static bool downedSecondSentinels = false; + public static bool downedPolterghast = false; public static bool downedDoG = false; public static bool downedBumble = false; public static bool buffedEclipse = false; @@ -169,6 +188,7 @@ namespace CalamityMod.World public static bool downedSCal = false; public static bool downedGSS = false; public static bool downedCLAM = false; + public static bool downedCLAMHardMode = false; public static bool downedBetsy = false; //Betsy public static bool downedEoCAcidRain = false; @@ -207,6 +227,7 @@ namespace CalamityMod.World bossRushActive = false; bossRushSpawnCountdown = 180; bossSpawnCountdown = 0; + bossRushHostileProjKillCounter = 0; deathBossSpawnCooldown = 0; bossType = 0; newAltarX = 0; @@ -215,6 +236,20 @@ namespace CalamityMod.World abyssSide = false; spawnedBandit = false; spawnedCirrus = false; + foundHomePermafrost = false; + guideName = false; + wizardName = false; + steampunkerName = false; + stylistName = false; + witchDoctorName = false; + taxCollectorName = false; + pirateName = false; + mechanicName = false; + armsDealerName = false; + dryadName = false; + nurseName = false; + anglerName = false; + clothierName = false; downedDesertScourge = false; downedAquaticScourge = false; downedHiveMind = false; @@ -236,6 +271,7 @@ namespace CalamityMod.World buffedEclipse = false; downedSCal = false; downedCLAM = false; + downedCLAMHardMode = false; downedBumble = false; downedCrabulon = false; downedBetsy = false; @@ -250,6 +286,7 @@ namespace CalamityMod.World downedGSS = false; downedBuffedMothron = false; downedBoomerDuke = false; + downedSecondSentinels = false; death = false; defiled = false; armageddon = false; @@ -298,6 +335,8 @@ namespace CalamityMod.World downed.Add("stormWeaver"); if (downedSentinel3) downed.Add("signus"); + if (downedSecondSentinels) + downed.Add("secondSentinels"); if (downedYharon) downed.Add("yharon"); if (buffedEclipse) @@ -348,6 +387,8 @@ namespace CalamityMod.World downed.Add("bossRushActive"); if (downedCLAM) downed.Add("clam"); + if (downedCLAMHardMode) + downed.Add("clamHardmode"); if (dragonScalesBought) downed.Add("scales"); if (rainingAcid) @@ -356,6 +397,34 @@ namespace CalamityMod.World downed.Add("bandit"); if (spawnedCirrus) downed.Add("drunkPrincess"); + if (foundHomePermafrost) + downed.Add("archmageHome"); + if (guideName) + downed.Add("guideName"); + if (wizardName) + downed.Add("wizardName"); + if (steampunkerName) + downed.Add("steampunkerName"); + if (stylistName) + downed.Add("stylistName"); + if (witchDoctorName) + downed.Add("witchDoctorName"); + if (taxCollectorName) + downed.Add("taxCollectorName"); + if (pirateName) + downed.Add("pirateName"); + if (mechanicName) + downed.Add("mechanicName"); + if (armsDealerName) + downed.Add("armsDealerName"); + if (dryadName) + downed.Add("dryadName"); + if (nurseName) + downed.Add("nurseName"); + if (anglerName) + downed.Add("anglerName"); + if (clothierName) + downed.Add("clothierName"); if (downedEoCAcidRain) downed.Add("eocRain"); if (downedAquaticScourgeAcidRain) @@ -379,6 +448,12 @@ namespace CalamityMod.World }, { "acidRainPoints", acidRainPoints + }, + { + "Reforges", Reforges + }, + { + "MoneyStolenByBandit", MoneyStolenByBandit } }; } @@ -404,6 +479,7 @@ namespace CalamityMod.World downedSentinel1 = downed.Contains("ceaselessVoid"); downedSentinel2 = downed.Contains("stormWeaver"); downedSentinel3 = downed.Contains("signus"); + downedSecondSentinels = downed.Contains("secondSentinels"); downedYharon = downed.Contains("yharon"); buffedEclipse = downed.Contains("eclipse"); downedSCal = downed.Contains("supremeCalamitas"); @@ -429,10 +505,25 @@ namespace CalamityMod.World abyssSide = downed.Contains("abyssSide"); bossRushActive = downed.Contains("bossRushActive"); downedCLAM = downed.Contains("clam"); + downedCLAMHardMode = downed.Contains("clamHardmode"); dragonScalesBought = downed.Contains("scales"); rainingAcid = downed.Contains("acidRain"); spawnedBandit = downed.Contains("bandit"); spawnedCirrus = downed.Contains("drunkPrincess"); + foundHomePermafrost = downed.Contains("archmageHome"); + guideName = downed.Contains("guideName"); + wizardName = downed.Contains("wizardName"); + steampunkerName = downed.Contains("stylistName"); + stylistName = downed.Contains("stylistName"); + witchDoctorName = downed.Contains("witchDoctorName"); + taxCollectorName = downed.Contains("taxCollectorName"); + pirateName = downed.Contains("pirateName"); + mechanicName = downed.Contains("mechanicName"); + armsDealerName = downed.Contains("armsDealerName"); + dryadName = downed.Contains("dryadName"); + nurseName = downed.Contains("nurseName"); + anglerName = downed.Contains("anglerName"); + clothierName = downed.Contains("clothierName"); downedEoCAcidRain = downed.Contains("eocRain"); downedAquaticScourgeAcidRain = downed.Contains("hmRain"); triedToSummonOldDuke = downed.Contains("spawnedBoomer"); @@ -442,6 +533,8 @@ namespace CalamityMod.World abyssChasmBottom = tag.GetInt("abyssChasmBottom"); acidRainPoints = tag.GetInt("acidRainPoints"); + Reforges = tag.GetInt("Reforges"); + MoneyStolenByBandit = tag.GetInt("MoneyStolenByBandit"); } #endregion @@ -451,6 +544,8 @@ namespace CalamityMod.World int loadVersion = reader.ReadInt32(); abyssChasmBottom = reader.ReadInt32(); acidRainPoints = reader.ReadInt32(); + Reforges = reader.ReadInt32(); + MoneyStolenByBandit = reader.ReadInt32(); if (loadVersion == 0) { @@ -528,12 +623,32 @@ namespace CalamityMod.World BitsByte flags8 = reader.ReadByte(); forcedRainAlready = flags8[0]; forcedDownpourWithTear = flags8[1]; - _ = flags8[2]; - _ = flags8[3]; - _ = flags8[4]; - _ = flags8[5]; - _ = flags8[6]; - _ = flags8[7]; + downedSecondSentinels = flags8[2]; + foundHomePermafrost = flags8[3]; + downedCLAMHardMode = flags8[4]; + guideName = flags8[5]; + wizardName = flags8[6]; + steampunkerName = flags8[7]; + + BitsByte flags9 = reader.ReadByte(); + stylistName = flags9[0]; + witchDoctorName = flags9[1]; + taxCollectorName = flags9[2]; + pirateName = flags9[3]; + mechanicName = flags9[4]; + armsDealerName = flags9[5]; + dryadName = flags9[6]; + nurseName = flags9[7]; + + BitsByte flags10 = reader.ReadByte(); + anglerName = flags10[0]; + clothierName = flags10[1]; + _ = flags10[2]; + _ = flags10[3]; + _ = flags10[4]; + _ = flags10[5]; + _ = flags10[6]; + _ = flags10[7]; } else { @@ -619,12 +734,32 @@ namespace CalamityMod.World BitsByte flags8 = new BitsByte(); flags8[0] = forcedRainAlready; flags8[1] = forcedDownpourWithTear; - flags8[2] = false; - flags8[3] = false; - flags8[4] = false; - flags8[5] = false; - flags8[6] = false; - flags8[7] = false; + flags8[2] = downedSecondSentinels; + flags8[3] = foundHomePermafrost; + flags8[4] = downedCLAMHardMode; + flags8[5] = guideName; + flags8[6] = wizardName; + flags8[7] = steampunkerName; + + BitsByte flags9 = new BitsByte(); + flags9[0] = stylistName; + flags9[1] = witchDoctorName; + flags9[2] = taxCollectorName; + flags9[3] = pirateName; + flags9[4] = mechanicName; + flags9[5] = armsDealerName; + flags9[6] = dryadName; + flags9[7] = nurseName; + + BitsByte flags10 = new BitsByte(); + flags10[0] = anglerName; + flags10[1] = clothierName; + flags10[2] = false; + flags10[3] = false; + flags10[4] = false; + flags10[5] = false; + flags10[6] = false; + flags10[7] = false; writer.Write(flags); writer.Write(flags2); @@ -634,8 +769,12 @@ namespace CalamityMod.World writer.Write(flags6); writer.Write(flags7); writer.Write(flags8); + writer.Write(flags9); + writer.Write(flags10); writer.Write(abyssChasmBottom); writer.Write(acidRainPoints); + writer.Write(Reforges); + writer.Write(MoneyStolenByBandit); } #endregion @@ -716,15 +855,37 @@ namespace CalamityMod.World BitsByte flags8 = reader.ReadByte(); forcedRainAlready = flags8[0]; forcedDownpourWithTear = flags8[1]; - _ = flags8[2]; - _ = flags8[3]; - _ = flags8[4]; - _ = flags8[5]; - _ = flags8[6]; - _ = flags8[7]; + downedSecondSentinels = flags8[2]; + foundHomePermafrost = flags8[3]; + downedCLAMHardMode = flags8[4]; + guideName = flags8[5]; + wizardName = flags8[6]; + steampunkerName = flags8[7]; + + BitsByte flags9 = reader.ReadByte(); + stylistName = flags9[0]; + witchDoctorName = flags9[1]; + taxCollectorName = flags9[2]; + pirateName = flags9[3]; + mechanicName = flags9[4]; + armsDealerName = flags9[5]; + dryadName = flags9[6]; + nurseName = flags9[7]; + + BitsByte flags10 = reader.ReadByte(); + anglerName = flags10[0]; + clothierName = flags10[1]; + _ = flags10[2]; + _ = flags10[3]; + _ = flags10[4]; + _ = flags10[5]; + _ = flags10[6]; + _ = flags10[7]; abyssChasmBottom = reader.ReadInt32(); acidRainPoints = reader.ReadInt32(); + Reforges = reader.ReadInt32(); + MoneyStolenByBandit = reader.ReadInt32(); } #endregion @@ -881,19 +1042,47 @@ namespace CalamityMod.World SmallBiomes.PlaceShrines(); })); - tasks.Insert(FinalIndex + 3, new PassLegacy("Abyss", delegate (GenerationProgress progress) + + tasks.Insert(FinalIndex + 3, new PassLegacy("Rust and Dust", (GenerationProgress progress) => + { + List workshopPositions = new List(); + int workshopCount = Main.maxTilesX / 1200; + int labCount = Main.maxTilesX / 1800; + DraedonStructures.DraedonsLogWorkshopIndex = WorldGen.genRand.Next(workshopCount); + + for (int i = 0; i < workshopCount; i++) + { + DraedonStructures.PlaceWorkshop(out Point placementPosition, workshopPositions, "Workshop"); + DraedonStructures.CurrentWorkshopIndex = i; + workshopPositions.Add(placementPosition); + + DraedonStructures.PlaceWorkshop(out Point placementPosition2, workshopPositions, "Workshop 2"); + DraedonStructures.CurrentWorkshopIndex = i; + workshopPositions.Add(placementPosition2); + } + for (int i = 0; i < labCount; i++) + { + DraedonStructures.PlaceResearchFacility(out Point placementPosition, workshopPositions, "Research Facility"); + workshopPositions.Add(placementPosition); + + DraedonStructures.PlaceResearchFacility(out Point placementPosition2, workshopPositions, "Research Facility 2"); + workshopPositions.Add(placementPosition2); + } + })); + + tasks.Insert(FinalIndex + 4, new PassLegacy("Abyss", delegate (GenerationProgress progress) { progress.Message = "The Abyss"; Abyss.PlaceAbyss(); })); - tasks.Insert(FinalIndex + 4, new PassLegacy("Sulphur2", delegate (GenerationProgress progress) + tasks.Insert(FinalIndex + 5, new PassLegacy("Sulphur2", delegate (GenerationProgress progress) { progress.Message = "Finishing Sulphur Sea"; Abyss.FinishGeneratingSulphurSea(); })); - tasks.Insert(FinalIndex + 5, new PassLegacy("IWannaRock", delegate (GenerationProgress progress) + tasks.Insert(FinalIndex + 6, new PassLegacy("IWannaRock", delegate (GenerationProgress progress) { progress.Message = "I Wanna Rock"; WorldGenerationMethods.PlaceRoxShrine(); @@ -1124,7 +1313,7 @@ namespace CalamityMod.World } // Life Fruit pre-mech - int random = Main.expertMode ? 30 : 40; + int random = Main.expertMode ? 90 : 120; if (WorldGen.genRand.Next(random) == 0) { if (Main.hardMode && !NPC.downedMechBossAny) @@ -1274,7 +1463,7 @@ namespace CalamityMod.World } // After Providence is dead - else if (bossRushStage == 36) + else if (bossRushStage == 37) { string key = "Mods.CalamityMod.BossRushTierFourEndText2"; Color messageColor = Color.LightCoral; @@ -1338,7 +1527,7 @@ namespace CalamityMod.World } // Remove Providence debuff for next boss fight - else if (bossRushStage == 36) + else if (bossRushStage == 37) { for (int playerIndex = 0; playerIndex < Main.maxPlayers; playerIndex++) { @@ -1356,7 +1545,7 @@ namespace CalamityMod.World // Spawn bosses if (Main.netMode != NetmodeID.MultiplayerClient) { - Main.PlaySound(SoundID.Roar, player.position, 0); + bool playSpecialSound = false; switch (bossRushStage) { case 0: @@ -1378,9 +1567,9 @@ namespace CalamityMod.World break; case 5: ChangeTime(true); - NPC.NewNPC((int)(player.position.X + (float)Main.rand.Next(-100, 101)), - (int)(player.position.Y - 400f), - NPCID.Golem, 0, 0f, 0f, 0f, 0f, 255); + int npc = NPC.NewNPC((int)(player.position.X + Main.rand.Next(-100, 101)), (int)(player.position.Y - 400f), NPCID.Golem, 1); + Main.npc[npc].timeLeft *= 20; + CalamityUtils.BossAwakenMessage(npc); break; case 6: ChangeTime(true); @@ -1416,8 +1605,10 @@ namespace CalamityMod.World break; case 14: ChangeTime(false); - NPC.SpawnOnPlayer(closestPlayer, NPCID.SkeletronHead); - break; + int npc6 = NPC.NewNPC((int)(player.position.X + Main.rand.Next(-100, 101)), (int)(player.position.Y - 400f), NPCID.SkeletronHead, 1); + Main.npc[npc6].timeLeft *= 20; + CalamityUtils.BossAwakenMessage(npc6); + break; case 15: ChangeTime(true); NPC.SpawnOnPlayer(closestPlayer, ModContent.NPCType()); @@ -1431,9 +1622,11 @@ namespace CalamityMod.World NPC.SpawnOnPlayer(closestPlayer, ModContent.NPCType()); break; case 18: - int num1302 = NPC.NewNPC((int)player.Center.X, (int)player.Center.Y - 400, NPCID.CultistBoss, 0, 0f, 0f, 0f, 0f, 255); - Main.npc[num1302].direction = Main.npc[num1302].spriteDirection = Math.Sign(player.Center.X - (float)player.Center.X - 90f); - break; + int npc2 = NPC.NewNPC((int)player.Center.X, (int)player.Center.Y - 400, NPCID.CultistBoss, 1); + Main.npc[npc2].direction = Main.npc[npc2].spriteDirection = Math.Sign(player.Center.X - player.Center.X - 90f); + Main.npc[npc2].timeLeft *= 20; + CalamityUtils.BossAwakenMessage(npc2); + break; case 19: for (int doom = 0; doom < Main.maxNPCs; doom++) { @@ -1445,8 +1638,10 @@ namespace CalamityMod.World Main.npc[doom].netUpdate = true; } } - NPC.NewNPC((int)(player.position.X + (float)Main.rand.Next(-100, 101)), (int)(player.position.Y - 400f), ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); - break; + int npc3 = NPC.NewNPC((int)(player.position.X + Main.rand.Next(-100, 101)), (int)(player.position.Y - 400f), ModContent.NPCType(), 1); + Main.npc[npc3].timeLeft *= 20; + CalamityUtils.BossAwakenMessage(npc3); + break; case 20: NPC.SpawnOnPlayer(closestPlayer, NPCID.Plantera); break; @@ -1466,11 +1661,17 @@ namespace CalamityMod.World NPC.SpawnOnPlayer(closestPlayer, ModContent.NPCType()); break; case 26: - NPC.NewNPC((int)(player.position.X + (float)Main.rand.Next(-100, 101)), (int)(player.position.Y - 400f), ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); - break; + playSpecialSound = true; + Main.PlaySound(SoundID.Roar, player.position, 2); + int npc4 = NPC.NewNPC((int)(player.position.X + Main.rand.Next(-100, 101)), (int)(player.position.Y - 400f), ModContent.NPCType(), 1); + Main.npc[npc4].timeLeft *= 20; + CalamityUtils.BossAwakenMessage(npc4); + break; case 27: - NPC.NewNPC((int)(player.position.X + (float)Main.rand.Next(-100, 101)), (int)(player.position.Y - 400f), NPCID.DukeFishron, 0, 0f, 0f, 0f, 0f, 255); - break; + int npc5 = NPC.NewNPC((int)(player.position.X + Main.rand.Next(-100, 101)), (int)(player.position.Y - 400f), NPCID.DukeFishron, 1); + Main.npc[npc5].timeLeft *= 20; + CalamityUtils.BossAwakenMessage(npc5); + break; case 28: NPC.SpawnOnPlayer(closestPlayer, NPCID.MoonLordCore); break; @@ -1493,26 +1694,39 @@ namespace CalamityMod.World ChangeTime(true); NPC.SpawnOnPlayer(closestPlayer, ModContent.NPCType()); break; - case 34: + case 34: + int npc7 = NPC.NewNPC((int)(player.position.X + Main.rand.Next(-100, 101)), (int)(player.position.Y - 400f), ModContent.NPCType(), 1); + Main.npc[npc7].timeLeft *= 20; + CalamityUtils.BossAwakenMessage(npc7); + break; + case 35: NPC.SpawnOnPlayer(closestPlayer, ModContent.NPCType()); NPC.SpawnOnPlayer(closestPlayer, ModContent.NPCType()); NPC.SpawnOnPlayer(closestPlayer, ModContent.NPCType()); break; - case 35: - ChangeTime(true); - NPC.SpawnOnPlayer(closestPlayer, ModContent.NPCType()); - break; case 36: - NPC.SpawnOnPlayer(closestPlayer, ModContent.NPCType()); + ChangeTime(true); + playSpecialSound = true; + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ProvidenceSpawn"), player.Center); + int prov = NPC.NewNPC((int)(player.position.X + Main.rand.Next(-500, 501)), (int)(player.position.Y - 250f), ModContent.NPCType(), 1); + Main.npc[prov].timeLeft *= 20; + CalamityUtils.BossAwakenMessage(prov); break; case 37: + NPC.SpawnOnPlayer(closestPlayer, ModContent.NPCType()); + break; + case 38: ChangeTime(true); NPC.SpawnOnPlayer(closestPlayer, ModContent.NPCType()); break; - case 38: + case 39: + playSpecialSound = true; + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/DevourerSpawn"), player.Center); NPC.SpawnOnPlayer(closestPlayer, ModContent.NPCType()); break; } + if (!playSpecialSound) + Main.PlaySound(SoundID.Roar, player.position, 0); } } } @@ -1532,6 +1746,19 @@ namespace CalamityMod.World } } } + if (bossRushHostileProjKillCounter > 0) + { + bossRushHostileProjKillCounter--; + if (bossRushHostileProjKillCounter == 1) + CalamityUtils.KillAllHostileProjectiles(); + if (Main.netMode == NetmodeID.Server) + { + var netMessage = mod.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.BRHostileProjKillSync); + netMessage.Write(bossRushHostileProjKillCounter); + netMessage.Send(); + } + } if (DoGSecondStageCountdown > 0) { @@ -1637,7 +1864,16 @@ namespace CalamityMod.World } } if (ArmoredDiggerSpawnCooldown > 0) + { ArmoredDiggerSpawnCooldown--; + if (Main.netMode == NetmodeID.Server) + { + var netMessage = mod.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.ArmoredDiggerCountdownSync); + netMessage.Write(ArmoredDiggerSpawnCooldown); + netMessage.Send(); + } + } if (Main.dayTime && Main.hardMode) { @@ -1676,7 +1912,7 @@ namespace CalamityMod.World } } - if (death && !CalamityPlayer.areThereAnyDamnBosses && !Main.snowMoon && !Main.pumpkinMoon && !DD2Event.Ongoing && player.statLifeMax2 >= 300) //does not occur while a boss is alive or during certain events + if (death && !CalamityPlayer.areThereAnyDamnBosses && !Main.snowMoon && !Main.pumpkinMoon && !DD2Event.Ongoing && player.statLifeMax2 >= 300 && !WorldGen.spawnEye && WorldGen.spawnHardBoss <= 0) //does not occur while a boss is alive or during certain events { if (bossSpawnCountdown <= 0 && deathBossSpawnCooldown <= 0) // Check for countdown and cooldown being 0 { diff --git a/World/DraedonStructures.cs b/World/DraedonStructures.cs new file mode 100644 index 0000000000..526553d08d --- /dev/null +++ b/World/DraedonStructures.cs @@ -0,0 +1,173 @@ +using CalamityMod.Items; +using CalamityMod.Items.Materials; +using CalamityMod.Schematics; +using Microsoft.Xna.Framework; +using System.Collections.Generic; +using System.Linq; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.World +{ + internal struct ChestItem + { + internal int Type; + internal int Stack; + internal ChestItem(int type, int stack) + { + Type = type; + Stack = stack; + } + } + public static class DraedonStructures + { + public static int CurrentWorkshopIndex; + public static int DraedonsLogWorkshopIndex; + public static void FillWorkshopChest(Chest chest) + { + int potionType = Utils.SelectRandom(WorldGen.genRand, ItemID.EndurancePotion, ItemID.GravitationPotion, ItemID.HeartreachPotion, ItemID.LifeforcePotion); + List contents = new List() + { + new ChestItem(ModContent.ItemType(), WorldGen.genRand.Next(8, 14 + 1)), + new ChestItem(ModContent.ItemType(), WorldGen.genRand.Next(7, 12 + 1)), + new ChestItem(ItemID.Torch, WorldGen.genRand.Next(15, 29 + 1)), + new ChestItem(ItemID.GoldCoin, WorldGen.genRand.Next(5, 11 + 1)), + new ChestItem(ItemID.HealingPotion, WorldGen.genRand.Next(5, 7 + 1)), + new ChestItem(ItemID.Bomb, WorldGen.genRand.Next(6, 7 + 1)), + new ChestItem(potionType, WorldGen.genRand.Next(3, 5 + 1)), + }; + if (CurrentWorkshopIndex == DraedonsLogWorkshopIndex) + contents.Insert(0, new ChestItem(ModContent.ItemType(), 1)); + for (int i = 0; i < contents.Count; i++) + { + chest.item[i].SetDefaults(contents[i].Type); + chest.item[i].stack = contents[i].Stack; + } + } + public static void FillLaboratoryChest(Chest chest) + { + int potionType = Utils.SelectRandom(WorldGen.genRand, ItemID.EndurancePotion, ItemID.GravitationPotion, ItemID.HeartreachPotion, ItemID.LifeforcePotion); + List contents = new List() + { + new ChestItem(ModContent.ItemType(), WorldGen.genRand.Next(10, 17 + 1)), + new ChestItem(ModContent.ItemType(), WorldGen.genRand.Next(10, 15 + 1)), + new ChestItem(ItemID.Torch, WorldGen.genRand.Next(20, 40 + 1)), + new ChestItem(ItemID.GoldCoin, WorldGen.genRand.Next(8, 16 + 1)), + new ChestItem(ItemID.HealingPotion, WorldGen.genRand.Next(7, 10 + 1)), + new ChestItem(ItemID.Dynamite, WorldGen.genRand.Next(4, 6 + 1)), + new ChestItem(potionType, WorldGen.genRand.Next(4, 7 + 1)), + }; + for (int i = 0; i < contents.Count; i++) + { + chest.item[i].SetDefaults(contents[i].Type); + chest.item[i].stack = contents[i].Stack; + } + } + public static bool ShouldAvoidLocation(Point placementPoint) + { + Tile tile = CalamityUtils.ParanoidTileRetrieval(placementPoint.X, placementPoint.Y); + if (tile.lava()) + return true; + if (tile.type == TileID.BlueDungeonBrick || + tile.type == TileID.GreenDungeonBrick || + tile.type == TileID.PinkDungeonBrick) + { + return true; + } + if (tile.type == TileID.LihzahrdBrick || + tile.wall == WallID.LihzahrdBrickUnsafe) + { + return true; + } + if (tile.type == TileID.Crimstone || + tile.wall == WallID.CrimstoneUnsafe || + tile.type == TileID.Ebonstone || + tile.wall == WallID.EbonstoneUnsafe) + { + return true; + } + return false; + } + public static void PlaceWorkshop(out Point placementPoint, List workshopPoints, string mapKey) + { + int tries = 0; + + TryAgain: + int underworldTop = Main.maxTilesY - 200; + int placementPositionX = WorldGen.genRand.Next((int)(Main.maxTilesX * 0.1f), (int)(Main.maxTilesX * 0.9f)); + int placementPositionY = WorldGen.genRand.Next(underworldTop - 550, underworldTop - 50); + + placementPoint = new Point(placementPositionX, placementPositionY); + Vector2 schematicSize = new Vector2(SchematicLoader.TileMaps[mapKey].GetLength(0), SchematicLoader.TileMaps[mapKey].GetLength(1)); + int activeTilesInArea = 0; + int xCheckArea = 40; + bool canGenerateInLocation = true; + + // new Vector2 is used here since a lambda expression cannot capture a ref, out, or in parameter. + bool nearbyOtherWorkshop = workshopPoints.Any(point => Vector2.Distance(point.ToVector2(), new Vector2(placementPositionX, placementPositionY)) < 240f); + float totalTiles = (schematicSize.X + xCheckArea * 2) * schematicSize.Y; + for (int x = placementPoint.X - xCheckArea; x < placementPoint.X + schematicSize.X + xCheckArea; x++) + { + for (int y = placementPoint.Y; y < placementPoint.Y + schematicSize.Y; y++) + { + Tile tile = CalamityUtils.ParanoidTileRetrieval(x, y); + if (tile.active()) + { + if (ShouldAvoidLocation(new Point(x, y))) + canGenerateInLocation = false; + activeTilesInArea++; + } + } + } + if (!canGenerateInLocation || nearbyOtherWorkshop || activeTilesInArea / totalTiles > 0.35f) + { + tries++; + if (tries > 25000) + return; + goto TryAgain; // Try again elsewhere if the correct conditions are not met. (Yes, I'm using a goto. Please don't kill me) + } + SchematicPlacementHelpers.PlaceStructure(mapKey, new Point(placementPoint.X, placementPoint.Y), SchematicPlacementHelpers.PlacementAnchorType.TopLeft, FillWorkshopChest); + } + public static void PlaceResearchFacility(out Point placementPoint, List workshopPoints, string mapKey) + { + int tries = 0; + + TryAgain: + int underworldTop = Main.maxTilesY - 200; + int placementPositionX = WorldGen.genRand.Next((int)(Main.maxTilesX * 0.15f), (int)(Main.maxTilesX * 0.85f)); + int placementPositionY = WorldGen.genRand.Next(underworldTop - 400, underworldTop - 50); + + placementPoint = new Point(placementPositionX, placementPositionY); + Vector2 schematicSize = new Vector2(SchematicLoader.TileMaps[mapKey].GetLength(0), SchematicLoader.TileMaps[mapKey].GetLength(1)); + int activeTilesInArea = 0; + int xCheckArea = 30; + bool canGenerateInLocation = true; + + // new Vector2 is used here since a lambda expression cannot capture a ref, out, or in parameter. + bool nearbyOtherWorkshop = workshopPoints.Any(point => Vector2.Distance(point.ToVector2(), new Vector2(placementPositionX, placementPositionY)) < 240f); + float totalTiles = (schematicSize.X + xCheckArea * 2) * schematicSize.Y; + for (int x = placementPoint.X - xCheckArea; x < placementPoint.X + schematicSize.X + xCheckArea; x++) + { + for (int y = placementPoint.Y; y < placementPoint.Y + schematicSize.Y; y++) + { + Tile tile = CalamityUtils.ParanoidTileRetrieval(x, y); + if (tile.active()) + { + if (ShouldAvoidLocation(new Point(x, y))) + canGenerateInLocation = false; + activeTilesInArea++; + } + } + } + if (!canGenerateInLocation || nearbyOtherWorkshop || activeTilesInArea / totalTiles > 0.35f) + { + tries++; + if (tries > 25000) + return; + goto TryAgain; // Try again elsewhere if the correct conditions are not met. (Yes, I'm using a goto. Please don't kill me) + } + SchematicPlacementHelpers.PlaceStructure(mapKey, new Point(placementPoint.X, placementPoint.Y), SchematicPlacementHelpers.PlacementAnchorType.TopLeft, FillLaboratoryChest); + } + } +} diff --git a/World/SunkenSea.cs b/World/SunkenSea.cs index 95882ac4ae..72f0cbac25 100644 --- a/World/SunkenSea.cs +++ b/World/SunkenSea.cs @@ -88,8 +88,8 @@ namespace CalamityMod.World Point point = new Point(num, num2); for (int i = point.Y - num2; i <= point.Y + num2; i++) { - float num4 = num / num2 * (float)(i - point.Y); - int num5 = Math.Min(num, (int)Math.Sqrt(num3 - num4 * num4)); + float num4 = (float)num / (float)num2 * (float)(i - point.Y); + int num5 = Math.Min(num, (int)Math.Sqrt((float)num3 - num4 * num4)); for (int j = point.X - num5; j <= point.X + num5; j++) { array[j, i] = WorldGen.genRand.Next(2) == 0; @@ -186,7 +186,7 @@ namespace CalamityMod.World { foreach (Point current4 in current3) { - cluster.Add(new Hub(current4.X + (WorldGen.genRand.NextFloat() - 0.5f) * 0.5f, current4.Y + (WorldGen.genRand.NextFloat() - 0.5f) * 0.5f)); + cluster.Add(new Hub((float)current4.X + (WorldGen.genRand.NextFloat() - 0.5f) * 0.5f, (float)current4.Y + (WorldGen.genRand.NextFloat() - 0.5f) * 0.5f)); } Add(cluster); } @@ -196,11 +196,11 @@ namespace CalamityMod.World private static void PlaceClusters(ClusterGroup clusters, Point start, Vector2 scale) //Places tile/wall clusters in Sunken Sea area { - int num = (int)(scale.X * clusters.Width); - int num2 = (int)(scale.Y * clusters.Height); - Vector2 value = new Vector2(num, num2); - Vector2 value2 = new Vector2(clusters.Width, clusters.Height); - for (int i = -20; i < num + 20; i++) + int num = (int)(scale.X * (float)clusters.Width); + int num2 = (int)(scale.Y * (float)clusters.Height); + Vector2 value = new Vector2((float)num, (float)num2); + Vector2 value2 = new Vector2((float)clusters.Width, (float)clusters.Height); + for (int i = -20; i < num + 20; i++) { for (int j = -20; j < num2 + 20; j++) { @@ -209,9 +209,9 @@ namespace CalamityMod.World float num5 = 0f; int num6 = i + start.X; int num7 = j + start.Y; - Vector2 vector = new Vector2(i, j) / value * value2; - float num8 = (new Vector2(i, j) / value * 2f - Vector2.One).Length(); - for (int k = 0; k < clusters.Count; k++) + Vector2 vector = new Vector2((float)i, (float)j) / value * value2; + float num8 = (new Vector2((float)i, (float)j) / value * 2f - Vector2.One).Length(); + for (int k = 0; k < clusters.Count; k++) { Cluster cluster = clusters[k]; if (Math.Abs(cluster[0].Position.X - vector.X) <= 10f && Math.Abs(cluster[0].Position.Y - vector.Y) <= 10f) @@ -303,18 +303,18 @@ namespace CalamityMod.World private static void AddTileVariance(ClusterGroup clusters, Point start, Vector2 scale, float size) /*Adds tile variation to the generated tile clusters and generates open areas with sea prism ore; Generates sea prism crystals on prism ore and occasionally on navystone*/ { - int num = (int)(scale.X * clusters.Width); - int num2 = (int)(scale.Y * clusters.Height); - bool genCentalHole = true; + int num = (int)(scale.X * (float)clusters.Width); + int num2 = (int)(scale.Y * (float)clusters.Height); + bool genCentalHole = true; Rectangle rectangle = default; - int radius = (int)(WorldGen.genRand.Next(24, 28) * size); //Radius of the generated hole - int diameter = radius * 2; + int radius = (int)(((float)WorldGen.genRand.Next(24, 28)) * size); //Radius of the generated hole + int diameter = radius * 2; Point point = new Point(WorldGen.UndergroundDesertLocation.Left + (WorldGen.UndergroundDesertLocation.Width / 2), WorldGen.UndergroundDesertLocation.Bottom + (WorldGen.UndergroundDesertLocation.Height / 3)); //Around the center of the Sunken Sea area ShapeData holeShape = new ShapeData(); - float outerRadiusPercentage = (float)(WorldGen.genRand.Next(40, 56) * 0.01); //Small radius for ore patch to fit inside holes - int sunkenSeaBottom = WorldGen.UndergroundDesertLocation.Bottom + (int)(WorldGen.UndergroundDesertLocation.Height * 0.7); - int smallHoles = 0; + float outerRadiusPercentage = (float)((double)WorldGen.genRand.Next(40, 56) * 0.01); //Small radius for ore patch to fit inside holes + int sunkenSeaBottom = WorldGen.UndergroundDesertLocation.Bottom + (int)((double)WorldGen.UndergroundDesertLocation.Height * 0.7); + int smallHoles = 0; int amt = (int)(4f * size); //Scale amount of holes with world size for (int i = -20; i < num + 20; i++) { @@ -341,7 +341,7 @@ namespace CalamityMod.World new Actions.SetFrames(true) })); - WorldUtils.Gen(point, new Shapes.Circle((int)(radius * outerRadiusPercentage)), Actions.Chain(new GenAction[] //Smallest is 6 + WorldUtils.Gen(point, new Shapes.Circle((int)((float)radius * outerRadiusPercentage)), Actions.Chain(new GenAction[] //Smallest is 6 { new Modifiers.Blotches(2, 0.3).Output(holeShape), new Actions.SetTile((ushort)ModContent.TileType(), true) //Place outer shell @@ -355,13 +355,13 @@ namespace CalamityMod.World new Actions.SetFrames(true) })); - WorldUtils.Gen(point, new Shapes.Circle((int)(radius * (outerRadiusPercentage * 0.6f))), Actions.Chain(new GenAction[] //Smallest is 4 + WorldUtils.Gen(point, new Shapes.Circle((int)((float)radius * (outerRadiusPercentage * 0.6f))), Actions.Chain(new GenAction[] //Smallest is 4 { new Modifiers.Blotches(2, 0.3), new Actions.SetTile((ushort)ModContent.TileType(), true) //Place prism })); - WorldUtils.Gen(point, new Shapes.Circle((int)(radius * (outerRadiusPercentage * 0.3f))), Actions.Chain(new GenAction[] //Smallest is 2 + WorldUtils.Gen(point, new Shapes.Circle((int)((float)radius * (outerRadiusPercentage * 0.3f))), Actions.Chain(new GenAction[] //Smallest is 2 { new Modifiers.Blotches(2, 0.3).Output(holeShape), new Actions.ClearTile(true), //Clear all tiles @@ -381,8 +381,8 @@ namespace CalamityMod.World if (smallHoles < amt && WorldGen.genRand.Next(3) == 0 && !rectangle.Contains(point)) { smallHoles++; - int radiusSmall = (int)(WorldGen.genRand.Next(8, 11) * size); - WorldUtils.Gen(point, new Shapes.Circle(radiusSmall), Actions.Chain(new GenAction[] + int radiusSmall = (int)(((float)WorldGen.genRand.Next(8, 11)) * size); + WorldUtils.Gen(point, new Shapes.Circle(radiusSmall), Actions.Chain(new GenAction[] { new Modifiers.Blotches(2, 0.45).Output(holeShape), new Actions.ClearTile(true), @@ -397,8 +397,8 @@ namespace CalamityMod.World new Actions.SetFrames(true) })); - outerRadiusPercentage = (float)(WorldGen.genRand.Next(65, 81) * 0.01); - WorldUtils.Gen(point, new Shapes.Circle((int)(radiusSmall * outerRadiusPercentage)), Actions.Chain(new GenAction[] //Smallest is 4 + outerRadiusPercentage = (float)((double)WorldGen.genRand.Next(65, 81) * 0.01); + WorldUtils.Gen(point, new Shapes.Circle((int)((float)radiusSmall * outerRadiusPercentage)), Actions.Chain(new GenAction[] //Smallest is 4 { new Modifiers.Blotches(2, 0.3).Output(holeShape), new Actions.SetTile((ushort)ModContent.TileType(), true) //Place outer shell @@ -412,13 +412,13 @@ namespace CalamityMod.World new Actions.SetFrames(true) })); - WorldUtils.Gen(point, new Shapes.Circle((int)(radiusSmall * (outerRadiusPercentage * 0.6f))), Actions.Chain(new GenAction[] //Smallest is 2 + WorldUtils.Gen(point, new Shapes.Circle((int)((float)radiusSmall * (outerRadiusPercentage * 0.6f))), Actions.Chain(new GenAction[] //Smallest is 2 { new Modifiers.Blotches(2, 0.3), new Actions.SetTile((ushort)ModContent.TileType(), true) //Place prism })); - WorldUtils.Gen(point, new Shapes.Circle((int)(radiusSmall * (outerRadiusPercentage * 0.3f))), Actions.Chain(new GenAction[] //Smallest is 1 + WorldUtils.Gen(point, new Shapes.Circle((int)((float)radiusSmall * (outerRadiusPercentage * 0.3f))), Actions.Chain(new GenAction[] //Smallest is 1 { new Modifiers.Blotches(2, 0.3).Output(holeShape), new Actions.ClearTile(true), //Clear center @@ -501,12 +501,12 @@ namespace CalamityMod.World tile3.type = (ushort)ModContent.TileType(); if (Main.tile[num5 - 1, num6].type == ModContent.TileType()) { - Main.tile[num5 - 1, num6].frameY = 2 * 18; - } + Main.tile[num5 - 1, num6].frameY = (short)(2 * 18); + } else if (Main.tile[num5 + 1, num6].type == ModContent.TileType()) { - Main.tile[num5 + 1, num6].frameY = 3 * 18; - } + Main.tile[num5 + 1, num6].frameY = (short)(3 * 18); + } tile3.frameX = (short)(WorldGen.genRand.Next(18) * 18); tile3.active(true); } @@ -519,12 +519,12 @@ namespace CalamityMod.World tile3.type = (ushort)ModContent.TileType(); if (Main.tile[num5, num6 - 1].type == ModContent.TileType()) { - Main.tile[num5, num6 - 1].frameY = 0 * 18; - } + Main.tile[num5, num6 - 1].frameY = (short)(0 * 18); + } else if (Main.tile[num5, num6 + 1].type == ModContent.TileType()) { - Main.tile[num5, num6 + 1].frameY = 1 * 18; - } + Main.tile[num5, num6 + 1].frameY = (short)(1 * 18); + } tile3.frameX = (short)(WorldGen.genRand.Next(18) * 18); tile3.active(true); } @@ -576,19 +576,19 @@ namespace CalamityMod.World public static bool Place(Point origin) { // 1 on Small, 1.52 on Medium, 2 on Large - float scale = Main.maxTilesX / 4200f; + float scale = (float)Main.maxTilesX / 4200f; // Clamp scale to prevent problems on extra large worlds scale = MathHelper.Clamp(scale, 1f, 2f); int sunkenSeaAreaX = (int)(80f * scale); //80f int sunkenSeaAreaY = (int)((WorldGen.genRand.NextFloat() + 1f) * 60f * scale); //80f - float radius = WorldGen.genRand.Next(6, 10); + float radius = (float)WorldGen.genRand.Next(6, 10); Vector2 vector = new Vector2(4f, 2f); //4, 2 ClusterGroup clusterGroup = new ClusterGroup(); clusterGroup.Generate(sunkenSeaAreaX, sunkenSeaAreaY); PlaceClusters(clusterGroup, origin, vector); AddTileVariance(clusterGroup, origin, vector, scale); - int num4 = (int)(vector.X * clusterGroup.Width); - int num5 = (int)(vector.Y * clusterGroup.Height); + int num4 = (int)(vector.X * (float)clusterGroup.Width); + int num5 = (int)(vector.Y * (float)clusterGroup.Height); for (int i = -40; i < num4 + 40; i++) //40 { for (int j = -40; j < num5 + 40; j++) //40 diff --git a/World/WorldGenerationMethods.cs b/World/WorldGenerationMethods.cs index d4de0fd404..1206237398 100644 --- a/World/WorldGenerationMethods.cs +++ b/World/WorldGenerationMethods.cs @@ -11,6 +11,7 @@ using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Schematics; using CalamityMod.Tiles; using CalamityMod.Tiles.Abyss; using CalamityMod.Tiles.Astral; @@ -1598,11 +1599,37 @@ namespace CalamityMod.World } } } + if (Main.netMode != NetmodeID.MultiplayerClient) { NetMessage.SendTileSquare(-1, i, j, 40, TileChangeType.None); if (CanAstralBiomeSpawn()) + { DoAstralConversion(new Point(i, j)); + int checkWidth = 180; + float averageHeight = 0f; + float lowestHeight = 0f; + for (int x = i - checkWidth / 2; x < i + checkWidth / 2; x++) + { + int y = j - 200; + while (!CalamityUtils.ParanoidTileRetrieval(x, y).active() || CalamityUtils.ParanoidTileRetrieval(x, y).type == TileID.Trees) + { + y++; + if (y > j - 10) + break; + } + lowestHeight = (int)MathHelper.Max(lowestHeight, y); + averageHeight += y; + } + lowestHeight -= 36f; + averageHeight /= checkWidth; + float height = lowestHeight; + + // If there's a sudden change between the average and lowest height (which is indicative of holes/chasms), go with the average. + if (Math.Abs(lowestHeight - averageHeight) > 50f) + height = averageHeight; + SchematicPlacementHelpers.PlaceStructure("Astral Beacon", new Point(i, (int)height - 20), SchematicPlacementHelpers.PlacementAnchorType.Center); + } } return true; } @@ -4043,7 +4070,7 @@ namespace CalamityMod.World #region ChasmGenerator public static void ChasmGenerator(int i, int j, int steps, bool ocean = false) { - float num = (float)steps; //850 small 1450 medium 2050 large + float num = steps; //850 small 1450 medium 2050 large if (ocean) { int tileYLookup = j; @@ -4064,19 +4091,19 @@ namespace CalamityMod.World j = tileYLookup; } Vector2 vector; - vector.X = (float)i; - vector.Y = (float)j; + vector.X = i; + vector.Y = j; Vector2 vector2; - vector2.X = (float)WorldGen.genRand.Next(-1, 2) * 0.1f; - vector2.Y = (float)WorldGen.genRand.Next(3, 8) * 0.2f + 0.5f; + vector2.X = WorldGen.genRand.Next(-1, 2) * 0.1f; + vector2.Y = WorldGen.genRand.Next(3, 8) * 0.2f + 0.5f; int num2 = 5; - double num3 = (double)(WorldGen.genRand.Next(5, 7) + 20); //start width + double num3 = WorldGen.genRand.Next(5, 7) + 20; //start width while (num3 > 0.0) { if (num > 0f) { - num3 += (double)WorldGen.genRand.Next(2); - num3 -= (double)WorldGen.genRand.Next(2); + num3 += WorldGen.genRand.Next(2); + num3 -= WorldGen.genRand.Next(2); float smallHoleLimit = 790f; //small if (Main.maxTilesY > 1500) { smallHoleLimit = 1360f; if (Main.maxTilesY > 2100) { smallHoleLimit = 1950f; } } @@ -4093,17 +4120,17 @@ namespace CalamityMod.World } else //dig large hole { - if (num3 < (ocean ? 30.0 : 8.0)) //min width + if (num3 < (ocean ? 45.0 : 8.0)) //min width { - num3 = ocean ? 30.0 : 8.0; //min width + num3 = ocean ? 45.0 : 8.0; //min width } - if (num3 > (ocean ? 35.0 : 20.0)) //max width + if (num3 > (ocean ? 50.0 : 20.0)) //max width { - num3 = ocean ? 35.0 : 20.0; //max width + num3 = ocean ? 50.0 : 20.0; //max width } - if (num == 1f && num3 < (ocean ? 30.0 : 15.0)) + if (num == 1f && num3 < (ocean ? 50.0 : 15.0)) { - num3 = ocean ? 30.0 : 15.0; + num3 = ocean ? 50.0 : 15.0; } } } @@ -4111,13 +4138,13 @@ namespace CalamityMod.World { if ((double)vector.Y > CalamityWorld.abyssChasmBottom) { - num3 -= (double)(WorldGen.genRand.Next(5) + 8); + num3 -= WorldGen.genRand.Next(5) + 8; } } if (Main.maxTilesY > 2100) { if (((double)vector.Y > CalamityWorld.abyssChasmBottom && num > 0f && ocean) || - ((double)vector.Y >= (double)Main.maxTilesY && num > 0f && !ocean)) + (vector.Y >= Main.maxTilesY && num > 0f && !ocean)) { num = 0f; } @@ -4125,7 +4152,7 @@ namespace CalamityMod.World else if (Main.maxTilesY > 1500) { if (((double)vector.Y > CalamityWorld.abyssChasmBottom && num > 0f && ocean) || - ((double)vector.Y > (double)Main.maxTilesY && num > 0f && !ocean)) + (vector.Y > Main.maxTilesY && num > 0f && !ocean)) { num = 0f; } @@ -4133,7 +4160,7 @@ namespace CalamityMod.World else { if (((double)vector.Y > CalamityWorld.abyssChasmBottom && num > 0f && ocean) || - ((double)vector.Y > (double)Main.maxTilesY && num > 0f && !ocean)) + (vector.Y > Main.maxTilesY && num > 0f && !ocean)) { num = 0f; } @@ -4143,12 +4170,12 @@ namespace CalamityMod.World int num5; int num6; int num7; - if (num > (float)num2) + if (num > num2) { - num4 = (int)((double)vector.X - num3 * 0.5); - num5 = (int)((double)vector.X + num3 * 0.5); - num6 = (int)((double)vector.Y - num3 * 0.5); - num7 = (int)((double)vector.Y + num3 * 0.5); + num4 = (int)(vector.X - num3 * 0.5); + num5 = (int)(vector.X + num3 * 0.5); + num6 = (int)(vector.Y - num3 * 0.5); + num7 = (int)(vector.Y + num3 * 0.5); if (num4 < 0) { num4 = 0; @@ -4169,7 +4196,7 @@ namespace CalamityMod.World { for (int l = num6; l < num7; l++) { - if ((double)(Math.Abs((float)k - vector.X) + Math.Abs((float)l - vector.Y)) < num3 * 0.5 * (1.0 + (double)WorldGen.genRand.Next(-5, 6) * 0.015)) + if ((Math.Abs(k - vector.X) + Math.Abs(l - vector.Y)) < num3 * 0.5 * (1.0 + WorldGen.genRand.Next(-5, 6) * 0.015)) { if (ocean) { @@ -4187,24 +4214,24 @@ namespace CalamityMod.World } } } - if (num <= 2f && (double)vector.Y < (Main.rockLayer + (double)Main.maxTilesY * 0.3)) + if (num <= 2f && vector.Y < (Main.rockLayer + Main.maxTilesY * 0.3)) { num = 2f; } vector += vector2; - vector2.X += (float)WorldGen.genRand.Next(-1, 2) * 0.01f; - if ((double)vector2.X > 0.02) + vector2.X += WorldGen.genRand.Next(-1, 2) * 0.01f; + if (vector2.X > 0.02) { vector2.X = 0.02f; } - if ((double)vector2.X < -0.02) + if (vector2.X < -0.02) { vector2.X = -0.02f; } - num4 = (int)((double)vector.X - num3 * 1.1); - num5 = (int)((double)vector.X + num3 * 1.1); - num6 = (int)((double)vector.Y - num3 * 1.1); - num7 = (int)((double)vector.Y + num3 * 1.1); + num4 = (int)(vector.X - num3 * 1.1); + num5 = (int)(vector.X + num3 * 1.1); + num6 = (int)(vector.Y - num3 * 1.1); + num7 = (int)(vector.Y + num3 * 1.1); if (num4 < 1) { num4 = 1; @@ -4225,7 +4252,7 @@ namespace CalamityMod.World { for (int n = num6; n < num7; n++) { - if ((double)(Math.Abs((float)m - vector.X) + Math.Abs((float)n - vector.Y)) < num3 * 1.1 * (1.0 + (double)WorldGen.genRand.Next(-5, 6) * 0.015)) + if ((Math.Abs(m - vector.X) + Math.Abs(n - vector.Y)) < num3 * 1.1 * (1.0 + WorldGen.genRand.Next(-5, 6) * 0.015)) { if (n > j + WorldGen.genRand.Next(7, 16)) { @@ -4252,7 +4279,7 @@ namespace CalamityMod.World { for (int num12 = num6; num12 < num7; num12++) { - if ((double)(Math.Abs((float)num11 - vector.X) + Math.Abs((float)num12 - vector.Y)) < num3 * 1.1 * (1.0 + (double)WorldGen.genRand.Next(-5, 6) * 0.015)) + if ((Math.Abs(num11 - vector.X) + Math.Abs(num12 - vector.Y)) < num3 * 1.1 * (1.0 + WorldGen.genRand.Next(-5, 6) * 0.015)) { if (ocean) { diff --git a/build.txt b/build.txt index b61b3f685b..10f7c9f146 100644 --- a/build.txt +++ b/build.txt @@ -1,5 +1,5 @@ author = Fabsol and the Dev Team -version = 1.4.4.004 +version = 1.4.5.001 displayName = Calamity Mod (No Calamity Music) homepage = https://forums.terraria.org/index.php?threads/calamity-mod.44065/ buildIgnore = .vs\*, Properties\*, *.csproj, *.user, obj\*, bin\*, *.config, .git\*, LICENSE, README.md, .editorconfig, .gitignore, .gitattributes