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/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/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/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index e07673a761..25878cd6e6 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -21,6 +21,7 @@ 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; @@ -43,6 +44,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; @@ -118,8 +120,21 @@ namespace CalamityMod.CalPlayer public bool brimlashBusterBoost = false; #endregion - #region External variables -- Only set by Mod.Call - public int externalAbyssLight = 0; + 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 + public int externalAbyssLight = 0; public bool externalColdImmunity = false; public bool externalHeatImmunity = false; #endregion @@ -908,9 +923,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 @@ -946,11 +965,6 @@ 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; @@ -963,8 +977,6 @@ namespace CalamityMod.CalPlayer public bool meldTransformationPower; #endregion - #endregion - #region SavingAndLoading public override void Initialize() { @@ -1264,7 +1276,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) @@ -1925,17 +1937,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; @@ -2294,6 +2308,15 @@ 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; @@ -2348,6 +2371,19 @@ 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); @@ -3300,11 +3336,6 @@ 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; @@ -3481,11 +3512,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) { @@ -3589,6 +3616,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 @@ -3805,6 +3862,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) @@ -5954,6 +6012,47 @@ namespace CalamityMod.CalPlayer 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()) @@ -6000,6 +6099,17 @@ 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; @@ -6029,7 +6139,7 @@ namespace CalamityMod.CalPlayer } } } - } + } #endregion #region Modify Hit By Proj @@ -6076,6 +6186,10 @@ namespace CalamityMod.CalPlayer 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; @@ -6183,6 +6297,47 @@ namespace CalamityMod.CalPlayer projectileDamageReduction += 0.25; } + if (trinketOfChiBuff) + projectileDamageReduction += 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)) + projectileDamageReduction += 0.15; + + if (abyssalDivingSuitPlates) + projectileDamageReduction += 0.15; + + if (sirenIce) + projectileDamageReduction += 0.2; + + if (encased) + projectileDamageReduction += 0.3; + + 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()) @@ -6221,7 +6376,18 @@ namespace CalamityMod.CalPlayer damage = (int)(damage * projectileDamageReduction); } - if (player.whoAmI == Main.myPlayer && gainRageCooldown <= 0) + 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)) { @@ -7087,13 +7253,6 @@ namespace CalamityMod.CalPlayer player.head = mod.GetEquipSlot("SirenHead", EquipType.Head); player.face = -1; } - 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); - player.face = -1; - } else if (meldTransformationPower || meldTransformationForce) { player.legs = mod.GetEquipSlot("MeldTransformationLegs", EquipType.Legs); @@ -7213,7 +7372,7 @@ 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 @@ -7233,7 +7392,6 @@ namespace CalamityMod.CalPlayer } } - #region MultiplierBoosts double damageMult = 1.0 + (dArtifact ? 0.25 : 0.0) + @@ -7274,76 +7432,20 @@ namespace CalamityMod.CalPlayer if (CalamityWorld.ironHeart) { - int damageMin = player.statLifeMax2 / 4; + int damageMin = 60 + (player.statLifeMax2 / 10); playSound = false; hurtSoundTimer = 20; - if (damage < damageMin) - { - damage = damageMin; + 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); } - #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 (purpleCandle) + damage = (int)(damage - (player.statDefense * 0.05)); - 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 ((godSlayerDamage && damage <= 80) || damage < 1) - { + if ((godSlayerDamage && damage <= 80) || damage < 1) damage = 1; - } #region HealingEffects if (revivify) @@ -7489,7 +7591,7 @@ 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++) @@ -9738,8 +9840,9 @@ namespace CalamityMod.CalPlayer tailFrame = 0; } tailFrameUp = 0; - } - } + } + Main.blockInput = PopupGUIManager.AnyGUIsActive; + } public static readonly PlayerLayer Tail = new PlayerLayer("CalamityMod", "Tail", PlayerLayer.BackAcc, delegate (PlayerDrawInfo drawInfo) { @@ -12091,7 +12194,7 @@ namespace CalamityMod.CalPlayer 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/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index b142dd257b..c9188c47bd 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -429,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; @@ -1249,7 +1249,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) @@ -1258,11 +1258,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) { @@ -1912,7 +1912,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% @@ -1976,7 +1976,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 @@ -2848,7 +2848,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; } diff --git a/CalamityMod.cs b/CalamityMod.cs index e81ce5773c..aa21425f3c 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -86,6 +86,9 @@ using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Config; using Terraria.UI; +using CalamityMod.Schematics; +using CalamityMod.Tiles; +using CalamityMod.TileEntities; namespace CalamityMod { @@ -112,7 +115,7 @@ namespace CalamityMod 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; @@ -245,7 +248,6 @@ namespace CalamityMod } ILChanges.Initialize(); - thorium = ModLoader.GetMod("ThoriumMod"); BossHealthBarManager.Load(this); @@ -269,10 +271,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"); @@ -335,13 +333,17 @@ namespace CalamityMod GameShaders.Misc["CalamityMod:SubsumingTentacle"] = new MiscShaderData(new Ref(TentacleShader), "BurstPass"); - RipperUI.Reset(); + RipperUI.Reset(); AstralArcanumUI.Load(this); GameShaders.Hair.BindShader(ModContent.ItemType(), new LegacyHairShaderData().UseLegacyMethod((Player player, Color newColor, ref bool lighting) => Color.Lerp(player.hairColor, new Color(0, 255, 171), ((float)player.Calamity().adrenaline / (float)player.Calamity().adrenalineMax)))); 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 @@ -450,6 +452,8 @@ namespace CalamityMod Instance = null; + PopupGUIManager.UnloadGUIs(); + SchematicLoader.UnloadEverything(); BossHealthBarManager.Unload(); base.Unload(); @@ -473,7 +477,7 @@ namespace CalamityMod rainOriginal = null; manaOriginal = null; carpetOriginal = null; - } + } #endregion #region Late Loading @@ -3345,6 +3349,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 () { @@ -3379,6 +3406,11 @@ namespace CalamityMod } return true; }, InterfaceScaleType.None)); + layers.Insert(invasionIndex + 1, new LegacyGameInterfaceLayer("Popup GUIs", () => + { + PopupGUIManager.UpdateAndDraw(Main.spriteBatch); + return true; + }, InterfaceScaleType.None)); } } @@ -4033,6 +4065,27 @@ namespace CalamityMod // Not strictly necessary, but helps prevent unnecessary packetstorm in MP 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(); + 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(); @@ -4124,6 +4177,9 @@ namespace CalamityMod AcidRainOldDukeSummonSync, GaelsGreatswordSwingSync, SpawnSuperDummy, - SyncCalamityNPCAIArray + SyncCalamityNPCAIArray, + DraedonGeneratorStackSync, + DraedonChargerSync, + DraedonFieldGeneratorSync } } 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/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/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/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 b61d810c24..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"); diff --git a/Items/Accessories/SirensHeartAlt.cs b/Items/Accessories/SirensHeartAlt.cs deleted file mode 100644 index 065f4e94f7..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 = CalamityGlobalItem.Rarity4BuyPrice; - item.rare = 4; - } - - 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/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index a039cc81fe..d449e43c63 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; @@ -59,8 +60,14 @@ 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 = ChargeMax; + public bool Chargeable = false; + public const int ChargeMax = 150; + public const float ChargeDamageMinMultiplier = 0.4f; + + // Rarity is provided both as the classic int and the new enum. + public CalamityRarity customRarity = CalamityRarity.NoEffect; public int postMoonLordRarity { get => (int)customRarity; @@ -211,6 +218,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) { @@ -446,15 +457,10 @@ namespace CalamityMod.Items { return new TagCompound { - { - "rogue", rogue - }, - { - "timesUsed", timesUsed - }, - { - "rarity", (int)customRarity - } + ["rogue"] = rogue, + ["timesUsed"] = timesUsed, + ["rarity"] = (int)customRarity, + ["Charge"] = CurrentCharge }; } @@ -463,6 +469,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) @@ -470,6 +477,7 @@ namespace CalamityMod.Items int loadVersion = reader.ReadInt32(); customRarity = (CalamityRarity)reader.ReadInt32(); timesUsed = reader.ReadInt32(); + CurrentCharge = reader.ReadInt32(); if (loadVersion == 0) { @@ -490,6 +498,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) @@ -499,6 +508,7 @@ namespace CalamityMod.Items customRarity = (CalamityRarity)reader.ReadInt32(); timesUsed = reader.ReadInt32(); + CurrentCharge = reader.ReadInt32(); } #endregion @@ -866,6 +876,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)) { @@ -985,6 +1000,16 @@ 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) + { + mult *= MathHelper.Lerp(ChargeDamageMinMultiplier, 1f, item.Calamity().CurrentCharge / (float)ChargeMax); + } + } + #endregion + #region Modify Tooltips public override void ModifyTooltips(Item item, List tooltips) { @@ -1128,9 +1153,9 @@ namespace CalamityMod.Items } } } - #endregion + #endregion - /*if (item.ammo == 97) + /*if (item.ammo == 97) { foreach (TooltipLine line2 in tooltips) { @@ -1142,7 +1167,7 @@ namespace CalamityMod.Items } }*/ - if (item.type == ItemID.RodofDiscord) + if (item.type == ItemID.RodofDiscord) { foreach (TooltipLine line2 in tooltips) { @@ -2725,7 +2750,15 @@ 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); } - } + } + + 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 diff --git a/Items/DraedonsLog.cs b/Items/DraedonsLog.cs new file mode 100644 index 0000000000..337678cf9d --- /dev/null +++ b/Items/DraedonsLog.cs @@ -0,0 +1,34 @@ +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 = 11; + 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/Materials/BloodOrb.cs b/Items/Materials/BloodOrb.cs index 5dc7343cb8..22c6e82464 100644 --- a/Items/Materials/BloodOrb.cs +++ b/Items/Materials/BloodOrb.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Items.Materials { public override void SetStaticDefaults() { - DisplayName.SetDefault("Blorb"); + DisplayName.SetDefault("Blood Orb"); } public override void SetDefaults() @@ -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/DubiousPlating.cs b/Items/Materials/DubiousPlating.cs new file mode 100644 index 0000000000..4ab4787e59 --- /dev/null +++ b/Items/Materials/DubiousPlating.cs @@ -0,0 +1,22 @@ +using Terraria; +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.value = Item.sellPrice(silver: 3); + item.rare = 1; + } + } +} 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/MysteriousCircuitry.cs b/Items/Materials/MysteriousCircuitry.cs new file mode 100644 index 0000000000..af61434ab7 --- /dev/null +++ b/Items/Materials/MysteriousCircuitry.cs @@ -0,0 +1,22 @@ +using Terraria; +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.value = Item.sellPrice(silver: 3); + item.rare = 1; + } + } +} 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/Placeables/DraedonsChargingStation.cs b/Items/Placeables/DraedonsChargingStation.cs new file mode 100644 index 0000000000..fb3c05b0af --- /dev/null +++ b/Items/Placeables/DraedonsChargingStation.cs @@ -0,0 +1,30 @@ +using CalamityMod.Items.Placeables.Walls; +using CalamityMod.Items.Materials; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Tiles; + +namespace CalamityMod.Items.Placeables +{ + public class DraedonsChargingStation : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Draedon's Charging Station"); + } + + public override void SetDefaults() + { + item.rare = 10; + 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(); + } + } +} 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..5b4d5378c8 --- /dev/null +++ b/Items/Placeables/DraedonsFuelFactoryItem.cs @@ -0,0 +1,28 @@ +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Tiles; + +namespace CalamityMod.Items.Placeables +{ + public class DraedonsFuelFactoryItem : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Draedon's Fuel Factory"); + } + + public override void SetDefaults() + { + item.rare = 10; + 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(); + } + } +} 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..6e6cb968a8 --- /dev/null +++ b/Items/Placeables/Furniture/AgedSecurityChest.cs @@ -0,0 +1,36 @@ +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 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/SecurityChest.cs b/Items/Placeables/Furniture/SecurityChest.cs new file mode 100644 index 0000000000..9f8916f70c --- /dev/null +++ b/Items/Placeables/Furniture/SecurityChest.cs @@ -0,0 +1,34 @@ +using CalamityMod.Tiles; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.Furniture +{ + public class SecurityChest : ModItem + { + 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/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/PowerCell.cs b/Items/PowerCell.cs new file mode 100644 index 0000000000..d52091a977 --- /dev/null +++ b/Items/PowerCell.cs @@ -0,0 +1,24 @@ +using CalamityMod.UI; +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 at a charger to charge special weapons"); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 14; + item.rare = 10; + item.maxStack = 999; + } + } +} 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/CosmicWorm.cs b/Items/SummonItems/CosmicWorm.cs index 6703c1a922..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; } @@ -61,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/RuneofCos.cs b/Items/SummonItems/RuneofCos.cs index 7eecc6ed51..22e0631d31 100644 --- a/Items/SummonItems/RuneofCos.cs +++ b/Items/SummonItems/RuneofCos.cs @@ -80,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/Tools/CrystylCrusher.cs b/Items/Tools/CrystylCrusher.cs index 44febeec27..f577715850 100644 --- a/Items/Tools/CrystylCrusher.cs +++ b/Items/Tools/CrystylCrusher.cs @@ -62,11 +62,11 @@ 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.useAnimation = 2; item.useTurn = true; item.autoReuse = true; item.noMelee = false; @@ -92,6 +92,9 @@ 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); 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/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..1539e60f55 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; @@ -41,6 +42,8 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal item.shoot = ModContent.ProjectileType(); item.shootSpeed = 24f; item.useAmmo = AmmoID.Bullet; + + item.Calamity().Chargeable = true; } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; @@ -62,16 +65,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(), 5); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ItemID.LaserMachinegun); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } } } diff --git a/Items/Weapons/DraedonsArsenal/GaussPistol.cs b/Items/Weapons/DraedonsArsenal/GaussPistol.cs new file mode 100644 index 0000000000..75447ea709 --- /dev/null +++ b/Items/Weapons/DraedonsArsenal/GaussPistol.cs @@ -0,0 +1,50 @@ +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"); + } + + public override void SetDefaults() + { + item.width = 40; + item.height = 22; + item.magic = true; + item.mana = 6; + item.damage = 25; + 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.Rarity3BuyPrice; + item.rare = 3; + + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 14f; + + item.Calamity().Chargeable = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 7); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddTile(TileID.Anvils); + 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..ba0fabdf64 --- /dev/null +++ b/Items/Weapons/DraedonsArsenal/GaussRifle.cs @@ -0,0 +1,62 @@ +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 GaussRifle : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Gauss Rifle"); + Tooltip.SetDefault("Fires an enormous pulse of energy"); + } + + public override void SetDefaults() + { + item.width = 112; + item.height = 36; + item.ranged = true; + item.damage = 8000; + 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.RarityVioletBuyPrice; + item.rare = ItemRarityID.Red; + item.Calamity().customRarity = CalamityRarity.RareVariant; // In accordance with the other post-ML Arsenal weapons that Fabsol made. + + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 27f; + item.useAmmo = AmmoID.Bullet; + + item.Calamity().Chargeable = 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(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(), 20); + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddIngredient(ItemID.LaserRifle); + recipe.AddTile(ModContent.TileType()); + 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..91151c2253 --- /dev/null +++ b/Items/Weapons/DraedonsArsenal/HydraulicVoltCrasher.cs @@ -0,0 +1,51 @@ +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("Zaps nearby enemies 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.rare = 10; + item.Calamity().customRarity = CalamityRarity.RareVariant; + item.value = CalamityGlobalItem.Rarity10BuyPrice; + item.noMelee = true; + item.noUseGraphic = true; + item.melee = true; + item.channel = true; + + item.Calamity().Chargeable = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddTile(TileID.LunarCraftingStation); + 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..1e78de8913 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; @@ -32,13 +33,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.value = CalamityGlobalItem.Rarity10BuyPrice; item.rare = 10; item.Calamity().customRarity = CalamityRarity.RareVariant; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 1f; item.useAmmo = AmmoID.Bullet; + + item.Calamity().Chargeable = 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) @@ -72,16 +75,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(), 5); + recipe.AddIngredient(ItemID.LaserRifle); + 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..20e8094772 --- /dev/null +++ b/Items/Weapons/DraedonsArsenal/MountedScanner.cs @@ -0,0 +1,88 @@ +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"); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.summon = true; + item.damage = 27; + item.knockBack = 2f; + item.useTime = item.useAnimation = 35; + item.autoReuse = true; + + item.useStyle = ItemUseStyleID.HoldingUp; + item.UseSound = SoundID.Item15; + item.noMelee = true; + + item.value = CalamityGlobalItem.Rarity4BuyPrice; + item.rare = 4; + + 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(ModContent.ItemType(), 3); + recipe.AddIngredient(ModContent.ItemType(), 3); + recipe.AddIngredient(ModContent.ItemType(), 3); + recipe.AddTile(TileID.Anvils); + 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/PlasmaCaster.cs b/Items/Weapons/DraedonsArsenal/PlasmaCaster.cs index ba26d956f9..bf6e2b6dd3 100644 --- a/Items/Weapons/DraedonsArsenal/PlasmaCaster.cs +++ b/Items/Weapons/DraedonsArsenal/PlasmaCaster.cs @@ -40,6 +40,8 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal item.shoot = ModContent.ProjectileType(); item.shootSpeed = 1f; item.useAmmo = AmmoID.Bullet; + + item.Calamity().Chargeable = true; } public override bool AltFunctionUse(Player player) diff --git a/Items/Weapons/DraedonsArsenal/PlasmaGrenade.cs b/Items/Weapons/DraedonsArsenal/PlasmaGrenade.cs new file mode 100644 index 0000000000..504b114588 --- /dev/null +++ b/Items/Weapons/DraedonsArsenal/PlasmaGrenade.cs @@ -0,0 +1,58 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Projectiles.DraedonsArsenal; +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 rolling barrel that explodes on wall collision\n" + + "Stealth strikes make it rain on collision"); + } + + public override void SafeSetDefaults() + { + item.width = 22; + item.height = 28; + item.damage = 50; + 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 = CalamityGlobalItem.Rarity5BuyPrice; + item.rare = 5; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 10f; + 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(ItemID.HallowedBar, 2); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this, 200); + 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..50a14fae93 --- /dev/null +++ b/Items/Weapons/DraedonsArsenal/PoleWarper.cs @@ -0,0 +1,84 @@ +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 PoleWarper : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Pole Warper"); + Tooltip.SetDefault("Summons two floating magnets which repel each other"); + } + + public override void SetDefaults() + { + item.shootSpeed = 10f; + item.damage = 38; + item.mana = 12; + item.width = 38; + item.height = 24; + item.useTime = item.useAnimation = 30; + item.useStyle = ItemUseStyleID.HoldingUp; + item.noMelee = true; + item.knockBack = 8f; + item.value = CalamityGlobalItem.Rarity4BuyPrice; + item.rare = 4; + 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(), 6); + recipe.AddIngredient(ModContent.ItemType(), 6); + recipe.AddIngredient(ModContent.ItemType(), 3); + recipe.AddIngredient(ModContent.ItemType(), 3); + recipe.AddIngredient(ModContent.ItemType(), 3); + recipe.AddTile(TileID.Anvils); + 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..75f1696043 --- /dev/null +++ b/Items/Weapons/DraedonsArsenal/PulsePistol.cs @@ -0,0 +1,69 @@ +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.ranged = 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 = 3; + + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 1.2f; // Keep in mind that the shot has extra updates. + item.useAmmo = AmmoID.Bullet; + + item.Calamity().Chargeable = 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(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + + // Consume 6 ammo per shot + CalamityGlobalItem.ConsumeAdditionalAmmo(player, item, 6); + + return false; + } + + public override Vector2? HoldoutOffset() => new Vector2(10f, 0f); + + // Disable vanilla ammo consumption + public override bool ConsumeAmmo(Player player) => false; + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddIngredient(ModContent.ItemType(), 7); + recipe.AddIngredient(ModContent.ItemType(), 10); + 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..15419e2443 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; @@ -41,6 +43,8 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal item.shoot = ModContent.ProjectileType(); item.shootSpeed = 1f; item.useAmmo = AmmoID.Bullet; + + item.Calamity().Chargeable = 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) @@ -74,16 +78,17 @@ 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(), 5); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ItemID.LaserRifle); + recipe.AddTile(ModContent.TileType()); + recipe.SetResult(this); + recipe.AddRecipe(); + } } } diff --git a/Items/Weapons/DraedonsArsenal/PulseTurretRemote.cs b/Items/Weapons/DraedonsArsenal/PulseTurretRemote.cs new file mode 100644 index 0000000000..15767f3f01 --- /dev/null +++ b/Items/Weapons/DraedonsArsenal/PulseTurretRemote.cs @@ -0,0 +1,75 @@ +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"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 26; + item.sentry = true; + item.damage = 21; + item.knockBack = 0f; + item.useTime = item.useAnimation = 35; + item.autoReuse = true; + + item.useStyle = ItemUseStyleID.HoldingUp; + item.UseSound = SoundID.Item15; + item.noMelee = true; + + item.value = CalamityGlobalItem.Rarity4BuyPrice; + item.rare = 4; + + 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); + } + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddIngredient(ModContent.ItemType(), 3); + recipe.AddIngredient(ModContent.ItemType(), 3); + recipe.AddIngredient(ModContent.ItemType(), 3); + recipe.AddTile(TileID.Anvils); + 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..8c7e89c90c --- /dev/null +++ b/Items/Weapons/DraedonsArsenal/SnakeEyes.cs @@ -0,0 +1,54 @@ +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 SnakeEyes : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Snake Eyes"); + } + + public override void SetDefaults() + { + item.shootSpeed = 10f; + item.damage = 15; + item.mana = 12; + item.width = 38; + item.height = 24; + item.useTime = item.useAnimation = 30; + item.useStyle = ItemUseStyleID.HoldingUp; + item.noMelee = true; + item.knockBack = 3f; + item.value = CalamityGlobalItem.Rarity3BuyPrice; + item.rare = ItemRarityID.Orange; + 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(), 7); + recipe.AddIngredient(ModContent.ItemType(), 7); + recipe.AddIngredient(ModContent.ItemType(), 7); + recipe.AddTile(TileID.Anvils); + 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..11ffadc655 --- /dev/null +++ b/Items/Weapons/DraedonsArsenal/StarSwallowerContainmentUnit.cs @@ -0,0 +1,58 @@ +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"); + } + + public override void SetDefaults() + { + item.shootSpeed = 10f; + item.damage = 20; + 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 = 3; + 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(), 6); + recipe.AddIngredient(ModContent.ItemType(), 6); + recipe.AddIngredient(ModContent.ItemType(), 8); + 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..56bff229a9 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; @@ -40,6 +42,8 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal item.shoot = ModContent.ProjectileType(); item.shootSpeed = 1f; item.useAmmo = AmmoID.Bullet; + + item.Calamity().Chargeable = 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) @@ -73,16 +77,16 @@ 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(), 5); + recipe.AddIngredient(ItemID.ChargedBlasterCannon); + recipe.AddTile(ModContent.TileType()); + recipe.SetResult(this); + recipe.AddRecipe(); + } } } diff --git a/Items/Weapons/Magic/ApoctosisArray.cs b/Items/Weapons/Magic/ApoctosisArray.cs index 74cd462352..72bf37f820 100644 --- a/Items/Weapons/Magic/ApoctosisArray.cs +++ b/Items/Weapons/Magic/ApoctosisArray.cs @@ -56,7 +56,7 @@ namespace CalamityMod.Items.Weapons.Magic { 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/Magic/UltraLiquidator.cs b/Items/Weapons/Magic/UltraLiquidator.cs index 7f3db174f7..172e9c85ef 100644 --- a/Items/Weapons/Magic/UltraLiquidator.cs +++ b/Items/Weapons/Magic/UltraLiquidator.cs @@ -49,9 +49,9 @@ namespace CalamityMod.Items.Weapons.Magic { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ItemID.AquaScepter); - recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddRecipeGroup("CursedFlameIchor", 20); + recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddIngredient(ItemID.LunarBar, 5); recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); @@ -62,9 +62,9 @@ namespace CalamityMod.Items.Weapons.Magic { 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 num78 = Main.mouseX + Main.screenPosition.X - vector2.X; + float num79 = Main.mouseY + Main.screenPosition.Y - vector2.Y; + float f = Main.rand.NextFloat() * MathHelper.TwoPi; float value12 = 20f; float value13 = 60f; Vector2 vector13 = vector2 + f.ToRotationVector2() * MathHelper.Lerp(value12, value13, Main.rand.NextFloat()); @@ -75,7 +75,7 @@ namespace CalamityMod.Items.Weapons.Magic { break; } - f = Main.rand.NextFloat() * 6.28318548f; + f = Main.rand.NextFloat() * MathHelper.TwoPi; } Vector2 mouseWorld = Main.MouseWorld; Vector2 vector14 = mouseWorld - vector13; 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/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/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..e8fe5209d7 100644 --- a/Items/Weapons/Melee/StellarStriker.cs +++ b/Items/Weapons/Melee/StellarStriker.cs @@ -151,7 +151,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/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/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/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/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/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/NPCs/Abyss/Laserfish.cs b/NPCs/Abyss/Laserfish.cs index 4092beb2b9..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); } diff --git a/NPCs/Astral/AstralProbe.cs b/NPCs/Astral/AstralProbe.cs index f3e28b000e..32e721f569 100644 --- a/NPCs/Astral/AstralProbe.cs +++ b/NPCs/Astral/AstralProbe.cs @@ -48,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); } diff --git a/NPCs/Bumblebirb/Bumblefuck.cs b/NPCs/Bumblebirb/Bumblefuck.cs index e0a45e0a30..53c12c6c7c 100644 --- a/NPCs/Bumblebirb/Bumblefuck.cs +++ b/NPCs/Bumblebirb/Bumblefuck.cs @@ -422,7 +422,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); @@ -463,7 +463,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..28332eb788 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; @@ -58,12 +60,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 +95,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 +116,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 +177,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 +192,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 +228,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 +255,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 +287,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 +301,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 +310,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 +321,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 +349,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 +361,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/LifeSeeker.cs b/NPCs/Calamitas/LifeSeeker.cs index bcdc08d81c..bd72406bfb 100644 --- a/NPCs/Calamitas/LifeSeeker.cs +++ b/NPCs/Calamitas/LifeSeeker.cs @@ -39,7 +39,15 @@ namespace CalamityMod.NPCs.Calamitas npc.buffImmune[BuffID.OnFire] = true; } - public override void FindFrame(int frameHeight) + 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]; diff --git a/NPCs/Calamitas/SoulSeeker.cs b/NPCs/Calamitas/SoulSeeker.cs index b4158783dd..75e3acf003 100644 --- a/NPCs/Calamitas/SoulSeeker.cs +++ b/NPCs/Calamitas/SoulSeeker.cs @@ -72,8 +72,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; diff --git a/NPCs/CalamityAI.cs b/NPCs/CalamityAI.cs index 593b15ba35..c8eb02733f 100644 --- a/NPCs/CalamityAI.cs +++ b/NPCs/CalamityAI.cs @@ -3540,7 +3540,7 @@ namespace CalamityMod.NPCs { float num472 = npc.Center.X; float num473 = npc.Center.Y; - float num474 = (float)(275D * (1D - lifeRatio)) * tileEnrageMult; + float num474 = (death ? 275f : (float)(275D * (1D - lifeRatio))) * tileEnrageMult; if (!player.ZoneDungeon) num474 *= 1.25f; @@ -4194,7 +4194,7 @@ namespace CalamityMod.NPCs } npc.ai[1] += 0.0333333351f; - float velocity = 18f + (enrageScale - 1) * 6f; + float velocity = 16f + (enrageScale - 1) * 4f; float scaleFactor18 = velocity + npc.ai[1]; float num1310 = 4f; value54.Normalize(); @@ -4211,7 +4211,7 @@ namespace CalamityMod.NPCs Vector2 vector206 = player.Center - npc.Center; vector206.Y -= 12f; - float scaleFactor19 = 32f + (enrageScale - 1) * 4f; + float scaleFactor19 = 28f + (enrageScale - 1) * 4f; float num1311 = 8f; vector206.Normalize(); vector206 *= scaleFactor19; @@ -4243,14 +4243,14 @@ 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; - float velocity = 32f + (enrageScale - 1) * 4f; + 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))) @@ -4847,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()); } } @@ -5115,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; @@ -5521,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; diff --git a/NPCs/CalamityGlobalAI.cs b/NPCs/CalamityGlobalAI.cs index 16d0f35db7..65ec97f2fc 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; @@ -2122,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; @@ -2625,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; @@ -2651,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); @@ -2703,9 +2700,9 @@ namespace CalamityMod.NPCs // Pick a random phase else if (npc.ai[0] == -1f) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { int num618; do num618 = Main.rand.Next(4); while (num618 == npc.ai[1] || num618 == 1); @@ -2714,25 +2711,25 @@ namespace CalamityMod.NPCs 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; @@ -2754,37 +2751,37 @@ namespace CalamityMod.NPCs // 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 += 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; @@ -2800,67 +2797,67 @@ namespace CalamityMod.NPCs num602 += 2f; num603 += 0.05f; } - if (npc.life < npc.lifeMax * 0.1 || death) - { - num602 += 2f; - num603 += 0.1f; - } + 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; @@ -2879,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; @@ -2889,38 +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; + // 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; - } + 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; } @@ -2929,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++) { @@ -3005,220 +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] = 2f; + // 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)); num650 -= 5 * 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; + // 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; + // 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 if (npc.ai[1] > num650 * 15f) - { - npc.ai[0] = -1f; - npc.ai[1] = 3f; - npc.netUpdate = true; - } - } + { + npc.ai[0] = -1f; + npc.ai[1] = 3f; + npc.netUpdate = true; + } + } else if (npc.ai[0] == 4f) { @@ -3245,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 @@ -7319,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) @@ -10435,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; @@ -10574,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; @@ -10615,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); } } @@ -10826,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; @@ -10860,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; @@ -11069,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; @@ -11545,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; @@ -11841,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++) @@ -11864,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); @@ -11881,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(); } @@ -12103,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; @@ -12281,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) { @@ -12338,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; } @@ -12348,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; } @@ -12363,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; @@ -12375,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); } } @@ -12713,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; @@ -12769,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); } } @@ -13160,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; @@ -14149,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; @@ -14380,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; @@ -14532,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; @@ -14542,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; @@ -22774,7 +22771,7 @@ 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; @@ -25404,7 +25401,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++) { @@ -25566,7 +25563,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; } diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 96f6c7c17b..5da258093e 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -359,6 +359,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 @@ -1648,10 +1691,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 || @@ -1666,9 +1711,7 @@ namespace CalamityMod.NPCs } if (CalamityWorld.bossRushActive && !npc.friendly && !npc.townNPC) - { BossRushForceDespawnOtherNPCs(npc, mod); - } if (CalamityWorld.revenge || CalamityWorld.bossRushActive) { @@ -2965,7 +3008,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.active = false; npc.netUpdate = true; diff --git a/NPCs/CalamityGlobalNPCLoot.cs b/NPCs/CalamityGlobalNPCLoot.cs index 67ef6f4261..db06b90db6 100644 --- a/NPCs/CalamityGlobalNPCLoot.cs +++ b/NPCs/CalamityGlobalNPCLoot.cs @@ -1794,8 +1794,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 @@ -1811,7 +1811,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: diff --git a/NPCs/CeaselessVoid/CeaselessVoid.cs b/NPCs/CeaselessVoid/CeaselessVoid.cs index 34800902fa..f36190247b 100644 --- a/NPCs/CeaselessVoid/CeaselessVoid.cs +++ b/NPCs/CeaselessVoid/CeaselessVoid.cs @@ -171,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) diff --git a/NPCs/CeaselessVoid/DarkEnergy.cs b/NPCs/CeaselessVoid/DarkEnergy.cs index 1a283e79e3..7ec96a7a02 100644 --- a/NPCs/CeaselessVoid/DarkEnergy.cs +++ b/NPCs/CeaselessVoid/DarkEnergy.cs @@ -31,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; } @@ -39,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; @@ -268,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); } } diff --git a/NPCs/CeaselessVoid/DarkEnergy2.cs b/NPCs/CeaselessVoid/DarkEnergy2.cs index 85aa5d6b60..0621a40eb1 100644 --- a/NPCs/CeaselessVoid/DarkEnergy2.cs +++ b/NPCs/CeaselessVoid/DarkEnergy2.cs @@ -31,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; } @@ -39,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; @@ -225,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); } } diff --git a/NPCs/CeaselessVoid/DarkEnergy3.cs b/NPCs/CeaselessVoid/DarkEnergy3.cs index 6bc3a791d9..84352e1b56 100644 --- a/NPCs/CeaselessVoid/DarkEnergy3.cs +++ b/NPCs/CeaselessVoid/DarkEnergy3.cs @@ -31,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; } @@ -39,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; @@ -253,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); } } diff --git a/NPCs/DevourerofGods/DevourerofGodsHead.cs b/NPCs/DevourerofGods/DevourerofGodsHead.cs index 8bbcdf93de..8ddb2ed5a5 100644 --- a/NPCs/DevourerofGods/DevourerofGodsHead.cs +++ b/NPCs/DevourerofGods/DevourerofGodsHead.cs @@ -95,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) @@ -160,9 +160,6 @@ namespace CalamityMod.NPCs.DevourerofGods } } - // Velocity - npc.velocity.Length(); - // Spawn dust if (npc.alpha != 0) { @@ -194,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; } @@ -226,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; @@ -279,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); @@ -303,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; @@ -322,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(); @@ -339,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; @@ -405,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; @@ -413,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; @@ -430,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; @@ -445,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; @@ -455,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) { @@ -487,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) @@ -507,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; @@ -549,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) { @@ -568,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; @@ -686,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) { diff --git a/NPCs/DevourerofGods/DevourerofGodsHeadS.cs b/NPCs/DevourerofGods/DevourerofGodsHeadS.cs index a16e97dd5d..930a2dae76 100644 --- a/NPCs/DevourerofGods/DevourerofGodsHeadS.cs +++ b/NPCs/DevourerofGods/DevourerofGodsHeadS.cs @@ -525,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) @@ -649,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) diff --git a/NPCs/Leviathan/AquaticAberration.cs b/NPCs/Leviathan/AquaticAberration.cs index 0b4adc9986..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) 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 50ba7c0d68..7d7843c103 100644 --- a/NPCs/Leviathan/Leviathan.cs +++ b/NPCs/Leviathan/Leviathan.cs @@ -46,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; @@ -102,6 +103,8 @@ namespace CalamityMod.NPCs.Leviathan public override void AI() { + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + CalamityGlobalNPC.leviathan = npc.whoAmI; bool death = CalamityWorld.death || CalamityWorld.bossRushActive; @@ -109,40 +112,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.1f; npc.spriteDirection = (npc.direction > 0) ? 1 : -1; bool sirenAlive = false; if (CalamityGlobalNPC.siren != -1) - { sirenAlive = Main.npc[CalamityGlobalNPC.siren].active; - } - int soundChoiceRage = 92; + 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)) - { - Main.PlaySound(SoundID.Zombie, (int)npc.position.X, (int)npc.position.Y, (sirenAlive && !death) ? soundChoice : soundChoiceRage); - } + + 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) { @@ -177,17 +198,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); @@ -200,12 +240,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; @@ -246,7 +284,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; @@ -259,35 +301,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; @@ -304,45 +351,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(SoundID.Zombie, (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); @@ -363,45 +417,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; @@ -419,14 +463,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; @@ -440,19 +487,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; @@ -462,13 +507,13 @@ namespace CalamityMod.NPCs.Leviathan npc.velocity.X = num1045 * num1047; npc.velocity.Y = num1046 * num1047; npc.spriteDirection = npc.direction; - Main.PlaySound(SoundID.Zombie, (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); @@ -533,7 +578,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,10 +602,10 @@ namespace CalamityMod.NPCs.Leviathan } 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, DustID.Blood, 0f, 0f, 100, default, 2f); @@ -568,7 +613,7 @@ namespace CalamityMod.NPCs.Leviathan 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++) @@ -579,7 +624,7 @@ namespace CalamityMod.NPCs.Leviathan 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); + 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); @@ -656,7 +701,7 @@ namespace CalamityMod.NPCs.Leviathan public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) { Texture2D texture = Main.npcTexture[npc.type]; - if (npc.ai[0] == 1f) + if (npc.ai[0] == 1f || npc.Calamity().newAI[3] < 180f) { texture = Main.npcTexture[npc.type]; } @@ -669,9 +714,13 @@ namespace CalamityMod.NPCs.Leviathan int height = texture.Height / verticalFrameCount; int width = texture.Width / horizontalFrameCount; SpriteEffects spriteEffects = SpriteEffects.FlipHorizontally; + float xOffset = -50f; 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); + 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; } @@ -691,7 +740,7 @@ namespace CalamityMod.NPCs.Leviathan initialised = true; } - //ensure width and height are set. + // Ensure width and height are set. npc.frame.Width = width; npc.frame.Height = height; npc.frameCounter++; diff --git a/NPCs/Leviathan/LeviathanStart.cs b/NPCs/Leviathan/LeviathanStart.cs index baf1a4517f..0df8a30735 100644 --- a/NPCs/Leviathan/LeviathanStart.cs +++ b/NPCs/Leviathan/LeviathanStart.cs @@ -43,7 +43,7 @@ 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); + Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 0f, 0.25f, 0.55f); for (int num569 = 0; num569 < 200; num569++) { if (Main.npc[num569].active && Main.npc[num569].boss) @@ -86,7 +86,7 @@ namespace CalamityMod.NPCs.Leviathan { 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()); } } diff --git a/NPCs/Leviathan/Parasea.cs b/NPCs/Leviathan/Parasea.cs index 8d8be97359..849a0c71b6 100644 --- a/NPCs/Leviathan/Parasea.cs +++ b/NPCs/Leviathan/Parasea.cs @@ -22,8 +22,8 @@ namespace CalamityMod.NPCs.Leviathan npc.noTileCollide = true; npc.canGhostHeal = false; npc.damage = 50; - npc.width = 90; - npc.height = 20; + npc.width = 30; + npc.height = 30; npc.defense = 8; npc.lifeMax = 650; if (CalamityWorld.bossRushActive) diff --git a/NPCs/Leviathan/Siren.cs b/NPCs/Leviathan/Siren.cs index c6253fab8e..d12d062578 100644 --- a/NPCs/Leviathan/Siren.cs +++ b/NPCs/Leviathan/Siren.cs @@ -17,7 +17,6 @@ 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"); @@ -26,7 +25,7 @@ namespace CalamityMod.NPCs.Leviathan public override void SetStaticDefaults() { - DisplayName.SetDefault("The Siren"); + DisplayName.SetDefault("Anahita"); Main.npcFrameCount[npc.type] = 6; } @@ -37,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); @@ -87,20 +86,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(); } @@ -116,86 +117,143 @@ namespace CalamityMod.NPCs.Leviathan 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.1f; // 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; + NPC.NewNPC((int)vector.X, (int)vector.Y + 480, ModContent.NPCType(), 1); + 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) @@ -253,6 +311,7 @@ namespace CalamityMod.NPCs.Leviathan npc.localAI[0] = 0f; npc.netUpdate = true; } + return; } } @@ -264,17 +323,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) { @@ -350,20 +404,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; @@ -375,13 +436,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) @@ -433,125 +495,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; } } @@ -559,26 +584,23 @@ 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; + npc.ai[0] = npc.ai[2] >= ((leviAlive && !phase4) ? 2f : 3f) ? -1f : 4f; + npc.ai[1] = npc.ai[2] >= ((leviAlive && !phase4) ? 2f : 3f) ? 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); @@ -589,7 +611,7 @@ namespace CalamityMod.NPCs.Leviathan npc.direction = num22; if (npc.spriteDirection == 1) - npc.rotation += 3.14159274f; + npc.rotation += MathHelper.Pi; npc.spriteDirection = -npc.direction; } @@ -599,12 +621,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; @@ -613,7 +637,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; @@ -628,82 +652,35 @@ 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) diff --git a/NPCs/Leviathan/SirenClone.cs b/NPCs/Leviathan/SirenClone.cs deleted file mode 100644 index cee08a3ab8..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, 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, 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/NormalNPCs/FearlessGoldfishWarrior.cs b/NPCs/NormalNPCs/FearlessGoldfishWarrior.cs index 5842f5c532..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; diff --git a/NPCs/OldDuke/OldDuke.cs b/NPCs/OldDuke/OldDuke.cs index 54b2051a70..f8fdc35197 100644 --- a/NPCs/OldDuke/OldDuke.cs +++ b/NPCs/OldDuke/OldDuke.cs @@ -42,7 +42,9 @@ namespace CalamityMod.NPCs.OldDuke npc.defense = 100; npc.DR_NERD(0.5f, null, null, null, true); npc.LifeMaxNERB(750000, 1000000, 4000000); - npc.knockBackResist = 0f; + 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/OldDukeToothBall.cs b/NPCs/OldDuke/OldDukeToothBall.cs index 4e29337430..a5186f8300 100644 --- a/NPCs/OldDuke/OldDukeToothBall.cs +++ b/NPCs/OldDuke/OldDukeToothBall.cs @@ -93,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); @@ -183,7 +187,7 @@ 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); diff --git a/NPCs/Polterghast/Polterghast.cs b/NPCs/Polterghast/Polterghast.cs index 055755fe2c..18dfbde209 100644 --- a/NPCs/Polterghast/Polterghast.cs +++ b/NPCs/Polterghast/Polterghast.cs @@ -954,14 +954,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) { @@ -1017,12 +1017,12 @@ 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, (int)CalamityDusts.Phantoplasm, 0f, 0f, 100, default, 2f); @@ -1030,7 +1030,7 @@ namespace CalamityMod.NPCs.Polterghast 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/Signus/Signus.cs b/NPCs/Signus/Signus.cs index e276f62f9f..1291d17118 100644 --- a/NPCs/Signus/Signus.cs +++ b/NPCs/Signus/Signus.cs @@ -48,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) { @@ -788,9 +788,12 @@ namespace CalamityMod.NPCs.Signus CalamityMod.UpdateServerBoolean(); } - // Mark Signus as dead - CalamityWorld.downedSentinel3 = true; - CalamityMod.UpdateServerBoolean(); + // Mark Signus as dead + if (CalamityWorld.DoGSecondStageCountdown <= 0) + { + CalamityWorld.downedSentinel3 = true; + CalamityMod.UpdateServerBoolean(); + } } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) diff --git a/NPCs/StormWeaver/StasisProbe.cs b/NPCs/StormWeaver/StasisProbe.cs index db38ddb1e9..b35d0c287c 100644 --- a/NPCs/StormWeaver/StasisProbe.cs +++ b/NPCs/StormWeaver/StasisProbe.cs @@ -40,7 +40,10 @@ namespace CalamityMod.NPCs.StormWeaver 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); diff --git a/NPCs/StormWeaver/StasisProbeNaked.cs b/NPCs/StormWeaver/StasisProbeNaked.cs index b62fc886a2..708b3b2166 100644 --- a/NPCs/StormWeaver/StasisProbeNaked.cs +++ b/NPCs/StormWeaver/StasisProbeNaked.cs @@ -40,7 +40,10 @@ namespace CalamityMod.NPCs.StormWeaver 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); @@ -124,7 +127,7 @@ 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)) 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 1d0d59f753..b3cb4bd850 100644 --- a/NPCs/StormWeaver/StormWeaverBodyNaked.cs +++ b/NPCs/StormWeaver/StormWeaverBodyNaked.cs @@ -27,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) diff --git a/NPCs/StormWeaver/StormWeaverHead.cs b/NPCs/StormWeaver/StormWeaverHead.cs index d743acd338..2dc24a65ba 100644 --- a/NPCs/StormWeaver/StormWeaverHead.cs +++ b/NPCs/StormWeaver/StormWeaverHead.cs @@ -35,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) @@ -83,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; } diff --git a/NPCs/StormWeaver/StormWeaverHeadNaked.cs b/NPCs/StormWeaver/StormWeaverHeadNaked.cs index f8aaa83f48..2962df3033 100644 --- a/NPCs/StormWeaver/StormWeaverHeadNaked.cs +++ b/NPCs/StormWeaver/StormWeaverHeadNaked.cs @@ -37,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) @@ -75,12 +75,16 @@ namespace CalamityMod.NPCs.StormWeaver { writer.Write(invinceTime); writer.Write(npc.dontTakeDamage); + writer.Write(npc.localAI[1]); + writer.Write(npc.localAI[2]); } public override void ReceiveExtraAI(BinaryReader reader) { invinceTime = reader.ReadInt32(); npc.dontTakeDamage = reader.ReadBoolean(); + npc.localAI[1] = reader.ReadSingle(); + npc.localAI[2] = reader.ReadSingle(); } public override void AI() @@ -278,8 +282,28 @@ namespace CalamityMod.NPCs.StormWeaver { 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; @@ -347,7 +371,15 @@ namespace CalamityMod.NPCs.StormWeaver } if (revenge) - npc.velocity = Vector2.Normalize(Main.player[npc.target].Center - npc.Center) * num188 * 2f; + 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; @@ -631,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 ea05f6aa3f..81d4b11f26 100644 --- a/NPCs/StormWeaver/StormWeaverTail.cs +++ b/NPCs/StormWeaver/StormWeaverTail.cs @@ -22,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) diff --git a/NPCs/StormWeaver/StormWeaverTailNaked.cs b/NPCs/StormWeaver/StormWeaverTailNaked.cs index 4ee3fe0c34..4b3236099e 100644 --- a/NPCs/StormWeaver/StormWeaverTailNaked.cs +++ b/NPCs/StormWeaver/StormWeaverTailNaked.cs @@ -25,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) diff --git a/NPCs/TownNPCs/FAP.cs b/NPCs/TownNPCs/FAP.cs index 0232319a60..13c92b785d 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; @@ -194,8 +194,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 +385,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/Yharon/Yharon.cs b/NPCs/Yharon/Yharon.cs index a62f35ca93..40b95c9754 100644 --- a/NPCs/Yharon/Yharon.cs +++ b/NPCs/Yharon/Yharon.cs @@ -94,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"); @@ -175,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; @@ -194,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) { @@ -203,7 +203,7 @@ namespace CalamityMod.NPCs.Yharon else if (Main.netMode == NetmodeID.Server) { NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } + }*/ startSecondAI = false; @@ -221,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; @@ -240,8 +249,8 @@ 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; @@ -1475,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.2 && 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) { @@ -1635,7 +1644,6 @@ namespace CalamityMod.NPCs.Yharon float spinRotation = MathHelper.TwoPi * 3 / spinTime; float spinPhaseVelocity = 25f; int flareDustSpawnDivisor = 24; - int flareDustSpawnDivisor2 = 5; int flareDustSpawnDivisor3 = 12 + (secondPhasePhase == 4 ? 4 : 0); float increasedIdleTimeAfterBulletHell = -120f; @@ -2130,7 +2138,7 @@ namespace CalamityMod.NPCs.Yharon npc.ai[1] += 1f; if (Main.netMode != NetmodeID.MultiplayerClient) { - if (secondPhasePhase == 3) + if (secondPhasePhase >= 3) { // Rotate spiral by 9 * (240 / 12) = +90 degrees and then back -90 degrees @@ -2144,29 +2152,14 @@ namespace CalamityMod.NPCs.Yharon DoFlareDustBulletHell(1, (int)spinPhaseTimer, projectileDamage, totalProjectiles, projectileVelocity, radialOffset, true); } } - else if (secondPhasePhase == 2) + else { if (npc.ai[1] % flareDustSpawnDivisor == 0f) { - int totalProjectiles = 38 - (int)(npc.ai[1] / 12f); // 36 for first ring, 18 for last ring + 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); } } - else - { - if (npc.ai[1] % flareDustSpawnDivisor2 == 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); - } - } - } if (npc.ai[1] == 210f && secondPhasePhase == 4 && useTornado) { @@ -2178,7 +2171,7 @@ namespace CalamityMod.NPCs.Yharon if (npc.ai[1] >= spinPhaseTimer) { npc.ai[0] = 1f; - npc.ai[1] = secondPhasePhase == 2 ? increasedIdleTimeAfterBulletHell : 0f; + npc.ai[1] = increasedIdleTimeAfterBulletHell; npc.ai[2] = 0f; npc.localAI[2] = 0f; npc.velocity /= 2f; @@ -2824,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; 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/BirbAuraFlare.cs b/Projectiles/Boss/BirbAuraFlare.cs index da03e29aaf..76073973b7 100644 --- a/Projectiles/Boss/BirbAuraFlare.cs +++ b/Projectiles/Boss/BirbAuraFlare.cs @@ -119,7 +119,7 @@ namespace CalamityMod.Projectiles.Boss int damage = Main.expertMode ? 75 : 100; if (projectile.ai[0] >= 1f) { - x += 500f; + x += 750f; if ((int)(x / 16f) > Main.maxTilesX - 10) { x = (Main.maxTilesX - 10) * 16f; @@ -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/FrostMist.cs b/Projectiles/Boss/FrostMist.cs index 6df3f39e6f..cc7d85f7b7 100644 --- a/Projectiles/Boss/FrostMist.cs +++ b/Projectiles/Boss/FrostMist.cs @@ -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 >= Main.projFrames[projectile.type]) - { - 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/SirenSong.cs b/Projectiles/Boss/SirenSong.cs index 6858829227..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 = 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/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/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 4a4b3c0fbe..eeb0eb52bf 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -67,7 +67,15 @@ 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) @@ -1056,6 +1064,23 @@ namespace CalamityMod.Projectiles Player player = Main.player[projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); + // 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; diff --git a/Projectiles/DraedonsArsenal/GatlingLaserProj.cs b/Projectiles/DraedonsArsenal/GatlingLaserProj.cs index 44f2f370b3..60cfd47a1c 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,6 +66,15 @@ namespace CalamityMod.Projectiles.DraedonsArsenal bool flag2 = player.channel && !player.noItems && !player.CCed; if (flag2) { + // 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--; + } + // Consume 2 ammo per shot CalamityGlobalItem.ConsumeAdditionalAmmo(player, player.ActiveItem(), 2); 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..995b73e73a --- /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(), + projectile.damage, + 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/MassivePlasmaExplosion.cs b/Projectiles/DraedonsArsenal/MassivePlasmaExplosion.cs new file mode 100644 index 0000000000..301af5d985 --- /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("Laser Rifle"); + } + + 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 = 10; + } + + 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..a2b3469e74 --- /dev/null +++ b/Projectiles/DraedonsArsenal/MountedScannerLaser.cs @@ -0,0 +1,88 @@ +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; + } + } + } + } +} 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/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..e2a3bdc19b --- /dev/null +++ b/Projectiles/DraedonsArsenal/PlasmaGrenadeProjectile.cs @@ -0,0 +1,98 @@ +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 * 3, projectile.knockBack * 3f, 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, 240); + 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(10f, 10f); + 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..00bf7eafe1 --- /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("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] = 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 == 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..bd4fd4dd91 --- /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.sentry = 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..c6baa0a3dd --- /dev/null +++ b/Projectiles/DraedonsArsenal/PulseTurret.cs @@ -0,0 +1,149 @@ +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); + + if (potentialTarget != null && Collision.CanHit(projectile.position, projectile.width, projectile.height, potentialTarget.position, potentialTarget.width, potentialTarget.height)) + { + 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); + + if (Math.Abs(Vector2.Normalize(potentialTarget.Center - shootPosition).ToRotation() - projectile.rotation) < MathHelper.ToRadians(32f) + (projectile.spriteDirection == -1).ToInt() * MathHelper.Pi) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PulseRifleFire"), shootPosition); + Projectile.NewProjectile(shootPosition, + Vector2.Normalize(potentialTarget.Center - shootPosition) * 24f, + 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)) * 14f, + 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); + } + } + + 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..fdd6c339ed --- /dev/null +++ b/Projectiles/DraedonsArsenal/PulseTurretShot.cs @@ -0,0 +1,85 @@ +using System; +using Microsoft.Xna.Framework; +using Terraria; +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"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 1; + projectile.timeLeft = 300; + projectile.Calamity().hasInorganicEnemyHitBoost = true; + projectile.Calamity().inorganicEnemyHitBoost = 0.002f; + } + + 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]); + 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..4d2e0c9865 --- /dev/null +++ b/Projectiles/DraedonsArsenal/SnakeEyesSummon.cs @@ -0,0 +1,258 @@ +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] = 8; + } + + 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 % 30f == 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; + } + projectile.ai[1]++; + OldCenter = projectile.Center; + } + else + { + EyeOutwardness = MathHelper.Lerp(EyeOutwardness, 1f, 0.15f); + EyeRotation = EyeRotation.AngleTowards(projectile.AngleTo(npc.Center), MathHelper.TwoPi / 30f); + projectile.Center = Vector2.SmoothStep(OldCenter, npc.Center + (new Vector2(300f) + projectile.Size * 0.5f) * offsetMultiplier, Time % 30f / 30f); + } + } + 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..1114bca9e6 --- /dev/null +++ b/Projectiles/DraedonsArsenal/StarSwallowerSummon.cs @@ -0,0 +1,341 @@ +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; + } + + AntiStickyMovement(0.05f); + 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.CanHitLine(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 = 9f; + 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.04f); + 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 = 30f; + projectile.netUpdate = true; + } + } + else if (AcidShootCooldown > 0f) + AcidShootCooldown--; + projectile.velocity.X *= 0.935f; + } + public void AntiStickyMovement(float antiStickAcceleration = 0.05f) + { + for (int index = 0; index < Main.projectile.Length; index++) + { + Projectile proj = Main.projectile[index]; + if (index != projectile.whoAmI && + proj.active && proj.owner == projectile.owner && + proj.type == projectile.type && Math.Abs(projectile.position.X - proj.position.X) + Math.Abs(projectile.position.Y - proj.position.Y) < projectile.width) + { + if (projectile.position.X < proj.position.X) + { + projectile.velocity.X -= antiStickAcceleration; + } + else + { + projectile.velocity.X += antiStickAcceleration; + } + if (projectile.position.Y < proj.position.Y) + { + projectile.velocity.Y -= antiStickAcceleration; + } + else + { + projectile.velocity.Y += antiStickAcceleration; + } + } + } + } + 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..f0fce021cf --- /dev/null +++ b/Projectiles/DraedonsArsenal/VoltageStream.cs @@ -0,0 +1,106 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.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++; + } + + 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/DreadonLaser.cs b/Projectiles/Enemy/DreadonLaser.cs new file mode 100644 index 0000000000..2fc6dc9717 --- /dev/null +++ b/Projectiles/Enemy/DreadonLaser.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 DreadonLaser : 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/DreadonLaser.png b/Projectiles/Enemy/DreadonLaser.png new file mode 100644 index 0000000000..d2fb806a1a Binary files /dev/null and b/Projectiles/Enemy/DreadonLaser.png differ diff --git a/Projectiles/Magic/DarkSparkBeam.cs b/Projectiles/Magic/DarkSparkBeam.cs index fe10ba6370..990ffb8345 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 = 14; } public override void SendExtraAI(BinaryWriter writer) diff --git a/Projectiles/Magic/FabRay.cs b/Projectiles/Magic/FabRay.cs index 4fab9f0e9d..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; @@ -39,7 +39,7 @@ namespace CalamityMod.Projectiles.Magic Main.dust[pink].noGravity = true; Main.dust[pink].noLight = true; Main.dust[pink].position = source; - Main.dust[pink].scale = (float)Main.rand.Next(70, 110) * 0.013f; + Main.dust[pink].scale = Main.rand.Next(70, 110) * 0.013f; Main.dust[pink].velocity *= 0.1f; } } 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/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/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/Typeless/CirrusOrb.png b/Projectiles/Typeless/CirrusOrb.png new file mode 100644 index 0000000000..6ea4de3903 Binary files /dev/null and b/Projectiles/Typeless/CirrusOrb.png differ 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/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/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..3c04c899c2 --- /dev/null +++ b/Schematics/SchematicLoader.cs @@ -0,0 +1,77 @@ +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"), + ["Plague Research Facility"] = LoadSchematicCodeAndTexture(typeof(ResearchFacilitySchematic), "Schematics/AutoGeneratedContent/ResearchFacilitySchematic") + }; + } + 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..aa91696846 --- /dev/null +++ b/Schematics/TileDefinitionStructure.cs @@ -0,0 +1,66 @@ +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; + } + } +} diff --git a/Schematics/TilePlacementHelpers.cs b/Schematics/TilePlacementHelpers.cs new file mode 100644 index 0000000000..7553592786 --- /dev/null +++ b/Schematics/TilePlacementHelpers.cs @@ -0,0 +1,104 @@ +using Microsoft.Xna.Framework; +using System; +using Terraria; +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 PlaceDraedonStructure(string mapKey, Point placementPosition, PlacementAnchorType placementAnchor, Action chestInteraction = null, bool preserveWalls = true) + { + PilePlacementMaps.TryGetValue(mapKey, out PilePlacementFunction pilePlacementFunction); + Tile[,] tiles = TileMaps[mapKey]; + 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; + } + 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); + } + } + + ushort oldWall = Main.tile[x + xOffset, y + yOffset].wall; + 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 && Main.tile[x + xOffset, y + yOffset].wall == 0 && !Main.tile[x + xOffset, y + yOffset].active()) + { + Main.tile[x + xOffset, y + yOffset].wall = oldWall; + } + + 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/TileEntities/TEBaseTurret.cs b/TileEntities/TEBaseTurret.cs new file mode 100644 index 0000000000..bab9a8e5f7 --- /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 class TEBaseTurret : ModTileEntity + { + public int Time; + public int Direction; + public float Rotation; + public virtual int TileType => ModContent.TileType(); + public virtual int ShootWaitTime => 15; + public virtual int ShootRate => 60; + public virtual int ProjectileDamage => 20; + public virtual float ShootSpeed => 5f; + public virtual float ShootSpawnOffset => 32f; + public virtual float ProjectileKnockback => 3f; + public virtual float MaxAngleOffestShootPrompt => MathHelper.ToRadians(35f); + public virtual int ProjectileShot => ModContent.ProjectileType(); + public virtual Vector2 ShootCoordsOffset => new Vector2(22f + 4f * Direction, -2f); + public virtual float TargetDistanceCheck => 600f; + 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..32c0a30b66 --- /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 % 20 == 19) + { + 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(), 40, 4f); + } + if (Time % 75 == 74) + { + 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(), 40, 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..3d09bac2c1 --- /dev/null +++ b/TileEntities/TEDraedonFuelFactory.cs @@ -0,0 +1,88 @@ +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++; + if (Time % 5 == 4 && Main.tileFrame[Main.tile[Position.X, Position.Y].type] == 43) + { + 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..08c983da02 --- /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 < CalamityGlobalItem.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..0fd19ff751 --- /dev/null +++ b/TileEntities/TEDraedonTurret.cs @@ -0,0 +1,9 @@ +using Microsoft.Xna.Framework; + +namespace CalamityMod.TileEntities +{ + public class TEDraedonTurret : TEBaseTurret + { + // Literally nothing is needed in here. The base code is suited to fit this particular turret type. + } +} 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/CalamityGlobalTile.cs b/Tiles/CalamityGlobalTile.cs index 1137bed448..5d43736cd4 100644 --- a/Tiles/CalamityGlobalTile.cs +++ b/Tiles/CalamityGlobalTile.cs @@ -525,5 +525,19 @@ namespace CalamityMod.Tiles return new int[0]; } - } + + public override bool CanKillTile(int i, int j, int type, ref bool blockDamaged) + { + // Prevent tiles below a turret or field generator from being destroyed. + if (CalamityUtils.ParanoidTileRetrieval(i, j - 1).active() && + CalamityUtils.ParanoidTileRetrieval(i, j).type != + CalamityUtils.ParanoidTileRetrieval(i, j - 1).type && + (CalamityUtils.ParanoidTileRetrieval(i, j - 1).type == ModContent.TileType() || + CalamityUtils.ParanoidTileRetrieval(i, j - 1).type == ModContent.TileType())) + { + 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/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..7057fd8fb7 --- /dev/null +++ b/Tiles/DraedonFactoryFieldGenerator.cs @@ -0,0 +1,121 @@ +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 = 190; + } + 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 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..6e344a6505 --- /dev/null +++ b/Tiles/DraedonFuelFactory.cs @@ -0,0 +1,135 @@ +using CalamityMod.Items.Placeables; +using CalamityMod.TileEntities; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class 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; + } + } +} diff --git a/Tiles/DraedonFuelFactory.png b/Tiles/DraedonFuelFactory.png new file mode 100644 index 0000000000..a1663c61e9 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..ae12765624 --- /dev/null +++ b/Tiles/DraedonHologram.cs @@ -0,0 +1,74 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; +using Terraria.ObjectData; +using Terraria.DataStructures; + +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 = 7; + 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(2, 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; + 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 > 7) + frame = 6; + 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; + } + } +} diff --git a/Tiles/DraedonHologram.png b/Tiles/DraedonHologram.png new file mode 100644 index 0000000000..996914de03 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..11f22a7a77 --- /dev/null +++ b/Tiles/DraedonItemCharger.cs @@ -0,0 +1,134 @@ +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; + 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/DraedonTurretTile.cs b/Tiles/DraedonTurretTile.cs new file mode 100644 index 0000000000..177098f5b7 --- /dev/null +++ b/Tiles/DraedonTurretTile.cs @@ -0,0 +1,95 @@ +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 = 100; + } + + 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/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..511c20d966 --- /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 % 5 == 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..0db909d24d --- /dev/null +++ b/UI/DraedonsLogUI.cs @@ -0,0 +1,168 @@ +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 const int TextStartOffsetX = 40; + public const int TotalLinesPerPage = 16; + 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 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 = "This is placeholder text. Yell at the lore writers to make something for this that pertains to Draedon and Co."; + + // Create text and arrows. + if (FadeTime >= FadeTimeMax - 4 && Active) + { + int textWidth = (int)(xScale * 2 * pageTexture.Width) - TextStartOffsetX; + List dialogLines = Utils.WordwrapString(placeholderText, Main.fontMouseText, textWidth, 250, out _).ToList(); + dialogLines.RemoveAll(text => string.IsNullOrEmpty(text)); + + int totalPages = dialogLines.Count / (TotalLinesPerPage * 2 + 2); + + // Draw arrows. + if (Page > 0) + { + Texture2D pageArrowTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/DraedonsLogArrow"); + Vector2 bottomLeft = new Vector2(Main.screenWidth / 2 - pageTexture.Width * 2 - 36, yPageTop + pageTexture.Height + 32); + Rectangle arrowRectangle = new Rectangle((int)bottomLeft.X, (int)bottomLeft.Y, pageArrowTexture.Width, pageArrowTexture.Height); + 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, + 1f, + SpriteEffects.FlipHorizontally, + 0f); + } + if (Page < totalPages) + { + Texture2D pageArrowTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/DraedonsLogArrow"); + Vector2 bottomRight = new Vector2(Main.screenWidth / 2 + pageTexture.Width * 2 + 10, yPageTop + pageTexture.Height + 32); + Rectangle arrowRectangle = new Rectangle((int)bottomRight.X, (int)bottomRight.Y, pageArrowTexture.Width, pageArrowTexture.Height); + 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, + 1f, + 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 = Main.screenWidth / 2 - pageTexture.Width * 2 - TextStartOffsetX; + int textDrawPositionY = 50 + (i - startingLine) * 24 + (int)yPageTop; + if (onNextPage) + { + textDrawPositionX = Main.screenWidth / 2 + (int)(TextStartOffsetX * 1.5); + textDrawPositionY = 50 + (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..abfee0bd6d --- /dev/null +++ b/UI/PopupGUIManager.cs @@ -0,0 +1,45 @@ +using Microsoft.Xna.Framework.Graphics; +using System.Collections.Generic; +using System.Linq; + +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; + } + public static void UpdateAndDraw(SpriteBatch spriteBatch) + { + if (AnyGUIsActive) + { + 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/Utilities/CalamityUtils.cs b/Utilities/CalamityUtils.cs index 873c5f4bff..340248019a 100644 --- a/Utilities/CalamityUtils.cs +++ b/Utilities/CalamityUtils.cs @@ -3186,6 +3186,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); diff --git a/World/CalamityWorld.cs b/World/CalamityWorld.cs index 293e0294f2..9bdd735350 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; @@ -902,19 +903,35 @@ namespace CalamityMod.World SmallBiomes.PlaceShrines(); })); - tasks.Insert(FinalIndex + 3, new PassLegacy("Abyss", delegate (GenerationProgress progress) + + tasks.Insert(FinalIndex + 3, new PassLegacy("DraedonThings", (GenerationProgress progress) => + { + List workshopPositions = new List(); + for (int i = 0; i < 10; i++) + { + DraedonStructures.PlaceWorkshop(out Point placementPosition, workshopPositions); + workshopPositions.Add(placementPosition); + } + for (int i = 0; i < 4; i++) + { + DraedonStructures.PlacePlagueLab(out Point placementPosition2, workshopPositions); + 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(); diff --git a/World/DraedonStructures.cs b/World/DraedonStructures.cs new file mode 100644 index 0000000000..5895edb45c --- /dev/null +++ b/World/DraedonStructures.cs @@ -0,0 +1,170 @@ +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 bool DraedonsLogPresentInWorld = false; + public static void FillWorkshopChest(Chest chest) + { + int potionType = Utils.SelectRandom(Main.rand, 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 (!DraedonsLogPresentInWorld) + { + contents.Insert(0, new ChestItem(ModContent.ItemType(), 1)); + DraedonsLogPresentInWorld = true; + } + 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(Main.rand, 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 void PlaceWorkshop(out Point placementPoint, List workshopPoints) + { + 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["Workshop"].GetLength(0), SchematicLoader.TileMaps["Workshop"].GetLength(1)); + int activeTilesInArea = 0; + int xCheckArea = 40; + bool anyDungeonBricks = false; + bool anyLihzardBricks = false; + + // 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 (tile.type == TileID.BlueDungeonBrick || + tile.type == TileID.GreenDungeonBrick || + tile.type == TileID.PinkDungeonBrick) + { + anyDungeonBricks = true; + } + if (tile.type == TileID.LihzahrdBrick || + tile.wall == WallID.LihzahrdBrickUnsafe) + { + anyLihzardBricks = true; + } + activeTilesInArea++; + } + } + } + if (anyDungeonBricks || anyLihzardBricks || nearbyOtherWorkshop || activeTilesInArea / totalTiles > 0.35f) + { + tries++; + if (tries > 2500) + 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.PlaceDraedonStructure("Workshop", new Point(placementPoint.X, placementPoint.Y), SchematicPlacementHelpers.PlacementAnchorType.TopLeft, FillWorkshopChest); + } + public static void PlacePlagueLab(out Point placementPoint, List workshopPoints) + { + 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["Plague Research Facility"].GetLength(0), SchematicLoader.TileMaps["Plague Research Facility"].GetLength(1)); + int activeTilesInArea = 0; + int xCheckArea = 30; + bool anyDungeonBricks = false; + bool anyLihzardBricks = false; + + // 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 (tile.type == TileID.BlueDungeonBrick || + tile.type == TileID.GreenDungeonBrick || + tile.type == TileID.PinkDungeonBrick) + { + anyDungeonBricks = true; + } + if (tile.type == TileID.LihzahrdBrick || + tile.wall == WallID.LihzahrdBrickUnsafe) + { + anyLihzardBricks = true; + } + activeTilesInArea++; + } + } + } + if (anyLihzardBricks || anyDungeonBricks || nearbyOtherWorkshop || activeTilesInArea / totalTiles > 0.3f) + { + tries++; + if (tries > 6000) + 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.PlaceDraedonStructure("Plague Research Facility", new Point(placementPoint.X, placementPoint.Y), SchematicPlacementHelpers.PlacementAnchorType.TopLeft, FillLaboratoryChest); + } + } +}