diff --git a/Buffs/Cooldowns/EvasionScarfCooldown.cs b/Buffs/Cooldowns/EvasionScarfCooldown.cs new file mode 100644 index 0000000000..213db3d68b --- /dev/null +++ b/Buffs/Cooldowns/EvasionScarfCooldown.cs @@ -0,0 +1,24 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Cooldowns +{ + public class EvasionScarfCooldown : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Evasion Scarf Cooldown"); + Description.SetDefault("Your dodge is recharging"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + canBeCleared = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().eScarfCooldown = true; + } + } +} diff --git a/Buffs/Cooldowns/EvasionScarfCooldown.png b/Buffs/Cooldowns/EvasionScarfCooldown.png new file mode 100644 index 0000000000..4d297ad57e Binary files /dev/null and b/Buffs/Cooldowns/EvasionScarfCooldown.png differ diff --git a/Buffs/Cooldowns/PrismaticCooldown.cs b/Buffs/Cooldowns/PrismaticCooldown.cs new file mode 100644 index 0000000000..5590ebef7e --- /dev/null +++ b/Buffs/Cooldowns/PrismaticCooldown.cs @@ -0,0 +1,24 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Cooldowns +{ + public class PrismaticCooldown : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Prismatic Cooldown"); + Description.SetDefault("Your laser attack is recharging"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + canBeCleared = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().prismaticCooldown = true; + } + } +} diff --git a/Buffs/Cooldowns/PrismaticCooldown.png b/Buffs/Cooldowns/PrismaticCooldown.png new file mode 100644 index 0000000000..8e4d2a5f64 Binary files /dev/null and b/Buffs/Cooldowns/PrismaticCooldown.png differ diff --git a/Buffs/DamageOverTime/Nightwither.png b/Buffs/DamageOverTime/Nightwither.png index 82322429f0..00cb74005f 100644 Binary files a/Buffs/DamageOverTime/Nightwither.png and b/Buffs/DamageOverTime/Nightwither.png differ diff --git a/Buffs/Mounts/AndromedaBuff.cs b/Buffs/Mounts/AndromedaBuff.cs new file mode 100644 index 0000000000..27244854ec --- /dev/null +++ b/Buffs/Mounts/AndromedaBuff.cs @@ -0,0 +1,17 @@ +using CalamityMod.Items.Mounts; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Mounts +{ + public class AndromedaBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Andromeda"); + Description.SetDefault("You're controlling a piece of history"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } + } +} diff --git a/Buffs/Mounts/AndromedaBuff.png b/Buffs/Mounts/AndromedaBuff.png new file mode 100644 index 0000000000..54f98b7bbf Binary files /dev/null and b/Buffs/Mounts/AndromedaBuff.png differ diff --git a/Buffs/Mounts/AndromedaSmallBuff.cs b/Buffs/Mounts/AndromedaSmallBuff.cs new file mode 100644 index 0000000000..b74a088387 --- /dev/null +++ b/Buffs/Mounts/AndromedaSmallBuff.cs @@ -0,0 +1,17 @@ +using CalamityMod.Items.Mounts; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Mounts +{ + public class AndromedaSmallBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Andromeda"); + Description.SetDefault("You're controlling a small piece of history"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } + } +} diff --git a/Buffs/Mounts/AndromedaSmallBuff.png b/Buffs/Mounts/AndromedaSmallBuff.png new file mode 100644 index 0000000000..6d68533277 Binary files /dev/null and b/Buffs/Mounts/AndromedaSmallBuff.png differ diff --git a/Buffs/Mounts/BumbledogeMount.cs b/Buffs/Mounts/BumbledogeMount.cs new file mode 100644 index 0000000000..6275fefc24 --- /dev/null +++ b/Buffs/Mounts/BumbledogeMount.cs @@ -0,0 +1,23 @@ +using CalamityMod.Items.Mounts; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Mounts +{ + public class BumbledogeMount : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Bumbledoge"); + Description.SetDefault("Wait a second. That's not right..."); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + player.mount.SetMount(ModContent.MountType(), player); + player.buffTime[buffIndex] = 10; + } + } +} diff --git a/Buffs/Mounts/BumbledogeMount.png b/Buffs/Mounts/BumbledogeMount.png new file mode 100644 index 0000000000..1d9fd501a6 Binary files /dev/null and b/Buffs/Mounts/BumbledogeMount.png differ diff --git a/Buffs/Potions/ShadowBuff.cs b/Buffs/Potions/ShadowBuff.cs new file mode 100644 index 0000000000..34e1da15ef --- /dev/null +++ b/Buffs/Potions/ShadowBuff.cs @@ -0,0 +1,24 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Potions +{ + public class ShadowBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Shadow"); + Description.SetDefault("You're invisible, certain rogue weapons give and gain buffs, and stealth generation is boosted."); + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.invis = true; + player.Calamity().shadow = true; + } + } +} diff --git a/Buffs/Potions/ShadowBuff.png b/Buffs/Potions/ShadowBuff.png new file mode 100644 index 0000000000..ed4141070a Binary files /dev/null and b/Buffs/Potions/ShadowBuff.png differ diff --git a/Buffs/StatBuffs/EvasionScarfBoost.cs b/Buffs/StatBuffs/EvasionScarfBoost.cs new file mode 100644 index 0000000000..8e06699c94 --- /dev/null +++ b/Buffs/StatBuffs/EvasionScarfBoost.cs @@ -0,0 +1,23 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.StatBuffs +{ + public class EvasionScarfBoost : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Evasion Scarf Boost"); + Description.SetDefault("10% increased damage, 10% increased crit chance, and 15% increased melee speed"); + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().eScarfBoost = true; + } + } +} diff --git a/Buffs/StatBuffs/EvasionScarfBoost.png b/Buffs/StatBuffs/EvasionScarfBoost.png new file mode 100644 index 0000000000..5e45380f0e Binary files /dev/null and b/Buffs/StatBuffs/EvasionScarfBoost.png differ diff --git a/Buffs/StatBuffs/ScarfMeleeBoost.cs b/Buffs/StatBuffs/ScarfMeleeBoost.cs index 940411c84d..4733a30f6b 100644 --- a/Buffs/StatBuffs/ScarfMeleeBoost.cs +++ b/Buffs/StatBuffs/ScarfMeleeBoost.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Buffs.StatBuffs public override void SetDefaults() { DisplayName.SetDefault("Scarf Boost"); - Description.SetDefault("10% increased damage, 5% increased crit chance, and 10% increased melee speed"); + Description.SetDefault("10% increased damage, 5% increased crit chance, and 5% increased melee speed"); Main.debuff[Type] = false; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; diff --git a/Buffs/StatDebuffs/AndromedaCripple.cs b/Buffs/StatDebuffs/AndromedaCripple.cs new file mode 100644 index 0000000000..14b103e42b --- /dev/null +++ b/Buffs/StatDebuffs/AndromedaCripple.cs @@ -0,0 +1,19 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.StatDebuffs +{ + public class AndromedaCripple : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Andromeda Cripple"); + Description.SetDefault("You're slow"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + canBeCleared = false; + } + } +} diff --git a/Buffs/StatDebuffs/AndromedaCripple.png b/Buffs/StatDebuffs/AndromedaCripple.png new file mode 100644 index 0000000000..71c4ea3f1e Binary files /dev/null and b/Buffs/StatDebuffs/AndromedaCripple.png differ diff --git a/Buffs/Summon/CausticStaffBuff.cs b/Buffs/Summon/CausticStaffBuff.cs new file mode 100644 index 0000000000..2c905a1c88 --- /dev/null +++ b/Buffs/Summon/CausticStaffBuff.cs @@ -0,0 +1,36 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Projectiles.Summon; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Summon +{ + public class CausticStaffBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Caustic Dragon"); + Description.SetDefault("A mini jungle dragon is following you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.Calamity(); + if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) + { + modPlayer.causticDragon = true; + } + if (!modPlayer.causticDragon) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} diff --git a/Buffs/Summon/CausticStaffBuff.png b/Buffs/Summon/CausticStaffBuff.png new file mode 100644 index 0000000000..aac0870f4a Binary files /dev/null and b/Buffs/Summon/CausticStaffBuff.png differ diff --git a/Buffs/Summon/HowlTrio.cs b/Buffs/Summon/HowlTrio.cs new file mode 100644 index 0000000000..ea712a2957 --- /dev/null +++ b/Buffs/Summon/HowlTrio.cs @@ -0,0 +1,39 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Projectiles.Summon; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Summon +{ + public class HowlTrio : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Howl's Heart"); + Description.SetDefault("Howl protects you, Calcifer lights your way, Turnip-Head stalks you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.Calamity(); + int howl = ModContent.ProjectileType(); + int calcifer = ModContent.ProjectileType(); + int turnip = ModContent.ProjectileType(); + if (player.ownedProjectileCounts[howl] > 0 || player.ownedProjectileCounts[calcifer] > 0 || player.ownedProjectileCounts[turnip] > 0) + { + modPlayer.howlTrio = true; + } + if (!modPlayer.howlTrio) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} diff --git a/Buffs/Summon/HowlTrio.png b/Buffs/Summon/HowlTrio.png new file mode 100644 index 0000000000..c5c81e2ce3 Binary files /dev/null and b/Buffs/Summon/HowlTrio.png differ diff --git a/Buffs/Summon/PlaguebringerSummonBuff.cs b/Buffs/Summon/PlaguebringerSummonBuff.cs new file mode 100644 index 0000000000..d8c85cf10b --- /dev/null +++ b/Buffs/Summon/PlaguebringerSummonBuff.cs @@ -0,0 +1,36 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Projectiles.Summon; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Summon +{ + public class PlaguebringerSummonBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Lil' Plaguebringer"); + Description.SetDefault("The plaguebringer will protect you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.Calamity(); + if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) + { + modPlayer.plaguebringerPatronSummon = true; + } + if (!modPlayer.plaguebringerPatronSummon) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} diff --git a/Buffs/Summon/PlaguebringerSummonBuff.png b/Buffs/Summon/PlaguebringerSummonBuff.png new file mode 100644 index 0000000000..fb69a6a4b3 Binary files /dev/null and b/Buffs/Summon/PlaguebringerSummonBuff.png differ diff --git a/Buffs/Summon/SiriusBuff.png b/Buffs/Summon/SiriusBuff.png index b3389bc825..d2023af054 100644 Binary files a/Buffs/Summon/SiriusBuff.png and b/Buffs/Summon/SiriusBuff.png differ diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 75b854b93f..1c967fe618 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -53,6 +53,8 @@ using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ModLoader.IO; +using Terraria.ModLoader.Config; +using System.Linq; namespace CalamityMod.CalPlayer { @@ -69,6 +71,14 @@ namespace CalamityMod.CalPlayer Walk } + public enum AndromedaPlayerState + { + Inactive, + SmallRobot, + LargeRobot, + SpecialAttack + } + public class CalamityPlayer : ModPlayer { #region Variables @@ -236,6 +246,8 @@ namespace CalamityMod.CalPlayer public bool angryDog = false; public bool fab = false; public bool crysthamyr = false; + public AndromedaPlayerState andromedaState; + public int andromedaCripple; #endregion #region Pet @@ -367,9 +379,11 @@ namespace CalamityMod.CalPlayer public bool vexation = false; public bool fBulwark = false; public bool dodgeScarf = false; + public bool evasionScarf = false; public bool badgeOfBravery = false; public bool badgeOfBraveryRare = false; public bool scarfCooldown = false; + public bool eScarfCooldown = false; public bool cryogenSoul = false; public bool yInsignia = false; public bool eGauntlet = false; @@ -479,6 +493,7 @@ namespace CalamityMod.CalPlayer public bool brimstoneWaifu = false; public bool sirenWaifu = false; public bool fungalClump = false; + public bool howlsHeart = false; public bool darkGodSheath = false; public bool inkBomb = false; public bool inkBombCooldown = false; @@ -503,8 +518,12 @@ namespace CalamityMod.CalPlayer public bool sandCloakCooldown = false; public bool spectralVeil = false; public int spectralVeilImmunity = 0; + public bool hasJetpack = false; + public bool blunderBooster = false; public bool plaguedFuelPack = false; - public int plaguedFuelPackCooldown = 0; + public int jetPackCooldown = 0; + public int blunderBoosterDash = 0; + public int blunderBoosterDirection = 0; public int plaguedFuelPackDash = 0; public int plaguedFuelPackDirection = 0; public bool veneratedLocket = false; @@ -523,6 +542,7 @@ namespace CalamityMod.CalPlayer #endregion #region Armor Set + public bool desertProwler = false; public bool snowRuffianSet = false; public bool forbiddenCirclet = false; public int forbiddenCooldown = 0; @@ -602,11 +622,18 @@ namespace CalamityMod.CalPlayer public int astralStarRainCooldown = 0; public bool plagueReaper = false; public int plagueReaperCooldown = 0; + public bool plaguebringerPatronSet = false; + public bool plaguebringerCarapace = false; public float ataxiaDmg; public bool ataxiaMage = false; public bool ataxiaGeyser = false; public float xerocDmg; public bool xerocSet = false; + public bool prismaticSet = false; + public bool prismaticHelmet = false; + public bool prismaticRegalia = false; + public bool prismaticGreaves = false; + public int prismaticLasers = 0; public bool silvaSet = false; public bool silvaMelee = false; public bool silvaRanged = false; @@ -671,6 +698,7 @@ namespace CalamityMod.CalPlayer public bool cragsLava = false; public bool vaporfied = false; public bool energyShellCooldown = false; + public bool prismaticCooldown = false; #endregion #region Buff @@ -686,6 +714,7 @@ namespace CalamityMod.CalPlayer public bool graxDefense = false; public bool encased = false; public bool sMeleeBoost = false; + public bool eScarfBoost = false; public bool tFury = false; public bool cadence = false; public bool omniscience = false; @@ -715,6 +744,7 @@ namespace CalamityMod.CalPlayer public bool bounding = false; public bool triumph = false; public bool penumbra = false; + public bool shadow = false; public bool photosynthesis = false; public bool astralInjection = false; public bool gravityNormalizer = false; @@ -844,6 +874,9 @@ namespace CalamityMod.CalPlayer public List GammaCanisters = new List(); public bool rustyDrone = false; public bool tundraFlameBlossom = false; + public bool causticDragon = false; + public bool plaguebringerPatronSummon = false; + public bool howlTrio = false; #endregion #region Biome @@ -1305,7 +1338,9 @@ namespace CalamityMod.CalPlayer fasterRogueLevel = false; dodgeScarf = false; + evasionScarf = false; scarfCooldown = false; + eScarfCooldown = false; elysianAegis = false; @@ -1526,6 +1561,8 @@ namespace CalamityMod.CalPlayer astralStarRain = false; + desertProwler = false; + snowRuffianSet = false; forbiddenCirclet = false; @@ -1543,10 +1580,16 @@ namespace CalamityMod.CalPlayer umbraphileSet = false; plagueReaper = false; + plaguebringerPatronSet = false; + plaguebringerCarapace = false; fathomSwarmer = false; fathomSwarmerVisage = false; fathomSwarmerBreastplate = false; fathomSwarmerTail = false; + prismaticSet = false; + prismaticHelmet = false; + prismaticRegalia = false; + prismaticGreaves = false; tarraSet = false; tarraMelee = false; @@ -1593,7 +1636,9 @@ namespace CalamityMod.CalPlayer sandCloak = false; sandCloakCooldown = false; spectralVeil = false; + hasJetpack = false; plaguedFuelPack = false; + blunderBooster = false; veneratedLocket = false; alcoholPoisoning = false; @@ -1634,6 +1679,7 @@ namespace CalamityMod.CalPlayer cragsLava = false; vaporfied = false; energyShellCooldown = false; + prismaticCooldown = false; revivify = false; trinketOfChiBuff = false; @@ -1646,6 +1692,7 @@ namespace CalamityMod.CalPlayer graxDefense = false; encased = false; sMeleeBoost = false; + eScarfBoost = false; tFury = false; cadence = false; omniscience = false; @@ -1661,6 +1708,7 @@ namespace CalamityMod.CalPlayer bounding = false; triumph = false; penumbra = false; + shadow = false; photosynthesis = false; astralInjection = false; gravityNormalizer = false; @@ -1779,6 +1827,7 @@ namespace CalamityMod.CalPlayer sirenWaifu = false; allWaifus = false; fungalClump = false; + howlsHeart = false; redDevil = false; valkyrie = false; slimeGod = false; @@ -1810,6 +1859,9 @@ namespace CalamityMod.CalPlayer gammaHead = false; rustyDrone = false; tundraFlameBlossom = false; + causticDragon = false; + plaguebringerPatronSummon = false; + howlTrio = false; abyssalDivingSuitPrevious = abyssalDivingSuit; abyssalDivingSuit = abyssalDivingSuitHide = abyssalDivingSuitForce = abyssalDivingSuitPower = false; @@ -1840,7 +1892,8 @@ namespace CalamityMod.CalPlayer deathModeUnderworldTime = 0; gaelRageCooldown = 0; gaelSwipes = 0; - gaelSwitchTimer = (GaelSwitchPhase)0; + gaelSwitchTimer = 0; + andromedaState = AndromedaPlayerState.Inactive; planarSpeedBoost = 0; galileoCooldown = 0; soundCooldown = 0; @@ -1861,9 +1914,12 @@ namespace CalamityMod.CalPlayer reforges = 0; polarisBoostCounter = 0; spectralVeilImmunity = 0; - plaguedFuelPackCooldown = 0; + jetPackCooldown = 0; + blunderBoosterDash = 0; + blunderBoosterDirection = 0; plaguedFuelPackDash = 0; plaguedFuelPackDirection = 0; + andromedaCripple = 0; theBeeCooldown = 0; killSpikyBalls = false; moonCrownCooldown = 0; @@ -1879,6 +1935,7 @@ namespace CalamityMod.CalPlayer forbiddenCooldown = 0; tornadoCooldown = 0; ladHearts = 0; + prismaticLasers = 0; alcoholPoisoning = false; shadowflame = false; @@ -1908,6 +1965,7 @@ namespace CalamityMod.CalPlayer clamity = false; snowmanNoseless = false; scarfCooldown = false; + eScarfCooldown = false; godSlayerCooldown = false; abyssalDivingSuitCooldown = false; abyssalDivingSuitPlateHits = 0; @@ -1925,6 +1983,7 @@ namespace CalamityMod.CalPlayer cragsLava = false; vaporfied = false; energyShellCooldown = false; + prismaticCooldown = false; #endregion #region Rogue @@ -1973,6 +2032,7 @@ namespace CalamityMod.CalPlayer graxDefense = false; encased = false; sMeleeBoost = false; + eScarfBoost = false; tFury = false; cadence = false; omniscience = false; @@ -1988,6 +2048,7 @@ namespace CalamityMod.CalPlayer bounding = false; triumph = false; penumbra = false; + shadow = false; photosynthesis = false; astralInjection = false; gravityNormalizer = false; @@ -2098,9 +2159,15 @@ namespace CalamityMod.CalPlayer fathomSwarmerVisage = false; fathomSwarmerBreastplate = false; fathomSwarmerTail = false; + prismaticSet = false; + prismaticHelmet = false; + prismaticRegalia = false; + prismaticGreaves = false; astralStarRain = false; plagueReaper = false; plagueReaperCooldown = 0; + plaguebringerPatronSet = false; + plaguebringerCarapace = false; ataxiaMage = false; ataxiaBolt = false; ataxiaGeyser = false; @@ -2108,6 +2175,7 @@ namespace CalamityMod.CalPlayer ataxiaVolley = false; ataxiaBlaze = false; hydrothermalSmoke = false; + desertProwler = false; snowRuffianSet = false; forbiddenCirclet = false; eskimoSet = false; //vanilla armor @@ -2444,7 +2512,9 @@ namespace CalamityMod.CalPlayer player.Teleport(teleportLocation, 4, 0); NetMessage.SendData(65, -1, -1, null, 0, (float)player.whoAmI, teleportLocation.X, teleportLocation.Y, 1, 0, 0); - if (scarfCooldown) + if (eScarfCooldown) + player.AddBuff(BuffID.ChaosState, (int)(chaosStateDuration * 1.5), true); + else if (scarfCooldown) player.AddBuff(BuffID.ChaosState, chaosStateDuration * 2, true); else player.AddBuff(BuffID.ChaosState, chaosStateDuration, true); @@ -2495,7 +2565,9 @@ namespace CalamityMod.CalPlayer player.Teleport(teleportLocation, 1, 0); NetMessage.SendData(65, -1, -1, null, 0, (float)player.whoAmI, teleportLocation.X, teleportLocation.Y, 1, 0, 0); - if (scarfCooldown) + if (eScarfCooldown) + player.AddBuff(BuffID.ChaosState, (int)(chaosStateDuration * 1.5), true); + else if (scarfCooldown) player.AddBuff(BuffID.ChaosState, chaosStateDuration * 2, true); else player.AddBuff(BuffID.ChaosState, chaosStateDuration, true); @@ -2520,15 +2592,27 @@ namespace CalamityMod.CalPlayer } } } - if (CalamityMod.PlaguePackHotKey.JustPressed && plaguedFuelPack && Main.myPlayer == player.whoAmI && rogueStealth >= rogueStealthMax * 0.25f && - wearingRogueArmor && rogueStealthMax > 0 && plaguedFuelPackCooldown == 0 && !player.mount.Active) + if (CalamityMod.PlaguePackHotKey.JustPressed && hasJetpack && Main.myPlayer == player.whoAmI && rogueStealth >= rogueStealthMax * 0.25f && + wearingRogueArmor && rogueStealthMax > 0 && jetPackCooldown == 0 && !player.mount.Active) { - plaguedFuelPackCooldown = 90; - plaguedFuelPackDash = 10; - plaguedFuelPackDirection = player.direction; - rogueStealth -= rogueStealthMax * 0.25f; - Main.PlaySound(2, player.position, 66); - Main.PlaySound(2, player.position, 34); + if (blunderBooster) + { + jetPackCooldown = 90; + blunderBoosterDash = 15; + blunderBoosterDirection = player.direction; + rogueStealth -= rogueStealthMax * 0.25f; + Main.PlaySound(2, player.position, 66); + Main.PlaySound(2, player.position, 34); + } + else if (plaguedFuelPack) + { + jetPackCooldown = 90; + plaguedFuelPackDash = 10; + plaguedFuelPackDirection = player.direction; + rogueStealth -= rogueStealthMax * 0.25f; + Main.PlaySound(2, player.position, 66); + Main.PlaySound(2, player.position, 34); + } } if (CalamityMod.TarraHotKey.JustPressed) { @@ -2699,6 +2783,8 @@ namespace CalamityMod.CalPlayer } } } + if (prismaticSet && !prismaticCooldown && prismaticLasers == 0) + prismaticLasers = CalamityUtils.SecondsToFrames(35f); } if (CalamityMod.AstralArcanumUIHotkey.JustPressed && astralArcanum) { @@ -3180,6 +3266,10 @@ namespace CalamityMod.CalPlayer { meleeSpeedMult += 0.05f; } + if (eScarfBoost) + { + meleeSpeedMult += 0.15f; + } if (yPower) { meleeSpeedMult += 0.05f; @@ -3586,6 +3676,23 @@ 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) { + if (player.Calamity().andromedaState == AndromedaPlayerState.LargeRobot) + { + if (!Main.dedServ) + { + for (int i = 0; i < 40; i++) + { + Dust dust = Dust.NewDustPerfect(player.Center + Utils.NextVector2Circular(Main.rand, 60f, 90f), 133); + dust.velocity = Utils.NextVector2Circular(Main.rand, 4f, 4f); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(1.2f, 1.35f); + } + for (int i = 0; i < 3; i++) + { + Utils.PoofOfSmoke(player.Center + Utils.NextVector2Circular(Main.rand, 20f, 30f)); + } + } + } if (invincible && player.ActiveItem().type != ModContent.ItemType()) { if (player.statLife <= 0) @@ -3903,6 +4010,11 @@ namespace CalamityMod.CalPlayer { acidRoundMultiplier = 1D; } + //Prismatic Breaker is a weird hybrid melee-ranged weapon so include it too. Why are you using desert prowler post-Yharon? don't ask me + if (desertProwler && (item.ranged/* || item.type == ModContent.ItemType()*/)) + { + flat += 2f; + } } public override void GetWeaponKnockback(Item item, ref float knockback) @@ -4102,6 +4214,19 @@ namespace CalamityMod.CalPlayer #region On Hit NPC public override void OnHitNPC(Item item, NPC target, int damage, float knockback, bool crit) { + if (desertProwler && item.ranged && crit) //for obscure stuff like marnite bayonet + { + if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1 && player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) + { + if (Main.rand.NextBool(15)) + { + if (player.whoAmI == Main.myPlayer) + { + Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(item.damage * player.RangedDamage()), knockback, player.whoAmI, 0f, 0f); + } + } + } + } if (!item.melee && (int) player.meleeEnchant == 7) Projectile.NewProjectile(target.Center.X, target.Center.Y, target.velocity.X, target.velocity.Y, ProjectileID.ConfettiMelee, 0, 0f, player.whoAmI, 0f, 0f); @@ -4279,6 +4404,19 @@ namespace CalamityMod.CalPlayer if (!proj.npcProj && !proj.trap) { + if (desertProwler && proj.ranged && crit) + { + if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1 && player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) + { + if (Main.rand.NextBool(15)) + { + if (player.whoAmI == Main.myPlayer) + { + Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), proj.damage, proj.knockBack, player.whoAmI, 0f, 0f); + } + } + } + } if (proj.Calamity().trueMelee) titanBoost = 600; @@ -4298,7 +4436,7 @@ namespace CalamityMod.CalPlayer { CalamityUtils.Inflict246DebuffsNPC(target, ModContent.BuffType()); } - if (uberBees && (proj.type == 566 || proj.type == 181 || proj.type == 189)) + if ((plaguebringerCarapace || uberBees) && (proj.type == 566 || proj.type == 181 || proj.type == 189)) { target.AddBuff(ModContent.BuffType(), 360); } @@ -4436,6 +4574,20 @@ namespace CalamityMod.CalPlayer #region PvP public override void OnHitPvp(Item item, Player target, int damage, bool crit) { + if (desertProwler && item.ranged && crit) //for obscure stuff like Marnite Bayonet + { + if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1 && player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) + { + if (Main.rand.NextBool(15)) + { + if (player.whoAmI == Main.myPlayer) + { + Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(item.damage * player.RangedDamage()), item.knockBack, player.whoAmI, 0f, 0f); + } + } + } + } + if (!item.melee && (int) player.meleeEnchant == 7) Projectile.NewProjectile(target.Center.X, target.Center.Y, target.velocity.X, target.velocity.Y, ProjectileID.ConfettiMelee, 0, 0f, player.whoAmI, 0f, 0f); @@ -4600,6 +4752,20 @@ namespace CalamityMod.CalPlayer if (!proj.npcProj && !proj.trap) { + if (desertProwler && proj.ranged && crit) + { + if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1 && player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) + { + if (Main.rand.NextBool(15)) + { + if (player.whoAmI == Main.myPlayer) + { + Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), proj.damage, proj.knockBack, player.whoAmI, 0f, 0f); + } + } + } + } + if (proj.Calamity().trueMelee) titanBoost = 600; @@ -4616,7 +4782,7 @@ namespace CalamityMod.CalPlayer { CalamityUtils.Inflict246DebuffsPvp(target, ModContent.BuffType()); } - if (uberBees && (proj.type == 566 || proj.type == 181 || proj.type == 189)) + if ((plaguebringerCarapace || uberBees) && (proj.type == 566 || proj.type == 181 || proj.type == 189)) { target.AddBuff(ModContent.BuffType(), 360); } @@ -4767,6 +4933,7 @@ namespace CalamityMod.CalPlayer if (item.melee) { double damageAdd = (dodgeScarf ? 0.2 : 0) + + (evasionScarf ? 0.1 : 0) + ((aBulwarkRare && aBulwarkRareMeleeBoostTimer > 0) ? 2 : 0) + (DoGLore ? 0.5 : 0) + (fungalSymbiote ? 0.25 : 0); @@ -4984,7 +5151,7 @@ namespace CalamityMod.CalPlayer return; bool isTrueMelee = proj.Calamity().trueMelee; - bool isSummon = proj.minion || proj.sentry || CalamityMod.projectileMinionList.Contains(proj.type); + bool isSummon = proj.minion || proj.sentry || CalamityMod.projectileMinionList.Contains(proj.type) || ProjectileID.Sets.MinionShot[proj.type] || ProjectileID.Sets.SentryShot[proj.type]; bool hasClassType = proj.melee || proj.ranged || proj.magic || isSummon || proj.Calamity().rogue; Item heldItem = player.ActiveItem(); @@ -5017,6 +5184,7 @@ namespace CalamityMod.CalPlayer if (isTrueMelee) { double damageAdd = (dodgeScarf ? 0.2 : 0) + + (evasionScarf ? 0.1 : 0) + ((aBulwarkRare && aBulwarkRareMeleeBoostTimer > 0) ? 2 : 0) + (DoGLore ? 0.5 : 0) + (fungalSymbiote ? 0.25 : 0); @@ -5187,10 +5355,27 @@ namespace CalamityMod.CalPlayer int defenseAdd = (int)(target.defense * 0.05 * (proj.damage / 50D) * acidRoundMultiplier); //100 defense * 0.05 = 5 damage += defenseAdd; } - if (uberBees && (proj.type == ProjectileID.GiantBee || proj.type == ProjectileID.Bee || proj.type == ProjectileID.Wasp || proj.type == ModContent.ProjectileType())) + if (uberBees && (proj.type == ProjectileID.GiantBee || proj.type == ProjectileID.Bee || proj.type == ProjectileID.Wasp || proj.type == ModContent.ProjectileType() || proj.type == ModContent.ProjectileType() || proj.type == ModContent.ProjectileType() || proj.type == ModContent.ProjectileType())) { damage += Main.rand.Next(20, 31); } + if (plaguebringerPatronSummon) + { + if (isSummon && proj.active && proj.friendly && !proj.npcProj && !proj.trap && proj.damage > 0) + { + if (proj.type != ModContent.ProjectileType() && proj.type != ModContent.ProjectileType()) + { + for (int j = 0; j < Main.maxProjectiles; j++) + { + Projectile miniPBG = Main.projectile[j]; + if (miniPBG.type == ModContent.ProjectileType() && Vector2.Distance(proj.Center, miniPBG.Center) <= PlaguebringerSummon.auraRange && miniPBG.owner == proj.owner) + { + damage += Main.rand.Next(10, 21); + } + } + } + } + } int penetrateAmt = 0; if (proj.Calamity().stealthStrike && proj.Calamity().rogue) { @@ -5881,7 +6066,6 @@ namespace CalamityMod.CalPlayer #endregion #region Can Hit - public override bool? CanHitNPC(Item item, NPC target) { if (camper && ((double)Math.Abs(player.velocity.X) > 0.05 || (double)Math.Abs(player.velocity.Y) > 0.05)) @@ -5899,7 +6083,6 @@ namespace CalamityMod.CalPlayer } return null; } - #endregion #region Fishing @@ -5961,7 +6144,7 @@ namespace CalamityMod.CalPlayer num79 *= num80; float speedX4 = num78 + (float)Main.rand.Next(-30, 31) * 0.02f; float speedY5 = num79 + (float)Main.rand.Next(-30, 31) * 0.02f; - int p = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, (int)((float)damage * 0.15f), (int)(knockBack), player.whoAmI, 0f, (float)Main.rand.Next(15)); + int p = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, (int)(damage * 0.15f), (int)(knockBack), player.whoAmI, 0f, (float)Main.rand.Next(15)); Main.projectile[p].knockBack /= 2; Main.projectile[p].Calamity().forceRogue = true; //in case melee/rogue variants bug out if (StealthStrikeAvailable()) @@ -6007,7 +6190,12 @@ namespace CalamityMod.CalPlayer public override void FrameEffects() { - if (snowRuffianSet) + if (player.Calamity().andromedaState == AndromedaPlayerState.LargeRobot || + player.Calamity().andromedaState == AndromedaPlayerState.SpecialAttack) + { + player.head = mod.GetEquipSlot("NoHead", EquipType.Head); // To make the head invisible on the map. The map was having a hissy fit because of hitbox changes. + } + else if (snowRuffianSet) { player.wings = mod.GetEquipSlot("SnowRuffWings", EquipType.Wings); bool falling = player.gravDir == -1 ? player.velocity.Y < 0.05f : player.velocity.Y > 0.05f; @@ -6016,6 +6204,7 @@ namespace CalamityMod.CalPlayer player.velocity.Y *= 0.9f; player.wingFrame = 3; player.noFallDmg = true; + player.fallStart = (int)(player.position.Y / 16f); } } else if ((profanedCrystal || profanedCrystalForce) && !profanedCrystalHide) @@ -6666,250 +6855,250 @@ namespace CalamityMod.CalPlayer Main.projectile[bee].localNPCHitCooldown = 5; } } - } - if (fCarapace) - { - if (damage > 0) - { - Main.PlaySound(3, (int)player.position.X, (int)player.position.Y, 45); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(player.velocity.X, player.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; - int fDamage = (int)(56 * player.AverageDamage()); - if (player.whoAmI == Main.myPlayer) - { - for (i = 0; i < 4; i++) - { - float xPos = Main.rand.NextBool(2) ? player.Center.X + 100 : player.Center.X - 100; - Vector2 vector2 = new Vector2(xPos, player.Center.Y + Main.rand.Next(-100, 101)); - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - int spore1 = Projectile.NewProjectile(vector2.X, vector2.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), 590, fDamage, 1.25f, player.whoAmI, 0f, 0f); - int spore2 = Projectile.NewProjectile(vector2.X, vector2.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), 590, fDamage, 1.25f, player.whoAmI, 0f, 0f); - Main.projectile[spore1].timeLeft = 120; - Main.projectile[spore2].timeLeft = 120; - } - } - } - } - if (aSpark) - { - if (damage > 0) - { - Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 93); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(player.velocity.X, player.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; - int sDamage = hardMode ? 36 : 6; - if (aSparkRare) - sDamage += hardMode ? 12 : 2; - if (player.whoAmI == Main.myPlayer) - { - for (i = 0; i < 4; i++) - { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - int spark1 = Projectile.NewProjectile(player.Center.X, player.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(sDamage * player.AverageDamage()), 1.25f, player.whoAmI, 0f, 0f); - int spark2 = Projectile.NewProjectile(player.Center.X, player.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(sDamage * player.AverageDamage()), 1.25f, player.whoAmI, 0f, 0f); - Main.projectile[spark1].timeLeft = 120; - Main.projectile[spark2].timeLeft = 120; - Main.projectile[spark1].Calamity().forceTypeless = true; - Main.projectile[spark2].Calamity().forceTypeless = true; - } - } - } - } - if (inkBomb) - { - if (player.whoAmI == Main.myPlayer && !inkBombCooldown) - { - player.AddBuff(ModContent.BuffType(), 1200); - rogueStealth += 0.5f; - for (int i = 0; i < 5; i++) - { - Main.PlaySound(2, (int)Main.player[Main.myPlayer].position.X, (int)Main.player[Main.myPlayer].position.Y, 61); - int inkBomb = Projectile.NewProjectile(player.Center.X, player.Center.Y, Main.rand.NextFloat(-3f, 3f), Main.rand.NextFloat(-0f, -4f), ModContent.ProjectileType(), 0, 0, player.whoAmI); - } - } - } - if (blazingCore) - { - if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1 && player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) - { - for (int i = 0; i < 360; i += 3) - { - Vector2 BCDSpeed = new Vector2(5f, 5f).RotatedBy(MathHelper.ToRadians(i)); - Dust.NewDust(player.Center, 1, 1, 244, BCDSpeed.X, BCDSpeed.Y, 0, default, 1.1f); - } - Main.PlaySound(SoundID.Item14, player.Center); - int blazingSun = Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(1690 * player.AverageDamage()), 0f, player.whoAmI, 0f, 0f); - Main.projectile[blazingSun].Center = player.Center; - int blazingSun2 = Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, player.whoAmI, 0f, 0f); - Main.projectile[blazingSun2].Center = player.Center; - } - } - if (ataxiaBlaze && Main.rand.NextBool(5)) - { - if (damage > 0) - { - Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 74); - int eDamage = (int)(100 * player.AverageDamage()); - if (player.whoAmI == Main.myPlayer) - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, ModContent.ProjectileType(), eDamage, 1f, player.whoAmI, 0f, 0f); - } - } - } - else if (daedalusShard) - { - if (damage > 0) - { - Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 27); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(player.velocity.X, player.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; - int sDamage = (int)(27 * player.RangedDamage()); //daedalus ranged helm - if (player.whoAmI == Main.myPlayer) - { - for (i = 0; i < 8; i++) - { - float randomSpeed = (float)Main.rand.Next(1, 7); - float randomSpeed2 = (float)Main.rand.Next(1, 7); - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - int shard = Projectile.NewProjectile(player.Center.X, player.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f) + randomSpeed, 90, sDamage, 1f, player.whoAmI, 0f, 0f); - int shard2 = Projectile.NewProjectile(player.Center.X, player.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f) + randomSpeed2, 90, sDamage, 1f, player.whoAmI, 0f, 0f); - Main.projectile[shard].Calamity().forceTypeless = true; - Main.projectile[shard2].Calamity().forceTypeless = true; - } - } - } - } - else if (reaverSpore) - { - if (damage > 0) - { - Main.PlaySound(3, (int)player.position.X, (int)player.position.Y, 1); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(player.velocity.X, player.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; - int rDamage = (int)(58 * player.RogueDamage()); //Reaver rogue helm - if (player.whoAmI == Main.myPlayer) - { - for (i = 0; i < 4; i++) - { - float xPos = Main.rand.NextBool(2) ? player.Center.X + 100 : player.Center.X - 100; - Vector2 vector2 = new Vector2(xPos, player.Center.Y + Main.rand.Next(-100, 101)); - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - int rspore1 = Projectile.NewProjectile(vector2.X, vector2.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), 567, rDamage, 2f, player.whoAmI, 0f, 0f); - Main.projectile[rspore1].usesLocalNPCImmunity = true; - Main.projectile[rspore1].localNPCHitCooldown = 60; - int rspore2 = Projectile.NewProjectile(vector2.X, vector2.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), 568, rDamage, 2f, player.whoAmI, 0f, 0f); - Main.projectile[rspore2].usesLocalNPCImmunity = true; - Main.projectile[rspore2].localNPCHitCooldown = 60; - } - } - } - } - else if (godSlayerDamage) //god slayer melee helm - { - if (damage > 80) - { - Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 73); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(player.velocity.X, player.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; - if (player.whoAmI == Main.myPlayer) - { - for (i = 0; i < 4; i++) - { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(player.Center.X, player.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(900 * player.MeleeDamage()), 5f, player.whoAmI, 0f, 0f); - Projectile.NewProjectile(player.Center.X, player.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(900 * player.MeleeDamage()), 5f, player.whoAmI, 0f, 0f); - } - } - } - } - else if (godSlayerMage) - { - if (damage > 0) - { - Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 74); - if (player.whoAmI == Main.myPlayer) - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)((auricSet ? 2400 : 1200) * player.MagicDamage()), 1f, player.whoAmI, 0f, 0f); - } - } - } - else if (dsSetBonus) - { - if (player.whoAmI == Main.myPlayer) - { - for (int l = 0; l < 2; l++) - { - float x = player.position.X + (float)Main.rand.Next(-400, 400); - float y = player.position.Y - (float)Main.rand.Next(500, 800); - Vector2 vector = new Vector2(x, y); - float num15 = player.position.X + (float)(player.width / 2) - vector.X; - float num16 = player.position.Y + (float)(player.height / 2) - vector.Y; - num15 += (float)Main.rand.Next(-100, 101); - int num17 = 22; - float num18 = (float)Math.Sqrt((double)(num15 * num15 + num16 * num16)); - num18 = (float)num17 / num18; - num15 *= num18; - num16 *= num18; - int num19 = Projectile.NewProjectile(x, y, num15, num16, ProjectileID.ShadowBeamFriendly, (int)(3000 * player.AverageDamage()), 7f, player.whoAmI, 0f, 0f); - Main.projectile[num19].ai[1] = player.position.Y; - Main.projectile[num19].usesLocalNPCImmunity = true; - Main.projectile[num19].localNPCHitCooldown = 10; - Main.projectile[num19].Calamity().forceTypeless = true; - } - for (int l = 0; l < 5; l++) - { - float x = player.position.X + (float)Main.rand.Next(-400, 400); - float y = player.position.Y - (float)Main.rand.Next(500, 800); - Vector2 vector = new Vector2(x, y); - float num15 = player.position.X + (float)(player.width / 2) - vector.X; - float num16 = player.position.Y + (float)(player.height / 2) - vector.Y; - num15 += (float)Main.rand.Next(-100, 101); - int num17 = 22; - float num18 = (float)Math.Sqrt((double)(num15 * num15 + num16 * num16)); - num18 = (float)num17 / num18; - num15 *= num18; - num16 *= num18; - int num19 = Projectile.NewProjectile(x, y, num15, num16, ProjectileID.DemonScythe, (int)(5000 * player.AverageDamage()), 7f, player.whoAmI, 0f, 0f); - Main.projectile[num19].ai[1] = player.position.Y; - Main.projectile[num19].usesLocalNPCImmunity = true; - Main.projectile[num19].localNPCHitCooldown = 10; - Main.projectile[num19].Calamity().forceTypeless = true; - } - } - } - if (lastProjectileHit != null) - { - switch (lastProjectileHit.modProjectile.cooldownSlot) - { - case 0: - case 1: - player.hurtCooldowns[lastProjectileHit.modProjectile.cooldownSlot] += iFramesToAdd; - break; - case -1: - default: - player.immuneTime += iFramesToAdd; - break; - } - } - else - { - player.immuneTime += iFramesToAdd; - } + if (fCarapace) + { + if (damage > 0) + { + Main.PlaySound(3, (int)player.position.X, (int)player.position.Y, 45); + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(player.velocity.X, player.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int i; + int fDamage = (int)(56 * player.AverageDamage()); + if (player.whoAmI == Main.myPlayer) + { + for (i = 0; i < 4; i++) + { + float xPos = Main.rand.NextBool(2) ? player.Center.X + 100 : player.Center.X - 100; + Vector2 vector2 = new Vector2(xPos, player.Center.Y + Main.rand.Next(-100, 101)); + offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; + int spore1 = Projectile.NewProjectile(vector2.X, vector2.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), 590, fDamage, 1.25f, player.whoAmI, 0f, 0f); + int spore2 = Projectile.NewProjectile(vector2.X, vector2.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), 590, fDamage, 1.25f, player.whoAmI, 0f, 0f); + Main.projectile[spore1].timeLeft = 120; + Main.projectile[spore2].timeLeft = 120; + } + } + } + } + if (aSpark) + { + if (damage > 0) + { + Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 93); + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(player.velocity.X, player.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int i; + int sDamage = hardMode ? 36 : 6; + if (aSparkRare) + sDamage += hardMode ? 12 : 2; + if (player.whoAmI == Main.myPlayer) + { + for (i = 0; i < 4; i++) + { + offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; + int spark1 = Projectile.NewProjectile(player.Center.X, player.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(sDamage * player.AverageDamage()), 1.25f, player.whoAmI, 0f, 0f); + int spark2 = Projectile.NewProjectile(player.Center.X, player.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(sDamage * player.AverageDamage()), 1.25f, player.whoAmI, 0f, 0f); + Main.projectile[spark1].timeLeft = 120; + Main.projectile[spark2].timeLeft = 120; + Main.projectile[spark1].Calamity().forceTypeless = true; + Main.projectile[spark2].Calamity().forceTypeless = true; + } + } + } + } + if (inkBomb) + { + if (player.whoAmI == Main.myPlayer && !inkBombCooldown) + { + player.AddBuff(ModContent.BuffType(), 1200); + rogueStealth += 0.5f; + for (int i = 0; i < 5; i++) + { + Main.PlaySound(2, (int)Main.player[Main.myPlayer].position.X, (int)Main.player[Main.myPlayer].position.Y, 61); + int inkBomb = Projectile.NewProjectile(player.Center.X, player.Center.Y, Main.rand.NextFloat(-3f, 3f), Main.rand.NextFloat(-0f, -4f), ModContent.ProjectileType(), 0, 0, player.whoAmI); + } + } + } + if (blazingCore) + { + if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1 && player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) + { + for (int i = 0; i < 360; i += 3) + { + Vector2 BCDSpeed = new Vector2(5f, 5f).RotatedBy(MathHelper.ToRadians(i)); + Dust.NewDust(player.Center, 1, 1, 244, BCDSpeed.X, BCDSpeed.Y, 0, default, 1.1f); + } + Main.PlaySound(SoundID.Item14, player.Center); + int blazingSun = Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(1690 * player.AverageDamage()), 0f, player.whoAmI, 0f, 0f); + Main.projectile[blazingSun].Center = player.Center; + int blazingSun2 = Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, player.whoAmI, 0f, 0f); + Main.projectile[blazingSun2].Center = player.Center; + } + } + if (ataxiaBlaze && Main.rand.NextBool(5)) + { + if (damage > 0) + { + Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 74); + int eDamage = (int)(100 * player.AverageDamage()); + if (player.whoAmI == Main.myPlayer) + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, ModContent.ProjectileType(), eDamage, 1f, player.whoAmI, 0f, 0f); + } + } + } + else if (daedalusShard) + { + if (damage > 0) + { + Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 27); + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(player.velocity.X, player.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int i; + int sDamage = (int)(27 * player.RangedDamage()); //daedalus ranged helm + if (player.whoAmI == Main.myPlayer) + { + for (i = 0; i < 8; i++) + { + float randomSpeed = (float)Main.rand.Next(1, 7); + float randomSpeed2 = (float)Main.rand.Next(1, 7); + offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; + int shard = Projectile.NewProjectile(player.Center.X, player.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f) + randomSpeed, 90, sDamage, 1f, player.whoAmI, 0f, 0f); + int shard2 = Projectile.NewProjectile(player.Center.X, player.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f) + randomSpeed2, 90, sDamage, 1f, player.whoAmI, 0f, 0f); + Main.projectile[shard].Calamity().forceTypeless = true; + Main.projectile[shard2].Calamity().forceTypeless = true; + } + } + } + } + else if (reaverSpore) + { + if (damage > 0) + { + Main.PlaySound(3, (int)player.position.X, (int)player.position.Y, 1); + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(player.velocity.X, player.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int i; + int rDamage = (int)(58 * player.RogueDamage()); //Reaver rogue helm + if (player.whoAmI == Main.myPlayer) + { + for (i = 0; i < 4; i++) + { + float xPos = Main.rand.NextBool(2) ? player.Center.X + 100 : player.Center.X - 100; + Vector2 vector2 = new Vector2(xPos, player.Center.Y + Main.rand.Next(-100, 101)); + offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; + int rspore1 = Projectile.NewProjectile(vector2.X, vector2.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), 567, rDamage, 2f, player.whoAmI, 0f, 0f); + Main.projectile[rspore1].usesLocalNPCImmunity = true; + Main.projectile[rspore1].localNPCHitCooldown = 60; + int rspore2 = Projectile.NewProjectile(vector2.X, vector2.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), 568, rDamage, 2f, player.whoAmI, 0f, 0f); + Main.projectile[rspore2].usesLocalNPCImmunity = true; + Main.projectile[rspore2].localNPCHitCooldown = 60; + } + } + } + } + else if (godSlayerDamage) //god slayer melee helm + { + if (damage > 80) + { + Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 73); + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(player.velocity.X, player.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int i; + if (player.whoAmI == Main.myPlayer) + { + for (i = 0; i < 4; i++) + { + offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; + Projectile.NewProjectile(player.Center.X, player.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(900 * player.MeleeDamage()), 5f, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(player.Center.X, player.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(900 * player.MeleeDamage()), 5f, player.whoAmI, 0f, 0f); + } + } + } + } + else if (godSlayerMage) + { + if (damage > 0) + { + Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 74); + if (player.whoAmI == Main.myPlayer) + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)((auricSet ? 2400 : 1200) * player.MagicDamage()), 1f, player.whoAmI, 0f, 0f); + } + } + } + else if (dsSetBonus) + { + if (player.whoAmI == Main.myPlayer) + { + for (int l = 0; l < 2; l++) + { + float x = player.position.X + (float)Main.rand.Next(-400, 400); + float y = player.position.Y - (float)Main.rand.Next(500, 800); + Vector2 vector = new Vector2(x, y); + float num15 = player.position.X + (float)(player.width / 2) - vector.X; + float num16 = player.position.Y + (float)(player.height / 2) - vector.Y; + num15 += (float)Main.rand.Next(-100, 101); + int num17 = 22; + float num18 = (float)Math.Sqrt((double)(num15 * num15 + num16 * num16)); + num18 = (float)num17 / num18; + num15 *= num18; + num16 *= num18; + int num19 = Projectile.NewProjectile(x, y, num15, num16, ProjectileID.ShadowBeamFriendly, (int)(3000 * player.AverageDamage()), 7f, player.whoAmI, 0f, 0f); + Main.projectile[num19].ai[1] = player.position.Y; + Main.projectile[num19].usesLocalNPCImmunity = true; + Main.projectile[num19].localNPCHitCooldown = 10; + Main.projectile[num19].Calamity().forceTypeless = true; + } + for (int l = 0; l < 5; l++) + { + float x = player.position.X + (float)Main.rand.Next(-400, 400); + float y = player.position.Y - (float)Main.rand.Next(500, 800); + Vector2 vector = new Vector2(x, y); + float num15 = player.position.X + (float)(player.width / 2) - vector.X; + float num16 = player.position.Y + (float)(player.height / 2) - vector.Y; + num15 += (float)Main.rand.Next(-100, 101); + int num17 = 22; + float num18 = (float)Math.Sqrt((double)(num15 * num15 + num16 * num16)); + num18 = (float)num17 / num18; + num15 *= num18; + num16 *= num18; + int num19 = Projectile.NewProjectile(x, y, num15, num16, ProjectileID.DemonScythe, (int)(5000 * player.AverageDamage()), 7f, player.whoAmI, 0f, 0f); + Main.projectile[num19].ai[1] = player.position.Y; + Main.projectile[num19].usesLocalNPCImmunity = true; + Main.projectile[num19].localNPCHitCooldown = 10; + Main.projectile[num19].Calamity().forceTypeless = true; + } + } + } + if (lastProjectileHit != null) + { + switch (lastProjectileHit.modProjectile.cooldownSlot) + { + case 0: + case 1: + player.hurtCooldowns[lastProjectileHit.modProjectile.cooldownSlot] += iFramesToAdd; + break; + case -1: + default: + player.immuneTime += iFramesToAdd; + break; + } + } + else + { + player.immuneTime += iFramesToAdd; + } + } } #endregion @@ -7300,6 +7489,48 @@ namespace CalamityMod.CalPlayer } } } + if (dashMod == 8 && player.dashDelay < 0 && player.whoAmI == Main.myPlayer) //plaguebringer armor + { + Rectangle rectangle = new Rectangle((int)(player.position.X + player.velocity.X * 0.5f - 4f), (int)(player.position.Y + player.velocity.Y * 0.5f - 4f), player.width + 8, player.height + 8); + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && !Main.npc[i].dontTakeDamage && !Main.npc[i].friendly && Main.npc[i].immune[player.whoAmI] <= 0) + { + NPC nPC = Main.npc[i]; + Rectangle rect = nPC.getRect(); + if (rectangle.Intersects(rect) && (nPC.noTileCollide || player.CanHit(nPC))) + { + float num = 50f * player.MinionDamage(); + float num2 = 3f; + bool crit = false; + int direction = player.direction; + if (player.velocity.X < 0f) + { + direction = -1; + } + if (player.velocity.X > 0f) + { + direction = 1; + } + if (player.whoAmI == Main.myPlayer) + { + player.ApplyDamageToNPC(nPC, (int)num, num2, direction, crit); + } + if (nPC.immune[player.whoAmI] < 6) + nPC.immune[player.whoAmI] = 6; + nPC.AddBuff(ModContent.BuffType(), 300); + player.immune = true; + player.immuneNoBlink = true; + if (player.immuneTime < 4) + player.immuneTime = 4; + for (int k = 0; k < player.hurtCooldowns.Length; k++) + { + player.hurtCooldowns[k] = player.immuneTime; + } + } + } + } + } if (dashMod == 1 && player.dashDelay < 0 && player.whoAmI == Main.myPlayer) //Counter Scarf { Rectangle rectangle = new Rectangle((int)((double)player.position.X + (double)player.velocity.X * 0.5 - 4.0), (int)((double)player.position.Y + (double)player.velocity.Y * 0.5 - 4.0), player.width + 8, player.height + 8); @@ -7465,6 +7696,22 @@ namespace CalamityMod.CalPlayer Main.projectile[scythe].idStaticNPCHitCooldown = 10 * Main.projectile[scythe].extraUpdates; } } + else if (dashMod == 8) //Plaguebringer armor + { + for (int m = 0; m < 24; m++) + { + int num14 = Dust.NewDust(new Vector2(player.position.X, player.position.Y + 4f), player.width, player.height - 8, 89, 0f, 0f, 100, default, 1f); + Main.dust[num14].velocity *= 0.1f; + Main.dust[num14].scale *= 1f + (float)Main.rand.Next(20) * 0.01f; + Main.dust[num14].shader = GameShaders.Armor.GetSecondaryShader(player.ArmorSetDye(), player); + Main.dust[num14].noGravity = true; + if (Main.rand.NextBool(2)) + { + Main.dust[num14].fadeIn = 0.5f; + } + } + num7 = 12.5f; //14 + } if (dashMod > 0) { player.vortexStealthActive = false; @@ -7494,9 +7741,9 @@ namespace CalamityMod.CalPlayer else if (dashMod > 0 && !player.mount.Active) { float dashDistance; - if (dashMod == 1) //Counter Scarf + if (dashMod == 1) //Counter and Evasion Scarf { - dashDistance = 14.5f; + dashDistance = evasionScarf ? 16.9f : 14.5f; int direction = 0; bool justDashed = false; if (dashTimeMod > 0) @@ -7535,7 +7782,7 @@ namespace CalamityMod.CalPlayer } if (justDashed) { - player.velocity.X = dashDistance * (float)direction; //eoc dash amount + player.velocity.X = dashDistance * (float)direction; //eoc dash amount (evasion = asgard's) Point point = (player.Center + new Vector2((float)(direction * player.width / 2 + 2), player.gravDir * (float)-(float)player.height / 2f + player.gravDir * 2f)).ToTileCoordinates(); Point point2 = (player.Center + new Vector2((float)(direction * player.width / 2 + 2), 0f)).ToTileCoordinates(); if (WorldGen.SolidOrSlopedTile(point.X, point.Y) || WorldGen.SolidOrSlopedTile(point2.X, point2.Y)) @@ -7933,15 +8180,86 @@ namespace CalamityMod.CalPlayer return; } } + else if (dashMod == 8) //Plaguebringer armor + { + dashDistance = 19f; + int direction = 0; + bool justDashed = false; + if (dashTimeMod > 0) + { + dashTimeMod--; + } + if (dashTimeMod < 0) + { + dashTimeMod++; + } + if (player.controlRight && player.releaseRight) + { + if (dashTimeMod > 0) + { + direction = 1; + justDashed = true; + dashTimeMod = 0; + } + else + { + dashTimeMod = 15; + } + } + else if (player.controlLeft && player.releaseLeft) + { + if (dashTimeMod < 0) + { + direction = -1; + justDashed = true; + dashTimeMod = 0; + } + else + { + dashTimeMod = -15; + } + } + if (justDashed) + { + player.velocity.X = dashDistance * (float)direction; + Point point5 = (player.Center + new Vector2((float)(direction * player.width / 2 + 2), player.gravDir * (float)-(float)player.height / 2f + player.gravDir * 2f)).ToTileCoordinates(); + Point point6 = (player.Center + new Vector2((float)(direction * player.width / 2 + 2), 0f)).ToTileCoordinates(); + if (WorldGen.SolidOrSlopedTile(point5.X, point5.Y) || WorldGen.SolidOrSlopedTile(point6.X, point6.Y)) + { + player.velocity.X = player.velocity.X / 2f; + } + player.dashDelay = -1; + for (int num24 = 0; num24 < 60; num24++) + { + int num25 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 89, 0f, 0f, 100, default, 1.25f); + Dust dust = Main.dust[num25]; + dust.position.X += (float)Main.rand.Next(-5, 6); + dust.position.Y += (float)Main.rand.Next(-5, 6); + dust.velocity *= 0.2f; + dust.scale *= 1f + (float)Main.rand.Next(20) * 0.01f; + dust.shader = GameShaders.Armor.GetSecondaryShader(player.ArmorSetDye(), player); + dust.noGravity = true; + dust.fadeIn = 0.5f; + } + } + } } } private void OnDodge() { - if (player.whoAmI == Main.myPlayer && dodgeScarf && !scarfCooldown) + if (player.whoAmI == Main.myPlayer && dodgeScarf && !scarfCooldown && !eScarfCooldown) { - player.AddBuff(ModContent.BuffType(), 540); - player.AddBuff(ModContent.BuffType(), player.chaosState ? 1800 : 900); + if (evasionScarf) + { + player.AddBuff(ModContent.BuffType(), CalamityUtils.SecondsToFrames(6f)); + player.AddBuff(ModContent.BuffType(), player.chaosState ? CalamityUtils.SecondsToFrames(20f) : CalamityUtils.SecondsToFrames(13f)); + } + else + { + player.AddBuff(ModContent.BuffType(), 540); + player.AddBuff(ModContent.BuffType(), player.chaosState ? 1800 : 900); + } player.immune = true; player.immuneTime = player.longInvince ? 100 : 60; for (int k = 0; k < player.hurtCooldowns.Length; k++) @@ -7985,50 +8303,57 @@ namespace CalamityMod.CalPlayer if (dashMod == 1) { int num7 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num3), player.width + 8, 4, 235, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default, 1.5f); - Main.dust[num7].velocity.X = Main.dust[num7].velocity.X * 0.2f; - Main.dust[num7].velocity.Y = Main.dust[num7].velocity.Y * 0.2f; + Main.dust[num7].velocity.X *= 0.2f; + Main.dust[num7].velocity.Y *= 0.2f; Main.dust[num7].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); } else if (dashMod == 2) { int num7 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num3), player.width + 8, 4, 246, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default, 2.5f); - Main.dust[num7].velocity.X = Main.dust[num7].velocity.X * 0.2f; - Main.dust[num7].velocity.Y = Main.dust[num7].velocity.Y * 0.2f; + Main.dust[num7].velocity.X *= 0.2f; + Main.dust[num7].velocity.Y *= 0.2f; Main.dust[num7].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); } else if (dashMod == 3) { int num7 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num3), player.width + 8, 4, 244, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default, 3f); - Main.dust[num7].velocity.X = Main.dust[num7].velocity.X * 0.2f; - Main.dust[num7].velocity.Y = Main.dust[num7].velocity.Y * 0.2f; + Main.dust[num7].velocity.X *= 0.2f; + Main.dust[num7].velocity.Y *= 0.2f; Main.dust[num7].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); } else if (dashMod == 4) { int num7 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num3), player.width + 8, 4, 244, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default, 3f); - Main.dust[num7].velocity.X = Main.dust[num7].velocity.X * 0.2f; - Main.dust[num7].velocity.Y = Main.dust[num7].velocity.Y * 0.2f; + Main.dust[num7].velocity.X *= 0.2f; + Main.dust[num7].velocity.Y *= 0.2f; Main.dust[num7].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); } else if (dashMod == 5) { int num7 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num3), player.width + 8, 4, 33, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default, 3f); - Main.dust[num7].velocity.X = Main.dust[num7].velocity.X * 0.2f; - Main.dust[num7].velocity.Y = Main.dust[num7].velocity.Y * 0.2f; + Main.dust[num7].velocity.X *= 0.2f; + Main.dust[num7].velocity.Y *= 0.2f; Main.dust[num7].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); } else if (dashMod == 6) { int num7 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num3), player.width + 8, 4, 67, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default, 1.25f); - Main.dust[num7].velocity.X = Main.dust[num7].velocity.X * 0.2f; - Main.dust[num7].velocity.Y = Main.dust[num7].velocity.Y * 0.2f; + Main.dust[num7].velocity.X *= 0.2f; + Main.dust[num7].velocity.Y *= 0.2f; Main.dust[num7].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); } else if (dashMod == 7) { int num7 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num3), player.width + 8, 4, 70, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default, 1.5f); - Main.dust[num7].velocity.X = Main.dust[num7].velocity.X * 0.2f; - Main.dust[num7].velocity.Y = Main.dust[num7].velocity.Y * 0.2f; + Main.dust[num7].velocity.X *= 0.2f; + Main.dust[num7].velocity.Y *= 0.2f; + Main.dust[num7].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); + } + else if (dashMod == 8) + { + int num7 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num3), player.width + 8, 4, 89, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default, 1.25f); + Main.dust[num7].velocity.X *= 0.2f; + Main.dust[num7].velocity.Y *= 0.2f; Main.dust[num7].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); } } @@ -8052,43 +8377,50 @@ namespace CalamityMod.CalPlayer else if (dashMod == 2) { int num12 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num8), player.width + 8, 4, 246, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default, 2.5f); - Main.dust[num12].velocity.X = Main.dust[num12].velocity.X * 0.2f; - Main.dust[num12].velocity.Y = Main.dust[num12].velocity.Y * 0.2f; + Main.dust[num12].velocity.X *= 0.2f; + Main.dust[num12].velocity.Y *= 0.2f; Main.dust[num12].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); } else if (dashMod == 3) { int num12 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num8), player.width + 8, 4, 244, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default, 3f); - Main.dust[num12].velocity.X = Main.dust[num12].velocity.X * 0.2f; - Main.dust[num12].velocity.Y = Main.dust[num12].velocity.Y * 0.2f; + Main.dust[num12].velocity.X *= 0.2f; + Main.dust[num12].velocity.Y *= 0.2f; Main.dust[num12].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); } else if (dashMod == 4) { int num12 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num8), player.width + 8, 4, 244, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default, 3f); - Main.dust[num12].velocity.X = Main.dust[num12].velocity.X * 0.2f; - Main.dust[num12].velocity.Y = Main.dust[num12].velocity.Y * 0.2f; + Main.dust[num12].velocity.X *= 0.2f; + Main.dust[num12].velocity.Y *= 0.2f; Main.dust[num12].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); } else if (dashMod == 5) { int num12 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num8), player.width + 8, 4, 33, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default, 3f); - Main.dust[num12].velocity.X = Main.dust[num12].velocity.X * 0.2f; - Main.dust[num12].velocity.Y = Main.dust[num12].velocity.Y * 0.2f; + Main.dust[num12].velocity.X *= 0.2f; + Main.dust[num12].velocity.Y *= 0.2f; Main.dust[num12].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); } else if (dashMod == 6) { int num12 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num8), player.width + 8, 4, 67, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default, 1.25f); - Main.dust[num12].velocity.X = Main.dust[num12].velocity.X * 0.2f; - Main.dust[num12].velocity.Y = Main.dust[num12].velocity.Y * 0.2f; + Main.dust[num12].velocity.X *= 0.2f; + Main.dust[num12].velocity.Y *= 0.2f; Main.dust[num12].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); } else if (dashMod == 7) { int num12 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num8), player.width + 8, 4, 70, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default, 1.5f); - Main.dust[num12].velocity.X = Main.dust[num12].velocity.X * 0.2f; - Main.dust[num12].velocity.Y = Main.dust[num12].velocity.Y * 0.2f; + Main.dust[num12].velocity.X *= 0.2f; + Main.dust[num12].velocity.Y *= 0.2f; + Main.dust[num12].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); + } + else if (dashMod == 8) + { + int num12 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num8), player.width + 8, 4, 89, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default, 1.25f); + Main.dust[num12].velocity.X *= 0.2f; + Main.dust[num12].velocity.Y *= 0.2f; Main.dust[num12].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); } } @@ -8214,7 +8546,7 @@ namespace CalamityMod.CalPlayer return; Player drawPlayer = drawInfo.drawPlayer; - Item item = drawPlayer.inventory[drawPlayer.selectedItem]; + Item item = drawPlayer.ActiveItem(); if (!drawPlayer.frozen && item.type > 0 && @@ -8242,7 +8574,7 @@ namespace CalamityMod.CalPlayer if ((drawPlayer.itemAnimation > 0 && item.useStyle != 0) || (item.holdStyle > 0 && !drawPlayer.pulley)) { // Staff - if (item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType()) + if (item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || (item.type == ModContent.ItemType() && item.useStyle == 5)) { Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Magic/DeathhailStaffGlow"); if (item.type == ModContent.ItemType()) @@ -8251,6 +8583,8 @@ namespace CalamityMod.CalPlayer texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Magic/SoulPiercerGlow"); else if (item.type == ModContent.ItemType()) texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Magic/FatesRevealGlow"); + else if (item.type == ModContent.ItemType()) + texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Melee/PrismaticBreakerGlow"); float num104 = drawPlayer.itemRotation + 0.785f * (float)drawPlayer.direction; int num105 = 0; @@ -8291,7 +8625,7 @@ namespace CalamityMod.CalPlayer // Bow and Book else if (item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || - item.type == ModContent.ItemType()) + item.type == ModContent.ItemType() || item.type == ModContent.ItemType()) { Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Ranged/DeathwindGlow"); int offsetX = 10; @@ -8310,6 +8644,11 @@ namespace CalamityMod.CalPlayer texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Magic/SubsumingVortexGlow"); offsetX = 9; } + else if (item.type == ModContent.ItemType()) + { + texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Ranged/AuroraBlazerGlow"); + offsetX = 44; + } Vector2 vector13 = new Vector2((float)(Main.itemTexture[item.type].Width / 2), (float)(Main.itemTexture[item.type].Height / 2)); Vector2 vector14 = vector13; @@ -8335,7 +8674,7 @@ namespace CalamityMod.CalPlayer // Sword else if (item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || - item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType()) + item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || (item.type == ModContent.ItemType() && item.useStyle == 1)) { Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Melee/ExcelsusGlow"); if (item.type == ModContent.ItemType()) @@ -8348,6 +8687,8 @@ namespace CalamityMod.CalPlayer texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Melee/TerrorBladeGlow"); else if (item.type == ModContent.ItemType()) texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Summon/EtherealSubjugatorGlow"); + else if (item.type == ModContent.ItemType()) + texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Melee/PrismaticBreakerGlow"); float yOffset = drawPlayer.gravDir == -1f ? 0f : (float)Main.itemTexture[item.type].Height; @@ -8366,22 +8707,20 @@ namespace CalamityMod.CalPlayer } } }); - public override void ModifyDrawInfo(ref PlayerDrawInfo drawInfo) { if (drawInfo.shadow != 0f) return; Player drawPlayer = drawInfo.drawPlayer; - Item item = drawPlayer.inventory[drawPlayer.selectedItem]; + Item item = drawPlayer.ActiveItem(); if (!drawPlayer.frozen && - item.type > 0 && + (item.type > 0 || item.IsAir) && !drawPlayer.dead && - !item.noUseGraphic && (!drawPlayer.wet || !item.noWet)) { - if (item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType()) + if (item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType()) { Color color89 = drawInfo.middleArmorColor = drawPlayer.GetImmuneAlphaPure(Lighting.GetColor((int)(drawPlayer.position.X + drawPlayer.width * 0.5) / 16, (int)(drawPlayer.position.Y + drawPlayer.height * 0.5) / 16, Color.White), drawInfo.shadow); SpriteEffects spriteEffects = player.direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; @@ -8417,6 +8756,8 @@ namespace CalamityMod.CalPlayer thingToDraw = ModContent.GetTexture("CalamityMod/ExtraTextures/Tanks/Backpack_Shadethrower"); else if (item.type == ModContent.ItemType()) thingToDraw = ModContent.GetTexture("CalamityMod/ExtraTextures/Tanks/Backpack_PristineFury"); + else if (item.type == ModContent.ItemType()) + thingToDraw = ModContent.GetTexture("CalamityMod/ExtraTextures/Tanks/Backpack_AuroraBlazer"); float num25 = -4f; float num24 = -8f; @@ -8431,6 +8772,26 @@ namespace CalamityMod.CalPlayer 0); howDoIDrawThings.shader = 0; Main.playerDrawData.Add(howDoIDrawThings); + } + else if (drawPlayer.Calamity().plaguebringerCarapace) + { + Color color89 = drawInfo.middleArmorColor = drawPlayer.GetImmuneAlphaPure(Lighting.GetColor((int)(drawPlayer.position.X + drawPlayer.width * 0.5) / 16, (int)(drawPlayer.position.Y + drawPlayer.height * 0.5) / 16, Color.White), drawInfo.shadow); + SpriteEffects spriteEffects = player.direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + Texture2D thingToDraw = ModContent.GetTexture("CalamityMod/Items/Armor/PlaguebringerCarapace_Back"); + float num25 = -4f; + float num24 = -8f; + DrawData howDoIDrawThings = new DrawData(thingToDraw, + new Vector2((int)(drawPlayer.position.X - Main.screenPosition.X + (drawPlayer.width / 2) - (9 * drawPlayer.direction)) + num25 * drawPlayer.direction, (int)(drawPlayer.position.Y - Main.screenPosition.Y + (drawPlayer.height / 2) + 2f * drawPlayer.gravDir + num24 * drawPlayer.gravDir)), + new Rectangle(0, 0, thingToDraw.Width, thingToDraw.Height), + color89, + drawPlayer.bodyRotation, + new Vector2(thingToDraw.Width / 2, thingToDraw.Height / 2), + 1f, + spriteEffects, + 0); + howDoIDrawThings.shader = 0; + Main.playerDrawData.Add(howDoIDrawThings); } } } @@ -8606,6 +8967,86 @@ namespace CalamityMod.CalPlayer } }); + public static readonly PlayerLayer IbanDevRobot = new PlayerLayer("CalamityMod", "IbanDevRobot", PlayerLayer.Body, (drawInfo) => + { + Player drawPlayer = drawInfo.drawPlayer; + if (drawPlayer.Calamity().andromedaState == AndromedaPlayerState.Inactive) + return; + Main.playerDrawData.Clear(); + int robot = -1; + for (int i = 0; i < Main.projectile.Length; i++) + { + if (Main.projectile[i].active && + Main.projectile[i].type == ModContent.ProjectileType() && + Main.projectile[i].owner == drawPlayer.whoAmI) + { + robot = i; + break; + } + } + if (robot == -1) + { + drawPlayer.Calamity().andromedaState = AndromedaPlayerState.Inactive; + return; + } + + GiantIbanRobotOfDoom robotEntityInstance = (GiantIbanRobotOfDoom)Main.projectile[robot].modProjectile; + if (drawPlayer.Calamity().andromedaState == AndromedaPlayerState.SpecialAttack) + { + Texture2D dashTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/AndromedaBolt"); + Rectangle frame = dashTexture.Frame(1, 4, 0, robotEntityInstance.RightIconCooldown / 4 % 4); + + DrawData drawData = new DrawData(dashTexture, + drawPlayer.Center + new Vector2(0f, -8f) - Main.screenPosition, + frame, + Color.White, + Main.projectile[robot].rotation, + drawPlayer.Size / 2, + 1f, + Main.projectile[robot].spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, + 1); + drawData.shader = drawPlayer.cBody; + + Main.playerDrawData.Add(drawData); + } + else if (drawPlayer.Calamity().andromedaState == AndromedaPlayerState.LargeRobot) + { + Texture2D robotTexture = ModContent.GetTexture(robotEntityInstance.Texture); + Rectangle frame = new Rectangle(robotEntityInstance.FrameX * robotTexture.Width / 3, robotEntityInstance.FrameY * robotTexture.Height / 7, + robotTexture.Width / 3, robotTexture.Height / 7); + + DrawData drawData = new DrawData(ModContent.GetTexture(Main.projectile[robot].modProjectile.Texture), + Main.projectile[robot].Center + Vector2.UnitY * 6f - Main.screenPosition, + frame, + Color.White, + Main.projectile[robot].rotation, + Main.projectile[robot].Size / 2, + 1f, + Main.projectile[robot].spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, + 1); + drawData.shader = drawPlayer.cBody; + + Main.playerDrawData.Add(drawData); + } + else + { + Texture2D robotTexture = ModContent.GetTexture("CalamityMod/Projectiles/Summon/AndromedaSmall"); + Rectangle frame = new Rectangle(0, robotEntityInstance.CurrentFrame * 54, robotTexture.Width, robotTexture.Height / 21); + DrawData drawData = new DrawData(robotTexture, + drawPlayer.Center + new Vector2(0f, -8f) - Main.screenPosition, + frame, + Color.White, + 0f, + drawPlayer.Size / 2, + 1f, + Main.projectile[robot].spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, + 1); + drawData.shader = drawPlayer.cBody; + + Main.playerDrawData.Add(drawData); + } + }); + public override void ModifyDrawLayers(List list) { MiscEffectsBack.visible = true; @@ -8634,6 +9075,7 @@ namespace CalamityMod.CalPlayer } list.Add(ColdDivinityOverlay); list.Add(StratusSphereDrawing); + list.Add(IbanDevRobot); } public PlayerLayer clAfterAll = new PlayerLayer("Calamity", "clAfterAll", PlayerLayer.MiscEffectsFront, delegate (PlayerDrawInfo drawInfo) @@ -9312,7 +9754,8 @@ namespace CalamityMod.CalPlayer bool isAxe = it.axe > 0; bool isHammer = it.hammer > 0; bool isPlaced = it.createTile != -1; - bool hasNonWeaponFunction = isPickaxe || isAxe || isHammer || isPlaced; + bool isChannelable = it.channel; + bool hasNonWeaponFunction = isPickaxe || isAxe || isHammer || isPlaced || isChannelable; bool playerUsingWeapon = hasDamage && hasHitboxes && !hasNonWeaponFunction; if (!stealthStrikeThisFrame && player.itemAnimation == player.itemAnimationMax - 1 && playerUsingWeapon) ConsumeStealthByAttacking(); @@ -9368,6 +9811,11 @@ namespace CalamityMod.CalPlayer stealthGenStandstill += 0.08f; stealthGenMoving += 0.08f; } + if (shadow) + { + stealthGenStandstill += 0.1f; + stealthGenMoving += 0.1f; + } if (etherealExtorter && Main.moonPhase == 3) // 3 = Waning Crescent stealthGenStandstill += 0.15f; @@ -9416,7 +9864,7 @@ namespace CalamityMod.CalPlayer return rogueStealth >= rogueStealthMax * (stealthStrikeHalfCost ? 0.5f : 1f); } - private void ConsumeStealthByAttacking() + internal void ConsumeStealthByAttacking() { stealthStrikeThisFrame = true; stealthAcceleration = 1f; // Reset acceleration when you attack diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index cce27f6054..a14cc532c1 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -19,6 +19,7 @@ using CalamityMod.Projectiles.Boss; using CalamityMod.Projectiles.Enemy; using CalamityMod.Projectiles.Environment; using CalamityMod.Projectiles.Melee; +using CalamityMod.Projectiles.Magic; using CalamityMod.Projectiles.Rogue; using CalamityMod.Projectiles.Summon; using CalamityMod.Projectiles.Typeless; @@ -315,6 +316,43 @@ namespace CalamityMod.CalPlayer modPlayer.stealthUIAlpha += 0.035f; modPlayer.stealthUIAlpha = MathHelper.Clamp(modPlayer.stealthUIAlpha, 0f, 1f); } + + if (player.Calamity().andromedaState == AndromedaPlayerState.LargeRobot || + player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) + { + player.controlHook = player.releaseHook = false; + } + + if (modPlayer.andromedaCripple > 0) + { + player.velocity = Vector2.Clamp(player.velocity, new Vector2(-11f, -8f), new Vector2(11f, 8f)); + modPlayer.andromedaCripple--; + } + + if (player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0 && + player.Calamity().andromedaState != AndromedaPlayerState.Inactive) + { + player.Calamity().andromedaState = AndromedaPlayerState.Inactive; + } + + if (player.Calamity().andromedaState == AndromedaPlayerState.LargeRobot) + { + player.width = 152; + player.height = 212; + player.position.Y -= 170; + } + else if (player.Calamity().andromedaState == AndromedaPlayerState.SpecialAttack) + { + player.width = 24; + player.height = 98; + player.position.Y -= 56; + } + else if (!player.mount.Active) + { + player.width = 20; + player.height = 42; + } + // Proficiency level ups if (CalamityMod.CalamityConfig.ProficiencyEnabled) modPlayer.GetExactLevelUp(); @@ -876,10 +914,12 @@ namespace CalamityMod.CalPlayer modPlayer.nanoFlareCooldown--; if (modPlayer.spectralVeilImmunity > 0) modPlayer.spectralVeilImmunity--; - if (modPlayer.plaguedFuelPackCooldown > 0) - modPlayer.plaguedFuelPackCooldown--; + if (modPlayer.jetPackCooldown > 0) + modPlayer.jetPackCooldown--; if (modPlayer.plaguedFuelPackDash > 0) modPlayer.plaguedFuelPackDash--; + if (modPlayer.blunderBoosterDash > 0) + modPlayer.blunderBoosterDash--; if (modPlayer.theBeeCooldown > 0) modPlayer.theBeeCooldown--; if (modPlayer.jellyDmg > 0f) @@ -922,6 +962,8 @@ namespace CalamityMod.CalPlayer modPlayer.ladHearts--; if (modPlayer.titanBoost > 0) modPlayer.titanBoost--; + if (modPlayer.prismaticLasers > 0) + modPlayer.prismaticLasers--; // Silva invincibility effects if (modPlayer.silvaCountdown > 0 && modPlayer.hasSilvaEffect && modPlayer.silvaSet) @@ -1701,6 +1743,31 @@ namespace CalamityMod.CalPlayer } } + // Blunder Booster effects + if (modPlayer.blunderBoosterDash > 0) + { + int velocityMult = modPlayer.blunderBoosterDash > 1 ? 35 : 5; + player.velocity = new Vector2(modPlayer.blunderBoosterDirection, -1) * velocityMult; + + int lightningCount = Main.rand.Next(2, 7); + for (int i = 0; i < lightningCount; i++) + { + Vector2 lightningVel = new Vector2(Main.rand.NextFloat(-1, 1), Main.rand.NextFloat(-1, 1)); + lightningVel.Normalize(); + lightningVel *= Main.rand.NextFloat(1f, 2f); + int projectile = Projectile.NewProjectile(player.Center, lightningVel, ModContent.ProjectileType(), (int)(30 * player.RogueDamage()), 0, player.whoAmI, Main.rand.Next(2), 0f); + Main.projectile[projectile].timeLeft = Main.rand.Next(180, 240); + } + + for (int i = 0; i < 3; i++) + { + int dust = Dust.NewDust(player.Center, 1, 1, 60, player.velocity.X * -0.1f, player.velocity.Y * -0.1f, 100, default, 3.5f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 1.2f; + Main.dust[dust].velocity.Y -= 0.15f; + } + } + // Gravistar Sabaton effects if (modPlayer.gSabaton) { @@ -2305,6 +2372,12 @@ namespace CalamityMod.CalPlayer player.moveSpeed += 0.05f; } + if (modPlayer.shadow) + { + if (player.FindBuffIndex(BuffID.Invisibility) > -1) + player.ClearBuff(BuffID.Invisibility); + } + if (modPlayer.irradiated) { if (modPlayer.boomerDukeLore) @@ -2342,6 +2415,11 @@ namespace CalamityMod.CalPlayer player.meleeDamage += 0.2f; } + if (modPlayer.eScarfBoost) + { + player.allDamage += 0.1f; + modPlayer.AllCritBoost(10); + } if (modPlayer.sMeleeBoost) { player.allDamage += 0.1f; @@ -2661,6 +2739,12 @@ namespace CalamityMod.CalPlayer player.wingTimeMax = (int)(player.wingTimeMax * 1.1); } + if (modPlayer.prismaticGreaves) + { + if (player.wingTimeMax > 0) + player.wingTimeMax = (int)(player.wingTimeMax * 1.1); + } + if (modPlayer.plagueReaper) { if (player.wingTimeMax > 0) @@ -3385,17 +3469,30 @@ namespace CalamityMod.CalPlayer } } - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 1 || player.ownedProjectileCounts[ModContent.ProjectileType()] > 1 || - player.ownedProjectileCounts[ModContent.ProjectileType()] > 1 || player.ownedProjectileCounts[ModContent.ProjectileType()] > 1 || - player.ownedProjectileCounts[ModContent.ProjectileType()] > 1 || player.ownedProjectileCounts[ModContent.ProjectileType()] > 1) + int brimmy = ModContent.ProjectileType(); + int siren = ModContent.ProjectileType(); + int healer = ModContent.ProjectileType(); + int sandy = ModContent.ProjectileType(); + int cloudy = ModContent.ProjectileType(); + int fungal = ModContent.ProjectileType(); + int howl = ModContent.ProjectileType(); + int calcifer = ModContent.ProjectileType(); + int turnip = ModContent.ProjectileType(); + if (player.ownedProjectileCounts[brimmy] > 1 || player.ownedProjectileCounts[siren] > 1 || + player.ownedProjectileCounts[healer] > 1 || player.ownedProjectileCounts[sandy] > 1 || + player.ownedProjectileCounts[cloudy] > 1 || player.ownedProjectileCounts[fungal] > 1 || + player.ownedProjectileCounts[howl] > 1 || player.ownedProjectileCounts[calcifer] > 1 || + player.ownedProjectileCounts[turnip] > 1) { for (int projIndex = 0; projIndex < Main.maxProjectiles; projIndex++) { if (Main.projectile[projIndex].active && Main.projectile[projIndex].owner == player.whoAmI) { - if (Main.projectile[projIndex].type == ModContent.ProjectileType() || Main.projectile[projIndex].type == ModContent.ProjectileType() || - Main.projectile[projIndex].type == ModContent.ProjectileType() || Main.projectile[projIndex].type == ModContent.ProjectileType() || - Main.projectile[projIndex].type == ModContent.ProjectileType() || Main.projectile[projIndex].type == ModContent.ProjectileType()) + if (Main.projectile[projIndex].type == brimmy || Main.projectile[projIndex].type == siren || + Main.projectile[projIndex].type == healer || Main.projectile[projIndex].type == sandy || + Main.projectile[projIndex].type == cloudy || Main.projectile[projIndex].type == fungal || + Main.projectile[projIndex].type == howl || Main.projectile[projIndex].type == calcifer || + Main.projectile[projIndex].type == turnip) { Main.projectile[projIndex].Kill(); } @@ -3403,12 +3500,35 @@ namespace CalamityMod.CalPlayer } } + if (modPlayer.blunderBooster) + { + if (player.whoAmI == Main.myPlayer) + { + if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(30 * player.RogueDamage()), 0f, player.whoAmI, 0f, 0f); + } + } + else if (player.ownedProjectileCounts[ModContent.ProjectileType()] != 0) + { + if (player.whoAmI == Main.myPlayer) + { + for (int i = 0; i < Main.maxProjectiles; i++) + { + if (Main.projectile[i].active && Main.projectile[i].type == ModContent.ProjectileType() && Main.projectile[i].owner == player.whoAmI) + { + Main.projectile[i].Kill(); + break; + } + } + } + } + if (modPlayer.tesla) { if (player.whoAmI == Main.myPlayer) { if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(10 * player.AverageDamage()), 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(10 * player.AverageDamage()), 0f, player.whoAmI, 0f, 0f); } } else if (player.ownedProjectileCounts[ModContent.ProjectileType()] != 0) @@ -3426,6 +3546,90 @@ namespace CalamityMod.CalPlayer } } + if (modPlayer.prismaticLasers > 1800 && player.whoAmI == Main.myPlayer) + { + float shootSpeed = 18f; + int dmg = (int)(150 * player.MagicDamage()); + Vector2 startPos = player.RotatedRelativePoint(player.MountedCenter, true); + Vector2 velocity = Main.MouseWorld - startPos; + if (player.gravDir == -1f) + { + velocity.Y = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - startPos.Y; + } + float travelDist = velocity.Length(); + if ((float.IsNaN(velocity.X) && float.IsNaN(velocity.Y)) || (velocity.X == 0f && velocity.Y == 0f)) + { + velocity.X = (float)player.direction; + velocity.Y = 0f; + travelDist = shootSpeed; + } + else + { + travelDist = shootSpeed / travelDist; + } + + int laserAmt = 2; + for (int index = 0; index < laserAmt; index++) + { + startPos = new Vector2(player.Center.X + (float)(Main.rand.Next(201) * -(float)player.direction) + (Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); + startPos.X = (startPos.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); + startPos.Y -= (float)(100 * index); + velocity.X = (float)Main.mouseX + Main.screenPosition.X - startPos.X; + velocity.Y = (float)Main.mouseY + Main.screenPosition.Y - startPos.Y; + if (velocity.Y < 0f) + { + velocity.Y *= -1f; + } + if (velocity.Y < 20f) + { + velocity.Y = 20f; + } + travelDist = velocity.Length(); + travelDist = shootSpeed / travelDist; + velocity.X *= travelDist; + velocity.Y *= travelDist; + velocity.X += (float)Main.rand.Next(-50, 51) * 0.02f; + velocity.Y += (float)Main.rand.Next(-50, 51) * 0.02f; + Projectile.NewProjectile(startPos, velocity, ModContent.ProjectileType(), dmg, 4f, player.whoAmI, 0f, (float)Main.rand.Next(10)); + } + Main.PlaySound(SoundID.Item12, player.position); + } + if (modPlayer.prismaticLasers == 1800) + { + //Set the cooldown + player.AddBuff(ModContent.BuffType(), CalamityUtils.SecondsToFrames(30f), true); + } + if (modPlayer.prismaticLasers == 1) + { + //Spawn some dust since you can use it again + int dustAmt = 36; + for (int dustIndex = 0; dustIndex < dustAmt; dustIndex++) + { + Color color = Utils.SelectRandom(Main.rand, new Color[] + { + new Color(255, 0, 0, 50), //Red + new Color(255, 128, 0, 50), //Orange + new Color(255, 255, 0, 50), //Yellow + new Color(128, 255, 0, 50), //Lime + new Color(0, 255, 0, 50), //Green + new Color(0, 255, 128, 50), //Turquoise + new Color(0, 255, 255, 50), //Cyan + new Color(0, 128, 255, 50), //Light Blue + new Color(0, 0, 255, 50), //Blue + new Color(128, 0, 255, 50), //Purple + new Color(255, 0, 255, 50), //Fuschia + new Color(255, 0, 128, 50) //Hot Pink + }); + Vector2 vector6 = Vector2.Normalize(player.velocity) * new Vector2((float)player.width / 2f, (float)player.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(dustIndex - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + player.Center; + Vector2 vector7 = vector6 - player.Center; + int dusty = Dust.NewDust(vector6 + vector7, 0, 0, 267, vector7.X * 1f, vector7.Y * 1f, 100, color, 1f); + Main.dust[dusty].noGravity = true; + Main.dust[dusty].noLight = true; + Main.dust[dusty].velocity = vector7; + } + } + if (modPlayer.theBee) { if (player.statLife >= player.statLifeMax2) diff --git a/CalamityMod.cs b/CalamityMod.cs index cd02b742a6..c1f1ddf3fd 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -65,6 +65,7 @@ using CalamityMod.Projectiles.Magic; using CalamityMod.Projectiles.Melee; using CalamityMod.Projectiles.Ranged; using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Summon; using CalamityMod.Projectiles.Typeless; using CalamityMod.Skies; using CalamityMod.UI; @@ -223,7 +224,7 @@ namespace CalamityMod MomentumCapacitatorHotkey = RegisterHotKey("Momentom Capacitater Effect", "U"); SandCloakHotkey = RegisterHotKey("Sand Cloak Effect", "C"); SpectralVeilHotKey = RegisterHotKey("Spectral Veil Teleport", "Z"); - PlaguePackHotKey = RegisterHotKey("Plagued Fuel Pack Dash", "Q"); + PlaguePackHotKey = RegisterHotKey("Booster Dash", "Q"); if (!Main.dedServ) { @@ -258,6 +259,8 @@ namespace CalamityMod 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"); AddEquipTexture(new PopoNoselessHead(), null, EquipType.Head, "PopoNoselessHead", "CalamityMod/Items/Accessories/Vanity/PopoNoseless_Head"); AddEquipTexture(new PopoBody(), null, EquipType.Body, "PopoBody", "CalamityMod/Items/Accessories/Vanity/Popo_Body", "CalamityMod/Items/Accessories/Vanity/Popo_Arms"); @@ -624,7 +627,8 @@ namespace CalamityMod ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType(), - ModContent.ProjectileType() + ModContent.ProjectileType(), + ModContent.ProjectileType() }; projectileDestroyExceptionList = new List() @@ -1864,7 +1868,8 @@ namespace CalamityMod ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType() + ModContent.ItemType(), + ModContent.ItemType() }; boomerangList = new List() @@ -2047,6 +2052,7 @@ namespace CalamityMod ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType(), + ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType(), @@ -2097,7 +2103,8 @@ namespace CalamityMod ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType() + ModContent.ItemType(), + ModContent.ItemType() }; flaskBombProjList = new List() @@ -2120,12 +2127,14 @@ namespace CalamityMod ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType(), + ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType(), - ModContent.ProjectileType() + ModContent.ProjectileType(), + ModContent.ProjectileType() }; spikyBallList = new List() @@ -2863,7 +2872,8 @@ namespace CalamityMod bool acidRain = CalamityWorld.rainingAcid; if (calamityModMusic != null) { - string musicChoice = acidRain ? CalamityWorld.downedPolterghast ? "Sounds/Music/AcidRain1" : "Sounds/Music/AcidRain1" : "Sounds/Music/Sulphur"; //replace first acidrain1 once second theme is added. + string rainMusic = "Sounds/Music/AcidRain"; + string musicChoice = acidRain ? rainMusic + (CalamityWorld.downedPolterghast ? "2" : "1") : "Sounds/Music/Sulphur"; //replace first acidrain1 once second theme is added. music = calamityModMusic.GetSoundSlot(SoundType.Music, musicChoice); } diff --git a/Dusts/AstralBlue.png b/Dusts/AstralBlue.png index 691796f1c9..04b49e54e3 100644 Binary files a/Dusts/AstralBlue.png and b/Dusts/AstralBlue.png differ diff --git a/Dusts/AstralOrange.png b/Dusts/AstralOrange.png index 2802603a1e..13ad12079e 100644 Binary files a/Dusts/AstralOrange.png and b/Dusts/AstralOrange.png differ diff --git a/Dusts/FinalFlame.cs b/Dusts/FinalFlame.cs new file mode 100644 index 0000000000..efeceeea56 --- /dev/null +++ b/Dusts/FinalFlame.cs @@ -0,0 +1,33 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Dusts +{ + public class FinalFlame : ModDust + { + public override void OnSpawn(Dust dust) + { + dust.color = default; + dust.velocity *= 0.5f; + dust.noGravity = true; + dust.noLight = true; + dust.alpha = 50; + } + + public override bool Update(Dust dust) + { + dust.position += dust.velocity; + dust.scale *= 0.94f; + dust.velocity *= 0.90f; + Lighting.AddLight(dust.position, 0.255f, 0.185f, 0.094f); + if (dust.scale < 0.4f) + { + dust.active = false; + } + return false; + } + + public override Color? GetAlpha(Dust dust, Color lightColor) => new Color(Color.White.R, Color.White.G, Color.White.B, dust.alpha); + } +} \ No newline at end of file diff --git a/Dusts/FinalFlame.png b/Dusts/FinalFlame.png new file mode 100644 index 0000000000..5e75ebb88b Binary files /dev/null and b/Dusts/FinalFlame.png differ diff --git a/ExtraTextures/AndromedaBolt.png b/ExtraTextures/AndromedaBolt.png new file mode 100644 index 0000000000..569ef2c846 Binary files /dev/null and b/ExtraTextures/AndromedaBolt.png differ diff --git a/ExtraTextures/AndromedaWithout_Head.png b/ExtraTextures/AndromedaWithout_Head.png new file mode 100644 index 0000000000..92e2245139 Binary files /dev/null and b/ExtraTextures/AndromedaWithout_Head.png differ diff --git a/ExtraTextures/Lasers/AndromedaDeathrayBegin.png b/ExtraTextures/Lasers/AndromedaDeathrayBegin.png new file mode 100644 index 0000000000..85e4add787 Binary files /dev/null and b/ExtraTextures/Lasers/AndromedaDeathrayBegin.png differ diff --git a/ExtraTextures/Lasers/AndromedaDeathrayEnd.png b/ExtraTextures/Lasers/AndromedaDeathrayEnd.png new file mode 100644 index 0000000000..a76189b3b0 Binary files /dev/null and b/ExtraTextures/Lasers/AndromedaDeathrayEnd.png differ diff --git a/ExtraTextures/Lasers/AndromedaDeathrayMid.png b/ExtraTextures/Lasers/AndromedaDeathrayMid.png new file mode 100644 index 0000000000..75611801d5 Binary files /dev/null and b/ExtraTextures/Lasers/AndromedaDeathrayMid.png differ diff --git a/ExtraTextures/Tanks/Backpack_AuroraBlazer.png b/ExtraTextures/Tanks/Backpack_AuroraBlazer.png new file mode 100644 index 0000000000..3f3cfa8860 Binary files /dev/null and b/ExtraTextures/Tanks/Backpack_AuroraBlazer.png differ diff --git a/Gores/WyvernWeapons/ClamorNoctusBody.png b/Gores/WyvernWeapons/ClamorNoctusBody.png index f187a3a909..20b5978107 100644 Binary files a/Gores/WyvernWeapons/ClamorNoctusBody.png and b/Gores/WyvernWeapons/ClamorNoctusBody.png differ diff --git a/Gores/WyvernWeapons/ClamorNoctusHead.png b/Gores/WyvernWeapons/ClamorNoctusHead.png index d7726d1985..92308b8f97 100644 Binary files a/Gores/WyvernWeapons/ClamorNoctusHead.png and b/Gores/WyvernWeapons/ClamorNoctusHead.png differ diff --git a/Gores/WyvernWeapons/ClamorNoctusTail.png b/Gores/WyvernWeapons/ClamorNoctusTail.png index 900335f9ec..9a3e618fe3 100644 Binary files a/Gores/WyvernWeapons/ClamorNoctusTail.png and b/Gores/WyvernWeapons/ClamorNoctusTail.png differ diff --git a/Items/Accessories/BloomStone.cs b/Items/Accessories/BloomStone.cs index c21b6768b3..06f114da1c 100644 --- a/Items/Accessories/BloomStone.cs +++ b/Items/Accessories/BloomStone.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Items.Accessories { if (random == 0) { - for (int l = 0; l < 200; l++) + for (int l = 0; l < Main.maxNPCs; l++) { NPC nPC = Main.npc[l]; if (nPC.active && !nPC.friendly && nPC.damage > 0 && !nPC.dontTakeDamage && !nPC.buffImmune[num] && Vector2.Distance(player.Center, nPC.Center) <= num2) @@ -64,98 +64,105 @@ namespace CalamityMod.Items.Accessories } } bloomCounter++; + + //Flower Boots code if (player.whoAmI == Main.myPlayer && player.velocity.Y == 0f && player.grappling[0] == -1) { - int num4 = (int)player.Center.X / 16; - int num5 = (int)(player.position.Y + (float)player.height - 1f) / 16; - if (Main.tile[num4, num5] == null) + int x = (int)player.Center.X / 16; + int y = (int)(player.position.Y + (float)player.height - 1f) / 16; + Tile tile = Main.tile[x, y]; + if (tile == null) { - Main.tile[num4, num5] = new Tile(); + tile = new Tile(); } - if (!Main.tile[num4, num5].active() && Main.tile[num4, num5].liquid == 0 && Main.tile[num4, num5 + 1] != null && WorldGen.SolidTile(num4, num5 + 1)) + if (!tile.active() && tile.liquid == 0 && Main.tile[x, y + 1] != null && WorldGen.SolidTile(x, y + 1)) { - Main.tile[num4, num5].frameY = 0; - Main.tile[num4, num5].slope(0); - Main.tile[num4, num5].halfBrick(false); - if (Main.tile[num4, num5 + 1].type == 0) + tile.frameY = 0; + tile.slope(0); + tile.halfBrick(false); + //On dirt blocks, there's a small chance to grow a dye plant + if (Main.tile[x, y + 1].type == TileID.Dirt) { if (Main.rand.NextBool(1000)) { - Main.tile[num4, num5].active(true); - Main.tile[num4, num5].type = 227; - Main.tile[num4, num5].frameX = (short)(34 * Main.rand.Next(1, 13)); - while (Main.tile[num4, num5].frameX == 144) + tile.active(true); + tile.type = TileID.DyePlants; + tile.frameX = (short)(34 * Main.rand.Next(1, 13)); + while (tile.frameX == 144) { - Main.tile[num4, num5].frameX = (short)(34 * Main.rand.Next(1, 13)); + tile.frameX = (short)(34 * Main.rand.Next(1, 13)); } } if (Main.netMode == NetmodeID.MultiplayerClient) { - NetMessage.SendTileSquare(-1, num4, num5, 1, TileChangeType.None); + NetMessage.SendTileSquare(-1, x, y, 1, TileChangeType.None); } } - if (Main.tile[num4, num5 + 1].type == 2) + //On grass, grow flowers + if (Main.tile[x, y + 1].type == TileID.Grass) { if (Main.rand.NextBool(2)) { - Main.tile[num4, num5].active(true); - Main.tile[num4, num5].type = 3; - Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(6, 11)); - while (Main.tile[num4, num5].frameX == 144) + tile.active(true); + tile.type = TileID.Plants; + tile.frameX = (short)(18 * Main.rand.Next(6, 11)); + while (tile.frameX == 144) { - Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(6, 11)); + tile.frameX = (short)(18 * Main.rand.Next(6, 11)); } } else { - Main.tile[num4, num5].active(true); - Main.tile[num4, num5].type = 73; - Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(6, 21)); - while (Main.tile[num4, num5].frameX == 144) + tile.active(true); + tile.type = TileID.Plants2; + tile.frameX = (short)(18 * Main.rand.Next(6, 21)); + while (tile.frameX == 144) { - Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(6, 21)); + tile.frameX = (short)(18 * Main.rand.Next(6, 21)); } } if (Main.netMode == NetmodeID.MultiplayerClient) { - NetMessage.SendTileSquare(-1, num4, num5, 1, TileChangeType.None); + NetMessage.SendTileSquare(-1, x, y, 1, TileChangeType.None); } } - else if (Main.tile[num4, num5 + 1].type == 109) + //On hallowed grass, grow hallowed flowers + else if (Main.tile[x, y + 1].type == TileID.HallowedGrass) { if (Main.rand.NextBool(2)) { - Main.tile[num4, num5].active(true); - Main.tile[num4, num5].type = 110; - Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(4, 7)); - while (Main.tile[num4, num5].frameX == 90) + tile.active(true); + tile.type = TileID.HallowedPlants; + tile.frameX = (short)(18 * Main.rand.Next(4, 7)); + while (tile.frameX == 90) { - Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(4, 7)); + tile.frameX = (short)(18 * Main.rand.Next(4, 7)); } } else { - Main.tile[num4, num5].active(true); - Main.tile[num4, num5].type = 113; - Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(2, 8)); - while (Main.tile[num4, num5].frameX == 90) + tile.active(true); + tile.type = TileID.HallowedPlants2; + tile.frameX = (short)(18 * Main.rand.Next(2, 8)); + while (tile.frameX == 90) { - Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(2, 8)); + tile.frameX = (short)(18 * Main.rand.Next(2, 8)); } } if (Main.netMode == NetmodeID.MultiplayerClient) { - NetMessage.SendTileSquare(-1, num4, num5, 1, TileChangeType.None); + NetMessage.SendTileSquare(-1, x, y, 1, TileChangeType.None); } } - else if (Main.tile[num4, num5 + 1].type == 60) + //On jungle grass, grow jungle flowers + else if (Main.tile[x, y + 1].type == TileID.JungleGrass) { - Main.tile[num4, num5].active(true); - Main.tile[num4, num5].type = 74; - Main.tile[num4, num5].frameX = (short)(18 * Main.rand.Next(9, 17)); + tile.active(true); + tile.type = TileID.JunglePlants2; + tile.frameX = (short)(18 * Main.rand.Next(9, 17)); if (Main.netMode == NetmodeID.MultiplayerClient) { - NetMessage.SendTileSquare(-1, num4, num5, 1, TileChangeType.None); + NetMessage.SendTileSquare(-1, x, y, 1, TileChangeType.None); } } } diff --git a/Items/Accessories/BlunderBooster.cs b/Items/Accessories/BlunderBooster.cs new file mode 100644 index 0000000000..dadf931fe4 --- /dev/null +++ b/Items/Accessories/BlunderBooster.cs @@ -0,0 +1,64 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Items.Materials; +using System.Collections.Generic; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Accessories +{ + public class BlunderBooster : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blunder Booster"); + Tooltip.SetDefault("12% increased rogue damage and 15% increased rogue projectile velocity\n" + + "Summons a red lightning aura to surround the player and electrify nearby enemies\n" + + "TOOLTIP LINE HERE" + + "This effect has a 3 second cooldown before it can be used again"); + } + + public override void SetDefaults() + { + item.width = 30; + item.height = 38; + item.value = CalamityGlobalItem.Rarity12BuyPrice; + item.rare = 10; + item.Calamity().postMoonLordRarity = 12; + item.accessory = true; + } + + public override bool CanEquipAccessory(Player player, int slot) => !player.Calamity().hasJetpack; + + public override void UpdateAccessory(Player player, bool hideVisual) + { + player.Calamity().hasJetpack = true; + player.Calamity().throwingDamage += 0.12f; + player.Calamity().throwingVelocity += 0.15f; + player.Calamity().blunderBooster = true; + } + + public override void ModifyTooltips(List list) + { + string hotkey = CalamityMod.PlaguePackHotKey.TooltipHotkeyString(); + foreach (TooltipLine line in list) + { + if (line.mod == "Terraria" && line.Name == "Tooltip2") + { + line.text = "Press " + hotkey + " to consume 25% of your maximum stealth to perform a swift upwards/diagonal dash which leaves a trail of lightning bolts"; + } + } + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType(), 8); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Accessories/BlunderBooster.png b/Items/Accessories/BlunderBooster.png new file mode 100644 index 0000000000..e4a7eb61a0 Binary files /dev/null and b/Items/Accessories/BlunderBooster.png differ diff --git a/Items/Accessories/CounterScarf.cs b/Items/Accessories/CounterScarf.cs index d948773066..569a249447 100644 --- a/Items/Accessories/CounterScarf.cs +++ b/Items/Accessories/CounterScarf.cs @@ -26,6 +26,8 @@ namespace CalamityMod.Items.Accessories item.accessory = true; } + public override bool CanEquipAccessory(Player player, int slot) => !player.Calamity().dodgeScarf; + public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); diff --git a/Items/Accessories/EvasionScarf.cs b/Items/Accessories/EvasionScarf.cs new file mode 100644 index 0000000000..da59176343 --- /dev/null +++ b/Items/Accessories/EvasionScarf.cs @@ -0,0 +1,52 @@ +using CalamityMod.CalPlayer; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Accessories +{ + [AutoloadEquip(EquipType.Neck)] + public class EvasionScarf : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Evasion Scarf"); + Tooltip.SetDefault("True melee strikes deal 30% more damage\n" + + "Grants the ability to dash; dashing into an attack will cause you to dodge it\n" + + "After a dodge you will be granted a buff to all damage, melee speed, and all crit chance for a short time\n" + + "After a successful dodge you must wait 13 seconds before you can dodge again"); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.accessory = true; + item.value = CalamityGlobalItem.Rarity5BuyPrice; + item.rare = 5; + item.Calamity().customRarity = CalamityRarity.Dedicated; + } + + public override bool CanEquipAccessory(Player player, int slot) => !player.Calamity().dodgeScarf; + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.dodgeScarf = true; + modPlayer.evasionScarf = true; + modPlayer.dashMod = 1; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ItemID.SoulofNight, 5); + recipe.AddIngredient(ItemID.SoulofLight, 5); + recipe.AddIngredient(ItemID.Silk, 15); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Accessories/EvasionScarf.png b/Items/Accessories/EvasionScarf.png new file mode 100644 index 0000000000..e342b5f8bc Binary files /dev/null and b/Items/Accessories/EvasionScarf.png differ diff --git a/Items/Accessories/EvasionScarf_Neck.png b/Items/Accessories/EvasionScarf_Neck.png new file mode 100644 index 0000000000..fda3557644 Binary files /dev/null and b/Items/Accessories/EvasionScarf_Neck.png differ diff --git a/Items/Accessories/HowlsHeart.cs b/Items/Accessories/HowlsHeart.cs new file mode 100644 index 0000000000..62234a3e5b --- /dev/null +++ b/Items/Accessories/HowlsHeart.cs @@ -0,0 +1,59 @@ +using CalamityMod.Buffs.Summon; +using CalamityMod.CalPlayer; +using CalamityMod.Projectiles.Summon; +using Terraria; +using Terraria.DataStructures; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Items.Accessories +{ + public class HowlsHeart : ModItem + { + public const int HowlDamage = 45; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Howl's Heart"); + Tooltip.SetDefault("Summons Howl to fight for you, Calcifer to light your way, and Turnip-Head to follow you around"); + Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(5, 4)); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 26; + item.value = CalamityGlobalItem.Rarity4BuyPrice; + item.rare = 4; + item.Calamity().customRarity = CalamityRarity.Dedicated; + item.accessory = true; + } + + public override bool CanEquipAccessory(Player player, int slot) => !player.Calamity().howlsHeart; + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.howlsHeart = true; + if (player.whoAmI == Main.myPlayer) + { + if (player.FindBuffIndex(BuffType()) == -1) + { + player.AddBuff(BuffType(), 3600, true); + } + if (player.ownedProjectileCounts[ProjectileType()] < 1) + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, ProjectileType(), (int)(HowlDamage * player.MinionDamage()), 1f, player.whoAmI, 0f, 0f); + } + if (player.ownedProjectileCounts[ProjectileType()] < 1) + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, ProjectileType(), 0, 0f, player.whoAmI, 0f, 0f); + } + if (player.ownedProjectileCounts[ProjectileType()] < 1) + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, ProjectileType(), 0, 0f, player.whoAmI, 0f, 0f); + } + } + } + } +} diff --git a/Items/Accessories/HowlsHeart.png b/Items/Accessories/HowlsHeart.png new file mode 100644 index 0000000000..d525074346 Binary files /dev/null and b/Items/Accessories/HowlsHeart.png differ diff --git a/Items/Accessories/PlaguedFuelPack.cs b/Items/Accessories/PlaguedFuelPack.cs index 458a6bbe33..70ed160be3 100644 --- a/Items/Accessories/PlaguedFuelPack.cs +++ b/Items/Accessories/PlaguedFuelPack.cs @@ -26,8 +26,11 @@ namespace CalamityMod.Items.Accessories item.accessory = true; } + public override bool CanEquipAccessory(Player player, int slot) => !player.Calamity().hasJetpack; + public override void UpdateAccessory(Player player, bool hideVisual) { + player.Calamity().hasJetpack = true; player.Calamity().throwingDamage += 0.05f; player.Calamity().throwingVelocity += 0.15f; player.Calamity().plaguedFuelPack = true; diff --git a/Items/Armor/DesertProwlerHat.cs b/Items/Armor/DesertProwlerHat.cs new file mode 100644 index 0000000000..69a9033f3f --- /dev/null +++ b/Items/Armor/DesertProwlerHat.cs @@ -0,0 +1,60 @@ +using CalamityMod.Buffs.Cooldowns; +using CalamityMod.CalPlayer; +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Rogue; +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class DesertProwlerHat : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Desert Prowler Hat"); + Tooltip.SetDefault("4% increased ranged critical strike chance and 20% chance to not consume ammo"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = CalamityGlobalItem.Rarity1BuyPrice; + item.rare = 1; + item.defense = 1; //6 + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); + } + + public override void UpdateArmorSet(Player player) + { + player.setBonus = "Ranged attacks deal an extra 2 flat damage\n" + + "Ranged crits can rarely whip up a sandstorm"; + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.desertProwler = true; + } + + public override void UpdateEquip(Player player) + { + player.rangedCrit += 4; + player.ammoCost80 = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 2); + recipe.AddIngredient(ItemID.Silk, 8); + recipe.AddTile(TileID.Loom); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/DesertProwlerHat.png b/Items/Armor/DesertProwlerHat.png new file mode 100644 index 0000000000..874bd3bddd Binary files /dev/null and b/Items/Armor/DesertProwlerHat.png differ diff --git a/Items/Armor/DesertProwlerHat_Head.png b/Items/Armor/DesertProwlerHat_Head.png new file mode 100644 index 0000000000..6a07f81bbd Binary files /dev/null and b/Items/Armor/DesertProwlerHat_Head.png differ diff --git a/Items/Armor/DesertProwlerPants.cs b/Items/Armor/DesertProwlerPants.cs new file mode 100644 index 0000000000..a57e60178e --- /dev/null +++ b/Items/Armor/DesertProwlerPants.cs @@ -0,0 +1,42 @@ +using CalamityMod.Items.Materials; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Legs)] + public class DesertProwlerPants : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Desert Prowler Pants"); + Tooltip.SetDefault("10% increased movement speed and immunity to the Mighty Wind debuff"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = CalamityGlobalItem.Rarity1BuyPrice; + item.rare = 1; + item.defense = 2; + } + + public override void UpdateEquip(Player player) + { + player.buffImmune[BuffID.WindPushed] = true; + player.moveSpeed += 0.1f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ItemID.Silk, 5); + recipe.AddTile(TileID.Loom); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/DesertProwlerPants.png b/Items/Armor/DesertProwlerPants.png new file mode 100644 index 0000000000..23e4e0456b Binary files /dev/null and b/Items/Armor/DesertProwlerPants.png differ diff --git a/Items/Armor/DesertProwlerPants_Legs.png b/Items/Armor/DesertProwlerPants_Legs.png new file mode 100644 index 0000000000..ac51bcf4a4 Binary files /dev/null and b/Items/Armor/DesertProwlerPants_Legs.png differ diff --git a/Items/Armor/DesertProwlerShirt.cs b/Items/Armor/DesertProwlerShirt.cs new file mode 100644 index 0000000000..bb6748f94d --- /dev/null +++ b/Items/Armor/DesertProwlerShirt.cs @@ -0,0 +1,42 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Body)] + public class DesertProwlerShirt : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Desert Prowler Shirt"); + Tooltip.SetDefault("5% increased ranged critical strike chance"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = CalamityGlobalItem.Rarity1BuyPrice; + item.rare = 1; + item.defense = 3; + } + + public override void UpdateEquip(Player player) + { + player.rangedCrit += 5; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 3); + recipe.AddIngredient(ItemID.Silk, 10); + recipe.AddTile(TileID.Loom); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/DesertProwlerShirt.png b/Items/Armor/DesertProwlerShirt.png new file mode 100644 index 0000000000..23f35ce0b0 Binary files /dev/null and b/Items/Armor/DesertProwlerShirt.png differ diff --git a/Items/Armor/DesertProwlerShirt_Arms.png b/Items/Armor/DesertProwlerShirt_Arms.png new file mode 100644 index 0000000000..c56e4e4d7d Binary files /dev/null and b/Items/Armor/DesertProwlerShirt_Arms.png differ diff --git a/Items/Armor/DesertProwlerShirt_Body.png b/Items/Armor/DesertProwlerShirt_Body.png new file mode 100644 index 0000000000..6a5292296e Binary files /dev/null and b/Items/Armor/DesertProwlerShirt_Body.png differ diff --git a/Items/Armor/DesertProwlerShirt_FemaleBody.png b/Items/Armor/DesertProwlerShirt_FemaleBody.png new file mode 100644 index 0000000000..9dd9e10998 Binary files /dev/null and b/Items/Armor/DesertProwlerShirt_FemaleBody.png differ diff --git a/Items/Armor/PlaguebringerCarapace.cs b/Items/Armor/PlaguebringerCarapace.cs new file mode 100644 index 0000000000..3287ca0148 --- /dev/null +++ b/Items/Armor/PlaguebringerCarapace.cs @@ -0,0 +1,51 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.CalPlayer; +using CalamityMod.Items.Accessories; +using CalamityMod.Items.Materials; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Body)] + public class PlaguebringerCarapace : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Plaguebringer Carapace"); + Tooltip.SetDefault("Immunity to the Plague\n" + + "12% increased minion damage and +1 max minions\n" + + "Friendly bees inflict the plague"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.defense = 17; + item.value = CalamityGlobalItem.Rarity8BuyPrice; + item.Calamity().customRarity = CalamityRarity.Dedicated; + } + + public override void UpdateEquip(Player player) + { + player.Calamity().plaguebringerCarapace = true; + player.maxMinions += 2; + player.minionDamage += 0.12f; + player.buffImmune[ModContent.BuffType()] = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BeeBreastplate); + recipe.AddIngredient(ModContent.ItemType(), 2); + recipe.AddIngredient(ModContent.ItemType(), 7); + recipe.AddIngredient(ModContent.ItemType(), 7); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} \ No newline at end of file diff --git a/Items/Armor/PlaguebringerCarapace.png b/Items/Armor/PlaguebringerCarapace.png new file mode 100644 index 0000000000..55cde235c2 Binary files /dev/null and b/Items/Armor/PlaguebringerCarapace.png differ diff --git a/Items/Armor/PlaguebringerCarapace_Arms.png b/Items/Armor/PlaguebringerCarapace_Arms.png new file mode 100644 index 0000000000..5ba9bf2d3a Binary files /dev/null and b/Items/Armor/PlaguebringerCarapace_Arms.png differ diff --git a/Items/Armor/PlaguebringerCarapace_Back.png b/Items/Armor/PlaguebringerCarapace_Back.png new file mode 100644 index 0000000000..1c7bbb0250 Binary files /dev/null and b/Items/Armor/PlaguebringerCarapace_Back.png differ diff --git a/Items/Armor/PlaguebringerCarapace_Body.png b/Items/Armor/PlaguebringerCarapace_Body.png new file mode 100644 index 0000000000..803175f3a0 Binary files /dev/null and b/Items/Armor/PlaguebringerCarapace_Body.png differ diff --git a/Items/Armor/PlaguebringerPistons.cs b/Items/Armor/PlaguebringerPistons.cs new file mode 100644 index 0000000000..f1383b7288 --- /dev/null +++ b/Items/Armor/PlaguebringerPistons.cs @@ -0,0 +1,179 @@ +using CalamityMod.Items.Accessories; +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Rogue; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Legs)] + public class PlaguebringerPistons : ModItem + { + public int counter = 0; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Plaguebringer Pistons"); + Tooltip.SetDefault("13% increased minion damage and 15% increased movement speed\n" + + "You grow flowers on the grass beneath you, chance to grow very random dye plants on grassless dirt\n" + + "You spawn bees while sprinting or dashing"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.defense = 8; + item.value = CalamityGlobalItem.Rarity8BuyPrice; + item.Calamity().customRarity = CalamityRarity.Dedicated; + } + + public override void UpdateEquip(Player player) + { + player.minionDamage += 0.13f; + player.moveSpeed += 0.15f; + + //Spawn bees while sprinting or dashing + counter++; + if (counter % 12 == 0) + { + if ((Math.Abs(player.velocity.X) >= 5 || Math.Abs(player.velocity.Y) >= 5) && player.whoAmI == Main.myPlayer) + { + int beeCount = 1; + if (Main.rand.NextBool(3)) + ++beeCount; + if (Main.rand.NextBool(3)) + ++beeCount; + if (player.strongBees && Main.rand.NextBool(3)) + ++beeCount; + int damage = 30; + damage = (int)(damage * player.MinionDamage()); + for (int index = 0; index < beeCount; ++index) + { + int bee = Projectile.NewProjectile(player.Center.X, player.Center.Y, Main.rand.NextFloat(-35f, 35f) * 0.02f, Main.rand.NextFloat(-35f, 35f) * 0.02f, (Main.rand.NextBool(4) ? ModContent.ProjectileType() : player.beeType()), damage, player.beeKB(0f), player.whoAmI, 0f, 0f); + Main.projectile[bee].Calamity().forceMinion = true; + Main.projectile[bee].usesLocalNPCImmunity = true; + Main.projectile[bee].localNPCHitCooldown = 10; + Main.projectile[bee].penetrate = 2; + } + } + } + + //Flower Boots code + if (player.whoAmI == Main.myPlayer && player.velocity.Y == 0f && player.grappling[0] == -1) + { + int x = (int)player.Center.X / 16; + int y = (int)(player.position.Y + (float)player.height - 1f) / 16; + Tile tile = Main.tile[x, y]; + if (tile == null) + { + tile = new Tile(); + } + if (!tile.active() && tile.liquid == 0 && Main.tile[x, y + 1] != null && WorldGen.SolidTile(x, y + 1)) + { + tile.frameY = 0; + tile.slope(0); + tile.halfBrick(false); + //On dirt blocks, there's a small chance to grow a dye plant + if (Main.tile[x, y + 1].type == TileID.Dirt) + { + if (Main.rand.NextBool(1000)) + { + tile.active(true); + tile.type = TileID.DyePlants; + tile.frameX = (short)(34 * Main.rand.Next(1, 13)); + while (tile.frameX == 144) + { + tile.frameX = (short)(34 * Main.rand.Next(1, 13)); + } + } + if (Main.netMode == NetmodeID.MultiplayerClient) + { + NetMessage.SendTileSquare(-1, x, y, 1, TileChangeType.None); + } + } + //On grass, grow flowers + if (Main.tile[x, y + 1].type == TileID.Grass) + { + if (Main.rand.NextBool(2)) + { + tile.active(true); + tile.type = TileID.Plants; + tile.frameX = (short)(18 * Main.rand.Next(6, 11)); + while (tile.frameX == 144) + { + tile.frameX = (short)(18 * Main.rand.Next(6, 11)); + } + } + else + { + tile.active(true); + tile.type = TileID.Plants2; + tile.frameX = (short)(18 * Main.rand.Next(6, 21)); + while (tile.frameX == 144) + { + tile.frameX = (short)(18 * Main.rand.Next(6, 21)); + } + } + if (Main.netMode == NetmodeID.MultiplayerClient) + { + NetMessage.SendTileSquare(-1, x, y, 1, TileChangeType.None); + } + } + //On hallowed grass, grow hallowed flowers + else if (Main.tile[x, y + 1].type == TileID.HallowedGrass) + { + if (Main.rand.NextBool(2)) + { + tile.active(true); + tile.type = TileID.HallowedPlants; + tile.frameX = (short)(18 * Main.rand.Next(4, 7)); + while (tile.frameX == 90) + { + tile.frameX = (short)(18 * Main.rand.Next(4, 7)); + } + } + else + { + tile.active(true); + tile.type = TileID.HallowedPlants2; + tile.frameX = (short)(18 * Main.rand.Next(2, 8)); + while (tile.frameX == 90) + { + tile.frameX = (short)(18 * Main.rand.Next(2, 8)); + } + } + if (Main.netMode == NetmodeID.MultiplayerClient) + { + NetMessage.SendTileSquare(-1, x, y, 1, TileChangeType.None); + } + } + //On jungle grass, grow jungle flowers + else if (Main.tile[x, y + 1].type == TileID.JungleGrass) + { + tile.active(true); + tile.type = TileID.JunglePlants2; + tile.frameX = (short)(18 * Main.rand.Next(9, 17)); + if (Main.netMode == NetmodeID.MultiplayerClient) + { + NetMessage.SendTileSquare(-1, x, y, 1, TileChangeType.None); + } + } + } + } + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BeeGreaves); + recipe.AddIngredient(ItemID.FlowerBoots); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} \ No newline at end of file diff --git a/Items/Armor/PlaguebringerPistons.png b/Items/Armor/PlaguebringerPistons.png new file mode 100644 index 0000000000..fc867a5827 Binary files /dev/null and b/Items/Armor/PlaguebringerPistons.png differ diff --git a/Items/Armor/PlaguebringerPistons_Legs.png b/Items/Armor/PlaguebringerPistons_Legs.png new file mode 100644 index 0000000000..463a3b62e7 Binary files /dev/null and b/Items/Armor/PlaguebringerPistons_Legs.png differ diff --git a/Items/Armor/PlaguebringerVisor.cs b/Items/Armor/PlaguebringerVisor.cs new file mode 100644 index 0000000000..b5b866f3e5 --- /dev/null +++ b/Items/Armor/PlaguebringerVisor.cs @@ -0,0 +1,81 @@ +using CalamityMod.Buffs.Summon; +using CalamityMod.Projectiles.Summon; +using CalamityMod.Items.Armor.Vanity; +using CalamityMod.Items.Materials; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class PlaguebringerVisor : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Plaguebringer Visor"); + Tooltip.SetDefault("15% increased minion damage and +2 max minions\n" + + "+20 max life"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.defense = 7; // 32 total + item.value = CalamityGlobalItem.Rarity8BuyPrice; + item.Calamity().customRarity = CalamityRarity.Dedicated; + } + + public override void UpdateEquip(Player player) + { + player.maxMinions += 2; + player.minionDamage += 0.15f; + player.statLifeMax2 += 20; + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); + } + + public override void ArmorSetShadows(Player player) + { + player.armorEffectDrawShadow = true; + } + + public override void UpdateArmorSet(Player player) + { + player.setBonus = "Grants a plague dash to ram enemies and afflict them with the plague\n" + + "Summons a lil' plaguebringer to protect you and empower nearby minions"; + + player.Calamity().plaguebringerPatronSet = true; + player.Calamity().dashMod = 8; + if (player.whoAmI == Main.myPlayer) + { + if (player.FindBuffIndex(ModContent.BuffType()) == -1) + { + player.AddBuff(ModContent.BuffType(), 3600, true); + } + if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), (int)(80 * player.MinionDamage()), 0f, player.whoAmI, 0f, 0f); + } + } + + // Constantly emit dim green light + Lighting.AddLight(player.Center, 0f, 0.39f, 0.24f); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BeeHeadgear); + recipe.AddIngredient(ModContent.ItemType(), 4); + recipe.AddIngredient(ModContent.ItemType(), 4); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} \ No newline at end of file diff --git a/Items/Armor/PlaguebringerVisor.png b/Items/Armor/PlaguebringerVisor.png new file mode 100644 index 0000000000..270ae5d5f9 Binary files /dev/null and b/Items/Armor/PlaguebringerVisor.png differ diff --git a/Items/Armor/PlaguebringerVisor_Head.png b/Items/Armor/PlaguebringerVisor_Head.png new file mode 100644 index 0000000000..cbd3faf49f Binary files /dev/null and b/Items/Armor/PlaguebringerVisor_Head.png differ diff --git a/Items/Armor/PrismaticGreaves.cs b/Items/Armor/PrismaticGreaves.cs new file mode 100644 index 0000000000..89c4ebf7ef --- /dev/null +++ b/Items/Armor/PrismaticGreaves.cs @@ -0,0 +1,51 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Ores; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Legs)] + public class PrismaticGreaves : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Prismatic Greaves"); + Tooltip.SetDefault("10% increased magic damage and 12% increased magic crit\n" + + "20% decreased non-magic damage\n" + + "Increases flight time and jump speed by 10%"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.defense = 21; + item.value = CalamityGlobalItem.Rarity13BuyPrice; + item.Calamity().customRarity = CalamityRarity.Dedicated; + } + + public override void UpdateEquip(Player player) + { + player.Calamity().prismaticGreaves = true; + player.magicDamage += 0.1f; + player.magicCrit += 12; + player.jumpSpeedBoost += 0.1f; + player.allDamage -= 0.2f; + player.magicDamage += 0.2f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 3); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddIngredient(ModContent.ItemType(), 6); + recipe.AddIngredient(ItemID.Nanites, 300); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/PrismaticGreaves.png b/Items/Armor/PrismaticGreaves.png new file mode 100644 index 0000000000..ff70d746df Binary files /dev/null and b/Items/Armor/PrismaticGreaves.png differ diff --git a/Items/Armor/PrismaticGreaves_Legs.png b/Items/Armor/PrismaticGreaves_Legs.png new file mode 100644 index 0000000000..98ffda4970 Binary files /dev/null and b/Items/Armor/PrismaticGreaves_Legs.png differ diff --git a/Items/Armor/PrismaticHelmet.cs b/Items/Armor/PrismaticHelmet.cs new file mode 100644 index 0000000000..cad0474c9b --- /dev/null +++ b/Items/Armor/PrismaticHelmet.cs @@ -0,0 +1,75 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Ores; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class PrismaticHelmet : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Prismatic Helmet"); + Tooltip.SetDefault("8% increased magic damage and 12% increased magic crit\n" + + "20% decreased non-magic damage\n" + + "Enemies with less than 500 health deal no damage\n" + + "This does not occur while a boss is alive"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.defense = 18; //71 + item.value = CalamityGlobalItem.Rarity13BuyPrice; + item.Calamity().customRarity = CalamityRarity.Dedicated; + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); + } + + public override void ArmorSetShadows(Player player) + { + player.armorEffectDrawShadowSubtle = true; + player.armorEffectDrawOutlines = true; + } + + public override void UpdateArmorSet(Player player) + { + player.Calamity().prismaticSet = true; + player.statManaMax2 += 40; + player.manaCost *= 0.85f; + player.manaRegenBonus += 8; + string hotkey = CalamityMod.TarraHotKey.TooltipHotkeyString(); + player.setBonus = "+40 max mana and 15% reduced mana cost\n" + + "Increased mana regeneration rate\n" + + "Press " + hotkey + " to unleash a barrage of death lasers at the cursor for the next 5 seconds\n" + + "This has a 30 second cooldown"; + } + + public override void UpdateEquip(Player player) + { + player.Calamity().prismaticHelmet = true; + player.allDamage -= 0.2f; + player.magicDamage += 0.2f; + player.magicDamage += 0.08f; + player.magicCrit += 12; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 3); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddIngredient(ModContent.ItemType(), 4); + recipe.AddIngredient(ItemID.Nanites, 300); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/PrismaticHelmet.png b/Items/Armor/PrismaticHelmet.png new file mode 100644 index 0000000000..ed44572040 Binary files /dev/null and b/Items/Armor/PrismaticHelmet.png differ diff --git a/Items/Armor/PrismaticHelmet_Head.png b/Items/Armor/PrismaticHelmet_Head.png new file mode 100644 index 0000000000..e4d743b5be Binary files /dev/null and b/Items/Armor/PrismaticHelmet_Head.png differ diff --git a/Items/Armor/PrismaticRegalia.cs b/Items/Armor/PrismaticRegalia.cs new file mode 100644 index 0000000000..da8b0ef885 --- /dev/null +++ b/Items/Armor/PrismaticRegalia.cs @@ -0,0 +1,53 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Ores; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Body)] + public class PrismaticRegalia : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Prismatic Regalia"); + Tooltip.SetDefault("12% increased magic damage and 15% increased magic crit\n" + + "20% decreased non-magic damage\n" + + "+20 max life and +40 max mana\n" + + "Magic attacks occasionally fire a pair of homing rockets"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.defense = 33; + item.value = CalamityGlobalItem.Rarity13BuyPrice; + item.Calamity().customRarity = CalamityRarity.Dedicated; + } + + public override void UpdateEquip(Player player) + { + player.Calamity().prismaticRegalia = true; + player.statLifeMax2 += 20; + player.statManaMax2 += 40; + player.magicDamage += 0.12f; + player.magicCrit += 15; + player.allDamage -= 0.2f; + player.magicDamage += 0.2f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 3); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddIngredient(ModContent.ItemType(), 8); + recipe.AddIngredient(ItemID.Nanites, 300); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/PrismaticRegalia.png b/Items/Armor/PrismaticRegalia.png new file mode 100644 index 0000000000..6496f673c0 Binary files /dev/null and b/Items/Armor/PrismaticRegalia.png differ diff --git a/Items/Armor/PrismaticRegalia_Arms.png b/Items/Armor/PrismaticRegalia_Arms.png new file mode 100644 index 0000000000..898e5fdc6c Binary files /dev/null and b/Items/Armor/PrismaticRegalia_Arms.png differ diff --git a/Items/Armor/PrismaticRegalia_Body.png b/Items/Armor/PrismaticRegalia_Body.png new file mode 100644 index 0000000000..ddb99b03f8 Binary files /dev/null and b/Items/Armor/PrismaticRegalia_Body.png differ diff --git a/Items/Armor/PrismaticRegalia_FemaleBody.png b/Items/Armor/PrismaticRegalia_FemaleBody.png new file mode 100644 index 0000000000..ddb99b03f8 Binary files /dev/null and b/Items/Armor/PrismaticRegalia_FemaleBody.png differ diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index 2177191869..02269482a1 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -354,6 +354,23 @@ namespace CalamityMod.Items } } } + if (modPlayer.prismaticRegalia) //0 - 99 + { + if (item.magic && Main.rand.Next(0, 100) >= 90) + { + if (player.whoAmI == Main.myPlayer) + { + for (int i = -5; i <= 5; i += 5) + { + if (i != 0) + { + Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.ToRadians(i)); + Projectile.NewProjectile(position.X, position.Y, perturbedSpeed.X, perturbedSpeed.Y, ModContent.ProjectileType(), (int)(damage * 1.3), 2f, player.whoAmI, 0f, 0f); + } + } + } + } + } if (modPlayer.harpyWingBoost && modPlayer.harpyRing) { if (Main.rand.NextBool(5)) @@ -636,6 +653,97 @@ namespace CalamityMod.Items #endregion + #region Andromeda Dev Item Attacks + private bool PerformAndromedaAttacks(Item item, Player player) + { + if (player.whoAmI != Main.myPlayer) + return false; + + int robotIndex = -1; + + for (int i = 0; i < Main.projectile.Length; i++) + { + if (Main.projectile[i].active && + Main.projectile[i].type == ModContent.ProjectileType() && + Main.projectile[i].owner == player.whoAmI) + { + robotIndex = i; + break; + } + } + if (robotIndex != -1) + { + Projectile robot = Main.projectile[robotIndex]; + GiantIbanRobotOfDoom robotModProjectile = ((GiantIbanRobotOfDoom)robot.modProjectile); + if (player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0 && + robotModProjectile.TopIconActive && + (robotModProjectile.RightIconCooldown <= GiantIbanRobotOfDoom.RightIconAttackTime || + !robotModProjectile.RightIconActive)) // "Melee" attack + { + int damage = player.Calamity().andromedaState == AndromedaPlayerState.SmallRobot ? GiantIbanRobotOfDoom.RegicideBaseDamageSmall : GiantIbanRobotOfDoom.RegicideBaseDamageLarge; + if (item.Calamity().rogue) + { + damage = (int)(damage * player.RogueDamage()); + } + if (item.melee) + { + damage = (int)(damage * player.MeleeDamage()); + } + if (item.ranged) + { + damage = (int)(damage * player.RangedDamage()); + } + if (item.magic) + { + damage = (int)(damage * player.MagicDamage()); + } + if (item.summon) + { + damage = (int)(damage * player.MinionDamage()); + } + Projectile blade = Projectile.NewProjectileDirect(robot.Center + (robot.spriteDirection > 0).ToDirectionInt() * robot.width / 2 * Vector2.UnitX, + Vector2.Zero, ModContent.ProjectileType(), damage, 15f, player.whoAmI, Projectile.GetByUUID(robot.owner, robot.whoAmI)); + + if (item.Calamity().rogue) + { + blade.Calamity().forceRogue = true; + } + if (item.melee) + { + blade.Calamity().forceMelee = true; + } + if (item.ranged) + { + blade.Calamity().forceRanged = true; + } + if (item.magic) + { + blade.Calamity().forceMagic = true; + } + if (item.summon) + { + blade.Calamity().forceMinion = true; + } + } + + if (!robotModProjectile.TopIconActive && + (robotModProjectile.LeftBracketActive || robotModProjectile.RightBracketActive) && + !robotModProjectile.BottomBracketActive && + robotModProjectile.LaserCooldown <= 0 && + (robotModProjectile.RightIconCooldown <= GiantIbanRobotOfDoom.RightIconAttackTime || + !robotModProjectile.RightIconActive)) // "Ranged" attack + { + robotModProjectile.LaserCooldown = AndromedaDeathRay.TrueTimeLeft * 2; + if (player.Calamity().andromedaState == AndromedaPlayerState.SmallRobot) + { + robotModProjectile.LaserCooldown = AndromedaDeathRay.TrueTimeLeft + 1; + } + } + } + return false; + } + #endregion + #region Use Item Changes public override bool AltFunctionUse(Item item, Player player) @@ -743,6 +851,26 @@ namespace CalamityMod.Items { return false; // Don't use weapons if you're charging with a spear } + + if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0 && + item.fishingPole > 0) + { + return false; + } + + if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0 && + item.pick == 0 && item.axe == 0 && item.hammer == 0 && item.autoReuse && (item.Calamity().rogue || item.magic || item.ranged || item.melee)) + { + if (player.altFunctionUse == 0) + { + return PerformAndromedaAttacks(item, player); + } + else + { + return AltFunctionUse(item, player); + } + } + if (modPlayer.profanedCrystalBuffs && item.pick == 0 && item.axe == 0 && item.hammer == 0 && item.autoReuse && (item.Calamity().rogue || item.magic || item.ranged || item.melee)) { if (player.altFunctionUse == 0) @@ -769,6 +897,10 @@ namespace CalamityMod.Items } return true; } + if (item.type == ItemID.InvisibilityPotion && player.FindBuffIndex(ModContent.BuffType()) > -1) + { + return false; + } if ((item.type == ItemID.RegenerationPotion || item.type == ItemID.LifeforcePotion) && player.FindBuffIndex(ModContent.BuffType()) > -1) { return false; @@ -817,7 +949,9 @@ namespace CalamityMod.Items { if (!Collision.SolidCollision(teleportLocation, player.width, player.height)) { - if (modPlayer.scarfCooldown) + if (modPlayer.eScarfCooldown) + player.AddBuff(BuffID.ChaosState, (int)(CalamityPlayer.chaosStateDuration * 1.5), true); + else if (modPlayer.scarfCooldown) player.AddBuff(BuffID.ChaosState, CalamityPlayer.chaosStateDuration * 2, true); else player.AddBuff(BuffID.ChaosState, CalamityPlayer.chaosStateDuration, true); @@ -912,6 +1046,21 @@ namespace CalamityMod.Items tt2.overrideColor = new Color(129, 29, 149); if (item.type == ModContent.ItemType()) tt2.overrideColor = new Color(220, 20, 60); + if (item.type == ModContent.ItemType()) + { + if (Main.GlobalTime % 1f < 0.6f) + { + tt2.overrideColor = new Color(89, 229, 255); + } + else if (Main.GlobalTime % 1f < 0.8f) + { + tt2.overrideColor = Color.Lerp(new Color(89, 229, 255), Color.White, (Main.GlobalTime % 1f - 0.6f) / 0.2f); + } + else + { + tt2.overrideColor = Color.Lerp(Color.White, new Color(89, 229, 255), (Main.GlobalTime % 1f - 0.8f) / 0.2f); + } + } // Uniquely colored legendary weapons and Yharim's Crystal if (item.type == ModContent.ItemType() || item.type == ModContent.ItemType()) @@ -932,6 +1081,8 @@ namespace CalamityMod.Items tt2.overrideColor = new Color(255, Main.DiscoG, 0); if (item.type == ModContent.ItemType()) tt2.overrideColor = CalamityUtils.ColorSwap(new Color(255, 168, 53), new Color(255, 249, 0), 2f); + if (item.type == ModContent.ItemType()) + tt2.overrideColor = CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 3f); break; } } diff --git a/Items/Materials/InfectedArmorPlating.cs b/Items/Materials/InfectedArmorPlating.cs new file mode 100644 index 0000000000..b9a00f7674 --- /dev/null +++ b/Items/Materials/InfectedArmorPlating.cs @@ -0,0 +1,22 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Materials +{ + public class InfectedArmorPlating : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Infected Armor Plating"); //haha recycled and recolored Corroded Metal Plating from T2 Acid Rain + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.maxStack = 999; + item.value = Item.buyPrice(0, 5, 0, 0); + item.rare = 8; + } + } +} diff --git a/Items/Materials/InfectedArmorPlating.png b/Items/Materials/InfectedArmorPlating.png new file mode 100644 index 0000000000..c68c72f36d Binary files /dev/null and b/Items/Materials/InfectedArmorPlating.png differ diff --git a/Items/Mounts/BUMBLEDOGE.cs b/Items/Mounts/BUMBLEDOGE.cs new file mode 100644 index 0000000000..9cdc2a3399 --- /dev/null +++ b/Items/Mounts/BUMBLEDOGE.cs @@ -0,0 +1,82 @@ +using CalamityMod.Buffs.Mounts; +using CalamityMod.Projectiles.Ranged; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Mounts +{ + public class BUMBLEDOGE : ModMountData + { + public override void SetDefaults() + { + mountData.spawnDust = 60; + mountData.spawnDustNoGravity = true; + mountData.buff = ModContent.BuffType(); + mountData.flightTimeMax = 600; + mountData.fatigueMax = 0; + mountData.fallDamage = 0f; + mountData.runSpeed = 12f; + mountData.dashSpeed = 12f; + mountData.heightBoost = 44; + mountData.acceleration = 0.2f; + mountData.jumpHeight = 10; + mountData.jumpSpeed = 4f; + mountData.blockExtraJumps = false; + mountData.totalFrames = 12; + mountData.constantJump = false; + int[] array = new int[mountData.totalFrames]; + for (int i = 0; i < array.Length; i++) + { + array[i] = 30; + } + mountData.playerYOffsets = array; + mountData.playerHeadOffset = mountData.heightBoost; + mountData.xOffset = 1; + mountData.bodyFrame = 3; + mountData.yOffset = 0; + mountData.standingFrameCount = 1; + mountData.standingFrameDelay = 12; + mountData.standingFrameStart = 0; + mountData.runningFrameCount = 5; + mountData.runningFrameDelay = 20; + mountData.runningFrameStart = 1; + mountData.flyingFrameCount = 4; + mountData.flyingFrameDelay = 7; + mountData.flyingFrameStart = 7; + mountData.inAirFrameCount = 1; + mountData.inAirFrameDelay = 11; + mountData.inAirFrameStart = 8; + mountData.idleFrameCount = 1; + mountData.idleFrameDelay = 10; + mountData.idleFrameStart = 0; + mountData.idleFrameLoop = true; + mountData.swimFrameCount = mountData.inAirFrameCount; + mountData.swimFrameDelay = mountData.inAirFrameDelay; + mountData.swimFrameStart = mountData.inAirFrameStart; + + mountData.dashSpeed = 25f; + mountData.dashingFrameCount = mountData.flyingFrameCount; + mountData.dashingFrameDelay = 5; + mountData.dashingFrameStart = mountData.flyingFrameStart; + if (Main.netMode != NetmodeID.Server) + { + mountData.textureWidth = mountData.backTexture.Width; + mountData.textureHeight = mountData.backTexture.Height; + } + } + public override void UpdateEffects(Player player) + { + if (Main.rand.NextBool(260) && Main.myPlayer == player.whoAmI) + { + Projectile.NewProjectileDirect(player.Center + Main.rand.NextVector2Circular(45f, 45f), + Main.rand.NextVector2Circular(15f, 15f), + ModContent.ProjectileType(), + (int)(180 * player.AverageDamage()), + 1f, + player.whoAmI).Calamity().forceTypeless = true; + } + } + } +} diff --git a/Items/Mounts/BUMBLEDOGE_Back.png b/Items/Mounts/BUMBLEDOGE_Back.png new file mode 100644 index 0000000000..ba74386886 Binary files /dev/null and b/Items/Mounts/BUMBLEDOGE_Back.png differ diff --git a/Items/Mounts/BUMBLEDOGE_Front.png b/Items/Mounts/BUMBLEDOGE_Front.png new file mode 100644 index 0000000000..ba74386886 Binary files /dev/null and b/Items/Mounts/BUMBLEDOGE_Front.png differ diff --git a/Items/Mounts/BirdSeed.cs b/Items/Mounts/BirdSeed.cs new file mode 100644 index 0000000000..c2e8e1957d --- /dev/null +++ b/Items/Mounts/BirdSeed.cs @@ -0,0 +1,30 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Mounts +{ + public class BirdSeed : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bird Seed"); + Tooltip.SetDefault("Summons a monstrosity"); + } + + public override void SetDefaults() + { + item.width = 34; + item.height = 36; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 1; + item.value = Item.sellPrice(0, 20, 0, 0); + item.rare = 10; + item.Calamity().customRarity = CalamityRarity.Dedicated; + item.UseSound = SoundID.NPCHit51; + item.noMelee = true; + item.mountType = ModContent.MountType(); + } + } +} diff --git a/Items/Mounts/BirdSeed.png b/Items/Mounts/BirdSeed.png new file mode 100644 index 0000000000..88d0de0af5 Binary files /dev/null and b/Items/Mounts/BirdSeed.png differ diff --git a/Items/Pets/RotomRemote.cs b/Items/Pets/RotomRemote.cs index 47e1219cfe..52bcce68aa 100644 --- a/Items/Pets/RotomRemote.cs +++ b/Items/Pets/RotomRemote.cs @@ -44,6 +44,13 @@ namespace CalamityMod.Items.Pets } } + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Pets/RotomRemoteGlow"); + Vector2 origin = new Vector2(texture.Width / 2f, texture.Height / 2f - 2f); + spriteBatch.Draw(texture, item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); + } + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); diff --git a/Items/Pets/RotomRemoteGlow.png b/Items/Pets/RotomRemoteGlow.png new file mode 100644 index 0000000000..8e6e21d16b Binary files /dev/null and b/Items/Pets/RotomRemoteGlow.png differ diff --git a/Items/Placeables/Furniture/AuricToilet.cs b/Items/Placeables/Furniture/AuricToilet.cs new file mode 100644 index 0000000000..dd31366603 --- /dev/null +++ b/Items/Placeables/Furniture/AuricToilet.cs @@ -0,0 +1,45 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.FurnitureBotanic; +using CalamityMod.Items.Placeables.FurnitureCosmilite; +using CalamityMod.Items.Placeables.FurnitureSilva; +using CalamityMod.Tiles.Furniture; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.Furniture +{ + public class AuricToilet : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Auric Toilet"); + Tooltip.SetDefault("This was used by the gods"); + } + + public override void SetDefaults() + { + item.width = 12; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.createTile = ModContent.TileType(); + item.Calamity().postMoonLordRarity = 15; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType(), 4); + recipe.SetResult(this); + recipe.AddTile(ModContent.TileType()); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Placeables/Furniture/AuricToilet.png b/Items/Placeables/Furniture/AuricToilet.png new file mode 100644 index 0000000000..94e35486c4 Binary files /dev/null and b/Items/Placeables/Furniture/AuricToilet.png differ diff --git a/Items/Potions/ShadowPotion.cs b/Items/Potions/ShadowPotion.cs new file mode 100644 index 0000000000..7171a5d8f5 --- /dev/null +++ b/Items/Potions/ShadowPotion.cs @@ -0,0 +1,55 @@ +using CalamityMod.Buffs.Potions; +using CalamityMod.Items.Fishing.BrimstoneCragCatches; +using CalamityMod.Items.Materials; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Potions +{ + public class ShadowPotion : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shadow Potion"); + Tooltip.SetDefault("Causes the player to disappear while not attacking\n" + + "Holding different types of rogue weapons give the player boosts\n" + + "Different types of rogue weapons spawn different projectiles on hit\n" + + "Stealth generation is increased by 10%"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 30; + item.rare = 3; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.buffType = ModContent.BuffType(); + item.buffTime = 18000; //5 minutes + item.value = Item.buyPrice(0, 2, 0, 0); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ItemID.InvisibilityPotion); + recipe.AddIngredient(ItemID.AlchemyTable); + recipe.AddTile(TileID.Bottles); + recipe.SetResult(this, 2); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddIngredient(ItemID.InvisibilityPotion); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Potions/ShadowPotion.png b/Items/Potions/ShadowPotion.png new file mode 100644 index 0000000000..e1bae342cf Binary files /dev/null and b/Items/Potions/ShadowPotion.png differ diff --git a/Items/TreasureBags/AstrageldonBag.cs b/Items/TreasureBags/AstrageldonBag.cs index 4acd405307..788004a24e 100644 --- a/Items/TreasureBags/AstrageldonBag.cs +++ b/Items/TreasureBags/AstrageldonBag.cs @@ -5,7 +5,10 @@ using CalamityMod.Items.Mounts; using CalamityMod.Items.PermanentBoosters; using CalamityMod.Items.Potions; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Items.Weapons.Rogue; using CalamityMod.NPCs.AstrumAureus; using CalamityMod.World; using Terraria; @@ -34,10 +37,7 @@ namespace CalamityMod.Items.TreasureBags item.rare = 9; } - public override bool CanRightClick() - { - return true; - } + public override bool CanRightClick() => true; public override void OpenBossBag(Player player) { @@ -50,7 +50,10 @@ namespace CalamityMod.Items.TreasureBags // Weapons DropHelper.DropItemChance(player, ModContent.ItemType(), 3); + DropHelper.DropItemChance(player, ModContent.ItemType(), 3); + DropHelper.DropItemChance(player, ModContent.ItemType(), 3); DropHelper.DropItemChance(player, ModContent.ItemType(), 3); + DropHelper.DropItemChance(player, ModContent.ItemType(), 3); // Equipment DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.revenge && NPC.downedMoonlord); diff --git a/Items/TreasureBags/BumblebirbBag.cs b/Items/TreasureBags/BumblebirbBag.cs index b02ddcda87..6b7dfd8bb8 100644 --- a/Items/TreasureBags/BumblebirbBag.cs +++ b/Items/TreasureBags/BumblebirbBag.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using CalamityMod.Items.Mounts; using CalamityMod.Items.PermanentBoosters; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; @@ -32,10 +33,7 @@ namespace CalamityMod.Items.TreasureBags item.rare = 9; } - public override bool CanRightClick() - { - return true; - } + public override bool CanRightClick() => true; public override void OpenBossBag(Player player) { @@ -52,6 +50,7 @@ namespace CalamityMod.Items.TreasureBags // Equipment DropHelper.DropItem(player, ModContent.ItemType()); + DropHelper.DropItemChance(player, ModContent.ItemType(), 3); DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.revenge && !player.Calamity().rageBoostThree); // Vanity diff --git a/Items/TreasureBags/PlaguebringerGoliathBag.cs b/Items/TreasureBags/PlaguebringerGoliathBag.cs index 7e0b0982a3..95533681a4 100644 --- a/Items/TreasureBags/PlaguebringerGoliathBag.cs +++ b/Items/TreasureBags/PlaguebringerGoliathBag.cs @@ -43,6 +43,7 @@ namespace CalamityMod.Items.TreasureBags // Materials DropHelper.DropItem(player, ModContent.ItemType(), 13, 17); + DropHelper.DropItem(player, ModContent.ItemType(), 16, 20); DropHelper.DropItem(player, ItemID.Stinger, 4, 8); // Weapons diff --git a/Items/TreasureBags/YharonBag.cs b/Items/TreasureBags/YharonBag.cs index 09c35732ef..46cf9622e8 100644 --- a/Items/TreasureBags/YharonBag.cs +++ b/Items/TreasureBags/YharonBag.cs @@ -52,6 +52,7 @@ namespace CalamityMod.Items.TreasureBags DropHelper.DropItemChance(player, ModContent.ItemType(), 3); DropHelper.DropItemChance(player, ModContent.ItemType(), 3); // Yharon Kindle Staff DropHelper.DropItemChance(player, ModContent.ItemType(), 3); // Infernal Spear + DropHelper.DropItemChance(player, ModContent.ItemType(), 3); // Equipment DropHelper.DropItem(player, ModContent.ItemType()); diff --git a/Items/Weapons/Magic/AlphaRay.cs b/Items/Weapons/Magic/AlphaRay.cs index 2b103f2f62..2d0190fcad 100644 --- a/Items/Weapons/Magic/AlphaRay.cs +++ b/Items/Weapons/Magic/AlphaRay.cs @@ -39,21 +39,15 @@ namespace CalamityMod.Items.Weapons.Magic item.Calamity().customRarity = CalamityRarity.Violet; } - public override Vector2? HoldoutOffset() - { - return new Vector2(-5, 0); - } + public override Vector2? HoldoutOffset() => new Vector2(-5, 0); - public override bool AltFunctionUse(Player player) - { - return true; - } + public override bool AltFunctionUse(Player player) => true; public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { if (player.altFunctionUse == 2) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), (int)(damage * 1.75), knockBack, player.whoAmI, 0.0f, 0.0f); + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), (int)(damage * 1.75), knockBack, player.whoAmI, 0f, 0f); } else { diff --git a/Items/Weapons/Magic/AlulaAustralis.cs b/Items/Weapons/Magic/AlulaAustralis.cs new file mode 100644 index 0000000000..fe5f528c33 --- /dev/null +++ b/Items/Weapons/Magic/AlulaAustralis.cs @@ -0,0 +1,44 @@ +using CalamityMod.Projectiles.Magic; +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Magic +{ + public class AlulaAustralis : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Alula Australis"); + Tooltip.SetDefault("Fires a beautiful aurora trailed by a star shower"); + Item.staff[item.type] = true; + } + + public override void SetDefaults() + { + item.damage = 60; + item.magic = true; + item.mana = 12; + item.width = 52; + item.height = 52; + item.useTime = 17; + item.useAnimation = 17; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3f; + item.value = Item.buyPrice(0, 60, 0, 0); + item.rare = 7; + item.UseSound = SoundID.Item9; + item.autoReuse = true; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 13f; + } + + public override Vector2? HoldoutOrigin() + { + return new Vector2(15, 15); + } + } +} diff --git a/Items/Weapons/Magic/AlulaAustralis.png b/Items/Weapons/Magic/AlulaAustralis.png new file mode 100644 index 0000000000..4cb6687719 Binary files /dev/null and b/Items/Weapons/Magic/AlulaAustralis.png differ diff --git a/Items/Weapons/Magic/Atlantis.cs b/Items/Weapons/Magic/Atlantis.cs index 8bb4b4a40e..b497187c7a 100644 --- a/Items/Weapons/Magic/Atlantis.cs +++ b/Items/Weapons/Magic/Atlantis.cs @@ -36,9 +36,6 @@ namespace CalamityMod.Items.Weapons.Magic item.shootSpeed = 32f; } - public override Vector2? HoldoutOrigin() - { - return new Vector2(15, 15); - } + public override Vector2? HoldoutOrigin() => new Vector2(15, 15); } } diff --git a/Items/Weapons/Magic/ClamorNoctus.png b/Items/Weapons/Magic/ClamorNoctus.png index 02399acf80..3e3a523ae8 100644 Binary files a/Items/Weapons/Magic/ClamorNoctus.png and b/Items/Weapons/Magic/ClamorNoctus.png differ diff --git a/Items/Weapons/Magic/MadAlchemistsCocktailGlove.cs b/Items/Weapons/Magic/MadAlchemistsCocktailGlove.cs index e17ace5fba..167eefcb28 100644 --- a/Items/Weapons/Magic/MadAlchemistsCocktailGlove.cs +++ b/Items/Weapons/Magic/MadAlchemistsCocktailGlove.cs @@ -41,27 +41,16 @@ namespace CalamityMod.Items.Weapons.Magic item.Calamity().customRarity = CalamityRarity.Dedicated; } - public override bool AltFunctionUse(Player player) - { - return true; - } + public override bool AltFunctionUse(Player player) => true; - public override bool CanUseItem(Player player) - { - if (player.altFunctionUse == 2) - item.damage = (int)((double)BaseDamage * 1.5); - else - item.damage = BaseDamage; - - return base.CanUseItem(player); - } + public override bool CanUseItem(Player player) => base.CanUseItem(player); public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { if (player.altFunctionUse == 2) { type = ModContent.ProjectileType(); - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, (int)((float)BaseDamage * 1.5f * player.magicDamage), knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, (int)(damage * 1.5f), knockBack, player.whoAmI, 0f, 0f); } else { @@ -83,7 +72,7 @@ namespace CalamityMod.Items.Weapons.Magic break; } - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, (int)((float)BaseDamage * player.magicDamage), knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); FlaskType++; if (FlaskType > 3) diff --git a/Items/Weapons/Magic/ParasiticSceptor.cs b/Items/Weapons/Magic/ParasiticSceptor.cs new file mode 100644 index 0000000000..9b48e1101c --- /dev/null +++ b/Items/Weapons/Magic/ParasiticSceptor.cs @@ -0,0 +1,95 @@ +using CalamityMod.Projectiles.Magic; +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Magic +{ + public class ParasiticSceptor : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Parasitic Sceptor"); + Tooltip.SetDefault("Fires a spread of water leeches that latch onto enemies, dealing a stacking damage over time"); + Item.staff[item.type] = true; + } + + public override void SetDefaults() + { + item.damage = 12; + item.knockBack = 3f; + item.mana = 10; + item.useTime = item.useAnimation = 25; + item.autoReuse = true; + item.magic = true; + item.shootSpeed = 10f; + item.shoot = ModContent.ProjectileType(); + + item.width = item.height = 52; + item.UseSound = SoundID.Item46; + item.noMelee = true; + item.useStyle = 5; + item.rare = 2; + item.value = CalamityGlobalItem.Rarity2BuyPrice; + } + + public override Vector2? HoldoutOrigin() => new Vector2(15, 15); + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + float speed = item.shootSpeed; + Vector2 playerPos = player.RotatedRelativePoint(player.MountedCenter, true); + float xDist = Main.mouseX + Main.screenPosition.X - playerPos.X; + float yDist = Main.mouseY + Main.screenPosition.Y - playerPos.Y; + if (player.gravDir == -1f) + { + yDist = Main.screenPosition.Y + Main.screenHeight - Main.mouseY - playerPos.Y; + } + Vector2 vector = new Vector2(xDist, yDist); + float speedMult = vector.Length(); + if ((float.IsNaN(xDist) && float.IsNaN(yDist)) || (xDist == 0f && yDist == 0f)) + { + xDist = player.direction; + yDist = 0f; + speedMult = speed; + } + else + { + speedMult = speed / speedMult; + } + xDist *= speedMult; + yDist *= speedMult; + int leechAmt = 2; + if (Main.rand.NextBool(3)) + { + leechAmt++; + } + if (Main.rand.NextBool(4)) + { + leechAmt++; + } + if (Main.rand.NextBool(5)) + { + leechAmt ++; + } + for (int i = 0; i < leechAmt; i++) + { + float xVec = xDist; + float yVec = yDist; + float spreadMult = 0.05f * i; + xVec += Main.rand.NextFloat(-25f, 25f) * spreadMult; + yVec += Main.rand.NextFloat(-25f, 25f) * spreadMult; + Vector2 directionToShoot = new Vector2(xVec, yVec); + speedMult = directionToShoot.Length(); + speedMult = speed / speedMult; + xVec *= speedMult; + yVec *= speedMult; + directionToShoot = new Vector2(xVec, yVec); + Projectile.NewProjectile(playerPos, directionToShoot, type, damage, knockBack, player.whoAmI, 0f, 0f); + } + return false; + } + } +} diff --git a/Items/Weapons/Magic/ParasiticSceptor.png b/Items/Weapons/Magic/ParasiticSceptor.png new file mode 100644 index 0000000000..9aca524358 Binary files /dev/null and b/Items/Weapons/Magic/ParasiticSceptor.png differ diff --git a/Items/Weapons/Magic/Starfall.png b/Items/Weapons/Magic/Starfall.png index 7a63265d99..ff885d0508 100644 Binary files a/Items/Weapons/Magic/Starfall.png and b/Items/Weapons/Magic/Starfall.png differ diff --git a/Items/Weapons/Magic/StratusSphere.png b/Items/Weapons/Magic/StratusSphere.png index c948342b48..e0affc9ac3 100644 Binary files a/Items/Weapons/Magic/StratusSphere.png and b/Items/Weapons/Magic/StratusSphere.png differ diff --git a/Items/Weapons/Magic/ThornBlossom.cs b/Items/Weapons/Magic/ThornBlossom.cs index 84a18c02f6..d3e2b2aaea 100644 --- a/Items/Weapons/Magic/ThornBlossom.cs +++ b/Items/Weapons/Magic/ThornBlossom.cs @@ -37,10 +37,7 @@ namespace CalamityMod.Items.Weapons.Magic item.Calamity().customRarity = CalamityRarity.RareVariant; } - public override Vector2? HoldoutOrigin() - { - return new Vector2(15, 15); - } + public override Vector2? HoldoutOrigin() => new Vector2(15, 15); public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { @@ -55,7 +52,7 @@ namespace CalamityMod.Items.Weapons.Magic float SpeedY = speedY + (float)Main.rand.Next(-120, 121) * 0.05f; Projectile.NewProjectile(position.X, position.Y, SpeedX * 1.5f, SpeedY * 1.5f, ModContent.ProjectileType(), (int)(damage * 1.5), knockBack, player.whoAmI, 0f, 0f); } - Projectile.NewProjectile(position.X, position.Y, speedX * 0.66f, speedY * 0.66f, type, damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position.X, position.Y, speedX * 0.66f, speedY * 0.66f, type, damage, knockBack, player.whoAmI, 1f, 0f); return false; } } diff --git a/Items/Weapons/Magic/UndinesRetribution.png b/Items/Weapons/Magic/UndinesRetribution.png index fdc108827a..96f3ce9794 100644 Binary files a/Items/Weapons/Magic/UndinesRetribution.png and b/Items/Weapons/Magic/UndinesRetribution.png differ diff --git a/Items/Weapons/Melee/AmidiasTrident.cs b/Items/Weapons/Melee/AmidiasTrident.cs index 7d1b1d1d38..8c6372ab45 100644 --- a/Items/Weapons/Melee/AmidiasTrident.cs +++ b/Items/Weapons/Melee/AmidiasTrident.cs @@ -34,16 +34,6 @@ namespace CalamityMod.Items.Weapons.Melee item.shootSpeed = 6f; } - public override bool CanUseItem(Player player) - { - for (int i = 0; i < 1000; ++i) - { - if (Main.projectile[i].active && Main.projectile[i].owner == Main.myPlayer && Main.projectile[i].type == item.shoot) - { - return false; - } - } - return true; - } + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; } } diff --git a/Items/Weapons/Melee/AstralPike.cs b/Items/Weapons/Melee/AstralPike.cs index 41721b7960..e86c53a34b 100644 --- a/Items/Weapons/Melee/AstralPike.cs +++ b/Items/Weapons/Melee/AstralPike.cs @@ -45,16 +45,6 @@ namespace CalamityMod.Items.Weapons.Melee recipe.AddRecipe(); } - public override bool CanUseItem(Player player) - { - for (int i = 0; i < 1000; ++i) - { - if (Main.projectile[i].active && Main.projectile[i].owner == Main.myPlayer && Main.projectile[i].type == item.shoot) - { - return false; - } - } - return true; - } + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; } } diff --git a/Items/Weapons/Melee/CorpusAvertorMelee.cs b/Items/Weapons/Melee/CorpusAvertorMelee.cs index 01a9f3d804..d50d006414 100644 --- a/Items/Weapons/Melee/CorpusAvertorMelee.cs +++ b/Items/Weapons/Melee/CorpusAvertorMelee.cs @@ -6,46 +6,48 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Melee { - public class CorpusAvertorMelee : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Corpus Avertor"); - Tooltip.SetDefault("Seems like it has worn down over time"); - } + public class CorpusAvertorMelee : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Corpus Avertor"); + Tooltip.SetDefault("Seems like it has worn down over time\n" + + "Attacks grant lifesteal based on damage dealt\n" + + "The lower your HP the more damage this weapon does and heals the player on enemy hits"); + } - public override void SetDefaults() - { - item.width = 18; - item.height = 32; - item.damage = 140; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 15; - item.useStyle = 1; - item.useTime = 15; - item.knockBack = 3f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.Calamity().customRarity = CalamityRarity.Dedicated; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 5f; - item.melee = true; - } + public override void SetDefaults() + { + item.width = 18; + item.height = 32; + item.damage = 140; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = 15; + item.useStyle = 1; + item.useTime = 15; + item.knockBack = 3f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + item.Calamity().customRarity = CalamityRarity.Dedicated; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 5f; + item.melee = true; + } - // Gains 20% of missing health as base damage. - public override void ModifyWeaponDamage(Player player, ref float add, ref float mult, ref float flat) - { - int lifeAmount = player.statLifeMax2 - player.statLife; - flat += lifeAmount * 0.2f * player.meleeDamage; - } + // Gains 20% of missing health as base damage. + public override void ModifyWeaponDamage(Player player, ref float add, ref float mult, ref float flat) + { + int lifeAmount = player.statLifeMax2 - player.statLife; + flat += lifeAmount * 0.2f * player.MeleeDamage(); + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + } } diff --git a/Items/Weapons/Melee/CrescentMoon.png b/Items/Weapons/Melee/CrescentMoon.png index f904a47c3e..418d2481fd 100644 Binary files a/Items/Weapons/Melee/CrescentMoon.png and b/Items/Weapons/Melee/CrescentMoon.png differ diff --git a/Items/Weapons/Melee/DraedonsExoblade.cs b/Items/Weapons/Melee/DraedonsExoblade.cs index 4ad61c0518..b09f0ceb06 100644 --- a/Items/Weapons/Melee/DraedonsExoblade.cs +++ b/Items/Weapons/Melee/DraedonsExoblade.cs @@ -11,178 +11,146 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Melee { - public class DraedonsExoblade : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Exoblade"); - Tooltip.SetDefault("Ancient blade of Yharim's weapons and armors expert, Draedon\n" + - "Fires an exo beam that homes in on the player and explodes\n" + - "Striking an enemy with the blade causes several comets to fire\n" + - "All attacks briefly freeze enemies hit\n" + - "Enemies hit at very low HP explode into frost energy and freeze nearby enemies\n" + - "The lower your HP the more damage this blade does and heals the player on enemy hits"); - } + public class DraedonsExoblade : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Exoblade"); + Tooltip.SetDefault("Ancient blade of Yharim's weapons and armors expert, Draedon\n" + + "Fires an exo beam that homes in on the player and explodes\n" + + "Striking an enemy with the blade causes several comets to fire\n" + + "All attacks briefly freeze enemies hit\n" + + "Enemies hit at very low HP explode into frost energy and freeze nearby enemies\n" + + "The lower your HP the more damage this blade does and heals the player on enemy hits"); + } - public override void SetDefaults() - { - item.width = 80; - item.damage = 5000; - item.useAnimation = 14; - item.useStyle = 1; - item.useTime = 14; - item.useTurn = true; - item.melee = true; - item.knockBack = 9f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 114; - item.value = Item.buyPrice(2, 50, 0, 0); - item.rare = 10; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 19f; - item.Calamity().customRarity = CalamityRarity.Violet; - } + public override void SetDefaults() + { + item.width = 80; + item.damage = 5000; + item.useAnimation = 14; + item.useStyle = 1; + item.useTime = 14; + item.useTurn = true; + item.melee = true; + item.knockBack = 9f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 114; + item.value = Item.buyPrice(2, 50, 0, 0); + item.rare = 10; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 19f; + item.Calamity().customRarity = CalamityRarity.Violet; + } - // Gains 100% of missing health as base damage. - public override void ModifyWeaponDamage(Player player, ref float add, ref float mult, ref float flat) - { - int lifeAmount = player.statLifeMax2 - player.statLife; - flat += lifeAmount * player.meleeDamage; - } + // Gains 100% of missing health as base damage. + public override void ModifyWeaponDamage(Player player, ref float add, ref float mult, ref float flat) + { + int lifeAmount = player.statLifeMax2 - player.statLife; + flat += lifeAmount * player.MeleeDamage(); + } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(4)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 107, 0f, 0f, 100, new Color(0, 255, 255)); - } - } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool(4)) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 107, 0f, 0f, 100, new Color(0, 255, 255)); + } + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - if (target.life <= (target.lifeMax * 0.05f)) - { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f)), knockback, Main.myPlayer); - } - target.AddBuff(ModContent.BuffType(), 30); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.Ichor, 120); - Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 88); - float xPos = Main.rand.NextBool(2) ? player.position.X + 800 : player.position.X - 800; - Vector2 vector2 = new Vector2(xPos, player.position.Y + Main.rand.Next(-800, 801)); - float num80 = xPos; - float speedX = (float)target.position.X - vector2.X; - float speedY = (float)target.position.Y - vector2.Y; - float dir = (float)Math.Sqrt((double)(speedX * speedX + speedY * speedY)); - dir = 10 / num80; - speedX *= dir * 150; - speedY *= dir * 150; - if (speedX > 15f) - { - speedX = 15f; - } - if (speedX < -15f) - { - speedX = -15f; - } - if (speedY > 15f) - { - speedY = 15f; - } - if (speedY < -15f) - { - speedY = -15f; - } - if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 8) - { - for (int comet = 0; comet < 2; comet++) - { - float ai1 = Main.rand.NextFloat() + 0.5f; - Projectile.NewProjectile(vector2.X, vector2.Y, speedX, speedY, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f)), knockback, player.whoAmI, 0f, ai1); - } - } - if (target.type == NPCID.TargetDummy || !target.canGhostHeal) - { - return; - } - int healAmount = Main.rand.Next(5) + 5; - player.statLife += healAmount; - player.HealEffect(healAmount); - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + if (target.life <= (target.lifeMax * 0.05f)) + { + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage()), knockback, Main.myPlayer); + } + target.AddBuff(ModContent.BuffType(), 30); + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(BuffID.CursedInferno, 120); + target.AddBuff(BuffID.Frostburn, 120); + target.AddBuff(BuffID.OnFire, 120); + target.AddBuff(BuffID.Ichor, 120); + Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 88); + float xPos = player.position.X + 800 * Main.rand.NextBool(2).ToDirectionInt(); + float yPos = player.position.Y + Main.rand.Next(-800, 801); + Vector2 startPos = new Vector2(xPos, yPos); + Vector2 velocity = target.position - startPos; + float dir = 10 / startPos.X; + velocity.X *= dir * 150; + velocity.Y *= dir * 150; + velocity.X = MathHelper.Clamp(velocity.X, -15f, 15f); + velocity.Y = MathHelper.Clamp(velocity.Y, -15f, 15f); + if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 8) + { + for (int comet = 0; comet < 2; comet++) + { + float ai1 = Main.rand.NextFloat() + 0.5f; + Projectile.NewProjectile(startPos, velocity, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage()), knockback, player.whoAmI, 0f, ai1); + } + } + if (target.type == NPCID.TargetDummy || !target.canGhostHeal) + { + return; + } + int healAmount = Main.rand.Next(5) + 5; + player.statLife += healAmount; + player.HealEffect(healAmount); + } - public override void OnHitPvp(Player player, Player target, int damage, bool crit) - { - if (target.statLife <= (target.statLifeMax2 * 0.05f)) - { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f)), item.knockBack, Main.myPlayer); - } - target.AddBuff(ModContent.BuffType(), 30); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(BuffID.CursedInferno, 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(BuffID.OnFire, 120); - target.AddBuff(BuffID.Ichor, 120); - Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 88); - float xPos = Main.rand.NextBool(2) ? player.position.X + 800 : player.position.X - 800; - Vector2 vector2 = new Vector2(xPos, player.position.Y + Main.rand.Next(-800, 801)); - float num80 = xPos; - float speedX = (float)target.position.X - vector2.X; - float speedY = (float)target.position.Y - vector2.Y; - float dir = (float)Math.Sqrt((double)(speedX * speedX + speedY * speedY)); - dir = 10 / num80; - speedX *= dir * 150; - speedY *= dir * 150; - if (speedX > 15f) - { - speedX = 15f; - } - if (speedX < -15f) - { - speedX = -15f; - } - if (speedY > 15f) - { - speedY = 15f; - } - if (speedY < -15f) - { - speedY = -15f; - } - if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 8) - { - for (int comet = 0; comet < 2; comet++) - { - float ai1 = Main.rand.NextFloat() + 0.5f; - Projectile.NewProjectile(vector2.X, vector2.Y, speedX, speedY, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f)), item.knockBack, player.whoAmI, 0f, ai1); - } - } - int healAmount = Main.rand.Next(5) + 5; - player.statLife += healAmount; - player.HealEffect(healAmount); - } + public override void OnHitPvp(Player player, Player target, int damage, bool crit) + { + if (target.statLife <= (target.statLifeMax2 * 0.05f)) + { + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage()), item.knockBack, Main.myPlayer); + } + target.AddBuff(ModContent.BuffType(), 30); + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(BuffID.CursedInferno, 120); + target.AddBuff(BuffID.Frostburn, 120); + target.AddBuff(BuffID.OnFire, 120); + target.AddBuff(BuffID.Ichor, 120); + Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 88); + float xPos = player.position.X + 800 * Main.rand.NextBool(2).ToDirectionInt(); + float yPos = player.position.Y + Main.rand.Next(-800, 801); + Vector2 startPos = new Vector2(xPos, yPos); + Vector2 velocity = target.position - startPos; + float dir = 10 / startPos.X; + velocity.X *= dir * 150; + velocity.Y *= dir * 150; + velocity.X = MathHelper.Clamp(velocity.X, -15f, 15f); + velocity.Y = MathHelper.Clamp(velocity.Y, -15f, 15f); + if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 8) + { + for (int comet = 0; comet < 2; comet++) + { + float ai1 = Main.rand.NextFloat() + 0.5f; + Projectile.NewProjectile(startPos, velocity, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage()), item.knockBack, player.whoAmI, 0f, ai1); + } + } + int healAmount = Main.rand.Next(5) + 5; + player.statLife += healAmount; + player.HealEffect(healAmount); + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType(), 4); recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/Melee/GalileoGladius.png b/Items/Weapons/Melee/GalileoGladius.png index 221da36309..e86d4d80e8 100644 Binary files a/Items/Weapons/Melee/GalileoGladius.png and b/Items/Weapons/Melee/GalileoGladius.png differ diff --git a/Items/Weapons/Melee/MonstrousKnives.cs b/Items/Weapons/Melee/MonstrousKnives.cs new file mode 100644 index 0000000000..b0f22ac525 --- /dev/null +++ b/Items/Weapons/Melee/MonstrousKnives.cs @@ -0,0 +1,111 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Melee; +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Melee +{ + public class MonstrousKnives : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Monstrous Knives"); + Tooltip.SetDefault("Throws a spread of knives that can heal the user"); + } + + public override void SetDefaults() + { + item.width = 18; + item.damage = 4; + item.melee = true; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = 21; + item.useStyle = 1; + item.useTime = 21; + item.knockBack = 3f; + item.UseSound = SoundID.Item39; + item.autoReuse = true; + item.height = 20; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 2; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 15f; + item.Calamity().customRarity = CalamityRarity.Dedicated; + } + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + float speed = item.shootSpeed; + Vector2 playerPos = player.RotatedRelativePoint(player.MountedCenter, true); + float xDist = Main.mouseX + Main.screenPosition.X - playerPos.X; + float yDist = Main.mouseY + Main.screenPosition.Y - playerPos.Y; + if (player.gravDir == -1f) + { + yDist = Main.screenPosition.Y + Main.screenHeight - Main.mouseY - playerPos.Y; + } + Vector2 vector = new Vector2(xDist, yDist); + float speedMult = vector.Length(); + if ((float.IsNaN(xDist) && float.IsNaN(yDist)) || (xDist == 0f && yDist == 0f)) + { + xDist = player.direction; + yDist = 0f; + speedMult = speed; + } + else + { + speedMult = speed / speedMult; + } + xDist *= speedMult; + yDist *= speedMult; + int knifeAmt = 3; + if (Main.rand.NextBool(2)) + { + knifeAmt++; + } + if (Main.rand.NextBool(4)) + { + knifeAmt++; + } + if (Main.rand.NextBool(8)) + { + knifeAmt++; + } + if (Main.rand.NextBool(16)) + { + knifeAmt++; + } + for (int i = 0; i < knifeAmt; i++) + { + float xVec = xDist; + float yVec = yDist; + float spreadMult = 0.05f * i; + xVec += Main.rand.NextFloat(-25f, 25f) * spreadMult; + yVec += Main.rand.NextFloat(-25f, 25f) * spreadMult; + Vector2 directionToShoot = new Vector2(xVec, yVec); + speedMult = directionToShoot.Length(); + speedMult = speed / speedMult; + xVec *= speedMult; + yVec *= speedMult; + directionToShoot = new Vector2(xVec, yVec); + Projectile.NewProjectile(playerPos, directionToShoot, type, damage, knockBack, player.whoAmI, 0f, 0f); + } + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.ThrowingKnife, 200); + recipe.AddIngredient(ItemID.LifeCrystal); + recipe.AddIngredient(ItemID.LesserHealingPotion, 5); //I considered making a recipe group for any healing potion but Merchant sells these + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Melee/MonstrousKnives.png b/Items/Weapons/Melee/MonstrousKnives.png new file mode 100644 index 0000000000..cce1236fb9 Binary files /dev/null and b/Items/Weapons/Melee/MonstrousKnives.png differ diff --git a/Items/Weapons/Melee/PlagueKeeper.cs b/Items/Weapons/Melee/PlagueKeeper.cs index 2711496b07..7e15c95487 100644 --- a/Items/Weapons/Melee/PlagueKeeper.cs +++ b/Items/Weapons/Melee/PlagueKeeper.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; using Terraria; using Terraria.ID; @@ -40,6 +41,7 @@ namespace CalamityMod.Items.Weapons.Melee recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ItemID.BeeKeeper); recipe.AddIngredient(ItemID.FragmentSolar, 10); + recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddIngredient(ItemID.LunarBar, 5); recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); @@ -52,7 +54,7 @@ namespace CalamityMod.Items.Weapons.Melee for (int i = 0; i < 3; i++) { int bee = Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, player.beeType(), - player.beeDamage((int)(item.damage * (player.allDamage + player.meleeDamage - 1f)) / 3), player.beeKB(0f), player.whoAmI, 0f, 0f); + player.beeDamage((int)(item.damage * player.MeleeDamage()) / 3), player.beeKB(0f), player.whoAmI, 0f, 0f); Main.projectile[bee].penetrate = 1; Main.projectile[bee].Calamity().forceMelee = true; } @@ -64,7 +66,7 @@ namespace CalamityMod.Items.Weapons.Melee for (int i = 0; i < 3; i++) { int bee = Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, player.beeType(), - player.beeDamage((int)(item.damage * (player.allDamage + player.meleeDamage - 1f)) / 3), player.beeKB(0f), player.whoAmI, 0f, 0f); + player.beeDamage((int)(item.damage * player.MeleeDamage()) / 3), player.beeKB(0f), player.whoAmI, 0f, 0f); Main.projectile[bee].penetrate = 1; Main.projectile[bee].Calamity().forceMelee = true; } diff --git a/Items/Weapons/Melee/PrismaticBreaker.cs b/Items/Weapons/Melee/PrismaticBreaker.cs new file mode 100644 index 0000000000..63586c1f30 --- /dev/null +++ b/Items/Weapons/Melee/PrismaticBreaker.cs @@ -0,0 +1,173 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Projectiles.Melee; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System.Collections.Generic; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Melee +{ + public class PrismaticBreaker : ModItem + { + private int alpha = 50; + public Color[] colors = new Color[] + { + new Color(255, 0, 0, 50), //Red + new Color(255, 128, 0, 50), //Orange + new Color(255, 255, 0, 50), //Yellow + new Color(128, 255, 0, 50), //Lime + new Color(0, 255, 0, 50), //Green + new Color(0, 255, 128, 50), //Turquoise + new Color(0, 255, 255, 50), //Cyan + new Color(0, 128, 255, 50), //Light Blue + new Color(0, 0, 255, 50), //Blue + new Color(128, 0, 255, 50), //Purple + new Color(255, 0, 255, 50), //Fuschia + new Color(255, 0, 128, 50) //Hot Pink + }; + List colorSet = new List() + { + new Color(255, 0, 0, 50), //Red + new Color(255, 255, 0, 50), //Yellow + new Color(0, 255, 0, 50), //Green + new Color(0, 255, 255, 50), //Cyan + new Color(0, 0, 255, 50), //Blue + new Color(255, 0, 255, 50), //Fuschia + }; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Prismatic Breaker"); + Tooltip.SetDefault("Seems to belong to a certain magical girl. Radiates with intense cosmic energy.\n" + + "Fire to charge for a powerful rainbow laser\n" + + "Right click to instead swing the sword and fire rainbow colored waves\n" + + "The sword is boosted by both melee and ranged damage"); + Item.staff[item.type] = true; + } + + public override void SetDefaults() + { + item.damage = 400; + item.crit += 8; + item.useAnimation = 15; + item.useStyle = 1; + item.useTime = 15; + item.useTurn = true; + item.melee = true; + item.knockBack = 7f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.width = 50; + item.height = 50; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 14f; + item.value = CalamityGlobalItem.Rarity14BuyPrice; + item.rare = 10; + item.Calamity().customRarity = CalamityRarity.Dedicated; + } + + //Cancel out normal melee damage boosts and replace it with the average of melee and ranged damage boosts + //all damage boosts should still apply + public override void ModifyWeaponDamage(Player player, ref float add, ref float mult, ref float flat) + { + float damageMult = (player.meleeDamage + player.rangedDamage - 2f) / 2f; + add += damageMult - player.meleeDamage + 1f; + } + + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + //item.width and then item.height - 2f + Vector2 origin = new Vector2(25f, 23f); + spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Items/Weapons/Melee/PrismaticBreakerGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); + } + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (player.altFunctionUse == 2) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage * 2, knockBack, player.whoAmI, 0f, 0f); + } + else + { + Projectile.NewProjectile(position.X, position.Y, speedX * 0.5f, speedY * 0.5f, type, damage, knockBack, player.whoAmI, 0f, 0f); + } + return false; + } + + public override bool AltFunctionUse(Player player) => true; + + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == 2) + { + item.UseSound = SoundID.Item1; + item.useStyle = 1; + item.useTurn = true; + item.autoReuse = true; + item.noMelee = false; + item.channel = false; + } + else + { + item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/CrystylCharge"); + item.useStyle = 5; + item.useTurn = false; + item.autoReuse = false; + item.noMelee = true; + item.channel = true; + } + return base.CanUseItem(player); + } + + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool(4)) + { + Dust rainbow = Main.dust[Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 267, 0f, 0f, alpha, Main.rand.Next(colors), 0.8f)]; + rainbow.noGravity = true; + } + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(BuffID.CursedInferno, 120); + target.AddBuff(BuffID.Frostburn, 120); + target.AddBuff(BuffID.OnFire, 120); + target.AddBuff(BuffID.Ichor, 120); + } + + public override void OnHitPvp(Player player, Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(BuffID.CursedInferno, 120); + target.AddBuff(BuffID.Frostburn, 120); + target.AddBuff(BuffID.OnFire, 120); + target.AddBuff(BuffID.Ichor, 120); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType(), 3); + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddTile(ModContent.TileType()); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Melee/PrismaticBreaker.png b/Items/Weapons/Melee/PrismaticBreaker.png new file mode 100644 index 0000000000..a70cc95ca5 Binary files /dev/null and b/Items/Weapons/Melee/PrismaticBreaker.png differ diff --git a/Items/Weapons/Melee/PrismaticBreakerGlow.png b/Items/Weapons/Melee/PrismaticBreakerGlow.png new file mode 100644 index 0000000000..2defec7094 Binary files /dev/null and b/Items/Weapons/Melee/PrismaticBreakerGlow.png differ diff --git a/Items/Weapons/Melee/TenebreusTides.cs b/Items/Weapons/Melee/TenebreusTides.cs new file mode 100644 index 0000000000..4aa3fc0331 --- /dev/null +++ b/Items/Weapons/Melee/TenebreusTides.cs @@ -0,0 +1,57 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Projectiles.Melee.Spears; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Melee +{ + public class TenebreusTides : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Tenebreus Tides"); + Tooltip.SetDefault("Inundatio ex Laminis\n" + + "Shoots a water spear that pierces enemies and terrain\n" + + "Striking enemies summon liquid blades and spears to assault the struck foe"); + } + + public override void SetDefaults() + { + item.damage = 75; + item.knockBack = 4.5f; + item.melee = true; + item.useAnimation = item.useTime = 15; + item.autoReuse = true; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 12f; + + item.width = item.height = 72; + item.useStyle = 5; + item.UseSound = SoundID.Item1; + item.noMelee = true; + item.useTurn = true; + item.noUseGraphic = true; + item.value = CalamityGlobalItem.Rarity9BuyPrice; + item.rare = 9; + item.Calamity().customRarity = CalamityRarity.Dedicated; + } + + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ItemID.InfluxWaver); + recipe.AddIngredient(ModContent.ItemType(), 25); + recipe.AddIngredient(ModContent.ItemType(), 50); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Melee/TenebreusTides.png b/Items/Weapons/Melee/TenebreusTides.png new file mode 100644 index 0000000000..6b5fac2a7a Binary files /dev/null and b/Items/Weapons/Melee/TenebreusTides.png differ diff --git a/Items/Weapons/Melee/TyphonsGreed.png b/Items/Weapons/Melee/TyphonsGreed.png index c9eda2e22e..20460e6eeb 100644 Binary files a/Items/Weapons/Melee/TyphonsGreed.png and b/Items/Weapons/Melee/TyphonsGreed.png differ diff --git a/Items/Weapons/Ranged/AuroraBlazer.cs b/Items/Weapons/Ranged/AuroraBlazer.cs new file mode 100644 index 0000000000..3364382d01 --- /dev/null +++ b/Items/Weapons/Ranged/AuroraBlazer.cs @@ -0,0 +1,59 @@ +using CalamityMod.Projectiles.Ranged; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Ranged +{ + public class AuroraBlazer : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aurora Blazer"); + Tooltip.SetDefault("Spews astral flames that travel in a star-shaped patterns\n" + + "60% chance to not consume gel"); + } + + public override void SetDefaults() + { + item.damage = 101; + item.ranged = true; + item.useTime = 15; + item.useAnimation = 15; + item.knockBack = 2f; + item.autoReuse = true; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 7.5f; + item.useAmmo = AmmoID.Gel; + + item.width = 68; + item.height = 36; + item.useStyle = 5; + item.noMelee = true; + item.UseSound = SoundID.Item34; + item.value = CalamityGlobalItem.Rarity7BuyPrice; + item.rare = 7; + } + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + float SpeedX = speedX + Main.rand.NextFloat(-15f, 15f) * 0.05f; + float SpeedY = speedY + Main.rand.NextFloat(-15f, 15f) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, Main.rand.Next(4, 11), 0f); + return false; + } + + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Texture2D glowmask = ModContent.GetTexture("CalamityMod/Items/Weapons/Ranged/AuroraBlazerGlow"); + Vector2 origin = new Vector2(glowmask.Width / 2f, glowmask.Height / 2f - 2f); + spriteBatch.Draw(glowmask, item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); + } + + public override Vector2? HoldoutOffset() => new Vector2(-10, 0); + + public override bool ConsumeAmmo(Player player) => Main.rand.Next(100) >= 60; + } +} diff --git a/Items/Weapons/Ranged/AuroraBlazer.png b/Items/Weapons/Ranged/AuroraBlazer.png new file mode 100644 index 0000000000..567a768453 Binary files /dev/null and b/Items/Weapons/Ranged/AuroraBlazer.png differ diff --git a/Items/Weapons/Ranged/AuroraBlazerGlow.png b/Items/Weapons/Ranged/AuroraBlazerGlow.png new file mode 100644 index 0000000000..91533ab0b1 Binary files /dev/null and b/Items/Weapons/Ranged/AuroraBlazerGlow.png differ diff --git a/Items/Weapons/Ranged/ClockGatlignum.cs b/Items/Weapons/Ranged/ClockGatlignum.cs index 3963e48f50..f90ac552cd 100644 --- a/Items/Weapons/Ranged/ClockGatlignum.cs +++ b/Items/Weapons/Ranged/ClockGatlignum.cs @@ -36,10 +36,7 @@ namespace CalamityMod.Items.Weapons.Ranged item.useAmmo = 97; } - public override Vector2? HoldoutOffset() - { - return new Vector2(-5, 0); - } + public override Vector2? HoldoutOffset() => new Vector2(-5, 0); public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { diff --git a/Items/Weapons/Ranged/CosmicBolter.cs b/Items/Weapons/Ranged/CosmicBolter.cs index 1a3ebea417..ac01336e13 100644 --- a/Items/Weapons/Ranged/CosmicBolter.cs +++ b/Items/Weapons/Ranged/CosmicBolter.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Cosmic Bolter"); - Tooltip.SetDefault("Fires three bouncing energy bolts"); + Tooltip.SetDefault("Fires three sliding energy bolts"); } public override void SetDefaults() @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Ranged item.autoReuse = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 10f; - item.useAmmo = 40; + item.useAmmo = AmmoID.Arrow; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Ranged/HalleysInferno.png b/Items/Weapons/Ranged/HalleysInferno.png index 8a597c848e..8888f3609e 100644 Binary files a/Items/Weapons/Ranged/HalleysInferno.png and b/Items/Weapons/Ranged/HalleysInferno.png differ diff --git a/Items/Weapons/Ranged/LunarianBow.cs b/Items/Weapons/Ranged/LunarianBow.cs index c3a64439e6..357d639795 100644 --- a/Items/Weapons/Ranged/LunarianBow.cs +++ b/Items/Weapons/Ranged/LunarianBow.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Lunarian Bow"); - Tooltip.SetDefault("Fires two bouncing energy bolts"); + Tooltip.SetDefault("Fires two sliding energy bolts"); } public override void SetDefaults() diff --git a/Items/Weapons/Ranged/MarksmanBow.cs b/Items/Weapons/Ranged/MarksmanBow.cs new file mode 100644 index 0000000000..15b6356c1a --- /dev/null +++ b/Items/Weapons/Ranged/MarksmanBow.cs @@ -0,0 +1,72 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Ranged +{ + public class MarksmanBow : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Marksman Bow"); + Tooltip.SetDefault("Fires three arrows at a time\n" + + "Wooden arrows are converted into Jester's arrows"); + } + + public override void SetDefaults() + { + item.damage = 32; + item.ranged = true; + item.crit += 20; + item.width = 36; + item.height = 110; + item.useTime = 18; + item.useAnimation = 18; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 6f; + item.UseSound = SoundID.Item5; + item.autoReuse = true; + item.shoot = ProjectileID.JestersArrow; + item.shootSpeed = 10f; + item.useAmmo = AmmoID.Arrow; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + item.Calamity().customRarity = CalamityRarity.Dedicated; + } + + public override Vector2? HoldoutOffset() => new Vector2(-4, 0); + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + //Convert wooden arrows to Jester's Arrows + if (type == ProjectileID.WoodenArrowFriendly) + type = ProjectileID.JestersArrow; + + for (int i = 0; i < 3; i++) + { + float SpeedX = speedX + Main.rand.NextFloat(-10f, 10f) * 0.05f; + float SpeedY = speedY + Main.rand.NextFloat(-10f, 10f) * 0.05f; + int arrow = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[arrow].noDropItem = true; + Main.projectile[arrow].extraUpdates += Main.rand.Next(3); //0 to 2 extra updates + if (type == ProjectileID.JestersArrow) + { + Main.projectile[arrow].localNPCHitCooldown = 10; + Main.projectile[arrow].usesLocalNPCImmunity = true; + } + } + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Ectoplasm, 31); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Ranged/MarksmanBow.png b/Items/Weapons/Ranged/MarksmanBow.png new file mode 100644 index 0000000000..d29862cf6a Binary files /dev/null and b/Items/Weapons/Ranged/MarksmanBow.png differ diff --git a/Items/Weapons/Ranged/Megalodon.png b/Items/Weapons/Ranged/Megalodon.png index 483e468810..85bd1f10b9 100644 Binary files a/Items/Weapons/Ranged/Megalodon.png and b/Items/Weapons/Ranged/Megalodon.png differ diff --git a/Items/Weapons/Ranged/P90.png b/Items/Weapons/Ranged/P90.png index 1235a193a8..317a9342bf 100644 Binary files a/Items/Weapons/Ranged/P90.png and b/Items/Weapons/Ranged/P90.png differ diff --git a/Items/Weapons/Ranged/PrideHuntersPlanarRipper.cs b/Items/Weapons/Ranged/PrideHuntersPlanarRipper.cs index b10c199a69..80f27431fd 100644 --- a/Items/Weapons/Ranged/PrideHuntersPlanarRipper.cs +++ b/Items/Weapons/Ranged/PrideHuntersPlanarRipper.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Ranged item.useStyle = 5; item.noMelee = true; item.knockBack = 1f; - item.value = Item.buyPrice(1, 20, 0, 0); + item.value = CalamityGlobalItem.Rarity12BuyPrice; item.rare = 10; item.Calamity().customRarity = CalamityRarity.Dedicated; item.UseSound = SoundID.Item11; diff --git a/Items/Weapons/Ranged/Pumpler.cs b/Items/Weapons/Ranged/Pumpler.cs index a44e6dca1b..365f92a458 100644 --- a/Items/Weapons/Ranged/Pumpler.cs +++ b/Items/Weapons/Ranged/Pumpler.cs @@ -18,8 +18,8 @@ namespace CalamityMod.Items.Weapons.Ranged { item.damage = 8; item.ranged = true; - item.width = 50; - item.height = 28; + item.width = 62; + item.height = 36; item.useTime = 10; item.useAnimation = 10; item.useStyle = 5; diff --git a/Items/Weapons/Ranged/Pumpler.png b/Items/Weapons/Ranged/Pumpler.png index a679090014..d7e4bca8fb 100644 Binary files a/Items/Weapons/Ranged/Pumpler.png and b/Items/Weapons/Ranged/Pumpler.png differ diff --git a/Items/Weapons/Ranged/RubicoPrime.cs b/Items/Weapons/Ranged/RubicoPrime.cs new file mode 100644 index 0000000000..e444d39168 --- /dev/null +++ b/Items/Weapons/Ranged/RubicoPrime.cs @@ -0,0 +1,64 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Ranged; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Ranged +{ + public class RubicoPrime : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Rubico Prime"); + Tooltip.SetDefault("Semi-automatic sniper that fires in 5 second bursts\n" + + "Fires impact rounds that have an increased crit multiplier and deal bonus damage to inorganic targets"); + //would do less to organic targets if like this wasn't meant to be used against yharon lole + } + + public override void SetDefaults() + { + item.damage = 5600; + item.ranged = true; + item.crit += 40; + item.knockBack = 10f; + item.useTime = 30; + item.useAnimation = 300; + item.autoReuse = false; + + item.useStyle = 5; + item.noMelee = true; + item.width = 82; + item.height = 28; + + item.shoot = 10; + item.shootSpeed = 12f; + item.useAmmo = AmmoID.Bullet; + + item.value = CalamityGlobalItem.Rarity15BuyPrice; + item.rare = 10; + item.Calamity().customRarity = CalamityRarity.Dedicated; + } + + public override Vector2? HoldoutOffset() => new Vector2(-10, 0); + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddTile(ModContent.TileType()); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + } +} diff --git a/Items/Weapons/Ranged/RubicoPrime.png b/Items/Weapons/Ranged/RubicoPrime.png new file mode 100644 index 0000000000..d09feb26a6 Binary files /dev/null and b/Items/Weapons/Ranged/RubicoPrime.png differ diff --git a/Items/Weapons/Ranged/TyrannysEnd.cs b/Items/Weapons/Ranged/TyrannysEnd.cs new file mode 100644 index 0000000000..501414bdd9 --- /dev/null +++ b/Items/Weapons/Ranged/TyrannysEnd.cs @@ -0,0 +1,64 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Ranged; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Ranged +{ + public class TyrannysEnd : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Tyranny's End"); + Tooltip.SetDefault("Pierce the heart of even the most heavily-armored foe\n" + + "Fires a .70 caliber sniper round that bypasses enemy defense and DR\n" + + "Rounds mark enemies for death and summon a swarm of additional bullets on crits"); + } + + public override void SetDefaults() + { + item.damage = 4000; + item.crit += 35; + item.knockBack = 9.5f; + item.ranged = true; + item.useTime = 55; + item.useAnimation = 55; + item.shoot = ProjectileID.BulletHighVelocity; + item.shootSpeed = 12f; + item.useAmmo = AmmoID.Bullet; + item.autoReuse = true; + + item.width = 94; + item.height = 32; + item.useStyle = 5; + item.noMelee = true; + item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LargeWeaponFire"); + item.value = CalamityGlobalItem.Rarity15BuyPrice; + item.rare = 10; + item.Calamity().customRarity = CalamityRarity.Dedicated; + } + + public override Vector2? HoldoutOffset() => new Vector2(-10, 0); + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType(), 4); + recipe.AddTile(ModContent.TileType()); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + } +} diff --git a/Items/Weapons/Ranged/TyrannysEnd.png b/Items/Weapons/Ranged/TyrannysEnd.png new file mode 100644 index 0000000000..557bea8b22 Binary files /dev/null and b/Items/Weapons/Ranged/TyrannysEnd.png differ diff --git a/Items/Weapons/Rogue/AdamantiteThrowingAxe.cs b/Items/Weapons/Rogue/AdamantiteThrowingAxe.cs index cdaede6260..0d6c75b87d 100644 --- a/Items/Weapons/Rogue/AdamantiteThrowingAxe.cs +++ b/Items/Weapons/Rogue/AdamantiteThrowingAxe.cs @@ -1,4 +1,6 @@ using CalamityMod.Projectiles.Rogue; +using Microsoft.Xna.Framework; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue @@ -8,6 +10,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Adamantite Throwing Axe"); + Tooltip.SetDefault("Stealth strikes summon lightning bolts on enemy hits"); } public override void SafeSetDefaults() @@ -32,6 +35,18 @@ namespace CalamityMod.Items.Weapons.Rogue 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) + { + if (player.Calamity().StealthStrikeAvailable()) + { + int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[stealth].Calamity().stealthStrike = true; + Main.projectile[stealth].usesLocalNPCImmunity = true; + return false; + } + return true; + } + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); diff --git a/Items/Weapons/Rogue/Apoctolith.cs b/Items/Weapons/Rogue/Apoctolith.cs new file mode 100644 index 0000000000..776dfbb294 --- /dev/null +++ b/Items/Weapons/Rogue/Apoctolith.cs @@ -0,0 +1,72 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables; +using CalamityMod.Projectiles.Rogue; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Rogue +{ + public class Apoctolith : RogueWeapon + { + public override void SetStaticDefaults() + { + Tooltip.SetDefault("Maybe catching bricks with your face isn't such a hot idea...\n" + + "Critical hits tear away enemy defense\n" + + "Stealth strikes shatter and briefly stun enemies"); + DisplayName.SetDefault("Apoctolith"); + } + + public override void SafeSetDefaults() + { + item.damage = 100; + item.shootSpeed = 15f; + item.shoot = ModContent.ProjectileType(); + item.width = 66; + item.height = 64; + item.useTime = 25; + item.useAnimation = 25; + item.useStyle = 1; + item.knockBack = 10f; + item.crit = 20; + item.value = CalamityGlobalItem.Rarity7BuyPrice; + item.rare = 7; + item.UseSound = SoundID.Item1; + item.noMelee = true; + item.noUseGraphic = true; + item.Calamity().rogue = true; + item.autoReuse = 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) + { + //Check if stealth is full + if (player.Calamity().StealthStrikeAvailable()) + { + int p = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + Main.projectile[p].Calamity().stealthStrike = true; + return false; + } + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 100); + recipe.AddIngredient(ModContent.ItemType(), 20); + recipe.AddIngredient(ModContent.ItemType(), 8); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Vector2 origin = new Vector2(item.width / 2f, item.height / 2f - 2f); + spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Items/Weapons/Rogue/ApoctolithGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); + } + } +} diff --git a/Items/Weapons/Rogue/Apoctolith.png b/Items/Weapons/Rogue/Apoctolith.png new file mode 100644 index 0000000000..8bb4754fdf Binary files /dev/null and b/Items/Weapons/Rogue/Apoctolith.png differ diff --git a/Items/Weapons/Rogue/ApoctolithGlow.png b/Items/Weapons/Rogue/ApoctolithGlow.png new file mode 100644 index 0000000000..222f7e5e6b Binary files /dev/null and b/Items/Weapons/Rogue/ApoctolithGlow.png differ diff --git a/Items/Weapons/Rogue/AuroradicalThrow.cs b/Items/Weapons/Rogue/AuroradicalThrow.cs new file mode 100644 index 0000000000..93098fceea --- /dev/null +++ b/Items/Weapons/Rogue/AuroradicalThrow.cs @@ -0,0 +1,54 @@ +using CalamityMod.Projectiles.Rogue; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Rogue +{ + public class AuroradicalThrow : RogueWeapon + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Auroradical Throw"); + Tooltip.SetDefault("Launches a star that splits after a short period of time\n" + + "Split stars home in on nearby enemies after a few seconds\n" + + "Stealth strikes summon a meteor upon enemy impact"); + } + + public override void SafeSetDefaults() + { + item.width = 34; + item.height = 58; + item.damage = 32; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = 30; + item.useStyle = 1; + item.useTime = 30; + item.knockBack = 6f; + item.UseSound = SoundID.Item117; + item.autoReuse = true; + item.value = Item.buyPrice(0, 60, 0, 0); + item.rare = 7; + 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) + { + int star = Projectile.NewProjectile(player.Center, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[star].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + return false; + } + + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Texture2D glowmask = Main.itemTexture[item.type]; + Vector2 origin = new Vector2(glowmask.Width / 2f, glowmask.Height / 2f - 2f); + spriteBatch.Draw(glowmask, item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); + } + } +} diff --git a/Items/Weapons/Rogue/AuroradicalThrow.png b/Items/Weapons/Rogue/AuroradicalThrow.png new file mode 100644 index 0000000000..d602928d2f Binary files /dev/null and b/Items/Weapons/Rogue/AuroradicalThrow.png differ diff --git a/Items/Weapons/Rogue/BrackishFlask.cs b/Items/Weapons/Rogue/BrackishFlask.cs index 0d96808f74..2ac0c49937 100644 --- a/Items/Weapons/Rogue/BrackishFlask.cs +++ b/Items/Weapons/Rogue/BrackishFlask.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,7 +12,8 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Brackish Flask"); - Tooltip.SetDefault("Explodes into poisonous seawater blasts"); + Tooltip.SetDefault("Explodes into poisonous seawater blasts\n" + + "Stealth strikes summon a brackish spear spike"); } public override void SafeSetDefaults() @@ -33,5 +35,16 @@ namespace CalamityMod.Items.Weapons.Rogue item.shootSpeed = 12f; item.Calamity().rogue = true; } + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike + { + int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[stealth].Calamity().stealthStrike = true; + return false; + } + return true; + } } } diff --git a/Items/Weapons/Rogue/Brimblade.cs b/Items/Weapons/Rogue/Brimblade.cs index 3da0a21a42..3c0f1faf82 100644 --- a/Items/Weapons/Rogue/Brimblade.cs +++ b/Items/Weapons/Rogue/Brimblade.cs @@ -1,5 +1,8 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Magic; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,7 +14,8 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Brimblade"); - Tooltip.SetDefault("Throws a blade that splits on enemy hits"); + Tooltip.SetDefault("Throws a blade that splits on enemy hits\n" + + "Stealth strikes split further and cause the player to launch a barrage of brimstone darts"); } public override void SafeSetDefaults() @@ -34,6 +38,24 @@ namespace CalamityMod.Items.Weapons.Rogue 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) + { + if (player.Calamity().StealthStrikeAvailable()) + { + int blade = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[blade].Calamity().stealthStrike = true; + + for (int i = -6; i <= 6; i += 4) + { + Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.ToRadians(i)); + int dart = Projectile.NewProjectile(position, perturbedSpeed, ModContent.ProjectileType(), damage / 2, knockBack * 0.5f, player.whoAmI, 0f, 0f); + Main.projectile[dart].Calamity().forceRogue = true; + } + return false; + } + return true; + } + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); diff --git a/Items/Weapons/Rogue/CobaltKunai.cs b/Items/Weapons/Rogue/CobaltKunai.cs index a685780b62..f7d71dc102 100644 --- a/Items/Weapons/Rogue/CobaltKunai.cs +++ b/Items/Weapons/Rogue/CobaltKunai.cs @@ -1,4 +1,6 @@ using CalamityMod.Projectiles.Rogue; +using Microsoft.Xna.Framework; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue @@ -8,6 +10,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Cobalt Kunai"); + Tooltip.SetDefault("Stealth strikes fire three homing cobalt energy bolts"); } public override void SafeSetDefaults() @@ -32,6 +35,20 @@ namespace CalamityMod.Items.Weapons.Rogue 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) + { + if (player.Calamity().StealthStrikeAvailable()) + { + for (int i = -6; i <= 6; i += 6) + { + Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.ToRadians(i)); + Projectile.NewProjectile(position.X, position.Y, perturbedSpeed.X, perturbedSpeed.Y, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + } + return false; + } + return true; + } + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); diff --git a/Items/Weapons/Rogue/CorpusAvertor.cs b/Items/Weapons/Rogue/CorpusAvertor.cs index 755992626d..74e7573bc9 100644 --- a/Items/Weapons/Rogue/CorpusAvertor.cs +++ b/Items/Weapons/Rogue/CorpusAvertor.cs @@ -6,46 +6,48 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class CorpusAvertor : RogueWeapon - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Corpus Avertor"); - Tooltip.SetDefault("Seems like it has worn down over time"); - } + public class CorpusAvertor : RogueWeapon + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Corpus Avertor"); + Tooltip.SetDefault("Seems like it has worn down over time\n" + + "Attacks grant lifesteal based on damage dealt\n" + + "The lower your HP the more damage this weapon does and heals the player on enemy hits"); + } - public override void SafeSetDefaults() - { - item.width = 18; - item.height = 32; - item.damage = 140; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 15; - item.useStyle = 1; - item.useTime = 15; - item.knockBack = 3f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.Calamity().customRarity = CalamityRarity.Dedicated; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 5f; - item.Calamity().rogue = true; - } + public override void SafeSetDefaults() + { + item.width = 18; + item.height = 32; + item.damage = 140; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = 15; + item.useStyle = 1; + item.useTime = 15; + item.knockBack = 3f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + item.Calamity().customRarity = CalamityRarity.Dedicated; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 5f; + item.Calamity().rogue = true; + } - // Gains 20% of missing health as base damage. - public override void ModifyWeaponDamage(Player player, ref float add, ref float mult, ref float flat) - { - int lifeAmount = player.statLifeMax2 - player.statLife; - flat += lifeAmount * 0.2f * player.Calamity().throwingDamage; - } + // Gains 20% of missing health as base damage. + public override void ModifyWeaponDamage(Player player, ref float add, ref float mult, ref float flat) + { + int lifeAmount = player.statLifeMax2 - player.statLife; + flat += lifeAmount * 0.2f * player.RogueDamage(); + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 1f); - return false; - } - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 1f); + return false; + } + } } diff --git a/Items/Weapons/Rogue/CraniumSmasher.cs b/Items/Weapons/Rogue/CraniumSmasher.cs index 9b22d9522f..fa34c83b75 100644 --- a/Items/Weapons/Rogue/CraniumSmasher.cs +++ b/Items/Weapons/Rogue/CraniumSmasher.cs @@ -6,47 +6,53 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class CraniumSmasher : RogueWeapon - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cranium Smasher"); - Tooltip.SetDefault("Throws disks that roll on the ground, occasionally launches an explosive disk"); - } + public class CraniumSmasher : RogueWeapon + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cranium Smasher"); + Tooltip.SetDefault("Throws disks that roll on the ground, occasionally launches an explosive disk\n" + + "Stealth strikes launch an explosive disk that can pierce several enemies"); + } - public override void SafeSetDefaults() - { - item.width = 50; - item.height = 50; - item.damage = 140; - item.noMelee = true; - item.noUseGraphic = true; - item.autoReuse = true; - item.useAnimation = 15; - item.useStyle = 1; - item.useTime = 15; - item.knockBack = 4f; - item.UseSound = SoundID.Item1; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 20f; - item.Calamity().rogue = true; - } + public override void SafeSetDefaults() + { + item.width = 50; + item.height = 50; + item.damage = 140; + item.noMelee = true; + item.noUseGraphic = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useStyle = 1; + item.useTime = 15; + item.knockBack = 4f; + item.UseSound = SoundID.Item1; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 20f; + 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) - { - if (Main.rand.Next(0, 5) == 0) - { - damage = (int)(damage * 1.25f); - type = ModContent.ProjectileType(); - } - else - { - type = ModContent.ProjectileType(); - } - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - return false; - } - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (player.Calamity().StealthStrikeAvailable()) + { + type = ModContent.ProjectileType(); + } + else if (Main.rand.NextBool(5)) + { + damage = (int)(damage * 1.25f); + type = ModContent.ProjectileType(); + } + else + { + type = ModContent.ProjectileType(); + } + int proj = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + return false; + } + } } diff --git a/Items/Weapons/Rogue/DuststormInABottle.cs b/Items/Weapons/Rogue/DuststormInABottle.cs index c7a52dbe78..9c5cbb4799 100644 --- a/Items/Weapons/Rogue/DuststormInABottle.cs +++ b/Items/Weapons/Rogue/DuststormInABottle.cs @@ -1,48 +1,61 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class DuststormInABottle : RogueWeapon - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Duststorm in a Bottle"); - Tooltip.SetDefault("Explodes into a dust cloud"); - } + public class DuststormInABottle : RogueWeapon + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Duststorm in a Bottle"); + Tooltip.SetDefault("Explodes into a dust cloud\n" + + "Stealth strikes form a more intense and longer lasting dust cloud"); + } - public override void SafeSetDefaults() - { - item.width = 20; - item.damage = 47; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 25; - item.useStyle = 1; - item.useTime = 25; - item.knockBack = 5f; - item.UseSound = SoundID.Item106; - item.autoReuse = true; - item.height = 24; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; - item.Calamity().rogue = true; - } + public override void SafeSetDefaults() + { + item.width = 20; + item.damage = 47; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = 25; + item.useStyle = 1; + item.useTime = 25; + item.knockBack = 5f; + item.UseSound = SoundID.Item106; + item.autoReuse = true; + item.height = 24; + item.value = Item.buyPrice(0, 60, 0, 0); + item.rare = 7; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 12f; + item.Calamity().rogue = true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.HolyWater, 20); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.SandstorminaBottle); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (player.Calamity().StealthStrikeAvailable()) + { + int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[stealth].Calamity().stealthStrike = true; + return false; + } + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.HolyWater, 20); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ItemID.SandstorminaBottle); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/Rogue/FinalDawn.cs b/Items/Weapons/Rogue/FinalDawn.cs new file mode 100644 index 0000000000..9911cfcbbf --- /dev/null +++ b/Items/Weapons/Rogue/FinalDawn.cs @@ -0,0 +1,46 @@ +using CalamityMod.Projectiles.Rogue; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Items.Weapons.Rogue +{ + public class FinalDawn : RogueWeapon + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Final Dawn"); + Tooltip.SetDefault("We shall ride into the sunrise once more\n" + + "Attack enemies with a giant scythe swing to replenish stealth\n" + + "Press up and attack to throw the scythe \n" + + "Stealth strikes perform a vertical swing that leaves a lingering fire aura\n" + + "Stealth strikes performed while pressing up fling yourself at the enemy and slice through them, causing homing fireballs to emerge"); + } + public override void SafeSetDefaults() + { + item.damage = 5000; + item.Calamity().rogue = true; + item.width = 78; + item.height = 66; + item.noMelee = true; + item.useTime = item.useAnimation = 15; + item.useStyle = ItemUseStyleID.SwingThrow; + item.knockBack = 4; + item.rare = 10; + item.Calamity().customRarity = CalamityRarity.Dedicated; + item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; + item.autoReuse = false; + item.shoot = ProjectileType(); + item.shootSpeed = 1f; + item.useTurn = false; + item.channel = true; + item.noUseGraphic = true; + } + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] + + player.ownedProjectileCounts[ProjectileType()] + + player.ownedProjectileCounts[ProjectileType()] + + player.ownedProjectileCounts[ProjectileType()] + + player.ownedProjectileCounts[ProjectileType()] <= 0; + } +} \ No newline at end of file diff --git a/Items/Weapons/Rogue/FinalDawn.png b/Items/Weapons/Rogue/FinalDawn.png new file mode 100644 index 0000000000..e5cbf9feb9 Binary files /dev/null and b/Items/Weapons/Rogue/FinalDawn.png differ diff --git a/Items/Weapons/Rogue/FrostyFlare.cs b/Items/Weapons/Rogue/FrostyFlare.cs index 1a2a81f845..3ab0ab8e20 100644 --- a/Items/Weapons/Rogue/FrostyFlare.cs +++ b/Items/Weapons/Rogue/FrostyFlare.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Rogue; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,8 +11,10 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Frosty Flare"); - Tooltip.SetDefault("Sticks to enemies\n" + - "Generates a localized hailstorm\n'Do not insert in flare gun'"); + Tooltip.SetDefault("Do not insert in flare gun\n" + + "Sticks to enemies\n" + + "Generates a localized hailstorm\n" + + "Stealth strikes trail snowflakes and summon phantom copies instead of ice shards"); } public override void SafeSetDefaults() @@ -36,5 +39,16 @@ namespace CalamityMod.Items.Weapons.Rogue item.consumable = true; 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) + { + if (player.Calamity().StealthStrikeAvailable()) + { + int gemstone = Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[gemstone].Calamity().stealthStrike = true; + return false; + } + return true; + } } } diff --git a/Items/Weapons/Rogue/LeonidProgenitor.cs b/Items/Weapons/Rogue/LeonidProgenitor.cs new file mode 100644 index 0000000000..9fb0b301b7 --- /dev/null +++ b/Items/Weapons/Rogue/LeonidProgenitor.cs @@ -0,0 +1,91 @@ +using CalamityMod.Projectiles.Rogue; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Rogue +{ + public class LeonidProgenitor : RogueWeapon + { + public static readonly Color blueColor = new Color(48, 208, 255); + public static readonly Color purpleColor = new Color(208, 125, 218); + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Leonid Progenitor"); + Tooltip.SetDefault("Legendary Drop\n" + + "Throws a bombshell that explodes, summoning a meteor to impact the site\n" + + "Right click to throw a spread of gravity affected comets that explode, leaving behind a star\n" + + "Stealth strikes lob a bombshell that additionally splits into comets on hit\n" + + "Revengeance drop"); + } + + public override void SafeSetDefaults() + { + item.damage = 80; + item.Calamity().rogue = true; + item.knockBack = 3f; + item.useTime = item.useAnimation = 15; + item.autoReuse = true; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 12f; + + item.width = 32; + item.height = 48; + item.useStyle = 1; + item.noMelee = true; + item.noUseGraphic = true; + item.UseSound = SoundID.Item61; + item.value = CalamityGlobalItem.Rarity7BuyPrice; + item.rare = 7; + item.Calamity().customRarity = CalamityRarity.ItemSpecific; + } + + public override bool AltFunctionUse(Player player) => true; + + public override bool CanUseItem(Player player) + { + if (player.Calamity().StealthStrikeAvailable() || player.altFunctionUse != 2) + { + item.useTime = item.useAnimation = 15; + item.UseSound = SoundID.Item61; + item.shoot = ModContent.ProjectileType(); + } + else + { + item.useTime = item.useAnimation = 20; + item.UseSound = SoundID.Item88; + item.shoot = ModContent.ProjectileType(); + } + return base.CanUseItem(player); + } + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (player.Calamity().StealthStrikeAvailable() || player.altFunctionUse != 2) + { + int bomb = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[bomb].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + return false; + } + else + { + float dmgMult = 0.5f; + for (float i = -2.5f; i < 3f; ++i) + { + Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.ToRadians(i)); + Projectile.NewProjectile(position, perturbedSpeed, type, (int)(damage * dmgMult), knockBack, player.whoAmI, 0f, 0f); + } + } + return false; + } + + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Vector2 origin = new Vector2(item.width / 2f, item.height / 2f - 2f); + spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Items/Weapons/Rogue/LeonidProgenitorGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); + } + } +} diff --git a/Items/Weapons/Rogue/LeonidProgenitor.png b/Items/Weapons/Rogue/LeonidProgenitor.png new file mode 100644 index 0000000000..bec6bcd49b Binary files /dev/null and b/Items/Weapons/Rogue/LeonidProgenitor.png differ diff --git a/Items/Weapons/Rogue/LeonidProgenitorGlow.png b/Items/Weapons/Rogue/LeonidProgenitorGlow.png new file mode 100644 index 0000000000..19febb2e6f Binary files /dev/null and b/Items/Weapons/Rogue/LeonidProgenitorGlow.png differ diff --git a/Items/Weapons/Rogue/Malachite.cs b/Items/Weapons/Rogue/Malachite.cs index 5f8a435485..71d9c69bcc 100644 --- a/Items/Weapons/Rogue/Malachite.cs +++ b/Items/Weapons/Rogue/Malachite.cs @@ -6,71 +6,87 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class Malachite : RogueWeapon - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Malachite"); - Tooltip.SetDefault("Legendary Drop\n" + - "Throws a stream of kunai that stick to enemies and explode\n" + - "Right click to throw a single kunai that pierces, after piercing an enemy it emits a massive explosion on the next enemy hit\n" + - "Revengeance drop"); - } + public class Malachite : RogueWeapon + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Malachite"); + Tooltip.SetDefault("Legendary Drop\n" + + "Throws a stream of kunai that stick to enemies and explode\n" + + "Right click to throw a single kunai that pierces, after piercing an enemy it emits a massive explosion on the next enemy hit\n" + + "Stealth strikes fire three kunai that home in, stick to enemies, and explode\n" + + "Revengeance drop"); + } - public override void SafeSetDefaults() - { - item.width = 26; - item.damage = 62; - item.noMelee = true; - item.noUseGraphic = true; - item.useTime = 10; - item.useAnimation = 10; - item.useStyle = 1; - item.knockBack = 1.25f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 58; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 10f; - item.Calamity().rogue = true; - item.Calamity().customRarity = CalamityRarity.ItemSpecific; - } + public override void SafeSetDefaults() + { + item.width = 26; + item.damage = 62; + item.noMelee = true; + item.noUseGraphic = true; + item.useTime = 10; + item.useAnimation = 10; + item.useStyle = 1; + item.knockBack = 1.25f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 58; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 10f; + item.Calamity().rogue = true; + item.Calamity().customRarity = CalamityRarity.ItemSpecific; + } - public override bool AltFunctionUse(Player player) - { - return true; - } + public override bool AltFunctionUse(Player player) => true; - public override bool CanUseItem(Player player) - { - if (player.altFunctionUse == 2) - { - item.useTime = 10; - item.useAnimation = 10; - item.UseSound = SoundID.Item109; - } - else - { - item.useTime = 5; - item.useAnimation = 5; - item.UseSound = SoundID.Item1; - } - return base.CanUseItem(player); - } + public override bool CanUseItem(Player player) + { + if (player.Calamity().StealthStrikeAvailable()) + { + item.useTime = item.useAnimation = 10; + item.UseSound = SoundID.Item109; + item.shoot = ModContent.ProjectileType(); + } + else if (player.altFunctionUse == 2) + { + item.useTime = item.useAnimation = 10; + item.UseSound = SoundID.Item109; + item.shoot = ModContent.ProjectileType(); + } + else + { + item.useTime = item.useAnimation = 5; + item.UseSound = SoundID.Item1; + item.shoot = ModContent.ProjectileType(); + } + return base.CanUseItem(player); + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - if (player.altFunctionUse == 2) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), (int)((double)damage * 1.75), knockBack, player.whoAmI, 0f, 0f); - } - else - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); - } - return false; - } - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + float dmgMult = 1f; + if (player.Calamity().StealthStrikeAvailable()) + { + for (float i = -6.5f; i <= 6.5f; i += 6.5f) + { + Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.ToRadians(i)); + int stealth = Projectile.NewProjectile(position, perturbedSpeed, type, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[stealth].Calamity().stealthStrike = true; + } + return false; + } + else if (player.altFunctionUse == 2) + { + dmgMult = 1.75f; + } + else + { + dmgMult = 1f; + } + Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, (int)(damage * dmgMult), knockBack, player.whoAmI, 0f, 0f); + return false; + } + } } diff --git a/Items/Weapons/Rogue/MythrilKnife.cs b/Items/Weapons/Rogue/MythrilKnife.cs index d58418a01c..51eab369d3 100644 --- a/Items/Weapons/Rogue/MythrilKnife.cs +++ b/Items/Weapons/Rogue/MythrilKnife.cs @@ -1,44 +1,58 @@ using CalamityMod.Projectiles.Rogue; +using Microsoft.Xna.Framework; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class MythrilKnife : RogueWeapon - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mythril Knife"); - } + public class MythrilKnife : RogueWeapon + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mythril Knife"); + Tooltip.SetDefault("Stealth strikes inflict a wide assortment of debuffs"); + } - public override void SafeSetDefaults() - { - item.width = 12; - item.damage = 40; - item.noMelee = true; - item.consumable = true; - item.noUseGraphic = true; - item.useAnimation = 10; - item.useStyle = 1; - item.useTime = 10; - item.knockBack = 1.75f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 30; - item.maxStack = 999; - item.value = 1100; - item.rare = 4; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; - item.Calamity().rogue = true; - } + public override void SafeSetDefaults() + { + item.width = 12; + item.damage = 40; + item.noMelee = true; + item.consumable = true; + item.noUseGraphic = true; + item.useAnimation = 10; + item.useStyle = 1; + item.useTime = 10; + item.knockBack = 1.75f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 30; + item.maxStack = 999; + item.value = 1100; + item.rare = 4; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 12f; + item.Calamity().rogue = true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.MythrilBar); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this, 40); - recipe.AddRecipe(); - } - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (player.Calamity().StealthStrikeAvailable()) + { + int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[stealth].Calamity().stealthStrike = true; + return false; + } + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.MythrilBar); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this, 40); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/Rogue/NightsGaze.cs b/Items/Weapons/Rogue/NightsGaze.cs index 88cb5fe336..f8f924b92a 100644 --- a/Items/Weapons/Rogue/NightsGaze.cs +++ b/Items/Weapons/Rogue/NightsGaze.cs @@ -2,6 +2,7 @@ using CalamityMod.Projectiles.Rogue; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Ores; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -13,14 +14,14 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Night's Gaze"); - Tooltip.SetDefault("Throws a spear that shatters when it hits an enemy\n" + - "Stealth strikes cause the spear to summon homing stars as it flies\n" + - "Strike your foes with this spear of the night"); + Tooltip.SetDefault("Strike your foes with this spear of the night\n" + + "Throws a spear that shatters when it hits an enemy\n" + + "Stealth strikes cause the spear to summon homing stars as it flies"); } public override void SafeSetDefaults() { - item.width = 80; + item.width = 82; item.damage = 800; item.noMelee = true; item.noUseGraphic = true; @@ -30,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.knockBack = 1f; item.UseSound = SoundID.Item1; item.autoReuse = true; - item.height = 80; + item.height = 82; item.maxStack = 1; item.value = Item.buyPrice(1, 40, 0, 0); item.rare = 10; @@ -51,6 +52,13 @@ namespace CalamityMod.Items.Weapons.Rogue return true; } + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Rogue/NightsGazeGlow"); + Vector2 origin = new Vector2(texture.Width / 2f, texture.Height / 2f - 2f); + spriteBatch.Draw(texture, item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); + } + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); diff --git a/Items/Weapons/Rogue/NightsGaze.png b/Items/Weapons/Rogue/NightsGaze.png index 70193b68e5..6b12c7754c 100644 Binary files a/Items/Weapons/Rogue/NightsGaze.png and b/Items/Weapons/Rogue/NightsGaze.png differ diff --git a/Items/Weapons/Rogue/NightsGazeGlow.png b/Items/Weapons/Rogue/NightsGazeGlow.png new file mode 100644 index 0000000000..146c7cd893 Binary files /dev/null and b/Items/Weapons/Rogue/NightsGazeGlow.png differ diff --git a/Items/Weapons/Rogue/OrichalcumSpikedGemstone.cs b/Items/Weapons/Rogue/OrichalcumSpikedGemstone.cs index e8604f6c43..08f2fae2a7 100644 --- a/Items/Weapons/Rogue/OrichalcumSpikedGemstone.cs +++ b/Items/Weapons/Rogue/OrichalcumSpikedGemstone.cs @@ -1,4 +1,6 @@ using CalamityMod.Projectiles.Rogue; +using Microsoft.Xna.Framework; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue @@ -8,6 +10,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Orichalcum Spiked Gemstone"); + Tooltip.SetDefault("Stealth strikes last longer and summon petals on enemy hits"); } public override void SafeSetDefaults() @@ -33,6 +36,20 @@ namespace CalamityMod.Items.Weapons.Rogue 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) + { + if (player.Calamity().StealthStrikeAvailable()) + { + int gemstone = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[gemstone].Calamity().stealthStrike = true; + Main.projectile[gemstone].usesLocalNPCImmunity = true; + Main.projectile[gemstone].timeLeft = 900; + Main.projectile[gemstone].penetrate = -1; + return false; + } + return true; + } + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); diff --git a/Items/Weapons/Rogue/PalladiumJavelin.cs b/Items/Weapons/Rogue/PalladiumJavelin.cs index cdc78351b8..7f5c32987b 100644 --- a/Items/Weapons/Rogue/PalladiumJavelin.cs +++ b/Items/Weapons/Rogue/PalladiumJavelin.cs @@ -1,4 +1,6 @@ using CalamityMod.Projectiles.Rogue; +using Microsoft.Xna.Framework; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue @@ -8,6 +10,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Palladium Javelin"); + Tooltip.SetDefault("Stealth strikes split into more javelins"); } public override void SafeSetDefaults() @@ -33,6 +36,15 @@ namespace CalamityMod.Items.Weapons.Rogue item.Calamity().rogue = true; } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + int javelin = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[javelin].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + if (!player.Calamity().StealthStrikeAvailable()) + Main.projectile[javelin].usesLocalNPCImmunity = false; + return false; + } + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); diff --git a/Items/Weapons/Rogue/Prismalline.cs b/Items/Weapons/Rogue/Prismalline.cs index 2e513ff717..ed28e0d7c6 100644 --- a/Items/Weapons/Rogue/Prismalline.cs +++ b/Items/Weapons/Rogue/Prismalline.cs @@ -8,56 +8,56 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class Prismalline : RogueWeapon - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Prismalline"); - Tooltip.SetDefault("Throws daggers that split after a while\n" + + public class Prismalline : RogueWeapon + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Prismalline"); + Tooltip.SetDefault("Throws daggers that split after a while\n" + "Stealth strikes additionally explode into prism shards and briefly stun enemies"); - } + } - public override void SafeSetDefaults() - { - item.width = 46; - item.damage = 18; - item.crit += 4; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 14; - item.useStyle = 1; - item.useTime = 14; - item.knockBack = 5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 46; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 16f; - item.Calamity().rogue = true; - } + public override void SafeSetDefaults() + { + item.width = 46; + item.damage = 18; + item.crit += 4; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = 14; + item.useStyle = 1; + item.useTime = 14; + item.knockBack = 5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 46; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 16f; + 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) - { - if (player.Calamity().StealthStrikeAvailable()) - { - int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[proj].Calamity().stealthStrike = true; - return false; - } - return true; - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (player.Calamity().StealthStrikeAvailable()) + { + int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[proj].Calamity().stealthStrike = true; + return false; + } + return true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/Rogue/Quasar.cs b/Items/Weapons/Rogue/Quasar.cs index 99ef2e8cd1..37a02673c9 100644 --- a/Items/Weapons/Rogue/Quasar.cs +++ b/Items/Weapons/Rogue/Quasar.cs @@ -11,7 +11,8 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Quasar"); - Tooltip.SetDefault("Succ"); + Tooltip.SetDefault("Succ\n" + + "Stealth strikes spawn more explosions"); } public override void SafeSetDefaults() @@ -38,7 +39,8 @@ namespace CalamityMod.Items.Weapons.Rogue public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 1f, 0f); + int knife = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[knife].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); return false; } } diff --git a/Items/Weapons/Rogue/SealedSingularity.cs b/Items/Weapons/Rogue/SealedSingularity.cs new file mode 100644 index 0000000000..3574841393 --- /dev/null +++ b/Items/Weapons/Rogue/SealedSingularity.cs @@ -0,0 +1,59 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Rogue; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Rogue +{ + public class SealedSingularity : RogueWeapon + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sealed Singularity"); + Tooltip.SetDefault("Shatters on impact, summoning a black hole that sucks in nearby enemies\n" + + "Stealth strikes summon a black hole that lasts longer and sucks enemies with stronger force"); + } + + public override void SafeSetDefaults() + { + item.damage = 47; + item.knockBack = 5f; + item.useAnimation = item.useTime = 25; + item.useStyle = 1; + item.Calamity().rogue = true; + item.autoReuse = true; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 12f; + + item.noMelee = item.noUseGraphic = true; + item.height = item.width = 34; + item.UseSound = SoundID.Item106; + item.value = CalamityGlobalItem.Rarity13BuyPrice; + item.rare = 10; + item.Calamity().customRarity = CalamityRarity.Dedicated; + } + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike + { + int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[stealth].Calamity().stealthStrike = true; + return false; + } + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType(), 3); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Rogue/SealedSingularity.png b/Items/Weapons/Rogue/SealedSingularity.png new file mode 100644 index 0000000000..5d81a77b7b Binary files /dev/null and b/Items/Weapons/Rogue/SealedSingularity.png differ diff --git a/Items/Weapons/Rogue/SpearofDestiny.cs b/Items/Weapons/Rogue/SpearofDestiny.cs index 59978ead10..091b67d2f4 100644 --- a/Items/Weapons/Rogue/SpearofDestiny.cs +++ b/Items/Weapons/Rogue/SpearofDestiny.cs @@ -11,7 +11,8 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Spear of Destiny"); - Tooltip.SetDefault("Throws three spears with the outer two having homing capabilities"); + Tooltip.SetDefault("Throws three spears with the outer two having homing capabilities\n" + + "Stealth strikes cause all three spears to home in, ignore tiles, and pierce more"); } public override void SafeSetDefaults() @@ -40,8 +41,10 @@ namespace CalamityMod.Items.Weapons.Rogue int index = 7; for (int i = -index; i <= index; i += index) { + int projType = (i != 0 || player.Calamity().StealthStrikeAvailable()) ? type : ModContent.ProjectileType(); Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.ToRadians(i)); - Projectile.NewProjectile(position.X, position.Y, perturbedSpeed.X, perturbedSpeed.Y, i != 0 ? type : ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + int spear = Projectile.NewProjectile(position.X, position.Y, perturbedSpeed.X, perturbedSpeed.Y, projType, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[spear].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); } return false; } diff --git a/Items/Weapons/Rogue/Supernova.cs b/Items/Weapons/Rogue/Supernova.cs index 8e4d80bb69..7fa1cfc232 100644 --- a/Items/Weapons/Rogue/Supernova.cs +++ b/Items/Weapons/Rogue/Supernova.cs @@ -59,10 +59,7 @@ Stealth strikes release energy as they fly"); recipe.AddIngredient(ModContent.ItemType(), 200); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - - //replaces Duststorm in a Bottle when added - //recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType(), 4); recipe.AddTile(ModContent.TileType()); diff --git a/Items/Weapons/Rogue/ThrowingBrick.cs b/Items/Weapons/Rogue/ThrowingBrick.cs index dd03097419..807a5d198f 100644 --- a/Items/Weapons/Rogue/ThrowingBrick.cs +++ b/Items/Weapons/Rogue/ThrowingBrick.cs @@ -10,8 +10,8 @@ namespace CalamityMod.Items.Weapons.Rogue { public override void SetStaticDefaults() { - Tooltip.SetDefault("Throws a brick that shatters if stealth is full.\n" + - "'Prove its resistance by throwing it upwards and catching it with your face'"); + Tooltip.SetDefault("Prove its resistance by throwing it upwards and catching it with your face\n" + + "Throws a brick that shatters if stealth is full."); DisplayName.SetDefault("Throwing Brick"); } public override void SafeSetDefaults() diff --git a/Items/Weapons/Rogue/XerocPitchfork.cs b/Items/Weapons/Rogue/XerocPitchfork.cs index 0dede440c8..f028813edd 100644 --- a/Items/Weapons/Rogue/XerocPitchfork.cs +++ b/Items/Weapons/Rogue/XerocPitchfork.cs @@ -1,46 +1,60 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; +using Microsoft.Xna.Framework; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class XerocPitchfork : RogueWeapon - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Xeroc Pitchfork"); - } + public class XerocPitchfork : RogueWeapon + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Xeroc Pitchfork"); + Tooltip.SetDefault("Stealth strikes leave homing stars in their wake"); + } - public override void SafeSetDefaults() - { - item.width = 48; - item.damage = 280; - item.noMelee = true; - item.consumable = true; - item.noUseGraphic = true; - item.useAnimation = 19; - item.useStyle = 1; - item.useTime = 19; - item.knockBack = 8f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 48; - item.maxStack = 999; - item.value = 10000; - item.rare = 9; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 16f; - item.Calamity().rogue = true; - } + public override void SafeSetDefaults() + { + item.width = 48; + item.damage = 280; + item.noMelee = true; + item.consumable = true; + item.noUseGraphic = true; + item.useAnimation = 19; + item.useStyle = 1; + item.useTime = 19; + item.knockBack = 8f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 48; + item.maxStack = 999; + item.value = 10000; + item.rare = 9; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 16f; + item.Calamity().rogue = true; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this, 20); - recipe.AddRecipe(); - } - } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (player.Calamity().StealthStrikeAvailable()) + { + int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[stealth].Calamity().stealthStrike = true; + return false; + } + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this, 20); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/Summon/CausticStaff.cs b/Items/Weapons/Summon/CausticStaff.cs new file mode 100644 index 0000000000..cc2043ee58 --- /dev/null +++ b/Items/Weapons/Summon/CausticStaff.cs @@ -0,0 +1,58 @@ +using CalamityMod.Projectiles.Summon; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Weapons.Summon +{ + public class CausticStaff : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Caustic Staff"); + Tooltip.SetDefault("Summons a mini dragon to fight for you\n" + + "The dragon inflicts several debilitating debuffs"); + } + + public override void SetDefaults() + { + item.mana = 10; + item.damage = 15; + item.useStyle = 1; + item.shootSpeed = 10f; + item.shoot = ModContent.ProjectileType(); + item.width = 26; + item.height = 28; + item.UseSound = SoundID.Item77; + item.useAnimation = item.useTime = 25; + item.rare = 4; + item.noMelee = true; + item.knockBack = 2f; + item.summon = true; + item.value = Item.buyPrice(0, 12, 0, 0); + item.Calamity().customRarity = CalamityRarity.Dedicated; + item.autoReuse = true; + } + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (player.altFunctionUse != 2) + { + Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, type, damage, knockBack, player.whoAmI); + } + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddRecipeGroup("AnyEvilFlask", 5); + recipe.AddIngredient(ItemID.Deathweed, 2); + recipe.AddIngredient(ItemID.SoulofNight, 10); + recipe.AddRecipeGroup("AnyEvilBar", 10); + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Summon/CausticStaff.png b/Items/Weapons/Summon/CausticStaff.png new file mode 100644 index 0000000000..243ed6c657 Binary files /dev/null and b/Items/Weapons/Summon/CausticStaff.png differ diff --git a/Items/Weapons/Summon/ElementalAxe.cs b/Items/Weapons/Summon/ElementalAxe.cs index 175e331c8b..caba5b6ccf 100644 --- a/Items/Weapons/Summon/ElementalAxe.cs +++ b/Items/Weapons/Summon/ElementalAxe.cs @@ -23,8 +23,7 @@ namespace CalamityMod.Items.Weapons.Summon item.mana = 10; item.width = 36; item.height = 36; - item.useTime = 36; - item.useAnimation = 36; + item.useTime = item.useAnimation = 15; item.useStyle = 1; item.noMelee = true; item.knockBack = 5f; diff --git a/Items/Weapons/Summon/PrototypeAndromechaRing.cs b/Items/Weapons/Summon/PrototypeAndromechaRing.cs new file mode 100644 index 0000000000..b1b38912a1 --- /dev/null +++ b/Items/Weapons/Summon/PrototypeAndromechaRing.cs @@ -0,0 +1,93 @@ +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.CalPlayer; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Projectiles.Summon; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Summon +{ + public class PrototypeAndromechaRing : ModItem + { + public const int CrippleTime = 360; // 6 seconds + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Prototype Andromecha Ring"); + Tooltip.SetDefault("Summons an colossal controllable mech\n" + + "Right click to display the mech's control panel\n" + + "The panel has 3 possible configurations, that you can choose using the brackets on the UI\n" + + "Each bracket powers 2 out of 3 functions, represented by icons on the UI.\n" + + "The bottom left icon shrinks the mech to the size of a player when powered, but weakens its attacks. \n" + + "The bottom right icon charges when powered. At full charge, you can click it to release bursts of branching lightning.\n" + + "The top icon alternates between the 2 the primary attacks when clicked. \n" + + "The primary attack replaces your normal attacks. You can only use the primary attack if the top icon is powered\n" + + "The melee mode slashes enemies with Regicide, an enormous energy blade\n" + + "The ranged mode releases quickly 3 laser beams. Only one laser is shot if the mech is shrunk\n" + + "Exiting the mount while a boss is alive will temporarily hinder your movement\n" + + "The remains of what could have been, forged into a deadly exosuit\n" + + "[c/87ceeb:Now, make them pay.]"); + } + + public override void SetDefaults() + { + item.mana = 200; + item.damage = 9999; + item.useStyle = ItemUseStyleID.HoldingUp; + item.width = item.height = 28; + item.useTime = item.useAnimation = 10; + item.noMelee = true; + item.knockBack = 1f; + item.value = CalamityGlobalItem.RarityHotPinkBuyPrice; + item.Calamity().customRarity = CalamityRarity.ItemSpecific; + item.rare = 10; + item.UseSound = SoundID.Item117; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 10f; + item.summon = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 100); + recipe.AddIngredient(ModContent.ItemType(), 4); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ItemID.WingsVortex); + recipe.AddTile(ModContent.TileType()); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + public override bool CanUseItem(Player player) => !(player.Calamity().andromedaCripple > 0 && CalamityPlayer.areThereAnyDamnBosses); + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + // If the player has any robots, kill them all. + if (player.ownedProjectileCounts[item.shoot] > 0) + { + for (int i = 0; i < Main.projectile.Length; i++) + { + if (Main.projectile[i].active && + Main.projectile[i].type == item.shoot && + Main.projectile[i].owner == player.whoAmI) + { + Main.projectile[i].Kill(); + } + } + if (CalamityPlayer.areThereAnyDamnBosses) + { + player.Calamity().andromedaCripple = CrippleTime; + player.AddBuff(ModContent.BuffType(), player.Calamity().andromedaCripple); + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AdrenalineBurnout1"), position); + } + return false; + } + // Otherwise create one. + return true; + } + } +} diff --git a/Items/Weapons/Summon/PrototypeAndromechaRing.png b/Items/Weapons/Summon/PrototypeAndromechaRing.png new file mode 100644 index 0000000000..99fecb9b52 Binary files /dev/null and b/Items/Weapons/Summon/PrototypeAndromechaRing.png differ diff --git a/Items/Weapons/Summon/Sirius.png b/Items/Weapons/Summon/Sirius.png index 7fbaf86838..14125d49e9 100644 Binary files a/Items/Weapons/Summon/Sirius.png and b/Items/Weapons/Summon/Sirius.png differ diff --git a/Items/Weapons/Summon/TacticalPlagueEngine.cs b/Items/Weapons/Summon/TacticalPlagueEngine.cs index 23a0d14215..b2deaa6b64 100644 --- a/Items/Weapons/Summon/TacticalPlagueEngine.cs +++ b/Items/Weapons/Summon/TacticalPlagueEngine.cs @@ -53,6 +53,7 @@ namespace CalamityMod.Items.Weapons.Summon recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType(), 15); + recipe.AddIngredient(ModContent.ItemType(), 8); recipe.AddIngredient(ItemID.LunarBar, 10); recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); diff --git a/ModSupport/ModCalls.cs b/ModSupport/ModCalls.cs index 193812415c..8f6de6c33f 100644 --- a/ModSupport/ModCalls.cs +++ b/ModSupport/ModCalls.cs @@ -560,6 +560,10 @@ namespace CalamityMod // LATER -- no summon set bonuses are written well. all use two bools, neither of which actually controls the function + // Desert Prowler + if (setBonus == "desertprowler" || setBonus == "desert prowler") + return mp.desertProwler; + // Snow Ruffian if (setBonus == "snowruffian" || setBonus == "snow ruffian") return mp.snowRuffianSet; @@ -700,6 +704,10 @@ namespace CalamityMod if (setBonus == "plaguereaper" || setBonus == "plague reaper") return mp.plagueReaper; + // Plaguebringer + if (setBonus == "plaguebringer" || setBonus == "plaguebringerpatron" || setBonus == "plaguebringer patron") + return mp.plaguebringerPatronSet; + // Astral if (setBonus == "astral") return mp.astralStarRain; @@ -732,6 +740,10 @@ namespace CalamityMod return mp.tarraThrowing; } + // Prismatic + if (setBonus == "prismatic" || setBonus == "prism") + return mp.prismaticSet; + // Bloodflare switch (setBonus) { @@ -841,6 +853,13 @@ namespace CalamityMod CalamityPlayer mp = p.Calamity(); setBonus = setBonus.ToLower(); + // Desert Prowler + if (setBonus == "desert prowler" || setBonus == "desert prowler") + { + mp.snowRuffianSet = enabled; + return true; + } + // Snow Ruffian if (setBonus == "snowruffian" || setBonus == "snow ruffian") { @@ -1040,6 +1059,13 @@ namespace CalamityMod return true; } + // Plaguebringer + if (setBonus == "plaguebringer" || setBonus == "plaguebringerpatron" || setBonus == "plaguebringer patron") + { + mp.plaguebringerPatronSet = enabled; + return true; + } + // Astral if (setBonus == "astral") { @@ -1089,6 +1115,13 @@ namespace CalamityMod return true; } + // Prismatic + if (setBonus == "prismatic" || setBonus == "prism") + { + mp.prismaticSet = enabled; + return true; + } + // Bloodflare switch (setBonus) { diff --git a/ModSupport/WeakReferenceSupport.cs b/ModSupport/WeakReferenceSupport.cs index 93e95f268a..08933814c5 100644 --- a/ModSupport/WeakReferenceSupport.cs +++ b/ModSupport/WeakReferenceSupport.cs @@ -357,7 +357,7 @@ namespace CalamityMod BossDifficulty.TryGetValue("AstrumAureus", out float order); int type = NPCType(); int summon = ItemType(); - List loot = new List() { ItemType(), ItemType(), ItemID.FallenStar, ItemType(), ItemType(), ItemType(), ItemType(), ItemID.HallowedKey, ItemID.FragmentSolar, ItemID.FragmentVortex, ItemID.FragmentNebula, ItemID.FragmentStardust, ItemType(), ItemID.GreaterHealingPotion }; + List loot = new List() { ItemType(), ItemType(), ItemID.FallenStar, ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemID.HallowedKey, ItemID.FragmentSolar, ItemID.FragmentVortex, ItemID.FragmentNebula, ItemID.FragmentStardust, ItemType(), ItemID.GreaterHealingPotion }; List collection = new List() { ItemType(), ItemType(), ItemType() }; string instructions = $"Use an [i:{summon}] at Night in the Astral Biome"; string despawn = CalamityUtils.ColorMessage("Astrum Aureus’ program has been executed. Initiate recall.", new Color(0xFF, 0xD7, 0x00)); @@ -422,7 +422,7 @@ namespace CalamityMod BossDifficulty.TryGetValue("Dragonfolly", out float order); int type = NPCType(); int summon = ItemType(); - List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemID.SuperHealingPotion }; + List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemID.SuperHealingPotion }; List collection = new List() { ItemType(), ItemType(), ItemType() }; string instructions = $"Use [i:{summon}] in the Jungle Biome"; string despawn = CalamityUtils.ColorMessage("The failed experiment returns to its reproductive routine.", new Color(0xFF, 0xD7, 0x00)); @@ -522,7 +522,7 @@ namespace CalamityMod BossDifficulty.TryGetValue("Yharon", out float order); int type = NPCType(); int summon = ItemType(); - List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; + List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; string instructions = $"Use a [i:{summon}] in the Jungle Biome"; // TODO -- this setup code is only run once, so the despawn message can't be changed post-eclipse. Find a way around this. @@ -830,6 +830,7 @@ namespace CalamityMod sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), ProjectileType()); sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), ProjectileType()); sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), ProjectileType()); + sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), ProjectileType()); sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), ProjectileType()); sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), ProjectileType()); sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), ProjectileType()); diff --git a/NPCs/AcidRain/NuclearToad.png b/NPCs/AcidRain/NuclearToad.png index 2aa70fa1f1..4a85443871 100644 Binary files a/NPCs/AcidRain/NuclearToad.png and b/NPCs/AcidRain/NuclearToad.png differ diff --git a/NPCs/AcidRain/NuclearToadGlow.png b/NPCs/AcidRain/NuclearToadGlow.png index d51d2291f3..d565338c77 100644 Binary files a/NPCs/AcidRain/NuclearToadGlow.png and b/NPCs/AcidRain/NuclearToadGlow.png differ diff --git a/NPCs/AcidRain/WaterLeech.cs b/NPCs/AcidRain/WaterLeech.cs index d9447e9b28..db02795914 100644 --- a/NPCs/AcidRain/WaterLeech.cs +++ b/NPCs/AcidRain/WaterLeech.cs @@ -1,5 +1,6 @@ using CalamityMod.Dusts; using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Items.Weapons.Magic; using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; @@ -174,5 +175,11 @@ namespace CalamityMod.NPCs.AcidRain { target.AddBuff(ModContent.BuffType(), 120); } + + public override void NPCLoot() + { + float dropChance = CalamityWorld.downedAquaticScourge ? 0.01f : 0.05f; + DropHelper.DropItemChance(npc, ModContent.ItemType(), dropChance); + } } } diff --git a/NPCs/AquaticScourge/AquaticScourgeHead.png b/NPCs/AquaticScourge/AquaticScourgeHead.png index 05dcf667a0..ecb4ce1ceb 100644 Binary files a/NPCs/AquaticScourge/AquaticScourgeHead.png and b/NPCs/AquaticScourge/AquaticScourgeHead.png differ diff --git a/NPCs/AstrumAureus/AstrumAureus.cs b/NPCs/AstrumAureus/AstrumAureus.cs index 4299c68e61..e47c132305 100644 --- a/NPCs/AstrumAureus/AstrumAureus.cs +++ b/NPCs/AstrumAureus/AstrumAureus.cs @@ -8,7 +8,10 @@ using CalamityMod.Items.Placeables.Furniture.Trophies; using CalamityMod.Items.Potions; using CalamityMod.Items.TreasureBags; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Items.Weapons.Rogue; using CalamityMod.NPCs.TownNPCs; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -357,7 +360,10 @@ namespace CalamityMod.NPCs.AstrumAureus // Weapons DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); + DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); + DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); + DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); // Vanity DropHelper.DropItemChance(npc, ModContent.ItemType(), 7); diff --git a/NPCs/Bumblebirb/BumbleFolly.png b/NPCs/Bumblebirb/BumbleFolly.png new file mode 100644 index 0000000000..08da141cc8 Binary files /dev/null and b/NPCs/Bumblebirb/BumbleFolly.png differ diff --git a/NPCs/Bumblebirb/Bumblefuck.cs b/NPCs/Bumblebirb/Bumblefuck.cs index 389c45afa4..6584ed016a 100644 --- a/NPCs/Bumblebirb/Bumblefuck.cs +++ b/NPCs/Bumblebirb/Bumblefuck.cs @@ -3,6 +3,7 @@ using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Armor.Vanity; using CalamityMod.Items.LoreItems; using CalamityMod.Items.Materials; +using CalamityMod.Items.Mounts; using CalamityMod.Items.Placeables.Furniture.Trophies; using CalamityMod.Items.TreasureBags; using CalamityMod.Items.Weapons.Magic; @@ -424,6 +425,9 @@ namespace CalamityMod.NPCs.Bumblebirb DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); DropHelper.DropItemChance(npc, ModContent.ItemType(), DropHelper.RareVariantDropRateInt); + // Equipment + DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); + // Vanity DropHelper.DropItemChance(npc, ModContent.ItemType(), 7); } diff --git a/NPCs/Bumblebirb/Bumblefuck2.cs b/NPCs/Bumblebirb/Bumblefuck2.cs index 0ac40a6f9f..dd3ab8562f 100644 --- a/NPCs/Bumblebirb/Bumblefuck2.cs +++ b/NPCs/Bumblebirb/Bumblefuck2.cs @@ -13,11 +13,11 @@ namespace CalamityMod.NPCs.Bumblebirb public override void SetStaticDefaults() { DisplayName.SetDefault("Draconic Swarmer"); - Main.npcFrameCount[npc.type] = 6; + Main.npcFrameCount[npc.type] = 5; NPCID.Sets.TrailingMode[npc.type] = 1; } - public override string Texture => "CalamityMod/NPCs/Bumblebirb/Birb"; + public override string Texture => "CalamityMod/NPCs/Bumblebirb/BumbleFolly"; public override void SetDefaults() { @@ -27,7 +27,6 @@ namespace CalamityMod.NPCs.Bumblebirb npc.damage = 110; npc.width = 120; npc.height = 80; - npc.scale = 0.66f; npc.defense = 20; npc.LifeMaxNERB(20000, 25000, 60000); npc.knockBackResist = 0f; diff --git a/NPCs/CalamityGlobalAI.cs b/NPCs/CalamityGlobalAI.cs index 5256f706cc..c1798531bb 100644 --- a/NPCs/CalamityGlobalAI.cs +++ b/NPCs/CalamityGlobalAI.cs @@ -17687,14 +17687,14 @@ namespace CalamityMod.NPCs maxVelocity = 1f; } maxVelocity *= 1.5f; - if (npcType < 310) + if (npcType < 310) //Pogo stick Scarecrows { if (npc.velocity.Y == 0f) { npc.velocity.X *= 0.85f; - if (npc.velocity.X > -0.3 && (double)npc.velocity.X < 0.3) + if (npc.velocity.X > -0.3f && npc.velocity.X < 0.3f) { - npc.velocity.Y = -9f; + npc.velocity.Y = -9f; //-7f normally npc.velocity.X = maxVelocity * (float)npc.direction; } } diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 72e020a8ce..3f5e146fa3 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -585,6 +585,28 @@ namespace CalamityMod.NPCs } } + if (irradiated > 0) + { + int projectileCount = 0; + for (int j = 0; j < Main.maxProjectiles; j++) + { + if (Main.projectile[j].active && Main.projectile[j].type == ProjectileType() && + Main.projectile[j].ai[0] == 1f && Main.projectile[j].ai[1] == npc.whoAmI) + { + projectileCount++; + } + } + + if (projectileCount > 0) + { + ApplyDPSDebuff(irradiated, projectileCount * 20, projectileCount * 4, ref npc.lifeRegen, ref damage); + } + else + { + ApplyDPSDebuff(irradiated, 20, 4, ref npc.lifeRegen, ref damage); + } + } + // Exo Freeze, Glacial State and Temporal Sadness don't work on bosses or other specific enemies. if (!npc.boss && !CalamityMod.movementImpairImmuneList.Contains(npc.type)) { @@ -623,7 +645,6 @@ namespace CalamityMod.NPCs } ApplyDPSDebuff(vaporfied, 30, 6, ref npc.lifeRegen, ref damage); - ApplyDPSDebuff(irradiated, 20, 4, ref npc.lifeRegen, ref damage); ApplyDPSDebuff(bFlames, 40, 8, ref npc.lifeRegen, ref damage); ApplyDPSDebuff(hFlames, 50, 10, ref npc.lifeRegen, ref damage); ApplyDPSDebuff(pFlames, 100, 20, ref npc.lifeRegen, ref damage); @@ -1374,6 +1395,14 @@ namespace CalamityMod.NPCs } } + if (target.Calamity().prismaticHelmet && !CalamityPlayer.areThereAnyDamnBosses) + { + if (npc.lifeMax < 500) + { + return false; + } + } + return true; } #endregion @@ -2523,12 +2552,16 @@ namespace CalamityMod.NPCs break; case NPCID.Dryad: - switch (Main.rand.Next(22)) // 21 Dryad names + switch (Main.rand.Next(23)) // 21 Dryad names { case 0: npc.GivenName = "Rythmi"; break; + case 1: + npc.GivenName = "Izuna"; + break; + default: break; } @@ -3505,7 +3538,7 @@ namespace CalamityMod.NPCs { damage = (int)(damage * 0.4); } - else if (projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType()) + else if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) { damage = (int)(damage * 0.5); } @@ -5623,6 +5656,7 @@ namespace CalamityMod.NPCs if (type == NPCID.Wizard) { + SetShopItem(ref shop, ref nextSlot, ItemType()); SetShopItem(ref shop, ref nextSlot, ItemType(), CalamityWorld.downedBrimstoneElemental, Item.buyPrice(0, 20)); SetShopItem(ref shop, ref nextSlot, ItemType(), CalamityWorld.downedAstrageldon, Item.buyPrice(0, 25)); SetShopItem(ref shop, ref nextSlot, ItemID.MagicMissile, price: Item.buyPrice(0, 5)); diff --git a/NPCs/HiveMind/DankCreeper.png b/NPCs/HiveMind/DankCreeper.png index d3076c78b2..37f96ed7b6 100644 Binary files a/NPCs/HiveMind/DankCreeper.png and b/NPCs/HiveMind/DankCreeper.png differ diff --git a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs index 0e63406a97..26d9f78b5a 100644 --- a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs +++ b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs @@ -1119,6 +1119,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath { // Materials DropHelper.DropItemSpray(npc, ModContent.ItemType(), 10, 14); + DropHelper.DropItemSpray(npc, ModContent.ItemType(), 13, 17); DropHelper.DropItemSpray(npc, ItemID.Stinger, 3, 5); // Weapons diff --git a/NPCs/Ravager/RavagerClawLeft.png b/NPCs/Ravager/RavagerClawLeft.png index 78efbe35d2..c592287373 100644 Binary files a/NPCs/Ravager/RavagerClawLeft.png and b/NPCs/Ravager/RavagerClawLeft.png differ diff --git a/NPCs/Ravager/RavagerClawRight.png b/NPCs/Ravager/RavagerClawRight.png index 116a48d6ea..2df4ccda99 100644 Binary files a/NPCs/Ravager/RavagerClawRight.png and b/NPCs/Ravager/RavagerClawRight.png differ diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas.cs b/NPCs/SupremeCalamitas/SupremeCalamitas.cs index 048e16585b..a9b76ac438 100644 --- a/NPCs/SupremeCalamitas/SupremeCalamitas.cs +++ b/NPCs/SupremeCalamitas/SupremeCalamitas.cs @@ -2150,28 +2150,30 @@ namespace CalamityMod.NPCs.SupremeCalamitas DropHelper.DropItem(npc, ModContent.ItemType(), true, essenceMin, essenceMax); // Weapons - // All non-hybrid weapons are listed twice so that the drop rates are actually equal between each unique weapon - DropHelper.DropItemFromSetCondition(npc, Main.expertMode, - ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), ModContent.ItemType(), // Illustrious Knives - ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), ModContent.ItemType(), // Staff of Blushie - ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), ModContent.ItemType(), // Voidragon - ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), ModContent.ItemType() //Temporal Umbrella - ); + + // All non-hybrid weapons are listed twice so that the drop rates are actually equal between each unique weapon + DropHelper.DropItemFromSetCondition(npc, Main.expertMode, + ModContent.ItemType(), ModContent.ItemType(), + ModContent.ItemType(), ModContent.ItemType(), + ModContent.ItemType(), ModContent.ItemType(), + ModContent.ItemType(), ModContent.ItemType(), + ModContent.ItemType(), ModContent.ItemType(), + ModContent.ItemType(), ModContent.ItemType(), + ModContent.ItemType(), ModContent.ItemType(), + ModContent.ItemType(), ModContent.ItemType(), // Illustrious Knives + ModContent.ItemType(), ModContent.ItemType(), + ModContent.ItemType(), ModContent.ItemType(), + ModContent.ItemType(), ModContent.ItemType(), + ModContent.ItemType(), ModContent.ItemType(), + ModContent.ItemType(), ModContent.ItemType(), // Staff of Blushie + ModContent.ItemType(), ModContent.ItemType(), + ModContent.ItemType(), ModContent.ItemType(), + ModContent.ItemType(), ModContent.ItemType(), + ModContent.ItemType(), ModContent.ItemType(), // Voidragon + ModContent.ItemType(), ModContent.ItemType(), + ModContent.ItemType(), ModContent.ItemType(), //Temporal Umbrella + ModContent.ItemType(), ModContent.ItemType() + ); DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.revenge); // Vanity diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas.png b/NPCs/SupremeCalamitas/SupremeCalamitas.png index c71aba7fae..0eea683573 100644 Binary files a/NPCs/SupremeCalamitas/SupremeCalamitas.png and b/NPCs/SupremeCalamitas/SupremeCalamitas.png differ diff --git a/NPCs/SupremeCalamitas/SupremeCalamitasGlow.png b/NPCs/SupremeCalamitas/SupremeCalamitasGlow.png index 9130ab0255..f09dcde7e3 100644 Binary files a/NPCs/SupremeCalamitas/SupremeCalamitasGlow.png and b/NPCs/SupremeCalamitas/SupremeCalamitasGlow.png differ diff --git a/NPCs/Yharon/Yharon.cs b/NPCs/Yharon/Yharon.cs index 8e2cd94508..3d405f54ae 100644 --- a/NPCs/Yharon/Yharon.cs +++ b/NPCs/Yharon/Yharon.cs @@ -3011,6 +3011,7 @@ namespace CalamityMod.NPCs.Yharon DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); + DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); // Vanity DropHelper.DropItemChance(npc, ModContent.ItemType(), 7); diff --git a/Projectiles/Boss/MushBomb.cs b/Projectiles/Boss/MushBomb.cs index 60d931060d..d14f549908 100644 --- a/Projectiles/Boss/MushBomb.cs +++ b/Projectiles/Boss/MushBomb.cs @@ -1,5 +1,7 @@ using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { @@ -13,14 +15,14 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; + projectile.width = 14; + projectile.height = 14; projectile.hostile = true; projectile.tileCollide = false; projectile.penetrate = 1; projectile.timeLeft = 480; projectile.aiStyle = 1; - aiType = 1; + aiType = ProjectileID.WoodenArrowFriendly; } public override void AI() @@ -43,6 +45,33 @@ namespace CalamityMod.Projectiles.Boss projectile.velocity.X *= 0.99f; } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture = Main.projectileTexture[projectile.type]; + int height = texture.Height / Main.projFrames[projectile.type]; + int drawStart = height * projectile.frame; + Vector2 origin = projectile.Size / 2; + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + spriteEffects = SpriteEffects.FlipHorizontally; + + spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, height)), Color.White, projectile.rotation, origin, projectile.scale, spriteEffects, 0f); + return false; + } + + public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture = Main.projectileTexture[projectile.type]; + int height = texture.Height / Main.projFrames[projectile.type]; + int drawStart = height * projectile.frame; + Vector2 origin = projectile.Size / 2; + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + spriteEffects = SpriteEffects.FlipHorizontally; + + spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Boss/MushBombGlow"), projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, height)), Color.White, projectile.rotation, origin, projectile.scale, spriteEffects, 0f); + } + public override void Kill(int timeLeft) { Main.PlaySound(4, (int)projectile.position.X, (int)projectile.position.Y, 1); diff --git a/Projectiles/Boss/MushBombFall.cs b/Projectiles/Boss/MushBombFall.cs index 0c4d203b12..fc8492233b 100644 --- a/Projectiles/Boss/MushBombFall.cs +++ b/Projectiles/Boss/MushBombFall.cs @@ -1,7 +1,9 @@ using CalamityMod.World; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using System; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { @@ -15,14 +17,14 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; + projectile.width = 14; + projectile.height = 14; projectile.hostile = true; projectile.tileCollide = false; projectile.penetrate = 1; projectile.timeLeft = 480; projectile.aiStyle = 1; - aiType = 1; + aiType = ProjectileID.WoodenArrowFriendly; } public override void AI() @@ -49,6 +51,33 @@ namespace CalamityMod.Projectiles.Boss projectile.velocity.X *= 0.99f; } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture = Main.projectileTexture[projectile.type]; + int height = texture.Height / Main.projFrames[projectile.type]; + int drawStart = height * projectile.frame; + Vector2 origin = projectile.Size / 2; + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + spriteEffects = SpriteEffects.FlipHorizontally; + + spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, height)), Color.White, projectile.rotation, origin, projectile.scale, spriteEffects, 0f); + return false; + } + + public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture = Main.projectileTexture[projectile.type]; + int height = texture.Height / Main.projFrames[projectile.type]; + int drawStart = height * projectile.frame; + Vector2 origin = projectile.Size / 2; + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + spriteEffects = SpriteEffects.FlipHorizontally; + + spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Boss/MushBombGlow"), projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, height)), Color.White, projectile.rotation, origin, projectile.scale, spriteEffects, 0f); + } + public override void Kill(int timeLeft) { Main.PlaySound(4, (int)projectile.position.X, (int)projectile.position.Y, 1); diff --git a/Projectiles/Boss/MushBombGlow.png b/Projectiles/Boss/MushBombGlow.png new file mode 100644 index 0000000000..16f1101e32 Binary files /dev/null and b/Projectiles/Boss/MushBombGlow.png differ diff --git a/Projectiles/Boss/ShadeNimbusHostile.png b/Projectiles/Boss/ShadeNimbusHostile.png index 8ed0e6e673..234d306f54 100644 Binary files a/Projectiles/Boss/ShadeNimbusHostile.png and b/Projectiles/Boss/ShadeNimbusHostile.png differ diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 733c1d5776..7f077815ca 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -1229,14 +1229,14 @@ namespace CalamityMod.Projectiles modPlayer.godSlayerDmg += num; } } - else if (projectile.melee) + if (projectile.melee) { if (modPlayer.ataxiaGeyser && player.ownedProjectileCounts[ProjectileType()] < 3) { Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ProjectileType(), CalamityUtils.DamageSoftCap(projectile.damage * 0.15, 35), 0f, projectile.owner, 0f, 0f); } } - else if (rogue) + if (rogue) { if (modPlayer.xerocSet && modPlayer.xerocDmg <= 0 && player.ownedProjectileCounts[ProjectileType()] < 3 && player.ownedProjectileCounts[ProjectileType()] < 3) { @@ -1382,8 +1382,78 @@ namespace CalamityMod.Projectiles } target.AddBuff(BuffID.Venom, 240); } + + if (modPlayer.shadow) + { + if (CalamityMod.javelinProjList.Contains(projectile.type)) + { + int randrot = Main.rand.Next(-30, 391); + Vector2 SoulSpeed = new Vector2(13f, 13f).RotatedBy(MathHelper.ToRadians(randrot)); + Projectile.NewProjectile(projectile.Center, SoulSpeed, ModContent.ProjectileType(), CalamityUtils.DamageSoftCap(projectile.damage * 0.1, 60), 3f, projectile.owner, 0f, 0f); + } + if (CalamityMod.spikyBallProjList.Contains(projectile.type)) + { + int scythe = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), CalamityUtils.DamageSoftCap(projectile.damage * 0.05, 60), 3f, projectile.owner, 0f, 0f); + Main.projectile[scythe].usesLocalNPCImmunity = true; + Main.projectile[scythe].localNPCHitCooldown = 10; + Main.projectile[scythe].penetrate = 2; + } + if (CalamityMod.daggerProjList.Contains(projectile.type)) + { + Vector2 shardVelocity = new Vector2(Main.rand.NextFloat(-1f, 1f), Main.rand.NextFloat(-1f, 1f)); + shardVelocity.Normalize(); + shardVelocity *= 5f; + int shard = Projectile.NewProjectile(projectile.Center, shardVelocity, ModContent.ProjectileType(), CalamityUtils.DamageSoftCap(projectile.damage * 0.15, 60), 0f, projectile.owner); + Main.projectile[shard].timeLeft = 150; + } + if (CalamityMod.boomerangProjList.Contains(projectile.type)) + { + int spiritDamage = CalamityUtils.DamageSoftCap(projectile.damage * 0.2, 60); + int[] numArray1 = new int[Main.maxNPCs]; + int maxValue1 = 0; + int maxValue2 = 0; + for (int index = 0; index < Main.maxNPCs; ++index) + { + if (Main.npc[index].CanBeChasedBy((object)projectile, false)) + { + float num2 = Math.Abs(Main.npc[index].Center.X - projectile.Center.X) + Math.Abs(Main.npc[index].Center.Y - projectile.Center.Y); + if (num2 < 800f) + { + if (Collision.CanHit(projectile.position, 1, 1, Main.npc[index].position, Main.npc[index].width, Main.npc[index].height) && num2 > 50f) + { + numArray1[maxValue2] = index; + ++maxValue2; + } + else if (maxValue2 == 0) + { + numArray1[maxValue1] = index; + ++maxValue1; + } + } + } + } + if (maxValue1 == 0 && maxValue2 == 0) + return; + int num3 = maxValue2 <= 0 ? numArray1[Main.rand.Next(maxValue1)] : numArray1[Main.rand.Next(maxValue2)]; + double num4 = 4.0; + float num5 = (float)Main.rand.Next(-100, 101); + float num6 = (float)Main.rand.Next(-100, 101); + double num7 = Math.Sqrt((double)num5 * (double)num5 + (double)num6 * (double)num6); + float num8 = (float)(num4 / num7); + float SpeedX = num5 * num8; + float SpeedY = num6 * num8; + int ghost = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, SpeedX, SpeedY, ProjectileID.SpectreWrath, spiritDamage, 0f, projectile.owner, (float)num3, 0f); + Main.projectile[ghost].Calamity().forceRogue = true; + Main.projectile[ghost].penetrate = 1; + } + if (CalamityMod.flaskBombProjList.Contains(projectile.type)) + { + int blackhole = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), CalamityUtils.DamageSoftCap(projectile.damage * 0.05, 60), 3f, projectile.owner, 0f, 0f); + Main.projectile[blackhole].Center = projectile.Center; + } + } } - else if (projectile.minion || projectile.sentry || CalamityMod.projectileMinionList.Contains(projectile.type) || ProjectileID.Sets.MinionShot[projectile.type] || ProjectileID.Sets.SentryShot[projectile.type]) + if (projectile.minion || projectile.sentry || CalamityMod.projectileMinionList.Contains(projectile.type) || ProjectileID.Sets.MinionShot[projectile.type] || ProjectileID.Sets.SentryShot[projectile.type]) { if (modPlayer.profanedCrystalBuffs || (modPlayer.pArtifact && !modPlayer.profanedCrystal)) { @@ -1687,9 +1757,7 @@ namespace CalamityMod.Projectiles } value15.Normalize(); value15 *= Main.rand.Next(70, 101) * 0.1f; - int soul = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, ProjectileID.LostSoulFriendly, (int)(projectile.damage * 0.33), 0f, projectile.owner, 0f, 0f); - Main.projectile[soul].Calamity().forceRogue = true; - Main.projectile[soul].timeLeft = 300; + int soul = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, ModContent.ProjectileType(), (int)(projectile.damage * 0.33), 0f, projectile.owner, 0f, 0f); Main.projectile[soul].tileCollide = false; } } diff --git a/Projectiles/Magic/AquamarineBolt.png b/Projectiles/Magic/AquamarineBolt.png index bfb8c86d2a..40a934ca3c 100644 Binary files a/Projectiles/Magic/AquamarineBolt.png and b/Projectiles/Magic/AquamarineBolt.png differ diff --git a/Projectiles/Magic/AtlantisSpear.cs b/Projectiles/Magic/AtlantisSpear.cs index 02d03e37d4..520170fd89 100644 --- a/Projectiles/Magic/AtlantisSpear.cs +++ b/Projectiles/Magic/AtlantisSpear.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using System; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { @@ -21,7 +22,7 @@ namespace CalamityMod.Projectiles.Magic projectile.penetrate = -1; projectile.tileCollide = false; projectile.magic = true; - aiType = 493; + aiType = ProjectileID.CrystalVileShardHead; } public override void AI() @@ -41,14 +42,14 @@ namespace CalamityMod.Projectiles.Magic } if (Main.myPlayer == projectile.owner) { - int num48 = projectile.type; + int projType = projectile.type; if (projectile.ai[1] >= (float)(12 + Main.rand.Next(2))) { - num48 = ModContent.ProjectileType(); + projType = ModContent.ProjectileType(); } - int num49 = projectile.damage; - float num50 = projectile.knockBack; - int number = Projectile.NewProjectile(projectile.position.X + projectile.velocity.X + (float)(projectile.width / 2), projectile.position.Y + projectile.velocity.Y + (float)(projectile.height / 2), projectile.velocity.X, projectile.velocity.Y, num48, num49, num50, projectile.owner, 0f, projectile.ai[1] + 1f); + int dmg = projectile.damage; + float kBack = projectile.knockBack; + int number = Projectile.NewProjectile(projectile.position.X + projectile.velocity.X + (float)(projectile.width / 2), projectile.position.Y + projectile.velocity.Y + (float)(projectile.height / 2), projectile.velocity.X, projectile.velocity.Y, projType, dmg, kBack, projectile.owner, 0f, projectile.ai[1] + 1f); NetMessage.SendData(27, -1, -1, null, number, 0f, 0f, 0f, 0, 0, 0); } } @@ -76,10 +77,7 @@ namespace CalamityMod.Projectiles.Magic } } - public override Color? GetAlpha(Color lightColor) - { - return new Color(200, 200, 200, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, projectile.alpha); public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { @@ -93,7 +91,7 @@ namespace CalamityMod.Projectiles.Magic for (int i = 0; i < numProj; i++) { Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - int projectile2 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, ModContent.ProjectileType(), (int)(double)projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + int projectile2 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); Main.projectile[projectile2].penetrate = 1; } for (int k = 0; k < 3; k++) diff --git a/Projectiles/Magic/AtlantisSpear2.cs b/Projectiles/Magic/AtlantisSpear2.cs index b37baa8cc3..4ac98ae888 100644 --- a/Projectiles/Magic/AtlantisSpear2.cs +++ b/Projectiles/Magic/AtlantisSpear2.cs @@ -1,11 +1,14 @@ using Microsoft.Xna.Framework; using System; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { public class AtlantisSpear2 : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Magic/AtlantisSpear"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Atlantis Spear"); @@ -21,7 +24,7 @@ namespace CalamityMod.Projectiles.Magic projectile.penetrate = -1; projectile.tileCollide = false; projectile.magic = true; - aiType = 494; + aiType = ProjectileID.CrystalVileShardShaft; } public override void AI() @@ -64,10 +67,7 @@ namespace CalamityMod.Projectiles.Magic } } - public override Color? GetAlpha(Color lightColor) - { - return new Color(200, 200, 200, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, projectile.alpha); public override void Kill(int timeLeft) { diff --git a/Projectiles/Magic/AtlantisSpear2.png b/Projectiles/Magic/AtlantisSpear2.png deleted file mode 100644 index 122a12fd18..0000000000 Binary files a/Projectiles/Magic/AtlantisSpear2.png and /dev/null differ diff --git a/Projectiles/Magic/AuraRain.cs b/Projectiles/Magic/AuraRain.cs index cbba29991f..962db31aef 100644 --- a/Projectiles/Magic/AuraRain.cs +++ b/Projectiles/Magic/AuraRain.cs @@ -15,8 +15,8 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; + projectile.width = 14; + projectile.height = 14; projectile.aiStyle = 45; projectile.friendly = true; projectile.penetrate = -1; diff --git a/Projectiles/Magic/AuraRain.png b/Projectiles/Magic/AuraRain.png index f129a7b060..eca4b9bfaf 100644 Binary files a/Projectiles/Magic/AuraRain.png and b/Projectiles/Magic/AuraRain.png differ diff --git a/Projectiles/Magic/AuroraAustralis.cs b/Projectiles/Magic/AuroraAustralis.cs new file mode 100644 index 0000000000..aef879aa5f --- /dev/null +++ b/Projectiles/Magic/AuroraAustralis.cs @@ -0,0 +1,122 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class AuroraAustralis : ModProjectile + { + private static float CosFrequency = 0.05f; + private static float CosAmplitude = 0.008f; + public int[] dustTypes = new int[] + { + ModContent.DustType(), + ModContent.DustType() + }; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aurora Australis"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.tileCollide = false; + projectile.timeLeft = 300; + projectile.magic = true; + projectile.alpha = 255; + + CosFrequency = 0.15f; + CosAmplitude = 0.06f; + } + + public override void AI() + { + // On-spawn effects + if (projectile.ai[0] == 0) + { + // Store the X and Y of the spawn velocity so it can be used for trig calculations + projectile.localAI[0] = projectile.velocity.X; + projectile.localAI[1] = projectile.velocity.Y; + } + + // Doesn't collide with tiles for the first 2 frames + projectile.tileCollide = projectile.ai[0] > 2f; + + // Apply fancy cosine movement, then slight gravity, then cap velocity. + // Original velocity is reconstructed so that it can be used in the calculation + Vector2 originalVelocity = new Vector2(projectile.localAI[0], projectile.localAI[1]); + ApplyCosVelocity(originalVelocity); + float currentSpeed = projectile.velocity.Length(); + float maxSpeed = 1.4f * originalVelocity.Length(); + if (currentSpeed > maxSpeed) + projectile.velocity *= maxSpeed / currentSpeed; + + // spawn dust + if (Main.rand.NextBool(5)) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, Main.rand.Next(dustTypes), projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + int rainbow = Dust.NewDust(projectile.Center, projectile.width, projectile.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); + Dust dust = Main.dust[rainbow]; + dust.velocity *= 0.1f; + dust.velocity += projectile.velocity * 0.2f; + dust.position.X = projectile.Center.X + 4f + Main.rand.Next(-2, 3); + dust.position.Y = projectile.Center.Y + Main.rand.Next(-2, 3); + dust.noGravity = true; + + if (projectile.timeLeft % 10 == 0 && Main.myPlayer == projectile.owner) //spawn stars every 10 ticks + { + if (Main.player[projectile.owner].ownedProjectileCounts[ModContent.ProjectileType()] < 30) + { + float dmgKBMult = Main.rand.NextFloat(0.25f, 0.75f); + float xStart = projectile.Center.X + projectile.velocity.X; + float yStart = projectile.Center.Y - Main.rand.Next(500, 800); + Vector2 startPos = new Vector2(xStart, yStart); + Vector2 velocity = projectile.Center - startPos; + velocity.X += (float)Main.rand.Next(-100, 101); + float travelDist = velocity.Length(); + float starSpeed = Main.rand.NextFloat(10f, 20f); + travelDist = starSpeed / travelDist; + velocity.X *= travelDist; + velocity.Y *= travelDist; + int star = Projectile.NewProjectile(startPos, velocity, ModContent.ProjectileType(), (int)(projectile.damage * dmgKBMult), projectile.knockBack * dmgKBMult, projectile.owner, 0f, 0f); + Main.projectile[star].timeLeft = 120; + } + } + + projectile.ai[0]++; + } + + private void ApplyCosVelocity(Vector2 baseVelocity) + { + float radians = -(-MathHelper.PiOver2 + CosFrequency * projectile.ai[0]); + projectile.velocity += CosAmplitude * baseVelocity.RotatedBy(radians); + } + + public override void Kill(int timeLeft) + { + for (int i = 0; i <= 5; i++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, Main.rand.Next(dustTypes), projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 180); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 180); + } + } +} diff --git a/Projectiles/Magic/AuroraAustralis.png b/Projectiles/Magic/AuroraAustralis.png new file mode 100644 index 0000000000..983260eb07 Binary files /dev/null and b/Projectiles/Magic/AuroraAustralis.png differ diff --git a/Projectiles/Magic/BeamingBolt.cs b/Projectiles/Magic/BeamingBolt.cs index 1f3fad32c1..2c275ea636 100644 --- a/Projectiles/Magic/BeamingBolt.cs +++ b/Projectiles/Magic/BeamingBolt.cs @@ -1,4 +1,6 @@ -using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic @@ -12,34 +14,38 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; + projectile.width = 30; + projectile.height = 30; projectile.friendly = true; - projectile.alpha = 255; + projectile.alpha = 0; projectile.timeLeft = 120; projectile.penetrate = -1; projectile.magic = true; } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + if (projectile.ai[0] == 1f) + tex = ModContent.GetTexture("CalamityMod/Projectiles/Magic/BeamingThornBlossom"); + + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } + public override void AI() { + projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; projectile.velocity.X *= 0.95f; projectile.velocity.Y *= 0.985f; - for (int dust = 0; dust < 3; dust++) + for (int dust = 0; dust < 2; dust++) { - int randomDust = Main.rand.Next(3); - if (randomDust == 0) - { - randomDust = 164; - } - else if (randomDust == 1) - { - randomDust = 58; - } - else - { - randomDust = 204; - } + int randomDust = Utils.SelectRandom(Main.rand, new int[] + { + 164, + 58, + 204 + }); Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, randomDust, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); } } @@ -48,33 +54,25 @@ namespace CalamityMod.Projectiles.Magic { for (int k = 0; k < 6; k++) { - int randomDust = Main.rand.Next(3); - if (randomDust == 0) - { - randomDust = 164; - } - else if (randomDust == 1) - { - randomDust = 58; - } - else - { - randomDust = 204; - } + int randomDust = Utils.SelectRandom(Main.rand, new int[] + { + 164, + 58, + 204 + }); Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, randomDust, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); } float spread = 90f * 0.0174f; double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; double deltaAngle = spread / 8f; double offsetAngle; - int i; if (projectile.owner == Main.myPlayer) { - for (i = 0; i < 4; i++) + for (int i = 0; i < 4; i++) { offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)((double)projectile.damage * 0.75f), projectile.knockBack, projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)((double)projectile.damage * 0.75f), projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(projectile.damage * 0.75), projectile.knockBack, projectile.owner, projectile.ai[0], 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(projectile.damage * 0.75), projectile.knockBack, projectile.owner, projectile.ai[0], 0f); } } Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 105); diff --git a/Projectiles/Magic/BeamingBolt.png b/Projectiles/Magic/BeamingBolt.png index ead80128fa..67398b6d32 100644 Binary files a/Projectiles/Magic/BeamingBolt.png and b/Projectiles/Magic/BeamingBolt.png differ diff --git a/Projectiles/Magic/BeamingBolt2.cs b/Projectiles/Magic/BeamingBolt2.cs index 7d02d3585c..98692f6227 100644 --- a/Projectiles/Magic/BeamingBolt2.cs +++ b/Projectiles/Magic/BeamingBolt2.cs @@ -1,4 +1,5 @@ using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using System; using Terraria; using Terraria.ModLoader; @@ -13,34 +14,35 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; + projectile.width = 14; + projectile.height = 14; projectile.friendly = true; - projectile.alpha = 255; + projectile.alpha = 0; projectile.timeLeft = 120; projectile.penetrate = 1; projectile.magic = true; } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + if (projectile.ai[0] == 1f) + tex = ModContent.GetTexture("CalamityMod/Projectiles/Magic/BeamingThorn"); + + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } + public override void AI() { - for (int dust = 0; dust < 2; dust++) - { - int randomDust = Main.rand.Next(3); - if (randomDust == 0) - { - randomDust = 164; - } - else if (randomDust == 1) - { - randomDust = 58; - } - else - { - randomDust = 204; - } - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, randomDust, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + MathHelper.PiOver2; + int randomDust = Utils.SelectRandom(Main.rand, new int[] + { + 164, + 58, + 204 + }); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, randomDust, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 400f, 20f, 20f); } @@ -49,19 +51,12 @@ namespace CalamityMod.Projectiles.Magic { for (int k = 0; k < 3; k++) { - int randomDust = Main.rand.Next(3); - if (randomDust == 0) - { - randomDust = 164; - } - else if (randomDust == 1) - { - randomDust = 58; - } - else - { - randomDust = 204; - } + int randomDust = Utils.SelectRandom(Main.rand, new int[] + { + 164, + 58, + 204 + }); Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, randomDust, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); } } diff --git a/Projectiles/Magic/BeamingBolt2.png b/Projectiles/Magic/BeamingBolt2.png index ead80128fa..a5bb2180ed 100644 Binary files a/Projectiles/Magic/BeamingBolt2.png and b/Projectiles/Magic/BeamingBolt2.png differ diff --git a/Projectiles/Magic/BeamingThorn.png b/Projectiles/Magic/BeamingThorn.png new file mode 100644 index 0000000000..fb727bcd21 Binary files /dev/null and b/Projectiles/Magic/BeamingThorn.png differ diff --git a/Projectiles/Magic/BeamingThornBlossom.png b/Projectiles/Magic/BeamingThornBlossom.png new file mode 100644 index 0000000000..260283e5c6 Binary files /dev/null and b/Projectiles/Magic/BeamingThornBlossom.png differ diff --git a/Projectiles/Magic/BloodBeam.cs b/Projectiles/Magic/BloodBeam.cs index 666aa2f211..a06b8f6c3e 100644 --- a/Projectiles/Magic/BloodBeam.cs +++ b/Projectiles/Magic/BloodBeam.cs @@ -1,5 +1,7 @@ using Microsoft.Xna.Framework; +using System; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { @@ -27,46 +29,39 @@ namespace CalamityMod.Projectiles.Magic Lighting.AddLight(projectile.Center, 0.35f, 0f, 0f); if (projectile.ai[0] > 7f) { - float num296 = 1f; + float scalar = 1f; if (projectile.ai[0] == 8f) { - num296 = 0.25f; + scalar = 0.25f; } else if (projectile.ai[0] == 9f) { - num296 = 0.5f; + scalar = 0.5f; } else if (projectile.ai[0] == 10f) { - num296 = 0.75f; + scalar = 0.75f; } projectile.ai[0] += 1f; - int num297 = 5; - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); + int dustType = DustID.Blood; + int blood = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); + Dust dust = Main.dust[blood]; if (Main.rand.NextBool(3)) { - Main.dust[num299].noGravity = true; - Main.dust[num299].scale *= 3.5f; - Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X *= 2f; - Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y *= 2f; + dust.noGravity = true; + dust.scale *= 2f; + dust.velocity.X *= 2f; + dust.velocity.Y *= 2f; } - else - { - Main.dust[num299].scale *= 1.25f; - } - Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X *= 1.2f; - Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y *= 1.2f; - Main.dust[num299].scale *= num296; + dust.velocity.X *= 1.2f; + dust.velocity.Y *= 1.2f; + dust.scale *= scalar; } else { projectile.ai[0] += 1f; } - projectile.rotation += 0.3f * (float)projectile.direction; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) - MathHelper.PiOver2; } } } diff --git a/Projectiles/Magic/BloodBeam.png b/Projectiles/Magic/BloodBeam.png index 04c5646fde..e83f86438b 100644 Binary files a/Projectiles/Magic/BloodBeam.png and b/Projectiles/Magic/BloodBeam.png differ diff --git a/Projectiles/Magic/BrimstoneFireball.cs b/Projectiles/Magic/BrimstoneFireball.cs index 0d6960cbe4..6a796fb74c 100644 --- a/Projectiles/Magic/BrimstoneFireball.cs +++ b/Projectiles/Magic/BrimstoneFireball.cs @@ -1,6 +1,8 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,17 +13,17 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Fireball"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; + projectile.width = 20; + projectile.height = 20; projectile.friendly = true; projectile.magic = true; - projectile.aiStyle = 1; projectile.penetrate = 4; - aiType = ProjectileID.ThornBall; projectile.timeLeft = 300; } @@ -33,30 +35,46 @@ namespace CalamityMod.Projectiles.Magic projectile.Kill(); if (projectile.owner == Main.myPlayer) { - int num251 = Main.rand.Next(2, 4); - for (int num252 = 0; num252 < num251; num252++) + int fireballAmt = Main.rand.Next(2, 4); + for (int j = 0; j < fireballAmt; j++) { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, -51)); - while (value15.X == 0f) + Vector2 velocity = new Vector2(Main.rand.NextFloat(-100f, 100f), Main.rand.NextFloat(-100f, -50f)); + while (velocity.X == 0f) { - value15.X = (float)Main.rand.Next(-100, 101); + velocity.X = (float)Main.rand.Next(-100, 101); } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), value15.X, value15.Y, ModContent.ProjectileType(), projectile.damage, 0f, projectile.owner, 0f, 0f); + velocity.Normalize(); + velocity *= Main.rand.NextFloat(70f, 100f) * 0.1f; + Projectile.NewProjectile(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), velocity.X, velocity.Y, ModContent.ProjectileType(), projectile.damage, 0f, projectile.owner, 0f, 0f); } } } projectile.localAI[0] += 1f; if (projectile.localAI[0] > 4f) { - for (int num468 = 0; num468 < 5; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } + int brimstone = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + Main.dust[brimstone].noGravity = true; + Main.dust[brimstone].velocity *= 0f; } + projectile.ai[0] += 1f; + if (projectile.ai[0] > 5f) + { + projectile.ai[0] = 5f; + if (projectile.velocity.Y == 0.0 && projectile.velocity.X != 0.0) + { + projectile.velocity.X *= 0.97f; + if (projectile.velocity.X > -0.01f && projectile.velocity.X < 0.01f) + { + projectile.velocity.X = 0f; + projectile.netUpdate = true; + } + } + projectile.velocity.Y += 0.2f; + projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.1f * projectile.direction; + } + if (projectile.velocity.Y <= 16f) + return; + projectile.velocity.Y = 16f; } public override bool OnTileCollide(Vector2 oldVelocity) @@ -83,6 +101,12 @@ namespace CalamityMod.Projectiles.Magic return false; } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + public override void Kill(int timeLeft) { Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); diff --git a/Projectiles/Magic/BrimstoneFireball.png b/Projectiles/Magic/BrimstoneFireball.png index ead80128fa..62d616a8c1 100644 Binary files a/Projectiles/Magic/BrimstoneFireball.png and b/Projectiles/Magic/BrimstoneFireball.png differ diff --git a/Projectiles/Magic/BrimstoneHomer.cs b/Projectiles/Magic/BrimstoneHomer.cs index f5100def5e..ce8707b029 100644 --- a/Projectiles/Magic/BrimstoneHomer.cs +++ b/Projectiles/Magic/BrimstoneHomer.cs @@ -15,8 +15,8 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; + projectile.width = 8; + projectile.height = 8; projectile.friendly = true; projectile.magic = true; projectile.ignoreWater = true; @@ -27,11 +27,10 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - for (int num468 = 0; num468 < 2; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1f); - Main.dust[num469].noGravity = true; - } + projectile.rotation += 0.7f * projectile.direction; + + int brimstone = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1f); + Main.dust[brimstone].noGravity = true; CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 500f, 8f, 20f); } diff --git a/Projectiles/Magic/BrimstoneHomer.png b/Projectiles/Magic/BrimstoneHomer.png index 15e8775737..282b689545 100644 Binary files a/Projectiles/Magic/BrimstoneHomer.png and b/Projectiles/Magic/BrimstoneHomer.png differ diff --git a/Projectiles/Magic/ClamorNoctusStar.png b/Projectiles/Magic/ClamorNoctusStar.png index 2edc75ddf5..1db97cb7ea 100644 Binary files a/Projectiles/Magic/ClamorNoctusStar.png and b/Projectiles/Magic/ClamorNoctusStar.png differ diff --git a/Projectiles/Magic/ClamorNoctusWyvern.png b/Projectiles/Magic/ClamorNoctusWyvern.png index eb819297e5..7a244dd21c 100644 Binary files a/Projectiles/Magic/ClamorNoctusWyvern.png and b/Projectiles/Magic/ClamorNoctusWyvern.png differ diff --git a/Projectiles/Magic/Crescent.png b/Projectiles/Magic/Crescent.png index 38aef93175..6d0844d54a 100644 Binary files a/Projectiles/Magic/Crescent.png and b/Projectiles/Magic/Crescent.png differ diff --git a/Projectiles/Magic/GleamingBolt.cs b/Projectiles/Magic/GleamingBolt.cs index a8e9ac5dd6..e5521a429b 100644 --- a/Projectiles/Magic/GleamingBolt.cs +++ b/Projectiles/Magic/GleamingBolt.cs @@ -12,10 +12,10 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; + projectile.width = 26; + projectile.height = 26; projectile.friendly = true; - projectile.alpha = 255; + projectile.alpha = 0; projectile.timeLeft = 250; projectile.penetrate = 1; projectile.magic = true; @@ -23,19 +23,16 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { + projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; projectile.velocity.X *= 0.985f; projectile.velocity.Y *= 0.985f; - for (int dust = 0; dust < 3; dust++) + for (int dust = 0; dust < 2; dust++) { - int randomDust = Main.rand.Next(2); - if (randomDust == 0) - { - randomDust = 64; - } - else - { - randomDust = 204; - } + int randomDust = Utils.SelectRandom(Main.rand, new int[] + { + 64, + 204 + }); Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, randomDust, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); } } @@ -44,29 +41,24 @@ namespace CalamityMod.Projectiles.Magic { for (int k = 0; k < 5; k++) { - int randomDust = Main.rand.Next(2); - if (randomDust == 0) - { - randomDust = 64; - } - else - { - randomDust = 204; - } + int randomDust = Utils.SelectRandom(Main.rand, new int[] + { + 64, + 204 + }); Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, randomDust, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); } float spread = 90f * 0.0174f; double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; double deltaAngle = spread / 8f; double offsetAngle; - int i; if (projectile.owner == Main.myPlayer) { - for (i = 0; i < 3; i++) + for (int i = 0; i < 3; i++) { offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)((double)projectile.damage * 0.75), projectile.knockBack, projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)((double)projectile.damage * 0.75), projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(projectile.damage * 0.75), projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(projectile.damage * 0.75), projectile.knockBack, projectile.owner, 0f, 0f); } } Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 105); diff --git a/Projectiles/Magic/GleamingBolt.png b/Projectiles/Magic/GleamingBolt.png index ead80128fa..c0bc5ebe68 100644 Binary files a/Projectiles/Magic/GleamingBolt.png and b/Projectiles/Magic/GleamingBolt.png differ diff --git a/Projectiles/Magic/GleamingBolt2.cs b/Projectiles/Magic/GleamingBolt2.cs index 66429d43f8..6e9532b445 100644 --- a/Projectiles/Magic/GleamingBolt2.cs +++ b/Projectiles/Magic/GleamingBolt2.cs @@ -1,4 +1,6 @@ -using Terraria; +using Microsoft.Xna.Framework; +using System; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { @@ -11,10 +13,10 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; + projectile.width = 14; + projectile.height = 14; projectile.friendly = true; - projectile.alpha = 255; + projectile.alpha = 0; projectile.timeLeft = 120; projectile.penetrate = 1; projectile.magic = true; @@ -22,21 +24,15 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + MathHelper.PiOver2; projectile.velocity.X *= 0.985f; projectile.velocity.Y *= 0.985f; - for (int dust = 0; dust < 2; dust++) - { - int randomDust = Main.rand.Next(2); - if (randomDust == 0) - { - randomDust = 64; - } - else - { - randomDust = 204; - } - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, randomDust, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } + int randomDust = Utils.SelectRandom(Main.rand, new int[] + { + 64, + 204 + }); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, randomDust, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); } public override void Kill(int timeLeft) diff --git a/Projectiles/Magic/GleamingBolt2.png b/Projectiles/Magic/GleamingBolt2.png index ead80128fa..2a3ae9e470 100644 Binary files a/Projectiles/Magic/GleamingBolt2.png and b/Projectiles/Magic/GleamingBolt2.png differ diff --git a/Projectiles/Magic/GraniteEnergy.cs b/Projectiles/Magic/GraniteEnergy.cs index d269f3af25..b924ca6b51 100644 --- a/Projectiles/Magic/GraniteEnergy.cs +++ b/Projectiles/Magic/GraniteEnergy.cs @@ -13,8 +13,8 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 6; - projectile.height = 6; + projectile.width = 12; + projectile.height = 12; projectile.friendly = true; projectile.penetrate = 1; projectile.tileCollide = true; @@ -24,7 +24,9 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 229, 0f, 0f, 100, default, 0.6f); + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + MathHelper.ToRadians(90); + if (Main.rand.NextBool(2)) + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 229, 0f, 0f, 100, default, 0.6f); CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 500f, 22f, 20f); } diff --git a/Projectiles/Magic/GraniteEnergy.png b/Projectiles/Magic/GraniteEnergy.png index a3192f9461..f49fec4516 100644 Binary files a/Projectiles/Magic/GraniteEnergy.png and b/Projectiles/Magic/GraniteEnergy.png differ diff --git a/Projectiles/Magic/GranitePulse.cs b/Projectiles/Magic/GranitePulse.cs index 2c1bd265d8..349bc7bda1 100644 --- a/Projectiles/Magic/GranitePulse.cs +++ b/Projectiles/Magic/GranitePulse.cs @@ -1,4 +1,5 @@ using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using System; using Terraria; using Terraria.ModLoader; @@ -11,12 +12,13 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Pulse"); + Main.projFrames[projectile.type] = 6; } public override void SetDefaults() { - projectile.width = 6; - projectile.height = 6; + projectile.width = 40; + projectile.height = 46; projectile.friendly = true; projectile.ignoreWater = true; projectile.tileCollide = false; @@ -27,6 +29,24 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { + projectile.velocity = new Vector2(0f, (float)Math.Sin((double)(6.28318548f * projectile.ai[0] / 300f)) * 0.5f); + projectile.ai[0] += 1f; + if (projectile.ai[0] >= 300f) + { + projectile.ai[0] = 0f; + projectile.netUpdate = true; + } + + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= Main.projFrames[projectile.type]) + { + projectile.frame = 0; + } projectile.ai[1] += 1f; if (projectile.ai[1] >= 7200f) { @@ -124,10 +144,9 @@ namespace CalamityMod.Projectiles.Magic double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; double deltaAngle = spread / 8f; double offsetAngle; - int i; if (projectile.owner == Main.myPlayer) { - for (i = 0; i < 4; i++) + for (int i = 0; i < 4; i++) { offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); @@ -136,5 +155,17 @@ namespace CalamityMod.Projectiles.Magic } } } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture = Main.projectileTexture[projectile.type]; + int height = texture.Height / Main.projFrames[projectile.type]; + int frameHeight = height * projectile.frame; + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + spriteEffects = SpriteEffects.FlipHorizontally; + Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, frameHeight, texture.Width, height)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture.Width / 2f, (float)height / 2f), projectile.scale, spriteEffects, 0f); + return false; + } } } diff --git a/Projectiles/Magic/GranitePulse.png b/Projectiles/Magic/GranitePulse.png index a3192f9461..f6b69d417b 100644 Binary files a/Projectiles/Magic/GranitePulse.png and b/Projectiles/Magic/GranitePulse.png differ diff --git a/Projectiles/Magic/HellwingPillar.cs b/Projectiles/Magic/HellwingPillar.cs index 41eea0e07b..db0af81273 100644 --- a/Projectiles/Magic/HellwingPillar.cs +++ b/Projectiles/Magic/HellwingPillar.cs @@ -1,4 +1,6 @@ using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,12 +12,15 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Pillar"); + Main.projFrames[projectile.type] = 3; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; + projectile.width = 26; + projectile.height = 26; projectile.friendly = true; projectile.ignoreWater = true; projectile.tileCollide = false; @@ -27,64 +32,70 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.25f / 255f, (255 - projectile.alpha) * 0.05f / 255f, (255 - projectile.alpha) * 0.05f / 255f); - if (projectile.timeLeft > 90) + projectile.frameCounter++; + if (projectile.frameCounter > 4) { - projectile.timeLeft = 90; + projectile.frame++; + projectile.frameCounter = 0; } + if (projectile.frame >= Main.projFrames[projectile.type]) + { + projectile.frame = 0; + } + Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.25f / 255f, (255 - projectile.alpha) * 0.05f / 255f, (255 - projectile.alpha) * 0.05f / 255f); if (projectile.ai[0] > 7f) { - float num296 = 1f; + float scalar = 1f; if (projectile.ai[0] == 8f) { - num296 = 0.25f; + scalar = 0.25f; } else if (projectile.ai[0] == 9f) { - num296 = 0.5f; + scalar = 0.5f; } else if (projectile.ai[0] == 10f) { - num296 = 0.75f; + scalar = 0.75f; } projectile.ai[0] += 1f; int num297 = 127; - if (Main.rand.NextBool(2)) + if (Main.rand.NextBool(3)) { - for (int num298 = 0; num298 < 1; num298++) - { - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); - if (Main.rand.NextBool(3)) - { - Main.dust[num299].noGravity = true; - Main.dust[num299].scale *= 3f; - Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X *= 2f; - Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y *= 2f; - } - else - { - Main.dust[num299].scale *= 1.5f; - } - Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X *= 1.2f; - Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y *= 1.2f; - Main.dust[num299].scale *= num296; - } + int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); + Dust dust = Main.dust[num299]; + if (Main.rand.NextBool(3)) + { + dust.noGravity = true; + dust.scale *= 2f; + dust.velocity.X *= 2f; + dust.velocity.Y *= 2f; + } + else + { + dust.scale *= 1.5f; + } + dust.velocity.X *= 1.2f; + dust.velocity.Y *= 1.2f; + dust.scale *= scalar; } } else { projectile.ai[0] += 1f; } - projectile.rotation += 0.3f * (float)projectile.direction; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) - MathHelper.PiOver2; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(BuffID.OnFire, 600); } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } } } diff --git a/Projectiles/Magic/HellwingPillar.png b/Projectiles/Magic/HellwingPillar.png index 04c5646fde..d1b30af298 100644 Binary files a/Projectiles/Magic/HellwingPillar.png and b/Projectiles/Magic/HellwingPillar.png differ diff --git a/Projectiles/Magic/IonBlast.cs b/Projectiles/Magic/IonBlast.cs index 81e8ac1428..1a13ca1d51 100644 --- a/Projectiles/Magic/IonBlast.cs +++ b/Projectiles/Magic/IonBlast.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + MathHelper.PiOver2; projectile.velocity.X *= 1.015f; projectile.velocity.Y *= 1.015f; if (projectile.alpha > 0) diff --git a/Projectiles/Magic/MagnusBeam.cs b/Projectiles/Magic/MagnusBeam.cs index 6753af189e..cfacbdbd4a 100644 --- a/Projectiles/Magic/MagnusBeam.cs +++ b/Projectiles/Magic/MagnusBeam.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -21,11 +22,12 @@ namespace CalamityMod.Projectiles.Magic projectile.ignoreWater = true; projectile.penetrate = 1; projectile.extraUpdates = 2; - projectile.alpha = 255; + projectile.alpha = 0; } public override void AI() { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); float num29 = 5f; float num30 = 150f; float scaleFactor = 6f; @@ -131,34 +133,28 @@ namespace CalamityMod.Projectiles.Magic } if (Main.rand.NextBool(12)) { - for (int num43 = 0; num43 < 1; num43++) - { - Vector2 value9 = -Vector2.UnitX.RotatedByRandom(0.19634954631328583).RotatedBy((double)projectile.velocity.ToRotation(), default); - int num44 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 234, 0f, 0f, 100, default, 1f); - Main.dust[num44].velocity *= 0.1f; - Main.dust[num44].position = projectile.Center + value9 * (float)projectile.width / 2f + projectile.velocity * 2f; - Main.dust[num44].fadeIn = 0.9f; - } + Vector2 value9 = -Vector2.UnitX.RotatedByRandom(0.2).RotatedBy((double)projectile.velocity.ToRotation(), default); + int num44 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 234, 0f, 0f, 100, default, 1f); + Main.dust[num44].velocity *= 0.1f; + Main.dust[num44].position = projectile.Center + value9 * (float)projectile.width / 2f + projectile.velocity * 2f; + Main.dust[num44].fadeIn = 0.9f; } if (Main.rand.NextBool(64)) { - for (int num45 = 0; num45 < 1; num45++) - { - Vector2 value10 = -Vector2.UnitX.RotatedByRandom(0.39269909262657166).RotatedBy((double)projectile.velocity.ToRotation(), default); - int num46 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 234, 0f, 0f, 155, default, 0.8f); - Main.dust[num46].velocity *= 0.3f; - Main.dust[num46].position = projectile.Center + value10 * (float)projectile.width / 2f; - if (Main.rand.NextBool(2)) - { - Main.dust[num46].fadeIn = 1.4f; - } - } + Vector2 value10 = -Vector2.UnitX.RotatedByRandom(0.4).RotatedBy((double)projectile.velocity.ToRotation(), default); + int num46 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 234, 0f, 0f, 155, default, 0.8f); + Main.dust[num46].velocity *= 0.3f; + Main.dust[num46].position = projectile.Center + value10 * (float)projectile.width / 2f; + if (Main.rand.NextBool(2)) + { + Main.dust[num46].fadeIn = 1.4f; + } } if (Main.rand.NextBool(4)) { for (int num47 = 0; num47 < 2; num47++) { - Vector2 value11 = -Vector2.UnitX.RotatedByRandom(0.78539818525314331).RotatedBy((double)projectile.velocity.ToRotation(), default); + Vector2 value11 = -Vector2.UnitX.RotatedByRandom(0.8).RotatedBy((double)projectile.velocity.ToRotation(), default); int num48 = Dust.NewDust(projectile.position, projectile.width, projectile.height, num33, 0f, 0f, 0, default, 1.2f); Main.dust[num48].velocity *= 0.3f; Main.dust[num48].noGravity = true; @@ -171,7 +167,7 @@ namespace CalamityMod.Projectiles.Magic } if (Main.rand.NextBool(3)) { - Vector2 value13 = -Vector2.UnitX.RotatedByRandom(0.19634954631328583).RotatedBy((double)projectile.velocity.ToRotation(), default); + Vector2 value13 = -Vector2.UnitX.RotatedByRandom(0.2).RotatedBy((double)projectile.velocity.ToRotation(), default); int num50 = Dust.NewDust(projectile.position, projectile.width, projectile.height, num34, 0f, 0f, 100, default, 1f); Main.dust[num50].velocity *= 0.3f; Main.dust[num50].position = projectile.Center + value13 * (float)projectile.width / 2f; @@ -180,7 +176,7 @@ namespace CalamityMod.Projectiles.Magic Main.dust[num50].noGravity = true; } Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.25f / 255f, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0.25f / 255f); - for (int num151 = 0; num151 < 3; num151++) + for (int num151 = 0; num151 < 2; num151++) { int num154 = 14; int num155 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width - num154 * 2, projectile.height - num154 * 2, 263, 0f, 0f, 100, default, 1.35f); @@ -245,8 +241,7 @@ namespace CalamityMod.Projectiles.Magic projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 10; projectile.Damage(); - int num3; - for (int num53 = 0; num53 < 40; num53 = num3 + 1) + for (int num53 = 0; num53 < 40; num53++) { num47 = Utils.SelectRandom(Main.rand, new int[] { @@ -257,33 +252,27 @@ namespace CalamityMod.Projectiles.Magic 181 }); int num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num47, 0f, 0f, 200, default, num50); - Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; - Main.dust[num54].noGravity = true; Dust dust = Main.dust[num54]; + dust.position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + dust.noGravity = true; dust.velocity *= 3f; - dust = Main.dust[num54]; dust.velocity += value4 * Main.rand.NextFloat(); num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num48, 0f, 0f, 100, default, num51); - Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; - dust = Main.dust[num54]; + dust.position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; dust.velocity *= 2f; - Main.dust[num54].noGravity = true; - Main.dust[num54].fadeIn = 1f; - Main.dust[num54].color = Color.Crimson * 0.5f; - dust = Main.dust[num54]; + dust.noGravity = true; + dust.fadeIn = 1f; + dust.color = Color.Crimson * 0.5f; dust.velocity += value4 * Main.rand.NextFloat(); - num3 = num53; } - for (int num55 = 0; num55 < 20; num55 = num3 + 1) + for (int num55 = 0; num55 < 20; num55++) { int num56 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num49, 0f, 0f, 0, default, num52); - Main.dust[num56].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default) * (float)projectile.width / 3f; - Main.dust[num56].noGravity = true; Dust dust = Main.dust[num56]; + dust.position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default) * (float)projectile.width / 3f; + dust.noGravity = true; dust.velocity *= 0.5f; - dust = Main.dust[num56]; dust.velocity += value4 * (0.6f + 0.6f * Main.rand.NextFloat()); - num3 = num55; } } } diff --git a/Projectiles/Magic/MagnusBeam.png b/Projectiles/Magic/MagnusBeam.png index 0056fc1e24..c84df1c661 100644 Binary files a/Projectiles/Magic/MagnusBeam.png and b/Projectiles/Magic/MagnusBeam.png differ diff --git a/Projectiles/Magic/ManaBolt.cs b/Projectiles/Magic/ManaBolt.cs index e16d4096d3..184255ed6f 100644 --- a/Projectiles/Magic/ManaBolt.cs +++ b/Projectiles/Magic/ManaBolt.cs @@ -12,10 +12,10 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; + projectile.width = 24; + projectile.height = 24; projectile.friendly = true; - projectile.alpha = 255; + projectile.alpha = 0; projectile.penetrate = 1; projectile.timeLeft = 180; projectile.magic = true; @@ -23,10 +23,15 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { + projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; projectile.velocity.X *= 0.985f; projectile.velocity.Y *= 0.985f; - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 15, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 107, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + int randomDust = Utils.SelectRandom(Main.rand, new int[] + { + 15, + 107 + }); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, randomDust, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); } public override void Kill(int timeLeft) @@ -40,14 +45,13 @@ namespace CalamityMod.Projectiles.Magic double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; double deltaAngle = spread / 8f; double offsetAngle; - int i; if (projectile.owner == Main.myPlayer) { - for (i = 0; i < 3; i++) + for (int i = 0; i < 3; i++) { offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)((double)projectile.damage * 0.5f), projectile.knockBack, projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)((double)projectile.damage * 0.5f), projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(projectile.damage * 0.5), projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(projectile.damage * 0.5), projectile.knockBack, projectile.owner, 0f, 0f); } } Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); diff --git a/Projectiles/Magic/ManaBolt.png b/Projectiles/Magic/ManaBolt.png index 5188920caa..6944830e40 100644 Binary files a/Projectiles/Magic/ManaBolt.png and b/Projectiles/Magic/ManaBolt.png differ diff --git a/Projectiles/Magic/ManaBoltSmall.cs b/Projectiles/Magic/ManaBoltSmall.cs index db242c9e71..fa9fb3df1d 100644 --- a/Projectiles/Magic/ManaBoltSmall.cs +++ b/Projectiles/Magic/ManaBoltSmall.cs @@ -1,4 +1,6 @@ -using Terraria; +using Microsoft.Xna.Framework; +using System; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { @@ -11,10 +13,10 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 6; - projectile.height = 6; + projectile.width = 10; + projectile.height = 10; projectile.friendly = true; - projectile.alpha = 255; + projectile.alpha = 0; projectile.penetrate = 1; projectile.timeLeft = 60; projectile.magic = true; @@ -22,9 +24,11 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + MathHelper.PiOver2; projectile.velocity.X *= 0.975f; projectile.velocity.Y *= 0.975f; - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 15, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + if (Main.rand.NextBool(2)) + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 15, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); } public override void Kill(int timeLeft) diff --git a/Projectiles/Magic/ManaBoltSmall.png b/Projectiles/Magic/ManaBoltSmall.png index a3192f9461..9fb9bb7677 100644 Binary files a/Projectiles/Magic/ManaBoltSmall.png and b/Projectiles/Magic/ManaBoltSmall.png differ diff --git a/Projectiles/Magic/ManaBoltSmall2.cs b/Projectiles/Magic/ManaBoltSmall2.cs index bfc5cbcccd..db5781dd73 100644 --- a/Projectiles/Magic/ManaBoltSmall2.cs +++ b/Projectiles/Magic/ManaBoltSmall2.cs @@ -1,4 +1,6 @@ -using Terraria; +using Microsoft.Xna.Framework; +using System; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { @@ -11,10 +13,10 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 6; - projectile.height = 6; + projectile.width = 10; + projectile.height = 10; projectile.friendly = true; - projectile.alpha = 255; + projectile.alpha = 0; projectile.penetrate = 1; projectile.timeLeft = 60; projectile.magic = true; @@ -22,9 +24,11 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + MathHelper.PiOver2; projectile.velocity.X *= 0.975f; projectile.velocity.Y *= 0.975f; - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 107, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + if (Main.rand.NextBool(2)) + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 107, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); } public override void Kill(int timeLeft) diff --git a/Projectiles/Magic/ManaBoltSmall2.png b/Projectiles/Magic/ManaBoltSmall2.png index a3192f9461..9fb9bb7677 100644 Binary files a/Projectiles/Magic/ManaBoltSmall2.png and b/Projectiles/Magic/ManaBoltSmall2.png differ diff --git a/Projectiles/Magic/PhantasmalFuryProj.cs b/Projectiles/Magic/PhantasmalFuryProj.cs index c34d016372..0a5f132992 100644 --- a/Projectiles/Magic/PhantasmalFuryProj.cs +++ b/Projectiles/Magic/PhantasmalFuryProj.cs @@ -1,6 +1,8 @@ using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using System; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { @@ -9,12 +11,15 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Fury"); + Main.projFrames[projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; + projectile.width = 16; + projectile.height = 16; projectile.friendly = true; projectile.ignoreWater = true; projectile.penetrate = 1; @@ -24,6 +29,16 @@ namespace CalamityMod.Projectiles.Magic 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.timeLeft % 10 == 0) { if (projectile.owner == Main.myPlayer) @@ -32,13 +47,15 @@ namespace CalamityMod.Projectiles.Magic } } Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.25f / 255f, (255 - projectile.alpha) * 0.25f / 255f, (255 - projectile.alpha) * 0.25f / 255f); - for (int num457 = 0; num457 < 5; num457++) + for (int num457 = 0; num457 < 3; num457++) { int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 175, 0f, 0f, 100, default, 2f); Main.dust[num458].noGravity = true; Main.dust[num458].velocity *= 0.5f; Main.dust[num458].velocity += projectile.velocity * 0.1f; } + projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); + projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); } public override void Kill(int timeLeft) @@ -52,10 +69,9 @@ namespace CalamityMod.Projectiles.Magic double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; double deltaAngle = spread / 8f; double offsetAngle; - int i; if (projectile.owner == Main.myPlayer) { - for (i = 0; i < 4; i++) + for (int i = 0; i < 4; i++) { offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); @@ -63,5 +79,11 @@ namespace CalamityMod.Projectiles.Magic } } } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } } } diff --git a/Projectiles/Magic/PhantasmalFuryProj.png b/Projectiles/Magic/PhantasmalFuryProj.png index 04c5646fde..5351d352da 100644 Binary files a/Projectiles/Magic/PhantasmalFuryProj.png and b/Projectiles/Magic/PhantasmalFuryProj.png differ diff --git a/Projectiles/Magic/Phantom.cs b/Projectiles/Magic/Phantom.cs index 4d2e505da1..4533c69cba 100644 --- a/Projectiles/Magic/Phantom.cs +++ b/Projectiles/Magic/Phantom.cs @@ -13,8 +13,8 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; + projectile.width = 8; + projectile.height = 8; projectile.friendly = true; projectile.extraUpdates = 1; projectile.penetrate = 2; @@ -25,9 +25,11 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { + projectile.rotation += 0.01f; + Lighting.AddLight(projectile.Center, 0.2f, 0.2f, 0.2f); - for (int num457 = 0; num457 < 5; num457++) + for (int num457 = 0; num457 < 2; num457++) { int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 175, 0f, 0f, 100, default, 1f); Main.dust[num458].noGravity = true; diff --git a/Projectiles/Magic/Phantom.png b/Projectiles/Magic/Phantom.png index 15e8775737..89c5f6271c 100644 Binary files a/Projectiles/Magic/Phantom.png and b/Projectiles/Magic/Phantom.png differ diff --git a/Projectiles/Magic/ShadeNimbus.cs b/Projectiles/Magic/ShadeNimbus.cs index 5d35d81a16..7a53cb21e9 100644 --- a/Projectiles/Magic/ShadeNimbus.cs +++ b/Projectiles/Magic/ShadeNimbus.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Nimbus"); - //Main.projFrames[projectile.type] = 6; + Main.projFrames[projectile.type] = 6; } public override void SetDefaults() @@ -21,16 +21,16 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - /*projectile.frameCounter++; + projectile.frameCounter++; if (projectile.frameCounter > 8) { projectile.frameCounter = 0; projectile.frame++; - if (projectile.frame > 5) + if (projectile.frame >= Main.projFrames[projectile.type]) { projectile.frame = 0; } - }*/ + } projectile.ai[1] += 1f; if (projectile.ai[1] >= 7200f) { diff --git a/Projectiles/Magic/ShadeNimbus.png b/Projectiles/Magic/ShadeNimbus.png index 5e260126d8..234d306f54 100644 Binary files a/Projectiles/Magic/ShadeNimbus.png and b/Projectiles/Magic/ShadeNimbus.png differ diff --git a/Projectiles/Magic/ShadeNimbusCloud.png b/Projectiles/Magic/ShadeNimbusCloud.png index f17fc547d8..c7e15d492c 100644 Binary files a/Projectiles/Magic/ShadeNimbusCloud.png and b/Projectiles/Magic/ShadeNimbusCloud.png differ diff --git a/Projectiles/Magic/UndinesRetributionSpear.png b/Projectiles/Magic/UndinesRetributionSpear.png index 3f335cf434..b3de896fd7 100644 Binary files a/Projectiles/Magic/UndinesRetributionSpear.png and b/Projectiles/Magic/UndinesRetributionSpear.png differ diff --git a/Projectiles/Magic/VenusianBolt.cs b/Projectiles/Magic/VenusianBolt.cs index 373ee8817c..788ce02c68 100644 --- a/Projectiles/Magic/VenusianBolt.cs +++ b/Projectiles/Magic/VenusianBolt.cs @@ -1,5 +1,6 @@ -using CalamityMod.Items.Weapons.Magic; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,6 +12,8 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Bolt"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; } public override void SetDefaults() @@ -26,6 +29,7 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + MathHelper.ToRadians(45); Lighting.AddLight(projectile.Center, 0.25f, 0.2f, 0f); if (projectile.wet && !projectile.lavaWet) { @@ -36,7 +40,7 @@ namespace CalamityMod.Projectiles.Magic Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 73); projectile.localAI[0] += 1f; } - for (int num457 = 0; num457 < 5; num457++) + for (int num457 = 0; num457 < 3; num457++) { int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 55, 0f, 0f, 100, default, 1.2f); Main.dust[num458].noGravity = true; @@ -75,5 +79,11 @@ namespace CalamityMod.Projectiles.Magic } } } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } } } diff --git a/Projectiles/Magic/VenusianBolt.png b/Projectiles/Magic/VenusianBolt.png index 6ea4de3903..ef55e2f9ed 100644 Binary files a/Projectiles/Magic/VenusianBolt.png and b/Projectiles/Magic/VenusianBolt.png differ diff --git a/Projectiles/Magic/VenusianFlame.cs b/Projectiles/Magic/VenusianFlame.cs index 8fdce736c6..88713c021b 100644 --- a/Projectiles/Magic/VenusianFlame.cs +++ b/Projectiles/Magic/VenusianFlame.cs @@ -1,4 +1,6 @@ using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,12 +12,15 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Venusian Cinder"); + Main.projFrames[projectile.type] = 3; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 6; - projectile.height = 12; + projectile.width = 14; + projectile.height = 14; projectile.friendly = true; projectile.magic = true; projectile.penetrate = 3; @@ -26,17 +31,27 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - if (projectile.velocity.X != projectile.velocity.X) + projectile.frameCounter++; + if (projectile.frameCounter > 4) { - projectile.velocity.X = projectile.velocity.X * -0.1f; + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= Main.projFrames[projectile.type]) + { + projectile.frame = 0; } if (projectile.velocity.X != projectile.velocity.X) { - projectile.velocity.X = projectile.velocity.X * -0.5f; + projectile.velocity.X *= -0.1f; + } + if (projectile.velocity.X != projectile.velocity.X) + { + projectile.velocity.X *= -0.5f; } if (projectile.velocity.Y != projectile.velocity.Y && projectile.velocity.Y > 1f) { - projectile.velocity.Y = projectile.velocity.Y * -0.5f; + projectile.velocity.Y *= -0.5f; } projectile.ai[0] += 1f; if (projectile.ai[0] > 5f) @@ -44,14 +59,14 @@ namespace CalamityMod.Projectiles.Magic projectile.ai[0] = 5f; if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) { - projectile.velocity.X = projectile.velocity.X * 0.97f; - if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) + projectile.velocity.X *= 0.97f; + if (projectile.velocity.X > -0.01f && projectile.velocity.X < 0.01f) { projectile.velocity.X = 0f; projectile.netUpdate = true; } } - projectile.velocity.Y = projectile.velocity.Y + 0.2f; + projectile.velocity.Y += 0.2f; } projectile.rotation += projectile.velocity.X * 0.1f; if (projectile.ai[1] == 0f && projectile.type >= 326 && projectile.type <= 328) @@ -59,14 +74,17 @@ namespace CalamityMod.Projectiles.Magic projectile.ai[1] = 1f; Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 13); } - int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 55, 0f, 0f, 100, default, 1f); - Dust dust = Main.dust[num199]; - dust.position.X -= 2f; - dust.position.Y += 2f; - dust.scale += (float)Main.rand.Next(50) * 0.01f; - dust.noGravity = true; - dust.velocity.Y -= 2f; - if (Main.rand.NextBool(2)) + if (Main.rand.NextBool(2)) + { + int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 55, 0f, 0f, 100, default, 1f); + Dust dust = Main.dust[num199]; + dust.position.X -= 2f; + dust.position.Y += 2f; + dust.scale += (float)Main.rand.Next(50) * 0.01f; + dust.noGravity = true; + dust.velocity.Y -= 2f; + } + if (Main.rand.NextBool(3)) { int num200 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 55, 0f, 0f, 100, default, 1f); Dust dust2 = Main.dust[num200]; @@ -76,11 +94,11 @@ namespace CalamityMod.Projectiles.Magic dust2.noGravity = true; dust2.velocity *= 0.1f; } - if ((double)projectile.velocity.Y < 0.25 && (double)projectile.velocity.Y > 0.15) + if (projectile.velocity.Y < 0.25f && projectile.velocity.Y > 0.15f) { - projectile.velocity.X = projectile.velocity.X * 0.8f; + projectile.velocity.X *= 0.8f; } - projectile.rotation = -projectile.velocity.X * 0.05f; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); if (projectile.velocity.Y > 16f) { projectile.velocity.Y = 16f; @@ -92,12 +110,11 @@ namespace CalamityMod.Projectiles.Magic target.AddBuff(BuffID.OnFire, 300); } - public override bool OnTileCollide(Vector2 oldVelocity) + public override bool OnTileCollide(Vector2 oldVelocity) => false; + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); return false; } } diff --git a/Projectiles/Magic/VenusianFlame.png b/Projectiles/Magic/VenusianFlame.png index 28f94674d6..2d6cfab7f2 100644 Binary files a/Projectiles/Magic/VenusianFlame.png and b/Projectiles/Magic/VenusianFlame.png differ diff --git a/Projectiles/Magic/WaterLeechProj.cs b/Projectiles/Magic/WaterLeechProj.cs new file mode 100644 index 0000000000..c092e1101d --- /dev/null +++ b/Projectiles/Magic/WaterLeechProj.cs @@ -0,0 +1,109 @@ +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class WaterLeechProj : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Leech"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = projectile.height = 18; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.timeLeft = 540; + projectile.magic = true; + } + + 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[0] == 0f) + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + MathHelper.Pi; + } + //Sticky Behaviour + CalamityUtils.StickyProjAI(projectile, 5); + } + + public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + CalamityUtils.ModifyHitNPCSticky(projectile, 4, false); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 180); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 180); + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + Collision.HitTiles(projectile.position + projectile.velocity, projectile.velocity, projectile.width, projectile.height); + projectile.Kill(); + return false; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture = Main.projectileTexture[projectile.type]; + int height = texture.Height / Main.projFrames[projectile.type]; + int drawStart = height * projectile.frame; + Vector2 origin = projectile.Size / 2; + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + spriteEffects = SpriteEffects.FlipHorizontally; + + spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, height)), Color.White, projectile.rotation, origin, projectile.scale, spriteEffects, 0f); + return false; + } + + public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture = Main.projectileTexture[projectile.type]; + int height = texture.Height / Main.projFrames[projectile.type]; + int drawStart = height * projectile.frame; + Vector2 origin = projectile.Size / 2; + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + spriteEffects = SpriteEffects.FlipHorizontally; + + spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Magic/WaterLeechProjGlow"), projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, height)), Color.White, projectile.rotation, origin, projectile.scale, spriteEffects, 0f); + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(4, (int)projectile.position.X, (int)projectile.position.Y, 1, 0.5f, 0f); + for (int i = 0; i < 5; i++) + { + int dust = Dust.NewDust(projectile.Center, 1, 1, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 1.5f); + Main.dust[dust].noGravity = true; + } + } + } +} diff --git a/Projectiles/Magic/WaterLeechProj.png b/Projectiles/Magic/WaterLeechProj.png new file mode 100644 index 0000000000..17bc7c88b0 Binary files /dev/null and b/Projectiles/Magic/WaterLeechProj.png differ diff --git a/Projectiles/Magic/WaterLeechProjGlow.png b/Projectiles/Magic/WaterLeechProjGlow.png new file mode 100644 index 0000000000..48aaa585d2 Binary files /dev/null and b/Projectiles/Magic/WaterLeechProjGlow.png differ diff --git a/Projectiles/Magic/WaywasherProj.cs b/Projectiles/Magic/WaywasherProj.cs index b6aad311bb..8d1087b303 100644 --- a/Projectiles/Magic/WaywasherProj.cs +++ b/Projectiles/Magic/WaywasherProj.cs @@ -1,4 +1,5 @@ using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic @@ -16,7 +17,7 @@ namespace CalamityMod.Projectiles.Magic projectile.height = 16; projectile.friendly = true; projectile.ignoreWater = true; - projectile.alpha = 255; + projectile.alpha = 0; projectile.penetrate = 2; projectile.timeLeft = 300; projectile.magic = true; @@ -24,36 +25,28 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { + projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.02f * (float)projectile.direction; Lighting.AddLight(projectile.Center, 0f, 0.1f, 0.7f); for (int num105 = 0; num105 < 2; num105++) { float num99 = projectile.velocity.X / 3f * (float)num105; float num100 = projectile.velocity.Y / 3f * (float)num105; int num101 = 4; - int num102 = Dust.NewDust(new Vector2(projectile.position.X + (float)num101, projectile.position.Y + (float)num101), projectile.width - num101 * 2, projectile.height - num101 * 2, 33, 0f, 0f, 0, new Color(0, 142, 255), 1.2f); - Main.dust[num102].noGravity = true; - Main.dust[num102].velocity *= 0.1f; - Main.dust[num102].velocity += projectile.velocity * 0.1f; - Dust expr_47FA_cp_0 = Main.dust[num102]; - expr_47FA_cp_0.position.X -= num99; - Dust expr_4815_cp_0 = Main.dust[num102]; - expr_4815_cp_0.position.Y -= num100; + int num102 = Dust.NewDust(new Vector2(projectile.position.X + (float)num101, projectile.position.Y + (float)num101), projectile.width - num101 * 2, projectile.height - num101 * 2, 33, 0f, 0f, 0, new Color(64, 224, 208), 1.2f); + Dust dust = Main.dust[num102]; + dust.noGravity = true; + dust.velocity *= 0.1f; + dust.velocity += projectile.velocity * 0.1f; + dust.position.X -= num99; + dust.position.Y -= num100; } if (Main.rand.NextBool(5)) { int num103 = 4; - int num104 = Dust.NewDust(new Vector2(projectile.position.X + (float)num103, projectile.position.Y + (float)num103), projectile.width - num103 * 2, projectile.height - num103 * 2, 33, 0f, 0f, 0, new Color(0, 142, 255), 0.6f); + int num104 = Dust.NewDust(new Vector2(projectile.position.X + (float)num103, projectile.position.Y + (float)num103), projectile.width - num103 * 2, projectile.height - num103 * 2, 33, 0f, 0f, 0, new Color(64, 224, 208), 0.6f); Main.dust[num104].velocity *= 0.25f; Main.dust[num104].velocity += projectile.velocity * 0.5f; } - if (projectile.ai[1] >= 20f) - { - projectile.velocity.Y = projectile.velocity.Y + 0.2f; - } - else - { - projectile.rotation += 0.3f * (float)projectile.direction; - } if (projectile.velocity.Y > 16f) { projectile.velocity.Y = 16f; diff --git a/Projectiles/Magic/WaywasherProj.png b/Projectiles/Magic/WaywasherProj.png index ed4e3450c0..115a36bf88 100644 Binary files a/Projectiles/Magic/WaywasherProj.png and b/Projectiles/Magic/WaywasherProj.png differ diff --git a/Projectiles/Melee/CrescentMoonFlail.png b/Projectiles/Melee/CrescentMoonFlail.png index f657e8b5ec..c9843d69f4 100644 Binary files a/Projectiles/Melee/CrescentMoonFlail.png and b/Projectiles/Melee/CrescentMoonFlail.png differ diff --git a/Projectiles/Melee/CrescentMoonProj.png b/Projectiles/Melee/CrescentMoonProj.png index 38aef93175..6d0844d54a 100644 Binary files a/Projectiles/Melee/CrescentMoonProj.png and b/Projectiles/Melee/CrescentMoonProj.png differ diff --git a/Projectiles/Melee/DepthOrb.cs b/Projectiles/Melee/DepthOrb.cs index dfedfe134b..81c3d5e346 100644 --- a/Projectiles/Melee/DepthOrb.cs +++ b/Projectiles/Melee/DepthOrb.cs @@ -57,7 +57,7 @@ namespace CalamityMod.Projectiles.Melee projectile.width = projectile.height = 64; projectile.position.X = projectile.position.X - (float)(projectile.width / 2); projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int dust = 0; dust < 30; dust++) + for (int dustIndex = 0; dustIndex < 30; dustIndex++) { float num463 = (float)Main.rand.Next(-10, 11); float num464 = (float)Main.rand.Next(-10, 11); @@ -67,15 +67,14 @@ namespace CalamityMod.Projectiles.Melee num463 *= num466; num464 *= num466; int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 1.2f); - Main.dust[num467].noGravity = true; - Main.dust[num467].position.X = projectile.Center.X; - Main.dust[num467].position.Y = projectile.Center.Y; - Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); - Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); - Main.dust[num467].velocity.X = num463; - Main.dust[num467].velocity.Y = num464; + Dust dust = Main.dust[num467]; + dust.noGravity = true; + dust.position.X = projectile.Center.X; + dust.position.Y = projectile.Center.Y; + dust.position.X += (float)Main.rand.Next(-10, 11); + dust.position.Y += (float)Main.rand.Next(-10, 11); + dust.velocity.X = num463; + dust.velocity.Y = num464; } projectile.maxPenetrate = -1; projectile.penetrate = -1; diff --git a/Projectiles/Melee/DepthOrb2.cs b/Projectiles/Melee/DepthOrb2.cs index 53302b05f0..333a4fe9cf 100644 --- a/Projectiles/Melee/DepthOrb2.cs +++ b/Projectiles/Melee/DepthOrb2.cs @@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Melee projectile.width = projectile.height = 64; projectile.position.X = projectile.position.X - (float)(projectile.width / 2); projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int dust = 0; dust <= 30; dust++) + for (int dustIndex = 0; dustIndex <= 30; dustIndex++) { float num463 = (float)Main.rand.Next(-10, 11); float num464 = (float)Main.rand.Next(-10, 11); @@ -71,15 +71,14 @@ namespace CalamityMod.Projectiles.Melee num463 *= num466; num464 *= num466; int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 1.2f); - Main.dust[num467].noGravity = true; - Main.dust[num467].position.X = projectile.Center.X; - Main.dust[num467].position.Y = projectile.Center.Y; - Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); - Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); - Main.dust[num467].velocity.X = num463; - Main.dust[num467].velocity.Y = num464; + Dust dust = Main.dust[num467]; + dust.noGravity = true; + dust.position.X = projectile.Center.X; + dust.position.Y = projectile.Center.Y; + dust.position.X += (float)Main.rand.Next(-10, 11); + dust.position.Y += (float)Main.rand.Next(-10, 11); + dust.velocity.X = num463; + dust.velocity.Y = num464; } projectile.maxPenetrate = -1; projectile.penetrate = -1; diff --git a/Projectiles/Melee/GalileosMoon.png b/Projectiles/Melee/GalileosMoon.png index 38aef93175..6d0844d54a 100644 Binary files a/Projectiles/Melee/GalileosMoon.png and b/Projectiles/Melee/GalileosMoon.png differ diff --git a/Projectiles/Melee/HellionSpike.cs b/Projectiles/Melee/HellionSpike.cs index 28a1818a06..5c3548865e 100644 --- a/Projectiles/Melee/HellionSpike.cs +++ b/Projectiles/Melee/HellionSpike.cs @@ -7,77 +7,75 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { - public class HellionSpike : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spike"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; - } + public class HellionSpike : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spike"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; + } - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.aiStyle = 27; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 3; - projectile.timeLeft = 600; - aiType = ProjectileID.SporeCloud; - } + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.aiStyle = 27; + projectile.friendly = true; + projectile.melee = true; + projectile.penetrate = 3; + projectile.timeLeft = 600; + aiType = ProjectileID.SporeCloud; + } - public override void AI() - { - Lighting.AddLight(projectile.Center, 0f, 0.25f, 0f); - if (Main.rand.NextBool(3)) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 44, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - } + public override void AI() + { + Lighting.AddLight(projectile.Center, 0f, 0.25f, 0f); + if (Main.rand.NextBool(3)) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 44, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + } - public override void Kill(int timeLeft) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 44, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - } + public override void Kill(int timeLeft) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 44, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { if (projectile.timeLeft > 595) return false; CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); - return false; - } + return false; + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 8; - target.AddBuff(BuffID.Venom, 300); - if (crit) - { - float xPos = projectile.position.X + 800 * Main.rand.NextBool(2).ToDirectionInt(); - Vector2 spawnPosition = new Vector2(xPos, projectile.position.Y - Main.rand.Next(600, 801)); - float num80 = xPos; - float speedX = (float)target.position.X - spawnPosition.X; - float speedY = (float)target.position.Y - spawnPosition.Y; - float dir = (float)Math.Sqrt((double)(speedX * speedX + speedY * speedY)); - dir = 10 / num80; - speedX *= dir * 150; - speedY *= dir * 150; - speedX = MathHelper.Clamp(speedX, -15f, 15f); - speedY = MathHelper.Clamp(speedY, -15f, 15f); - if (projectile.owner == Main.myPlayer) - { - int petal = Projectile.NewProjectile(spawnPosition, new Vector2(speedX, speedY), ProjectileID.FlowerPetal, (int)(projectile.damage * 0.5), 2f, projectile.owner); + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 8; + target.AddBuff(BuffID.Venom, 300); + if (crit) + { + float xPos = projectile.position.X + 800 * Main.rand.NextBool(2).ToDirectionInt(); + float yPos = projectile.position.Y + Main.rand.Next(-800, 801); + Vector2 spawnPosition = new Vector2(xPos, yPos); + Vector2 velocity = target.position - spawnPosition; + float dir = 10 / spawnPosition.X; + velocity.X *= dir * 150; + velocity.Y *= dir * 150; + velocity.X = MathHelper.Clamp(velocity.X, -15f, 15f); + velocity.Y = MathHelper.Clamp(velocity.Y, -15f, 15f); + if (projectile.owner == Main.myPlayer) + { + int petal = Projectile.NewProjectile(spawnPosition, velocity, ProjectileID.FlowerPetal, (int)(projectile.damage * 0.5), 2f, projectile.owner); Main.projectile[petal].Calamity().forceMelee = true; Main.projectile[petal].localNPCHitCooldown = -1; - } - } - } - } + } + } + } + } } diff --git a/Projectiles/Melee/MonstrousKnife.cs b/Projectiles/Melee/MonstrousKnife.cs new file mode 100644 index 0000000000..f9b7cfa4e7 --- /dev/null +++ b/Projectiles/Melee/MonstrousKnife.cs @@ -0,0 +1,85 @@ +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Melee +{ + public class MonstrousKnife : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Monstrous Knife"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.aiStyle = 2; + projectile.friendly = true; + projectile.melee = true; + projectile.ignoreWater = true; + } + + public override void AI() + { + projectile.ai[0] += 1f; + if (projectile.ai[0] >= 30f) + { + projectile.alpha += 10; + if (projectile.damage > 1) + projectile.damage = (int)(projectile.damage * 0.9); + projectile.knockBack = projectile.knockBack * 0.9f; + if (projectile.alpha >= 255) + projectile.Kill(); + } + if (projectile.ai[0] < 30f) + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + MathHelper.PiOver2; + } + + public override void Kill(int timeLeft) + { + for (int dustIndex = 0; dustIndex < 3; ++dustIndex) + { + int redDust = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 182, 0f, 0f, 100, new Color(), 0.8f); + Dust dust = Main.dust[redDust]; + dust.noGravity = true; + dust.velocity *= 1.2f; + dust.velocity -= projectile.oldVelocity * 0.3f; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (Main.myPlayer != projectile.owner) + return; + if (target.type == NPCID.TargetDummy || target.lifeMax <= 5 || Main.player[projectile.owner].moonLeech) + return; + if (Main.player[projectile.owner].lifeSteal <= 0f) + return; + + float healAmt = damage * Main.rand.NextFloat(0.075f, 0.9f); + if (healAmt < 1f) + healAmt = 1f; + if (Main.rand.NextBool(3)) + CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], healAmt, ProjectileID.VampireHeal, 1200f, 1.5f); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + if (Main.myPlayer != projectile.owner) + return; + if (Main.player[projectile.owner].moonLeech) + return; + if (Main.player[projectile.owner].lifeSteal <= 0f) + return; + + float healAmt = damage * Main.rand.NextFloat(0.075f, 0.9f); + if (healAmt < 1f) + healAmt = 1f; + if (Main.rand.NextBool(3)) + CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], healAmt, ProjectileID.VampireHeal, 1200f, 1.5f); + } + } +} diff --git a/Projectiles/Melee/MonstrousKnife.png b/Projectiles/Melee/MonstrousKnife.png new file mode 100644 index 0000000000..5873e9229d Binary files /dev/null and b/Projectiles/Melee/MonstrousKnife.png differ diff --git a/Projectiles/Melee/NeptuneOrb.cs b/Projectiles/Melee/NeptuneOrb.cs index 017c541056..fe47af6ba4 100644 --- a/Projectiles/Melee/NeptuneOrb.cs +++ b/Projectiles/Melee/NeptuneOrb.cs @@ -9,8 +9,6 @@ namespace CalamityMod.Projectiles.Melee { public class NeptuneOrb : ModProjectile { - private int addSprayTimer = 20; - public override void SetStaticDefaults() { DisplayName.SetDefault("Beam"); @@ -31,14 +29,12 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { Lighting.AddLight(projectile.Center, 0f, 0f, 1f); - addSprayTimer--; - if (addSprayTimer <= 0) + if (projectile.timeLeft % 20 == 19) { if (projectile.owner == Main.myPlayer) { Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 15f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); } - addSprayTimer = 20; } int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 0.4f); Main.dust[num458].noGravity = true; @@ -68,7 +64,7 @@ namespace CalamityMod.Projectiles.Melee projectile.width = projectile.height = 64; projectile.position.X = projectile.position.X - (float)(projectile.width / 2); projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int dust = 0; dust <= 30; dust++) + for (int dustIndex = 0; dustIndex <= 30; dustIndex++) { float num463 = (float)Main.rand.Next(-10, 11); float num464 = (float)Main.rand.Next(-10, 11); @@ -78,15 +74,14 @@ namespace CalamityMod.Projectiles.Melee num463 *= num466; num464 *= num466; int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 1.2f); - Main.dust[num467].noGravity = true; - Main.dust[num467].position.X = projectile.Center.X; - Main.dust[num467].position.Y = projectile.Center.Y; - Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); - Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); - Main.dust[num467].velocity.X = num463; - Main.dust[num467].velocity.Y = num464; + Dust dust = Main.dust[num467]; + dust.noGravity = true; + dust.position.X = projectile.Center.X; + dust.position.Y = projectile.Center.Y; + dust.position.X += (float)Main.rand.Next(-10, 11); + dust.position.Y += (float)Main.rand.Next(-10, 11); + dust.velocity.X = num463; + dust.velocity.Y = num464; } projectile.maxPenetrate = -1; projectile.penetrate = -1; diff --git a/Projectiles/Melee/PrismaticBeam.cs b/Projectiles/Melee/PrismaticBeam.cs new file mode 100644 index 0000000000..6066e3b85e --- /dev/null +++ b/Projectiles/Melee/PrismaticBeam.cs @@ -0,0 +1,321 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Items.Weapons.Melee; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; +using System.IO; +using Terraria; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Melee +{ + public class PrismaticBeam : ModProjectile + { + public Color[] colors = new Color[] + { + new Color(255, 0, 0, 50), //Red + new Color(255, 128, 0, 50), //Orange + new Color(255, 255, 0, 50), //Yellow + new Color(128, 255, 0, 50), //Lime + new Color(0, 255, 0, 50), //Green + new Color(0, 255, 128, 50), //Turquoise + new Color(0, 255, 255, 50), //Cyan + new Color(0, 128, 255, 50), //Light Blue + new Color(0, 0, 255, 50), //Blue + new Color(128, 0, 255, 50), //Purple + new Color(255, 0, 255, 50), //Fuschia + new Color(255, 0, 128, 50) //Hot Pink + }; + List colorSet = new List() + { + new Color(255, 0, 0, 50), //Red + new Color(255, 255, 0, 50), //Yellow + new Color(0, 255, 0, 50), //Green + new Color(0, 255, 255, 50), //Cyan + new Color(0, 0, 255, 50), //Blue + new Color(255, 0, 255, 50), //Fuschia + }; + private bool playedSound = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Prismatic Beam"); + } + + // Use a different style for constant so it is very clear in code when a constant is used + // but only constants copied from example mod ;) + + // The maximum charge value + private const float MAX_CHARGE = 100f; + //The distance charge particle from the player center + private const float MOVE_DISTANCE = 100f; + + // The actual distance is stored in the ai0 field + // By making a property to handle this it makes our life easier, and the accessibility more readable + public float Distance + { + get => projectile.ai[0]; + set => projectile.ai[0] = value; + } + + // The actual charge value is stored in the localAI0 field + public float Charge + { + get => projectile.localAI[0]; + set => projectile.localAI[0] = value; + } + + // Are we at max charge? With c#6 you can simply use => which indicates this is a get only property + public bool IsAtMaxCharge => Charge == MAX_CHARGE; + + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 6; + projectile.friendly = true; + projectile.ranged = true; + projectile.melee = true; + projectile.scale = 1.5f; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.hide = true; + projectile.timeLeft = 300; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + int colorIndex = (int)(Main.GlobalTime / 2 % colorSet.Count); + Color currentColor = colorSet[colorIndex]; + Color nextColor = colorSet[(colorIndex + 1) % colorSet.Count]; + // We start drawing the laser if we have charged up + if (IsAtMaxCharge) + { + Vector2 maxLength = Main.MouseWorld - Main.player[projectile.owner].Center; + + DrawLaser(spriteBatch, Main.projectileTexture[projectile.type], Main.player[projectile.owner].Center, + projectile.velocity, 15f, projectile.damage, -MathHelper.PiOver2, projectile.scale, maxLength.Length(), Color.Lerp(currentColor, nextColor, Main.GlobalTime % 2f > 1f ? 1f : Main.GlobalTime % 1f), (int)MOVE_DISTANCE); + } + return false; + } + + // The core function of drawing a laser + public void DrawLaser(SpriteBatch spriteBatch, Texture2D texture, Vector2 start, Vector2 unit, float step, int damage, float rotation = 0f, float scale = 1f, float maxDist = 2000f, Color color = default(Color), int transDist = 50) + { + int colorIndex = (int)(Main.GlobalTime / 2 % colorSet.Count); + Color currentColor = colorSet[colorIndex]; + Color nextColor = colorSet[(colorIndex + 1) % colorSet.Count]; + + float r = unit.ToRotation() + rotation; + + // Draws the laser 'body' + for (float i = transDist; i <= Distance; i += step) + { + var origin = start + i * unit; + spriteBatch.Draw(texture, origin - Main.screenPosition, + new Rectangle(0, 26, 28, 26), i < transDist ? Color.Transparent : Color.Lerp(currentColor, nextColor, Main.GlobalTime % 2f > 1f ? 1f : Main.GlobalTime % 1f), r, + new Vector2(28 * .5f, 26 * .5f), scale, 0, 0); + } + + // Draws the laser 'tail' + spriteBatch.Draw(texture, start + unit * (transDist - step) - Main.screenPosition, + new Rectangle(0, 0, 28, 26), Color.Lerp(currentColor, nextColor, Main.GlobalTime % 2f > 1f ? 1f : Main.GlobalTime % 1f), r, new Vector2(28 * .5f, 26 * .5f), scale, 0, 0); + + // Draws the laser 'head' + spriteBatch.Draw(texture, start + (Distance + step) * unit - Main.screenPosition, + new Rectangle(0, 52, 28, 26), Color.Lerp(currentColor, nextColor, Main.GlobalTime % 2f > 1f ? 1f : Main.GlobalTime % 1f), r, new Vector2(28 * .5f, 26 * .5f), scale, 0, 0); + } + + // Change the way of collision check of the projectile + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + // We can only collide if we are at max charge, which is when the laser is actually fired + if (!IsAtMaxCharge) return false; + + Player player = Main.player[projectile.owner]; + Vector2 unit = projectile.velocity; + float point = 0f; + // Run an AABB versus Line check to look for collisions, look up AABB collision first to see how it works + // It will look for collisions on the given line using AABB + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), player.Center, + player.Center + unit * Distance, 22, ref point); + } + + // The AI of the projectile + public override void AI() + { + Player player = Main.player[projectile.owner]; + projectile.position = player.Center + projectile.velocity * MOVE_DISTANCE; + projectile.timeLeft = 2; + + // By separating large AI into methods it becomes very easy to see the flow of the AI in a broader sense + // 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); + + // If laser is not charged yet, stop the AI here. + if (Charge < MAX_CHARGE) return; + + //Play cool sound when fully charged + if (playedSound == false) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 68); + playedSound = true; + } + + SetLaserPosition(player); + SpawnDusts(player); + CastLights(); + } + + /* + * Sets the end of the laser position based on where it collides with something + */ + private void SetLaserPosition(Player player) + { + for (Distance = MOVE_DISTANCE; Distance <= 2200f; Distance += 5f) + { + var start = player.Center + projectile.velocity * Distance; + if (!Collision.CanHit(player.Center, 1, 1, start, 1, 1)) + { + Distance -= 5f; + break; + } + } + } + + private void ChargeLaser(Player player) + { + // Kill the projectile if the player stops channeling + if (!player.channel) + { + projectile.Kill(); + } + else + { + Vector2 offset = projectile.velocity; + offset *= MOVE_DISTANCE - 20; + Vector2 pos = player.Center + offset - new Vector2(15f, 15f); + if (Charge < MAX_CHARGE) + { + Charge++; + } + int chargeFact = (int)(Charge / 20f); + Vector2 dustVelocity = Vector2.UnitX * 18f; + dustVelocity = dustVelocity.RotatedBy(projectile.rotation - 1.57f); + Vector2 spawnPos = projectile.Center + dustVelocity; + for (int k = 0; k < chargeFact + 1; k++) + { + Vector2 spawn = spawnPos + ((float)Main.rand.NextDouble() * 6.28f).ToRotationVector2() * (12f - chargeFact * 2); + Dust dust = Main.dust[Dust.NewDust(pos, 20, 20, 267, projectile.velocity.X / 2f, projectile.velocity.Y / 2f)]; + dust.velocity = Vector2.Normalize(spawnPos - spawn) * 1.5f * (10f - chargeFact * 2f) / 10f; + dust.noGravity = true; + dust.color = Main.rand.Next(colors); + dust.scale = Main.rand.Next(10, 20) * 0.05f; + } + } + } + + 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, 267, 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 = Main.rand.Next(colors); + 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, Main.rand.Next(colors), 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, Main.rand.Next(colors), 1.5f)]; + dust.velocity = dust.velocity * 0.5f; + dust.velocity.Y = -Math.Abs(dust.velocity.Y); + } + } + + private void UpdatePlayer(Player player) + { + // Multiplayer support here, only run this code if the client running it is the owner of the projectile + if (projectile.owner == Main.myPlayer) + { + Vector2 diff = Main.MouseWorld - player.Center; + diff.Normalize(); + projectile.velocity = diff; + projectile.direction = Main.MouseWorld.X > player.position.X ? 1 : -1; + projectile.netUpdate = true; + } + int dir = projectile.direction; + player.ChangeDir(dir); // Set player direction to where we are shooting + player.heldProj = projectile.whoAmI; // Update player's held projectile + player.itemTime = 2; // Set item time to 2 frames while we are used + player.itemAnimation = 2; // Set item animation time to 2 frames while we are used + player.itemRotation = (float)Math.Atan2(projectile.velocity.Y * dir, projectile.velocity.X * dir); // Set the item rotation to where we are shooting + } + + private void CastLights() + { + // Cast a light along the line of the laser + DelegateMethods.v3_1 = new Vector3(0.8f, 0.8f, 1f); + Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * (Distance - MOVE_DISTANCE), 26, DelegateMethods.CastLight); + } + + public override bool ShouldUpdatePosition() => false; + + //Update CutTiles so the laser will cut tiles (like grass) + public override void CutTiles() + { + DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; + Vector2 unit = projectile.velocity; + Utils.PlotTileLine(projectile.Center, projectile.Center + unit * Distance, projectile.width + 16, DelegateMethods.CutTiles); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(BuffID.CursedInferno, 120); + target.AddBuff(BuffID.Frostburn, 120); + target.AddBuff(BuffID.OnFire, 120); + target.AddBuff(BuffID.Ichor, 120); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(BuffID.CursedInferno, 120); + target.AddBuff(BuffID.Frostburn, 120); + target.AddBuff(BuffID.OnFire, 120); + target.AddBuff(BuffID.Ichor, 120); + } + } +} diff --git a/Projectiles/Melee/PrismaticBeam.png b/Projectiles/Melee/PrismaticBeam.png new file mode 100644 index 0000000000..4bcb09bbf2 Binary files /dev/null and b/Projectiles/Melee/PrismaticBeam.png differ diff --git a/Projectiles/Melee/PrismaticWave.cs b/Projectiles/Melee/PrismaticWave.cs new file mode 100644 index 0000000000..ec2e35de71 --- /dev/null +++ b/Projectiles/Melee/PrismaticWave.cs @@ -0,0 +1,159 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Items.Weapons.Melee; +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; + +namespace CalamityMod.Projectiles.Melee +{ + public class PrismaticWave : ModProjectile + { + private int alpha = 50; + public Color[] colors = new Color[] + { + new Color(255, 0, 0, 50), //Red + new Color(255, 128, 0, 50), //Orange + new Color(255, 255, 0, 50), //Yellow + new Color(128, 255, 0, 50), //Lime + new Color(0, 255, 0, 50), //Green + new Color(0, 255, 128, 50), //Turquoise + new Color(0, 255, 255, 50), //Cyan + new Color(0, 128, 255, 50), //Light Blue + new Color(0, 0, 255, 50), //Blue + new Color(128, 0, 255, 50), //Purple + new Color(255, 0, 255, 50), //Fuschia + new Color(255, 0, 128, 50) //Hot Pink + }; + List colorSet = new List() + { + new Color(255, 0, 0, 50), //Red + new Color(255, 255, 0, 50), //Yellow + new Color(0, 255, 0, 50), //Green + new Color(0, 255, 255, 50), //Cyan + new Color(0, 0, 255, 50), //Blue + new Color(255, 0, 255, 50), //Fuschia + }; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Wave"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; + } + + public override void SetDefaults() + { + projectile.width = 36; + projectile.height = 36; + aiType = ProjectileID.FrostWave; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.ranged = true; + projectile.melee = true; + projectile.penetrate = 3; + projectile.timeLeft = 360; + projectile.tileCollide = false; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + } + + public override void AI() + { + if (projectile.localAI[0] == 0f) + { + projectile.scale -= 0.02f; + projectile.alpha += 30; + if (projectile.alpha >= 250) + { + projectile.alpha = 255; + projectile.localAI[0] = 1f; + } + } + else if (projectile.localAI[0] == 1f) + { + projectile.scale += 0.02f; + projectile.alpha -= 30; + if (projectile.alpha <= 0) + { + projectile.alpha = 0; + projectile.localAI[0] = 0f; + } + } + Lighting.AddLight(projectile.Center, Main.DiscoR * 0.5f / 255f, Main.DiscoG * 0.5f / 255f, Main.DiscoB * 0.5f / 255f); + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + if (Main.rand.NextBool(2)) + { + int rainbow = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 267, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, alpha, Main.rand.Next(colors)); + Main.dust[rainbow].noGravity = true; + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + if (projectile.timeLeft > 355) + return false; + + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + return false; + } + + public override Color? GetAlpha(Color lightColor) + { + int colorIndex = (int)(Main.GlobalTime / 2 % colorSet.Count); + Color currentColor = colorSet[colorIndex]; + Color nextColor = colorSet[(colorIndex + 1) % colorSet.Count]; + return Color.Lerp(currentColor, nextColor, Main.GlobalTime % 2f > 1f ? 1f : Main.GlobalTime % 1f); + } + + public override void Kill(int timeLeft) + { + for (int k = 0; k < 3; k++) + { + int rainbow = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 267, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f, alpha, Main.rand.Next(colors)); + Main.dust[rainbow].noGravity = true; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(BuffID.CursedInferno, 120); + target.AddBuff(BuffID.Frostburn, 120); + target.AddBuff(BuffID.OnFire, 120); + target.AddBuff(BuffID.Ichor, 120); + projectile.velocity *= 0.75f; + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(BuffID.CursedInferno, 120); + target.AddBuff(BuffID.Frostburn, 120); + target.AddBuff(BuffID.OnFire, 120); + target.AddBuff(BuffID.Ichor, 120); + projectile.velocity *= 0.75f; + } + } +} diff --git a/Projectiles/Melee/PrismaticWave.png b/Projectiles/Melee/PrismaticWave.png new file mode 100644 index 0000000000..cca6c037d5 Binary files /dev/null and b/Projectiles/Melee/PrismaticWave.png differ diff --git a/Projectiles/Melee/Spears/TenebreusTidesProjectile.cs b/Projectiles/Melee/Spears/TenebreusTidesProjectile.cs new file mode 100644 index 0000000000..29dd0e8a69 --- /dev/null +++ b/Projectiles/Melee/Spears/TenebreusTidesProjectile.cs @@ -0,0 +1,114 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.Melee; +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ModLoader; +using CalamityMod.Projectiles.BaseProjectiles; + +namespace CalamityMod.Projectiles.Melee.Spears +{ + public class TenebreusTidesProjectile : BaseSpearProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Tenebreus Tides"); + } + + public override void SetDefaults() + { + projectile.width = 46; //The width of the .png file in pixels divided by 2. + projectile.height = 46; //The height of the .png file in pixels divided by 2. + projectile.aiStyle = 19; + projectile.melee = true; //Dictates whether projectile is a melee-class weapon. + projectile.timeLeft = 90; + projectile.friendly = true; + projectile.hostile = false; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.ownerHitCheck = true; + projectile.Calamity().trueMelee = true; + projectile.usesIDStaticNPCImmunity = true; + projectile.idStaticNPCHitCooldown = 15; + } + public override float InitialSpeed => 3f; + public override float ReelbackSpeed => 2.4f; + public override float ForwardSpeed => 0.95f; + public override Action EffectBeforeReelback => (proj) => + { + Projectile.NewProjectile(projectile.Center.X + projectile.velocity.X, projectile.Center.Y + projectile.velocity.Y, projectile.velocity.X * 2.4f, projectile.velocity.Y * 2.4f, ModContent.ProjectileType(), (int)(projectile.damage * 0.65), projectile.knockBack * 0.85f, projectile.owner, 0f, 0f); + }; + public override void ExtraBehavior() + { + if (Main.rand.NextBool(5)) + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 33, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 300); + SwordSpam(target, damage, knockback, crit); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 300); + SwordSpamPvp(target, damage, crit); + } + + // Spawns a storm of water projectiles on-hit. + public void SwordSpam(NPC target, int damage, float knockback, bool crit) + { + int projAmt = 3; + for (int i = 0; i < projAmt; ++i) + { + int type = Main.rand.NextBool() ? ModContent.ProjectileType() : ModContent.ProjectileType(); + float startOffsetX = Main.rand.NextFloat(1000f, 1400f) * (Main.rand.NextBool() ? -1f : 1f); + float startOffsetY = Main.rand.NextFloat(80f, 900f) * (Main.rand.NextBool() ? -1f : 1f); + Vector2 startPos = new Vector2(target.Center.X + startOffsetX, target.Center.Y + startOffsetY); + Vector2 projVel = target.Center - startPos; + + // Add some randomness / inaccuracy to the projectile target location + projVel.X += Main.rand.NextFloat(-5f, 5f); + projVel.Y += Main.rand.NextFloat(-5f, 5f); + float speed = Main.rand.NextFloat(25f, 35f); + float dist = projVel.Length(); + dist = speed / dist; + projVel.X *= dist; + projVel.Y *= dist; + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(startPos, projVel, type, projectile.damage / 2, projectile.knockBack * 0.5f, projectile.owner, 0f, 0f); + } + } + } + + // Spawns a storm of water projectiles on-hit. + public void SwordSpamPvp(Player target, int damage, bool crit) + { + int projAmt = 3; + for (int i = 0; i < projAmt; ++i) + { + int type = Main.rand.NextBool() ? ModContent.ProjectileType() : ModContent.ProjectileType(); + float startOffsetX = Main.rand.NextFloat(1000f, 1400f) * (Main.rand.NextBool() ? -1f : 1f); + float startOffsetY = Main.rand.NextFloat(80f, 900f) * (Main.rand.NextBool() ? -1f : 1f); + Vector2 startPos = new Vector2(target.Center.X + startOffsetX, target.Center.Y + startOffsetY); + Vector2 projVel = target.Center - startPos; + + // Add some randomness / inaccuracy to the projectile target location + projVel.X += Main.rand.NextFloat(-5f, 5f); + projVel.Y += Main.rand.NextFloat(-5f, 5f); + float speed = Main.rand.NextFloat(25f, 35f); + float dist = projVel.Length(); + dist = speed / dist; + projVel.X *= dist; + projVel.Y *= dist; + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(startPos, projVel, type, projectile.damage / 2, projectile.knockBack * 0.5f, projectile.owner, 0f, 0f); + } + } + } + } +} diff --git a/Projectiles/Melee/Spears/TenebreusTidesProjectile.png b/Projectiles/Melee/Spears/TenebreusTidesProjectile.png new file mode 100644 index 0000000000..e63f37c150 Binary files /dev/null and b/Projectiles/Melee/Spears/TenebreusTidesProjectile.png differ diff --git a/Projectiles/Melee/TenebreusTidesWaterProjectile.cs b/Projectiles/Melee/TenebreusTidesWaterProjectile.cs new file mode 100644 index 0000000000..11c42e25f4 --- /dev/null +++ b/Projectiles/Melee/TenebreusTidesWaterProjectile.cs @@ -0,0 +1,147 @@ +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Melee +{ + public class TenebreusTidesWaterProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Water Spear"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.aiStyle = 27; + projectile.friendly = true; + projectile.melee = true; + projectile.penetrate = -1; + projectile.timeLeft = 300; + projectile.ignoreWater = true; + projectile.usesIDStaticNPCImmunity = true; + projectile.idStaticNPCHitCooldown = 10; + projectile.tileCollide = false; + } + + public override void AI() + { + Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 0f, 0f, (255 - projectile.alpha) * 1f / 255f); + int water = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 0.4f); + Main.dust[water].noGravity = true; + Main.dust[water].velocity *= 0.5f; + Main.dust[water].velocity += projectile.velocity * 0.1f; + + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + MathHelper.ToRadians(135f); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + if (projectile.timeLeft == 300) + return false; + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + + public override Color? GetAlpha(Color lightColor) => new Color(50, 50, 255, projectile.alpha); + + public override void Kill(int timeLeft) + { + Main.PlaySound(SoundID.Item10, projectile.position); + projectile.position = projectile.Center; + projectile.width = projectile.height = 64; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int dustIndex = 0; dustIndex <= 30; dustIndex++) + { + Vector2 dustVel = new Vector2(Main.rand.Next(-10, 11), Main.rand.Next(-10, 11)); + float dustSpeed = (float)Main.rand.Next(3, 9); + float dist = dustVel.Length(); + dist = dustSpeed / dist; + dustVel.X *= dist; + dustVel.Y *= dist; + int water = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 1.2f); + Dust dust = Main.dust[water]; + dust.noGravity = true; + dust.position.X = projectile.Center.X; + dust.position.Y = projectile.Center.Y; + dust.position.X += (float)Main.rand.Next(-10, 11); + dust.position.Y += (float)Main.rand.Next(-10, 11); + dust.velocity = dustVel; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 240); + SwordSpam(target, damage, knockback, crit); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 240); + SwordSpamPvp(target, damage, crit); + } + + // Spawns a storm of water projectiles on-hit. + public void SwordSpam(NPC target, int damage, float knockback, bool crit) + { + int projAmt = 3; + for (int i = 0; i < projAmt; ++i) + { + int type = Main.rand.NextBool() ? ModContent.ProjectileType() : ModContent.ProjectileType(); + float startOffsetX = Main.rand.NextFloat(1000f, 1400f) * (Main.rand.NextBool() ? -1f : 1f); + float startOffsetY = Main.rand.NextFloat(80f, 900f) * (Main.rand.NextBool() ? -1f : 1f); + Vector2 startPos = new Vector2(target.Center.X + startOffsetX, target.Center.Y + startOffsetY); + Vector2 projVel = target.Center - startPos; + + // Add some randomness / inaccuracy to the projectile target location + projVel.X += Main.rand.NextFloat(-5f, 5f); + projVel.Y += Main.rand.NextFloat(-5f, 5f); + float speed = Main.rand.NextFloat(25f, 35f); + float dist = projVel.Length(); + dist = speed / dist; + projVel.X *= dist; + projVel.Y *= dist; + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(startPos, projVel, type, projectile.damage / 2, projectile.knockBack * 0.5f, projectile.owner, 0f, 0f); + } + } + } + + // Spawns a storm of water projectiles on-hit. + public void SwordSpamPvp(Player target, int damage, bool crit) + { + int projAmt = 3; + for (int i = 0; i < projAmt; ++i) + { + int type = Main.rand.NextBool() ? ModContent.ProjectileType() : ModContent.ProjectileType(); + float startOffsetX = Main.rand.NextFloat(1000f, 1400f) * (Main.rand.NextBool() ? -1f : 1f); + float startOffsetY = Main.rand.NextFloat(80f, 900f) * (Main.rand.NextBool() ? -1f : 1f); + Vector2 startPos = new Vector2(target.Center.X + startOffsetX, target.Center.Y + startOffsetY); + Vector2 projVel = target.Center - startPos; + + // Add some randomness / inaccuracy to the projectile target location + projVel.X += Main.rand.NextFloat(-5f, 5f); + projVel.Y += Main.rand.NextFloat(-5f, 5f); + float speed = Main.rand.NextFloat(25f, 35f); + float dist = projVel.Length(); + dist = speed / dist; + projVel.X *= dist; + projVel.Y *= dist; + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(startPos, projVel, type, projectile.damage / 2, projectile.knockBack * 0.5f, projectile.owner, 0f, 0f); + } + } + } + } +} diff --git a/Projectiles/Melee/TenebreusTidesWaterProjectile.png b/Projectiles/Melee/TenebreusTidesWaterProjectile.png new file mode 100644 index 0000000000..5aa2c079e2 Binary files /dev/null and b/Projectiles/Melee/TenebreusTidesWaterProjectile.png differ diff --git a/Projectiles/Melee/TenebreusTidesWaterSpear.cs b/Projectiles/Melee/TenebreusTidesWaterSpear.cs new file mode 100644 index 0000000000..ca9ed2e2fb --- /dev/null +++ b/Projectiles/Melee/TenebreusTidesWaterSpear.cs @@ -0,0 +1,250 @@ +using CalamityMod.Buffs.DamageOverTime; +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.Melee +{ + public class TenebreusTidesWaterSpear : ModProjectile + { + public override string Texture => "CalamityMod/Projectiles/Magic/UndinesRetributionSpear"; + + private int penetrationAmt = 4; + private bool dontDraw = false; + private int drawInt = 0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Tenebreus Tides Water Spear"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = 28; + projectile.height = 28; + projectile.friendly = true; + projectile.penetrate = penetrationAmt; + projectile.timeLeft = 600; + projectile.melee = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 5; + projectile.tileCollide = false; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(penetrationAmt); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + penetrationAmt = reader.ReadInt32(); + } + + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + + // If projectile hasn't hit anything yet + if (projectile.ai[0] == 0f) + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 7f) + { + int water = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 0.4f); + Main.dust[water].noGravity = true; + Main.dust[water].velocity *= 0.5f; + Main.dust[water].velocity += projectile.velocity * 0.1f; + } + float scalar = 0.01f; + int alphaAmt = 5; + int alphaCeiling = alphaAmt * 15; + int alphaFloor = 0; + if (projectile.localAI[0] > 7f) + { + if (projectile.localAI[1] == 0f) + { + projectile.scale -= scalar; + + projectile.alpha += alphaAmt; + if (projectile.alpha > alphaCeiling) + { + projectile.alpha = alphaCeiling; + projectile.localAI[1] = 1f; + } + } + else if (projectile.localAI[1] == 1f) + { + projectile.scale += scalar; + + projectile.alpha -= alphaAmt; + if (projectile.alpha <= alphaFloor) + { + projectile.alpha = alphaFloor; + projectile.localAI[1] = 0f; + } + } + } + } + + // If projectile has hit an enemy and has 'split' + else if (projectile.ai[0] >= 1f && projectile.ai[0] < (float)(1 + penetrationAmt)) + { + projectile.alpha += 15; + projectile.velocity *= 0.98f; + projectile.localAI[0] = 0f; + + if (projectile.alpha >= 255) + { + if (projectile.ai[0] == 1f) + { + projectile.Kill(); + return; + } + + int whoAmI = -1; + Vector2 targetSpot = projectile.Center; + float detectRange = 700f; + for (int i = 0; i < Main.maxNPCs; i++) + { + NPC npc = Main.npc[i]; + if (npc.CanBeChasedBy(projectile, false)) + { + float targetDist = Vector2.Distance(npc.Center, projectile.Center); + if (targetDist < detectRange) + { + detectRange = targetDist; + targetSpot = npc.Center; + whoAmI = i; + } + } + } + + if (whoAmI >= 0) + { + projectile.netUpdate = true; + projectile.ai[0] += (float)penetrationAmt; + projectile.position = targetSpot + ((float)Main.rand.NextDouble() * 6.28318548f).ToRotationVector2() * 100f - new Vector2((float)projectile.width, (float)projectile.height) / 2f; + dontDraw = true; + projectile.velocity = Vector2.Normalize(targetSpot - projectile.Center) * 18f; + } + else + projectile.Kill(); + } + + if (Main.rand.NextBool(3)) + { + int water = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 0.4f); + Main.dust[water].noGravity = true; + Main.dust[water].velocity *= 0.5f; + Main.dust[water].velocity += projectile.velocity * 0.1f; + } + } + + // If 'split' projectile has a target + else if (projectile.ai[0] >= (float)(1 + penetrationAmt) && projectile.ai[0] < (float)(1 + penetrationAmt * 2)) + { + projectile.scale = 0.9f; + + projectile.ai[1] += 1f; + if (projectile.ai[1] >= 15f) + { + projectile.alpha += 51; + projectile.velocity *= 0.8f; + + if (projectile.alpha >= 255) + projectile.Kill(); + } + else + { + projectile.alpha -= 125; + if (projectile.alpha < 0) + projectile.alpha = 0; + + projectile.velocity *= 0.98f; + } + + projectile.localAI[0] += 1f; + + int water = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 0.4f); + Main.dust[water].noGravity = true; + Main.dust[water].velocity *= 0.5f; + Main.dust[water].velocity += projectile.velocity * 0.1f; + } + + Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 0f, 0f, (255 - projectile.alpha) * 1f / 255f); + if (dontDraw) + drawInt++; + if (drawInt > 1) + { + drawInt = 0; + dontDraw = false; + } + } + + public override Color? GetAlpha(Color lightColor) => new Color(50, 50, 255, projectile.alpha); + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + if (dontDraw) + return false; + Texture2D texture = Main.projectileTexture[projectile.type]; + int height = texture.Height / Main.projFrames[projectile.type]; + int frameHeight = height * projectile.frame; + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + spriteEffects = SpriteEffects.FlipHorizontally; + Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, frameHeight, texture.Width, height)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture.Width / 2f, (float)height / 2f), projectile.scale, spriteEffects, 0f); + return false; + } + + public override bool CanDamage() + { + // Do not do damage if a tile is hit OR if projectile has 'split' and hasn't been live for more than 5 frames + if ((((int)(projectile.ai[0] - 1f) / penetrationAmt == 0 && penetrationAmt < 3) || projectile.ai[1] < 5f) && projectile.ai[0] != 0f) + return false; + return true; + } + + public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + // If 'split' projectile hits an enemy + if (projectile.ai[0] >= (float)(1 + penetrationAmt) && projectile.ai[0] < (float)(1 + penetrationAmt * 2)) + projectile.ai[0] = 0f; + + // Becomes 5 on first hit, then 4, and so on + penetrationAmt--; + + // Hits enemy, ai[0] = 0f + 4f = 4f on first hit + // ai[0] = 4f - 1f = 3f on second hit + // ai[0] = 3f - 1f = 2f on third hit + if (projectile.ai[0] == 0f) + projectile.ai[0] += (float)penetrationAmt; + else + projectile.ai[0] -= (float)(penetrationAmt + 1); + + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 120); + } + } +} diff --git a/Projectiles/Melee/TenebreusTidesWaterSword.cs b/Projectiles/Melee/TenebreusTidesWaterSword.cs new file mode 100644 index 0000000000..79486b5876 --- /dev/null +++ b/Projectiles/Melee/TenebreusTidesWaterSword.cs @@ -0,0 +1,234 @@ +using CalamityMod.Buffs.DamageOverTime; +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.Melee +{ + public class TenebreusTidesWaterSword : ModProjectile + { + private int penetrationAmt = 4; + private bool dontDraw = false; + private int drawInt = 0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Tenebreus Tides Water Sword"); + } + + public override void SetDefaults() + { + projectile.width = 28; + projectile.height = 28; + projectile.friendly = true; + projectile.penetrate = penetrationAmt; + projectile.timeLeft = 600; + projectile.melee = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 5; + projectile.tileCollide = false; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(penetrationAmt); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + penetrationAmt = reader.ReadInt32(); + } + + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + MathHelper.ToRadians(45f); + + // If projectile hasn't hit anything yet + if (projectile.ai[0] == 0f) + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 7f) + { + int water = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 0.4f); + Main.dust[water].noGravity = true; + Main.dust[water].velocity *= 0.5f; + Main.dust[water].velocity += projectile.velocity * 0.1f; + } + float scalar = 0.01f; + int alphaAmt = 5; + int alphaCeiling = alphaAmt * 15; + int alphaFloor = 0; + if (projectile.localAI[0] > 7f) + { + if (projectile.localAI[1] == 0f) + { + projectile.scale -= scalar; + + projectile.alpha += alphaAmt; + if (projectile.alpha > alphaCeiling) + { + projectile.alpha = alphaCeiling; + projectile.localAI[1] = 1f; + } + } + else if (projectile.localAI[1] == 1f) + { + projectile.scale += scalar; + + projectile.alpha -= alphaAmt; + if (projectile.alpha <= alphaFloor) + { + projectile.alpha = alphaFloor; + projectile.localAI[1] = 0f; + } + } + } + } + + // If projectile has hit an enemy and has 'split' + else if (projectile.ai[0] >= 1f && projectile.ai[0] < (float)(1 + penetrationAmt)) + { + projectile.alpha += 15; + projectile.velocity *= 0.98f; + projectile.localAI[0] = 0f; + + if (projectile.alpha >= 255) + { + if (projectile.ai[0] == 1f) + { + projectile.Kill(); + return; + } + + int whoAmI = -1; + Vector2 targetSpot = projectile.Center; + float detectRange = 700f; + for (int i = 0; i < Main.maxNPCs; i++) + { + NPC npc = Main.npc[i]; + if (npc.CanBeChasedBy(projectile, false)) + { + float targetDist = Vector2.Distance(npc.Center, projectile.Center); + if (targetDist < detectRange) + { + detectRange = targetDist; + targetSpot = npc.Center; + whoAmI = i; + } + } + } + + if (whoAmI >= 0) + { + projectile.netUpdate = true; + projectile.ai[0] += (float)penetrationAmt; + projectile.position = targetSpot + ((float)Main.rand.NextDouble() * 6.28318548f).ToRotationVector2() * 100f - new Vector2((float)projectile.width, (float)projectile.height) / 2f; + dontDraw = true; + projectile.velocity = Vector2.Normalize(targetSpot - projectile.Center) * 18f; + } + else + projectile.Kill(); + } + + if (Main.rand.NextBool(3)) + { + int water = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 0.4f); + Main.dust[water].noGravity = true; + Main.dust[water].velocity *= 0.5f; + Main.dust[water].velocity += projectile.velocity * 0.1f; + } + } + + // If 'split' projectile has a target + else if (projectile.ai[0] >= (float)(1 + penetrationAmt) && projectile.ai[0] < (float)(1 + penetrationAmt * 2)) + { + projectile.scale = 0.9f; + + projectile.ai[1] += 1f; + if (projectile.ai[1] >= 15f) + { + projectile.alpha += 51; + projectile.velocity *= 0.8f; + + if (projectile.alpha >= 255) + projectile.Kill(); + } + else + { + projectile.alpha -= 125; + if (projectile.alpha < 0) + projectile.alpha = 0; + + projectile.velocity *= 0.98f; + } + + projectile.localAI[0] += 1f; + + int water = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 0.4f); + Main.dust[water].noGravity = true; + Main.dust[water].velocity *= 0.5f; + Main.dust[water].velocity += projectile.velocity * 0.1f; + } + + Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 0f, 0f, (255 - projectile.alpha) * 1f / 255f); + if (dontDraw) + drawInt++; + if (drawInt > 1) + { + drawInt = 0; + dontDraw = false; + } + } + + public override Color? GetAlpha(Color lightColor) => new Color(50, 50, 255, projectile.alpha); + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + if (dontDraw) + return false; + Texture2D texture = Main.projectileTexture[projectile.type]; + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + spriteEffects = SpriteEffects.FlipHorizontally; + Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, 0, texture.Width, texture.Height)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture.Width / 2f, (float)texture.Height / 2f), projectile.scale, spriteEffects, 0f); + return false; + } + + public override bool CanDamage() + { + // Do not do damage if a tile is hit OR if projectile has 'split' and hasn't been live for more than 5 frames + if ((((int)(projectile.ai[0] - 1f) / penetrationAmt == 0 && penetrationAmt < 3) || projectile.ai[1] < 5f) && projectile.ai[0] != 0f) + return false; + return true; + } + + public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + // If 'split' projectile hits an enemy + if (projectile.ai[0] >= (float)(1 + penetrationAmt) && projectile.ai[0] < (float)(1 + penetrationAmt * 2)) + projectile.ai[0] = 0f; + + // Becomes 5 on first hit, then 4, and so on + penetrationAmt--; + + // Hits enemy, ai[0] = 0f + 4f = 4f on first hit + // ai[0] = 4f - 1f = 3f on second hit + // ai[0] = 3f - 1f = 2f on third hit + if (projectile.ai[0] == 0f) + projectile.ai[0] += (float)penetrationAmt; + else + projectile.ai[0] -= (float)(penetrationAmt + 1); + + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 120); + } + } +} diff --git a/Projectiles/Melee/TenebreusTidesWaterSword.png b/Projectiles/Melee/TenebreusTidesWaterSword.png new file mode 100644 index 0000000000..27b038626f Binary files /dev/null and b/Projectiles/Melee/TenebreusTidesWaterSword.png differ diff --git a/Projectiles/Melee/TyphonsGreedBubble.png b/Projectiles/Melee/TyphonsGreedBubble.png index e4e8f2d460..43d4175395 100644 Binary files a/Projectiles/Melee/TyphonsGreedBubble.png and b/Projectiles/Melee/TyphonsGreedBubble.png differ diff --git a/Projectiles/Melee/TyphonsGreedStaff.png b/Projectiles/Melee/TyphonsGreedStaff.png index 5704b3ca99..57b185e00f 100644 Binary files a/Projectiles/Melee/TyphonsGreedStaff.png and b/Projectiles/Melee/TyphonsGreedStaff.png differ diff --git a/Projectiles/Ranged/AMRShot.cs b/Projectiles/Ranged/AMRShot.cs index 35d9bed4fc..cbb0dfd792 100644 --- a/Projectiles/Ranged/AMRShot.cs +++ b/Projectiles/Ranged/AMRShot.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using System; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { @@ -24,7 +25,7 @@ namespace CalamityMod.Projectiles.Ranged projectile.ranged = true; projectile.ignoreWater = true; projectile.aiStyle = 1; - aiType = 242; + aiType = ProjectileID.BulletHighVelocity; projectile.penetrate = 1; projectile.timeLeft = 600; } @@ -42,7 +43,7 @@ namespace CalamityMod.Projectiles.Ranged { for (int x = 0; x < 8; x++) { - float xPos = projectile.ai[0] > 0 ? projectile.position.X + 500 : projectile.position.X - 500; + float xPos = x > 4 ? projectile.position.X + 500 : projectile.position.X - 500; Vector2 vector2 = new Vector2(xPos, projectile.position.Y + Main.rand.Next(-500, 501)); float num80 = xPos; float speedX = (float)target.position.X - vector2.X; @@ -53,7 +54,7 @@ namespace CalamityMod.Projectiles.Ranged speedY *= dir * 150; if (projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(vector2.X, vector2.Y, speedX, speedY, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.1), 1f, projectile.owner); + Projectile.NewProjectile(vector2.X, vector2.Y, speedX, speedY, ModContent.ProjectileType(), (int)(projectile.damage * 0.1), 1f, projectile.owner); } } } diff --git a/Projectiles/Ranged/AuroraFire.cs b/Projectiles/Ranged/AuroraFire.cs new file mode 100644 index 0000000000..aae7dae614 --- /dev/null +++ b/Projectiles/Ranged/AuroraFire.cs @@ -0,0 +1,89 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class AuroraFire : ModProjectile + { + private const int framesBeforeTurning = 70; + private bool initialized = false; + private int radianAmt = 0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aurora"); + } + + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.ranged = true; + projectile.penetrate = -1; + projectile.extraUpdates = 3; + projectile.tileCollide = false; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 8; + } + + public override void AI() + { + if (projectile.ai[0] % 2 == 0) + projectile.ai[0]++; + + if (!initialized) + { + int pointCount = (int)projectile.ai[0]; + radianAmt = 180 + (int)(360 / (pointCount * 2)); + projectile.timeLeft = framesBeforeTurning * pointCount - 1; + initialized = true; + } + + //Velocity movement + projectile.localAI[1]++; + if (projectile.localAI[1] % framesBeforeTurning == 0) + { + projectile.velocity = projectile.velocity.RotatedBy(MathHelper.ToRadians(radianAmt)); + } + + //Dust behavior + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + int dustType = Utils.SelectRandom(Main.rand, new int[] + { + ModContent.DustType(), + ModContent.DustType() + }); + for (int i = 0; i < 5; i++) + { + int astral = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, 0f, 0f, 100, default, 0.8f); + Dust dust = Main.dust[astral]; + dust.noGravity = true; + dust.velocity *= 0f; + dust.scale *= Main.rand.NextFloat(); + } + } + + //rotation code for when sproot + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 240); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 240); + } + } +} diff --git a/Projectiles/Ranged/AuroraFire.png b/Projectiles/Ranged/AuroraFire.png new file mode 100644 index 0000000000..983260eb07 Binary files /dev/null and b/Projectiles/Ranged/AuroraFire.png differ diff --git a/Projectiles/Ranged/CorrodedShell.cs b/Projectiles/Ranged/CorrodedShell.cs index 1f1c2eeb41..ea2cff9d05 100644 --- a/Projectiles/Ranged/CorrodedShell.cs +++ b/Projectiles/Ranged/CorrodedShell.cs @@ -9,7 +9,6 @@ namespace CalamityMod.Projectiles.Ranged { public class CorrodedShell : ModProjectile { - public int auraTimer = 3; public override void SetStaticDefaults() { DisplayName.SetDefault("Shell"); @@ -35,8 +34,7 @@ namespace CalamityMod.Projectiles.Ranged projectile.velocity.Y *= 0.9995f; projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; - auraTimer--; - if (auraTimer <= 0) + if (projectile.timeLeft % 3 == 0) { if (projectile.owner == Main.myPlayer) { @@ -44,7 +42,6 @@ namespace CalamityMod.Projectiles.Ranged Main.projectile[aura].Calamity().forceRanged = true; Main.projectile[aura].timeLeft = 40; } - auraTimer = 3; } } diff --git a/Projectiles/Ranged/DesertMark.cs b/Projectiles/Ranged/DesertMark.cs new file mode 100644 index 0000000000..a8bbe810bc --- /dev/null +++ b/Projectiles/Ranged/DesertMark.cs @@ -0,0 +1,160 @@ +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Ranged +{ + public class DesertMark : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mark"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.timeLeft = 900; + projectile.ignoreWater = true; + projectile.alpha = 255; + projectile.ranged = true; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + } + + public override void AI() + { + Color newColor3 = new Color(255, 255, 255); + if (projectile.soundDelay == 0) + { + projectile.soundDelay = -1; + Main.PlaySound(2, projectile.Center, 60); + } + if (projectile.localAI[1] < 30f) + { + for (int num1134 = 0; num1134 < 1; num1134++) + { + float value79 = -0.5f; + float value80 = 0.9f; + float amount4 = Main.rand.NextFloat(); + Vector2 value81 = new Vector2(MathHelper.Lerp(0.1f, 1f, Main.rand.NextFloat()), MathHelper.Lerp(value79, value80, amount4)); + value81.X *= MathHelper.Lerp(2.2f, 0.6f, amount4); + value81.X *= -1f; + Vector2 value82 = new Vector2(2f, 10f); + Vector2 position4 = projectile.Center + new Vector2(60f, 200f) * value81 * 0.5f + value82; + Dust dust34 = Main.dust[Dust.NewDust(position4, 0, 0, 269, 0f, 0f, 0, default, 0.5f)]; + dust34.position = position4; + dust34.customData = projectile.Center + value82; + dust34.fadeIn = 1f; + dust34.scale = 0.3f; + if (value81.X > -1.2f) + { + dust34.velocity.X = 1f + Main.rand.NextFloat(); + } + dust34.velocity.Y = Main.rand.NextFloat() * -0.5f - 1f; + } + } + if (projectile.localAI[0] == 0f) + { + projectile.localAI[0] = 0.8f; + projectile.direction = 1; + Point point9 = projectile.Center.ToTileCoordinates(); + projectile.Center = new Vector2((float)(point9.X * 16 + 8), (float)(point9.Y * 16 + 8)); + } + projectile.rotation = projectile.localAI[1] / 40f * 6.28318548f * (float)projectile.direction; + if (projectile.localAI[1] < 33f) + { + if (projectile.alpha > 0) + { + projectile.alpha -= 8; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + } + } + if (projectile.localAI[1] > 103f) + { + if (projectile.alpha < 255) + { + projectile.alpha += 16; + } + if (projectile.alpha > 255) + { + projectile.alpha = 255; + } + } + if (projectile.alpha == 0) + { + Lighting.AddLight(projectile.Center, newColor3.ToVector3() * 0.5f); + } + for (int num1135 = 0; num1135 < 2; num1135++) + { + if (Main.rand.NextBool(10)) + { + Vector2 value83 = Vector2.UnitY.RotatedBy((double)((float)num1135 * 3.14159274f), default).RotatedBy((double)projectile.rotation, default); + Dust dust35 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 269, 0f, 0f, 225, newColor3, 1f)]; + dust35.noGravity = true; + dust35.noLight = true; + dust35.scale = projectile.Opacity * projectile.localAI[0]; + dust35.position = projectile.Center; + dust35.velocity = value83 * 2.5f; + } + } + for (int num1136 = 0; num1136 < 2; num1136++) + { + if (Main.rand.NextBool(10)) + { + Vector2 value84 = Vector2.UnitY.RotatedBy((double)((float)num1136 * 3.14159274f), default); + Dust dust36 = Main.dust[Dust.NewDust(projectile.Center, 0, 0, 269, 0f, 0f, 225, newColor3, 1.5f)]; + dust36.noGravity = true; + dust36.noLight = true; + dust36.scale = projectile.Opacity * projectile.localAI[0]; + dust36.position = projectile.Center; + dust36.velocity = value84 * 2.5f; + } + } + if (projectile.localAI[1] < 33f || projectile.localAI[1] > 87f) + { + projectile.scale = projectile.Opacity / 2f * projectile.localAI[0]; + } + projectile.velocity = Vector2.Zero; + projectile.localAI[1] += 1f; + if (projectile.localAI[1] == 60f && projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, 2f, projectile.owner, 0f, 0f); + } + if (projectile.localAI[1] >= 120f) + { + projectile.Kill(); + return; + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0)); + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Vector2 vector38 = projectile.position + new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; + Texture2D texture2D27 = Main.projectileTexture[projectile.type]; + Rectangle rectangle11 = texture2D27.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); + Color alpha5 = projectile.GetAlpha(color25); + Vector2 origin7 = rectangle11.Size() / 2f; + Color color47 = Main.hslToRgb(0.25f, 1f, 1f).MultiplyRGBA(new Color(255, 255, 255, 0)); + Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), color47, 0f, origin7, new Vector2(1f, 5f) * projectile.scale * 2f, spriteEffects, 0f); + Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, projectile.rotation, origin7, projectile.scale, spriteEffects, 0f); + Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, 0f, origin7, new Vector2(1f, 8f) * projectile.scale, spriteEffects, 0f); + return false; + } + } +} diff --git a/Projectiles/Ranged/DesertMark.png b/Projectiles/Ranged/DesertMark.png new file mode 100644 index 0000000000..2bbbfb60bb Binary files /dev/null and b/Projectiles/Ranged/DesertMark.png differ diff --git a/Projectiles/Ranged/DesertTornado.cs b/Projectiles/Ranged/DesertTornado.cs new file mode 100644 index 0000000000..d4af6be148 --- /dev/null +++ b/Projectiles/Ranged/DesertTornado.cs @@ -0,0 +1,182 @@ +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Ranged +{ + public class DesertTornado : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Tornado"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.ranged = true; + projectile.penetrate = -1; + projectile.timeLeft = 1200; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 20; + } + + public override void AI() + { + //only 1 tornado can exist at a time + projectile.localAI[1] += 1f; + if (projectile.localAI[1] >= 10f) + { + projectile.localAI[1] = 0f; + int projCount = 0; + int oldestTornado = 0; + float tornadoAge = 0f; + int projType = projectile.type; + for (int projIndex = 0; projIndex < Main.maxProjectiles; projIndex++) + { + Projectile proj = Main.projectile[projIndex]; + if (proj.active && proj.owner == projectile.owner && proj.type == projType && proj.ai[0] < 900f) + { + projCount++; + if (proj.ai[0] > tornadoAge) + { + oldestTornado = projIndex; + tornadoAge = proj.ai[0]; + } + } + } + if (projCount > 1) + { + Main.projectile[oldestTornado].netUpdate = true; + Main.projectile[oldestTornado].ai[0] = 36000f; + return; + } + } + + float lifeSpan = 900f; + if (projectile.soundDelay == 0) + { + projectile.soundDelay = -1; + Main.PlaySound(2, projectile.Center, 122); + } + projectile.ai[0] += 1f; + if (projectile.ai[0] >= lifeSpan) + { + projectile.Kill(); + } + if (projectile.localAI[0] >= 30f) + { + projectile.damage = 0; + if (projectile.ai[0] < lifeSpan - 120f) + { + float num1126 = projectile.ai[0] % 60f; + projectile.ai[0] = lifeSpan - 120f + num1126; + projectile.netUpdate = true; + } + } + float num1127 = 15f; + float num1128 = 15f; + Point point8 = projectile.Center.ToTileCoordinates(); + int num1129; + int num1130; + Collision.ExpandVertically(point8.X, point8.Y, out num1129, out num1130, (int)num1127, (int)num1128); + num1129++; + num1130--; + Vector2 value72 = new Vector2((float)point8.X, (float)num1129) * 16f + new Vector2(8f); + Vector2 value73 = new Vector2((float)point8.X, (float)num1130) * 16f + new Vector2(8f); + Vector2 vector146 = Vector2.Lerp(value72, value73, 0.5f); + Vector2 value74 = new Vector2(0f, value73.Y - value72.Y); + value74.X = value74.Y * 0.2f; + projectile.width = (int)(value74.X * 0.65f); + projectile.height = (int)value74.Y; + projectile.Center = vector146; + if (projectile.owner == Main.myPlayer) + { + bool flag74 = false; + Vector2 center16 = Main.player[projectile.owner].Center; + Vector2 top = Main.player[projectile.owner].Top; + for (float num1131 = 0f; num1131 < 1f; num1131 += 0.05f) + { + Vector2 position2 = Vector2.Lerp(value72, value73, num1131); + if (Collision.CanHitLine(position2, 0, 0, center16, 0, 0) || Collision.CanHitLine(position2, 0, 0, top, 0, 0)) + { + flag74 = true; + break; + } + } + if (!flag74 && projectile.ai[0] < lifeSpan - 120f) + { + float num1132 = projectile.ai[0] % 60f; + projectile.ai[0] = lifeSpan - 120f + num1132; + projectile.netUpdate = true; + } + } + if (projectile.ai[0] < lifeSpan - 120f) + { + return; + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + float num226 = 600f; + float num227 = 15f; + float num228 = 15f; + float num229 = projectile.ai[0]; + float scale5 = MathHelper.Clamp(num229 / 30f, 0f, 1f); + if (num229 > num226 - 60f) + { + scale5 = MathHelper.Lerp(1f, 0f, (num229 - (num226 - 60f)) / 60f); + } + Point point5 = projectile.Center.ToTileCoordinates(); + int num230; + int num231; + Collision.ExpandVertically(point5.X, point5.Y, out num230, out num231, (int)num227, (int)num228); + num230++; + num231--; + float num232 = 0.2f; + Vector2 value32 = new Vector2((float)point5.X, (float)num230) * 16f + new Vector2(8f); + Vector2 value33 = new Vector2((float)point5.X, (float)num231) * 16f + new Vector2(8f); + Vector2.Lerp(value32, value33, 0.5f); + Vector2 vector33 = new Vector2(0f, value33.Y - value32.Y); + vector33.X = vector33.Y * num232; + new Vector2(value32.X - vector33.X / 2f, value32.Y); + Texture2D texture2D23 = Main.projectileTexture[projectile.type]; + Rectangle rectangle9 = texture2D23.Frame(1, 1, 0, 0); + Vector2 origin3 = rectangle9.Size() / 2f; + float num233 = -0.06283186f * num229; + Vector2 spinningpoint2 = Vector2.UnitY.RotatedBy((double)(num229 * 0.1f), default); + float num234 = 0f; + float num235 = 5.1f; + Color value34 = new Color(225, 225, 100); + for (float num236 = (float)(int)value33.Y; num236 > (float)(int)value32.Y; num236 -= num235) + { + num234 += num235; + float num237 = num234 / vector33.Y; + float num238 = num234 * 6.28318548f / -20f; + float num239 = num237 - 0.15f; + Vector2 vector34 = spinningpoint2.RotatedBy((double)num238, default); + Vector2 value35 = new Vector2(0f, num237 + 1f); + value35.X = value35.Y * num232; + Color color39 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, value34, num237 * 2f); + if (num237 > 0.5f) + { + color39 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, value34, 2f - num237 * 2f); + } + color39.A = (byte)((float)color39.A * 0.5f); + color39 *= scale5; + vector34 *= value35 * 100f; + vector34.Y = 0f; + vector34.X = 0f; + vector34 += new Vector2(value33.X, num236) - Main.screenPosition; + Main.spriteBatch.Draw(texture2D23, vector34, new Microsoft.Xna.Framework.Rectangle?(rectangle9), color39, num233 + num238, origin3, 1f + num239, SpriteEffects.None, 0f); + } + return false; + } + } +} diff --git a/Projectiles/Ranged/DesertTornado.png b/Projectiles/Ranged/DesertTornado.png new file mode 100644 index 0000000000..c97d6cde91 Binary files /dev/null and b/Projectiles/Ranged/DesertTornado.png differ diff --git a/Projectiles/Ranged/Flash.cs b/Projectiles/Ranged/Flash.cs index c0fe9f37b3..c720de44e5 100644 --- a/Projectiles/Ranged/Flash.cs +++ b/Projectiles/Ranged/Flash.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Items.Weapons.Rogue; +using Microsoft.Xna.Framework; using System; using Terraria; using Terraria.ID; @@ -28,6 +29,7 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.5f / 255f, (255 - projectile.alpha) * 0.5f / 255f, (255 - projectile.alpha) * 0.5f / 255f); + Color dustColor = projectile.ai[1] == 1f ? CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f) : default; bool flag15 = false; bool flag16 = false; if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) @@ -72,7 +74,7 @@ namespace CalamityMod.Projectiles.Ranged num466 = num465 / num466; num463 *= num466; num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 264, 0f, 0f, 100, default, 2f); + int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 264, 0f, 0f, 100, dustColor, 2f); Dust dust = Main.dust[num467]; dust.noGravity = true; dust.position.X = projectile.Center.X; diff --git a/Projectiles/Ranged/FlashBulletProj.cs b/Projectiles/Ranged/FlashBulletProj.cs index 8eb9d0c7b7..36ae975684 100644 --- a/Projectiles/Ranged/FlashBulletProj.cs +++ b/Projectiles/Ranged/FlashBulletProj.cs @@ -51,7 +51,7 @@ namespace CalamityMod.Projectiles.Ranged Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 93); if (projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.25), 0f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(projectile.damage * 0.25), 0f, projectile.owner, 0f, 0f); } for (int k = 0; k < 5; k++) { diff --git a/Projectiles/Ranged/ImpactRound.cs b/Projectiles/Ranged/ImpactRound.cs new file mode 100644 index 0000000000..72e536c9d0 --- /dev/null +++ b/Projectiles/Ranged/ImpactRound.cs @@ -0,0 +1,73 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Ranged +{ + public class ImpactRound : ModProjectile + { + private bool initialized = false; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Impact Round"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.light = 0.5f; + projectile.alpha = 255; + projectile.extraUpdates = 7; + projectile.scale = 1.18f; + projectile.friendly = true; + projectile.ranged = true; + projectile.ignoreWater = true; + projectile.aiStyle = 1; + aiType = ProjectileID.BulletHighVelocity; + projectile.penetrate = -1; + projectile.timeLeft = 600; + projectile.tileCollide = false; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + } + + public override void AI() + { + if (!initialized) + { + initialized = true; + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LargeWeaponFire"), (int)projectile.position.X, (int)projectile.position.Y); + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.timeLeft < 600; + + public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + double damageMult = 1D; + if (crit) + { + damageMult += 0.25; + } + if (target.HitSound != SoundID.NPCHit1 && target.HitSound != SoundID.NPCHit6 && target.HitSound != SoundID.NPCHit7 && + target.HitSound != SoundID.NPCHit8 && target.HitSound != SoundID.NPCHit9 && target.HitSound != SoundID.NPCHit12 && + target.HitSound != SoundID.NPCHit13 && target.HitSound != SoundID.NPCHit14 && target.HitSound != SoundID.NPCHit18 && + target.HitSound != SoundID.NPCHit19 && target.HitSound != SoundID.NPCHit20 && target.HitSound != SoundID.NPCHit21 && + target.HitSound != SoundID.NPCHit22 && target.HitSound != SoundID.NPCHit23 && target.HitSound != SoundID.NPCHit24 && + target.HitSound != SoundID.NPCHit25 && target.HitSound != SoundID.NPCHit26 && target.HitSound != SoundID.NPCHit27 && + target.HitSound != SoundID.NPCHit28 && target.HitSound != SoundID.NPCHit29 && target.HitSound != SoundID.NPCHit31 && + target.HitSound != SoundID.NPCHit32 && target.HitSound != SoundID.NPCHit33 && target.HitSound != SoundID.NPCHit35 && + target.HitSound != SoundID.NPCHit37 && target.HitSound != SoundID.NPCHit38 && target.HitSound != SoundID.NPCHit40 && + target.HitSound != SoundID.NPCHit43 && target.HitSound != SoundID.NPCHit44 && target.HitSound != SoundID.NPCHit45 && + target.HitSound != SoundID.NPCHit46 && target.HitSound != SoundID.NPCHit47 && target.HitSound != SoundID.NPCHit48 && + target.HitSound != SoundID.NPCHit50 && target.HitSound != SoundID.NPCHit51 && target.HitSound != SoundID.NPCHit55 && + target.HitSound != SoundID.NPCHit56 && target.HitSound != SoundID.NPCHit57) + { + damageMult += 0.1; + } + damage = (int)(damage * damageMult); + } + } +} diff --git a/Projectiles/Ranged/ImpactRound.png b/Projectiles/Ranged/ImpactRound.png new file mode 100644 index 0000000000..3f761a0306 Binary files /dev/null and b/Projectiles/Ranged/ImpactRound.png differ diff --git a/Projectiles/Ranged/PiercingBullet.cs b/Projectiles/Ranged/PiercingBullet.cs new file mode 100644 index 0000000000..29d5803af7 --- /dev/null +++ b/Projectiles/Ranged/PiercingBullet.cs @@ -0,0 +1,101 @@ +using CalamityMod.Buffs.StatDebuffs; +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Ranged +{ + public class PiercingBullet : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Piercing Blow"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.light = 0.5f; + projectile.alpha = 255; + projectile.extraUpdates = 10; + projectile.scale = 1.18f; + projectile.friendly = true; + projectile.ranged = true; + projectile.ignoreWater = true; + projectile.aiStyle = 1; + aiType = ProjectileID.BulletHighVelocity; + projectile.penetrate = 1; + projectile.timeLeft = 600; + } + + public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + //Avoid touching things that you probably aren't meant to damage + if (target.defense > 999 || target.Calamity().DR >= 0.95f || target.Calamity().unbreakableDR) + return; + + //DR applies after defense, so undo it first + damage = (int)(damage * (1 / (1 - target.Calamity().DR))); + + //Then proceed to ignore all defense + int penetratableDefense = Math.Max(target.defense - Main.player[projectile.owner].armorPenetration, 0); + int penetratedDefense = Math.Min(penetratableDefense, target.defense); + damage += (int)(0.5f * penetratedDefense); + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); + Main.PlaySound(0, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); + return true; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (crit) + { + int bulletCount = 10; + for (int x = 0; x < bulletCount; x++) + { + float speed = 12f; + float xPos = projectile.Center.X + (x < bulletCount / 2 ? 500f : -500f); + float yPos = projectile.Center.Y + Main.rand.Next(-500, 501); + Vector2 origin = new Vector2(xPos, yPos); + Vector2 velocity = new Vector2(target.Center.X - origin.X, target.Center.Y - origin.Y); + velocity.Normalize(); + velocity *= speed; + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(origin, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.2), projectile.knockBack, projectile.owner); + } + } + } + target.AddBuff(ModContent.BuffType(), 900); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + if (crit) + { + int bulletCount = 10; + for (int x = 0; x < bulletCount; x++) + { + float speed = 12f; + float xPos = projectile.Center.X + (x < bulletCount / 2 ? 500f : -500f); + float yPos = projectile.Center.Y + Main.rand.Next(-500, 501); + Vector2 origin = new Vector2(xPos, yPos); + Vector2 velocity = new Vector2(target.Center.X - origin.X, target.Center.Y - origin.Y); + velocity.Normalize(); + velocity *= speed; + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(origin, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.2), projectile.knockBack, projectile.owner); + } + } + } + target.AddBuff(ModContent.BuffType(), 900); + } + } +} diff --git a/Projectiles/Ranged/PiercingBullet.png b/Projectiles/Ranged/PiercingBullet.png new file mode 100644 index 0000000000..3f761a0306 Binary files /dev/null and b/Projectiles/Ranged/PiercingBullet.png differ diff --git a/Projectiles/Ranged/VanquisherArrowMain.cs b/Projectiles/Ranged/VanquisherArrowMain.cs index 563ce01430..894b187207 100644 --- a/Projectiles/Ranged/VanquisherArrowMain.cs +++ b/Projectiles/Ranged/VanquisherArrowMain.cs @@ -9,8 +9,6 @@ namespace CalamityMod.Projectiles.Ranged { public class VanquisherArrowMain : ModProjectile { - private int projCount = 18; - public override void SetStaticDefaults() { DisplayName.SetDefault("Arrow"); @@ -32,20 +30,17 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - projCount--; - if (projCount <= 0) + if (projectile.timeLeft % 18 == 0) { if (projectile.owner == Main.myPlayer) { Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); } - projCount = 18; } } public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { - Vector2 origin = new Vector2(0f, 0f); Color color = Color.White; if (projectile.timeLeft < 85) { diff --git a/Projectiles/Rogue/AdamantiteThrowingAxeProjectile.cs b/Projectiles/Rogue/AdamantiteThrowingAxeProjectile.cs index ee62d90031..f8fbdadc74 100644 --- a/Projectiles/Rogue/AdamantiteThrowingAxeProjectile.cs +++ b/Projectiles/Rogue/AdamantiteThrowingAxeProjectile.cs @@ -23,6 +23,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.timeLeft = 600; aiType = ProjectileID.Shuriken; projectile.Calamity().rogue = true; + projectile.localNPCHitCooldown = 10; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) @@ -39,5 +40,47 @@ namespace CalamityMod.Projectiles.Rogue Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, ModContent.ItemType()); } } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (projectile.Calamity().stealthStrike && Main.myPlayer == projectile.owner) + { + for (int n = 0; n < 3; n++) + { + float xStart = projectile.position.X + Main.rand.Next(-400, 400); + float yStart = projectile.position.Y + Main.rand.Next(500, 800); + Vector2 startPos = new Vector2(xStart, yStart); + Vector2 velocity = projectile.Center - startPos; + velocity.X += (float)Main.rand.Next(-100, 101); + float travelDist = velocity.Length(); + float lightningSpeed = 8f; + travelDist = lightningSpeed / travelDist; + velocity.X *= travelDist; + velocity.Y *= travelDist; + Projectile.NewProjectile(startPos, velocity, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, Main.rand.Next(2), 0f); + } + } + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + if (projectile.Calamity().stealthStrike && Main.myPlayer == projectile.owner) + { + for (int n = 0; n < Main.rand.Next(3,6); n++) + { + float xStart = projectile.position.X + Main.rand.Next(-400, 400); + float yStart = projectile.position.Y + Main.rand.Next(500, 800); + Vector2 startPos = new Vector2(xStart, yStart); + Vector2 velocity = projectile.Center - startPos; + velocity.X += (float)Main.rand.Next(-100, 101); + float travelDist = velocity.Length(); + float lightningSpeed = 16f; + travelDist = lightningSpeed / travelDist; + velocity.X *= travelDist; + velocity.Y *= travelDist; + Projectile.NewProjectile(startPos, velocity, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, Main.rand.Next(2), 1f); + } + } + } } } diff --git a/Projectiles/Rogue/ApoctolithProj.cs b/Projectiles/Rogue/ApoctolithProj.cs new file mode 100644 index 0000000000..c89abfc6bd --- /dev/null +++ b/Projectiles/Rogue/ApoctolithProj.cs @@ -0,0 +1,115 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Rogue +{ + public class ApoctolithProj : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Apoctolith"); + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.friendly = true; + projectile.Calamity().rogue = true; + } + + public override void AI() + { + //Constant rotation and gravity + projectile.rotation += 0.4f * projectile.direction; + projectile.velocity.Y += 0.3f; + if (projectile.velocity.Y > 16f) + { + projectile.velocity.Y = 16f; + } + //Dust trail + if (Main.rand.NextBool(13)) + { + Dust.NewDust(projectile.position, projectile.width, projectile.height, 180, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, 150, default, 0.9f); + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 300); + if (crit && target.defense > 0) + { + target.defense -= Math.Min(target.defense, 15); + } + if (projectile.Calamity().stealthStrike) + { + target.AddBuff(ModContent.BuffType(), 120); + } + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 300); + if (projectile.Calamity().stealthStrike) + { + target.AddBuff(ModContent.BuffType(), 120); + } + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(21, (int)projectile.position.X, (int)projectile.position.Y); + //Dust on impact + int dust_splash = 0; + while (dust_splash < 9) + { + Dust.NewDust(projectile.position, projectile.width, projectile.height, 180, -projectile.velocity.X * 0.15f, -projectile.velocity.Y * 0.15f, 120, default, 1.5f); + dust_splash += 1; + } + // This only triggers if stealth is full + if (projectile.Calamity().stealthStrike) + { + int split = 0; + while (split < 5) + { + //Calculate the velocity of the projectile + float shardspeedX = -projectile.velocity.X * Main.rand.NextFloat(.5f, .7f) + Main.rand.NextFloat(-3f, 3f); + float shardspeedY = -projectile.velocity.Y * Main.rand.Next(50, 70) * 0.01f + Main.rand.Next(-8, 9) * 0.2f; + //Prevents the projectile speed from being too low + if (shardspeedX < 2f && shardspeedX > -2f) + { + shardspeedX += -projectile.velocity.X; + } + if (shardspeedY > 2f && shardspeedY < 2f) + { + shardspeedY += -projectile.velocity.Y; + } + + //Spawn the projectile + int shard = Projectile.NewProjectile(projectile.position.X + shardspeedX, projectile.position.Y + shardspeedY, shardspeedX, shardspeedY, ModContent.ProjectileType(), (int)(projectile.damage * 0.5), projectile.knockBack / 2f, projectile.owner); + Main.projectile[shard].frame = Main.rand.Next(3); + split += 1; + } + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + Vector2 origin = new Vector2(32f, 33f); + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, origin, projectile.scale, SpriteEffects.None, 0f); + return false; + } + + public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = ModContent.GetTexture("CalamityMod/Items/Weapons/Rogue/ApoctolithGlow"); + Vector2 origin = new Vector2(32f, 33f); + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, origin, projectile.scale, SpriteEffects.None, 0f); + } + } +} diff --git a/Projectiles/Rogue/ApoctolithProj.png b/Projectiles/Rogue/ApoctolithProj.png new file mode 100644 index 0000000000..8bb4754fdf Binary files /dev/null and b/Projectiles/Rogue/ApoctolithProj.png differ diff --git a/Projectiles/Rogue/ApoctolithShard.cs b/Projectiles/Rogue/ApoctolithShard.cs new file mode 100644 index 0000000000..0c9f5c5c94 --- /dev/null +++ b/Projectiles/Rogue/ApoctolithShard.cs @@ -0,0 +1,53 @@ +using CalamityMod.Buffs.DamageOverTime; +using Terraria; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Rogue +{ + public class ApoctolithShard : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Apoctolith Shard"); + Main.projFrames[projectile.type] = 3; + } + public override void SetDefaults() + { + projectile.friendly = true; + projectile.width = 13; + projectile.height = 13; + projectile.Calamity().rogue = true; + } + public override void AI() + { + //Rotation and gravity + projectile.rotation += 0.6f * projectile.direction; + projectile.velocity.Y += 0.27f; + if (projectile.velocity.Y > 16f) + { + projectile.velocity.Y = 16f; + } + + } + public override void Kill(int timeLeft) + { + Main.PlaySound(0, (int)projectile.position.X, (int)projectile.position.Y); + //Dust effect + int splash = 0; + while (splash < 4) + { + Dust.NewDust(projectile.position, projectile.width, projectile.height, 67, -projectile.velocity.X * 0.15f, -projectile.velocity.Y * 0.10f, 150, default, 0.9f); + splash += 1; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 120); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 120); + } + } +} diff --git a/Projectiles/Rogue/ApoctolithShard.png b/Projectiles/Rogue/ApoctolithShard.png new file mode 100644 index 0000000000..e7cc9f5a56 Binary files /dev/null and b/Projectiles/Rogue/ApoctolithShard.png differ diff --git a/Projectiles/Rogue/AuroradicalSplitter.cs b/Projectiles/Rogue/AuroradicalSplitter.cs new file mode 100644 index 0000000000..7ee1c48c78 --- /dev/null +++ b/Projectiles/Rogue/AuroradicalSplitter.cs @@ -0,0 +1,129 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using CalamityMod.Projectiles.Melee; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Rogue +{ + public class AuroradicalSplitter : ModProjectile + { + public int[] dustTypes = new int[] + { + ModContent.DustType(), + ModContent.DustType() + }; + + public override string Texture => "CalamityMod/Projectiles/Rogue/AuroradicalStar"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Auroradical Star"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + + public override void SetDefaults() + { + projectile.width = 50; + projectile.height = 50; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.alpha = 100; + projectile.penetrate = -1; + projectile.timeLeft = 50; + projectile.Calamity().rogue = true; + projectile.localNPCHitCooldown = 10; + projectile.usesLocalNPCImmunity = true; + } + + public override void AI() + { + //Rotation + projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; + + //Lighting + Lighting.AddLight(projectile.Center, 0.3f, 0.5f, 0.1f); + + //sound effects + if (projectile.soundDelay == 0) + { + projectile.soundDelay = 20 + Main.rand.Next(40); + if (Main.rand.NextBool(5)) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 9); + } + } + + //Change the scale size a little bit to make it pulse in and out + float scaleAmt = (float)Main.mouseTextColor / 200f - 0.35f; + scaleAmt *= 0.2f; + projectile.scale = scaleAmt + 0.95f; + + //Spawn dust + projectile.ai[0] += 1f; + if (projectile.ai[0] > 15f) + { + int astral = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, Main.rand.Next(dustTypes), 0f, 0f, 100, default, 0.8f); + Main.dust[astral].noGravity = true; + Main.dust[astral].velocity *= 0f; + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + + public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, projectile.alpha); + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 180); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 180); + } + + public override void Kill(int timeLeft) + { + if (Main.myPlayer != projectile.owner) + return; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 9, 1f, 0f); + for (float i = 0; i < 5; i++) + { + float angle = MathHelper.TwoPi / 5f * i; + int star = Projectile.NewProjectile(projectile.Center, angle.ToRotationVector2() * 5f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[star].Calamity().stealthStrike = projectile.Calamity().stealthStrike; + } + projectile.position = projectile.Center; + projectile.width = projectile.height = 96; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int d = 0; d < 2; d++) + { + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, Main.rand.Next(dustTypes), 0f, 0f, 50, default, 1f); + } + for (int d = 0; d < 20; d++) + { + int astral = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, Main.rand.Next(dustTypes), 0f, 0f, 0, default, 1.5f); + Main.dust[astral].noGravity = true; + Main.dust[astral].velocity *= 3f; + astral = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 50, default, 1f); + Main.dust[astral].velocity *= 2f; + Main.dust[astral].noGravity = true; + } + for (int g = 0; g < 3; g++) + { + Gore.NewGore(projectile.position, new Vector2(projectile.velocity.X * 0.05f, projectile.velocity.Y * 0.05f), Main.rand.Next(16, 18), 1f); + } + } + } +} diff --git a/Projectiles/Rogue/AuroradicalStar.cs b/Projectiles/Rogue/AuroradicalStar.cs new file mode 100644 index 0000000000..f7468a41c1 --- /dev/null +++ b/Projectiles/Rogue/AuroradicalStar.cs @@ -0,0 +1,183 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using CalamityMod.Projectiles.Melee; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Rogue +{ + public class AuroradicalStar : ModProjectile + { + public int[] dustTypes = new int[] + { + ModContent.DustType(), + ModContent.DustType() + }; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Auroradical Star"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + + public override void SetDefaults() + { + projectile.width = 50; + projectile.height = 50; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.alpha = 100; + projectile.penetrate = 1; + projectile.timeLeft = 485; + projectile.Calamity().rogue = true; + } + + public override void AI() + { + //Rotation + projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; + + //Lighting + Lighting.AddLight(projectile.Center, 0.3f, 0.5f, 0.1f); + + //sound effects + if (projectile.soundDelay == 0) + { + projectile.soundDelay = 20 + Main.rand.Next(40); + if (Main.rand.NextBool(5)) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 9); + } + } + + //Change the scale size a little bit to make it pulse in and out + float scaleAmt = (float)Main.mouseTextColor / 200f - 0.35f; + scaleAmt *= 0.2f; + projectile.scale = scaleAmt + 0.95f; + + //Spawn dust + projectile.ai[0] += 1f; + if (projectile.ai[0] > 15f) + { + int astral = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, Main.rand.Next(dustTypes), 0f, 0f, 100, default, 0.8f); + Main.dust[astral].noGravity = true; + Main.dust[astral].velocity *= 0f; + } + + //Home in + float maxDistance = 1600f; + int targetIndex = -1; + int i; + for (i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].CanBeChasedBy(projectile, false)) + { + float extraDistance = (Main.npc[i].width / 2) + (Main.npc[i].height / 2); + + if (Vector2.Distance(Main.npc[i].Center, projectile.Center) < (maxDistance + extraDistance)) + { + targetIndex = i; + break; + } + } + } + if (targetIndex != -1) + { + Vector2 targetVec = Main.npc[i].Center - projectile.Center; + if (targetVec.Length() < 60f) + { + projectile.Kill(); + return; + } + if (projectile.ai[0] >= 120f) + { + projectile.ai[1] += 1f; + if (projectile.ai[1] < 120f) + { + float speedMult = 25f; + targetVec.Normalize(); + targetVec *= speedMult; + projectile.velocity = (projectile.velocity * 15f + targetVec) / 16f; + projectile.velocity.Normalize(); + projectile.velocity *= speedMult; + } + else if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 18f) + { + projectile.velocity.X *= 1.01f; + projectile.velocity.Y *= 1.01f; + } + } + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + + public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, projectile.alpha); + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 180); + if (projectile.Calamity().stealthStrike && Main.myPlayer == projectile.owner) + { + Vector2 pos = new Vector2(target.Center.X + target.width * 0.5f + Main.rand.Next(-201, 201), Main.screenPosition.Y - 600f - Main.rand.Next(50)); + Vector2 velocity = (target.Center - pos) / 40f; + int dmg = projectile.damage / 2; + int comet = Projectile.NewProjectile(pos, velocity, ModContent.ProjectileType(), dmg, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[comet].Calamity().forceRogue = true; + Main.projectile[comet].Calamity().lineColor = Main.rand.Next(3);; + } + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 180); + if (projectile.Calamity().stealthStrike && Main.myPlayer == projectile.owner) + { + Vector2 pos = new Vector2(target.Center.X + target.width * 0.5f + Main.rand.Next(-201, 201), Main.screenPosition.Y - 600f - Main.rand.Next(50)); + Vector2 velocity = (target.Center - pos) / 40f; + int dmg = projectile.damage / 2; + int comet = Projectile.NewProjectile(pos, velocity, ModContent.ProjectileType(), dmg, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[comet].Calamity().forceRogue = true; + Main.projectile[comet].Calamity().lineColor = Main.rand.Next(3);; + } + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 9, 1f, 0f); + projectile.position = projectile.Center; + projectile.width = projectile.height = 96; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.localNPCHitCooldown = 10; + projectile.usesLocalNPCImmunity = true; + projectile.Damage(); + for (int d = 0; d < 2; d++) + { + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, Main.rand.Next(dustTypes), 0f, 0f, 50, default, 1f); + } + for (int d = 0; d < 20; d++) + { + int astral = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, Main.rand.Next(dustTypes), 0f, 0f, 0, default, 1.5f); + Main.dust[astral].noGravity = true; + Main.dust[astral].velocity *= 3f; + astral = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 50, default, 1f); + Main.dust[astral].velocity *= 2f; + Main.dust[astral].noGravity = true; + } + for (int g = 0; g < 3; g++) + { + Gore.NewGore(projectile.position, new Vector2(projectile.velocity.X * 0.05f, projectile.velocity.Y * 0.05f), Main.rand.Next(16, 18), 1f); + } + } + } +} diff --git a/Projectiles/Rogue/AuroradicalStar.png b/Projectiles/Rogue/AuroradicalStar.png new file mode 100644 index 0000000000..cd94acd17f Binary files /dev/null and b/Projectiles/Rogue/AuroradicalStar.png differ diff --git a/Projectiles/Rogue/BallisticPoisonBombProj.cs b/Projectiles/Rogue/BallisticPoisonBombProj.cs index dfe929ff3e..ffcedef6f8 100644 --- a/Projectiles/Rogue/BallisticPoisonBombProj.cs +++ b/Projectiles/Rogue/BallisticPoisonBombProj.cs @@ -91,13 +91,13 @@ namespace CalamityMod.Projectiles.Rogue if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) { projectile.velocity.X = projectile.velocity.X * 0.97f; - if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) + if (projectile.velocity.X > -0.01f && projectile.velocity.X < 0.01f) { projectile.velocity.X = 0f; projectile.netUpdate = true; } } - projectile.velocity.Y = projectile.velocity.Y + 0.2f; + projectile.velocity.Y += 0.2f; } projectile.rotation += projectile.velocity.X * 0.1f; } diff --git a/Projectiles/Rogue/BlunderBoosterLightning.cs b/Projectiles/Rogue/BlunderBoosterLightning.cs new file mode 100644 index 0000000000..6808e31235 --- /dev/null +++ b/Projectiles/Rogue/BlunderBoosterLightning.cs @@ -0,0 +1,126 @@ +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.Rogue +{ + public class BlunderBoosterLightning : ModProjectile + { + public static int frameWidth = 12; + public static int frameHeight = 26; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.penetrate = 3; + projectile.timeLeft = 120; + projectile.Calamity().rogue = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 15; + } + + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 3) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= Main.projFrames[projectile.type]) + { + projectile.frame = 0; + } + + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + + if (projectile.timeLeft < 55 && projectile.ai[1] != 1f) + { + projectile.tileCollide = true; + } + + projectile.ai[1]++; + if (projectile.ai[1] >= 15f) + { + float minDist = 999f; + int index = -1; + for (int i = 0; i < Main.npc.Length; i++) + { + NPC npc = Main.npc[i]; + if (!npc.friendly && !npc.townNPC && npc.active && !npc.dontTakeDamage && npc.chaseable && npc.type != NPCID.TargetDummy) + { + float dist = (projectile.Center - npc.Center).Length(); + if (dist < minDist) + { + minDist = dist; + index = i; + } + } + } + + Vector2 velocityNew; + if (minDist < 999f && index != -1) + { + velocityNew = Main.npc[index].Center - projectile.Center; + velocityNew.Normalize(); + velocityNew *= 2f; + projectile.velocity += velocityNew; + if (projectile.velocity.Length() > 10f) + { + projectile.velocity.Normalize(); + projectile.velocity *= 10f; + } + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Electrified, 180); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Electrified, 180); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D sprite; + if (projectile.ai[0] == 0f) + sprite = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/BlunderBoosterLightning"); + else + sprite = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/BlunderBoosterLightning2"); + Color drawColour = Color.White; + + Vector2 origin = new Vector2(frameWidth / 2, frameHeight / 2); + spriteBatch.Draw(sprite, projectile.Center - Main.screenPosition, new Rectangle(0, frameHeight * projectile.frame, frameWidth, frameHeight), drawColour, projectile.rotation, origin, 1f, SpriteEffects.None, 0f); + return false; + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 93, 0.25f, 0f); + + for (int i = 0; i < 5; i++) + { + int dustType = 60; + int dust = Dust.NewDust(projectile.Center, 1, 1, dustType, projectile.velocity.X, projectile.velocity.Y, 0, default, 0.5f); + Main.dust[dust].noGravity = true; + } + } + } +} diff --git a/Projectiles/Rogue/BlunderBoosterLightning.png b/Projectiles/Rogue/BlunderBoosterLightning.png new file mode 100644 index 0000000000..acf365719f Binary files /dev/null and b/Projectiles/Rogue/BlunderBoosterLightning.png differ diff --git a/Projectiles/Rogue/BlunderBoosterLightning2.png b/Projectiles/Rogue/BlunderBoosterLightning2.png new file mode 100644 index 0000000000..e397bdbbd8 Binary files /dev/null and b/Projectiles/Rogue/BlunderBoosterLightning2.png differ diff --git a/Projectiles/Rogue/BrackishFlaskProj.cs b/Projectiles/Rogue/BrackishFlaskProj.cs index 0864fc042e..1c3cd7792b 100644 --- a/Projectiles/Rogue/BrackishFlaskProj.cs +++ b/Projectiles/Rogue/BrackishFlaskProj.cs @@ -1,4 +1,5 @@ using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -27,15 +28,11 @@ namespace CalamityMod.Projectiles.Rogue public override void Kill(int timeLeft) { Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 107); - int randomDust = Main.rand.Next(2); - if (randomDust == 0) - { - randomDust = 33; - } - else - { - randomDust = 89; - } + int randomDust = Utils.SelectRandom(Main.rand, new int[] + { + 33, + 89 + }); for (int k = 0; k < 5; k++) { Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, randomDust, projectile.oldVelocity.X, projectile.oldVelocity.Y); @@ -47,7 +44,13 @@ namespace CalamityMod.Projectiles.Rogue int i; if (projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + if (projectile.Calamity().stealthStrike) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, -32f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + + Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + for (i = 0; i < 4; i++) { offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; diff --git a/Projectiles/Rogue/BrackishSpear.cs b/Projectiles/Rogue/BrackishSpear.cs new file mode 100644 index 0000000000..d7c4dbb5bc --- /dev/null +++ b/Projectiles/Rogue/BrackishSpear.cs @@ -0,0 +1,114 @@ +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Rogue +{ + public class BrackishSpear : ModProjectile + { + public override string Texture => "CalamityMod/Projectiles/Magic/AtlantisSpear"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Atlantis Spear"); + } + + public override void SetDefaults() + { + projectile.width = 52; + projectile.height = 52; + projectile.aiStyle = 4; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.Calamity().rogue = true; + aiType = ProjectileID.CrystalVileShardHead; + projectile.usesIDStaticNPCImmunity = true; + projectile.idStaticNPCHitCooldown = 6; + } + + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; + if (projectile.ai[0] == 0f) + { + projectile.alpha -= 50; + if (projectile.alpha <= 0) + { + projectile.alpha = 0; + projectile.ai[0] = 1f; + if (projectile.ai[1] == 0f) + { + projectile.ai[1] += 1f; + projectile.position += projectile.velocity * 1f; + } + if (Main.myPlayer == projectile.owner) + { + int projType = projectile.type; + if (projectile.ai[1] >= (float)(12 + Main.rand.Next(2))) + { + projType = ModContent.ProjectileType(); + } + int dmg = projectile.damage; + float kBack = projectile.knockBack; + int number = Projectile.NewProjectile(projectile.position.X + projectile.velocity.X + (float)(projectile.width / 2), projectile.position.Y + projectile.velocity.Y + (float)(projectile.height / 2), projectile.velocity.X, projectile.velocity.Y, projType, dmg, kBack, projectile.owner, 0f, projectile.ai[1] + 1f); + NetMessage.SendData(27, -1, -1, null, number, 0f, 0f, 0f, 0, 0, 0); + } + } + } + else + { + if (projectile.alpha < 170 && projectile.alpha + 5 >= 170) + { + for (int num55 = 0; num55 < 8; num55++) + { + int num56 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 206, projectile.velocity.X * 0.005f, projectile.velocity.Y * 0.005f, 200, default, 1f); + Main.dust[num56].noGravity = true; + Main.dust[num56].velocity *= 0.5f; + } + } + projectile.alpha += 7; + if (projectile.alpha >= 255) + { + projectile.Kill(); + } + } + if (Main.rand.NextBool(4)) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 206, projectile.velocity.X * 0.005f, projectile.velocity.Y * 0.005f); + } + } + + public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, projectile.alpha); + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Venom, 600); + target.AddBuff(BuffID.Poisoned, 600); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Venom, 600); + target.AddBuff(BuffID.Poisoned, 600); + } + + public override void Kill(int timeLeft) + { + int numProj = 2; + float rotation = MathHelper.ToRadians(20); + for (int i = 0; i < numProj; i++) + { + Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + int projectile2 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[projectile2].penetrate = 1; + } + for (int k = 0; k < 3; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 206, projectile.oldVelocity.X * 0.005f, projectile.oldVelocity.Y * 0.005f); + } + } + } +} diff --git a/Projectiles/Rogue/BrackishSpear2.cs b/Projectiles/Rogue/BrackishSpear2.cs new file mode 100644 index 0000000000..4580d64e3b --- /dev/null +++ b/Projectiles/Rogue/BrackishSpear2.cs @@ -0,0 +1,94 @@ +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Rogue +{ + public class BrackishSpear2 : ModProjectile + { + public override string Texture => "CalamityMod/Projectiles/Magic/AtlantisSpear"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Atlantis Spear"); + } + + public override void SetDefaults() + { + projectile.width = 52; + projectile.height = 52; + projectile.aiStyle = 4; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.Calamity().rogue = true; + aiType = ProjectileID.CrystalVileShardShaft; + projectile.usesIDStaticNPCImmunity = true; + projectile.idStaticNPCHitCooldown = 10; + } + + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; + if (projectile.ai[0] == 0f) + { + projectile.alpha -= 50; + if (projectile.alpha <= 0) + { + projectile.alpha = 0; + projectile.ai[0] = 1f; + if (projectile.ai[1] == 0f) + { + projectile.ai[1] += 1f; + projectile.position += projectile.velocity * 1f; + } + } + } + else + { + if (projectile.alpha < 170 && projectile.alpha + 5 >= 170) + { + for (int num55 = 0; num55 < 8; num55++) + { + int num56 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 206, projectile.velocity.X * 0.005f, projectile.velocity.Y * 0.005f, 200, default, 1f); + Main.dust[num56].noGravity = true; + Main.dust[num56].velocity *= 0.5f; + } + } + projectile.alpha += 7; + if (projectile.alpha >= 255) + { + projectile.Kill(); + } + } + if (Main.rand.NextBool(4)) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 206, projectile.velocity.X * 0.005f, projectile.velocity.Y * 0.005f); + } + } + + public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, projectile.alpha); + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Venom, 600); + target.AddBuff(BuffID.Poisoned, 600); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Venom, 600); + target.AddBuff(BuffID.Poisoned, 600); + } + + public override void Kill(int timeLeft) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 206, projectile.oldVelocity.X * 0.005f, projectile.oldVelocity.Y * 0.005f); + } + } + } +} diff --git a/Projectiles/Rogue/BrackishWater.cs b/Projectiles/Rogue/BrackishWater.cs index c63f5ad0c3..c2d0d092ec 100644 --- a/Projectiles/Rogue/BrackishWater.cs +++ b/Projectiles/Rogue/BrackishWater.cs @@ -31,15 +31,11 @@ namespace CalamityMod.Projectiles.Rogue Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 21); projectile.localAI[0] += 1f; } - int randomDust = Main.rand.Next(2); - if (randomDust == 0) - { - randomDust = 33; - } - else - { - randomDust = 89; - } + int randomDust = Utils.SelectRandom(Main.rand, new int[] + { + 33, + 89 + }); for (int num457 = 0; num457 < 3; num457++) { int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDust, 0f, 0f, 100, default, 1.2f); @@ -53,7 +49,7 @@ namespace CalamityMod.Projectiles.Rogue { if (projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); } } diff --git a/Projectiles/Rogue/BrackishWaterBlast.cs b/Projectiles/Rogue/BrackishWaterBlast.cs index 5e97031360..384a893570 100644 --- a/Projectiles/Rogue/BrackishWaterBlast.cs +++ b/Projectiles/Rogue/BrackishWaterBlast.cs @@ -28,15 +28,11 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0.5f / 255f, (255 - projectile.alpha) * 0.75f / 255f); - int randomDust = Main.rand.Next(2); - if (randomDust == 0) - { - randomDust = 33; - } - else - { - randomDust = 89; - } + int randomDust = Utils.SelectRandom(Main.rand, new int[] + { + 33, + 89 + }); if (projectile.localAI[0] == 0f) { Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 21); @@ -76,8 +72,8 @@ namespace CalamityMod.Projectiles.Rogue } num461 *= 0.7f; projectile.ai[0] += 4f; - int num462 = 0; - while ((float)num462 < num461) + float num462 = 0f; + while (num462 < num461) { float num463 = (float)Main.rand.Next(-10, 11); float num464 = (float)Main.rand.Next(-10, 11); diff --git a/Projectiles/Rogue/BrimbladeProj.cs b/Projectiles/Rogue/BrimbladeProj.cs index d95b0da398..f64b912b56 100644 --- a/Projectiles/Rogue/BrimbladeProj.cs +++ b/Projectiles/Rogue/BrimbladeProj.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 180); - int numProj = 2; + int numProj = projectile.Calamity().stealthStrike ? 3 : 2; float rotation = MathHelper.ToRadians(20); if (projectile.owner == Main.myPlayer) { @@ -47,7 +47,7 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitPvp(Player target, int damage, bool crit) { target.AddBuff(ModContent.BuffType(), 180); - int numProj = 2; + int numProj = projectile.Calamity().stealthStrike ? 3 : 2; float rotation = MathHelper.ToRadians(20); if (projectile.owner == Main.myPlayer) { diff --git a/Projectiles/Rogue/CobaltEnergy.cs b/Projectiles/Rogue/CobaltEnergy.cs new file mode 100644 index 0000000000..d201365355 --- /dev/null +++ b/Projectiles/Rogue/CobaltEnergy.cs @@ -0,0 +1,131 @@ +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.Rogue +{ + public class CobaltEnergy : ModProjectile + { + private bool hasHitEnemy = false; + private int targetNPC = -1; + private List previousNPCs = new List() { -1 }; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cobalt Energy"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.penetrate = 3; + projectile.timeLeft = 600; + projectile.Calamity().rogue = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + } + + public override void AI() + { + for (int index = 0; index < 2; ++index) + { + int ruby = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 88, projectile.velocity.X, projectile.velocity.Y, 90, new Color(), 1.2f); + Dust dust = Main.dust[ruby]; + dust.noGravity = true; + dust.velocity *= 0.3f; + } + + if (!hasHitEnemy && projectile.timeLeft < 575) + { + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 350f, 12f, 20f); + } + else if (hasHitEnemy) + { + if (targetNPC >= 0) + { + Vector2 newVelocity = Main.npc[targetNPC].Center - projectile.Center; + newVelocity.Normalize(); + newVelocity *= 15f; + projectile.velocity = newVelocity; + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + float minDist = 999f; + int index = 0; + for (int i = 0; i < Main.npc.Length; i++) + { + bool hasHitNPC = false; + for (int j = 0; j < previousNPCs.Count; j++) + { + if (previousNPCs[j] == i) + { + hasHitNPC = true; + } + } + + NPC npc = Main.npc[i]; + if (npc == target) + { + previousNPCs.Add(i); + } + if (!npc.friendly && !npc.townNPC && npc.active && !npc.dontTakeDamage && npc.chaseable && npc != target && !hasHitNPC && npc.type != NPCID.TargetDummy) + { + float dist = (projectile.Center - npc.Center).Length(); + if (dist < minDist) + { + minDist = dist; + index = i; + } + } + } + + Vector2 velocityNew; + if (minDist < 999f) + { + hasHitEnemy = true; + targetNPC = index; + velocityNew = Main.npc[index].Center - projectile.Center; + velocityNew.Normalize(); + velocityNew *= 15f; + projectile.velocity = velocityNew; + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + Collision.HitTiles(projectile.position + projectile.velocity, projectile.velocity, projectile.width, projectile.height); + Main.PlaySound(0, projectile.position); + projectile.Kill(); + return false; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(0, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); + for (int index1 = 0; index1 < 15; ++index1) + { + int ruby = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 88, projectile.oldVelocity.X, projectile.oldVelocity.Y, 50, new Color(), 1.2f); + Dust dust = Main.dust[ruby]; + dust.noGravity = true; + dust.scale *= 1.25f; + dust.velocity *= 0.5f; + } + } + } +} diff --git a/Projectiles/Rogue/CobaltEnergy.png b/Projectiles/Rogue/CobaltEnergy.png new file mode 100644 index 0000000000..0056fc1e24 Binary files /dev/null and b/Projectiles/Rogue/CobaltEnergy.png differ diff --git a/Projectiles/Rogue/CosmicScythe.cs b/Projectiles/Rogue/CosmicScythe.cs index f280bc3277..d0b1149701 100644 --- a/Projectiles/Rogue/CosmicScythe.cs +++ b/Projectiles/Rogue/CosmicScythe.cs @@ -49,7 +49,7 @@ namespace CalamityMod.Projectiles.Rogue { if (projectile.timeLeft > 350) projectile.velocity *= 1.06f; - projectile.damage = (int) ((double)originalDamage * 1.25); + projectile.damage = (int)(originalDamage * 1.25); CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 1500f, 20f, 20f); } } diff --git a/Projectiles/Rogue/CraniumSMASH.cs b/Projectiles/Rogue/CraniumSMASH.cs new file mode 100644 index 0000000000..1fed76310b --- /dev/null +++ b/Projectiles/Rogue/CraniumSMASH.cs @@ -0,0 +1,50 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Microsoft.Xna.Framework; + +namespace CalamityMod.Projectiles.Rogue +{ + public class CraniumSMASH : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cranium SMASH"); + } + + public override void SetDefaults() + { + projectile.width = 192; + projectile.height = 192; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.timeLeft = 10; + projectile.Calamity().rogue = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = -2; + } + + public override void AI() + { + if (projectile.ai[0] == 0f) + SpawnExplosionDust(); + if (projectile.ai[0] <= 1f) + projectile.ai[0]++; + } + + void SpawnExplosionDust() + { + Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14); + CalamityUtils.ExplosionGores(projectile, 3); + for (int num194 = 0; num194 < 25; num194++) + { + int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 135, 0f, 0f, 100, default, 2f); + Main.dust[num195].noGravity = true; + Main.dust[num195].velocity *= 0f; + } + } + } +} diff --git a/Projectiles/Rogue/CraniumSMASH.png b/Projectiles/Rogue/CraniumSMASH.png new file mode 100644 index 0000000000..983260eb07 Binary files /dev/null and b/Projectiles/Rogue/CraniumSMASH.png differ diff --git a/Projectiles/Rogue/CraniumSmasherGlow.png b/Projectiles/Rogue/CraniumSmasherGlow.png new file mode 100644 index 0000000000..6322eec4e2 Binary files /dev/null and b/Projectiles/Rogue/CraniumSmasherGlow.png differ diff --git a/Projectiles/Rogue/CraniumSmasherStealth.cs b/Projectiles/Rogue/CraniumSmasherStealth.cs new file mode 100644 index 0000000000..058da37834 --- /dev/null +++ b/Projectiles/Rogue/CraniumSmasherStealth.cs @@ -0,0 +1,86 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Rogue +{ + public class CraniumSmasherStealth : ModProjectile + { + public override string Texture => "CalamityMod/Projectiles/Rogue/CraniumSmasherExplosive"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Stealthy Cranium Smasher"); + } + + public override void SetDefaults() + { + projectile.width = 50; + projectile.height = 50; + projectile.friendly = true; + projectile.penetrate = 5; + projectile.timeLeft = 300; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 15; + projectile.tileCollide = false; + projectile.Calamity().rogue = true; + } + + public override void AI() + { + projectile.ai[0] += 1f; + if (projectile.ai[0] >= 5f) + { + projectile.tileCollide = true; + } + projectile.rotation += projectile.velocity.X * 0.02f; + projectile.velocity.Y = projectile.velocity.Y + 0.085f; + projectile.velocity.X = projectile.velocity.X * 0.99f; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (projectile.owner == Main.myPlayer) + { + int smash = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(projectile.damage * 0.5), projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[smash].Center = projectile.Center; + } + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + if (projectile.owner == Main.myPlayer) + { + int smash = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(projectile.damage * 0.5), projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[smash].Center = projectile.Center; + } + } + + public override void Kill(int timeLeft) + { + projectile.position = projectile.Center; + projectile.width = projectile.height = 192; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.Damage(); + Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14); + CalamityUtils.ExplosionGores(projectile, 3); + for (int num194 = 0; num194 < 25; num194++) + { + int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 135, 0f, 0f, 100, default, 2f); + Main.dust[num195].noGravity = true; + Main.dust[num195].velocity *= 0f; + } + } + + public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/CraniumSmasherGlow"); + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, tex.Size() / 2, projectile.scale, SpriteEffects.None, 0f); + } + } +} diff --git a/Projectiles/Rogue/DuststormCloud.cs b/Projectiles/Rogue/DuststormCloud.cs index e89531a8e5..81250cee64 100644 --- a/Projectiles/Rogue/DuststormCloud.cs +++ b/Projectiles/Rogue/DuststormCloud.cs @@ -2,69 +2,66 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { - public class DuststormCloud : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cloud"); - Main.projFrames[projectile.type] = 4; - } + public class DuststormCloud : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cloud"); + Main.projFrames[projectile.type] = 4; + } - public override void SetDefaults() - { - projectile.width = 38; - projectile.height = 14; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.timeLeft = 3600; - projectile.Calamity().rogue = true; - } + public override void SetDefaults() + { + projectile.width = 38; + projectile.height = 14; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.timeLeft = 3600; + projectile.Calamity().rogue = true; + projectile.usesIDStaticNPCImmunity = true; + projectile.idStaticNPCHitCooldown = 5; + } - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 6) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - projectile.velocity *= 0.995f; - projectile.ai[1] += 1f; - if (projectile.ai[1] >= 120f) - { - if (projectile.alpha < 255) - { - projectile.alpha += 5; - if (projectile.alpha > 255) - { - projectile.alpha = 255; - } - } - else if (projectile.owner == Main.myPlayer) - { - projectile.Kill(); - } - } - else if (projectile.alpha > 80) - { - projectile.alpha -= 30; - if (projectile.alpha < 80) - { - projectile.alpha = 80; - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 5; - } - } + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= Main.projFrames[projectile.type]) + { + projectile.frame = 0; + } + projectile.velocity *= 0.995f; + projectile.ai[1] += 1f; + if (projectile.ai[1] >= 120f) + { + if (projectile.alpha < 255) + { + projectile.alpha += 5; + if (projectile.alpha > 255) + { + projectile.alpha = 255; + } + } + else if (projectile.owner == Main.myPlayer) + { + projectile.Kill(); + } + } + else if (projectile.alpha > 80) + { + projectile.alpha -= 30; + if (projectile.alpha < 80) + { + projectile.alpha = 80; + } + } + } + } } diff --git a/Projectiles/Rogue/DuststormCloudStealth.cs b/Projectiles/Rogue/DuststormCloudStealth.cs new file mode 100644 index 0000000000..396252143f --- /dev/null +++ b/Projectiles/Rogue/DuststormCloudStealth.cs @@ -0,0 +1,69 @@ +using Terraria; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Rogue +{ + public class DuststormCloudStealth : ModProjectile + { + public override string Texture => "CalamityMod/Projectiles/Rogue/DuststormCloud"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cloud"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = 38; + projectile.height = 14; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.timeLeft = 3600; + projectile.Calamity().rogue = true; + projectile.usesIDStaticNPCImmunity = true; + projectile.idStaticNPCHitCooldown = 4; + } + + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= Main.projFrames[projectile.type]) + { + projectile.frame = 0; + } + projectile.velocity *= 0.998f; + projectile.ai[1] += 1f; + if (projectile.ai[1] >= 120f) + { + if (projectile.alpha < 255) + { + projectile.alpha += 3; + if (projectile.alpha > 255) + { + projectile.alpha = 255; + } + } + else if (projectile.owner == Main.myPlayer) + { + projectile.Kill(); + } + } + else if (projectile.alpha > 80) + { + projectile.alpha -= 30; + if (projectile.alpha < 80) + { + projectile.alpha = 80; + } + } + } + } +} diff --git a/Projectiles/Rogue/DuststormInABottleProj.cs b/Projectiles/Rogue/DuststormInABottleProj.cs index b9422a923e..de59cf4eca 100644 --- a/Projectiles/Rogue/DuststormInABottleProj.cs +++ b/Projectiles/Rogue/DuststormInABottleProj.cs @@ -4,43 +4,47 @@ using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { - public class DuststormInABottleProj : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Duststorm"); - } + public class DuststormInABottleProj : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Duststorm"); + } - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.aiStyle = 2; - projectile.timeLeft = 180; - aiType = ProjectileID.ThrowingKnife; - projectile.Calamity().rogue = true; - } + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.aiStyle = 2; + projectile.timeLeft = 180; + aiType = ProjectileID.ThrowingKnife; + projectile.Calamity().rogue = true; + } - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 107); //change - for (int k = 0; k < 15; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 85, projectile.oldVelocity.X, projectile.oldVelocity.Y); - } - int num220 = Main.rand.Next(20, 31); - if (projectile.owner == Main.myPlayer) - { - for (int num221 = 0; num221 < num220; num221++) - { - Vector2 value17 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - value17.Normalize(); - value17 *= (float)Main.rand.Next(10, 201) * 0.01f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value17.X, value17.Y, ModContent.ProjectileType(), projectile.damage, 1f, projectile.owner, 0f, (float)Main.rand.Next(-45, 1)); - } - } - } - } + public override void Kill(int timeLeft) + { + bool stealth = projectile.Calamity().stealthStrike; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 107); //change + for (int k = 0; k < 15; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 85, projectile.oldVelocity.X, projectile.oldVelocity.Y); + } + int cloudAmt = Main.rand.Next(20, 31); + if (stealth) + cloudAmt *= 2; + int projType = stealth ? ModContent.ProjectileType() : ModContent.ProjectileType(); + if (projectile.owner == Main.myPlayer) + { + for (int index = 0; index < cloudAmt; index++) + { + Vector2 velocity = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + velocity.Normalize(); + velocity *= (float)Main.rand.Next(10, 201) * 0.01f; + Projectile.NewProjectile(projectile.Center, velocity, projType, projectile.damage, projectile.knockBack * 0.5f, projectile.owner, stealth ? 1f : 0f, (float)Main.rand.Next(-45, 1)); + } + } + } + } } diff --git a/Projectiles/Rogue/EclipsesStealth.cs b/Projectiles/Rogue/EclipsesStealth.cs index 4cfa10ab98..f2a28866f3 100644 --- a/Projectiles/Rogue/EclipsesStealth.cs +++ b/Projectiles/Rogue/EclipsesStealth.cs @@ -36,24 +36,24 @@ namespace CalamityMod.Projectiles.Rogue { if (projectile.timeLeft % 5 == 0) //congrats Pinkie... every 5 ticks { - if (Main.rand.NextBool(2)) + if (Main.rand.NextBool(2) && Main.myPlayer == projectile.owner) { + float dmgKBMult = Main.rand.NextFloat(0.32f, 0.56f); int spearAmt = Main.rand.Next(1, 4); //1 to 3 spears for (int n = 0; n < spearAmt; n++) { - float x = projectile.position.X + (float)Main.rand.Next(-400, 400); - float y = projectile.position.Y - (float)Main.rand.Next(500, 800); - Vector2 vector = new Vector2(x, y); - float num13 = projectile.position.X + (float)(projectile.width / 2) - vector.X; - float num14 = projectile.position.Y + (float)(projectile.height / 2) - vector.Y; - num13 += (float)Main.rand.Next(-100, 101); - int num15 = 29; - float num16 = (float)Math.Sqrt((double)(num13 * num13 + num14 * num14)); - num16 = (float)num15 / num16; - num13 *= num16; - num14 *= num16; - Projectile.NewProjectile(x, y, num13, num14, ModContent.ProjectileType(), (int)(projectile.damage * Main.rand.NextFloat(0.32f, 0.56f)), projectile.knockBack * Main.rand.NextFloat(0.32f, 0.56f), projectile.owner, 0f, 0f); - } //very complicated and painful + float xStart = projectile.position.X + Main.rand.Next(-400, 400); + float yStart = projectile.position.Y - Main.rand.Next(500, 800); + Vector2 startPos = new Vector2(xStart, yStart); + Vector2 velocity = projectile.Center - startPos; + velocity.X += (float)Main.rand.Next(-100, 101); + float travelDist = velocity.Length(); + float spearSpeed = 29f; + travelDist = spearSpeed / travelDist; + velocity.X *= travelDist; + velocity.Y *= travelDist; + Projectile.NewProjectile(startPos, velocity, ModContent.ProjectileType(), (int)(projectile.damage * dmgKBMult), projectile.knockBack * dmgKBMult, projectile.owner, 0f, 0f); + } } } if (projectile.ai[0] == 0f) diff --git a/Projectiles/Rogue/FantasyTalismanStealth.cs b/Projectiles/Rogue/FantasyTalismanStealth.cs index 4b6a606947..d291322099 100644 --- a/Projectiles/Rogue/FantasyTalismanStealth.cs +++ b/Projectiles/Rogue/FantasyTalismanStealth.cs @@ -45,10 +45,7 @@ namespace CalamityMod.Projectiles.Rogue { if (projectile.owner == Main.myPlayer) { - int sGhost = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ProjectileID.LostSoulFriendly, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[sGhost].Calamity().forceRogue = true; - Main.projectile[sGhost].penetrate = 1; - Main.projectile[sGhost].timeLeft = 240; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); } } } diff --git a/Projectiles/Rogue/FinalDawnFireSlash.cs b/Projectiles/Rogue/FinalDawnFireSlash.cs new file mode 100644 index 0000000000..b3930b6fa6 --- /dev/null +++ b/Projectiles/Rogue/FinalDawnFireSlash.cs @@ -0,0 +1,131 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Microsoft.Xna.Framework.Graphics; +using CalamityMod.CalPlayer; +using CalamityMod.Buffs.DamageOverTime; + +namespace CalamityMod.Projectiles.Rogue +{ + public class FinalDawnFireSlash : ModProjectile + { + public bool HasRegeneratedStealth = false; + public const float StealthReturnRatio = 0.25f; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Final Dawn"); + Main.projFrames[projectile.type] = 11; + } + public override void SetDefaults() + { + projectile.width = 300; + projectile.height = 398; + projectile.friendly = false; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.Calamity().rogue = true; + projectile.ownerHitCheck = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + } + public override void AI() + { + Player player = Main.player[projectile.owner]; + + player.direction = projectile.direction; + player.heldProj = projectile.whoAmI; + + AdjustPlayerPositionValues(player); + + projectile.ai[0]++; + if(projectile.ai[0] >= 4) + { + projectile.ai[1]++; + projectile.ai[0] = 0; + if (projectile.ai[1] == 5) + { + projectile.friendly = true; + Main.PlaySound(SoundID.Item71, (int)projectile.position.X, (int)projectile.position.Y); + } + } + if (projectile.ai[1] >= 11) + { + projectile.Kill(); + return; + } + projectile.frame = (int)projectile.ai[1]; + + AdjustPlayerItemFrameValues(player); + } + public void AdjustPlayerPositionValues(Player player) + { + projectile.Center = player.Center; + projectile.position.X += 60 * player.direction; + projectile.position.Y -= 30; + } + + public void AdjustPlayerItemFrameValues(Player player) + { + if (projectile.ai[1] < 5) + { + player.bodyFrame.Y = player.bodyFrame.Height; + } + else if (projectile.ai[1] < 8) + { + player.bodyFrame.Y = 3 * player.bodyFrame.Height; + } + else + { + player.bodyFrame.Y = 4 * player.bodyFrame.Height; + } + + projectile.spriteDirection = player.direction; + player.heldProj = projectile.whoAmI; + } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + CalamityPlayer calamityPlayer = Main.player[projectile.owner].Calamity(); + // Restore stealth + if (!HasRegeneratedStealth) + { + calamityPlayer.rogueStealth += calamityPlayer.rogueStealthMax * StealthReturnRatio; + if (calamityPlayer.rogueStealth > calamityPlayer.rogueStealthMax) + calamityPlayer.rogueStealth = calamityPlayer.rogueStealthMax; + HasRegeneratedStealth = true; + target.AddBuff(ModContent.BuffType(), 600); + } + } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + int width = 918 / 3; + int height = 1990 / 5; + + Vector2 drawCenter = projectile.Center; + Rectangle frameRectangle = new Rectangle(projectile.frame / 5 * width, projectile.frame % 5 * height, width, height); + + Texture2D scytheTexture = Main.projectileTexture[projectile.type]; + Texture2D glowTexture = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/FinalDawnFireSlash_Glow"); + + Main.spriteBatch.Draw(scytheTexture, + drawCenter - Main.screenPosition, + frameRectangle, + projectile.GetAlpha(lightColor), + projectile.rotation, + frameRectangle.Size() / 2, + projectile.scale, + projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, + 0f); + Main.spriteBatch.Draw(glowTexture, + drawCenter - Main.screenPosition, + frameRectangle, + projectile.GetAlpha(Color.White), + projectile.rotation, + frameRectangle.Size() / 2, + projectile.scale, + projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, + 0f); + return false; + } + } +} diff --git a/Projectiles/Rogue/FinalDawnFireSlash.png b/Projectiles/Rogue/FinalDawnFireSlash.png new file mode 100644 index 0000000000..560fd43ef7 Binary files /dev/null and b/Projectiles/Rogue/FinalDawnFireSlash.png differ diff --git a/Projectiles/Rogue/FinalDawnFireSlash_Glow.png b/Projectiles/Rogue/FinalDawnFireSlash_Glow.png new file mode 100644 index 0000000000..cfb5a2729a Binary files /dev/null and b/Projectiles/Rogue/FinalDawnFireSlash_Glow.png differ diff --git a/Projectiles/Rogue/FinalDawnFireball.cs b/Projectiles/Rogue/FinalDawnFireball.cs new file mode 100644 index 0000000000..2df97df18e --- /dev/null +++ b/Projectiles/Rogue/FinalDawnFireball.cs @@ -0,0 +1,89 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class FinalDawnFireball : ModProjectile + { + public const float DesiredSpeed = 30; + public const float InterpolationTime = 10; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Final Dawn"); + Main.projFrames[projectile.type] = 4; + } + public override void SetDefaults() + { + projectile.width = 36; + projectile.height = 80; + projectile.Calamity().rogue = true; + projectile.penetrate = 1; + projectile.hostile = false; + projectile.friendly = false; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.alpha = 50; + projectile.timeLeft = 180; + } + public override void AI() + { + NPC chargeAt = Main.npc[(int)projectile.ai[1]]; + if(!chargeAt.active) + projectile.Kill(); + + int idx = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width , projectile.height, ModContent.DustType(), 0f, 0f, 0, default, 1.0f); + Main.dust[idx].velocity = projectile.velocity * 0.5f; + Main.dust[idx].noGravity = true; + Main.dust[idx].noLight = true; + + projectile.ai[0]++; + if(projectile.ai[0] >= 20) + { + projectile.friendly = true; + NPC npc = Main.npc[(int)projectile.ai[1]]; + Vector2 desiredVelocity = projectile.DirectionTo(npc.Center) * DesiredSpeed; + projectile.velocity = Vector2.Lerp(projectile.velocity, desiredVelocity, 1f / InterpolationTime); + if(!npc.active) + projectile.Kill(); + } + + projectile.frameCounter++; + if (projectile.frameCounter >= 5) + { + projectile.frame++; + projectile.frameCounter = 0; + if (projectile.frame >= Main.projFrames[projectile.type]) + projectile.frame = 0; + } + } + public override void Kill(int timeLeft) + { + if (Main.myPlayer == projectile.owner) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); + } + } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D glowmask = Main.projectileTexture[projectile.type]; + int height = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int yStart = height * projectile.frame; + Main.spriteBatch.Draw(glowmask, + projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), + new Rectangle?(new Rectangle(0, yStart, glowmask.Width, height)), + projectile.GetAlpha(Color.White), projectile.rotation, + new Vector2(glowmask.Width / 2f, height / 2f), projectile.scale, + projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, + 0f); + return false; + } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 600); + } + } +} \ No newline at end of file diff --git a/Projectiles/Rogue/FinalDawnFireball.png b/Projectiles/Rogue/FinalDawnFireball.png new file mode 100644 index 0000000000..e4558d9715 Binary files /dev/null and b/Projectiles/Rogue/FinalDawnFireball.png differ diff --git a/Projectiles/Rogue/FinalDawnFlame.cs b/Projectiles/Rogue/FinalDawnFlame.cs new file mode 100644 index 0000000000..c5ba6d565f --- /dev/null +++ b/Projectiles/Rogue/FinalDawnFlame.cs @@ -0,0 +1,152 @@ +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class FinalDawnFlame : ModProjectile + { + internal struct Flame + { + public Vector2 Position; + + public int FrameCounter; + + public int Frame; + + public float Alpha; + + public float Scale; + + public int Direction; + } + private Flame[] Flames; + public const int TotalFlames = 120; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Final Dawn"); + Main.projFrames[projectile.type] = 8; + } + public override void SetDefaults() + { + projectile.scale = 1f; + projectile.width = 1000; + projectile.height = 100; + projectile.penetrate = -1; + projectile.hostile = false; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.Calamity().rogue = true; + projectile.alpha = 255; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 30; + + Flames = new Flame[TotalFlames]; + for (int i = 0; i < Flames.Length; i++) + { + Vector2 flamePosition = Main.rand.NextVector2Circular(projectile.width / 2, projectile.height / 2); + + Flames[i].Position = flamePosition; + Flames[i].Frame = Main.rand.Next(8); + Flames[i].FrameCounter = Main.rand.Next(5); + Flames[i].Alpha = 1f; + Flames[i].Scale = 0.8f + 0.4f * Main.rand.NextFloat(); + Flames[i].Direction = Main.rand.Next(2); + } + } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture = Main.projectileTexture[projectile.type]; + int frameHeight = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + + + if (Flames.Length > 0) + { + for(int i = 0; i < Flames.Length; i++) + { + int frameHeight2 = frameHeight * Flames[i].Frame; + spriteBatch.Draw(texture, + projectile.Center + Flames[i].Position - Main.screenPosition, + new Rectangle?(new Rectangle(0, frameHeight2, texture.Width, frameHeight)), + projectile.GetAlpha(Color.White) * Flames[i].Alpha, + projectile.rotation, + new Vector2(texture.Width / 2f, frameHeight / 2f), + Flames[i].Scale, + Flames[i].Direction == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, + 0f); + } + } + return false; + } + + public override void AI() + { + if (Flames.Length > 0) + { + for (int i = 0; i < Flames.Length; i++) + { + AdjustFlameValues(ref Flames[i]); + } + } + AlphaAdjustments(); + } + // The internal is to match consistency with the Flame struct. If you want to make this class public, you must also make the struct public. + internal void AdjustFlameValues(ref Flame flame) + { + flame.FrameCounter++; + if (flame.FrameCounter >= 5) + { + flame.Frame++; + flame.FrameCounter = 0; + + if (flame.Frame >= 8) + { + if (projectile.ai[0] < 570) + { + Vector2 pos = new Vector2(Main.rand.NextFloat(projectile.width / 2)).RotatedByRandom(MathHelper.TwoPi); + float widthHeightRatio = (float)projectile.height / projectile.width; + pos.Y *= widthHeightRatio; + + flame.Position = pos; + flame.Scale = 0.8f + 0.4f * Main.rand.NextFloat(); + flame.Direction = Main.rand.Next(2); + flame.Frame = 0; + } + else + { + flame.Alpha = 0f; + } + } + } + } + public void AlphaAdjustments() + { + projectile.ai[0]++; + if (projectile.ai[0] < 570) + { + projectile.alpha -= 10; + if (projectile.alpha < 0) projectile.alpha = 0; + } + else + { + projectile.friendly = false; + projectile.alpha += 5; + if (projectile.alpha > 255) + { + projectile.alpha = 255; + } + } + if (projectile.ai[0] >= 600 && projectile.alpha >= 255) + { + projectile.Kill(); + } + } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 600); + } + } +} \ No newline at end of file diff --git a/Projectiles/Rogue/FinalDawnFlame.png b/Projectiles/Rogue/FinalDawnFlame.png new file mode 100644 index 0000000000..39cfd79c74 Binary files /dev/null and b/Projectiles/Rogue/FinalDawnFlame.png differ diff --git a/Projectiles/Rogue/FinalDawnHorizontalSlash.cs b/Projectiles/Rogue/FinalDawnHorizontalSlash.cs new file mode 100644 index 0000000000..d7d6474030 --- /dev/null +++ b/Projectiles/Rogue/FinalDawnHorizontalSlash.cs @@ -0,0 +1,95 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Microsoft.Xna.Framework.Graphics; +using CalamityMod.Buffs.DamageOverTime; + +namespace CalamityMod.Projectiles.Rogue +{ + public class FinalDawnHorizontalSlash : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Final Dawn"); + Main.projFrames[projectile.type] = 9; + } + public override void SetDefaults() + { + projectile.width = 600; + projectile.height = 156; + projectile.friendly = false; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.Calamity().rogue = true; + projectile.ownerHitCheck = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + } + public override void AI() + { + Player player = Main.player[projectile.owner]; + projectile.Center = player.Center; + player.heldProj = projectile.whoAmI; + projectile.spriteDirection = (projectile.velocity.X > 0).ToDirectionInt(); + + projectile.ai[0]++; + if (projectile.ai[0] >= 4) + { + projectile.ai[1]++; + projectile.ai[0] = 0; + if (projectile.ai[1] == 3) + { + projectile.friendly = true; + Main.PlaySound(SoundID.Item71, projectile.position); + + if(projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage / 2, 0f, projectile.owner); + } + } + } + if (projectile.ai[1] >= 9) + { + projectile.Kill(); + return; + } + + projectile.frame = (int)projectile.ai[1]; + + if (projectile.ai[1] < 2) player.bodyFrame.Y = 1 * player.bodyFrame.Height; + else player.bodyFrame.Y = 3 * player.bodyFrame.Height; + + if (projectile.ai[1] == 4 || projectile.ai[1] == 5) player.direction = -1 * projectile.spriteDirection; + else player.direction = 1 * projectile.spriteDirection; + } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D scytheTexture = Main.projectileTexture[projectile.type]; + Texture2D scytheGlowTexture = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/FinalDawnHorizontalSlash_Glow"); + int height = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int yStart = height * projectile.frame; + Main.spriteBatch.Draw(scytheTexture, + projectile.Center - Main.screenPosition + projectile.gfxOffY * Vector2.UnitY, + new Rectangle?(new Rectangle(0, yStart, scytheTexture.Width, height)), + projectile.GetAlpha(lightColor), projectile.rotation, + new Vector2((float)scytheTexture.Width / 2f, (float)height / 2f), projectile.scale, + projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, + 0f); + Main.spriteBatch.Draw(scytheGlowTexture, + projectile.Center - Main.screenPosition + projectile.gfxOffY * Vector2.UnitY, + new Rectangle?(new Rectangle(0, yStart, scytheTexture.Width, height)), + projectile.GetAlpha(Color.White), + projectile.rotation, + new Vector2((float)scytheTexture.Width / 2f, (float)height / 2f), + projectile.scale, + projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, + 0f); + return false; + } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 600); + } + } +} \ No newline at end of file diff --git a/Projectiles/Rogue/FinalDawnHorizontalSlash.png b/Projectiles/Rogue/FinalDawnHorizontalSlash.png new file mode 100644 index 0000000000..5f4aa41f47 Binary files /dev/null and b/Projectiles/Rogue/FinalDawnHorizontalSlash.png differ diff --git a/Projectiles/Rogue/FinalDawnHorizontalSlash_Glow.png b/Projectiles/Rogue/FinalDawnHorizontalSlash_Glow.png new file mode 100644 index 0000000000..d45779cf18 Binary files /dev/null and b/Projectiles/Rogue/FinalDawnHorizontalSlash_Glow.png differ diff --git a/Projectiles/Rogue/FinalDawnProjectile.cs b/Projectiles/Rogue/FinalDawnProjectile.cs new file mode 100644 index 0000000000..c2f298dd27 --- /dev/null +++ b/Projectiles/Rogue/FinalDawnProjectile.cs @@ -0,0 +1,172 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class FinalDawnProjectile : ModProjectile + { + public const float MaxChargeTime = 20f; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Final Dawn"); + } + public override void SetDefaults() + { + projectile.width = 16; + projectile.height = 16; + projectile.friendly = false; + projectile.Calamity().rogue = true; + projectile.penetrate = -1; + projectile.tileCollide = false; + Main.projFrames[projectile.type] = 2; + //projectile.extraUpdates = 2; + } + public override bool ShouldUpdatePosition() => false; + public override void AI() + { + Player player = Main.player[projectile.owner]; + + if (Main.myPlayer == player.whoAmI) + { + projectile.velocity = Main.MouseWorld - player.Center; + projectile.velocity.Normalize(); + } + player.direction = projectile.direction; + player.heldProj = projectile.whoAmI; + projectile.Center = player.Center; + projectile.position.Y -= 44; + projectile.position.X -= 46 * player.direction; + player.bodyFrame.Y = player.bodyFrame.Height; + + if (projectile.ai[0] < MaxChargeTime) + { + // Charging dust + Vector2 dustCenter = new Vector2(projectile.Center.X, projectile.Center.Y - 40); + int flame = Dust.NewDust(dustCenter, projectile.width, projectile.height, ModContent.DustType(), 0, 0, 100, default, 2f); + Main.dust[flame].noGravity = true; + Main.dust[flame].fadeIn = 1.5f; + Main.dust[flame].scale = 1.4f; + Vector2 offsetVector = Utils.NextVector2CircularEdge(Main.rand, 100f, 100f); + Main.dust[flame].position = dustCenter - offsetVector; + Vector2 newVelocity = dustCenter - Main.dust[flame].position; + Main.dust[flame].velocity = newVelocity * 0.1f; + } + if (projectile.ai[0] == MaxChargeTime) + { + int dustCount = 36; + for (int i = 0; i < dustCount; i++) + { + Vector2 startingPosition = projectile.Center + new Vector2(0, -40); + Vector2 offset = Vector2.UnitX * projectile.width * 0.1875f; + offset = offset.RotatedBy((i - (dustCount / 2 - 1)) * MathHelper.TwoPi / dustCount); + int dustIdx = Dust.NewDust(startingPosition + offset, 0, 0, ModContent.DustType(), offset.X * 2f, offset.Y * 2f, 100, default, 3.4f); + Main.dust[dustIdx].noGravity = true; + Main.dust[dustIdx].noLight = true; + Main.dust[dustIdx].velocity = Vector2.Normalize(offset) * 5f; + } + projectile.frame = 1; + } + projectile.ai[0]++; + + projectile.spriteDirection = (projectile.velocity.X > 0).ToDirectionInt(); + + if (Main.myPlayer == projectile.owner) + { + if (!player.channel || player.noItems || player.CCed) + { + AttemptExecuteAttacks(player); + projectile.Kill(); + } + } + } + + public void AttemptExecuteAttacks(Player player) + { + if (projectile.ai[0] >= MaxChargeTime && !player.noItems && !player.CCed) + { + // Far range attack + if (player.controlUp) + { + // Stealth Strike + if (player.Calamity().StealthStrikeAvailable()) + { + Projectile.NewProjectile(player.Center, + player.DirectionTo(Main.MouseWorld) * 38f, + ModContent.ProjectileType(), + (int)(projectile.damage * 2.5f), + projectile.knockBack, + projectile.owner); + player.Calamity().ConsumeStealthByAttacking(); + } + else + { + Projectile.NewProjectile(projectile.Center, + projectile.DirectionTo(Main.MouseWorld) * 38f, + ModContent.ProjectileType(), projectile.damage, + projectile.knockBack, projectile.owner); + } + } + // Close range attack + else + { + // Stealth + if (player.Calamity().StealthStrikeAvailable()) + { + Projectile.NewProjectile(projectile.Center, + projectile.velocity, + ModContent.ProjectileType(), + (int)(projectile.damage * 2.5f), + projectile.knockBack, + projectile.owner); + player.Calamity().ConsumeStealthByAttacking(); + } + else + { + Projectile.NewProjectile(projectile.Center, + projectile.velocity, + ModContent.ProjectileType(), + (int)(projectile.damage * 1.5f), + projectile.knockBack, + projectile.owner); + } + } + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D scytheTexture = Main.projectileTexture[projectile.type]; + Texture2D glowmask = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/FinalDawnProjectile_Glow"); + int height = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int yStart = height * projectile.frame; + Main.spriteBatch.Draw(scytheTexture, + projectile.Center - Main.screenPosition + Vector2.UnitY * projectile.gfxOffY, + new Rectangle?(new Rectangle(0, yStart, scytheTexture.Width, height)), + projectile.GetAlpha(lightColor), + projectile.rotation, + new Vector2(scytheTexture.Width / 2f, height / 2f), + projectile.scale, + projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, + 0f); + Main.spriteBatch.Draw(glowmask, + projectile.Center - Main.screenPosition + Vector2.UnitY * projectile.gfxOffY, + new Rectangle?(new Rectangle(0, yStart, scytheTexture.Width, height)), + projectile.GetAlpha(Color.White), + projectile.rotation, + new Vector2(scytheTexture.Width / 2f, height / 2f), + projectile.scale, + projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, + 0f); + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 600); + } + } +} \ No newline at end of file diff --git a/Projectiles/Rogue/FinalDawnProjectile.png b/Projectiles/Rogue/FinalDawnProjectile.png new file mode 100644 index 0000000000..08ceda6fff Binary files /dev/null and b/Projectiles/Rogue/FinalDawnProjectile.png differ diff --git a/Projectiles/Rogue/FinalDawnProjectile_Glow.png b/Projectiles/Rogue/FinalDawnProjectile_Glow.png new file mode 100644 index 0000000000..d8050e928e Binary files /dev/null and b/Projectiles/Rogue/FinalDawnProjectile_Glow.png differ diff --git a/Projectiles/Rogue/FinalDawnReticle.cs b/Projectiles/Rogue/FinalDawnReticle.cs new file mode 100644 index 0000000000..a2c4fc0de4 --- /dev/null +++ b/Projectiles/Rogue/FinalDawnReticle.cs @@ -0,0 +1,81 @@ +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class FinalDawnReticle : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Final Dawn"); + } + public override void SetDefaults() + { + projectile.scale = 1.5f; + projectile.width = 120; + projectile.height = 120; + projectile.penetrate = -1; + projectile.hostile = false; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.Calamity().rogue = true; + projectile.alpha = 0; + + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = -1; + } + public override void AI() + { + if (projectile.ai[1] == 0) + projectile.ai[1] = 1; + if (projectile.ai[0] == 0) + { + int dustCount = 36; + for (int i = 0; i < dustCount; i++) + { + Vector2 startingPosition = projectile.Center + 10f * Vector2.UnitX; + Vector2 offset = Vector2.UnitX * projectile.width * 0.1875f; + offset = offset.RotatedBy((i - (dustCount / 2 - 1)) * MathHelper.TwoPi / 20f); + int dustIdx = Dust.NewDust(startingPosition + offset, 0, 0, ModContent.DustType(), offset.X * 2f, offset.Y * 2f, 100, default, 3.4f); + Main.dust[dustIdx].noGravity = true; + Main.dust[dustIdx].noLight = true; + Main.dust[dustIdx].velocity = Vector2.Normalize(offset) * 5f; + } + projectile.ai[0] = 1; + } + projectile.alpha += 8; + projectile.scale *= 0.98f; + projectile.ai[1] *= 1.01f; + if(projectile.alpha >= 255) + projectile.Kill(); + } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D ring = Main.projectileTexture[projectile.type]; + Texture2D symbol = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/FinalDawnReticleSymbol"); + spriteBatch.Draw(symbol, + projectile.Center - Main.screenPosition, + null, + projectile.GetAlpha(Color.White), + projectile.rotation, + new Vector2(symbol.Width / 2, symbol.Height / 2), + projectile.scale, + projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, + 0f); + spriteBatch.Draw(ring, + projectile.Center - Main.screenPosition, + null, + projectile.GetAlpha(Color.White), + projectile.rotation, + new Vector2(ring.Width / 2, ring.Height / 2), + projectile.ai[1], + projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, + 0f); + return false; + } + } +} \ No newline at end of file diff --git a/Projectiles/Rogue/FinalDawnReticle.png b/Projectiles/Rogue/FinalDawnReticle.png new file mode 100644 index 0000000000..3b92c7069d Binary files /dev/null and b/Projectiles/Rogue/FinalDawnReticle.png differ diff --git a/Projectiles/Rogue/FinalDawnReticleSymbol.png b/Projectiles/Rogue/FinalDawnReticleSymbol.png new file mode 100644 index 0000000000..27f3d33fbc Binary files /dev/null and b/Projectiles/Rogue/FinalDawnReticleSymbol.png differ diff --git a/Projectiles/Rogue/FinalDawnThrow.cs b/Projectiles/Rogue/FinalDawnThrow.cs new file mode 100644 index 0000000000..04c7a8ceae --- /dev/null +++ b/Projectiles/Rogue/FinalDawnThrow.cs @@ -0,0 +1,95 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class FinalDawnThrow : ModProjectile + { + public const float DesiredSpeed = 38; + public const float InterpolationTime = 15; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Final Dawn"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + public override void SetDefaults() + { + projectile.width = 80; + projectile.height = 80; + projectile.friendly = true; + projectile.Calamity().rogue = true; + projectile.penetrate = -1; + projectile.light = 0.0f; + projectile.extraUpdates = 2; + projectile.tileCollide = false; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 5; + } + public override void AI() + { + if (projectile.localAI[0] == 0) + { + Main.PlaySound(SoundID.Item71, (int)projectile.position.X, (int)projectile.position.Y); + projectile.localAI[0] = 1; + } + Player player = Main.player[projectile.owner]; + + projectile.spriteDirection = (projectile.velocity.X > 0).ToDirectionInt(); + projectile.rotation += 0.25f * projectile.direction; + + projectile.ai[0]++; + if (projectile.ai[0] >= 30) + { + Vector2 desiredVelocity = projectile.DirectionTo(player.Center) * DesiredSpeed; + projectile.velocity = Vector2.Lerp(projectile.velocity, desiredVelocity, 1f / InterpolationTime); + + float distance = projectile.Distance(player.Center); + if (distance < 64) + projectile.Kill(); + } + + int idx = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width , projectile.height, ModContent.DustType(), 0f, 0f, 0, default, 0.5f); + Main.dust[idx].velocity *= 0.5f; + Main.dust[idx].velocity += projectile.velocity * 0.5f; + Main.dust[idx].noGravity = true; + Main.dust[idx].noLight = false; + Main.dust[idx].scale = 1.0f; + } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D scytheTexture = Main.projectileTexture[projectile.type]; + Texture2D scytheGlowTexture = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/FinalDawnThrow_Glow"); + int height = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int yStart = height * projectile.frame; + Main.spriteBatch.Draw(scytheTexture, + projectile.Center - Main.screenPosition + Vector2.UnitY * projectile.gfxOffY, + new Rectangle?(new Rectangle(0, yStart, scytheTexture.Width, height)), + projectile.GetAlpha(lightColor), + projectile.rotation, + new Vector2(scytheTexture.Width / 2f, height / 2f), + projectile.scale, + projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, + 0f); + Main.spriteBatch.Draw(scytheGlowTexture, + projectile.Center - Main.screenPosition + Vector2.UnitY * projectile.gfxOffY, + new Rectangle?(new Rectangle(0, yStart, scytheTexture.Width, height)), + projectile.GetAlpha(Color.White), + projectile.rotation, + new Vector2(scytheTexture.Width / 2f, height / 2f), + projectile.scale, + projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, + 0f); + return false; + } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 600); + } + } +} \ No newline at end of file diff --git a/Projectiles/Rogue/FinalDawnThrow.png b/Projectiles/Rogue/FinalDawnThrow.png new file mode 100644 index 0000000000..4ee5e2a8dd Binary files /dev/null and b/Projectiles/Rogue/FinalDawnThrow.png differ diff --git a/Projectiles/Rogue/FinalDawnThrow2.cs b/Projectiles/Rogue/FinalDawnThrow2.cs new file mode 100644 index 0000000000..cb1c736e3c --- /dev/null +++ b/Projectiles/Rogue/FinalDawnThrow2.cs @@ -0,0 +1,127 @@ +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class FinalDawnThrow2 : ModProjectile + { + bool HasHitEnemy = false; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Final Dawn"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + public override void SetDefaults() + { + projectile.width = 200; + projectile.height = 200; + projectile.friendly = true; + projectile.Calamity().rogue = true; + projectile.penetrate = -1; + projectile.light = 0.0f; + projectile.extraUpdates = 1; + projectile.tileCollide = true; // We don't want people getting stuck in walls right + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 5; + } + public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough) + { + //should be self explanatory + width = 32; + height = 32; + return true; + } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + // Spawn homing flames that chase the HIT enemy only. This is also limited to one burst + if (Main.myPlayer == projectile.owner && !HasHitEnemy) + { + for (int i = 0; i < 6; i++) + { + Vector2 velocity = Utils.NextVector2Circular(Main.rand, 7.2f, 7.2f); + Projectile.NewProjectile(projectile.Center, velocity, + ModContent.ProjectileType(), + (int)(projectile.damage * 0.8), projectile.knockBack, projectile.owner, 0f, + target.whoAmI); + } + HasHitEnemy = true; + } + } + public override void AI() + { + if (projectile.localAI[0] == 0) + { + Main.PlaySound(SoundID.Item71, projectile.position); + projectile.localAI[0] = 1; + } + Player player = Main.player[projectile.owner]; + + projectile.spriteDirection = projectile.velocity.X > 0 ? 1 : -1; + projectile.rotation += 0.25f * projectile.direction; + player.Center = projectile.Center; + player.fullRotationOrigin = player.Center - player.position; + player.fullRotation = projectile.rotation; + player.direction = projectile.direction; + player.heldProj = projectile.whoAmI; + player.bodyFrame.Y = 1 * player.bodyFrame.Height; + player.immuneNoBlink = true; + player.immuneTime = 10; + + // This is to make sure the player doesn't get yeeted out of the world, which crashes the game pretty much all of the time + bool worldEdge = projectile.Center.X < 1000 || projectile.Center.Y < 1000 || projectile.Center.X > Main.maxTilesX * 16 - 1000 || projectile.Center.Y > Main.maxTilesY * 16 - 1000; + + projectile.ai[0]++; + if(projectile.ai[0] >= 60 || worldEdge) + { + projectile.Kill(); + } + + int idx = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width , projectile.height, mod.DustType("FinalFlame"), 0f, 0f, 0, default, 2.5f); + Main.dust[idx].velocity = projectile.velocity * -0.5f; + Main.dust[idx].noGravity = true; + Main.dust[idx].noLight = false; + } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Player player = Main.player[projectile.owner]; + float scytheRotation = player.fullRotation; + + Texture2D scytheTexture = Main.projectileTexture[projectile.type]; + Texture2D glowScytheTexture = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/FinalDawnThrow2_Glow"); + int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y6 = num214 * projectile.frame; + + Vector2 origin = new Vector2(scytheTexture.Width / 2f + 40f * player.direction, num214 * 1.1f); + + Main.spriteBatch.Draw(scytheTexture, + player.Center - Main.screenPosition + Vector2.UnitY * projectile.gfxOffY, + new Rectangle?(new Rectangle(0, y6, scytheTexture.Width, num214)), + projectile.GetAlpha(lightColor), + scytheRotation, + origin, + projectile.scale, + projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, + 0f); + Main.spriteBatch.Draw(glowScytheTexture, + player.Center - Main.screenPosition + Vector2.UnitY * projectile.gfxOffY, + new Rectangle?(new Rectangle(0, y6, scytheTexture.Width, num214)), + projectile.GetAlpha(Color.White), + scytheRotation, + origin, + projectile.scale, + projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, + 0f); + return false; + } + public override void Kill(int timeLeft) + { + Player player = Main.player[projectile.owner]; + player.fullRotation = 0; + } + } +} \ No newline at end of file diff --git a/Projectiles/Rogue/FinalDawnThrow2.png b/Projectiles/Rogue/FinalDawnThrow2.png new file mode 100644 index 0000000000..5e8c222953 Binary files /dev/null and b/Projectiles/Rogue/FinalDawnThrow2.png differ diff --git a/Projectiles/Rogue/FinalDawnThrow2_Glow.png b/Projectiles/Rogue/FinalDawnThrow2_Glow.png new file mode 100644 index 0000000000..23146bdc0c Binary files /dev/null and b/Projectiles/Rogue/FinalDawnThrow2_Glow.png differ diff --git a/Projectiles/Rogue/FinalDawnThrow_Glow.png b/Projectiles/Rogue/FinalDawnThrow_Glow.png new file mode 100644 index 0000000000..430a5f16bd Binary files /dev/null and b/Projectiles/Rogue/FinalDawnThrow_Glow.png differ diff --git a/Projectiles/Rogue/FrostShardFriendly.png b/Projectiles/Rogue/FrostShardFriendly.png index 14ddad107b..cf7a6c32b1 100644 Binary files a/Projectiles/Rogue/FrostShardFriendly.png and b/Projectiles/Rogue/FrostShardFriendly.png differ diff --git a/Projectiles/Rogue/FrostyFlareProj.cs b/Projectiles/Rogue/FrostyFlareProj.cs index bbbf23389b..ff7841fd36 100644 --- a/Projectiles/Rogue/FrostyFlareProj.cs +++ b/Projectiles/Rogue/FrostyFlareProj.cs @@ -6,123 +6,127 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { - public class FrostyFlareProj : ModProjectile - { - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.coldDamage = true; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft = 300; - projectile.Calamity().rogue = true; + public class FrostyFlareProj : ModProjectile + { + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; projectile.coldDamage = true; - } + projectile.friendly = true; + projectile.penetrate = -1; + projectile.timeLeft = 300; + projectile.Calamity().rogue = true; + } - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Frosty Flare"); - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Frosty Flare"); + } - public override void AI() - { - bool shoot = false; - if (projectile.timeLeft % 30f == 0f) - { - if (projectile.owner == Main.myPlayer) - shoot = true; - } + public override void AI() + { + if (projectile.owner != Main.myPlayer) + return; - if (projectile.ai[0] == 0f) - { - projectile.velocity.X *= 0.99f; - projectile.velocity.Y += 0.25f; - projectile.rotation = projectile.velocity.ToRotation(); + bool shoot = false; + if (projectile.timeLeft % 30f == 0f) + { + if (projectile.owner == Main.myPlayer) + shoot = true; + } - if (shoot) - { - Vector2 vel = new Vector2(Main.rand.Next(-300, 301), Main.rand.Next(500, 801)); - Vector2 pos = projectile.Center - vel; - vel.X += Main.rand.Next(-50, 51); - vel.Normalize(); - vel *= 30f; - Projectile.NewProjectile(pos, vel + projectile.velocity / 4f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); - } + if (projectile.ai[0] == 0f) + { + projectile.velocity.X *= 0.99f; + projectile.velocity.Y += 0.25f; + projectile.rotation = projectile.velocity.ToRotation(); - int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 172); - Main.dust[index2].noGravity = true; - } - else - { - projectile.ignoreWater = true; - projectile.tileCollide = false; - int id = (int)projectile.ai[1]; - if (id >= 0 && id < Main.maxNPCs && Main.npc[id].active && !Main.npc[id].dontTakeDamage) - { - projectile.Center = Main.npc[id].Center - projectile.velocity * 2f; - projectile.gfxOffY = Main.npc[id].gfxOffY; + if (shoot) + { + Vector2 vel = new Vector2(Main.rand.Next(-300, 301), Main.rand.Next(500, 801)); + Vector2 pos = projectile.Center - vel; + vel.X += Main.rand.Next(-50, 51); + vel.Normalize(); + vel *= 30f; + int shard = Projectile.NewProjectile(pos, vel + projectile.velocity / 4f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); + Main.projectile[shard].alpha = projectile.alpha; + } - if (shoot) - { - Vector2 vel = new Vector2(Main.rand.Next(-300, 301), Main.rand.Next(500, 801)); - Vector2 pos = Main.npc[id].Center - vel; - vel.X += Main.rand.Next(-50, 51); - vel.Normalize(); - vel *= 30f; - Projectile.NewProjectile(pos, vel + Main.npc[id].velocity, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); - } - } - else - { - projectile.Kill(); - } - } - } + int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 172); + Main.dust[index2].noGravity = true; + } + else + { + projectile.ignoreWater = true; + projectile.tileCollide = false; + int id = (int)projectile.ai[1]; + if (id >= 0 && id < Main.maxNPCs && Main.npc[id].active && !Main.npc[id].dontTakeDamage) + { + projectile.Center = Main.npc[id].Center - projectile.velocity * 2f; + projectile.gfxOffY = Main.npc[id].gfxOffY; - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Frostburn, 300); - target.AddBuff(ModContent.BuffType(), 120); - target.immune[projectile.owner] = 0; - projectile.ai[0] = 1f; - projectile.ai[1] = target.whoAmI; - projectile.velocity = target.Center - projectile.Center; - projectile.velocity *= 0.75f; - projectile.netUpdate = true; + if (shoot) + { + Vector2 vel = new Vector2(Main.rand.Next(-300, 301), Main.rand.Next(500, 801)); + Vector2 pos = Main.npc[id].Center - vel; + vel.X += Main.rand.Next(-50, 51); + vel.Normalize(); + vel *= 30f; + int shard = Projectile.NewProjectile(pos, vel + Main.npc[id].velocity, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); + Main.projectile[shard].alpha = projectile.alpha; + } + } + else + { + projectile.Kill(); + } + } + } - const int maxFlares = 5; - int flaresFound = 0; - int oldestFlare = -1; - int oldestFlareTimeLeft = 300; - for (int i = 0; i < Main.maxProjectiles; i++) - { - if (Main.projectile[i].active && Main.projectile[i].owner == Main.myPlayer && Main.projectile[i].type == projectile.type && i != projectile.whoAmI && Main.projectile[i].ai[1] == target.whoAmI) - { - flaresFound++; - if (Main.projectile[i].timeLeft < oldestFlareTimeLeft) - { - oldestFlareTimeLeft = Main.projectile[i].timeLeft; - oldestFlare = Main.projectile[i].whoAmI; - } - if (flaresFound >= maxFlares) - break; - } - } - //Main.NewText("found " + flaresFound.ToString()); - if (flaresFound >= maxFlares && oldestFlare >= 0) - { - //Main.NewText("killing flare " + oldestFlare.ToString()); - Main.projectile[oldestFlare].Kill(); - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Frostburn, 300); + target.AddBuff(ModContent.BuffType(), 120); + target.immune[projectile.owner] = 0; + projectile.ai[0] = 1f; + projectile.ai[1] = target.whoAmI; + projectile.velocity = target.Center - projectile.Center; + projectile.velocity *= 0.75f; + projectile.netUpdate = true; - public override void OnHitPvp(Player target, int damage, bool crit) - { - target.AddBuff(BuffID.Frostburn, 300); - target.AddBuff(ModContent.BuffType(), 120); - } + const int maxFlares = 5; + int flaresFound = 0; + int oldestFlare = -1; + int oldestFlareTimeLeft = 300; + for (int i = 0; i < Main.maxProjectiles; i++) + { + if (Main.projectile[i].active && Main.projectile[i].owner == Main.myPlayer && Main.projectile[i].type == projectile.type && i != projectile.whoAmI && Main.projectile[i].ai[1] == target.whoAmI) + { + flaresFound++; + if (Main.projectile[i].timeLeft < oldestFlareTimeLeft) + { + oldestFlareTimeLeft = Main.projectile[i].timeLeft; + oldestFlare = Main.projectile[i].whoAmI; + } + if (flaresFound >= maxFlares) + break; + } + } + //Main.NewText("found " + flaresFound.ToString()); + if (flaresFound >= maxFlares && oldestFlare >= 0) + { + //Main.NewText("killing flare " + oldestFlare.ToString()); + Main.projectile[oldestFlare].Kill(); + } + } - public override bool CanDamage() => projectile.ai[0] == 0f; - } + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Frostburn, 300); + target.AddBuff(ModContent.BuffType(), 120); + } + + public override bool CanDamage() => projectile.ai[0] == 0f; + } } diff --git a/Projectiles/Rogue/FrostyFlareStealth.cs b/Projectiles/Rogue/FrostyFlareStealth.cs new file mode 100644 index 0000000000..8b23654c57 --- /dev/null +++ b/Projectiles/Rogue/FrostyFlareStealth.cs @@ -0,0 +1,140 @@ +using CalamityMod.Buffs.StatDebuffs; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class FrostyFlareStealth : ModProjectile + { + public override string Texture => "CalamityMod/Projectiles/Rogue/FrostyFlareProj"; + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.coldDamage = true; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.timeLeft = 300; + projectile.Calamity().rogue = true; + } + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Frosty Flare"); + } + + public override void AI() + { + if (projectile.owner != Main.myPlayer) + return; + + bool shoot = false; + if (projectile.timeLeft % 30f == 0f) + { + if (projectile.owner == Main.myPlayer) + shoot = true; + } + + if (projectile.ai[0] == 0f) + { + projectile.velocity.X *= 0.99f; + projectile.velocity.Y += 0.25f; + projectile.rotation = projectile.velocity.ToRotation(); + + if (shoot) + { + Vector2 vel = new Vector2(Main.rand.Next(-300, 301), Main.rand.Next(500, 801)); + Vector2 pos = projectile.Center - vel; + vel.X += Main.rand.Next(-50, 51); + vel.Normalize(); + vel *= 30f; + int flare = Projectile.NewProjectile(pos, vel + projectile.velocity / 4f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); + Main.projectile[flare].alpha = 150; + } + if (projectile.timeLeft % 10 == 0) + { + int snowflake = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0f, projectile.velocity.Y * 0f, ProjectileID.NorthPoleSnowflake, (int)(projectile.damage * 0.25), projectile.knockBack, projectile.owner, 0f, Main.rand.Next(3)); + Main.projectile[snowflake].Calamity().forceRogue = true; + Main.projectile[snowflake].timeLeft = 300; + } + + int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 172); + Main.dust[index2].noGravity = true; + } + else + { + projectile.ignoreWater = true; + projectile.tileCollide = false; + int id = (int)projectile.ai[1]; + if (id >= 0 && id < Main.maxNPCs && Main.npc[id].active && !Main.npc[id].dontTakeDamage) + { + projectile.Center = Main.npc[id].Center - projectile.velocity * 2f; + projectile.gfxOffY = Main.npc[id].gfxOffY; + + if (shoot) + { + Vector2 vel = new Vector2(Main.rand.Next(-300, 301), Main.rand.Next(500, 801)); + Vector2 pos = Main.npc[id].Center - vel; + vel.X += Main.rand.Next(-50, 51); + vel.Normalize(); + vel *= 30f; + int flare = Projectile.NewProjectile(pos, vel + Main.npc[id].velocity, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); + Main.projectile[flare].alpha = 150; + } + } + else + { + projectile.Kill(); + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Frostburn, 300); + target.AddBuff(ModContent.BuffType(), 120); + target.immune[projectile.owner] = 0; + projectile.ai[0] = 1f; + projectile.ai[1] = target.whoAmI; + projectile.velocity = target.Center - projectile.Center; + projectile.velocity *= 0.75f; + projectile.netUpdate = true; + + const int maxFlares = 1; + int flaresFound = 0; + int oldestFlare = -1; + int oldestFlareTimeLeft = 300; + for (int i = 0; i < Main.maxProjectiles; i++) + { + if (Main.projectile[i].active && Main.projectile[i].owner == Main.myPlayer && Main.projectile[i].type == projectile.type && i != projectile.whoAmI && Main.projectile[i].ai[1] == target.whoAmI) + { + flaresFound++; + if (Main.projectile[i].timeLeft < oldestFlareTimeLeft) + { + oldestFlareTimeLeft = Main.projectile[i].timeLeft; + oldestFlare = Main.projectile[i].whoAmI; + } + if (flaresFound >= maxFlares) + break; + } + } + //Main.NewText("found " + flaresFound.ToString()); + if (flaresFound >= maxFlares && oldestFlare >= 0) + { + //Main.NewText("killing flare " + oldestFlare.ToString()); + Main.projectile[oldestFlare].Kill(); + } + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Frostburn, 300); + target.AddBuff(ModContent.BuffType(), 120); + } + + public override bool CanDamage() => projectile.ai[0] == 0f; + } +} diff --git a/Projectiles/Rogue/JawsProjectile.cs b/Projectiles/Rogue/JawsProjectile.cs index 5befdbab58..97bceff3e1 100644 --- a/Projectiles/Rogue/JawsProjectile.cs +++ b/Projectiles/Rogue/JawsProjectile.cs @@ -79,7 +79,7 @@ namespace CalamityMod.Projectiles.Rogue if (projectile.Calamity().stealthStrike) { target.AddBuff(ModContent.BuffType(), 240); - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(100f * (player.allDamage + player.Calamity().throwingDamage - 1f)), 10f, projectile.owner, 0, 0); + Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(100f * player.RogueDamage()), 10f, projectile.owner, 0, 0); } } @@ -92,7 +92,7 @@ namespace CalamityMod.Projectiles.Rogue if (projectile.Calamity().stealthStrike) { target.AddBuff(ModContent.BuffType(), 240); - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(100f * (player.allDamage + player.Calamity().throwingDamage - 1f)), 10f, projectile.owner, 0, 0); + Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(100f * player.RogueDamage()), 10f, projectile.owner, 0, 0); } } diff --git a/Projectiles/Rogue/LeonidCometBig.cs b/Projectiles/Rogue/LeonidCometBig.cs new file mode 100644 index 0000000000..346244dd41 --- /dev/null +++ b/Projectiles/Rogue/LeonidCometBig.cs @@ -0,0 +1,102 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Rogue; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Rogue +{ + public class LeonidCometBig : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Comet"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + + public override void SetDefaults() + { + projectile.width = 50; + projectile.height = 42; + projectile.aiStyle = 1; + projectile.friendly = true; + projectile.Calamity().rogue = true; + projectile.tileCollide = false; + projectile.extraUpdates = 2; + aiType = ProjectileID.Meteor1; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 300); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 300); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f), ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + + public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/LeonidCometBigGlow"); + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, tex.Size() / 2, projectile.scale, SpriteEffects.None, 0f); + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(SoundID.Item89, projectile.position); + projectile.position.X += (float)(projectile.width / 2); + projectile.position.Y += (float)(projectile.height / 2); + projectile.width = (int)(128f * projectile.scale); + projectile.height = (int)(128f * projectile.scale); + projectile.position.X -= (float)(projectile.width / 2); + projectile.position.Y -= (float)(projectile.height / 2); + for (int index = 0; index < 8; ++index) + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0.0f, 0.0f, 100, CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f), 1.5f); + for (int index1 = 0; index1 < 32; ++index1) + { + int index2 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, DustID.Fire, 0f, 0f, 100, CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f), 2.5f); + Dust dust1 = Main.dust[index2]; + dust1.noGravity = true; + dust1.velocity *= 3f; + int index3 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, DustID.Fire, 0f, 0f, 100, CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f), 1.5f); + Dust dust2 = Main.dust[index3]; + dust2.velocity *= 2f; + dust2.noGravity = true; + } + for (int index1 = 0; index1 < 2; ++index1) + { + int index2 = Gore.NewGore(projectile.position + new Vector2((float) (projectile.width * Main.rand.Next(100)) / 100f, (float) (projectile.height * Main.rand.Next(100)) / 100f) - Vector2.One * 10f, new Vector2(), Main.rand.Next(61, 64), 1f); + Gore gore = Main.gore[index2]; + gore.velocity *= 0.3f; + gore.velocity.X += (float) Main.rand.Next(-10, 11) * 0.05f; + gore.velocity.Y += (float) Main.rand.Next(-10, 11) * 0.05f; + } + if (projectile.owner == Main.myPlayer) + { + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.localAI[1] = -1f; + projectile.maxPenetrate = 0; + projectile.Damage(); + } + for (int index1 = 0; index1 < 5; ++index1) + { + int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, Utils.SelectRandom(Main.rand, new int[3]{ DustID.Fire, 259, 158 }), 2.5f * (float) projectile.direction, -2.5f, 0, CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f), 1f); + Dust dust1 = Main.dust[index2]; + dust1.alpha = 200; + dust1.velocity *= 2.4f; + dust1.scale += Main.rand.NextFloat(); + } + } + } +} diff --git a/Projectiles/Rogue/LeonidCometBig.png b/Projectiles/Rogue/LeonidCometBig.png new file mode 100644 index 0000000000..edca9fb237 Binary files /dev/null and b/Projectiles/Rogue/LeonidCometBig.png differ diff --git a/Projectiles/Rogue/LeonidCometBigGlow.png b/Projectiles/Rogue/LeonidCometBigGlow.png new file mode 100644 index 0000000000..c3b7ec1b20 Binary files /dev/null and b/Projectiles/Rogue/LeonidCometBigGlow.png differ diff --git a/Projectiles/Rogue/LeonidCometSmall.cs b/Projectiles/Rogue/LeonidCometSmall.cs new file mode 100644 index 0000000000..aa7879816c --- /dev/null +++ b/Projectiles/Rogue/LeonidCometSmall.cs @@ -0,0 +1,139 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Rogue; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Rogue +{ + public class LeonidCometSmall : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Comet"); + } + + public override void SetDefaults() + { + projectile.width = 28; + projectile.height = 28; + projectile.friendly = true; + projectile.Calamity().rogue = true; + projectile.penetrate = 1; + projectile.timeLeft = 300; + projectile.extraUpdates = 1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = -1; + projectile.alpha = 255; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f), projectile.rotation, tex.Size() / 2, projectile.scale, SpriteEffects.None, 0f); + return false; + } + + public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = ModContent.GetTexture("CalamityMod/Items/Weapons/Rogue/LeonidProgenitorGlow"); + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, tex.Size() / 2, projectile.scale, SpriteEffects.None, 0f); + } + + public override void AI() + { + projectile.alpha -= 25; + if (projectile.alpha < 0) + projectile.alpha = 0; + if (Main.rand.NextBool(4)) + { + int randomDust = Utils.SelectRandom(Main.rand, new int[] + { + ModContent.DustType(), + ModContent.DustType() + }); + if (Main.rand.NextBool(2)) + { + int index = Dust.NewDust(projectile.position, projectile.width, projectile.height, randomDust, 0f, 0f, 100, CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f), 1.6f); + Main.dust[index].noGravity = true; + } + if (Main.rand.NextBool(2)) + { + int index = Dust.NewDust(projectile.position, projectile.width, projectile.height, 31, 0f, 0f, 100, CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f), 1.6f); + Main.dust[index].noGravity = true; + } + int index1 = Dust.NewDust(projectile.position, projectile.width, projectile.height, randomDust, 0f, 0f, 100, CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f), 1.2f); + Main.dust[index1].noGravity = true; + Main.dust[index1].velocity *= 2f; + Main.dust[index1].velocity += projectile.velocity; + Main.dust[index1].fadeIn = projectile.ai[1] != -1f ? 1.22f : 1.5f; + } + if (projectile.ai[0] >= 0f) + { + ++projectile.ai[0]; + if (projectile.ai[0] >= 20f) + { + projectile.velocity.Y += 0.2f; + if (projectile.velocity.Y > 0f) + projectile.velocity.X *= 0.98f; + if (projectile.velocity.Y > 12f) + projectile.velocity.Y = 12f; + } + } + projectile.rotation += projectile.velocity.X * 0.1f; + } + + public override void Kill(int timeLeft) + { + if (projectile.owner != Main.myPlayer) + return; + Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage / 3, 0f, projectile.owner); + projectile.ai[1] = -1f; + projectile.position = projectile.Center; + projectile.width = projectile.height = 40; + projectile.Center = projectile.position; + projectile.Damage(); + Main.PlaySound(SoundID.Item89, projectile.position); + for (int index1 = 0; index1 < 2; ++index1) + { + int index2 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f), 1.5f); + Dust dust = Main.dust[index2]; + dust.position = projectile.Center + Vector2.UnitY.RotatedByRandom(Math.PI) * Main.rand.NextFloat() * projectile.width / 2f; + } + for (int index1 = 0; index1 < 10; ++index1) + { + int randomDust = Utils.SelectRandom(Main.rand, new int[] + { + ModContent.DustType(), + ModContent.DustType() + }); + int index2 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDust, 0f, 0f, 0, CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f), 2.5f); + Dust dust = Main.dust[index2]; + dust.position = projectile.Center + Vector2.UnitY.RotatedByRandom(Math.PI) * Main.rand.NextFloat() * projectile.width / 2f; + dust.noGravity = true; + dust.velocity *= 2f; + } + for (int index1 = 0; index1 < 5; ++index1) + { + int index2 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 0, CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f), 1.5f); + Dust dust = Main.dust[index2]; + dust.position = projectile.Center + Vector2.UnitX.RotatedByRandom(Math.PI).RotatedBy((double)projectile.velocity.ToRotation(), new Vector2()) * projectile.width / 2f; + dust.noGravity = true; + dust.velocity *= 2f; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 120); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 120); + } + } +} diff --git a/Projectiles/Rogue/LeonidCometSmall.png b/Projectiles/Rogue/LeonidCometSmall.png new file mode 100644 index 0000000000..2dac0b1dc7 Binary files /dev/null and b/Projectiles/Rogue/LeonidCometSmall.png differ diff --git a/Projectiles/Rogue/LeonidCometSmallGlow.png b/Projectiles/Rogue/LeonidCometSmallGlow.png new file mode 100644 index 0000000000..7f9093ea6e Binary files /dev/null and b/Projectiles/Rogue/LeonidCometSmallGlow.png differ diff --git a/Projectiles/Rogue/LeonidProgenitorBombshell.cs b/Projectiles/Rogue/LeonidProgenitorBombshell.cs new file mode 100644 index 0000000000..c3ec4a99e9 --- /dev/null +++ b/Projectiles/Rogue/LeonidProgenitorBombshell.cs @@ -0,0 +1,132 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using CalamityMod.Projectiles.Ranged; +using CalamityMod.Items.Weapons.Rogue; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class LeonidProgenitorBombshell : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Leonid Bombshell"); + } + + public override void SetDefaults() + { + projectile.width = 32; + projectile.height = 32; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.timeLeft = 180; + projectile.Calamity().rogue = true; + } + + public override void AI() + { + int randomDust = Utils.SelectRandom(Main.rand, new int[] + { + ModContent.DustType(), + ModContent.DustType() + }); + int astral = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDust, 0f, 0f, 100, CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f), 0.8f); + Main.dust[astral].noGravity = true; + Main.dust[astral].velocity *= 0f; + + projectile.ai[0] += 1f; + if (projectile.ai[0] > 10f) + { + projectile.ai[0] = 10f; + if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) + { + projectile.velocity.X = projectile.velocity.X * 0.97f; + if (projectile.velocity.X > -0.01f && projectile.velocity.X < 0.01f) + { + projectile.velocity.X = 0f; + projectile.netUpdate = true; + } + } + projectile.velocity.Y += 0.2f; + } + projectile.rotation += projectile.velocity.X * 0.1f; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, lightColor, projectile.rotation, tex.Size() / 2, projectile.scale, SpriteEffects.None, 0f); + return false; + } + + public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = ModContent.GetTexture("CalamityMod/Items/Weapons/Rogue/LeonidProgenitorGlow"); + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, tex.Size() / 2, projectile.scale, SpriteEffects.None, 0f); + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(SoundID.Item62, projectile.position); + if (Main.myPlayer == projectile.owner) + { + int flash = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, 0f, projectile.owner, 0f, 1f); + Main.projectile[flash].Calamity().forceRogue = true; + Main.projectile[flash].usesLocalNPCImmunity = true; + Main.projectile[flash].localNPCHitCooldown = 10; + + Vector2 pos = new Vector2(projectile.Center.X + projectile.width * 0.5f + Main.rand.Next(-201, 201), Main.screenPosition.Y - 600f - Main.rand.Next(50)); + Vector2 velocity = (projectile.Center - pos) / 40f; + int dmg = projectile.damage / 2; + int comet = Projectile.NewProjectile(pos, velocity, ModContent.ProjectileType(), dmg, projectile.knockBack, projectile.owner, 0f, 0.5f + (float)Main.rand.NextDouble() * 0.3f); + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 300); + if (!projectile.Calamity().stealthStrike || Main.myPlayer != projectile.owner) + return; + + Vector2 spinningpoint = new Vector2(0f, 6f); + float num1 = MathHelper.ToRadians(45f); + int cometAmt = 5; + float num3 = -(num1 * 2f) / (cometAmt - 1f); + for (int projIndex = 0; projIndex < cometAmt; ++projIndex) + { + int index2 = Projectile.NewProjectile(projectile.Center, spinningpoint.RotatedBy((double)num1 + (double)num3 * (double)projIndex, new Vector2()), ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, -1f); + Projectile proj = Main.projectile[index2]; + for (int index3 = 0; index3 < projectile.localNPCImmunity.Length; ++index3) + { + proj.localNPCImmunity[index3] = projectile.localNPCImmunity[index3]; + } + } + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 300); + if (!projectile.Calamity().stealthStrike || Main.myPlayer != projectile.owner) + return; + + Vector2 spinningpoint = new Vector2(0f, 6f); + float num1 = MathHelper.ToRadians(45f); + int cometAmt = 5; + float num3 = -(num1 * 2f) / (cometAmt - 1f); + for (int projIndex = 0; projIndex < cometAmt; ++projIndex) + { + int index2 = Projectile.NewProjectile(projectile.Center, spinningpoint.RotatedBy((double)num1 + (double)num3 * (double)projIndex, new Vector2()), ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, -1f); + Projectile proj = Main.projectile[index2]; + for (int index3 = 0; index3 < projectile.localNPCImmunity.Length; ++index3) + { + proj.localNPCImmunity[index3] = projectile.localNPCImmunity[index3]; + } + } + } + } +} diff --git a/Projectiles/Rogue/LeonidProgenitorBombshell.png b/Projectiles/Rogue/LeonidProgenitorBombshell.png new file mode 100644 index 0000000000..bec6bcd49b Binary files /dev/null and b/Projectiles/Rogue/LeonidProgenitorBombshell.png differ diff --git a/Projectiles/Rogue/LeonidStar.cs b/Projectiles/Rogue/LeonidStar.cs new file mode 100644 index 0000000000..a601774acf --- /dev/null +++ b/Projectiles/Rogue/LeonidStar.cs @@ -0,0 +1,96 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Rogue; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class LeonidStar : ModProjectile + { + private bool hasHit = false; + private bool initialized = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Leonid Star"); + } + + public override void SetDefaults() + { + projectile.width = 22; + projectile.height = 24; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.Calamity().rogue = true; + projectile.tileCollide = false; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = -2; + } + + public override void AI() + { + if (!initialized) + { + projectile.rotation += Main.rand.NextFloat(); + initialized = true; + } + projectile.ai[0]++; + if (projectile.ai[0] > 120f) + { + projectile.alpha -= 15; + if (projectile.alpha <= 0) + projectile.Kill(); + } + projectile.rotation += projectile.direction * 0.05f; + if (projectile.soundDelay == 0) + { + projectile.soundDelay = 20 + Main.rand.Next(40); + if (Main.rand.NextBool(9)) + { + Main.PlaySound(SoundID.Item9, projectile.position); + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 120); + hasHit = true; + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 120); + hasHit = true; + } + + public override bool CanDamage() => !hasHit; + + public override Color? GetAlpha(Color lightColor) => CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 2.5f); + + public override void Kill(int timeLeft) + { + for (int i = 0; i < 5; i++) + { + int dustType = Utils.SelectRandom(Main.rand, new int[] + { + ModContent.DustType(), + ModContent.DustType() + }); + + int dust = Dust.NewDust(projectile.Center, 1, 1, dustType, projectile.velocity.X, projectile.velocity.Y, 0, CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f), 1.5f); + Main.dust[dust].noGravity = true; + } + for (int num480 = 0; num480 < 3; num480++) + { + Vector2 velocity = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + velocity.SafeNormalize(default); + velocity *= Main.rand.Next(1, 6) * 0.01f; + Gore.NewGore(projectile.position, velocity, Main.rand.Next(16, 18), 1f); + } + } + } +} diff --git a/Projectiles/Rogue/LeonidStar.png b/Projectiles/Rogue/LeonidStar.png new file mode 100644 index 0000000000..5356ebfc31 Binary files /dev/null and b/Projectiles/Rogue/LeonidStar.png differ diff --git a/Projectiles/Rogue/LostSoulFriendly.cs b/Projectiles/Rogue/LostSoulFriendly.cs new file mode 100644 index 0000000000..069cf54644 --- /dev/null +++ b/Projectiles/Rogue/LostSoulFriendly.cs @@ -0,0 +1,63 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Rogue +{ + public class LostSoulFriendly : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Lost Soul"); + Main.projFrames[projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + + public override void SetDefaults() + { + projectile.width = 16; + projectile.height = 16; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.penetrate = 1; + projectile.timeLeft = 240; + projectile.Calamity().rogue = true; + } + + 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; + } + Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.25f / 255f, (255 - projectile.alpha) * 0.25f / 255f, (255 - projectile.alpha) * 0.25f / 255f); + projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); + projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 400f, 6f, 20f); + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 43); + for (int j = 0; j <= 10; j++) + { + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 175, 0f, 0f, 100, default, 1f); + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + } +} diff --git a/Projectiles/Rogue/LostSoulFriendly.png b/Projectiles/Rogue/LostSoulFriendly.png new file mode 100644 index 0000000000..5351d352da Binary files /dev/null and b/Projectiles/Rogue/LostSoulFriendly.png differ diff --git a/Projectiles/Rogue/MalachiteBolt.cs b/Projectiles/Rogue/MalachiteBolt.cs index 012000e6bd..4133705f6f 100644 --- a/Projectiles/Rogue/MalachiteBolt.cs +++ b/Projectiles/Rogue/MalachiteBolt.cs @@ -7,149 +7,148 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { - public class MalachiteBolt : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Malachite"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public class MalachiteBolt : ModProjectile + { + public override string Texture => "CalamityMod/Projectiles/Rogue/MalachiteProj"; - public override void SetDefaults() - { - projectile.width = 12; - projectile.height = 12; - projectile.alpha = 255; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 2; - projectile.alpha = 255; - projectile.extraUpdates = 10; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Calamity().rogue = true; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Malachite"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - projectile.alpha -= 3; - if (projectile.alpha < 100) - { - projectile.alpha = 100; - } - projectile.localAI[1] += 1f; - if (projectile.localAI[1] > 4f) - { - for (int num468 = 0; num468 < 3; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 0.75f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } - } + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.alpha = 255; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.penetrate = 2; + projectile.alpha = 255; + projectile.extraUpdates = 10; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.Calamity().rogue = true; + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + MathHelper.PiOver2; + projectile.alpha -= 3; + if (projectile.alpha < 100) + { + projectile.alpha = 100; + } + projectile.localAI[1] += 1f; + if (projectile.localAI[1] > 4f) + { + for (int num468 = 0; num468 < 3; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 0.75f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(Main.DiscoR, 203, 103, projectile.alpha); - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - if (projectile.penetrate <= 1) - { - projectile.position = projectile.Center; - projectile.width = projectile.height = 160; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - for (int num621 = 0; num621 < 70; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 40; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); - Main.dust[num624].velocity *= 2f; - } - } - } + public override Color? GetAlpha(Color lightColor) => new Color(Main.DiscoR, 203, 103, projectile.alpha); - public override void OnHitPvp(Player target, int damage, bool crit) - { - if (projectile.penetrate <= 1) - { - projectile.position = projectile.Center; - projectile.width = projectile.height = 160; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); - for (int num621 = 0; num621 < 70; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 40; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); - Main.dust[num624].velocity *= 2f; - } - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (projectile.penetrate <= 1) + { + projectile.position = projectile.Center; + projectile.width = projectile.height = 160; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.Damage(); + for (int num621 = 0; num621 < 70; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 40; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); + Main.dust[num624].velocity *= 2f; + } + } + } - public override void Kill(int timeLeft) - { - projectile.position = projectile.Center; - projectile.width = projectile.height = 16; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num621 = 0; num621 < 7; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 3; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); - Main.dust[num624].velocity *= 2f; - } - } - } + public override void OnHitPvp(Player target, int damage, bool crit) + { + if (projectile.penetrate <= 1) + { + projectile.position = projectile.Center; + projectile.width = projectile.height = 160; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.Damage(); + for (int num621 = 0; num621 < 70; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 40; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); + Main.dust[num624].velocity *= 2f; + } + } + } + + public override void Kill(int timeLeft) + { + projectile.position = projectile.Center; + projectile.width = projectile.height = 16; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num621 = 0; num621 < 7; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 3; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); + Main.dust[num624].velocity *= 2f; + } + } + } } diff --git a/Projectiles/Rogue/MalachiteBolt.png b/Projectiles/Rogue/MalachiteBolt.png deleted file mode 100644 index 7112e64fbf..0000000000 Binary files a/Projectiles/Rogue/MalachiteBolt.png and /dev/null differ diff --git a/Projectiles/Rogue/MalachiteProj.cs b/Projectiles/Rogue/MalachiteProj.cs index 133311e6f5..2d12ee803e 100644 --- a/Projectiles/Rogue/MalachiteProj.cs +++ b/Projectiles/Rogue/MalachiteProj.cs @@ -6,86 +6,83 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { - public class MalachiteProj : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Malachite"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public class MalachiteProj : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Malachite"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } - public override void SetDefaults() - { - projectile.width = 12; - projectile.height = 12; - projectile.alpha = 255; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 3; - projectile.alpha = 255; - projectile.extraUpdates = 3; - projectile.aiStyle = 93; - aiType = 514; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; - projectile.Calamity().rogue = true; - } + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.alpha = 255; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.penetrate = 3; + projectile.alpha = 255; + projectile.extraUpdates = 3; + projectile.aiStyle = 93; + aiType = ProjectileID.NailFriendly; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 1; + projectile.Calamity().rogue = true; + } - public override void AI() - { - projectile.alpha -= 3; - if (projectile.alpha < 30) - { - projectile.alpha = 30; - } - projectile.localAI[1] += 1f; - if (projectile.localAI[1] > 4f) - { - for (int num468 = 0; num468 < 3; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 0.75f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } - } + public override void AI() + { + projectile.alpha -= 3; + if (projectile.alpha < 30) + { + projectile.alpha = 30; + } + projectile.localAI[1] += 1f; + if (projectile.localAI[1] > 4f) + { + for (int num468 = 0; num468 < 3; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 0.75f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(Main.DiscoR, 203, 103, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) => new Color(Main.DiscoR, 203, 103, projectile.alpha); - public override void Kill(int timeLeft) - { - projectile.position = projectile.Center; - projectile.width = projectile.height = 48; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num621 = 0; num621 < 7; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 15; num623++) - { - int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); - Main.dust[num624].velocity *= 2f; - } - } - } + public override void Kill(int timeLeft) + { + projectile.position = projectile.Center; + projectile.width = projectile.height = 48; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num621 = 0; num621 < 7; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 15; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); + Main.dust[num624].velocity *= 2f; + } + } + } } diff --git a/Projectiles/Rogue/MalachiteStealth.cs b/Projectiles/Rogue/MalachiteStealth.cs new file mode 100644 index 0000000000..456d7fb07a --- /dev/null +++ b/Projectiles/Rogue/MalachiteStealth.cs @@ -0,0 +1,152 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class MalachiteStealth : ModProjectile + { + private const int lifeSpan = 300; + public override string Texture => "CalamityMod/Projectiles/Rogue/MalachiteProj"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Malachite"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.alpha = 255; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.alpha = 255; + projectile.Calamity().rogue = true; + projectile.tileCollide = false; + projectile.timeLeft = lifeSpan; + projectile.extraUpdates = 2; + } + + public override void AI() + { + if (projectile.ai[0] == 0f) + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + MathHelper.PiOver2; + CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 800f, 10f, 25f); + projectile.localAI[1] += 1f; + if (projectile.localAI[1] > 4f) + { + for (int num468 = 0; num468 < 3; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 0.75f); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + } + } + else + { + int id = (int)projectile.ai[1]; + if (id >= 0 && id < Main.maxNPCs && Main.npc[id].active && !Main.npc[id].dontTakeDamage) + { + projectile.Center = Main.npc[id].Center - projectile.velocity * 2f; + projectile.gfxOffY = Main.npc[id].gfxOffY; + } + else + { + projectile.Kill(); + } + } + + projectile.alpha -= 3; + if (projectile.alpha < 30) + { + projectile.alpha = 30; + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + + public override Color? GetAlpha(Color lightColor) => new Color(Main.DiscoR, 203, 103, projectile.alpha); + + public override void Kill(int timeLeft) + { + projectile.ai[0] = 2f; + projectile.position = projectile.Center; + projectile.width = projectile.height = 112; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + Main.PlaySound(SoundID.Item14, projectile.position); + for (int i = 0; i < 7; i++) + { + int dusty = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.2f); + Main.dust[dusty].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[dusty].scale = 0.5f; + Main.dust[dusty].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int j = 0; j < 15; j++) + { + int green = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f); + Main.dust[green].noGravity = true; + Main.dust[green].velocity *= 5f; + green = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f); + Main.dust[green].velocity *= 2f; + } + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.Damage(); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 0; + projectile.extraUpdates = 0; + projectile.ai[0] = 1f; + projectile.ai[1] = target.whoAmI; + projectile.velocity = target.Center - projectile.Center; + projectile.velocity *= 0.75f; + projectile.netUpdate = true; + + const int maxKunai = 3; + int kunaiFound = 0; + int oldestKunai = -1; + int oldestKunaiTimeLeft = lifeSpan; + for (int i = 0; i < Main.maxProjectiles; i++) + { + if (Main.projectile[i].active && Main.projectile[i].owner == Main.myPlayer && Main.projectile[i].type == projectile.type && i != projectile.whoAmI && Main.projectile[i].ai[1] == target.whoAmI) + { + kunaiFound++; + if (Main.projectile[i].timeLeft < oldestKunaiTimeLeft) + { + oldestKunaiTimeLeft = Main.projectile[i].timeLeft; + oldestKunai = Main.projectile[i].whoAmI; + } + if (kunaiFound >= maxKunai) + break; + } + } + // Main.NewText("found " + kunaiFound.ToString()); + if (kunaiFound >= maxKunai && oldestKunai >= 0) + { + // Main.NewText("killing kunai " + oldestKunai.ToString()); + Main.projectile[oldestKunai].Kill(); + } + } + + public override bool CanDamage() => projectile.ai[0] != 1f; + } +} diff --git a/Projectiles/Rogue/MythrilKnifeProjectile.cs b/Projectiles/Rogue/MythrilKnifeProjectile.cs index 3345eb61d3..76e38e5a82 100644 --- a/Projectiles/Rogue/MythrilKnifeProjectile.cs +++ b/Projectiles/Rogue/MythrilKnifeProjectile.cs @@ -1,4 +1,6 @@ -using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Items.Weapons.Rogue; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -64,7 +66,26 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.Venom, 200); + if (!projectile.Calamity().stealthStrike) + return; + + target.AddBuff(BuffID.CursedInferno, 300); + target.AddBuff(BuffID.Venom, 300); + target.AddBuff(ModContent.BuffType(), 300); + target.AddBuff(ModContent.BuffType(), 300); + target.AddBuff(ModContent.BuffType(), 300); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + if (!projectile.Calamity().stealthStrike) + return; + + target.AddBuff(BuffID.CursedInferno, 300); + target.AddBuff(BuffID.Venom, 300); + target.AddBuff(ModContent.BuffType(), 300); + target.AddBuff(ModContent.BuffType(), 300); + target.AddBuff(ModContent.BuffType(), 300); } } } diff --git a/Projectiles/Rogue/NightsGazeProjectile.cs b/Projectiles/Rogue/NightsGazeProjectile.cs index fcc2008c1a..eb5b37206e 100644 --- a/Projectiles/Rogue/NightsGazeProjectile.cs +++ b/Projectiles/Rogue/NightsGazeProjectile.cs @@ -1,4 +1,3 @@ - using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -32,7 +31,7 @@ namespace CalamityMod.Projectiles.Rogue { if (projectile.ai[0] == 0f) { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + MathHelper.ToRadians(45); } if (projectile.Calamity().stealthStrike) @@ -119,8 +118,9 @@ namespace CalamityMod.Projectiles.Rogue public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { - Vector2 origin = new Vector2(projectile.width / 2, projectile.height / 2); - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Rogue/NightsGazeProjectileGlow"), projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, origin, 1f, SpriteEffects.None, 0f); + Texture2D texture = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/NightsGazeProjectileGlow"); + Vector2 origin = new Vector2(texture.Width / 2f, texture.Height / 2f); + spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, origin, 1f, SpriteEffects.None, 0f); } public override void Kill(int timeLeft) diff --git a/Projectiles/Rogue/NightsGazeProjectile.png b/Projectiles/Rogue/NightsGazeProjectile.png index 80fbd96afe..6b12c7754c 100644 Binary files a/Projectiles/Rogue/NightsGazeProjectile.png and b/Projectiles/Rogue/NightsGazeProjectile.png differ diff --git a/Projectiles/Rogue/NightsGazeProjectileGlow.png b/Projectiles/Rogue/NightsGazeProjectileGlow.png index 3328e6a6bc..146c7cd893 100644 Binary files a/Projectiles/Rogue/NightsGazeProjectileGlow.png and b/Projectiles/Rogue/NightsGazeProjectileGlow.png differ diff --git a/Projectiles/Rogue/NightsGazeStar.cs b/Projectiles/Rogue/NightsGazeStar.cs index 7dc14c154b..ed77c8d2ff 100644 --- a/Projectiles/Rogue/NightsGazeStar.cs +++ b/Projectiles/Rogue/NightsGazeStar.cs @@ -47,20 +47,12 @@ namespace CalamityMod.Projectiles.Rogue for (int i = 0; i < 3; i++) { float dustVelocity = Main.rand.NextFloat(0f, 0.5f); - int dustToUse = Main.rand.Next(0, 3); - int dustType = 0; - switch (dustToUse) - { - case 0: - dustType = 109; - break; - case 1: - dustType = 111; - break; - case 2: - dustType = 132; - break; - } + int dustType = Utils.SelectRandom(Main.rand, new int[] + { + 109, + 111, + 132 + }); int dust = Dust.NewDust(projectile.Center, 1, 1, dustType, projectile.velocity.X, projectile.velocity.Y, 0, default, 1.5f); Main.dust[dust].noGravity = true; @@ -131,20 +123,12 @@ namespace CalamityMod.Projectiles.Rogue { for (int i = 0; i < 5; i++) { - int dustToUse = Main.rand.Next(0, 3); - int dustType = 0; - switch (dustToUse) - { - case 0: - dustType = 109; - break; - case 1: - dustType = 111; - break; - case 2: - dustType = 132; - break; - } + int dustType = Utils.SelectRandom(Main.rand, new int[] + { + 109, + 111, + 132 + }); int dust = Dust.NewDust(projectile.Center, 1, 1, dustType, projectile.velocity.X, projectile.velocity.Y, 0, default, 1.5f); Main.dust[dust].noGravity = true; diff --git a/Projectiles/Rogue/NightsGazeStar.png b/Projectiles/Rogue/NightsGazeStar.png index 2edc75ddf5..1db97cb7ea 100644 Binary files a/Projectiles/Rogue/NightsGazeStar.png and b/Projectiles/Rogue/NightsGazeStar.png differ diff --git a/Projectiles/Rogue/OrichalcumSpikedGemstoneProjectile.cs b/Projectiles/Rogue/OrichalcumSpikedGemstoneProjectile.cs index 2e334c2929..27243954bc 100644 --- a/Projectiles/Rogue/OrichalcumSpikedGemstoneProjectile.cs +++ b/Projectiles/Rogue/OrichalcumSpikedGemstoneProjectile.cs @@ -23,6 +23,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.timeLeft = 600; aiType = ProjectileID.ThrowingKnife; projectile.Calamity().rogue = true; + projectile.localNPCHitCooldown = 10; } public override bool OnTileCollide(Vector2 oldVelocity) @@ -51,6 +52,54 @@ namespace CalamityMod.Projectiles.Rogue return false; } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (Main.myPlayer != projectile.owner) + return; + + for (int i = 0; i < 2; i++) + { + int direction = Main.player[projectile.owner].direction; + float xStart = Main.screenPosition.X; + if (direction < 0) + xStart += Main.screenWidth; + float yStart = Main.screenPosition.Y + Main.rand.Next(Main.screenHeight); + Vector2 startPos = new Vector2(xStart, yStart); + Vector2 pathToTravel = target.Center - startPos; + pathToTravel.X += Main.rand.NextFloat(-50f, 50f) * 0.1f; + pathToTravel.Y += Main.rand.NextFloat(-50f, 50f) * 0.1f; + float speedMult = 24f / pathToTravel.Length(); + pathToTravel.X *= speedMult; + pathToTravel.Y *= speedMult; + int petal = Projectile.NewProjectile(startPos, pathToTravel, ProjectileID.FlowerPetal, projectile.damage, 0f, projectile.owner, 0f, 0f); + Main.projectile[petal].Calamity().forceRogue = true; + } + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + if (Main.myPlayer != projectile.owner) + return; + + for (int i = 0; i < 2; i++) + { + int direction = Main.player[projectile.owner].direction; + float xStart = Main.screenPosition.X; + if (direction < 0) + xStart += Main.screenWidth; + float yStart = Main.screenPosition.Y + Main.rand.Next(Main.screenHeight); + Vector2 startPos = new Vector2(xStart, yStart); + Vector2 pathToTravel = target.Center - startPos; + pathToTravel.X += Main.rand.NextFloat(-50f, 50f) * 0.1f; + pathToTravel.Y += Main.rand.NextFloat(-50f, 50f) * 0.1f; + float speedMult = 24f / pathToTravel.Length(); + pathToTravel.X *= speedMult; + pathToTravel.Y *= speedMult; + int petal = Projectile.NewProjectile(startPos, pathToTravel, ProjectileID.FlowerPetal, projectile.damage, 0f, projectile.owner, 0f, 0f); + Main.projectile[petal].Calamity().forceRogue = true; + } + } + public override void Kill(int timeLeft) { if (Main.rand.NextBool(2)) diff --git a/Projectiles/Rogue/PalladiumJavelinProjectile.cs b/Projectiles/Rogue/PalladiumJavelinProjectile.cs index b023d36f6b..2b23890cda 100644 --- a/Projectiles/Rogue/PalladiumJavelinProjectile.cs +++ b/Projectiles/Rogue/PalladiumJavelinProjectile.cs @@ -24,11 +24,40 @@ namespace CalamityMod.Projectiles.Rogue projectile.timeLeft = 600; aiType = ProjectileID.BoneJavelin; projectile.Calamity().rogue = true; + projectile.localNPCHitCooldown = 10; + projectile.usesLocalNPCImmunity = true; } public override void AI() { projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; + + //Stealth strike behavior + if (!projectile.Calamity().stealthStrike || projectile.owner != Main.myPlayer || projectile.Calamity().lineColor >= 2) + return; + projectile.localAI[0]++; + if (projectile.localAI[0] >= 30f) + { + Vector2 vector2 = new Vector2(20f, 20f); + for (int index1 = 0; index1 < 10; ++index1) + { + int index2 = Dust.NewDust(projectile.Center - vector2 / 2f, (int) vector2.X, (int) vector2.Y, 87, 0f, 0f, 100, new Color(), 1.5f); + Dust dust = Main.dust[index2]; + dust.velocity *= 1.4f; + } + for (int index1 = 0; index1 < 5; ++index1) + { + Dust.NewDust(projectile.Center - vector2 / 2f, (int) vector2.X, (int) vector2.Y, 144, 0f, 0f, 0, default, 1f); + } + + int javelin = Projectile.NewProjectile(projectile.Center, projectile.velocity.RotatedBy(MathHelper.ToRadians(5f)), projectile.type, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + int javelin2 = Projectile.NewProjectile(projectile.Center, projectile.velocity.RotatedBy(MathHelper.ToRadians(-5f)), projectile.type, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[javelin].Calamity().lineColor = projectile.Calamity().lineColor + 1; + Main.projectile[javelin2].Calamity().lineColor = projectile.Calamity().lineColor + 1; + Main.projectile[javelin].Calamity().stealthStrike = true; + Main.projectile[javelin2].Calamity().stealthStrike = true; + projectile.Kill(); + } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) @@ -40,7 +69,7 @@ namespace CalamityMod.Projectiles.Rogue public override void Kill(int timeLeft) { - if (Main.rand.NextBool(2)) + if (Main.rand.NextBool(2) && !projectile.Calamity().stealthStrike) { Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, ModContent.ItemType()); } diff --git a/Projectiles/Rogue/PhantasmalRuinProj.cs b/Projectiles/Rogue/PhantasmalRuinProj.cs index 4c8e102722..5ff968f089 100644 --- a/Projectiles/Rogue/PhantasmalRuinProj.cs +++ b/Projectiles/Rogue/PhantasmalRuinProj.cs @@ -45,16 +45,11 @@ namespace CalamityMod.Projectiles.Rogue { if (projectile.Calamity().stealthStrike) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.5), projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, ModContent.ProjectileType(), (int)(projectile.damage * 0.5), projectile.knockBack, projectile.owner, 0f, 0f); } else { - if (Main.rand.NextBool(3)) - { - int soul = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0f, Main.rand.NextFloat(-2,2), ProjectileID.LostSoulFriendly, (int)((double)projectile.damage * 0.5), projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[soul].Calamity().forceRogue = true; - Main.projectile[soul].timeLeft = 180; - } + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0f, Main.rand.NextFloat(-2,2), ModContent.ProjectileType(), (int)(projectile.damage * 0.5), projectile.knockBack, projectile.owner, 0f, 0f); } } } diff --git a/Projectiles/Rogue/PlaguenadeBee.cs b/Projectiles/Rogue/PlaguenadeBee.cs index 64b285965a..1eb275eb94 100644 --- a/Projectiles/Rogue/PlaguenadeBee.cs +++ b/Projectiles/Rogue/PlaguenadeBee.cs @@ -30,11 +30,11 @@ namespace CalamityMod.Projectiles.Rogue { if (projectile.velocity.X > 0f) { - projectile.spriteDirection = 1; + projectile.spriteDirection = projectile.direction = 1; } else if (projectile.velocity.X < 0f) { - projectile.spriteDirection = -1; + projectile.spriteDirection = projectile.direction = -1; } projectile.rotation = projectile.velocity.X * 0.05f; projectile.frameCounter++; diff --git a/Projectiles/Rogue/Quasar2.cs b/Projectiles/Rogue/Quasar2.cs index 81e6cb4ea5..4d8b87ad05 100644 --- a/Projectiles/Rogue/Quasar2.cs +++ b/Projectiles/Rogue/Quasar2.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Rogue float num472 = projectile.Center.X; float num473 = projectile.Center.Y; float num474 = 600f; - for (int num475 = 0; num475 < 200; num475++) + for (int num475 = 0; num475 < Main.maxNPCs; num475++) { if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1) && !CalamityPlayer.areThereAnyDamnBosses) { @@ -90,6 +90,13 @@ namespace CalamityMod.Projectiles.Rogue { Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, ModContent.DustType(), projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); } + if (projectile.Calamity().stealthStrike && projectile.owner == Main.myPlayer) + { + int boomer = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(projectile.damage * 0.5f), projectile.knockBack, projectile.owner, 0f, 1f); + Main.projectile[boomer].Calamity().stealthStrike = projectile.Calamity().stealthStrike; + Main.projectile[boomer].height = Main.projectile[boomer].width = 280; + Main.projectile[boomer].Center = projectile.Center; + } } } } diff --git a/Projectiles/Rogue/QuasarKnife.cs b/Projectiles/Rogue/QuasarKnife.cs index 6b71e68cd6..a23f7dd363 100644 --- a/Projectiles/Rogue/QuasarKnife.cs +++ b/Projectiles/Rogue/QuasarKnife.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Rogue float num472 = projectile.Center.X; float num473 = projectile.Center.Y; float num474 = 600f; - for (int num475 = 0; num475 < 200; num475++) + for (int num475 = 0; num475 < Main.maxNPCs; num475++) { if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1) && !CalamityPlayer.areThereAnyDamnBosses) { @@ -82,7 +82,12 @@ namespace CalamityMod.Projectiles.Rogue } speed.Normalize(); speed *= (float)Main.rand.Next(30, 61) * 0.1f * 2.5f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, speed.X, speed.Y, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + int knife = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, speed.X, speed.Y, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[knife].Calamity().stealthStrike = projectile.Calamity().stealthStrike; + if (projectile.Calamity().stealthStrike) + { + Main.projectile[knife].timeLeft = 120; + } } Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); diff --git a/Projectiles/Rogue/RadiantExplosion.cs b/Projectiles/Rogue/RadiantExplosion.cs index cf796eb082..76fac37912 100644 --- a/Projectiles/Rogue/RadiantExplosion.cs +++ b/Projectiles/Rogue/RadiantExplosion.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.CalPlayer; using CalamityMod.Dusts; using CalamityMod.Projectiles.Ranged; using CalamityMod.Projectiles.Typeless; @@ -54,6 +55,41 @@ namespace CalamityMod.Projectiles.Rogue Main.dust[num469].velocity *= 0f; } } + + if (projectile.ai[1] == 1f) //Quasar Stealth Strike + { + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 600f; + for (int num475 = 0; num475 < Main.maxNPCs; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1) && !CalamityPlayer.areThereAnyDamnBosses) + { + float npcCenterX = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + float npcCenterY = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - npcCenterX) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - npcCenterY); + if (num478 < num474) + { + if (Main.npc[num475].position.X < num472) + { + Main.npc[num475].velocity.X += 0.25f; + } + else + { + Main.npc[num475].velocity.X -= 0.25f; + } + if (Main.npc[num475].position.Y < num473) + { + Main.npc[num475].velocity.Y += 0.25f; + } + else + { + Main.npc[num475].velocity.Y -= 0.25f; + } + } + } + } + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Rogue/SealedSingularityBlackhole.cs b/Projectiles/Rogue/SealedSingularityBlackhole.cs new file mode 100644 index 0000000000..6239e3f145 --- /dev/null +++ b/Projectiles/Rogue/SealedSingularityBlackhole.cs @@ -0,0 +1,99 @@ +using CalamityMod.NPCs; +using CalamityMod.NPCs.NormalNPCs; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class SealedSingularityBlackhole : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blackhole"); + Main.projFrames[projectile.type] = 7; + } + + public override void SetDefaults() + { + projectile.width = 88; + projectile.height = 90; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.Calamity().rogue = true; + projectile.tileCollide = false; + projectile.usesIDStaticNPCImmunity = true; + projectile.idStaticNPCHitCooldown = 5; + } + + public override void AI() + { + // Update animation + if (projectile.timeLeft % 5 == 0) + { + projectile.frame++; + } + if (projectile.frame >= Main.projFrames[projectile.type]) + { + projectile.frame = 0; + } + + //Succcc + float projCenX = projectile.Center.X; + float projCenY = projectile.Center.Y; + float maxDistance = projectile.Calamity().stealthStrike ? 1000f : 500f; + float succPower = projectile.Calamity().stealthStrike ? 0.25f : 0.1f; + for (int index = 0; index < Main.maxNPCs; index++) + { + NPC npc = Main.npc[index]; + if (npc.CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, npc.Center, 1, 1)) + { + if (CalamityGlobalNPC.ShouldAffectNPC(npc) || npc.type == ModContent.NPCType()) + { + float extraDistance = (npc.width / 2) + (npc.height / 2); + if (Vector2.Distance(npc.Center, projectile.Center) < (maxDistance + extraDistance)) + { + if (npc.position.X < projCenX) + { + npc.velocity.X += succPower; + } + else + { + npc.velocity.X -= succPower; + } + if (npc.position.Y < projCenY) + { + npc.velocity.Y += succPower; + } + else + { + npc.velocity.Y -= succPower; + } + } + } + } + } + + projectile.ai[0]++; + if (projectile.ai[0] > 300f) + { + projectile.scale *= 0.95f; + projectile.Opacity *= 0.95f; + projectile.height = (int)(projectile.height * projectile.scale); + projectile.width = (int)(projectile.width * projectile.scale); + } + if (projectile.scale <= 0.05f) + { + projectile.Kill(); + } + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Blackout, 300); + } + } +} diff --git a/Projectiles/Rogue/SealedSingularityBlackhole.png b/Projectiles/Rogue/SealedSingularityBlackhole.png new file mode 100644 index 0000000000..e8c92cab14 Binary files /dev/null and b/Projectiles/Rogue/SealedSingularityBlackhole.png differ diff --git a/Projectiles/Rogue/SealedSingularityGore.cs b/Projectiles/Rogue/SealedSingularityGore.cs new file mode 100644 index 0000000000..1dad8cd775 --- /dev/null +++ b/Projectiles/Rogue/SealedSingularityGore.cs @@ -0,0 +1,63 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Rogue +{ + public class SealedSingularityGore : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sealed Singularity Fragment"); + } + + public override void SetDefaults() + { + projectile.friendly = true; + projectile.width = 25; + projectile.height = 25; + projectile.Calamity().rogue = true; + } + + public override void AI() + { + //Rotation and gravity + projectile.rotation += 0.6f * projectile.direction; + projectile.velocity.Y = projectile.velocity.Y + 0.27f; + if (projectile.velocity.Y > 16f) + { + projectile.velocity.Y = 16f; + } + + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(0, (int)projectile.position.X, (int)projectile.position.Y); + //Dust effect + int splash = 0; + while (splash < 4) + { + Dust.NewDust(projectile.position, projectile.width, projectile.height, 31, -projectile.velocity.X * 0.15f, -projectile.velocity.Y * 0.10f, 150, default, 0.9f); + splash += 1; + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture; + switch (projectile.ai[0]) + { + + case 2f: texture = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/SealedSingularityGore2"); + break; + case 3f: texture = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/SealedSingularityGore3"); + break; + default: texture = Main.projectileTexture[projectile.type]; + break; + } + Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, texture.Width, texture.Height)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2(texture.Width / 2f, texture.Height / 2f), projectile.scale, SpriteEffects.None, 0f); + return false; + } + } +} diff --git a/Projectiles/Rogue/SealedSingularityGore.png b/Projectiles/Rogue/SealedSingularityGore.png new file mode 100644 index 0000000000..78e1d9b2a3 Binary files /dev/null and b/Projectiles/Rogue/SealedSingularityGore.png differ diff --git a/Projectiles/Rogue/SealedSingularityGore2.png b/Projectiles/Rogue/SealedSingularityGore2.png new file mode 100644 index 0000000000..5498c44de5 Binary files /dev/null and b/Projectiles/Rogue/SealedSingularityGore2.png differ diff --git a/Projectiles/Rogue/SealedSingularityGore3.png b/Projectiles/Rogue/SealedSingularityGore3.png new file mode 100644 index 0000000000..9c1117344f Binary files /dev/null and b/Projectiles/Rogue/SealedSingularityGore3.png differ diff --git a/Projectiles/Rogue/SealedSingularityProj.cs b/Projectiles/Rogue/SealedSingularityProj.cs new file mode 100644 index 0000000000..c085fe1261 --- /dev/null +++ b/Projectiles/Rogue/SealedSingularityProj.cs @@ -0,0 +1,69 @@ +using System; +using Terraria; +using Terraria.ID; +using Microsoft.Xna.Framework; +using Terraria.ModLoader; +using CalamityMod.Projectiles.Typeless; +using CalamityMod.CalPlayer; +using CalamityMod.Buffs.DamageOverTime; + +namespace CalamityMod.Projectiles.Rogue +{ + public class SealedSingularityProj : ModProjectile + { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/SealedSingularity"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sealed Singularity"); + } + + public override void SetDefaults() + { + projectile.width = 34; + projectile.height = 34; + projectile.friendly = true; + projectile.Calamity().rogue = true; + projectile.penetrate = 1; + projectile.timeLeft = 180; + + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 40; + } + + public override void AI() + { + projectile.ai[0] += 1f; + + if (projectile.ai[0] >= 70f) + { + projectile.velocity.X *= 0.96f; + projectile.velocity.Y *= 0.96f; + } + else + { + projectile.rotation += 0.3f * (float)projectile.direction; + } + } + + public override void Kill (int timeLeft) + { + if (projectile.owner != Main.myPlayer) + return; + + //glass-pot break sound + Main.PlaySound(13, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); + + int blackhole = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, projectile.Calamity().stealthStrike ? -180f : 0f, 0f); + Main.projectile[blackhole].Center = projectile.Center; + Main.projectile[blackhole].Calamity().stealthStrike = projectile.Calamity().stealthStrike; + + for (int index = 0; index < 3; ++index) + { + float SpeedX = -projectile.velocity.X * Main.rand.Next(40, 70) * 0.01f + Main.rand.Next(-20, 21) * 0.4f; + float SpeedY = -projectile.velocity.Y * Main.rand.Next(40, 70) * 0.01f + Main.rand.Next(-20, 21) * 0.4f; + Projectile.NewProjectile(projectile.Center.X + SpeedX, projectile.Center.Y + SpeedY, SpeedX, SpeedY, ModContent.ProjectileType(), (int)(projectile.damage * 0.25), 0f, projectile.owner, index, 0f); + } + } + } +} diff --git a/Projectiles/Rogue/ShadowBlackhole.cs b/Projectiles/Rogue/ShadowBlackhole.cs new file mode 100644 index 0000000000..adee13f4bf --- /dev/null +++ b/Projectiles/Rogue/ShadowBlackhole.cs @@ -0,0 +1,61 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class ShadowBlackhole : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blackhole"); + Main.projFrames[projectile.type] = 7; + } + + public override void SetDefaults() + { + projectile.width = 88; + projectile.height = 90; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.Calamity().rogue = true; + projectile.tileCollide = false; + projectile.usesIDStaticNPCImmunity = true; + projectile.idStaticNPCHitCooldown = 20; + } + + public override void AI() + { + // Update animation + if (projectile.timeLeft % 5 == 0) + { + projectile.frame++; + } + if (projectile.frame >= Main.projFrames[projectile.type]) + { + projectile.frame = 0; + } + + projectile.ai[0]++; + if (projectile.ai[0] > 120f) + { + projectile.scale *= 0.95f; + projectile.Opacity *= 0.95f; + projectile.height = (int)(projectile.height * projectile.scale); + projectile.width = (int)(projectile.width * projectile.scale); + } + if (projectile.scale <= 0.05f) + { + projectile.Kill(); + } + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Blackout, 300); + } + } +} diff --git a/Projectiles/Rogue/ShadowBlackhole.png b/Projectiles/Rogue/ShadowBlackhole.png new file mode 100644 index 0000000000..e8c92cab14 Binary files /dev/null and b/Projectiles/Rogue/ShadowBlackhole.png differ diff --git a/Projectiles/Rogue/ShockTeslaAura.cs b/Projectiles/Rogue/ShockTeslaAura.cs index dae84a495d..120724c3b2 100644 --- a/Projectiles/Rogue/ShockTeslaAura.cs +++ b/Projectiles/Rogue/ShockTeslaAura.cs @@ -99,7 +99,7 @@ namespace CalamityMod.Projectiles.Rogue if (CalamityGlobalNPC.ShouldAffectNPC(target)) { - float knockbackMultiplier = knockback - target.knockBackResist; + float knockbackMultiplier = knockback - (1f - target.knockBackResist); if (knockbackMultiplier < 0) { knockbackMultiplier = 0; diff --git a/Projectiles/Rogue/SnapClamProj.png b/Projectiles/Rogue/SnapClamProj.png index 5768ab3887..16b9d31422 100644 Binary files a/Projectiles/Rogue/SnapClamProj.png and b/Projectiles/Rogue/SnapClamProj.png differ diff --git a/Projectiles/Rogue/SnapClamStealth.cs b/Projectiles/Rogue/SnapClamStealth.cs index 91b6c40e2b..d9abdaa989 100644 --- a/Projectiles/Rogue/SnapClamStealth.cs +++ b/Projectiles/Rogue/SnapClamStealth.cs @@ -10,6 +10,8 @@ namespace CalamityMod.Projectiles.Rogue public bool openClam = true; public bool onEnemy = false; + public override string Texture => "CalamityMod/Projectiles/Rogue/SnapClamProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Snap Clam"); diff --git a/Projectiles/Rogue/SnapClamStealth.png b/Projectiles/Rogue/SnapClamStealth.png deleted file mode 100644 index 5768ab3887..0000000000 Binary files a/Projectiles/Rogue/SnapClamStealth.png and /dev/null differ diff --git a/Projectiles/Rogue/SpearofDestinyGlow.png b/Projectiles/Rogue/SpearofDestinyGlow.png new file mode 100644 index 0000000000..ce935139cd Binary files /dev/null and b/Projectiles/Rogue/SpearofDestinyGlow.png differ diff --git a/Projectiles/Rogue/SpearofDestinyProjectile.cs b/Projectiles/Rogue/SpearofDestinyProjectile.cs index 36da995728..14da5b83bd 100644 --- a/Projectiles/Rogue/SpearofDestinyProjectile.cs +++ b/Projectiles/Rogue/SpearofDestinyProjectile.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Rogue { public class SpearofDestinyProjectile : ModProjectile { + private bool initialized = false; + public override void SetStaticDefaults() { DisplayName.SetDefault("Spear"); @@ -26,10 +28,21 @@ namespace CalamityMod.Projectiles.Rogue projectile.timeLeft = 600; aiType = ProjectileID.BoneJavelin; projectile.Calamity().rogue = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; } public override void AI() { + if (!initialized) + { + if (projectile.Calamity().stealthStrike) + { + projectile.penetrate++; + projectile.tileCollide = false; + } + initialized = true; + } if (Main.rand.NextBool(4)) { Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 246, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); @@ -49,8 +62,9 @@ namespace CalamityMod.Projectiles.Rogue if (Main.npc[i].CanBeChasedBy(projectile, false)) { float extraDistance = (float)(Main.npc[i].width / 2) + (float)(Main.npc[i].height / 2); + bool canHit = projectile.Calamity().stealthStrike || Collision.CanHit(projectile.Center, 1, 1, Main.npc[i].Center, 1, 1); - if (Vector2.Distance(Main.npc[i].Center, projectile.Center) < (maxDistance + extraDistance) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[i].Center, 1, 1)) + if (Vector2.Distance(Main.npc[i].Center, projectile.Center) < (maxDistance + extraDistance) && canHit) { center = Main.npc[i].Center; homeIn = true; @@ -93,5 +107,14 @@ namespace CalamityMod.Projectiles.Rogue { target.AddBuff(BuffID.Ichor, 120); } + + public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) + { + if (projectile.Calamity().stealthStrike) + { + Texture2D tex = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/SpearofDestinyGlow"); + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, tex.Size() / 2, projectile.scale, SpriteEffects.None, 0f); + } + } } } diff --git a/Projectiles/Rogue/StealthNimbus.png b/Projectiles/Rogue/StealthNimbus.png index 8ed0e6e673..234d306f54 100644 Binary files a/Projectiles/Rogue/StealthNimbus.png and b/Projectiles/Rogue/StealthNimbus.png differ diff --git a/Projectiles/Rogue/StealthNimbusCloud.png b/Projectiles/Rogue/StealthNimbusCloud.png index f17fc547d8..c7e15d492c 100644 Binary files a/Projectiles/Rogue/StealthNimbusCloud.png and b/Projectiles/Rogue/StealthNimbusCloud.png differ diff --git a/Projectiles/Rogue/TheSyringeProj.cs b/Projectiles/Rogue/TheSyringeProj.cs index 2a543dec1d..e62b56ae28 100644 --- a/Projectiles/Rogue/TheSyringeProj.cs +++ b/Projectiles/Rogue/TheSyringeProj.cs @@ -82,25 +82,23 @@ namespace CalamityMod.Projectiles.Rogue } value15.Normalize(); value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.5), 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, ModContent.ProjectileType(), (int)(projectile.damage * 0.5), 0f, Main.myPlayer, 0f, 0f); } for (int index = 0; index < 2; ++index) { float SpeedX = -projectile.velocity.X * Main.rand.Next(40, 70) * 0.01f + Main.rand.Next(-20, 21) * 0.4f; float SpeedY = -projectile.velocity.Y * Main.rand.Next(40, 70) * 0.01f + Main.rand.Next(-20, 21) * 0.4f; - Projectile.NewProjectile(projectile.Center.X + SpeedX, projectile.Center.Y + SpeedY, SpeedX, SpeedY, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.25), 0f, Main.myPlayer, Main.rand.Next(3), 0f); + Projectile.NewProjectile(projectile.Center.X + SpeedX, projectile.Center.Y + SpeedY, SpeedX, SpeedY, ModContent.ProjectileType(), (int)(projectile.damage * 0.25), 0f, Main.myPlayer, Main.rand.Next(3), 0f); } } if (projectile.owner == Main.myPlayer && projectile.ai[1] == 1) { - int num3; - for (int num639 = 0; num639 < 5; num639 = num3 + 1) + for (int num639 = 0; num639 < 5; num639++) { float speedX = (float)Main.rand.Next(-35, 36) * 0.02f; float speedY = (float)Main.rand.Next(-35, 36) * 0.02f; - int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, speedX, speedY, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.5), 0f, Main.myPlayer, 0f, 0f); + int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, speedX, speedY, ModContent.ProjectileType(), (int)(projectile.damage * 0.5), 0f, Main.myPlayer, 0f, 0f); Main.projectile[proj].penetrate = 1; - num3 = num639; } } } diff --git a/Projectiles/Rogue/TotalityFlask.cs b/Projectiles/Rogue/TotalityFlask.cs index 1f86320d87..148a07c262 100644 --- a/Projectiles/Rogue/TotalityFlask.cs +++ b/Projectiles/Rogue/TotalityFlask.cs @@ -53,6 +53,9 @@ namespace CalamityMod.Projectiles.Rogue public override void Kill(int timeLeft) { + if (projectile.owner != Main.myPlayer) + return; + //glass-pot break sound Main.PlaySound(13, (int) projectile.position.X, (int) projectile.position.Y, 1, 1f, 0f); @@ -79,19 +82,16 @@ namespace CalamityMod.Projectiles.Rogue dust2.velocity *= 3f; } int num251 = Main.rand.Next(2, 4); - if (projectile.owner == Main.myPlayer) - { - for (int num252 = 0; num252 < num251; num252++) - { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, ModContent.ProjectileType(), (int)(projectile.damage * 0.3), 0f, Main.myPlayer, 0f, 0f); - } + for (int num252 = 0; num252 < num251; num252++) + { + Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + while (value15.X == 0f && value15.Y == 0f) + { + value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + } + value15.Normalize(); + value15 *= (float)Main.rand.Next(70, 101) * 0.1f; + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, ModContent.ProjectileType(), (int)(projectile.damage * 0.3), 0f, Main.myPlayer, 0f, 0f); } } } diff --git a/Projectiles/Rogue/XerocPitchforkProjectile.cs b/Projectiles/Rogue/XerocPitchforkProjectile.cs index 2280da17b4..425d9234ec 100644 --- a/Projectiles/Rogue/XerocPitchforkProjectile.cs +++ b/Projectiles/Rogue/XerocPitchforkProjectile.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -40,6 +41,17 @@ namespace CalamityMod.Projectiles.Rogue { projectile.rotation -= 1.57f; } + if (projectile.timeLeft % 12 == 0) + { + if (projectile.owner == Main.myPlayer) + { + if (projectile.Calamity().stealthStrike) + { + int star = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, ModContent.ProjectileType(), (int)(projectile.damage * 0.5), projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[star].Calamity().rogue = true; + } + } + } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Summon/AndromedaDeathRay.cs b/Projectiles/Summon/AndromedaDeathRay.cs new file mode 100644 index 0000000000..a6b476148f --- /dev/null +++ b/Projectiles/Summon/AndromedaDeathRay.cs @@ -0,0 +1,217 @@ +using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.Enums; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Summon +{ + public class AndromedaDeathRay : ModProjectile + { + // How long this laser can exist before it is deleted. + public const int TrueTimeLeft = 25; + + // Pretty self explanatory + private const float maximumLength = 2000f; + + public float AngularMultiplier = 0f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + ProjectileID.Sets.MinionShot[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 18; + projectile.height = 14; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.timeLeft = TrueTimeLeft; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 4; + } + + // Netcode for sending and receiving shit + // localAI[0] is the timer, localAI[1] is the laser length + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + writer.Write(projectile.localAI[1]); + writer.Write(AngularMultiplier); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + projectile.localAI[1] = reader.ReadSingle(); + AngularMultiplier = reader.ReadSingle(); + } + + public override void AI() + { + Projectile owner = Main.projectile[(int)projectile.ai[0]]; + Player player = Main.player[projectile.owner]; + + if (owner.type != ModContent.ProjectileType() || !owner.active) + projectile.Kill(); + if (owner.active) + { + projectile.Center = player.Center + new Vector2(owner.spriteDirection == 1 ? 48f : 22f, -28f); + if (player.Calamity().andromedaState == AndromedaPlayerState.SmallRobot) + { + projectile.Center = player.Center + new Vector2(owner.spriteDirection == 1 ? 24f : 2f, 0f); + } + } + + // How fat the laser is + float laserSize = 0.6f + (float)Math.Sin(projectile.localAI[0] / 7f) * 0.025f; // The sine gives a pulsating effect to the laser + + projectile.localAI[0] += 1f; + if (projectile.localAI[0] >= TrueTimeLeft) + { + projectile.Kill(); + return; + } + + // Causes the effect where the laser appears to expand/contract at the beginning and end of its life + projectile.scale = (float)Math.Sin(projectile.localAI[0] * MathHelper.Pi / TrueTimeLeft) * 5f * laserSize; + if (projectile.scale > laserSize) + { + projectile.scale = laserSize; + } + + projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; + + // Generate dust form the beginning of the ray, giving an illusion of electricity escaping the laser cannon. + if (!Main.dedServ) + { + for (int i = 0; i < 4; i++) + { + Dust dust = Dust.NewDustPerfect(projectile.Center, 133); + dust.velocity = projectile.velocity.RotatedByRandom(0.5f) * Main.rand.NextFloat(2f, 3.5f) + Main.player[projectile.owner].velocity * 1.5f; + dust.fadeIn = Main.rand.NextFloat(0.6f, 0.85f); + if (player.Calamity().andromedaState == AndromedaPlayerState.SmallRobot) + { + dust.fadeIn = 0.05f; + dust.scale = 0.8f; + } + dust.noGravity = true; + } + } + + Vector2 samplingPoint = projectile.Center; + + float[] samples = new float[3]; + + float determinedLength = 0f; + Collision.LaserScan(samplingPoint, projectile.velocity, projectile.width * projectile.scale, maximumLength, samples); + for (int i = 0; i < samples.Length; i++) + { + determinedLength += samples[i]; + } + determinedLength /= samples.Length; + + projectile.localAI[1] = MathHelper.Lerp(projectile.localAI[1], determinedLength, 0.5f); + Vector2 beamEndPosiiton = projectile.Center + projectile.velocity * projectile.localAI[1]; + // Dust at the end of the beam, if there's a tile there. + if (Collision.SolidCollision(beamEndPosiiton, 16, 16) && !Main.dedServ) + { + if (AngularMultiplier == 0f) + AngularMultiplier = Main.rand.NextFloat(1f, 4f); + float angle = projectile.localAI[0] / 18f; + float x = (float)Math.Sin(angle * AngularMultiplier) * (float)Math.Cos(angle); + float y = (float)Math.Cos(angle * AngularMultiplier) * (float)Math.Sin(angle); + Vector2 velocity = new Vector2(x * 4.5f, y * 2f); + + for (int i = 0; i < 3; i++) + { + Dust dust = Dust.NewDustPerfect(beamEndPosiiton + angle.ToRotationVector2() * 8f, 133); + dust.velocity = velocity.RotatedBy(MathHelper.TwoPi / 3f * i); + dust.scale = (float)Math.Cos(angle) + 1.2f; + dust.noGravity = true; + } + } + + // Draw light blue light across the laser + DelegateMethods.v3_1 = Color.SkyBlue.ToVector3(); + Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + if (projectile.velocity == Vector2.Zero) + { + return false; + } + Texture2D laserTailTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/AndromedaDeathrayBegin"); + Texture2D laserBodyTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/AndromedaDeathrayMid"); + Texture2D laserHeadTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/AndromedaDeathrayEnd"); + float laserLength = projectile.localAI[1]; + Color drawColor = new Color(1f, 1f, 1f) * 0.9f; + + // Laser tail logic + + Main.spriteBatch.Draw(laserTailTexture, projectile.Center - Main.screenPosition, null, drawColor, projectile.rotation, laserTailTexture.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + + // Laser body logic + + laserLength -= (laserTailTexture.Height / 2 + laserHeadTexture.Height) * projectile.scale; + Vector2 centerDelta = projectile.Center; + centerDelta += projectile.velocity * projectile.scale * laserTailTexture.Height / 2f; + if (laserLength > 0f) + { + float laserLengthDelta = 0f; + Rectangle sourceRectangle = new Rectangle(0, 0, laserBodyTexture.Width, laserBodyTexture.Height); + while (laserLengthDelta + 1f < laserLength) + { + if (laserLength - laserLengthDelta < sourceRectangle.Height) + { + sourceRectangle.Height = (int)(laserLength - laserLengthDelta); + } + Main.spriteBatch.Draw(laserBodyTexture, centerDelta - Main.screenPosition, new Rectangle?(sourceRectangle), drawColor, projectile.rotation, new Vector2(sourceRectangle.Width / 2f, 0f), projectile.scale, SpriteEffects.None, 0f); + laserLengthDelta += sourceRectangle.Height * projectile.scale; + centerDelta += projectile.velocity * sourceRectangle.Height * projectile.scale; + sourceRectangle.Y += 16; + if (sourceRectangle.Y + sourceRectangle.Height > laserBodyTexture.Height) + { + sourceRectangle.Y = 0; + } + } + } + + // Laser head logic + + Main.spriteBatch.Draw(laserHeadTexture, centerDelta - Main.screenPosition, null, drawColor, projectile.rotation, laserHeadTexture.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } + + public override void CutTiles() + { + DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; + Vector2 unit = projectile.velocity; + Utils.PlotTileLine(projectile.Center, projectile.Center + unit * projectile.localAI[1], (float)projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + if (projHitbox.Intersects(targetHitbox)) + { + return true; + } + float value = 0f; + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], 22f * projectile.scale, ref value)) + { + return true; + } + return false; + } + } +} diff --git a/Projectiles/Summon/AndromedaDeathRay.png b/Projectiles/Summon/AndromedaDeathRay.png new file mode 100644 index 0000000000..f3dc2a77b0 Binary files /dev/null and b/Projectiles/Summon/AndromedaDeathRay.png differ diff --git a/Projectiles/Summon/AndromedaRegislash.cs b/Projectiles/Summon/AndromedaRegislash.cs new file mode 100644 index 0000000000..574be30c67 --- /dev/null +++ b/Projectiles/Summon/AndromedaRegislash.cs @@ -0,0 +1,69 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Summon +{ + public class AndromedaRegislash : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Regislash"); + Main.projFrames[projectile.type] = 6; + } + + public override void SetDefaults() + { + projectile.width = 582; + projectile.height = 304; + projectile.tileCollide = false; + projectile.friendly = true; + projectile.minion = true; + projectile.minionSlots = 0f; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.light = 3f; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 5; + } + + public override void AI() + { + Player player = Main.player[projectile.owner]; + if (projectile.localAI[0] == 0f) + { + if (CalamityUtils.CountProjectiles(projectile.type) > 1) + { + projectile.Kill(); + return; + } + Main.PlaySound(SoundID.DD2_DrakinShot, projectile.Center); + projectile.rotation = projectile.AngleTo(Main.MouseWorld); + projectile.localAI[0] = 1f; + } + projectile.position = player.Center - projectile.Size / 2f; + if (Math.Abs(Math.Cos(projectile.rotation)) > 0.675f) + { + projectile.position.X += Math.Sign(Math.Cos(projectile.rotation)) * 295f; + } + projectile.position.Y += (float)Math.Sin(projectile.rotation) * 325f; + projectile.frameCounter++; + if (projectile.frameCounter % 7 == 6) + { + projectile.frame++; + } + if (projectile.frame >= Main.projFrames[projectile.type]) + { + projectile.Kill(); + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + return false; + } + } +} diff --git a/Projectiles/Summon/AndromedaRegislash.png b/Projectiles/Summon/AndromedaRegislash.png new file mode 100644 index 0000000000..49a0abb62f Binary files /dev/null and b/Projectiles/Summon/AndromedaRegislash.png differ diff --git a/Projectiles/Summon/AndromedaSmall.png b/Projectiles/Summon/AndromedaSmall.png new file mode 100644 index 0000000000..dd64a0897b Binary files /dev/null and b/Projectiles/Summon/AndromedaSmall.png differ diff --git a/Projectiles/Summon/AndromedaUI/AndromedaUI_Background.cs b/Projectiles/Summon/AndromedaUI/AndromedaUI_Background.cs new file mode 100644 index 0000000000..af57cc96ee --- /dev/null +++ b/Projectiles/Summon/AndromedaUI/AndromedaUI_Background.cs @@ -0,0 +1,454 @@ +using CalamityMod.Buffs.Cooldowns; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System.IO; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon.AndromedaUI +{ + public class AndromedaUI_Background : ModProjectile + { + public int FadeoutTime = -1; + public Vector2 PlayerOffset = Vector2.Zero; + public static readonly int FadeoutTimeMax = 40; + public static readonly Vector2 LeftBracketOffset = new Vector2(-8f, -6f); + public static readonly Vector2 RightBracketOffset = new Vector2(8f, -6f); + public static readonly Vector2 TopBracketOffset = new Vector2(2f, 27f); + public GiantIbanRobotOfDoom AttachedRobot => (GiantIbanRobotOfDoom)Main.projectile[(int)projectile.localAI[0]].modProjectile; + + // These properties are here to mitigate the need for typing out long and cumbersome slews of the same code to access the robot's variables. + + #region Robot Properties + public bool LeftBracketActive + { + get => AttachedRobot.LeftBracketActive; + set => AttachedRobot.LeftBracketActive = value; + } + public bool RightBracketActive + { + get => AttachedRobot.RightBracketActive; + set => AttachedRobot.RightBracketActive = value; + } + public bool BottomBracketActive + { + get => AttachedRobot.BottomBracketActive; + set => AttachedRobot.BottomBracketActive = value; + } + + public bool LeftIconActive + { + get => AttachedRobot.LeftIconActive; + set => AttachedRobot.LeftIconActive = value; + } + public int RightIconCooldown + { + get => AttachedRobot.RightIconCooldown; + set => AttachedRobot.RightIconCooldown = value; + } + public bool TopIconActive + { + get => AttachedRobot.TopIconActive; + set => AttachedRobot.TopIconActive = value; + } + #endregion + + // Mouse calculations are done primarily in a World context, not Screen, in this file. + Rectangle MouseRectangle => new Rectangle((int)Main.MouseWorld.X, (int)Main.MouseWorld.Y, 2, 2); + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("UI"); + } + + public override void SetDefaults() + { + projectile.width = 62; + projectile.height = 58; + projectile.ignoreWater = true; + projectile.timeLeft = 36000; + projectile.tileCollide = false; + projectile.friendly = true; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(FadeoutTime); + writer.Write(projectile.localAI[0]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + FadeoutTime = reader.ReadInt32(); + projectile.localAI[0] = reader.ReadSingle(); + } + + public override void AI() + { + // Death fade-out effect + if (FadeoutTime > 0) + { + projectile.alpha = (int)MathHelper.Lerp(0f, 255f, 1f - FadeoutTime / (float)FadeoutTimeMax); + FadeoutTime--; + } + else if (FadeoutTime == 0) + { + projectile.Kill(); + } + + // Kill the UI immediately if there is no robot, and halt the AI + if (Main.projectile[(int)projectile.localAI[0]].type != ModContent.ProjectileType() || + !Main.projectile[(int)projectile.localAI[0]].active) + { + projectile.Kill(); + return; + } + + // Fade-in effect + projectile.localAI[1]++; + if (projectile.localAI[1] < 40f) + { + projectile.alpha = (int)MathHelper.Lerp(255f, 0f, projectile.localAI[1] / 40f); + } + + // Adjust the position of the UI. + if (Main.myPlayer == projectile.owner) + { + if (PlayerOffset == Vector2.Zero) + { + PlayerOffset = Main.player[projectile.owner].Center - projectile.Center; + } + projectile.Center = Main.player[projectile.owner].Center - PlayerOffset; + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + // Should be invisible for players that do not control the UI + if (Main.myPlayer == projectile.owner) + { + // Draw the background UI + spriteBatch.Draw(ModContent.GetTexture(Texture), + projectile.Center - Main.screenPosition, + null, + Color.White * projectile.Opacity, + 0f, + projectile.Size * 0.5f, + projectile.scale, + SpriteEffects.None, + 0f); + DrawBrackets(spriteBatch); + DrawIcons(spriteBatch); + + + // Kills the projectile if the player clicks something that isn't the UI. + // This is done in here and not AI to ensure that the above checks are done immediately before this check. + if (!Main.blockMouse && Main.mouseLeft && FadeoutTime == -1) + { + FadeoutTime = FadeoutTimeMax; + } + } + + return false; + } + + public void DrawBrackets(SpriteBatch spriteBatch) + { + Texture2D leftBracketTexture = ModContent.GetTexture("CalamityMod/Projectiles/Summon/AndromedaUI/LeftBracket" + (LeftBracketActive ? "Lit" : "")); + Texture2D leftBracketTextureHovered = ModContent.GetTexture("CalamityMod/Projectiles/Summon/AndromedaUI/LeftBracketHovered"); + + Texture2D rightBracketTexture = ModContent.GetTexture("CalamityMod/Projectiles/Summon/AndromedaUI/RightBracket" + (RightBracketActive ? "Lit" : "")); + Texture2D rightBracketTextureHovered = ModContent.GetTexture("CalamityMod/Projectiles/Summon/AndromedaUI/RightBracketHovered"); + + Texture2D topBracketTexture = ModContent.GetTexture("CalamityMod/Projectiles/Summon/AndromedaUI/TopBracket" + (BottomBracketActive ? "Lit" : "")); + Texture2D topBracketTextureHovered = ModContent.GetTexture("CalamityMod/Projectiles/Summon/AndromedaUI/TopBracketHovered"); + + // Top bracket + Vector2 topBracketPosition = projectile.Bottom + TopBracketOffset; + Rectangle topBracketFrame = new Rectangle((int)topBracketPosition.X - topBracketTexture.Width / 2, + (int)topBracketPosition.Y - 24, + topBracketTexture.Width - 18, topBracketTexture.Height - 12); + bool topBracketSelect = MouseRectangle.Intersects(topBracketFrame) && !BottomBracketActive; + + spriteBatch.Draw(topBracketSelect ? topBracketTextureHovered : topBracketTexture, + topBracketPosition - Main.screenPosition, + null, + Color.White * projectile.Opacity, + 0f, + projectile.Size * 0.5f, + projectile.scale, + SpriteEffects.None, + 0f); + + // Left bracket + Vector2 leftBracketPosition = projectile.Center + LeftBracketOffset; + Rectangle leftBracketFrame = new Rectangle((int)leftBracketPosition.X - leftBracketTexture.Width / 2, + (int)leftBracketPosition.Y - 24, + leftBracketTexture.Width - 12, leftBracketTexture.Height - 18); + bool leftBracketSelect = MouseRectangle.Intersects(leftBracketFrame) && !LeftBracketActive; + + spriteBatch.Draw(leftBracketSelect ? leftBracketTextureHovered : leftBracketTexture, + leftBracketPosition - Main.screenPosition, + null, + Color.White * projectile.Opacity, + 0f, + projectile.Size * 0.5f, + projectile.scale, + SpriteEffects.None, + 0f); + + // Right bracket + Vector2 rightBracketPosition = projectile.Center + RightBracketOffset + (projectile.width / 2 - 1) * Vector2.UnitX; + Rectangle rightBracketFrame = new Rectangle((int)rightBracketPosition.X - rightBracketTexture.Width / 2, + (int)rightBracketPosition.Y - 24, + rightBracketTexture.Width - 12, rightBracketTexture.Height - 18); + bool rightBracketSelect = MouseRectangle.Intersects(rightBracketFrame) && !RightBracketActive; + + spriteBatch.Draw(rightBracketSelect ? rightBracketTextureHovered : rightBracketTexture, + rightBracketPosition - Main.screenPosition, + null, + Color.White * projectile.Opacity, + 0f, + projectile.Size * 0.5f, + projectile.scale, + SpriteEffects.None, + 0f); + + if (leftBracketSelect || rightBracketSelect || topBracketSelect) + { + Main.blockMouse = true; + if (Main.mouseLeft && Main.projectile[(int)projectile.localAI[0]].ai[0] <= 0f) + { + if (leftBracketSelect) + { + LeftBracketActive = true; + RightBracketActive = BottomBracketActive = false; + } + if (rightBracketSelect) + { + RightBracketActive = true; + LeftBracketActive = BottomBracketActive = false; + LeftIconActive = false; + } + if (topBracketSelect) + { + BottomBracketActive = true; + LeftBracketActive = RightBracketActive = false; + TopIconActive = false; + } + Main.projectile[(int)projectile.localAI[0]].ai[0] = 30f; + } + } + } + + public void DrawIcons(SpriteBatch spriteBatch) + { + // Left Icon (Big/Small indicator) + DrawLeftIcon(spriteBatch); + + // Right Icon (Lightning charge + cooldown) + DrawRightIcon(spriteBatch); + + // Top Icon (Alternating between melee swing and ranged bursts) + DrawTopIcon(spriteBatch); + } + + public void DrawLeftIcon(SpriteBatch spriteBatch) + { + // Define icons to draw + Texture2D smallIndicator = ModContent.GetTexture("CalamityMod/Projectiles/Summon/AndromedaUI/SmallIcon"); + Texture2D smallIndicatorLocked = ModContent.GetTexture("CalamityMod/Projectiles/Summon/AndromedaUI/Lock"); + Texture2D textureToDraw = smallIndicator; + + // An offset is required for said icons, as they have difference sizes. Don't touch them unless the sprites are modified. + // Bless whoever is tasked's soul if they are indeed changed + Vector2 iconOffset = new Vector2(2f, 28f); + Vector2 drawPosition = projectile.Center + iconOffset; + + bool eitherBracketActive = LeftBracketActive || BottomBracketActive; + + // Lock the icon if the active bracket does not activate the icon + if (!eitherBracketActive || RightBracketActive) + { + textureToDraw = smallIndicatorLocked; + iconOffset = new Vector2(7f, 30f); + drawPosition = projectile.Center + iconOffset; + } + bool wasActive = LeftIconActive; + LeftIconActive = textureToDraw == smallIndicator; // In simpler terms, LeftIconActive = Whether the robot is small vs if it's big. + // If the player's robot state changed, make a scene + if (LeftIconActive != wasActive) + { + if (!Main.dedServ) + { + Player player = Main.player[projectile.owner]; + for (int i = 0; i < 45; i++) + { + Dust dust = Dust.NewDustPerfect(player.Center + Utils.NextVector2Circular(Main.rand, 60f, 90f), 26); + dust.velocity = Utils.NextVector2Circular(Main.rand, 4f, 4f); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(1.2f, 1.35f); + } + for (int i = 0; i < 4; i++) + { + Utils.PoofOfSmoke(player.Center + Utils.NextVector2Circular(Main.rand, 20f, 30f)); + } + } + } + // And finally draw + spriteBatch.Draw(textureToDraw, + drawPosition - Main.screenPosition, + null, + Color.White * projectile.Opacity, + 0f, + projectile.Size * 0.5f, + projectile.scale, + SpriteEffects.None, + 0f); + } + + public void DrawRightIcon(SpriteBatch spriteBatch) + { + // Define icons to draw + Texture2D thunderIndicator = ModContent.GetTexture("CalamityMod/Projectiles/Summon/AndromedaUI/ThunderIcon"); + Texture2D thunderIndicatorHovered = ModContent.GetTexture("CalamityMod/Projectiles/Summon/AndromedaUI/ThunderIconHovered"); + Texture2D thunderIndicatorCharge = ModContent.GetTexture("CalamityMod/Projectiles/Summon/AndromedaUI/ThunderIconCharge"); + Texture2D thunderIndicatorLocked = ModContent.GetTexture("CalamityMod/Projectiles/Summon/AndromedaUI/Lock"); + Texture2D textureToDraw = thunderIndicatorLocked; + + // An offset is required for said icons, as they have difference sizes. Don't touch them unless the sprites are modified. + // Bless whoever is tasked's soul if they are indeed changed + Vector2 iconOffset = new Vector2(40f, 32f); + Vector2 drawPosition; + + bool eitherBracketActive = RightBracketActive || BottomBracketActive; + + // Lock the icon if the active bracket does not activate the icon + if (eitherBracketActive && !LeftBracketActive) + { + textureToDraw = thunderIndicator; + } + + if (textureToDraw == thunderIndicatorLocked) + { + iconOffset = new Vector2(36f, 30f); + } + + drawPosition = projectile.Center + iconOffset; + + // Otherwise do mouse click/hover checks, and, assuming the cooldown is at 0, perform the special attack and restart the cooldown. + if (textureToDraw != thunderIndicatorLocked && RightIconCooldown <= 0) + { + Rectangle iconFrame = new Rectangle((int)drawPosition.X - 36, + (int)drawPosition.Y - 32, + textureToDraw.Width + 4, textureToDraw.Height + 6); + textureToDraw = thunderIndicator; + if (MouseRectangle.Intersects(iconFrame)) + { + textureToDraw = thunderIndicatorHovered; + // Prevent clicking affecting other things. For example, disallow weapon firing. + Main.blockMouse = true; + if (Main.mouseLeft && Main.projectile[(int)projectile.localAI[0]].ai[0] <= 0f) + { + FadeoutTime = FadeoutTimeMax; + RightIconCooldown = GiantIbanRobotOfDoom.RightIconCooldownMax; + // A cooldown value. This ensures that the game will not register another click + // one frame after the first one. + Main.projectile[(int)projectile.localAI[0]].ai[0] = 30f; + + // Explosion effect + if (!Main.dedServ) + { + for (int i = 0; i < 80; i++) + { + Dust dust = Dust.NewDustPerfect(Main.projectile[(int)projectile.localAI[0]].Center, Utils.SelectRandom(Main.rand, 226, 263)); + dust.velocity = Main.rand.NextVector2Circular(14f, 14f); + dust.fadeIn = 1.1f; + dust.noGravity = true; + } + } + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LargeMechGaussRifle"), projectile.Center); + } + } + } + // And finally draw the cooldown texture + the icon + float chargeCompletionRatio = 1f - (RightIconCooldown / (float)GiantIbanRobotOfDoom.RightIconCooldownMax); + spriteBatch.Draw(thunderIndicatorCharge, + projectile.Center + new Vector2(34f, 30f) - Main.screenPosition, + new Rectangle(0, 0, thunderIndicatorCharge.Width, (int)(chargeCompletionRatio * thunderIndicatorCharge.Height)), // Fill up vertically + Color.White * projectile.Opacity, + 0f, + projectile.Size * 0.5f, + projectile.scale, + SpriteEffects.None, + 0f); + spriteBatch.Draw(textureToDraw, + drawPosition - Main.screenPosition, + null, + Color.White * projectile.Opacity, + 0f, + projectile.Size * 0.5f, + projectile.scale, + SpriteEffects.None, + 1f); + } + + public void DrawTopIcon(SpriteBatch spriteBatch) + { + // Define icons to draw + Texture2D meleeIndicator = ModContent.GetTexture("CalamityMod/Projectiles/Summon/AndromedaUI/MeleeIcon"); + Texture2D rangedIndicator = ModContent.GetTexture("CalamityMod/Projectiles/Summon/AndromedaUI/RangedIcon"); + Texture2D attackIndicatorLocked = ModContent.GetTexture("CalamityMod/Projectiles/Summon/AndromedaUI/Lock"); + Texture2D meleeIndicatorHovered = ModContent.GetTexture("CalamityMod/Projectiles/Summon/AndromedaUI/MeleeIconHovered"); + Texture2D rangedIndicatorHovered = ModContent.GetTexture("CalamityMod/Projectiles/Summon/AndromedaUI/RangedIconHovered"); + Texture2D textureToDraw = TopIconActive ? meleeIndicator : rangedIndicator; + + // An offset is required for said icons, as they have difference sizes. Don't touch them unless the sprites are modified. + // Bless whoever is tasked's soul if they are indeed changed + Vector2 iconOffset = new Vector2(22f, 8f); + Vector2 drawPosition = projectile.Center + iconOffset; + + bool eitherBracketActive = LeftBracketActive || RightBracketActive; + + // Lock the icon if the active bracket does not activate the icon + if (!eitherBracketActive || BottomBracketActive) + { + textureToDraw = attackIndicatorLocked; + iconOffset = new Vector2(22f, 6f); + drawPosition = projectile.Center + iconOffset; + } + // Otherwise do mouse click/hover checks, and, assuming the cooldown is at 0, perform the special attack and restart the cooldown. + else if (eitherBracketActive) + { + Rectangle iconFrame = new Rectangle((int)drawPosition.X - 36, + (int)drawPosition.Y - 32, + textureToDraw.Width, textureToDraw.Height); + if (MouseRectangle.Intersects(iconFrame)) + { + textureToDraw = TopIconActive ? meleeIndicatorHovered : rangedIndicatorHovered; + // Prevent clicking affecting other things. For example, disallow weapon firing. + Main.blockMouse = true; + if (Main.mouseLeft && Main.projectile[(int)projectile.localAI[0]].ai[0] <= 0f) + { + TopIconActive = !TopIconActive; + // A cooldown value. This ensures that the game will not register another click + // one frame after the first one. + Main.projectile[(int)projectile.localAI[0]].ai[0] = 30f; + } + } + } + // And finally draw + spriteBatch.Draw(textureToDraw, + drawPosition - Main.screenPosition, + null, + Color.White * projectile.Opacity, + 0f, + projectile.Size * 0.5f, + projectile.scale, + SpriteEffects.None, + 0f); + } + + public override bool CanDamage() => false; // This is a UI. It should not do damage. + } +} diff --git a/Projectiles/Summon/AndromedaUI/AndromedaUI_Background.png b/Projectiles/Summon/AndromedaUI/AndromedaUI_Background.png new file mode 100644 index 0000000000..92c8789814 Binary files /dev/null and b/Projectiles/Summon/AndromedaUI/AndromedaUI_Background.png differ diff --git a/Projectiles/Summon/AndromedaUI/BigIcon.png b/Projectiles/Summon/AndromedaUI/BigIcon.png new file mode 100644 index 0000000000..bb7a624f34 Binary files /dev/null and b/Projectiles/Summon/AndromedaUI/BigIcon.png differ diff --git a/Projectiles/Summon/AndromedaUI/BigIconHovered.png b/Projectiles/Summon/AndromedaUI/BigIconHovered.png new file mode 100644 index 0000000000..b27b0dc63d Binary files /dev/null and b/Projectiles/Summon/AndromedaUI/BigIconHovered.png differ diff --git a/Projectiles/Summon/AndromedaUI/LeftBracket.png b/Projectiles/Summon/AndromedaUI/LeftBracket.png new file mode 100644 index 0000000000..6525d99282 Binary files /dev/null and b/Projectiles/Summon/AndromedaUI/LeftBracket.png differ diff --git a/Projectiles/Summon/AndromedaUI/LeftBracketHovered.png b/Projectiles/Summon/AndromedaUI/LeftBracketHovered.png new file mode 100644 index 0000000000..ea4d3a9ded Binary files /dev/null and b/Projectiles/Summon/AndromedaUI/LeftBracketHovered.png differ diff --git a/Projectiles/Summon/AndromedaUI/LeftBracketLit.png b/Projectiles/Summon/AndromedaUI/LeftBracketLit.png new file mode 100644 index 0000000000..64114b3116 Binary files /dev/null and b/Projectiles/Summon/AndromedaUI/LeftBracketLit.png differ diff --git a/Projectiles/Summon/AndromedaUI/Lock.png b/Projectiles/Summon/AndromedaUI/Lock.png new file mode 100644 index 0000000000..4679b899c6 Binary files /dev/null and b/Projectiles/Summon/AndromedaUI/Lock.png differ diff --git a/Projectiles/Summon/AndromedaUI/MeleeIcon.png b/Projectiles/Summon/AndromedaUI/MeleeIcon.png new file mode 100644 index 0000000000..e715487add Binary files /dev/null and b/Projectiles/Summon/AndromedaUI/MeleeIcon.png differ diff --git a/Projectiles/Summon/AndromedaUI/MeleeIconHovered.png b/Projectiles/Summon/AndromedaUI/MeleeIconHovered.png new file mode 100644 index 0000000000..65cc24e115 Binary files /dev/null and b/Projectiles/Summon/AndromedaUI/MeleeIconHovered.png differ diff --git a/Projectiles/Summon/AndromedaUI/RangedIcon.png b/Projectiles/Summon/AndromedaUI/RangedIcon.png new file mode 100644 index 0000000000..2ce174b9ae Binary files /dev/null and b/Projectiles/Summon/AndromedaUI/RangedIcon.png differ diff --git a/Projectiles/Summon/AndromedaUI/RangedIconHovered.png b/Projectiles/Summon/AndromedaUI/RangedIconHovered.png new file mode 100644 index 0000000000..d20d09fdf4 Binary files /dev/null and b/Projectiles/Summon/AndromedaUI/RangedIconHovered.png differ diff --git a/Projectiles/Summon/AndromedaUI/RightBracket.png b/Projectiles/Summon/AndromedaUI/RightBracket.png new file mode 100644 index 0000000000..4a13be7270 Binary files /dev/null and b/Projectiles/Summon/AndromedaUI/RightBracket.png differ diff --git a/Projectiles/Summon/AndromedaUI/RightBracketHovered.png b/Projectiles/Summon/AndromedaUI/RightBracketHovered.png new file mode 100644 index 0000000000..f89604028f Binary files /dev/null and b/Projectiles/Summon/AndromedaUI/RightBracketHovered.png differ diff --git a/Projectiles/Summon/AndromedaUI/RightBracketLit.png b/Projectiles/Summon/AndromedaUI/RightBracketLit.png new file mode 100644 index 0000000000..b22ff3f486 Binary files /dev/null and b/Projectiles/Summon/AndromedaUI/RightBracketLit.png differ diff --git a/Projectiles/Summon/AndromedaUI/SmallIcon.png b/Projectiles/Summon/AndromedaUI/SmallIcon.png new file mode 100644 index 0000000000..a9672734f3 Binary files /dev/null and b/Projectiles/Summon/AndromedaUI/SmallIcon.png differ diff --git a/Projectiles/Summon/AndromedaUI/ThunderIcon.png b/Projectiles/Summon/AndromedaUI/ThunderIcon.png new file mode 100644 index 0000000000..758a32592d Binary files /dev/null and b/Projectiles/Summon/AndromedaUI/ThunderIcon.png differ diff --git a/Projectiles/Summon/AndromedaUI/ThunderIconCharge.png b/Projectiles/Summon/AndromedaUI/ThunderIconCharge.png new file mode 100644 index 0000000000..428b8f49b9 Binary files /dev/null and b/Projectiles/Summon/AndromedaUI/ThunderIconCharge.png differ diff --git a/Projectiles/Summon/AndromedaUI/ThunderIconHovered.png b/Projectiles/Summon/AndromedaUI/ThunderIconHovered.png new file mode 100644 index 0000000000..12947e6125 Binary files /dev/null and b/Projectiles/Summon/AndromedaUI/ThunderIconHovered.png differ diff --git a/Projectiles/Summon/AndromedaUI/TopBracket.png b/Projectiles/Summon/AndromedaUI/TopBracket.png new file mode 100644 index 0000000000..de4204d139 Binary files /dev/null and b/Projectiles/Summon/AndromedaUI/TopBracket.png differ diff --git a/Projectiles/Summon/AndromedaUI/TopBracketHovered.png b/Projectiles/Summon/AndromedaUI/TopBracketHovered.png new file mode 100644 index 0000000000..481d2b7ca3 Binary files /dev/null and b/Projectiles/Summon/AndromedaUI/TopBracketHovered.png differ diff --git a/Projectiles/Summon/AndromedaUI/TopBracketLit.png b/Projectiles/Summon/AndromedaUI/TopBracketLit.png new file mode 100644 index 0000000000..e9ebbb3eb6 Binary files /dev/null and b/Projectiles/Summon/AndromedaUI/TopBracketLit.png differ diff --git a/Projectiles/Summon/CausticStaffProjectile.cs b/Projectiles/Summon/CausticStaffProjectile.cs new file mode 100644 index 0000000000..50780e355c --- /dev/null +++ b/Projectiles/Summon/CausticStaffProjectile.cs @@ -0,0 +1,61 @@ +using CalamityMod.Buffs.StatDebuffs; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Summon +{ + public class CausticStaffProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Thorn"); + ProjectileID.Sets.MinionShot[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.minion = true; + projectile.minionSlots = 0f; + projectile.ignoreWater = true; + projectile.penetrate = 3; + projectile.timeLeft = 360; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.extraUpdates = 1; + projectile.tileCollide = false; + } + public override void AI() + { + int num822 = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Fire, 0f, 0f, 0, default, 0.5f); + Dust dust = Main.dust[num822]; + dust.velocity *= 0.1f; + dust.scale = 1.3f; + dust.noGravity = true; + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + projectile.velocity.X *= 0.99f; + if (projectile.velocity.Y < 9f) + projectile.velocity.Y += 0.085f; + } + public override void Kill(int timeLeft) + { + for (int i = 0; i < 5; i++) + { + Dust dust = Dust.NewDustPerfect(projectile.Center, DustID.Fire); + dust.noGravity = true; + dust.velocity = Vector2.One.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(2); + } + } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(BuffID.Ichor, 180); + target.AddBuff(BuffID.Venom, 180); + target.AddBuff(BuffID.CursedInferno, 180); + target.AddBuff(BuffID.OnFire, 180); + } + } +} diff --git a/Projectiles/Summon/CausticStaffProjectile.png b/Projectiles/Summon/CausticStaffProjectile.png new file mode 100644 index 0000000000..4523c43f06 Binary files /dev/null and b/Projectiles/Summon/CausticStaffProjectile.png differ diff --git a/Projectiles/Summon/CausticStaffSummon.cs b/Projectiles/Summon/CausticStaffSummon.cs new file mode 100644 index 0000000000..8a691e51c9 --- /dev/null +++ b/Projectiles/Summon/CausticStaffSummon.cs @@ -0,0 +1,308 @@ +using CalamityMod.Buffs.Summon; +using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Summon +{ + public class CausticStaffSummon : ModProjectile + { + public bool initialized = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Caustic Dragon"); + Main.projFrames[projectile.type] = 4; + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 26; + projectile.height = 26; + projectile.netImportant = true; + projectile.friendly = true; + projectile.minionSlots = 1f; + 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]; + CalamityPlayer modPlayer = player.Calamity(); + + //Spawn dust and record initial damage values + if (!initialized) + { + projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + int dustAmt = 36; + for (int dustIndex = 0; dustIndex < dustAmt; dustIndex++) + { + Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(dustIndex - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + projectile.Center; + Vector2 vector7 = vector6 - projectile.Center; + int dusty = Dust.NewDust(vector6 + vector7, 0, 0, DustID.Fire, vector7.X * 1f, vector7.Y * 1f, 100, default, 1.1f); + Main.dust[dusty].noGravity = true; + Main.dust[dusty].noLight = true; + Main.dust[dusty].velocity = vector7; + } + initialized = true; + } + + //if minion damage changes, update it + if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue * + player.MinionDamage()); + projectile.damage = damage2; + } + + //If the correct minion, set bools and apply buffs + bool correctMinion = projectile.type == ModContent.ProjectileType(); + player.AddBuff(ModContent.BuffType(), 3600); + if (correctMinion) + { + if (player.dead) + { + modPlayer.causticDragon = false; + } + if (modPlayer.causticDragon) + { + projectile.timeLeft = 2; + } + } + + //Anti sticky movement to prevent minions from stacking + float antiStickyFloat = 0.05f; + for (int index = 0; index < Main.maxProjectiles; ++index) + { + Projectile proj = Main.projectile[index]; + if (index != projectile.whoAmI && proj.active && (proj.owner == projectile.owner && proj.type == projectile.type) && (double) 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 -= antiStickyFloat; + else + projectile.velocity.X += antiStickyFloat; + if (projectile.position.Y < proj.position.Y) + projectile.velocity.Y -= antiStickyFloat; + else + projectile.velocity.Y += antiStickyFloat; + } + } + + //Set tile collision for only when trying to return to the player + projectile.tileCollide = projectile.ai[0] != 1f; + + //Find an enemy + Vector2 targetPos = projectile.position; + float maxRange = 900f; + bool foundEnemy = false; + int targetIndex = -1; + //If the player has targetted an enemy, choose that one + NPC target = projectile.OwnerMinionAttackTargetNPC; + if (target != null && target.CanBeChasedBy(projectile, false)) + { + float targetDist = Vector2.Distance(target.Center, projectile.Center); + if (!foundEnemy && targetDist < maxRange && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, target.position, target.width, target.height)) + { + maxRange = targetDist; + targetPos = target.Center; + foundEnemy = true; + targetIndex = target.whoAmI; + } + } + //else, search through all available NPCs + if (!foundEnemy) + { + for (int index = 0; index < Main.maxNPCs; ++index) + { + NPC npc = Main.npc[index]; + if (npc.CanBeChasedBy(projectile, false)) + { + float targetDist = Vector2.Distance(npc.Center, projectile.Center); + if (!foundEnemy && targetDist < maxRange && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + { + maxRange = targetDist; + targetPos = npc.Center; + foundEnemy = true; + targetIndex = index; + } + } + } + } + + //If the minion is too far away, return to the player. Max distance increases while attacking + float maxDistanceFromPlayer = 1300f; + if (foundEnemy) + maxDistanceFromPlayer = 1600f; + if (Vector2.Distance(player.Center, projectile.Center) > maxDistanceFromPlayer && projectile.ai[0] != 1f) + { + projectile.ai[0] = 1f; + projectile.netUpdate = true; + } + + //Move toward an enemy if one has been found + if (foundEnemy && projectile.ai[0] == 0f) + { + Vector2 homeInVector = targetPos - projectile.Center; + float targetDist = homeInVector.Length(); + homeInVector.Normalize(); + if (targetDist > 200f) + { + float velocity = 6f; + projectile.velocity = (projectile.velocity * 40f + homeInVector * velocity) / 41f; + } + else + { + if (targetDist < 150f) + { + float velocity = -4f; + projectile.velocity = (projectile.velocity * 40f + homeInVector * velocity) / 41f; + } + else + projectile.velocity *= 0.97f; + } + } + else + { + //Return to the player if you can't see the player + if (!Collision.CanHitLine(projectile.Center, 1, 1, player.Center, 1, 1)) + projectile.ai[0] = 1f; + + //Set speed to home in on the player. If returning to the player, go faster + float speed = 9f; + if (projectile.ai[0] == 1f) + speed = 22f; + + //Find the player and align accordingly. Get in a line if there's more than one. + Vector2 playerPos = player.Center - projectile.Center; + projectile.netUpdate = true; + int minionPosition = 1; + for (int index = 0; index < projectile.whoAmI; ++index) + { + Projectile proj = Main.projectile[index]; + if (proj.active && proj.owner == projectile.owner && proj.type == projectile.type) + ++minionPosition; + } + playerPos.X -= 10f * player.direction; + playerPos.X -= minionPosition * 40f * player.direction; + playerPos.Y -= 10f; + + //Calculate player distance + float playerDist = playerPos.Length(); + //If too far, increase speed + if (playerDist > 200f && speed < 15f) + speed = 15f; + //If you were trying to chase the player but are close enough now, return to normal + if (playerDist < 100f && projectile.ai[0] == 1f && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + projectile.ai[0] = 0f; + projectile.netUpdate = true; + } + //Teleport to the player if really, really far + if (playerDist > 2000f) + { + projectile.position.X = player.Center.X - projectile.width / 2f; + projectile.position.Y = player.Center.Y - projectile.width / 2f; + projectile.netUpdate = true; + } + //Home in on the player + if (playerDist > 10f) + { + playerPos.Normalize(); + if (playerDist < 50f) + speed /= 2f; + projectile.velocity = (projectile.velocity * 20f + playerPos * speed) / 21f; + } + else + { + projectile.direction = player.direction; + projectile.velocity *= 0.9f; + } + } + + //Rotation + projectile.rotation = projectile.velocity.X * 0.05f; + + //Cycle through animation + projectile.frameCounter++; + if (projectile.frameCounter >= 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= Main.projFrames[projectile.type]) + { + projectile.frame = 0; + } + + //Occasionally spawn fiery dust + if (Main.rand.NextBool(6)) + { + int fire = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, DustID.Fire, 0f, 0f, 100, new Color(), 2f); + Main.dust[fire].velocity *= 0.3f; + Main.dust[fire].noGravity = true; + Main.dust[fire].noLight = true; + } + + //Set projectile direction based on its movement + if (projectile.velocity.X > 0f) + projectile.spriteDirection = projectile.direction = -1; + else if (projectile.velocity.X < 0f) + projectile.spriteDirection = projectile.direction = 1; + + //Increment firing cooldown + if (projectile.ai[1] > 0f) + { + projectile.ai[1] += Main.rand.Next(1,4); + if (Main.rand.NextBool(3)) + ++projectile.ai[1]; + } + //Determine if it should shoot + if (projectile.ai[1] > 90f) + { + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + + //Return if trying to return to the player or no enemy has been found + if (projectile.ai[0] != 0f || !foundEnemy) + return; + + //Set projectile direction based on target location + Vector2 targetVec = targetPos - projectile.Center; + if (targetVec.X > 0f) + projectile.spriteDirection = projectile.direction = -1; + else if (targetVec.X < 0f) + projectile.spriteDirection = projectile.direction = 1; + + //Return if firing cooldown isn't perfect + if (projectile.ai[1] != 0f) + return; + ++projectile.ai[1]; + if (Main.myPlayer != projectile.owner) + return; + + //Fire projectile + float speedMult = 16f; + targetVec.Normalize(); + targetVec *= speedMult; + int spike = Projectile.NewProjectile(projectile.Center, targetVec, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[spike].netUpdate = true; + projectile.netUpdate = true; + } + + public override bool OnTileCollide(Vector2 oldVelocity) => false; + + public override bool CanDamage() => false; + } +} diff --git a/Projectiles/Summon/CausticStaffSummon.png b/Projectiles/Summon/CausticStaffSummon.png new file mode 100644 index 0000000000..43773977b1 Binary files /dev/null and b/Projectiles/Summon/CausticStaffSummon.png differ diff --git a/Projectiles/Summon/GiantIbanRobotOfDoom.cs b/Projectiles/Summon/GiantIbanRobotOfDoom.cs new file mode 100644 index 0000000000..024a04af96 --- /dev/null +++ b/Projectiles/Summon/GiantIbanRobotOfDoom.cs @@ -0,0 +1,487 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Buffs.Mounts; +using CalamityMod.Items; +using CalamityMod.Projectiles.Summon.AndromedaUI; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.GameContent.Events; +using Terraria.ID; +using Terraria.ModLoader; +using System; +using System.Collections.Generic; +using CalamityMod.Buffs.Cooldowns; + +namespace CalamityMod.Projectiles.Summon +{ + public class AndromedaHead : EquipTexture + { + public override bool DrawHead() => false; + } + public class GiantIbanRobotOfDoom : ModProjectile + { + public int FrameX = 0; + public int FrameY = 0; + public int CurrentFrame + { + get => FrameY + FrameX * 7; + set + { + FrameX = value / 7; + FrameY = value % 7; + } + } + public bool LeftBracketActive = false; + public bool RightBracketActive = true; // This is supposed to be the default bracket, according to Iban. Ask him before changing this. + public bool BottomBracketActive = false; + public bool RightIconActive => RightBracketActive || BottomBracketActive; + + public bool LeftIconActive = false; + public bool TopIconActive = false; + + public int RightIconCooldown = 0; + public const int RightIconAttackTime = 480; // 8 second wait + public const int RightIconCooldownMax = RightIconAttackTime * 2; // 16 second wait. + public const float RightIconLungeSpeed = 28f; + + /// + /// This cooldown is set in + /// + public int LaserCooldown = 0; + public static Vector2 LightningShootOffset; + public const int SpecialLightningBaseDamage = 5600; + public const int RegicideBaseDamageSmall = 12650; + public const int RegicideBaseDamageLarge = 17800; + public const int LaserBaseDamage = 21000; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Andromeda"); + ProjectileID.Sets.NeedsUUID[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 152; + projectile.height = 212; + projectile.netImportant = true; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.timeLeft = 18000; + projectile.timeLeft *= 5; + projectile.tileCollide = false; + projectile.alpha = 255; + projectile.Calamity().rogue = true; + projectile.usesIDStaticNPCImmunity = true; + projectile.idStaticNPCHitCooldown = 11; + } + public override void AI() + { + Player player = Main.player[projectile.owner]; + InitializeValues(player); + HandleCooldowns(player); + ManipulatePlayerValues(player); + RegisterRightClick(player); + SetFrames(player); + SetSpriteDirection(player); + player.AddBuff(LeftIconActive ? ModContent.BuffType() : ModContent.BuffType(), 2); + } + public void InitializeValues(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 trueDamage = (int)(projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue * + player.MinionDamage()); + projectile.damage = trueDamage; + } + } + public void HandleCooldowns(Player player) + { + if (RightIconCooldown > 0 && RightIconActive) + { + RightIconCooldown--; // The shooting of the lightning is done in the SetFrames method. + } + if (LaserCooldown > 0) + { + LaserCooldown--; + LaserBeam(player); + } + } + public void ManipulatePlayerValues(Player player) + { + if (!player.active || player.dead) + { + player.Calamity().andromedaState = AndromedaPlayerState.Inactive; + projectile.Kill(); + return; + } + projectile.Center = player.Center + Vector2.UnitY * (6f + player.gfxOffY); + player.Calamity().andromedaState = LeftIconActive ? AndromedaPlayerState.SmallRobot : AndromedaPlayerState.LargeRobot; + player.channel = false; + if (RightIconCooldown > RightIconAttackTime) + { + player.Calamity().andromedaState = AndromedaPlayerState.SpecialAttack; + + for (int i = 0; i < 4; i++) + { + Vector2 spinningPoint = new Vector2(0f, -28f).RotatedBy(RightIconCooldown / 60f * MathHelper.TwoPi) + .RotatedBy(projectile.velocity.ToRotation()) + .RotatedBy(MathHelper.Lerp(MathHelper.ToRadians(-40f), MathHelper.ToRadians(40f), i / 4f)); + + Vector2 center = player.Center + new Vector2(6f, -2f).RotatedBy(player.velocity.ToRotation()); + + int idx = Dust.NewDust(center, 0, 0, 226, 0f, 0f, 100, default, 0.5f); + Main.dust[idx].noGravity = true; + Main.dust[idx].position = center + spinningPoint; + Main.dust[idx].velocity = Vector2.Zero; + spinningPoint *= -1f; + + idx = Dust.NewDust(center, 0, 0, 226, 0f, 0f, 100, default, 0.5f); + Main.dust[idx].noGravity = true; + Main.dust[idx].position = center + spinningPoint; + Main.dust[idx].velocity = Vector2.Zero; + } + // Exit the charge mode early. + if ((player.velocity.X == 0f || player.velocity.Y == 0f) && RightIconCooldown < RightIconCooldownMax - 30f) + { + ExitChargeModeEarly(player); + } + player.velocity = Vector2.Lerp(player.velocity, projectile.DirectionTo(Main.MouseWorld) * RightIconLungeSpeed, 0.225f); + projectile.rotation = player.velocity.ToRotation() + MathHelper.PiOver2; + } + else projectile.rotation = 0f; + if (player.mount != null) // Kill any mounts + { + player.mount.Dismount(player); + } + } + public void RegisterRightClick(Player player) + { + if (Main.mouseRight && projectile.ai[0] <= 0f) + { + projectile.ai[0] = 30f; + // Exit the charge mode early. + if (RightIconCooldown > RightIconAttackTime) + { + ExitChargeModeEarly(player); + return; + } + // If the player has any existing UIs, kill them all. + if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) + { + for (int i = 0; i < Main.projectile.Length; i++) + { + if (Main.projectile[i].active && + Main.projectile[i].type == ModContent.ProjectileType() && + Main.projectile[i].owner == player.whoAmI) + { + Main.projectile[i].Kill(); + } + } + } + // Otherwise, create one. + else + { + if (Main.myPlayer == player.whoAmI) + { + Projectile ui = Projectile.NewProjectileDirect(Main.MouseWorld, + Vector2.Zero, + ModContent.ProjectileType(), + 0, + 0f, + player.whoAmI); + ui.localAI[0] = Projectile.GetByUUID(projectile.owner, projectile.whoAmI); + ui.netUpdate = true; + } + } + } + else if (projectile.ai[0] > 0f) + { + projectile.ai[0]--; + } + } + public void SetFrames(Player player) + { + projectile.frameCounter++; + if (RightIconCooldown <= RightIconAttackTime) + { + if (Math.Abs(player.velocity.Y) != 0f) + { + SetFlyingFrames(player); + } + else if (Math.Abs(player.velocity.X) > 3f) + { + SetWalkingFrames(); + } + if (player.velocity == Vector2.Zero) + { + CurrentFrame = 0; + } + } + } + public void SetFlyingFrames(Player player) + { + // Falling + if (player.velocity.Y > 0f) + { + CurrentFrame = 1; + return; + } + // Quickly go to flying frames + if (CurrentFrame == 0) + { + if (projectile.frameCounter >= 4) + { + CurrentFrame++; + projectile.frameCounter = 0; + } + } + // Flying frames + else if (projectile.frameCounter % 4 == 3) + { + CurrentFrame++; + if (CurrentFrame >= 6) + CurrentFrame = 2; + } + + // Dust effect + + Vector2 dustOffset = new Vector2(94f, 58f); + if (projectile.spriteDirection == -1) + { + dustOffset.X = 214 - dustOffset.X; + } + if (!Main.dedServ && player.Calamity().andromedaState == AndromedaPlayerState.LargeRobot) + { + for (int i = 0; i < 2; i++) + { + Dust dust = Dust.NewDustPerfect(projectile.position + dustOffset, 263); + dust.velocity = Vector2.Normalize(dust.position - projectile.Top).RotatedByRandom(0.4f) * Main.rand.NextFloat(4f, 7f) + projectile.velocity; + dust.color = Color.SkyBlue; + dust.scale = Main.rand.NextFloat(0.9f, 1.35f); + dust.noGravity = true; + } + } + + // Clamp frames + if (CurrentFrame >= 6) + CurrentFrame = 0; + } + public void SetWalkingFrames() + { + Player player = Main.player[projectile.owner]; + int walkInterval = (int)MathHelper.Clamp(8 - Math.Abs(player.velocity.X) / 3.5f, 1, 8); + if (player.velocity.X == 0f) + { + CurrentFrame = 0; + } + else if (projectile.frameCounter >= walkInterval) + { + projectile.frameCounter = 0; + CurrentFrame++; + if (CurrentFrame >= 13) + { + CurrentFrame = 6; + } + } + // Clamp frames + if (CurrentFrame >= 14 || CurrentFrame <= 6) + CurrentFrame = 6; + } + public void SetSpriteDirection(Player player) + { + if (RightIconCooldown > RightIconAttackTime) + { + projectile.spriteDirection = (Math.Cos(projectile.rotation) > 0).ToDirectionInt(); + return; + } + if (player.velocity.X != 0) // So that the original sprite direction is maintained when there is no X movement. + { + projectile.spriteDirection = (player.velocity.X > 0).ToDirectionInt(); + } + int slashIndex = -1; + + for (int i = 0; i < Main.projectile.Length; i++) + { + if (Main.projectile[i].active && + Main.projectile[i].type == ModContent.ProjectileType() && + Main.projectile[i].owner == projectile.owner) + { + slashIndex = i; + break; + } + } + + if (slashIndex != -1) + { + if (Main.projectile[slashIndex].frameCounter > 0) // To ensure that the starting variables of the blade have been initialized + { + projectile.spriteDirection = (Math.Cos(Main.projectile[slashIndex].rotation) > 0).ToDirectionInt(); // ai[1] is the blade's starting rotation + } + } + + int laserBeamIndex = -1; + + for (int i = 0; i < Main.projectile.Length; i++) + { + if (Main.projectile[i].active && + Main.projectile[i].type == ModContent.ProjectileType() && + Main.projectile[i].owner == projectile.owner) + { + laserBeamIndex = i; + break; + } + } + + if (laserBeamIndex != -1) + { + projectile.spriteDirection = (Math.Cos(Main.projectile[laserBeamIndex].velocity.ToRotation()) > 0).ToDirectionInt(); // ai[1] is the blade's starting rotation + } + } + public void LaserBeam(Player player) + { + if (LaserCooldown % (AndromedaDeathRay.TrueTimeLeft - 10) == (AndromedaDeathRay.TrueTimeLeft - 11)) + { + if (projectile.owner == Main.myPlayer) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LargeMechGaussRifle"), projectile.Center); + int damage = LaserBaseDamage; + if (player.HeldItem != null) + { + if (player.HeldItem.magic) + { + damage = (int)(damage * player.MagicDamage()); + } + else if (player.HeldItem.melee) + { + damage = (int)(damage * player.MeleeDamage()); + } + else if (player.HeldItem.ranged) + { + damage = (int)(damage * player.RangedDamage()); + } + else if (player.HeldItem.summon) + { + damage = (int)(damage * player.MinionDamage()); + } + else if (player.HeldItem.Calamity().rogue) + { + damage = (int)(damage * player.RogueDamage()); + } + else + { + damage = (int)(damage * player.AverageDamage()); + } + } + Vector2 laserVelocity = (Main.MouseWorld - (Main.player[projectile.owner].Center + new Vector2(projectile.spriteDirection == 1 ? 48f : 22f, -28f))).SafeNormalize(Vector2.UnitX * projectile.spriteDirection); + Projectile deathLaser = Projectile.NewProjectileDirect(projectile.Center, + laserVelocity, + ModContent.ProjectileType(), + damage, + 8f, + projectile.owner, + projectile.whoAmI); + if (player.HeldItem != null) + { + if (player.HeldItem.magic) + { + deathLaser.Calamity().forceMagic = true; + } + else if (player.HeldItem.melee) + { + deathLaser.Calamity().forceMelee = true; + } + else if (player.HeldItem.ranged) + { + deathLaser.Calamity().forceRanged = true; + } + else if (player.HeldItem.summon) + { + deathLaser.Calamity().forceMinion = true; + } + else if (player.HeldItem.Calamity().rogue) + { + deathLaser.Calamity().forceRogue = true; + } + else + { + deathLaser.Calamity().forceTypeless = true; + } + } + } + } + } + public void ExitChargeModeEarly(Player player) + { + RightIconCooldown = RightIconAttackTime; + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LargeMechGaussRifle"), projectile.Center); + SpecialAttackExplosionDust(player); + } + public void SpecialAttackExplosionDust(Player player) + { + if (!Main.dedServ) + { + // Petal + for (int angleInterval = 0; angleInterval < 10; angleInterval++) + { + for (int outwardness = 190; outwardness < 360; outwardness += 8) + { + for (int speedSign = -1; speedSign <= 1; speedSign += 2) + { + float angle = MathHelper.Lerp(0f, MathHelper.TwoPi / 10f, (outwardness - 190f) / 170f); + Dust dust = Dust.NewDustPerfect(projectile.Center, 221); + dust.noGravity = true; + dust.scale = 1.6f; + dust.position = player.Center + outwardness * (MathHelper.TwoPi / 10f * angleInterval).ToRotationVector2().RotatedBy(angle); + dust.velocity = player.DirectionTo(dust.position) * 8f * speedSign; + + dust = Dust.NewDustPerfect(projectile.Center, 221); + dust.noGravity = true; + dust.scale = 1.6f; + dust.position = player.Center + outwardness * (MathHelper.TwoPi / 10f * angleInterval).ToRotationVector2().RotatedBy(-angle); + dust.velocity = player.DirectionTo(dust.position) * 8f * speedSign; + } + } + } + // Star + int pointsOnStar = 6; + for (int k = 0; k < 2; k++) + { + for (int i = 0; i < pointsOnStar; i++) + { + float angle = MathHelper.Pi * 1.5f - i * MathHelper.TwoPi / pointsOnStar; + float nextAngle = MathHelper.Pi * 1.5f - ((i + 3) % pointsOnStar) * MathHelper.TwoPi / pointsOnStar; + if (k == 1) + nextAngle = MathHelper.Pi * 1.5f - (i + 2) * MathHelper.TwoPi / pointsOnStar; + Vector2 start = angle.ToRotationVector2(); + Vector2 end = nextAngle.ToRotationVector2(); + int pointsOnStarSegment = 24; + for (int j = 0; j < pointsOnStarSegment; j++) + { + Dust dust = Dust.NewDustPerfect(player.Center, 221); + dust.noGravity = true; + dust.scale = 1.9f; + dust.velocity = Vector2.Lerp(start, end, j / (float)pointsOnStarSegment) * 13f * new Vector2(1.414f, 1f); + } + } + } + } + } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => false; // Drawing is done completely by the player. + public override bool OnTileCollide(Vector2 oldVelocity) => false; + public override bool CanDamage() => false; + public override void Kill(int timeLeft) + { + Player player = Main.player[projectile.owner]; + player.width = 20; + player.height = 42; + } + } +} diff --git a/Projectiles/Summon/GiantIbanRobotOfDoom.png b/Projectiles/Summon/GiantIbanRobotOfDoom.png new file mode 100644 index 0000000000..a8d08b1be8 Binary files /dev/null and b/Projectiles/Summon/GiantIbanRobotOfDoom.png differ diff --git a/Projectiles/Summon/HowlsHeartCalcifer.cs b/Projectiles/Summon/HowlsHeartCalcifer.cs new file mode 100644 index 0000000000..f45b5650b8 --- /dev/null +++ b/Projectiles/Summon/HowlsHeartCalcifer.cs @@ -0,0 +1,67 @@ +using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Summon +{ + public class HowlsHeartCalcifer : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Calcifer"); + Main.projFrames[projectile.type] = 4; + Main.projPet[projectile.type] = true; + ProjectileID.Sets.LightPet[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.netImportant = true; + projectile.width = 30; + projectile.height = 30; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.timeLeft *= 5; + } + + public override void AI() + { + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + bool correctMinion = projectile.type == ModContent.ProjectileType(); + if (!modPlayer.howlsHeart || !player.active) + { + projectile.active = false; + return; + } + if (correctMinion) + { + if (player.dead) + { + modPlayer.howlTrio = false; + } + if (modPlayer.howlTrio) + { + projectile.timeLeft = 2; + } + } + Lighting.AddLight(projectile.Center, 0.75f, 0.485f, 0f); + CalamityGlobalProjectile.FloatingPetAI(projectile, false, 0.04f, true); + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= Main.projFrames[projectile.type]) + { + projectile.frame = 0; + } + } + + public override bool CanDamage() => false; + } +} diff --git a/Projectiles/Summon/HowlsHeartCalcifer.png b/Projectiles/Summon/HowlsHeartCalcifer.png new file mode 100644 index 0000000000..917f8a5f4e Binary files /dev/null and b/Projectiles/Summon/HowlsHeartCalcifer.png differ diff --git a/Projectiles/Summon/HowlsHeartFireball.cs b/Projectiles/Summon/HowlsHeartFireball.cs new file mode 100644 index 0000000000..bc1acf984e --- /dev/null +++ b/Projectiles/Summon/HowlsHeartFireball.cs @@ -0,0 +1,121 @@ +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class HowlsHeartFireball : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fireball"); + Main.projFrames[projectile.type] = 4; + ProjectileID.Sets.MinionShot[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 20; + projectile.friendly = true; + projectile.netImportant = true; + projectile.penetrate = 1; + projectile.timeLeft = 180; + projectile.minion = true; + projectile.minionSlots = 0f; + } + + public override void AI() + { + Player player = Main.player[projectile.owner]; + + //Cycle through animation + projectile.frameCounter++; + if (projectile.frameCounter >= 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= Main.projFrames[projectile.type]) + { + projectile.frame = 0; + } + + Vector2 center = projectile.Center; + float maxDistance = 500f; + bool homeIn = false; + + if (player.HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) + { + float extraDistance = (npc.width / 2) + (npc.height / 2); + + bool canHit = true; + if (extraDistance < maxDistance) + canHit = Collision.CanHit(projectile.Center, 1, 1, npc.Center, 1, 1); + + if (Vector2.Distance(npc.Center, projectile.Center) < (maxDistance + extraDistance) && canHit) + { + center = npc.Center; + homeIn = true; + } + } + } + else + { + for (int i = 0; i < Main.maxNPCs; i++) + { + NPC npc = Main.npc[i]; + if (npc.CanBeChasedBy(projectile, false)) + { + float extraDistance = (npc.width / 2) + (npc.height / 2); + + bool canHit = true; + if (extraDistance < maxDistance) + canHit = Collision.CanHit(projectile.Center, 1, 1, npc.Center, 1, 1); + + if (Vector2.Distance(npc.Center, projectile.Center) < (maxDistance + extraDistance) && canHit) + { + center = npc.Center; + homeIn = true; + break; + } + } + } + } + + if (homeIn) + { + Vector2 homeInVector = projectile.DirectionTo(center); + if (homeInVector.HasNaNs()) + homeInVector = Vector2.UnitY; + + projectile.velocity = (projectile.velocity * 20f + homeInVector * 21f) / (21f); + } + + int blueT = Dust.NewDust(projectile.position, projectile.width, projectile.height, 59, 0f, 0f, 100, default, 0.6f); + Main.dust[blueT].noGravity = true; + Main.dust[blueT].velocity *= 0.5f; + Main.dust[blueT].velocity += projectile.velocity * 0.1f; + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(SoundID.Item45, projectile.position); + int blue = Dust.NewDust(projectile.position, projectile.width, projectile.height, 59, 0f, 0f, 100, default, 1f); + Main.dust[blue].velocity *= 0.5f; + if (Main.rand.NextBool(2)) + { + Main.dust[blue].scale = 0.5f; + Main.dust[blue].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + int torch = Dust.NewDust(projectile.position, projectile.width, projectile.height, 59, 0f, 0f, 100, default, 1.4f); + Main.dust[torch].noGravity = true; + Dust.NewDust(projectile.position, projectile.width, projectile.height, 59, 0f, 0f, 100, default, 0.8f); + } + } +} diff --git a/Projectiles/Summon/HowlsHeartFireball.png b/Projectiles/Summon/HowlsHeartFireball.png new file mode 100644 index 0000000000..9bfd24d1cb Binary files /dev/null and b/Projectiles/Summon/HowlsHeartFireball.png differ diff --git a/Projectiles/Summon/HowlsHeartHowl.cs b/Projectiles/Summon/HowlsHeartHowl.cs new file mode 100644 index 0000000000..1c063c2e31 --- /dev/null +++ b/Projectiles/Summon/HowlsHeartHowl.cs @@ -0,0 +1,302 @@ +using CalamityMod.Buffs.Summon; +using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Summon +{ + public class HowlsHeartHowl : ModProjectile + { + public bool initialized = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Howl"); + Main.projFrames[projectile.type] = 5; + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 72; + projectile.height = 54; + projectile.netImportant = true; + projectile.friendly = true; + projectile.minionSlots = 1f; + 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]; + CalamityPlayer modPlayer = player.Calamity(); + + //Spawn dust and record initial damage values + if (!initialized) + { + projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + int dustAmt = 36; + for (int dustIndex = 0; dustIndex < dustAmt; dustIndex++) + { + Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(dustIndex - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + projectile.Center; + Vector2 vector7 = vector6 - projectile.Center; + int dusty = Dust.NewDust(vector6 + vector7, 0, 0, 191, vector7.X * 1f, vector7.Y * 1f, 100, default, 1.1f); + Main.dust[dusty].noGravity = true; + Main.dust[dusty].noLight = true; + Main.dust[dusty].velocity = vector7; + } + initialized = true; + } + + //if minion damage changes, update it + if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue * + player.MinionDamage()); + projectile.damage = damage2; + } + + //If the correct minion, set bools + bool correctMinion = projectile.type == ModContent.ProjectileType(); + if (!modPlayer.howlsHeart || !player.active) + { + projectile.active = false; + return; + } + if (correctMinion) + { + if (player.dead) + { + modPlayer.howlTrio = false; + } + if (modPlayer.howlTrio) + { + projectile.timeLeft = 2; + } + } + + //Anti sticky movement although there should only be one + float antiStickyFloat = 0.05f; + for (int index = 0; index < Main.maxProjectiles; ++index) + { + Projectile proj = Main.projectile[index]; + if (index != projectile.whoAmI && proj.active && (proj.owner == projectile.owner && proj.type == projectile.type) && (double)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 -= antiStickyFloat; + else + projectile.velocity.X += antiStickyFloat; + if (projectile.position.Y < proj.position.Y) + projectile.velocity.Y -= antiStickyFloat; + else + projectile.velocity.Y += antiStickyFloat; + } + } + + //Set tile collision for only when trying to return to the player + projectile.tileCollide = projectile.ai[0] != 1f; + + //Find an enemy + Vector2 targetPos = projectile.position; + float maxRange = 900f; + bool foundEnemy = false; + //If the player has targetted an enemy, choose that one + NPC target = projectile.OwnerMinionAttackTargetNPC; + if (target != null && target.CanBeChasedBy(projectile, false)) + { + float targetDist = Vector2.Distance(target.Center, projectile.Center); + if (!foundEnemy && targetDist < maxRange && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, target.position, target.width, target.height)) + { + maxRange = targetDist; + targetPos = target.Center; + foundEnemy = true; + } + } + //else, search through all available NPCs + if (!foundEnemy) + { + for (int index = 0; index < Main.maxNPCs; ++index) + { + NPC npc = Main.npc[index]; + if (npc.CanBeChasedBy(projectile, false)) + { + float targetDist = Vector2.Distance(npc.Center, projectile.Center); + if (!foundEnemy && targetDist < maxRange && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + { + maxRange = targetDist; + targetPos = npc.Center; + foundEnemy = true; + } + } + } + } + + //If the minion is too far away, return to the player. Max distance increases while attacking + float maxDistanceFromPlayer = 1300f; + if (foundEnemy) + maxDistanceFromPlayer = 1600f; + if (Vector2.Distance(player.Center, projectile.Center) > maxDistanceFromPlayer && projectile.ai[0] != 1f) + { + projectile.ai[0] = 1f; + projectile.netUpdate = true; + } + + //Move toward an enemy if one has been found + if (foundEnemy && projectile.ai[0] == 0f) + { + Vector2 homeInVector = targetPos - projectile.Center; + float targetDist = homeInVector.Length(); + homeInVector.Normalize(); + if (targetDist > 200f) + { + float velocity = 6f; + projectile.velocity = (projectile.velocity * 40f + homeInVector * velocity) / 41f; + } + else + { + if (targetDist < 150f) + { + float velocity = -4f; + projectile.velocity = (projectile.velocity * 40f + homeInVector * velocity) / 41f; + } + else + projectile.velocity *= 0.97f; + } + } + else + { + //Return to the player if you can't see the player + if (!Collision.CanHitLine(projectile.Center, 1, 1, player.Center, 1, 1)) + projectile.ai[0] = 1f; + + //Set speed to home in on the player. If returning to the player, go faster + float speed = 9f; + if (projectile.ai[0] == 1f) + speed = 22f; + + //Find the player and align accordingly. Get in a line if there's more than one. + Vector2 playerPos = player.Center - projectile.Center; + projectile.netUpdate = true; + int minionPosition = 1; + for (int index = 0; index < projectile.whoAmI; ++index) + { + Projectile proj = Main.projectile[index]; + if (proj.active && proj.owner == projectile.owner && proj.type == projectile.type) + ++minionPosition; + } + playerPos.X -= 10f * player.direction; + playerPos.X -= minionPosition * 60f * player.direction; + playerPos.Y -= 10f; + + //Calculate player distance + float playerDist = playerPos.Length(); + //If too far, increase speed + if (playerDist > 200f && speed < 15f) + speed = 15f; + //If you were trying to chase the player but are close enough now, return to normal + if (playerDist < 100f && projectile.ai[0] == 1f && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + projectile.ai[0] = 0f; + projectile.netUpdate = true; + } + //Teleport to the player if really, really far + if (playerDist > 2000f) + { + projectile.position.X = player.Center.X - projectile.width / 2f; + projectile.position.Y = player.Center.Y - projectile.width / 2f; + projectile.netUpdate = true; + } + //Home in on the player + if (playerDist > 10f) + { + playerPos.Normalize(); + if (playerDist < 50f) + speed /= 2f; + projectile.velocity = (projectile.velocity * 20f + playerPos * speed) / 21f; + } + else + { + projectile.direction = -player.direction; + projectile.velocity *= 0.9f; + } + } + + //Rotation + projectile.rotation = projectile.velocity.X * 0.05f; + + //Cycle through animation + projectile.frameCounter++; + if (projectile.frameCounter >= 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= Main.projFrames[projectile.type]) + { + projectile.frame = 0; + } + + //Set projectile direction based on its movement + if (projectile.velocity.X > 0f) + projectile.spriteDirection = projectile.direction = -1; + else if (projectile.velocity.X < 0f) + projectile.spriteDirection = projectile.direction = 1; + + //Increment firing cooldown + if (projectile.ai[1] > 0f) + { + projectile.ai[1] += Main.rand.Next(1,4); + if (Main.rand.NextBool(3)) + ++projectile.ai[1]; + } + //Determine if it should shoot + if (projectile.ai[1] > 90f) + { + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + + //Return if trying to return to the player or no enemy has been found + if (projectile.ai[0] != 0f || !foundEnemy) + return; + + //Set projectile direction based on target location + Vector2 targetVec = targetPos - projectile.Center; + if (targetVec.X > 0f) + projectile.spriteDirection = projectile.direction = -1; + else if (targetVec.X < 0f) + projectile.spriteDirection = projectile.direction = 1; + + //Return if firing cooldown isn't perfect + if (projectile.ai[1] != 0f) + return; + ++projectile.ai[1]; + if (Main.myPlayer != projectile.owner) + return; + + //Fire projectile + float speedMult = 16f; + targetVec.Normalize(); + targetVec *= speedMult; + Main.PlaySound(SoundID.Item20, projectile.position); + int fireball = Projectile.NewProjectile(projectile.Center, targetVec, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[fireball].netUpdate = true; + Main.projectile[fireball].frame = Main.rand.Next(4); + projectile.netUpdate = true; + } + + public override bool OnTileCollide(Vector2 oldVelocity) => false; + + public override bool CanDamage() => false; + } +} diff --git a/Projectiles/Summon/HowlsHeartHowl.png b/Projectiles/Summon/HowlsHeartHowl.png new file mode 100644 index 0000000000..42306d7ab9 Binary files /dev/null and b/Projectiles/Summon/HowlsHeartHowl.png differ diff --git a/Projectiles/Summon/HowlsHeartTurnipHead.cs b/Projectiles/Summon/HowlsHeartTurnipHead.cs new file mode 100644 index 0000000000..9db6de050a --- /dev/null +++ b/Projectiles/Summon/HowlsHeartTurnipHead.cs @@ -0,0 +1,163 @@ +using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Summon +{ + public class HowlsHeartTurnipHead : ModProjectile + { + private bool fly = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Turnip-Head"); + Main.projFrames[projectile.type] = 5; + Main.projPet[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.netImportant = true; + projectile.width = 70; + projectile.height = 82; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.timeLeft *= 5; + projectile.tileCollide = true; + } + + public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough) + { + Player player = Main.player[projectile.owner]; + Vector2 center2 = projectile.Center; + Vector2 vector48 = player.Center - center2; + float playerDistance = vector48.Length(); + fallThrough = playerDistance > 200f; + return true; + } + + public override void AI() + { + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + + //If the correct minion, set bools + bool correctMinion = projectile.type == ModContent.ProjectileType(); + if (!modPlayer.howlsHeart || !player.active) + { + projectile.active = false; + return; + } + if (correctMinion) + { + if (player.dead) + { + modPlayer.howlTrio = false; + } + if (modPlayer.howlTrio) + { + projectile.timeLeft = 2; + } + } + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= Main.projFrames[projectile.type]) + { + projectile.frame = 0; + } + Vector2 vector46 = projectile.position; + if (!fly) + { + projectile.rotation = 0; + Vector2 playerVec = player.Center - projectile.Center; + float playerDistance = playerVec.Length(); + if (projectile.velocity.Y == 0f) + { + projectile.velocity.Y = -3f; + } + projectile.velocity.Y += 0.2f; + if (projectile.velocity.Y > 7f) + { + projectile.velocity.Y = 7f; + } + if (playerDistance > 600f) + { + fly = true; + projectile.velocity.X = 0f; + } + if (playerDistance > 100f) + { + if (player.position.X - projectile.position.X > 0f) + { + projectile.velocity.X += 0.10f; + if (projectile.velocity.X > 7f) + { + projectile.velocity.X = 7f; + } + } + else + { + projectile.velocity.X -= 0.10f; + if (projectile.velocity.X < -7f) + { + projectile.velocity.X = -7f; + } + } + } + if (playerDistance < 100f) + { + if (projectile.velocity.X != 0f) + { + if (projectile.velocity.X > 0.5f) + { + projectile.velocity.X -= 0.15f; + } + else if (projectile.velocity.X < -0.5f) + { + projectile.velocity.X += 0.15f; + } + else if (projectile.velocity.X < 0.5f && projectile.velocity.X > -0.5f) + { + projectile.velocity.X = 0f; + } + } + } + } + else if (fly) + { + //still hopping + if (projectile.velocity.Y == 0f) + { + projectile.velocity.Y = -3f; + } + projectile.velocity.Y += 0.2f; + if (projectile.velocity.Y > 7f) + { + projectile.velocity.Y = 7f; + } + projectile.alpha += 15; + if (projectile.alpha >= 255) + { + projectile.position.X = player.position.X; + projectile.position.Y = player.position.Y - 5f; + fly = false; + projectile.alpha = 0; + } + } + if (projectile.velocity.X > 0.25f) + { + projectile.spriteDirection = -1; + } + else if (projectile.velocity.X < -0.25f) + { + projectile.spriteDirection = 1; + } + } + + public override bool CanDamage() => false; + } +} diff --git a/Projectiles/Summon/HowlsHeartTurnipHead.png b/Projectiles/Summon/HowlsHeartTurnipHead.png new file mode 100644 index 0000000000..7ea589fd91 Binary files /dev/null and b/Projectiles/Summon/HowlsHeartTurnipHead.png differ diff --git a/Projectiles/Summon/PlagueBeeSmall.cs b/Projectiles/Summon/PlagueBeeSmall.cs index 4142756d1b..9d8a34765e 100644 --- a/Projectiles/Summon/PlagueBeeSmall.cs +++ b/Projectiles/Summon/PlagueBeeSmall.cs @@ -30,11 +30,11 @@ namespace CalamityMod.Projectiles.Summon { if (projectile.velocity.X > 0f) { - projectile.spriteDirection = 1; + projectile.spriteDirection = projectile.direction = 1; } else if (projectile.velocity.X < 0f) { - projectile.spriteDirection = -1; + projectile.spriteDirection = projectile.direction = -1; } projectile.rotation = projectile.velocity.X * 0.05f; projectile.frameCounter++; diff --git a/Projectiles/Summon/PlaguebringerSummon.cs b/Projectiles/Summon/PlaguebringerSummon.cs new file mode 100644 index 0000000000..c064f0dbc9 --- /dev/null +++ b/Projectiles/Summon/PlaguebringerSummon.cs @@ -0,0 +1,239 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.Summon; +using CalamityMod.CalPlayer; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class PlaguebringerSummon : ModProjectile + { + public const float auraRange = 960f; + private int auraCounter = 0; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Lil' Plaguebringer"); + Main.projFrames[projectile.type] = 6; + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.netImportant = true; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.minionSlots = 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]; + CalamityPlayer modPlayer = player.Calamity(); + + if (projectile.frameCounter++ > 6f) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= 3) //dashing frames are unused + { + projectile.frame = 0; + } + + 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 damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue * + player.MinionDamage()); + projectile.damage = damage2; + } + + bool correctMinion = projectile.type == ModContent.ProjectileType(); + player.AddBuff(ModContent.BuffType(), 3600); + if (correctMinion) + { + if (player.dead) + { + modPlayer.plaguebringerPatronSummon = false; + } + if (modPlayer.plaguebringerPatronSummon) + { + projectile.timeLeft = 2; + } + } + if (!modPlayer.plaguebringerPatronSet) + projectile.Kill(); + + float SAIMovement = 0.05f; + for (int i = 0; i < Main.maxProjectiles; i++) + { + Projectile proj = Main.projectile[i]; + bool minionTypeCheck = proj.type == ModContent.ProjectileType() || Main.projPet[proj.type]; + if (i != projectile.whoAmI && proj.active && proj.owner == projectile.owner && minionTypeCheck && 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 -= SAIMovement; + } + else + { + projectile.velocity.X += SAIMovement; + } + if (projectile.position.Y < proj.position.Y) + { + projectile.velocity.Y -= SAIMovement; + } + else + { + projectile.velocity.Y += SAIMovement; + } + } + } + + int buffType = ModContent.BuffType(); + float range = auraRange; + bool dealDamage = auraCounter++ % 60 == 0; + int dmg = projectile.damage; + if (projectile.owner == Main.myPlayer) + { + for (int l = 0; l < Main.maxNPCs; l++) + { + NPC npc = Main.npc[l]; + if (npc.active && !npc.friendly && npc.damage > 0 && !npc.dontTakeDamage && !npc.buffImmune[buffType] && Vector2.Distance(projectile.Center, npc.Center) <= range) + { + if (npc.FindBuffIndex(buffType) == -1) + { + npc.AddBuff(buffType, 120, false); + } + if (dealDamage) + { + Projectile aura = Projectile.NewProjectileDirect(npc.Center, Vector2.Zero, ModContent.ProjectileType(), dmg, 0f, projectile.owner, l); + aura.Calamity().forceMinion = true; + } + } + } + } + + float passiveMvtFloat = 0.5f; + projectile.tileCollide = false; + float safeDist = 100f; + Vector2 projPos = new Vector2(projectile.Center.X, projectile.Center.Y); + float xDist = player.Center.X - projPos.X; + float yDist = player.Center.Y - projPos.Y; + yDist += Main.rand.NextFloat(-10f, 20f); + xDist += Main.rand.NextFloat(-10f, 20f); + yDist -= 70f; + Vector2 playerVector = new Vector2(xDist, yDist); + float playerDist = playerVector.Length(); + float returnSpeed = 18f; + + //If player is close enough, resume normal + if (playerDist < safeDist && player.velocity.Y == 0f && + projectile.position.Y + projectile.height <= player.position.Y + player.height && + !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + if (projectile.velocity.Y < -6f) + { + projectile.velocity.Y = -6f; + } + } + + //Teleport to player if too far + if (playerDist > 2000f) + { + projectile.position.X = player.Center.X - projectile.width / 2; + projectile.position.Y = player.Center.Y - projectile.height / 2; + projectile.netUpdate = true; + } + + if (playerDist < 50f) + { + if (Math.Abs(projectile.velocity.X) > 2f || Math.Abs(projectile.velocity.Y) > 2f) + { + projectile.velocity *= 0.99f; + } + passiveMvtFloat = 0.01f; + } + else + { + if (playerDist < 100f) + { + passiveMvtFloat = 0.1f; + } + if (playerDist > 300f) + { + passiveMvtFloat = 1f; + } + playerDist = returnSpeed / playerDist; + playerVector.X *= playerDist; + playerVector.Y *= playerDist; + } + if (projectile.velocity.X < playerVector.X) + { + projectile.velocity.X += passiveMvtFloat; + if (passiveMvtFloat > 0.05f && projectile.velocity.X < 0f) + { + projectile.velocity.X += passiveMvtFloat; + } + } + if (projectile.velocity.X > playerVector.X) + { + projectile.velocity.X -= passiveMvtFloat; + if (passiveMvtFloat > 0.05f && projectile.velocity.X > 0f) + { + projectile.velocity.X -= passiveMvtFloat; + } + } + if (projectile.velocity.Y < playerVector.Y) + { + projectile.velocity.Y += passiveMvtFloat; + if (passiveMvtFloat > 0.05f && projectile.velocity.Y < 0f) + { + projectile.velocity.Y += passiveMvtFloat * 2f; + } + } + if (projectile.velocity.Y > playerVector.Y) + { + projectile.velocity.Y -= passiveMvtFloat; + if (passiveMvtFloat > 0.05f && projectile.velocity.Y > 0f) + { + projectile.velocity.Y -= passiveMvtFloat * 2f; + } + } + if (projectile.velocity.X >= 0.25f) + { + projectile.direction = -1; + } + else if (projectile.velocity.X < -0.25f) + { + projectile.direction = 1; + } + //Tilting and change directions + projectile.spriteDirection = projectile.direction; + projectile.rotation = projectile.velocity.X * 0.01f; + } + + public override bool OnTileCollide(Vector2 oldVelocity) => false; + + public override bool CanDamage() => false; + } +} diff --git a/Projectiles/Summon/PlaguebringerSummon.png b/Projectiles/Summon/PlaguebringerSummon.png new file mode 100644 index 0000000000..cbcf0c019f Binary files /dev/null and b/Projectiles/Summon/PlaguebringerSummon.png differ diff --git a/Projectiles/Summon/SakuraBullet.cs b/Projectiles/Summon/SakuraBullet.cs index d218b4b6c3..78c2034756 100644 --- a/Projectiles/Summon/SakuraBullet.cs +++ b/Projectiles/Summon/SakuraBullet.cs @@ -33,62 +33,51 @@ namespace CalamityMod.Projectiles.Summon Player player = Main.player[projectile.owner]; projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.02f; - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 400f; - bool flag17 = false; + Vector2 center = projectile.Center; + float maxDistance = 400f; + bool homeIn = false; if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; if ((npc.CanBeChasedBy(projectile, false) || npc.type == NPCID.DukeFishron) && npc.active) { - float num476 = npc.position.X + (float)(npc.width / 2); - float num477 = npc.position.Y + (float)(npc.height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } + float extraDistance = (npc.width / 2) + (npc.height / 2); + + if (Vector2.Distance(npc.Center, projectile.Center) < (maxDistance + extraDistance)) + { + center = npc.Center; + homeIn = true; + } } - } + } else { - for (int num475 = 0; num475 < Main.maxNPCs; num475++) + for (int i = 0; i < Main.maxNPCs; i++) { - NPC npc = Main.npc[num475]; + NPC npc = Main.npc[i]; if ((npc.CanBeChasedBy(projectile, false) || npc.type == NPCID.DukeFishron) && npc.active) { - float num476 = npc.position.X + (float)(npc.width / 2); - float num477 = npc.position.Y + (float)(npc.height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) + float extraDistance = (npc.width / 2) + (npc.height / 2); + + if (Vector2.Distance(npc.Center, projectile.Center) < (maxDistance + extraDistance)) { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; + center = npc.Center; + homeIn = true; + break; } } } } - if (flag17) - { - float num483 = 11f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + if (homeIn) + { + Vector2 homeInVector = projectile.DirectionTo(center); + if (homeInVector.HasNaNs()) + homeInVector = Vector2.UnitY; + + projectile.velocity = (projectile.velocity * 20f + homeInVector * 11f) / (21f); + } int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 73, 0f, 0f, 100, default, 0.6f); Main.dust[num458].noGravity = true; diff --git a/Projectiles/Summon/SiriusMinion.cs b/Projectiles/Summon/SiriusMinion.cs index ad856cffb9..3631108e70 100644 --- a/Projectiles/Summon/SiriusMinion.cs +++ b/Projectiles/Summon/SiriusMinion.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetDefaults() { projectile.width = 38; - projectile.height = 50; + projectile.height = 48; projectile.netImportant = true; projectile.friendly = true; projectile.ignoreWater = true; diff --git a/Projectiles/Summon/SiriusMinion.png b/Projectiles/Summon/SiriusMinion.png index a2b6f1bc7d..dd846897b8 100644 Binary files a/Projectiles/Summon/SiriusMinion.png and b/Projectiles/Summon/SiriusMinion.png differ diff --git a/Projectiles/Typeless/BlunderBoosterAura.cs b/Projectiles/Typeless/BlunderBoosterAura.cs new file mode 100644 index 0000000000..b3c8b056e6 --- /dev/null +++ b/Projectiles/Typeless/BlunderBoosterAura.cs @@ -0,0 +1,162 @@ +using CalamityMod.CalPlayer; +using CalamityMod.NPCs; +using CalamityMod.NPCs.AcidRain; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.Potions; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class BlunderBoosterAura : ModProjectile + { + private const float radius = 98f; + private const int framesX = 3; + private const int framesY = 6; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Red Lightning Aura"); + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 218; + projectile.height = 218; + projectile.ignoreWater = true; + projectile.minionSlots = 0f; + projectile.timeLeft = 18000; + projectile.tileCollide = false; + projectile.friendly = true; + projectile.timeLeft *= 5; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 25; + } + + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 3) + { + projectile.localAI[0]++; + projectile.frameCounter = 0; + } + if (projectile.localAI[0] >= framesY) + { + projectile.localAI[0] = 0; + projectile.localAI[1]++; + } + if (projectile.localAI[1] >= framesX) + { + projectile.localAI[1] = 0; + } + if (Main.myPlayer != projectile.owner) + projectile.Kill(); + Player player = Main.player[projectile.owner]; + Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.15f / 255f, (255 - projectile.alpha) * 0.15f / 255f, (255 - projectile.alpha) * 0.01f / 255f); + projectile.Center = player.Center; + if (player.dead || player is null) + { + player.Calamity().blunderBooster = false; + projectile.Kill(); + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Electrified, 300); + + if (target.knockBackResist <= 0f) + return; + + if (CalamityGlobalNPC.ShouldAffectNPC(target)) + { + float knockbackMultiplier = knockback - (1f - target.knockBackResist); + if (knockbackMultiplier < 0) + { + knockbackMultiplier = 0; + } + Vector2 trueKnockback = target.Center - projectile.Center; + trueKnockback.Normalize(); + target.velocity = trueKnockback * knockbackMultiplier; + } + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Electrified, 300); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D sprite = Main.projectileTexture[projectile.type]; + + Color drawColour = Color.White; + Rectangle sourceRect = new Rectangle(projectile.width * (int)projectile.localAI[1], projectile.height * (int)projectile.localAI[0], projectile.width, projectile.height); + Vector2 origin = new Vector2(projectile.width / 2, projectile.height / 2); + + float opacity = 1f; + int sparkCount = 0; + int fadeTime = 20; + + if (projectile.timeLeft < fadeTime) + { + opacity = projectile.timeLeft * (1f / fadeTime); + sparkCount = fadeTime - projectile.timeLeft; + } + + for (int i = 0; i < sparkCount * 2; i++) + { + int dustType = 132; + if (Main.rand.NextBool()) + { + dustType = 264; + } + float rangeDiff = 2f; + + Vector2 dustPos = new Vector2(Main.rand.NextFloat(-1, 1), Main.rand.NextFloat(-1, 1)); + dustPos.Normalize(); + dustPos *= radius + Main.rand.NextFloat(-rangeDiff, rangeDiff); + + int dust = Dust.NewDust(projectile.Center + dustPos, 1, 1, dustType, 0, 0, 0, default, 0.75f); + Main.dust[dust].noGravity = true; + } + + spriteBatch.Draw(sprite, projectile.Center - Main.screenPosition, sourceRect, drawColour * opacity, projectile.rotation, origin, 1f, SpriteEffects.None, 0f); + return false; + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + float dist1 = Vector2.Distance(projectile.Center, targetHitbox.TopLeft()); + float dist2 = Vector2.Distance(projectile.Center, targetHitbox.TopRight()); + float dist3 = Vector2.Distance(projectile.Center, targetHitbox.BottomLeft()); + float dist4 = Vector2.Distance(projectile.Center, targetHitbox.BottomRight()); + + float minDist = dist1; + if (dist2 < minDist) + minDist = dist2; + if (dist3 < minDist) + minDist = dist3; + if (dist4 < minDist) + minDist = dist4; + + return minDist <= radius; + } + + public override bool? CanHitNPC(NPC target) + { + if (target.catchItem != 0 && target.type != ModContent.NPCType()) + { + return false; + } + return null; + } + } +} diff --git a/Projectiles/Typeless/BlunderBoosterAura.png b/Projectiles/Typeless/BlunderBoosterAura.png new file mode 100644 index 0000000000..440704108a Binary files /dev/null and b/Projectiles/Typeless/BlunderBoosterAura.png differ diff --git a/Projectiles/Typeless/FiniteUse/ExplosiveShotgunShell.cs b/Projectiles/Typeless/FiniteUse/ExplosiveShotgunShell.cs index 0d0bba31cd..6428d063f1 100644 --- a/Projectiles/Typeless/FiniteUse/ExplosiveShotgunShell.cs +++ b/Projectiles/Typeless/FiniteUse/ExplosiveShotgunShell.cs @@ -60,6 +60,8 @@ namespace CalamityMod.Projectiles.Typeless.FiniteUse Main.dust[num195].velocity *= 2f; Main.dust[num195].noGravity = true; } + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; projectile.Damage(); } } diff --git a/Projectiles/Typeless/GodSlayerPhantom.cs b/Projectiles/Typeless/GodSlayerPhantom.cs index 7edfcc4328..aa3da5f3c9 100644 --- a/Projectiles/Typeless/GodSlayerPhantom.cs +++ b/Projectiles/Typeless/GodSlayerPhantom.cs @@ -42,8 +42,8 @@ namespace CalamityMod.Projectiles.Typeless int num822 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 173, 0f, 0f, 0, default, 0.5f); Dust dust = Main.dust[num822]; dust.velocity *= 0.1f; - Main.dust[num822].scale = 1.3f; - Main.dust[num822].noGravity = true; + dust.scale = 1.3f; + dust.noGravity = true; float num953 = 40f * projectile.ai[1]; //100 float scaleFactor12 = 8f * projectile.ai[1]; //5 float num954 = 600f; diff --git a/Projectiles/Typeless/SandCloakVeil.cs b/Projectiles/Typeless/SandCloakVeil.cs index 101f1186e6..41e02e54fe 100644 --- a/Projectiles/Typeless/SandCloakVeil.cs +++ b/Projectiles/Typeless/SandCloakVeil.cs @@ -100,7 +100,7 @@ namespace CalamityMod.Projectiles.Typeless if (CalamityGlobalNPC.ShouldAffectNPC(target)) { - float knockbackMultiplier = knockback - target.knockBackResist; + float knockbackMultiplier = knockback - (1f - target.knockBackResist); if (knockbackMultiplier < 0) { knockbackMultiplier = 0; diff --git a/Projectiles/Typeless/TeslaAura.cs b/Projectiles/Typeless/TeslaAura.cs index 3e797ce795..0c0605e01f 100644 --- a/Projectiles/Typeless/TeslaAura.cs +++ b/Projectiles/Typeless/TeslaAura.cs @@ -77,7 +77,7 @@ namespace CalamityMod.Projectiles.Typeless if (CalamityGlobalNPC.ShouldAffectNPC(target)) { - float knockbackMultiplier = knockback - target.knockBackResist; + float knockbackMultiplier = knockback - (1f - target.knockBackResist); if (knockbackMultiplier < 0) { knockbackMultiplier = 0; diff --git a/Tiles/Furniture/AuricToiletTile.cs b/Tiles/Furniture/AuricToiletTile.cs new file mode 100644 index 0000000000..dfadd9a8e3 --- /dev/null +++ b/Tiles/Furniture/AuricToiletTile.cs @@ -0,0 +1,62 @@ +using CalamityMod.Items.Placeables.Furniture; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Furniture +{ + public class AuricToiletTile : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = false; + Main.tileWaterDeath[Type] = false; + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.Origin = new Point16(1, 1); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop, 4, 0); + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; + TileObjectData.addAlternate(1); + TileObjectData.addTile(Type); + + // Toilets count as chairs + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsChair); + + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Auric Toilet"); + AddMapEntry(new Color(191, 142, 111), name); + disableSmartCursor = true; + adjTiles = new int[] { TileID.Chairs }; + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 132, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 134, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 16, 32, ModContent.ItemType()); + } + } +} diff --git a/Tiles/Furniture/AuricToiletTile.png b/Tiles/Furniture/AuricToiletTile.png new file mode 100644 index 0000000000..759f089b29 Binary files /dev/null and b/Tiles/Furniture/AuricToiletTile.png differ diff --git a/Tiles/Furniture/CorruptionEffigy.cs b/Tiles/Furniture/CorruptionEffigy.cs index 73d7a73ed4..94c973c642 100644 --- a/Tiles/Furniture/CorruptionEffigy.cs +++ b/Tiles/Furniture/CorruptionEffigy.cs @@ -22,7 +22,8 @@ namespace CalamityMod.Tiles.Furniture TileObjectData.newTile.CoordinateWidth = 16; TileObjectData.newTile.CoordinatePadding = 2; TileObjectData.newTile.Origin = new Point16(0, 3); - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, 2, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop, 2, 0); TileObjectData.addTile(Type); ModTranslation name = CreateMapEntryName(); name.SetDefault("Corruption Effigy"); diff --git a/Tiles/Furniture/CraftingStations/PlagueInfuser.cs b/Tiles/Furniture/CraftingStations/PlagueInfuser.cs index 1377bf86e0..8e53a4b8a4 100644 --- a/Tiles/Furniture/CraftingStations/PlagueInfuser.cs +++ b/Tiles/Furniture/CraftingStations/PlagueInfuser.cs @@ -21,7 +21,8 @@ namespace CalamityMod.Tiles.Furniture.CraftingStations TileObjectData.newTile.CoordinateWidth = 16; TileObjectData.newTile.CoordinatePadding = 2; TileObjectData.newTile.Origin = new Point16(0, 3); - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, 2, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop, 2, 0); TileObjectData.addTile(Type); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/Furniture/CrimsonEffigy.cs b/Tiles/Furniture/CrimsonEffigy.cs index 16f7686df2..b167072679 100644 --- a/Tiles/Furniture/CrimsonEffigy.cs +++ b/Tiles/Furniture/CrimsonEffigy.cs @@ -22,7 +22,8 @@ namespace CalamityMod.Tiles.Furniture TileObjectData.newTile.CoordinateWidth = 16; TileObjectData.newTile.CoordinatePadding = 2; TileObjectData.newTile.Origin = new Point16(0, 3); - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, 2, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop, 2, 0); TileObjectData.addTile(Type); ModTranslation name = CreateMapEntryName(); name.SetDefault("Crimson Effigy"); diff --git a/Tiles/Furniture/EffigyOfDecayPlaceable.cs b/Tiles/Furniture/EffigyOfDecayPlaceable.cs index 28ccb6ce39..89c91b2fbf 100644 --- a/Tiles/Furniture/EffigyOfDecayPlaceable.cs +++ b/Tiles/Furniture/EffigyOfDecayPlaceable.cs @@ -23,7 +23,8 @@ namespace CalamityMod.Tiles.Furniture TileObjectData.newTile.CoordinateWidth = 16; TileObjectData.newTile.CoordinatePadding = 2; TileObjectData.newTile.Origin = new Point16(0, 3); - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, 2, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop, 2, 0); TileObjectData.addTile(Type); ModTranslation name = CreateMapEntryName(); name.SetDefault("Effigy of Decay"); diff --git a/Utilities/CalamityRecipes.cs b/Utilities/CalamityRecipes.cs index 2485b63028..65b1349c2e 100644 --- a/Utilities/CalamityRecipes.cs +++ b/Utilities/CalamityRecipes.cs @@ -657,6 +657,15 @@ namespace CalamityMod r.AddTile(TileID.Loom); r.SetResult(ItemID.HandWarmer); r.AddRecipe(); + + // Flower Boots + r = GetNewRecipe(); + r.AddIngredient(ItemID.Silk, 7); + r.AddIngredient(ItemID.JungleRose); + r.AddIngredient(ItemID.JungleGrassSeeds, 5); + r.AddTile(TileID.Loom); + r.SetResult(ItemID.FlowerBoots); + r.AddRecipe(); } #endregion diff --git a/Utilities/CalamityUtils.cs b/Utilities/CalamityUtils.cs index cf4cc53275..745f611edf 100644 --- a/Utilities/CalamityUtils.cs +++ b/Utilities/CalamityUtils.cs @@ -612,20 +612,20 @@ namespace CalamityMod //Count how many projectiles are attached, delete as necessary Point[] array2 = new Point[maxStick]; - int num29 = 0; + int projCount = 0; for (int projIndex = 0; projIndex < Main.maxProjectiles; projIndex++) { Projectile proj = Main.projectile[projIndex]; if (projIndex != projectile.whoAmI && proj.active && proj.owner == Main.myPlayer && proj.type == projectile.type && proj.ai[0] == 1f && proj.ai[1] == (float)npcIndex) { - array2[num29++] = new Point(projIndex, proj.timeLeft); - if (num29 >= array2.Length) + array2[projCount++] = new Point(projIndex, proj.timeLeft); + if (projCount >= array2.Length) { break; } } } - if (num29 >= array2.Length) + if (projCount >= array2.Length) { int num30 = 0; for (int m = 1; m < array2.Length; m++) @@ -2173,7 +2173,8 @@ namespace CalamityMod TileObjectData.newTile.CoordinateWidth = 16; TileObjectData.newTile.CoordinatePadding = 2; TileObjectData.newTile.Origin = new Point16(0, 3); - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, 2, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop, 2, 0); TileObjectData.addTile(mt.Type); } #endregion