diff --git a/Buffs/StatDebuffs/ProfanedWeakness.cs b/Buffs/StatDebuffs/ProfanedWeakness.cs index 4a2a558c3b..e9d61ddd1a 100644 --- a/Buffs/StatDebuffs/ProfanedWeakness.cs +++ b/Buffs/StatDebuffs/ProfanedWeakness.cs @@ -1,5 +1,8 @@ -using Terraria; +using CalamityMod.Dusts; +using CalamityMod.Particles; +using Terraria; using Terraria.ModLoader; +using Microsoft.Xna.Framework; namespace CalamityMod.Buffs.StatDebuffs { @@ -11,5 +14,29 @@ namespace CalamityMod.Buffs.StatDebuffs Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; } + public override void Update(NPC npc, ref int buffIndex) + { + if (npc.Calamity().relicOfResilienceWeakness < npc.buffTime[buffIndex]) + npc.Calamity().relicOfResilienceWeakness = npc.buffTime[buffIndex]; + npc.DelBuff(buffIndex); + buffIndex--; + } + internal static void DrawEffects(NPC npc, ref Color drawColor) + { + Vector2 npcSize = npc.Center + new Vector2(Main.rand.NextFloat(-npc.width / 2, npc.width / 2), Main.rand.NextFloat(-npc.height / 2, npc.height / 2)); + + if (Main.rand.NextBool(5)) + { + Particle spark = new CustomSpark(npcSize, Vector2.Zero, "CalamityMod/Projectiles/Typeless/ArtifactOfResilienceShard" + Main.rand.Next(1, 6 + 1).ToString(), true, Main.rand.Next(9, 22 + 1), Main.rand.NextFloat(0.4f, 0.8f), Color.White * Main.rand.NextFloat(0.4f, 0.9f), new Vector2(1.1f, 0.8f), false, false, Main.rand.NextFloat(-5, 5), false, false); + GeneralParticleHandler.SpawnParticle(spark); + } + + if (Main.rand.NextBool(5)) + { + Dust dust = Dust.NewDustDirect(npc.position - new Vector2(2f), npc.width + 4, npc.height + 4, ModContent.DustType(), npc.velocity.X * 0.4f, npc.velocity.Y * 0.4f, 100, default, Main.rand.NextFloat(0.9f, 1.7f)); + dust.noGravity = Main.rand.NextBool(3); + dust.color = Main.rand.NextBool() ? Color.Sienna : Color.Goldenrod; + } + } } } diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 41b1624eb0..c78acc2737 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -216,6 +216,8 @@ namespace CalamityMod.CalPlayer public int GalaxyHammer = 0; public bool despoilerNerf = false; public int amputatorBuff = 0; + public int rOfResilienceCooldown = 0; + public int rOfResilienceEffect = 0; public int NorfleetCounter = 0; public int hideOfDeusMeleeBoostTimer = 0; public int alcoholPoisonLevel = 0; @@ -2438,6 +2440,8 @@ namespace CalamityMod.CalPlayer bloodflareMageCooldown = 0; tarraRangedCooldown = 0; hideOfDeusMeleeBoostTimer = 0; + rOfResilienceCooldown = 0; + rOfResilienceEffect = 0; externalAbyssLight = 0; externalBreathLossMultBoost = 0f; diff --git a/CalPlayer/CalamityPlayerHitHurt.cs b/CalPlayer/CalamityPlayerHitHurt.cs index 0622e475b1..b4c1b2f941 100644 --- a/CalPlayer/CalamityPlayerHitHurt.cs +++ b/CalPlayer/CalamityPlayerHitHurt.cs @@ -27,6 +27,7 @@ using CalamityMod.Items.Tools; using CalamityMod.Items.VanillaArmorChanges; using CalamityMod.Items.Weapons.DraedonsArsenal; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Items; using CalamityMod.NPCs; using CalamityMod.NPCs.Abyss; using CalamityMod.NPCs.Cryogen; @@ -803,12 +804,6 @@ namespace CalamityMod.CalPlayer if (npc.Calamity().tSad > 0) contactDamageReduction += 0.5; - if (npc.Calamity().relicOfResilienceWeakness > 0) - { - contactDamageReduction += Items.Weapons.Typeless.RelicOfResilience.WeaknessDR; - npc.Calamity().relicOfResilienceWeakness = 0; - } - if (eskimoSet) { if (npc.coldDamage) @@ -1520,6 +1515,15 @@ namespace CalamityMod.CalPlayer theBeeCooldown = TheBee.CooldownLength; } + if (rOfResilienceCooldown == 0 && rOfResilienceEffect > 0) + { + int cooldownTime = (Player.Calamity().profanedSoulRelicBuff ? 300 : 600); + rOfResilienceCooldown = cooldownTime; + Player.AddCooldown(Cooldowns.RelicOfResilienceCooldown.ID, cooldownTime); + SoundStyle youGotHit = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianRockShieldActivate"); + SoundEngine.PlaySound(youGotHit with { Volume = 0.7f, Pitch = -0.1f }, Player.Center); + } + if (alchFlask) { for (int i = 0; i < 9; i++) diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 86dd0baf5a..9f5373ef25 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -1443,6 +1443,60 @@ namespace CalamityMod.CalPlayer } } + if (rOfResilienceEffect > 0) + rOfResilienceEffect--; + if (Player.HeldItem.type == ModContent.ItemType()) // All players close to a player holding RoR get the benefits + { + if (Player.ownedProjectileCounts[ModContent.ProjectileType()] < 1 && !Player.dead) + { + Projectile relic = Projectile.NewProjectileDirect(Player.GetSource_FromThis(), Player.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Player.whoAmI); + } + for (int index = 0; index < Main.player.Length; index++) + { + Player fella = Main.player[index]; + if (Utils.Distance(fella.Center, Player.Center) < 650) + { + fella.Calamity().rOfResilienceEffect = (fella != Player ? 120 : 2); + } + } + } + if (rOfResilienceEffect > 0) + { + // Adds a floor for defense and dr at 100 and 15% respectivley, will not ignore defense damage + if (Player.Calamity().rOfResilienceCooldown > 300 || Player.Calamity().rOfResilienceCooldown == 0) + { + float fadeStats = (Player.Calamity().rOfResilienceCooldown == 0 ? 1 : Utils.GetLerpValue(300, 600, Player.Calamity().rOfResilienceCooldown, true)); + int maxDefFloor = (int)(100 * fadeStats); + float MaxDRFloor = 0.15f * fadeStats; + if (Player.statDefense < maxDefFloor) + Player.statDefense += maxDefFloor - Player.statDefense; + if (Player.endurance < MaxDRFloor) + Player.endurance += MaxDRFloor - Player.endurance; + } + + int numOfShards = 0; + for (int x = 0; x < Main.maxProjectiles; x++) + { + Projectile projectile = Main.projectile[x]; + if (projectile.active && projectile.type == ModContent.ProjectileType() && projectile.ai[1] == 0 && projectile.owner == Player.whoAmI) + { + numOfShards++; + } + } + if (Player.miscCounter % (Player.Calamity().profanedSoulRelicBuff ? 4 : 8) == 0 && numOfShards < (Player.Calamity().profanedSoulRelicBuff ? 75 : 30) && Player.Calamity().rOfResilienceCooldown == 0) + { + if (numOfShards == 0) + { + SoundStyle sound = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianDash"); + SoundEngine.PlaySound(sound with { Volume = 0.5f, Pitch = -0.3f }, Player.Center); + } + int shardDamage = (int)Player.GetBestClassDamage().ApplyTo(420); + Projectile.NewProjectileDirect(Player.GetSource_FromThis(), Player.Center, new Vector2(1, 0), ModContent.ProjectileType(), shardDamage, 0f, Player.whoAmI, 0, 0, numOfShards + 1); + } + } + if (rOfResilienceCooldown > 0) + rOfResilienceCooldown--; + if (unstableGraniteCore) { zapActivity += 1; diff --git a/CalamityLists.cs b/CalamityLists.cs index 5a737b4bdd..4b96b0df81 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -899,6 +899,7 @@ namespace CalamityMod ProjectileType(), ProjectileType(), + ProjectileType(), // Some hostile boss projectiles ProjectileID.SaucerDeathray, @@ -2031,6 +2032,7 @@ namespace CalamityMod ProjectileType(), ProjectileType(), ProjectileType(), + ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType(), diff --git a/Cooldowns/RelicOfResilience.cs b/Cooldowns/RelicOfResilienceCooldown.cs similarity index 77% rename from Cooldowns/RelicOfResilience.cs rename to Cooldowns/RelicOfResilienceCooldown.cs index fe76048f4e..18da908039 100644 --- a/Cooldowns/RelicOfResilience.cs +++ b/Cooldowns/RelicOfResilienceCooldown.cs @@ -3,12 +3,12 @@ using Terraria.Localization; namespace CalamityMod.Cooldowns { - public class RelicOfResilience : CooldownHandler + public class RelicOfResilienceCooldown : CooldownHandler { - public static new string ID => "RelicOfResilience"; + public static new string ID => "RelicOfResilienceCooldown"; public override bool ShouldDisplay => true; public override LocalizedText DisplayName => CalamityUtils.GetText($"UI.Cooldowns.{ID}"); - public override string Texture => "CalamityMod/Cooldowns/RelicOfResilience"; + public override string Texture => "CalamityMod/Cooldowns/RelicOfResilienceCooldown"; public override Color OutlineColor => new Color(255, 191, 73); public override Color CooldownStartColor => new Color(122, 66, 59); public override Color CooldownEndColor => new Color(165, 103, 87); diff --git a/Cooldowns/RelicOfResilience.png b/Cooldowns/RelicOfResilienceCooldown.png similarity index 100% rename from Cooldowns/RelicOfResilience.png rename to Cooldowns/RelicOfResilienceCooldown.png diff --git a/Cooldowns/RelicOfResilienceOutline.png b/Cooldowns/RelicOfResilienceCooldownOutline.png similarity index 100% rename from Cooldowns/RelicOfResilienceOutline.png rename to Cooldowns/RelicOfResilienceCooldownOutline.png diff --git a/Cooldowns/RelicOfResilienceOverlay.png b/Cooldowns/RelicOfResilienceCooldownOverlay.png similarity index 100% rename from Cooldowns/RelicOfResilienceOverlay.png rename to Cooldowns/RelicOfResilienceCooldownOverlay.png diff --git a/Items/Accessories/WarbanneroftheRighteous.cs b/Items/Accessories/WarbanneroftheRighteous.cs index 6d7a6a9d04..37991f7afb 100644 --- a/Items/Accessories/WarbanneroftheRighteous.cs +++ b/Items/Accessories/WarbanneroftheRighteous.cs @@ -107,7 +107,7 @@ namespace CalamityMod.Items.Accessories { modNPC.warbannerBurnIntensity = intensity; modNPC.warbannerBurnDirection = Utils.DirectionTo(player.Center, nPC.Center); - int burnDamage = (int)player.GetBestClassDamage().ApplyTo(45 * damageMult); // There is up to a 3x multiplier on this damage depending on distance from the enemy + int burnDamage = (int)player.GetBestClassDamage().ApplyTo(47 * damageMult); // There is up to a 3x multiplier on this damage depending on distance from the enemy modNPC.warbannerBurnDamage = burnDamage; modNPC.warbannerBurnStacks++; modNPC.warbannerBurnTimer++; diff --git a/Items/RelicOfResilience.cs b/Items/RelicOfResilience.cs new file mode 100644 index 0000000000..2d198cc845 --- /dev/null +++ b/Items/RelicOfResilience.cs @@ -0,0 +1,28 @@ +using System.Linq; +using CalamityMod.Projectiles.Damageable; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items +{ + public class RelicOfResilience : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Misc"; + public override void SetDefaults() + { + Item.width = 40; + Item.height = 34; + Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; + Item.rare = ItemRarityID.Purple; + } + + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.ToolsOther; + } + } +} diff --git a/Items/Weapons/Typeless/RelicOfResilience.png b/Items/RelicOfResilience.png similarity index 100% rename from Items/Weapons/Typeless/RelicOfResilience.png rename to Items/RelicOfResilience.png diff --git a/Items/Weapons/Typeless/RelicOfResilience.cs b/Items/Weapons/Typeless/RelicOfResilience.cs deleted file mode 100644 index 3ac122a0b0..0000000000 --- a/Items/Weapons/Typeless/RelicOfResilience.cs +++ /dev/null @@ -1,73 +0,0 @@ -using System.Linq; -using CalamityMod.Projectiles.Damageable; -using CalamityMod.Projectiles.Typeless; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Typeless -{ - public class RelicOfResilience : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Weapons.Typeless"; - public const int CooldownSeconds = 5; - public const float WeaknessDR = 0.45f; - public override void SetStaticDefaults() - { - ItemID.Sets.CanBePlacedOnWeaponRacks[Type] = true; - } - - public override void SetDefaults() - { - Item.width = 40; - Item.height = 34; - Item.useAnimation = Item.useTime = 28; - Item.useStyle = ItemUseStyleID.HoldUp; - Item.UseSound = SoundID.Item45; - Item.autoReuse = true; - Item.noMelee = true; - Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; - Item.rare = ItemRarityID.Purple; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 0f; - } - - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.ToolsOther; - } - - public override bool CanUseItem(Player player) => !player.HasCooldown(Cooldowns.RelicOfResilience.ID); - public override bool? UseItem(Player player) => true; - - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - player.AddCooldown(Cooldowns.RelicOfResilience.ID, CalamityUtils.SecondsToFrames(CooldownSeconds)); - int[] shardTypes = new int[] - { - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - }; - if (player.ownedProjectileCounts[Item.shoot] > 0) - { - foreach (Projectile p in Main.ActiveProjectiles) - { - if (p.type == Item.shoot) - { - p.Center = Main.MouseWorld; - p.netUpdate = true; - } - } - } - else if (shardTypes.All(proj => player.ownedProjectileCounts[proj] == 0)) - Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); - return false; - } - } -} diff --git a/Localization/en-US/Mods.CalamityMod.Buffs.hjson b/Localization/en-US/Mods.CalamityMod.Buffs.hjson index d9f688287e..776862a581 100644 --- a/Localization/en-US/Mods.CalamityMod.Buffs.hjson +++ b/Localization/en-US/Mods.CalamityMod.Buffs.hjson @@ -1024,7 +1024,7 @@ PearlAura: { ProfanedWeakness: { DisplayName: Profaned Weakness - Description: You do less damage + Description: You take more damage } TemporalSadness: { diff --git a/Localization/en-US/Mods.CalamityMod.Items.Misc.hjson b/Localization/en-US/Mods.CalamityMod.Items.Misc.hjson index 4bbf0ff4e0..b06f27b629 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Misc.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Misc.hjson @@ -428,3 +428,14 @@ SuperDummy: { Right click to kill all super dummies ''' } + +RelicOfResilience: { + DisplayName: Relic Of Resilience + Tooltip: + ''' + 1... + 2... + 30... + rocks hmmmmmmm + ''' +} diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Typeless.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Typeless.hjson index 3a4d95fc0e..6b0ef15b59 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Typeless.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Typeless.hjson @@ -41,22 +41,6 @@ RelicOfDeliverance: { ''' } -RelicOfResilience: { - DisplayName: Relic of Resilience - Tooltip: - ''' - Summons an artifact at the mouse position - The artifact is damaged by enemies and all projectiles - When destroyed, the artifact explodes into a rotating burst of shards - If an enemy is in the area of the shards, its next attack will be 45% weaker - This effect has a cooldown - After 5 seconds, the shards come together to reform the original artifact - This reformation can happen 3 times before needing to be re-summoned - You gain a 5 second cooldown when summoning a new artifact - If an artifact already exists, using this item again will relocate it to the cursor - ''' -} - Skynamite: { DisplayName: Skynamite Tooltip: diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson index 969f12f917..61f481c2ab 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson @@ -2,12 +2,7 @@ AbaddonCrit.DisplayName: Brimstone Blast AeroExplosive.DisplayName: Aeroboom AllianceTriangle.DisplayName: Alliance Triangle ArcZap.DisplayName: Arc Zap -ArtifactOfResilienceShard1.DisplayName: Artifact Shard -ArtifactOfResilienceShard2.DisplayName: Artifact Shard -ArtifactOfResilienceShard3.DisplayName: Artifact Shard -ArtifactOfResilienceShard4.DisplayName: Artifact Shard -ArtifactOfResilienceShard5.DisplayName: Artifact Shard -ArtifactOfResilienceShard6.DisplayName: Artifact Shard +ArtifactOfResilienceShards.DisplayName: Artifact Shard AscendantAura.DisplayName: Ascendant Aura AstralFallingSand.DisplayName: Astral Falling Sand AstralSandBallFalling.DisplayName: Astral Sand @@ -140,3 +135,4 @@ YanmeisKnifeSlash.DisplayName: Yanmei's Knife YellowLabSeeker.DisplayName: Seeking Mechanism VoidofExtinctionCrit.DisplayName: Void of Extinction Crit XykDeathAnim.DisplayName: Xyk Death Animation +RelicGuard.DisplayName: Relic Guard diff --git a/Localization/en-US/Mods.CalamityMod.UI.hjson b/Localization/en-US/Mods.CalamityMod.UI.hjson index bf2b16ad40..3b8b83aede 100644 --- a/Localization/en-US/Mods.CalamityMod.UI.hjson +++ b/Localization/en-US/Mods.CalamityMod.UI.hjson @@ -111,7 +111,7 @@ Cooldowns: { PrismaticLaser: Prismatic Laser Barrage Cooldown ProfanedSoulShieldDurability: Profaned Soul Shield Durability ProfanedSoulShieldRecharge: Profaned Soul Shield Recharge - RelicOfResilience: Relic of Resilience Cooldown + RelicOfResilienceCooldown: Relic of Resilience Cooldown RogueBooster: Rogue Booster Cooldown SandCloak: Sand Cloak Cooldown SandsmokeBombActive: Sandsmoke Bomb Duration diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 8551deb29a..b0eeb0539f 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -328,7 +328,6 @@ namespace CalamityMod.NPCs public int sulphurPoison = 0; public int ladHearts = 0; public int kamiFlu = 0; - public int relicOfResilienceCooldown = 0; public int relicOfResilienceWeakness = 0; public int GaussFluxTimer = 0; public int sagePoisonTime = 0; @@ -565,7 +564,6 @@ namespace CalamityMod.NPCs myClone.sulphurPoison = sulphurPoison; myClone.ladHearts = ladHearts; myClone.kamiFlu = kamiFlu; - myClone.relicOfResilienceCooldown = relicOfResilienceCooldown; myClone.relicOfResilienceWeakness = relicOfResilienceWeakness; myClone.GaussFluxTimer = GaussFluxTimer; myClone.sagePoisonTime = sagePoisonTime; @@ -3691,6 +3689,8 @@ namespace CalamityMod.NPCs calcDR *= ArmorCrunch.MultiplicativeDamageReductionEnemy; if (npc.Calamity().crumble > 0) calcDR *= Crumbling.MultiplicativeDamageReductionEnemy; + if (relicOfResilienceWeakness > 0) + calcDR *= 0.65f; return calcDR; @@ -5590,10 +5590,6 @@ namespace CalamityMod.NPCs sulphurPoison--; if (sagePoisonTime > 0) sagePoisonTime--; - if (relicOfResilienceCooldown > 0) - relicOfResilienceCooldown--; - if (relicOfResilienceWeakness > 0) - relicOfResilienceWeakness--; if (GaussFluxTimer > 0) GaussFluxTimer--; if (ladHearts > 0) @@ -5608,6 +5604,9 @@ namespace CalamityMod.NPCs if (cursorFocus > 0 && cursorFocus < cursorFocusMax) cursorFocus--; + if (relicOfResilienceWeakness > 0) + relicOfResilienceWeakness--; + if (warbannerBurnTimer > 0) warbannerBurnTimer--; if (warbannerBurnTimer == 0 && warbannerBurnMarked) @@ -7130,6 +7129,9 @@ namespace CalamityMod.NPCs if (pFlames > 0) // Plague debuff Plague.DrawEffects(npc, ref drawColor); + if (relicOfResilienceWeakness > 0) + ProfanedWeakness.DrawEffects(npc, ref drawColor); + if (rTide > 0) RiptideDebuff.DrawEffects(npc, ref drawColor); diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianDefender.cs b/NPCs/ProfanedGuardians/ProfanedGuardianDefender.cs index 8639908070..b8d0f5f027 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianDefender.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianDefender.cs @@ -4,7 +4,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Events; using CalamityMod.Items.Accessories; -using CalamityMod.Items.Weapons.Typeless; +using CalamityMod.Items; using CalamityMod.NPCs.Providence; using CalamityMod.Projectiles.Boss; using CalamityMod.World; diff --git a/Projectiles/Damageable/ArtifactOfResilienceBulwark.cs b/Projectiles/Damageable/ArtifactOfResilienceBulwark.cs deleted file mode 100644 index 80877b95ca..0000000000 --- a/Projectiles/Damageable/ArtifactOfResilienceBulwark.cs +++ /dev/null @@ -1,57 +0,0 @@ -using CalamityMod.Dusts; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Damageable -{ - public class ArtifactOfResilienceBulwark : DamageableProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Misc"; - public int Reformations = 0; - public const int MaxReformations = 3; - public override int LifeMax => 1; - public override int MaxDamageImmunityFrames => 5; - public override DamageSourceType DamageSources => DamageSourceType.FriendlyProjectiles | DamageSourceType.HostileProjectiles | DamageSourceType.HostileNPCs; - public override SoundStyle HitSound => SoundID.NPCHit3; - public override SoundStyle DeathSound => SoundID.NPCDeath14; - public override void SafeSetDefaults() - { - Projectile.width = Projectile.height = 76; - Projectile.friendly = true; - Projectile.penetrate = 20; - } - - public override void SafeAI() - { - Projectile.rotation += MathHelper.ToRadians(8f); - Vector2 spawnPosition = Projectile.Center + Utils.NextVector2Circular(Main.rand, Projectile.width, Projectile.height) / 2f; - for (int i = 0; i < 8; i++) - { - Dust dust = Dust.NewDustPerfect(spawnPosition, (int)CalamityDusts.ProfanedFire); - dust.velocity = Projectile.DirectionFrom(spawnPosition); - dust.scale = Main.rand.NextFloat(1.1f, 1.5f); - dust.noGravity = true; - } - } - public override void DamageKillEffect() - { - Utils.PoofOfSmoke(Projectile.Center); - } - public override void OnKill(int timeLeft) - { - for (int i = 1; i <= 6; i++) - { - if (Main.myPlayer == Projectile.owner) - { - float angle = MathHelper.TwoPi / 6f * (i - 1); - Projectile shard = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, Mod.Find("ArtifactOfResilienceShard" + i.ToString()).Type, Projectile.damage, Projectile.knockBack, Projectile.owner); - shard.ai[0] = angle; - shard.frameCounter = Projectile.frameCounter + 1; // FrameCounter is a stored value for the amount of times the bulwark has reformed. - } - } - } - } -} diff --git a/Projectiles/Damageable/ArtifactOfResilienceBulwark.png b/Projectiles/Damageable/ArtifactOfResilienceBulwark.png deleted file mode 100644 index 97f00c91bd..0000000000 Binary files a/Projectiles/Damageable/ArtifactOfResilienceBulwark.png and /dev/null differ diff --git a/Projectiles/Melee/HolyColliderHoldout.cs b/Projectiles/Melee/HolyColliderHoldout.cs index 74e289b957..9436a10338 100644 --- a/Projectiles/Melee/HolyColliderHoldout.cs +++ b/Projectiles/Melee/HolyColliderHoldout.cs @@ -441,7 +441,7 @@ namespace CalamityMod.Projectiles.Melee Texture2D centerTexture = ModContent.Request("CalamityMod/Projectiles/Melee/HolyColliderGhost").Value; Color auraColor = mainColor1 with { A = 0 } * 0.15f * fadeIn; Vector2 drawOffset = (MathHelper.TwoPi * i / 25f).ToRotationVector2() * 6 * fadeIn; - Main.EntitySpriteDraw(centerTexture, Projectile.Center - Main.screenPosition + drawOffset + new Vector2(0, Owner.gfxOffY), centerTexture.Frame(1, FrameCount, 0, Frame), auraColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); + Main.EntitySpriteDraw(centerTexture, Projectile.Center - Main.screenPosition + drawOffset + new Vector2(0, Owner.gfxOffY), centerTexture.Frame(1, FrameCount, 0, Frame), auraColor, Projectile.rotation + RotationOffset + r, flipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (flipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); } Main.EntitySpriteDraw(tex.Value, generalDrawPos, tex.Frame(1, FrameCount, 0, Frame), lightColor, Projectile.rotation + RotationOffset + r, flipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, sEffects); diff --git a/Projectiles/Typeless/ArtifactOfResilienceShards.cs b/Projectiles/Typeless/ArtifactOfResilienceShards.cs index a9f0af6ded..a0287416af 100644 --- a/Projectiles/Typeless/ArtifactOfResilienceShards.cs +++ b/Projectiles/Typeless/ArtifactOfResilienceShards.cs @@ -1,332 +1,208 @@ -using System.IO; +using System; +using System.Collections.Generic; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; -using CalamityMod.Projectiles.Damageable; +using CalamityMod.Particles; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless { - // TODO -- Make this one projectile with multiple frames instead of multiple projectiles with one frame. - public class ArtifactOfResilienceShard1 : ModProjectile, ILocalizedModType + public class ArtifactOfResilienceShards : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Typeless"; - public int Timer = 0; - public Vector2 StartingPosition; - public const int MaxTimeLeft = 360; - public const int FallTime = 240; - public const float OutwardMovementTime = 85f; - public const float InwardReturnMovementTime = 100f; - public const float MaxRadius = 240f; - public override void SetStaticDefaults() - { - Main.projFrames[Type] = 1; - } + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public ref float time => ref Projectile.ai[0]; + public bool orbiting => Projectile.ai[1] == 0; + public Player Owner => Main.player[Projectile.owner]; + public Vector2 goalPosition; + public bool behind = false; + public int relicType = 1; + public float orbitSine = 0; + + public int burstTimer = 0; + public float speedMult = 1; + public float placementMult = 1; + public float orbitRot = 0; + public bool isAttacking => (burstTimer == 0 && !orbiting && Projectile.ai[1] != -1); public override void SetDefaults() { - Projectile.width = 30; - Projectile.height = 30; + Projectile.width = 50; + Projectile.height = 50; Projectile.friendly = true; Projectile.penetrate = -1; + Projectile.extraUpdates = 4; Projectile.tileCollide = false; Projectile.ignoreWater = true; - Projectile.timeLeft = MaxTimeLeft; + Projectile.timeLeft = 230; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 20; + Projectile.localNPCHitCooldown = 30 * Projectile.MaxUpdates; } - - public override void SendExtraAI(BinaryWriter writer) + public override void AI() { - writer.Write(Projectile.frameCounter); - writer.WriteVector2(StartingPosition); - } + float sine = (float)Math.Sin(time * 0.03f * speedMult / MathHelper.Pi); + float sine2 = (float)Math.Sin(time * (0.03f * 0.5f * speedMult) / MathHelper.Pi); + float sineNumberThreeSurelyWeNeedAThirdSineYouWillNotRegretAThirdSine = (float)Math.Sin(Main.GlobalTimeWrappedHourly * (4.5f) / MathHelper.Pi); - public override void ReceiveExtraAI(BinaryReader reader) - { - Projectile.frameCounter = reader.ReadInt32(); - StartingPosition = reader.ReadVector2(); - } + orbitSine = MathHelper.Lerp(Math.Abs(sine2), 0.1f, 1 - Math.Abs(sine2)); + float shardNumMult = Utils.GetLerpValue(-10, 30, Owner.ownedProjectileCounts[ModContent.ProjectileType()], true) * (Owner.Calamity().profanedSoulRelicBuff ? 2 : 1); - public static void ArtifactOfResilienceShardAI(Projectile projectile, ref Vector2 StartingPosition, ref int Timer) - { - // Spinning - if (projectile.localAI[1] == 0f) + float displace = new Vector2(25, 0).RotatedBy(sineNumberThreeSurelyWeNeedAThirdSineYouWillNotRegretAThirdSine * 0.5f).ToRotation(); + orbitRot = Utils.AngleLerp(orbitRot, displace, 0.01f); + goalPosition = Owner.Center + (new Vector2(250 * sine * shardNumMult * placementMult, (125 * orbitSine - 45) * shardNumMult * placementMult)).RotatedBy(orbitRot); + + Lighting.AddLight(Projectile.Center, Color.Lerp(Color.White, Color.Sienna, 0.5f).ToVector3() * 0.8f); + + if (Owner.Calamity().rOfResilienceCooldown > 0 && Projectile.ai[1] == 0) { - if (projectile.localAI[0] == 0f) + burstTimer = 120; + Projectile.ai[1] = 1; + } + if (Owner.Calamity().rOfResilienceEffect == 0 && Projectile.ai[1] == 0) + { + Projectile.ai[1] = -1; + Projectile.timeLeft = 95; + Projectile.velocity = Utils.DirectionTo(Projectile.Center, goalPosition) * Main.rand.NextFloat(1f, 3f); + } + + if (time == 0) + { + relicType = Main.rand.Next(1, 6 + 1); + speedMult = (Owner.Calamity().profanedSoulRelicBuff ? Main.rand.NextFloat(0.6f, 1.5f) : Main.rand.NextFloat(0.8f, 1.2f)); + placementMult = Main.rand.NextFloat(0.75f, 1.15f); + } + + if (orbiting) + { + Projectile.scale = 0.8f + orbitSine * 0.5f; + Projectile.rotation += 0.02f * sine; + + Projectile.timeLeft++; + + Projectile.Center = goalPosition; + Projectile.velocity = Vector2.Zero; + + if (Projectile.scale < 0.9f) { - StartingPosition = projectile.Center; - projectile.netUpdate = true; - projectile.localAI[0] = 1f; + behind = true; + Projectile.Opacity = MathHelper.Lerp(Projectile.Opacity, 0.15f, 0.057f); } - Timer++; - if (Timer < OutwardMovementTime) + else { - projectile.ai[1] = MathHelper.Lerp(0f, MaxRadius, Timer / OutwardMovementTime); + behind = false; + Projectile.Opacity = MathHelper.Lerp(Projectile.Opacity, 0.7f, 0.027f); } - if (Timer > MaxTimeLeft - InwardReturnMovementTime) + } + else + { + Projectile.Opacity = Utils.GetLerpValue(0, 90, Projectile.timeLeft, true); + if (Projectile.ai[1] == -1) { - projectile.ai[1] = MathHelper.Lerp(0f, MaxRadius, (Timer - MaxTimeLeft) / -InwardReturnMovementTime); + Projectile.velocity *= 0.98f; } - projectile.ai[0] += MathHelper.Pi / (projectile.ai[1] / MathHelper.Pi + 1); - projectile.Center = StartingPosition + projectile.ai[0].ToRotationVector2() * projectile.ai[1]; - projectile.rotation = projectile.ai[0]; - if (projectile.timeLeft == 1) + else { - for (int i = 0; i < 50; i++) + if (burstTimer > 0) { - Dust dust = Dust.NewDustPerfect(projectile.Center, (int)CalamityDusts.ProfanedFire); - dust.velocity = Utils.NextVector2Circular(Main.rand, 36f, 36f); - dust.scale = Main.rand.NextFloat(1.9f, 2.45f); - dust.noGravity = true; - } - projectile.timeLeft = FallTime; - projectile.tileCollide = true; - projectile.velocity = Utils.NextVector2Circular(Main.rand, 18f, 9f); - projectile.localAI[1] = 1; - } - if (projectile.ModProjectile is ArtifactOfResilienceShard1) - { - foreach (var n in Main.ActiveNPCs) - { - if (n.Distance(StartingPosition) < projectile.ai[1] && - n.damage > 0) + Projectile.extraUpdates = 1; + Projectile.velocity *= 0.9f; + if (Utils.Distance(Projectile.Center, Owner.Center) < 15) { - if (n.Calamity().relicOfResilienceCooldown <= 0) + behind = true; + Projectile.Center = Owner.Center; + } + else + { + Projectile.Center += Utils.DirectionTo(Projectile.Center, Owner.Center) * 40f * Utils.GetLerpValue(90, 0, burstTimer); + if (time % 8 == 0) { - n.Calamity().relicOfResilienceCooldown = 600; - n.Calamity().relicOfResilienceWeakness = 180; - n.AddBuff(ModContent.BuffType(), n.Calamity().relicOfResilienceWeakness); + Particle spark = new CustomSpark(Projectile.Center, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(3, 8), "CalamityMod/Projectiles/Typeless/ArtifactOfResilienceShard" + Main.rand.Next(1, 6 + 1).ToString(), true, Main.rand.Next(20, 32 + 1), Main.rand.NextFloat(0.65f, 1.1f), Color.White * Main.rand.NextFloat(0.4f, 0.9f), Vector2.One, false, false, Main.rand.NextFloat(-5, 5), false, false); + GeneralParticleHandler.SpawnParticle(spark); + } + } + burstTimer--; + if (burstTimer == 0) + { + Projectile.Opacity = 1; + + int projNum = Owner.ownedProjectileCounts[ModContent.ProjectileType()] - 4; + + Projectile.velocity = ((MathHelper.TwoPi * Projectile.ai[2] / projNum).ToRotationVector2()) * 15 * speedMult; + + if (Projectile.ai[2] == 1) + { + SoundStyle boom = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianShieldDeactivate"); + SoundEngine.PlaySound(boom with { Volume = 0.7f, Pitch = 0.1f }, Owner.Center); + SoundStyle boom2 = new("CalamityMod/Sounds/Item/MagicRockSound"); + SoundEngine.PlaySound(boom2 with { Volume = 0.7f, Pitch = 0f }, Owner.Center); + } + for (int i = 0; i < 3; i++) + { + Particle spark = new CustomSpark(Projectile.Center, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(6, 28), "CalamityMod/Projectiles/Typeless/ArtifactOfResilienceShard" + Main.rand.Next(1, 6 + 1).ToString(), Main.rand.NextBool(3), Main.rand.Next(25, 55 + 1), Main.rand.NextFloat(1.2f, 1.7f), Color.White, new Vector2(0.9f, 1.1f), false, false, 0, false, false); + GeneralParticleHandler.SpawnParticle(spark); + + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(5, 38)); + dust.noGravity = Main.rand.NextBool(); + dust.scale = Main.rand.NextFloat(1.35f, 2.8f); + dust.color = Main.rand.NextBool() ? Color.OrangeRed : Color.Sienna; } } } - } - } - // Falling - else - { - if (projectile.frameCounter <= ArtifactOfResilienceBulwark.MaxReformations) - { - // Reform - if (projectile.ModProjectile is ArtifactOfResilienceShard1 && Main.myPlayer == projectile.owner) + else { - Projectile reformedBulwark = Projectile.NewProjectileDirect(projectile.GetSource_FromThis(), - projectile.Center, - Vector2.Zero, - ModContent.ProjectileType(), - projectile.damage, - projectile.knockBack, - projectile.owner); - reformedBulwark.frameCounter = projectile.frameCounter; // Incremented on death, not reformation. + Projectile.velocity *= 0.97f; } - projectile.Kill(); - return; - } - if (projectile.velocity.Y < 12f) - { - projectile.velocity.Y += 0.25f; - } - projectile.velocity.X *= 0.95f; - projectile.rotation = projectile.velocity.ToRotation(); - if (projectile.timeLeft < 60f) - { - projectile.alpha = 255 - (int)MathHelper.Lerp(0, 255, projectile.timeLeft / 60f); } } - } - public override bool OnTileCollide(Vector2 oldVelocity) => false; - public override void AI() => ArtifactOfResilienceShardAI(Projectile, ref StartingPosition, ref Timer); - } - public class ArtifactOfResilienceShard2 : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Typeless"; - public int Timer = 0; - public Vector2 StartingPosition; - public const float MaxRadius = 660f; - public override void SetStaticDefaults() - { - Main.projFrames[Type] = 1; - } + if (isAttacking && Main.rand.NextBool(4)) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), -Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedByRandom(0.6f) * Main.rand.NextFloat(4f, 8f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.55f, 1.1f) * Projectile.Opacity; + dust.color = Main.rand.NextBool() ? Color.Orange : Color.Goldenrod; + } - public override void SetDefaults() - { - Projectile.width = 30; - Projectile.height = 30; - Projectile.friendly = true; - Projectile.penetrate = -1; - Projectile.tileCollide = false; - Projectile.ignoreWater = true; - Projectile.timeLeft = ArtifactOfResilienceShard1.MaxTimeLeft; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 40; + time++; } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + modifiers.SourceDamage *= (isAttacking ? 1 : 0.45f); + if (isAttacking) + target.AddBuff(ModContent.BuffType(), 520); + } + public override void OnKill(int timeLeft) + { - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(Projectile.frameCounter); - writer.WriteVector2(StartingPosition); } - - public override void ReceiveExtraAI(BinaryReader reader) + public override bool PreDraw(ref Color lightColor) { - Projectile.frameCounter = reader.ReadInt32(); - StartingPosition = reader.ReadVector2(); + Texture2D tex = relicType switch + { + 1 => ModContent.Request("CalamityMod/Projectiles/Typeless/ArtifactOfResilienceShard1").Value, + 2 => ModContent.Request("CalamityMod/Projectiles/Typeless/ArtifactOfResilienceShard2").Value, + 3 => ModContent.Request("CalamityMod/Projectiles/Typeless/ArtifactOfResilienceShard3").Value, + 4 => ModContent.Request("CalamityMod/Projectiles/Typeless/ArtifactOfResilienceShard4").Value, + 5 => ModContent.Request("CalamityMod/Projectiles/Typeless/ArtifactOfResilienceShard5").Value, + _ => ModContent.Request("CalamityMod/Projectiles/Typeless/ArtifactOfResilienceShard6").Value + }; + if (isAttacking) + Projectile.DrawProjectileWithBackglow(Color.Goldenrod with { A = 0 } * Projectile.Opacity, Color.White * Projectile.Opacity, 3 * Projectile.scale, tex); + else + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, lightColor * Projectile.Opacity, Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, SpriteEffects.None, 0); + + return false; } - - public override bool OnTileCollide(Vector2 oldVelocity) => false; - public override void AI() => ArtifactOfResilienceShard1.ArtifactOfResilienceShardAI(Projectile, ref StartingPosition, ref Timer); - } - public class ArtifactOfResilienceShard3 : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Typeless"; - public int Timer = 0; - public Vector2 StartingPosition; - public const float MaxRadius = 660f; - public override void SetStaticDefaults() + public override void DrawBehind(int index, List behindNPCsAndTiles, List behindNPCs, List behindProjectiles, List overPlayers, List overWiresUI) { - Main.projFrames[Type] = 1; + if (behind) + behindProjectiles.Add(index); + else + overPlayers.Add(index); } - - public override void SetDefaults() - { - Projectile.width = 30; - Projectile.height = 30; - Projectile.friendly = true; - Projectile.penetrate = -1; - Projectile.tileCollide = false; - Projectile.ignoreWater = true; - Projectile.timeLeft = ArtifactOfResilienceShard1.MaxTimeLeft; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 40; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(Projectile.frameCounter); - writer.WriteVector2(StartingPosition); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - Projectile.frameCounter = reader.ReadInt32(); - StartingPosition = reader.ReadVector2(); - } - public override bool OnTileCollide(Vector2 oldVelocity) => false; - public override void AI() => ArtifactOfResilienceShard1.ArtifactOfResilienceShardAI(Projectile, ref StartingPosition, ref Timer); - } - public class ArtifactOfResilienceShard4 : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Typeless"; - public int Timer = 0; - public Vector2 StartingPosition; - public const float MaxRadius = 660f; - public override void SetStaticDefaults() - { - Main.projFrames[Type] = 1; - } - - public override void SetDefaults() - { - Projectile.width = 30; - Projectile.height = 30; - Projectile.friendly = true; - Projectile.penetrate = -1; - Projectile.tileCollide = false; - Projectile.ignoreWater = true; - Projectile.timeLeft = ArtifactOfResilienceShard1.MaxTimeLeft; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 40; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(Projectile.frameCounter); - writer.WriteVector2(StartingPosition); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - Projectile.frameCounter = reader.ReadInt32(); - StartingPosition = reader.ReadVector2(); - } - public override bool OnTileCollide(Vector2 oldVelocity) => false; - public override void AI() => ArtifactOfResilienceShard1.ArtifactOfResilienceShardAI(Projectile, ref StartingPosition, ref Timer); - } - public class ArtifactOfResilienceShard5 : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Typeless"; - public int Timer = 0; - public Vector2 StartingPosition; - public const float MaxRadius = 660f; - public override void SetStaticDefaults() - { - Main.projFrames[Type] = 1; - } - - public override void SetDefaults() - { - Projectile.width = 30; - Projectile.height = 30; - Projectile.friendly = true; - Projectile.penetrate = -1; - Projectile.tileCollide = false; - Projectile.ignoreWater = true; - Projectile.timeLeft = ArtifactOfResilienceShard1.MaxTimeLeft; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 40; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(Projectile.frameCounter); - writer.WriteVector2(StartingPosition); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - Projectile.frameCounter = reader.ReadInt32(); - StartingPosition = reader.ReadVector2(); - } - public override bool OnTileCollide(Vector2 oldVelocity) => false; - public override void AI() => ArtifactOfResilienceShard1.ArtifactOfResilienceShardAI(Projectile, ref StartingPosition, ref Timer); - } - public class ArtifactOfResilienceShard6 : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Typeless"; - public int Timer = 0; - public Vector2 StartingPosition; - public const float MaxRadius = 660f; - public override void SetStaticDefaults() - { - Main.projFrames[Type] = 1; - } - - public override void SetDefaults() - { - Projectile.width = 30; - Projectile.height = 30; - Projectile.friendly = true; - Projectile.penetrate = -1; - Projectile.tileCollide = false; - Projectile.ignoreWater = true; - Projectile.timeLeft = ArtifactOfResilienceShard1.MaxTimeLeft; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 40; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(Projectile.frameCounter); - writer.WriteVector2(StartingPosition); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - Projectile.frameCounter = reader.ReadInt32(); - StartingPosition = reader.ReadVector2(); - } - public override bool OnTileCollide(Vector2 oldVelocity) => false; - public override void AI() => ArtifactOfResilienceShard1.ArtifactOfResilienceShardAI(Projectile, ref StartingPosition, ref Timer); + public override bool? CanDamage() => (Projectile.ai[1] == -1 || burstTimer > 0) ? false : null; } } diff --git a/Projectiles/Typeless/RelicGuard.cs b/Projectiles/Typeless/RelicGuard.cs new file mode 100644 index 0000000000..b07fc19b63 --- /dev/null +++ b/Projectiles/Typeless/RelicGuard.cs @@ -0,0 +1,109 @@ +using System; +using System.Collections.Generic; +using CalamityMod.Buffs.Summon; +using CalamityMod.CalPlayer; +using CalamityMod.Dusts; +using CalamityMod.Items; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class RelicGuard : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public Player Owner => Main.player[Projectile.owner]; + public CalamityPlayer moddedOwner => Owner.Calamity(); + public Color bColor = Color.White; + public int time = 0; + public float rotMult = 0.05f; + public int direction = 1; + public float rot2 = 0; + public Vector2 aimVel; + public float xLerp = 0; + public override void SetDefaults() + { + Projectile.width = Projectile.height = 1; + Projectile.ignoreWater = true; + Projectile.timeLeft = 300; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.penetrate = -1; + } + + public override void AI() + { + float sine = (float)Math.Sin(time * 0.13f / MathHelper.Pi); + float rate = Main.GlobalTimeWrappedHourly * 2; + List eColors = new List() + { + Color.Sienna, + Color.Peru + }; + + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + bColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); + + xLerp = MathHelper.Lerp(xLerp, (30 + 10 * sine) * Math.Sign(aimVel.X), 0.05f); + Projectile.Center = Owner.MountedCenter + new Vector2(xLerp, -25 + 12 * sine); + Owner.direction = Math.Sign(aimVel.X); + + if (Owner.HeldItem.type == ModContent.ItemType()) + Projectile.timeLeft++; + else + Projectile.Kill(); + if (Owner.dead) + Projectile.Kill(); + + // Emit some light + Lighting.AddLight(Projectile.Center, Color.Goldenrod.ToVector3() * 1.5f); + + rot2 = Math.Abs((float)Math.Sin(time * 0.15f / MathHelper.Pi) * 0.2f) + 0.8f; + + if (time % 2 == 0 && false) + { + Vector2 dustVel = new Vector2(15, 15).RotatedByRandom(100); + Dust dust = Dust.NewDustPerfect(Projectile.Center + dustVel, ModContent.DustType(), dustVel * Main.rand.NextFloat(0.1f, 0.4f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.7f, 0.9f) * Utils.GetLerpValue(300, 0, Owner.Calamity().rOfResilienceCooldown, true); + dust.color = bColor; + dust.noLightEmittence = true; + } + + aimVel = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld); + float adjustedRot = aimVel.ToRotation(); + Projectile.rotation = Utils.AngleLerp(Projectile.rotation, adjustedRot + (MathHelper.ToRadians(90)), 0.05f); + + float rot = Utils.DirectionFrom(Owner.Center, Projectile.Center).ToRotation() + (MathHelper.ToRadians(90)); + Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, rot); + Owner.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, rot); + + time++; + } + public override bool PreDraw(ref Color lightColor) + { + Texture2D rTexture = ModContent.Request("CalamityMod/Items/RelicOfResilience").Value; + Texture2D bTexture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + Color drawColor = bColor; + float CDScale = Utils.GetLerpValue(300, 0, Owner.Calamity().rOfResilienceCooldown, true); + + for (int i = 0; i < 2; i++) + { + float bScale2 = 0.55f; + Main.EntitySpriteDraw(bTexture, Projectile.Center - Main.screenPosition, null, Color.Lerp(drawColor, Color.White, i * 0.15f) with { A = 0 }, 0, bTexture.Size() * 0.5f, (bScale2 - i * 0.15f) * rot2 * CDScale, SpriteEffects.None, 0); + } + + Projectile.DrawProjectileWithBackglow(Color.OrangeRed with { A = 0 } * CDScale, Color.White, 3 * rot2 * CDScale, rTexture, null, Math.Sign(aimVel.X) < 0 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + return false; + } + public override bool? CanDamage() => false; + } +} diff --git a/Projectiles/Typeless/RelicOfConvergenceCrystal.cs b/Projectiles/Typeless/RelicOfConvergenceCrystal.cs index d497e685e6..b32f3bd4d1 100644 --- a/Projectiles/Typeless/RelicOfConvergenceCrystal.cs +++ b/Projectiles/Typeless/RelicOfConvergenceCrystal.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Typeless public override LocalizedText DisplayName => CalamityUtils.GetItemName(); public int SoundInterval = 25; public int TotalCrystalsToDraw = 3; - public int CrystalsDrawTime = 50; + public int CrystalsDrawTime = 40; public float MaxCrystalOffsetRadius = 80f; public float MaxDustOffsetRadius = 70f; @@ -33,12 +33,12 @@ namespace CalamityMod.Projectiles.Typeless Projectile.penetrate = -1; Projectile.tileCollide = false; Projectile.ignoreWater = true; - Projectile.timeLeft = 180; + Projectile.timeLeft = 120; } public override void AI() { - completion = Utils.GetLerpValue(180, 0, Projectile.timeLeft, true); + completion = Utils.GetLerpValue(120, 0, Projectile.timeLeft, true); fade = MathHelper.Lerp(fade, 0, 0.04f); Player player = Main.player[Projectile.owner]; @@ -70,7 +70,7 @@ namespace CalamityMod.Projectiles.Typeless } } - Projectile.soundDelay = (int)(SoundInterval * (time >= CrystalsDrawTime ? 1 - 0.8f * completion : 0.5f)); + Projectile.soundDelay = (int)(SoundInterval * (time >= CrystalsDrawTime ? 1 - 0.9f * completion : 0.5f)); fade = 1; } diff --git a/Projectiles/Typeless/WarbannerLight.cs b/Projectiles/Typeless/WarbannerLight.cs index 214c03b6cf..dfdcde65c0 100644 --- a/Projectiles/Typeless/WarbannerLight.cs +++ b/Projectiles/Typeless/WarbannerLight.cs @@ -71,7 +71,6 @@ namespace CalamityMod.Projectiles.Typeless dust.color = bColor; dust.noLightEmittence = true; } - time++; } public override bool PreDraw(ref Color lightColor) @@ -83,11 +82,11 @@ namespace CalamityMod.Projectiles.Typeless for (int i = 0; i < 5; i++) { float bScale2 = 0.75f; - Main.EntitySpriteDraw(bTexture, Owner.Center - Main.screenPosition, null, Color.Lerp(drawColor, Color.White, i * 0.15f) with { A = 0 }, 0, bTexture.Size() * 0.5f, (bScale2 - i * 0.15f) * rot2, SpriteEffects.None, 0); + Main.EntitySpriteDraw(bTexture, Owner.Center - Main.screenPosition, null, Color.Lerp(drawColor, Color.White, i * 0.15f) with { A = 0 }, 0, bTexture.Size() * 0.5f, (bScale2 - i * 0.15f) * rot2 * Projectile.scale, SpriteEffects.None, 0); } - Main.EntitySpriteDraw(rTexture, Owner.Center - Main.screenPosition, null, drawColor with { A = 0 }, Main.rand.NextFloat(-2, 2), rTexture.Size() * 0.5f, 0.03f * rot2, SpriteEffects.None, 0); - Main.EntitySpriteDraw(rTexture, Owner.Center - Main.screenPosition, null, drawColor with { A = 0 }, Main.rand.NextFloat(-2, 2), rTexture.Size() * 0.5f, 0.04f * rot2, SpriteEffects.None, 0); + Main.EntitySpriteDraw(rTexture, Owner.Center - Main.screenPosition, null, drawColor with { A = 0 }, Main.rand.NextFloat(-2, 2), rTexture.Size() * 0.5f, 0.03f * rot2 * Projectile.scale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(rTexture, Owner.Center - Main.screenPosition, null, drawColor with { A = 0 }, Main.rand.NextFloat(-2, 2), rTexture.Size() * 0.5f, 0.04f * rot2 * Projectile.scale, SpriteEffects.None, 0); return false; } public override bool? CanDamage() => false;