diff --git a/Buffs/Summon/SeashineSwordBuff.cs b/Buffs/Summon/SeashineSwordBuff.cs new file mode 100644 index 0000000000..c45048954a --- /dev/null +++ b/Buffs/Summon/SeashineSwordBuff.cs @@ -0,0 +1,12 @@ +using CalamityMod.Projectiles.Summon; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Summon +{ + public class SeashineSwordBuff : BaseSummonBuff + { + protected override int MinionProjectileType => ModContent.ProjectileType(); + + protected override ref bool MinionBool => ref BuffModdedOwner.seashineSwordBuff; + } +} diff --git a/Buffs/Summon/SeashineSwordBuff.png b/Buffs/Summon/SeashineSwordBuff.png new file mode 100644 index 0000000000..a7b9a06f29 Binary files /dev/null and b/Buffs/Summon/SeashineSwordBuff.png differ diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 35a842eb61..3f9d258b45 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -915,6 +915,9 @@ namespace CalamityMod.CalPlayer public bool auricSArtifact = false; public bool pSoulArtifact = false; public bool giantPearl = false; + public bool shieldOfTheOcean = false; + public int shieldOfTheOceanParry = 0; + public bool shieldOfTheOceanEmpoweredParry = false; public bool normalityRelocator = false; public bool flameLickedShell = false; public int flameLickedShellParry = 0; @@ -1038,7 +1041,7 @@ namespace CalamityMod.CalPlayer public int tornadoCooldown = 0; /// Calamity's Snow armor set bonus; reduces cold enemy damage and increases cold debuff damage. public bool eskimoSet = false; - /// Calamity's Rain armor set bonus; gives jump speed and makes jumps create a splash + /// Calamity's Rain armor set bonus; gives jump speed and makes jumps create a splash. public bool rainSet = false; /// Calamity's Meteor armor set bonus; makes all magic guns cost 33% mana instead of Space Gun costing 0 mana. public bool meteorSet = false; @@ -1155,7 +1158,9 @@ namespace CalamityMod.CalPlayer public bool valkyrie = false; /// Statigel armor's summoner set bonus minion. public bool slimeGod = false; - public bool molluskSet = false; + public bool molluskHelmet = false; + public bool molluskChest = false; + public bool molluskLegs = false; public bool fearmongerSet = false; public int fearmongerRegenFrames = 0; public bool daedalusCrystal = false; @@ -1450,6 +1455,7 @@ namespace CalamityMod.CalPlayer /// Dragonblood Disgorger. public bool dragonFamily = false; public bool providenceStabber = false; + public bool seashineSwordBuff = false; public bool saros = false; /// Fuel Cell Bundle. public bool plaguebringerMK2 = false; @@ -2098,7 +2104,9 @@ namespace CalamityMod.CalPlayer omegaBlueSet = false; omegaBlueHentai = false; - molluskSet = false; + molluskHelmet = false; + molluskChest = false; + molluskLegs = false; fearmongerSet = false; ataxiaBolt = false; @@ -2210,9 +2218,6 @@ namespace CalamityMod.CalPlayer darkSunRing = false; crawCarapace = false; baroclaw = false; - gShell = false; - lAmbergris = false; - tortShell = false; voidOfCalamity = false; voidOfExtinction = false; eArtifact = false; @@ -2220,6 +2225,7 @@ namespace CalamityMod.CalPlayer auricSArtifact = false; pSoulArtifact = false; giantPearl = false; + shieldOfTheOcean = false; normalityRelocator = false; flameLickedShell = false; Pauldron = false; @@ -2596,6 +2602,7 @@ namespace CalamityMod.CalPlayer powerfulRaven = false; dragonFamily = false; providenceStabber = false; + seashineSwordBuff = false; plaguebringerMK2 = false; igneousExaltation = false; GlacialEmbrace = false; @@ -3054,7 +3061,9 @@ namespace CalamityMod.CalPlayer ChlorophyteHealDelay = 0; omegaBlueChestplate = false; omegaBlueSet = false; - molluskSet = false; + molluskHelmet = false; + molluskChest = false; + molluskLegs = false; fearmongerSet = false; daedalusReflect = false; daedalusSplit = false; @@ -3135,6 +3144,8 @@ namespace CalamityMod.CalPlayer tracersDust = false; elysianWingsDust = false; GemTechState.OnDeathEffects(); + shieldOfTheOceanParry = 0; + shieldOfTheOceanEmpoweredParry = false; blazingCoreParry = 0; blazingCoreEmpoweredParry = false; blazingCoreSuccessfulParry = 0; @@ -3446,6 +3457,12 @@ namespace CalamityMod.CalPlayer flameLickedShellParry = FlameLickedShell.flameLickedParry; } } + else if (shieldOfTheOcean && shieldOfTheOceanParry == 0) + { + GeneralScreenShakePower = 2f; + SoundEngine.PlaySound(ShieldoftheOcean.TriggerSound, Player.Center); + shieldOfTheOceanParry = ShieldoftheOcean.ParryTime; + } } // Trigger for pressing the God Slayer dash key diff --git a/CalPlayer/CalamityPlayerHitHurt.cs b/CalPlayer/CalamityPlayerHitHurt.cs index 4dcd101eb0..dcc2c5d56e 100644 --- a/CalPlayer/CalamityPlayerHitHurt.cs +++ b/CalPlayer/CalamityPlayerHitHurt.cs @@ -1878,6 +1878,23 @@ namespace CalamityMod.CalPlayer FlameLickedShell.handleParry(Player); } } + else if (shieldOfTheOceanParry >= 12) + { + if (!Player.HasCooldown(ParryCooldown.ID)) + { + // Shield of the Ocean is a parry. It uses vanilla parry iframes and benefits from Cross Necklace. + int shieldParryIFrames = Player.ComputeParryIFrames(); + Player.GiveUniversalIFrames(shieldParryIFrames, true); + + shieldOfTheOceanEmpoweredParry = true; + modifiers.FinalDamage *= 0.4f; // 60% DR + modifiers.DisableSound(); + } + + SoundEngine.PlaySound(Main.zenithWorld ? ShieldoftheOcean.ParrySoundGFB : ShieldoftheOcean.ParrySound, Player.Center); + Player.AddCooldown(ParryCooldown.ID, 1200, false, "shieldoftheocean"); + ShieldoftheOcean.ActivateParry(Player); + } } private void ModifyHurtInfo_Calamity(ref Player.HurtInfo info) @@ -2647,7 +2664,7 @@ namespace CalamityMod.CalPlayer { var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); int effectStrength = amalgam ? 3 : aBrain ? 2 : 1; - int effectDamage = amalgam ? 400 : aBrain ? 50 : 15; + int effectDamage = amalgam ? 400 : aBrain ? 35 : 15; effectDamage = (int)Player.GetBestClassDamage().ApplyTo(effectDamage); Vector2 spawnerVelocity = -Vector2.UnitY.RotatedByRandom(MathHelper.Pi / 40f) * 12.5f; diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 7f0ac08799..c1f1904037 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -467,12 +467,6 @@ namespace CalamityMod.CalPlayer } } - // Solar Wings increase dash velocity of Solar Flare armor dash - if (Player.wingsLogic == (int)VanillaWingID.WingsSolar && Player.dash == 3 && dashStart) - { - Player.velocity.X *= 1.25f; - } - if (Player.dashDelay == -1) IsFirstDashFrame = false; else @@ -2026,6 +2020,13 @@ namespace CalamityMod.CalPlayer { FlameLickedShell.HandleParryCountdown(Player); } + if (shieldOfTheOceanParry > 0) + { + if (shieldOfTheOcean) + ShieldoftheOcean.HandleParryCountdown(Player); + else + shieldOfTheOceanParry--; + } if (!flameLickedShell && flameLickedShellParry > 0) flameLickedShellParry--; @@ -3552,8 +3553,12 @@ namespace CalamityMod.CalPlayer if ((vaporfied && !purity) || galvanicCorrosion) Player.velocity *= 0.98f; - if (molluskSet) - Player.velocity.X *= 0.985f; + if (molluskHelmet) + Player.velocity.X *= 0.994f; + if (molluskChest) + Player.velocity.X *= 0.994f; + if (molluskLegs) + Player.velocity.X *= 0.994f; if ((warped || caribbeanRum) && !Player.slowFall && !Player.mount.Active) { diff --git a/CalPlayer/DrawLayers/EncasementParryLayer.cs b/CalPlayer/DrawLayers/EncasementParryLayer.cs index 28e75b3674..c0ffbb8c29 100644 --- a/CalPlayer/DrawLayers/EncasementParryLayer.cs +++ b/CalPlayer/DrawLayers/EncasementParryLayer.cs @@ -12,11 +12,12 @@ namespace CalamityMod.CalPlayer.DrawLayers public enum EncasementType { BlazingCore, - FlameLickedShell + FlameLickedShell, + ShieldoftheOcean } public override Position GetDefaultPosition() => new BeforeParent(PlayerDrawLayers.FrontAccFront); //me when the player layer is called front acc front :skull: - public EncasementType GetEncasementTypeFor(CalamityPlayer modPlayer) => modPlayer.blazingCore ? EncasementType.BlazingCore : EncasementType.FlameLickedShell; + public EncasementType GetEncasementTypeFor(CalamityPlayer modPlayer) => modPlayer.blazingCore ? EncasementType.BlazingCore : modPlayer.flameLickedShell ? EncasementType.FlameLickedShell : EncasementType.ShieldoftheOcean; public override bool GetDefaultVisibility(PlayerDrawSet drawInfo) { @@ -28,6 +29,7 @@ namespace CalamityMod.CalPlayer.DrawLayers { EncasementType.BlazingCore => visible && modPlayer.blazingCoreParry > 0, EncasementType.FlameLickedShell => visible && modPlayer.flameLickedShellParry > 0, + EncasementType.ShieldoftheOcean => visible && modPlayer.shieldOfTheOceanParry > 0, _ => false }; return visible; @@ -56,6 +58,12 @@ namespace CalamityMod.CalPlayer.DrawLayers defaultOpacity = 0.875f; scale = 1.2f; break; + case EncasementType.ShieldoftheOcean: + tex += "OceanShieldBubble"; + currentParry = calPlayer.shieldOfTheOceanParry; + defaultOpacity = 0.7f; + scale = 1.3f; + break; default: //should never be this option tex += "BlazingCoreCrystal"; currentParry = 0; @@ -70,8 +78,8 @@ namespace CalamityMod.CalPlayer.DrawLayers drawPos.X += 15f; - int maxParry = 30; //all parries use thirty seconds as a max at this point in time, if this changes, this too should change - float colorIntensity = currentParry >= 18 ? defaultOpacity : 1f - Utils.GetLerpValue(maxParry, 0f, currentParry, true); + int maxParry = 30; // All parries currently last 30 frames. If this changes, this too should change. + float colorIntensity = currentParry >= 12 ? defaultOpacity : 1f - Utils.GetLerpValue(maxParry, 0f, currentParry, true); SpriteEffects spriteEffects = drawPlayer.direction != -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; drawInfo.DrawDataCache.Add(new DrawData(texture, drawPos, null, Color.White * colorIntensity, 0f, texture.Size() * 0.75f, scale, spriteEffects, 0)); } diff --git a/CalPlayer/DrawLayers/OceanShieldBubble.png b/CalPlayer/DrawLayers/OceanShieldBubble.png new file mode 100644 index 0000000000..e98f8c6037 Binary files /dev/null and b/CalPlayer/DrawLayers/OceanShieldBubble.png differ diff --git a/Cooldowns/ParryCooldown.cs b/Cooldowns/ParryCooldown.cs index e7cdbb218b..c226732eb7 100644 --- a/Cooldowns/ParryCooldown.cs +++ b/Cooldowns/ParryCooldown.cs @@ -38,6 +38,13 @@ namespace CalamityMod.Cooldowns cooldownColorStart = Color.Lerp(new Color(107, 6, 6), new Color(228, 78, 78), 1 - (instance?.Completion ?? 0)); cooldownColorEnd = Color.Lerp(new Color(107, 6, 6), new Color(228, 78, 78), 1 - (instance?.Completion ?? 0)); break;*/ + case "shieldoftheocean": + // skinTexture = "ShieldOfTheOceanParry"; + skinTexture = "ParryCooldown"; + outlineColor = Color.White; + cooldownColorStart = new Color(233, 111, 165); + cooldownColorEnd = new Color(105, 139, 148); + break; default: skinTexture = "ParryCooldown"; outlineColor = Color.White; diff --git a/ExtraTextures/Jesus.png b/ExtraTextures/Jesus.png new file mode 100644 index 0000000000..8750d55c55 Binary files /dev/null and b/ExtraTextures/Jesus.png differ diff --git a/ILEditing/BalancingILChanges.cs b/ILEditing/BalancingILChanges.cs index 18468c030a..5018cee4bb 100644 --- a/ILEditing/BalancingILChanges.cs +++ b/ILEditing/BalancingILChanges.cs @@ -719,6 +719,29 @@ namespace CalamityMod.ILEditing } #endregion + #region Solar Wings Change to Solar Flare Armor Dash + private static void SolarWingsDashChange(ILContext il) + { + // Make Solar Wings always allow using Solar Flare armor's dash. + var cursor = new ILCursor(il); + + // Genuinely how the fuck is this the only OR opcode in the entire method + if (!cursor.TryGotoNext(MoveType.After, i => i.MatchOr())) + { + LogFailure("Solar Dash Change", "Could not locate the OR opcode."); + return; + } + + // Add an additional check for if the player is wearing Solar Wings. + cursor.Emit(OpCodes.Ldarg_0); + cursor.Emit(OpCodes.Ldfld, typeof(Player).GetField("wingsLogic")); + cursor.Emit(OpCodes.Ldc_I4, (int)VanillaWingID.WingsSolar); + cursor.EmitCeq(); + // Then OR it. + cursor.EmitOr(); + } + #endregion + #region Remove Melee Armor (Beetle Shell + Solar Flare) Multiplicative DR private static void RemoveBeetleAndSolarFlareMultiplicativeDR(ILContext il) { diff --git a/ILEditing/ILChangesLoading.cs b/ILEditing/ILChangesLoading.cs index 866fd43eac..5e7483cac7 100644 --- a/ILEditing/ILChangesLoading.cs +++ b/ILEditing/ILChangesLoading.cs @@ -147,6 +147,7 @@ namespace CalamityMod.ILEditing IL_Projectile.Damage += VanillaBossResistChanges; IL_Projectile.AI_099_2 += LimitTerrarianProjectiles; IL_Projectile.AI_120_StardustGuardian += StardustGuardianAttackBuffs; + IL_Player.UpdateArmorSets += SolarWingsDashChange; IL_Player.UpdateBuffs += UpdateBuffsBalancingChanges; IL_Player.ApplyVanillaHurtEffectModifiers += RemoveBeetleAndSolarFlareMultiplicativeDR; diff --git a/Items/Accessories/ShieldoftheOcean.cs b/Items/Accessories/ShieldoftheOcean.cs index 9db1a74924..cacb484ead 100644 --- a/Items/Accessories/ShieldoftheOcean.cs +++ b/Items/Accessories/ShieldoftheOcean.cs @@ -1,6 +1,10 @@ -using CalamityMod.Items.Armor.Victide; -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using System.Collections.Generic; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -9,40 +13,115 @@ namespace CalamityMod.Items.Accessories public class ShieldoftheOcean : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; + public static readonly SoundStyle TriggerSound = new("CalamityMod/Sounds/Custom/MossMine"); + public static readonly SoundStyle ParrySound = new("CalamityMod/Sounds/Custom/BubbleCracklePop"); + public static readonly SoundStyle ParrySoundGFB = new("CalamityMod/Sounds/Custom/GFB/OceanShieldParryGFB"); + public const int ParryTime = 30; + // These damage values scale in Expert and Master. + public const int ShoveFallBaseDamage = 80; + public const int ImmuneToShoveBaseDamage = 200; + public override void SetDefaults() { Item.width = 24; Item.height = 28; - Item.value = CalamityGlobalItem.RarityGreenBuyPrice; - Item.rare = ItemRarityID.Green; - Item.defense = 2; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; + Item.rare = ItemRarityID.Orange; Item.accessory = true; } + public override void ModifyTooltips(List list) => list.IntegrateHotkey(CalamityKeybinds.AccessoryParryHotKey); public override void UpdateAccessory(Player player, bool hideVisual) { - if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) + player.Calamity().shieldOfTheOcean = true; + } + + public static void HandleParryCountdown(Player player) + { + player.Calamity().shieldOfTheOceanParry--; + + if (player.Calamity().shieldOfTheOceanParry > 0) { - player.statDefense += 5; - } - // Accessory update comes before set bonus for some reason, so this has to be done - if ((player.armor[0].type == ModContent.ItemType() || player.armor[0].type == ModContent.ItemType() || - player.armor[0].type == ModContent.ItemType() || player.armor[0].type == ModContent.ItemType() || - player.armor[0].type == ModContent.ItemType()) && - player.armor[1].type == ModContent.ItemType() && player.armor[2].type == ModContent.ItemType()) - { - player.moveSpeed += 0.1f; - player.lifeRegen += 2; + player.controlJump = false; + player.controlDown = false; + player.controlLeft = false; + player.controlRight = false; + player.controlUp = false; + player.controlUseItem = false; + player.controlUseTile = false; + player.controlThrow = false; + player.gravDir = 1f; + player.velocity = Vector2.Zero; + player.velocity.Y = -0.1f; // Ensure Y velocity is not 0, otherwise the flight meter gets reset. + player.RemoveAllGrapplingHooks(); } } - public override void AddRecipes() + // GFB changes: + // Different sound when parrying. + // Larger radius for pushing away enemies. + // Enemies are pushed much faster. + // Damage is multiplied by 10. + public static void ActivateParry(Player player) { - CreateRecipe(). - AddIngredient(5). - AddIngredient(ItemID.Starfish, 5). - AddTile(TileID.Anvils). - Register(); + bool empowered = player.Calamity().shieldOfTheOceanEmpoweredParry; + + // Search for every NPC within a certain radius of the player. + foreach (NPC npc in Main.ActiveNPCs) + { + if (Vector2.Distance(player.Center, npc.Center) > (Main.zenithWorld ? 720f : 240f)) + continue; + + // Inflict Riptide on empowered parries. + if (empowered) + npc.AddBuff(ModContent.BuffType(), 300); + + // If the NPC can be moved, violently shove them away. Make them susceptible to fall damage on empowered parries. + // Otherwise, simply deal a large amount of damage to them if empowered. + if (npc.CanBeMoved(true)) + { + // The NPC has to actually have its velocity changed, because TileCollisionHarmNPC only changes its position. Not confusing at all! + Vector2 shoveVelocity = Utils.DirectionTo(player.Center, npc.Center) * (Main.zenithWorld ? 35f : 12.5f) - Vector2.UnitY * 6f; + npc.MoveNPC(Vector2.Normalize(shoveVelocity), shoveVelocity.Length(), true); + + int scaledFallDamage = ShoveFallBaseDamage * (Main.masterMode ? 3 : Main.expertMode ? 2 : 1) * (Main.zenithWorld ? 10 : 1); + if (empowered) + npc.FlungNPC().ApplyCollisionDamage(npc, player, scaledFallDamage, shoveVelocity * 0.5f, 5f, true); + else + npc.FlungNPC().ApplyForcedVelocity(npc, player, shoveVelocity * 0.5f, true); + + for (int i = -1; i <= 1; i++) + { + Vector2 particleVel = Vector2.Normalize(npc.velocity).RotatedBy(MathHelper.Pi / 6f * i) * 7.5f; + WaterFlavoredParticle pushHit = new(npc.Center, particleVel, false, 10, 0.7f, Color.AliceBlue); + GeneralParticleHandler.SpawnParticle(pushHit); + } + } + else + { + if (empowered) + { + int scaledImmuneDamage = ImmuneToShoveBaseDamage * (Main.masterMode ? 3 : Main.expertMode ? 2 : 1) * (Main.zenithWorld ? 10 : 1); + Projectile.NewProjectile(player.GetSource_FromThis(), npc.Center, Vector2.Zero, ModContent.ProjectileType(), scaledImmuneDamage, 0f, player.whoAmI, npc.whoAmI); + } + + float randOffset = Main.rand.NextFloat(MathHelper.TwoPi); + for (int i = 0; i < 6; i++) + { + Vector2 particleVel = Vector2.UnitX.RotatedBy(MathHelper.Pi / 3f * i + randOffset) * 7.5f; + WaterFlavoredParticle bigHit = new(npc.Center, particleVel, false, 10, 0.7f, Color.AliceBlue); + GeneralParticleHandler.SpawnParticle(bigHit); + } + } + } + player.Calamity().shieldOfTheOceanEmpoweredParry = false; + + for (int b = 0; b < 20; b++) + { + Vector2 waterVel = Vector2.UnitX.RotatedBy(MathHelper.TwoPi / 15f * b) * Main.rand.NextFloat(12f, 24f); + WaterFoamParticle sorryToBurstYourBubble = new(player.Center, waterVel, 15, 0.6f, Color.Blue); + GeneralParticleHandler.SpawnParticle(sorryToBurstYourBubble); + } } } } diff --git a/Items/Armor/Astral/AstralBreastplate.cs b/Items/Armor/Astral/AstralBreastplate.cs index 9785855ba4..0efb6e01dc 100644 --- a/Items/Armor/Astral/AstralBreastplate.cs +++ b/Items/Armor/Astral/AstralBreastplate.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Armor.Astral { player.statLifeMax2 += 20; player.statManaMax2 += 80; - player.GetDamage() += 0.1f; + player.GetDamage() += 0.07f; } public override void AddRecipes() diff --git a/Items/Armor/Astral/AstralHelm.cs b/Items/Armor/Astral/AstralHelm.cs index df802b0cea..35c40f89a9 100644 --- a/Items/Armor/Astral/AstralHelm.cs +++ b/Items/Armor/Astral/AstralHelm.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Items.Armor.Astral public override void UpdateEquip(Player player) { player.GetDamage() += 0.05f; - player.GetCritChance() += 15; + player.GetCritChance() += 10; } public override void AddRecipes() diff --git a/Items/Armor/Astral/AstralLeggings.cs b/Items/Armor/Astral/AstralLeggings.cs index 093563cbfc..3a717b7f0c 100644 --- a/Items/Armor/Astral/AstralLeggings.cs +++ b/Items/Armor/Astral/AstralLeggings.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Armor.Astral public override void UpdateEquip(Player player) { player.moveSpeed += 0.15f; - player.GetDamage() += 0.1f; + player.GetDamage() += 0.05f; } public override void AddRecipes() diff --git a/Items/Armor/Mollusk/MolluskShelleggings.cs b/Items/Armor/Mollusk/MolluskShelleggings.cs index 5b2afdc3c7..607fdb87d5 100644 --- a/Items/Armor/Mollusk/MolluskShelleggings.cs +++ b/Items/Armor/Mollusk/MolluskShelleggings.cs @@ -16,14 +16,14 @@ namespace CalamityMod.Items.Armor.Mollusk Item.height = 18; Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; - Item.defense = 15; + Item.defense = 12; } public override void UpdateEquip(Player player) { - player.GetDamage() += 0.12f; + player.GetDamage() += 0.06f; player.GetCritChance() += 4; - player.moveSpeed -= 0.07f; + player.Calamity().molluskLegs = true; } public override void AddRecipes() diff --git a/Items/Armor/Mollusk/MolluskShellmet.cs b/Items/Armor/Mollusk/MolluskShellmet.cs index 8b5db6f70e..180be5c2c6 100644 --- a/Items/Armor/Mollusk/MolluskShellmet.cs +++ b/Items/Armor/Mollusk/MolluskShellmet.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Armor.Mollusk Item.height = 22; Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; - Item.defense = 18; + Item.defense = 15; } public override void UpdateEquip(Player player) @@ -31,6 +31,7 @@ namespace CalamityMod.Items.Armor.Mollusk player.ignoreWater = true; player.GetDamage() += 0.05f; player.GetCritChance() += 4; + player.Calamity().molluskHelmet = true; } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -41,10 +42,8 @@ namespace CalamityMod.Items.Armor.Mollusk public override void UpdateArmorSet(Player player) { player.setBonus = this.GetLocalizedValue("SetBonus"); - var modPlayer = player.Calamity(); - player.GetDamage() += 0.1f; - modPlayer.molluskSet = true; - player.maxMinions += 4; + player.endurance += 0.1f; + player.maxMinions += 4; // These are allocated for the Shellfish minions; there is no net change in minion slots. if (player.whoAmI == Main.myPlayer) { var source = player.GetSource_ItemUse(Item); diff --git a/Items/Armor/Mollusk/MolluskShellplate.cs b/Items/Armor/Mollusk/MolluskShellplate.cs index 33d3dea500..881bed8097 100644 --- a/Items/Armor/Mollusk/MolluskShellplate.cs +++ b/Items/Armor/Mollusk/MolluskShellplate.cs @@ -16,14 +16,14 @@ namespace CalamityMod.Items.Armor.Mollusk Item.height = 22; Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; - Item.defense = 22; + Item.defense = 18; } public override void UpdateEquip(Player player) { - player.GetDamage() += 0.1f; - player.GetCritChance() += 6; - player.moveSpeed -= 0.15f; + player.GetDamage() += 0.06f; + player.GetCritChance() += 5; + player.Calamity().molluskChest = true; } public override void AddRecipes() diff --git a/Items/Armor/TitanHeart/TitanHeartMantle.cs b/Items/Armor/TitanHeart/TitanHeartMantle.cs index 8a7129a95b..fbd3c17cd5 100644 --- a/Items/Armor/TitanHeart/TitanHeartMantle.cs +++ b/Items/Armor/TitanHeart/TitanHeartMantle.cs @@ -34,8 +34,7 @@ namespace CalamityMod.Items.Armor.TitanHeart public override void UpdateEquip(Player player) { player.Calamity().titanHeartMantle = true; - // 15% attack speed penalty - player.GetAttackSpeed() -= 0.15f; + player.GetDamage() += 0.05f; } public override void AddRecipes() diff --git a/Items/Armor/TitanHeart/TitanHeartMask.cs b/Items/Armor/TitanHeart/TitanHeartMask.cs index 479a5b5b25..03b99c9fa4 100644 --- a/Items/Armor/TitanHeart/TitanHeartMask.cs +++ b/Items/Armor/TitanHeart/TitanHeartMask.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Armor.TitanHeart player.setBonus = this.GetLocalizedValue("SetBonus"); var modPlayer = player.Calamity(); modPlayer.titanHeartSet = true; - player.GetDamage() += 0.15f; + player.GetDamage() += 0.10f; modPlayer.rogueStealthMax += 1f; modPlayer.wearingRogueArmor = true; player.noKnockback = true; diff --git a/Items/Placeables/Furniture/DevPaintings/ThankYouPainting.cs b/Items/Placeables/Furniture/DevPaintings/ThankYouPainting.cs index b955370119..0969ede8cc 100644 --- a/Items/Placeables/Furniture/DevPaintings/ThankYouPainting.cs +++ b/Items/Placeables/Furniture/DevPaintings/ThankYouPainting.cs @@ -65,6 +65,7 @@ namespace CalamityMod.Items.Placeables.Furniture.DevPaintings "CrabBar", "Dandy", "Dia", + "dozezoze", "enamoured", "ENNWAY", "Flowaria", diff --git a/Items/Weapons/Melee/Hellkite.cs b/Items/Weapons/Melee/Hellkite.cs index 63fb2fe1a4..e3954b3dff 100644 --- a/Items/Weapons/Melee/Hellkite.cs +++ b/Items/Weapons/Melee/Hellkite.cs @@ -1,9 +1,6 @@ using System.Collections.Generic; -using System.Linq; using CalamityMod.Items.BaseItems; -using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; -using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -45,13 +42,9 @@ namespace CalamityMod.Items.Weapons.Melee } public override bool AltFunctionUse(Player player) => true; public override bool MeleePrefix() => true; - public override void HoldItem(Player player) - { - return; - } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (player.altFunctionUse == 2) + if (player.Calamity().mouseRight) { Projectile.NewProjectile(source, player.MountedCenter, Vector2.Zero, type, damage, knockback, player.whoAmI, 0, 0, 5); } diff --git a/Items/Weapons/Melee/SeashineSword.cs b/Items/Weapons/Melee/SeashineSword.cs deleted file mode 100644 index c28720bdff..0000000000 --- a/Items/Weapons/Melee/SeashineSword.cs +++ /dev/null @@ -1,49 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.SunkenSea; -using CalamityMod.Projectiles.Melee; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Melee -{ - public class SeashineSword : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Weapons.Melee"; - - public override void SetDefaults() - { - Item.CloneDefaults(ItemID.EnchantedSword); - Item.width = 40; - Item.height = 40; - Item.useTime = 30; - Item.damage = 25; - Item.DamageType = DamageClass.Melee; - Item.value = CalamityGlobalItem.RarityGreenBuyPrice; - Item.knockBack = 4f; - Item.shootSpeed = 12f; - Item.rare = ItemRarityID.Green; - Item.UseSound = SoundID.Item1; - Item.shoot = ModContent.ProjectileType(); - } - public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 120); - } - public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) - { - target.AddBuff(ModContent.BuffType(), 120); - } - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(3). - AddIngredient(7). - AddIngredient(10). - AddTile(TileID.Anvils). - Register(); - } - } -} diff --git a/Items/Weapons/Melee/SeashineSword.png b/Items/Weapons/Melee/SeashineSword.png deleted file mode 100644 index ec74860678..0000000000 Binary files a/Items/Weapons/Melee/SeashineSword.png and /dev/null differ diff --git a/Items/Weapons/Melee/YinYo.cs b/Items/Weapons/Melee/YinYo.cs index b0fe1afa8f..31cedfa79f 100644 --- a/Items/Weapons/Melee/YinYo.cs +++ b/Items/Weapons/Melee/YinYo.cs @@ -47,8 +47,11 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { CreateRecipe(). + AddIngredient(ItemID.Valor). AddIngredient(ItemID.DarkShard). AddIngredient(ItemID.LightShard). + AddIngredient(ItemID.SoulofNight, 7). + AddIngredient(ItemID.SoulofLight, 7). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Rogue/Equanimity.cs b/Items/Weapons/Rogue/Equanimity.cs index 6ab914a57d..3133d376dc 100644 --- a/Items/Weapons/Rogue/Equanimity.cs +++ b/Items/Weapons/Rogue/Equanimity.cs @@ -1,6 +1,9 @@ -using CalamityMod.Projectiles.Rogue; +using System.Linq; +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -9,14 +12,15 @@ namespace CalamityMod.Items.Weapons.Rogue { public class Equanimity : RogueWeapon { + public static readonly SoundStyle StealthBoom = new("CalamityMod/Sounds/Item/MagnusImpact") { PitchVariance = 0.1f }; public override void SetDefaults() { Item.width = 46; Item.height = 58; - Item.damage = 40; + Item.damage = 84; Item.noMelee = true; Item.noUseGraphic = true; - Item.useAnimation = Item.useTime = 36; + Item.useAnimation = Item.useTime = 46; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 1f; Item.UseSound = SoundID.Item1; @@ -25,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 30f; + Item.shootSpeed = 3f; Item.DamageType = RogueDamageClass.Instance; } @@ -44,10 +48,11 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.Flamarang). - AddIngredient(ItemID.IceBoomerang). + AddIngredient(). AddIngredient(ItemID.DarkShard). AddIngredient(ItemID.LightShard). + AddIngredient(ItemID.SoulofNight, 7). + AddIngredient(ItemID.SoulofLight, 7). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Rogue/Exorcism.cs b/Items/Weapons/Rogue/Exorcism.cs index 8800eb5c2f..4742e420dc 100644 --- a/Items/Weapons/Rogue/Exorcism.cs +++ b/Items/Weapons/Rogue/Exorcism.cs @@ -11,24 +11,28 @@ namespace CalamityMod.Items.Weapons.Rogue { public override void SetDefaults() { - Item.width = 34; - Item.height = 42; - Item.damage = 64; + Item.width = 109; + Item.height = 128; + Item.damage = 285; Item.noMelee = true; Item.noUseGraphic = true; - Item.useAnimation = Item.useTime = 20; + // Due to the amazing sound engine, having more than one of these on screen will cause audio bugs! + // Therefore this thing has to be absurdly slow (Not that I've ever complained about that before) + Item.useAnimation = Item.useTime = 115; Item.useStyle = ItemUseStyleID.Swing; - Item.knockBack = 1f; - Item.UseSound = SoundID.Item1; + Item.knockBack = 12f; Item.autoReuse = true; - Item.maxStack = 1; Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; + Item.shootSpeed = 6f; Item.DamageType = RogueDamageClass.Instance; } - + public override float StealthDamageMultiplier => 0.65f; + public override void HoldItem(Player player) + { + player.Calamity().mouseWorldListener = true; + } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) @@ -43,15 +47,14 @@ namespace CalamityMod.Items.Weapons.Rogue } return false; } - + public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.HolyWater, 10). - AddIngredient(ItemID.HallowedBar, 12). - AddIngredient(ItemID.SoulofFright, 6). - AddIngredient(ItemID.SoulofMight, 6). - AddIngredient(ItemID.SoulofSight, 6). + AddIngredient(ItemID.HallowedBar, 20). + AddIngredient(ItemID.SoulofFright, 3). + AddIngredient(ItemID.SoulofMight, 3). + AddIngredient(ItemID.SoulofSight, 3). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Rogue/Exorcism.png b/Items/Weapons/Rogue/Exorcism.png index 0011f65c8d..c595d31a28 100644 Binary files a/Items/Weapons/Rogue/Exorcism.png and b/Items/Weapons/Rogue/Exorcism.png differ diff --git a/Items/Weapons/Summon/SeashineSword.cs b/Items/Weapons/Summon/SeashineSword.cs new file mode 100644 index 0000000000..3425ef6d93 --- /dev/null +++ b/Items/Weapons/Summon/SeashineSword.cs @@ -0,0 +1,144 @@ +using System; +using CalamityMod.Dusts; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.SunkenSea; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Summon; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Summon +{ + public class SeashineSword : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Weapons.Summon"; + public override void SetStaticDefaults() + { + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; + } + public override void SetDefaults() + { + Item.width = 32; + Item.height = 34; + Item.useTime = 10; + Item.useAnimation = 10; + Item.damage = 55; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.autoReuse = true; + Item.useStyle = ItemUseStyleID.Shoot; + Item.DamageType = DamageClass.Summon; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; + Item.knockBack = 5f; + Item.shootSpeed = 12f; + Item.mana = 10; + Item.rare = ItemRarityID.Green; + Item.shoot = ModContent.ProjectileType(); + } + public override bool AltFunctionUse(Player player) => true; + public override float UseSpeedMultiplier(Player player) + { + // There's a long cooldown on commanding blades + // This is so you don't just hold down right click, since now it's optimal to only command blades when all are ready + if (player.altFunctionUse == 2) + return 0.1f; + else + return 1f; + } + public override void HoldItem(Player player) + { + player.Calamity().mouseWorldListener = true; + } + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + // Call all active blades to attack if they are charged + // The check to see if a blade is charged is done in the blade itself + if (player.altFunctionUse == 2) + { + int blades = 0; + for (int x = 0; x < Main.maxProjectiles; x++) + { + Projectile projectile = Main.projectile[x]; + if (projectile.active && projectile.type == Item.shoot && projectile.ai[0] < 5 && projectile.timeLeft < 90000 - 180) + { + projectile.ai[0] = 5; + blades++; + } + } + if (blades > 0) // If theres no blades, then don't do anything + { + for (int i = 0; i < 7; i++) + { + Dust dust = Dust.NewDustPerfect(player.Center, ModContent.DustType(), (velocity.SafeNormalize(Vector2.UnitX)).RotatedByRandom(0.6f) * Main.rand.NextFloat(5f, 10f)); + dust.noGravity = false; + dust.scale = Main.rand.NextFloat(0.95f, 1.7f); + dust.color = Main.rand.NextBool() ? Color.Cyan : Color.DodgerBlue; + dust.noLightEmittence = true; + + Particle fx = new CustomSpark(player.Center, (velocity.SafeNormalize(Vector2.UnitX)).RotatedByRandom(0.6f) * Main.rand.NextFloat(10f, 20f), "CalamityMod/Particles/Sparkle", false, (int)(Main.rand.Next(16, 26 + 1)), Main.rand.NextFloat(1.1f, 1.7f), Main.rand.NextBool() ? Color.Cyan : Color.DodgerBlue, new Vector2(0.5f, 1.1f), extraRotation: 0, shrinkSpeed: 0.2f); + GeneralParticleHandler.SpawnParticle(fx); + } + Particle e = new CustomSpark(player.Center, (velocity.SafeNormalize(Vector2.UnitX)).RotatedByRandom(0.6f) * Main.rand.NextFloat(7f, 20f), "CalamityMod/Particles/WaterFoam", false, 14, Main.rand.NextFloat(0.15f, 0.25f) * 3, Main.rand.NextBool() ? Color.Cyan : Color.DodgerBlue, new Vector2(1f, 1f), true, false, shrinkSpeed: 0.4f); + GeneralParticleHandler.SpawnParticle(e); + SoundEngine.PlaySound(SoundID.Item101 with { Volume = 0.9f, Pitch = Main.rand.NextFloat(0.3f, 0.5f) }, player.Center); + } + } + else // Toss out the summon + { + SoundEngine.PlaySound(SoundID.Item1, player.Center); + + int pr = Projectile.NewProjectile(source, player.Center, velocity, type, damage, knockback, player.whoAmI); + if (Main.projectile.IndexInRange(pr)) + Main.projectile[pr].originalDamage = Item.damage; + + float angleMax = MathHelper.ToRadians(360f); + if (CalamityUtils.CountProjectiles(type) == 1) + angleMax = 0f; + float index = 1f; + if (player.ownedProjectileCounts[Item.shoot] > 30) + { + angleMax += MathHelper.ToRadians((player.ownedProjectileCounts[Item.shoot] - 30) * 2.5f); + } + angleMax = angleMax > MathHelper.ToRadians(360f) ? MathHelper.ToRadians(360f) : angleMax; // More intuative than using a min function + foreach (Projectile p in Main.ActiveProjectiles) + { + if (p.type == type && p.owner == player.whoAmI) + { + p.ai[2] = (index / CalamityUtils.CountProjectiles(type)) * angleMax - angleMax / 2f; + p.ai[1] = index; + p.netUpdate = true; + index++; + } + } + } + return false; + } + public override void UseItemFrame(Player player) // Player hand animation when you command the blades + { + if (player.altFunctionUse == 2) + { + player.ChangeDir(Math.Sign((player.Calamity().mouseWorld - player.Center).X)); + + float animProgress = 0.5f - player.itemTime / (float)player.itemTimeMax; + float rotation = (player.Center - player.Calamity().mouseWorld).ToRotation() * player.gravDir + MathHelper.PiOver2; + if (animProgress < 0.4f) + rotation += (-0.15f) * (float)Math.Pow((0.6f - animProgress) / 0.6f, 2) * player.direction; + + player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, rotation); + } + } + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(3). + AddIngredient(7). + AddIngredient(10). + AddTile(TileID.Anvils). + Register(); + } + } +} diff --git a/Items/Weapons/Summon/SeashineSword.png b/Items/Weapons/Summon/SeashineSword.png new file mode 100644 index 0000000000..7b2e0792bc Binary files /dev/null and b/Items/Weapons/Summon/SeashineSword.png differ diff --git a/Localization/en-US/Mods.CalamityMod.Buffs.hjson b/Localization/en-US/Mods.CalamityMod.Buffs.hjson index 8c05baf6a7..67845293c8 100644 --- a/Localization/en-US/Mods.CalamityMod.Buffs.hjson +++ b/Localization/en-US/Mods.CalamityMod.Buffs.hjson @@ -1473,6 +1473,11 @@ SarosPossessionBuff: { Description: A radiant aura protects you } +SeashineSwordBuff: { + DisplayName: Seashine Sword + Description: A beautiful dance of crystalline blades... +} + SeaSnailBuff: { DisplayName: Sea Snail Description: Meow? diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson index 08aaa8560b..5a20b5cf25 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson @@ -1560,8 +1560,12 @@ ShieldoftheOcean: { DisplayName: Shield of the Ocean Tooltip: ''' - Increased defense by 5 when submerged in liquid - 10% increased movement speed and +1 HP/s life regen while wearing Victide armor + Pressing [KEY] will activate a parry, encasing you in a bubble + Being hit shortly after encasement will pop the bubble, granting 60% DR for that hit + Upon popping, nearby enemies are violently launched away from you, and will be damaged if they collide with tiles + Enemies which cannot be launched instead directly take large damage + After popping, the damage reducing effect goes on a 20 second cooldown + Damage parried whilst on cooldown will not be reduced, and will not deal collision damage to launched enemies ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Armor.Hardmode.hjson b/Localization/en-US/Mods.CalamityMod.Items.Armor.Hardmode.hjson index 8b8e2f204b..91905b3659 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Armor.Hardmode.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Armor.Hardmode.hjson @@ -2,14 +2,14 @@ AstralBreastplate: { DisplayName: Astral Breastplate Tooltip: ''' - 10% increased damage + 7% increased damage +80 max mana and +20 max life ''' } AstralHelm: { DisplayName: Astral Helm - Tooltip: 5% increased damage and 15% increased critical strike chance + Tooltip: 5% increased damage and 10% increased critical strike chance SetBonus: ''' +3 max minions @@ -24,7 +24,7 @@ AstralLeggings: { DisplayName: Astral Leggings Tooltip: ''' - 10% increased damage + 5% increased damage 15% increased movement speed ''' } @@ -353,8 +353,8 @@ MolluskShelleggings: { DisplayName: Mollusk Shelleggings Tooltip: ''' - 12% increased damage and 4% increased critical strike chance - 7% decreased movement speed + 6% increased damage and 4% increased critical strike chance + Your horizontal movement is slowed ''' } @@ -364,12 +364,12 @@ MolluskShellmet: { ''' 5% increased damage and 4% increased critical strike chance You can move freely through liquids + Your horizontal movement is slowed ''' SetBonus: ''' Two shellfishes aid you in combat - 10% increased damage - Your horizontal movement is slowed + 10% increased damage reduction ''' } @@ -377,8 +377,8 @@ MolluskShellplate: { DisplayName: Mollusk Shellplate Tooltip: ''' - 10% increased damage and 6% increased critical strike chance - 15% decreased movement speed + 6% increased damage and 5% increased critical strike chance + Your horizontal movement is slowed ''' } @@ -522,7 +522,7 @@ TitanHeartBoots: { TitanHeartMantle: { DisplayName: Titan Heart Mantle - Tooltip: 5% boosted rogue knockback but 15% lowered rogue attack speed + Tooltip: 5% boosted rogue damage and knockback } TitanHeartMask: { @@ -534,7 +534,7 @@ TitanHeartMask: { ''' SetBonus: ''' - 15% increased rogue damage and knockback + 10% increased rogue damage and 20% increased rogue knockback +100 maximum stealth Stealth strikes deal double knockback and cause an astral explosion Grants immunity to knockback diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson index 1f831bc623..3436e9adff 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson @@ -1106,11 +1106,6 @@ ScourgeoftheCosmos: { Tooltip: Throws a bouncing cosmic scourge that emits tiny homing cosmic scourges on enemy and tile hits } -SeashineSword: { - DisplayName: Seashine Sword - Tooltip: Shoots an aqua sword beam -} - SeekingScorcher: { DisplayName: Seeking Scorcher Tooltip: diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson index cb6faaa7bf..ddacc2c83d 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson @@ -385,9 +385,9 @@ Equanimity: { DisplayName: Equanimity Tooltip: ''' - Throws a boomerang born of light and darkness that confuses enemies - The boomerang will create light shards upon hitting enemies when thrown out, and will fire homing dark shards when returning - Stealth strikes cause the boomerang to create both dark and light shards whenever one type would be created + Throws a confusing boomerang that ricochets between enemies + Enemy hits alternate summoning homing light shards or piercing dark shards + Stealth strikes cause an alternating explosion of light or dark on every ricochet, empowering the opposite color of shard ''' } @@ -413,8 +413,10 @@ Exorcism: { DisplayName: Exorcism Tooltip: ''' - Throws a hallowed cross which explodes into a flash of light that damages nearby enemies - Stealth strikes create larger flashes and rain stars infused with holy light + Throws a gigantic hallowed cross to the heavens, which will fall at your cursor a moment later + Enemies hit as it falls are impaled and repeatedly seared with holy light + Upon experation a cross shaped explosion is created + Stealth strikes twirl and throw the cross, ending in a stronger explosion at your cursor ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson index 42d411ed19..50e9c95edd 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson @@ -669,6 +669,17 @@ ScabRipper: { Tooltip: Summons a baby blood crawler to protect you } +SeashineSword: { + DisplayName: Seashine Sword + Tooltip: + ''' + Summons a brilliant sea prism blade to slice your enemies + Blades will charge up while you hold this item + Pressing will order all fully charged blades to swipe at your cursor + Each sword only consumes half a minion slot + ''' +} + ShellfishStaff: { DisplayName: Shellfish Staff Tooltip: diff --git a/Localization/en-US/Mods.CalamityMod.NPCs.hjson b/Localization/en-US/Mods.CalamityMod.NPCs.hjson index 37e84bc593..e12ca32fb9 100644 --- a/Localization/en-US/Mods.CalamityMod.NPCs.hjson +++ b/Localization/en-US/Mods.CalamityMod.NPCs.hjson @@ -375,18 +375,23 @@ FAP: { Stylist3: I love it when {0}'s hands get sticky from all that... wax. Stylist3Alt: "{0} and I will be building wax figures tonight. And no, there's nothing weird about that." Day1: I'm literally balls drunk off my sass right now, what do you want? + Day1Alt: A nice day for a walk in the woods, don't you think? Anyway, what do you need? Day2: I'm either laughing because I'm drunk or because I've lost my mind, probably both. + Day2Alt: Some people ask me whether it's 'unicorn', 'pegacorn', 'alicorn', 'pegasus'... whatever, all of them suit me. Day3: When I'm drunk I'm way happier... at least until the talking worms start to appear. - Day4: I should reprogram the whole mod, while drunk, then send it back to the testers. - DayStylist1: "{0} helped me learn to accept my past. It's been rough, but I think I'm on the right track now." + Day3Alt: Did you know that certain worms can speak? Neither did I, until I flew to outer space. + Day4: I should go fishing... while drunk, and jump into the ocean to spare myself {0}'s annoying naivety... + Day4Alt: I may be a 'hater' and a 'gatekeeper', but I'm also Dionysus' favorite princess, and the most fabulous girl in the world. + DayStylist1: "{0} helped me accept my past. It's been tough, but I think I'm on the right path now." DayStylist2: Might go out for a jog later with {0}. Nice day for it. - DayDrunk1: I drink to forget certain... things. What things, you might ask? Well, the point is to forget them, isn't it? + DayDrunk1: I drink to forget... What am I trying to forget, you might ask? Well, the point is to FORGET, not RECALL, isn't it? DayDrunk2: What a great day! Might just drink so much that I get poisoned again. - Night1: A perfect night to light some candles, drink some wine and relax. - Night2: Here's a challenge... take a shot for every time you've had to look at the wiki. Oh wait, you'd die. - Night3: Yes, everyone knows the mechworm is buggy. Well, not anymore, but still. - Night4: You lost or something? I don't mind company, but I'd rather be left alone at night. - Night5: Are you sure you're 21? ...Alright, fine, but don't tell anyone I sold you these. + Night1: A perfect night to light some candles, drink some wine, and relax. + Night2: Here's a challenge, take a shot for every time you've had to use the wiki. Oh wait, you'd die. + Night2Alt: There's more to life than challenge, y'know. Be sure to sit back and treat yourself once in a while. + Night3: You lost or something? I don't mind company, but I'd rather be left alone at night. + Night3Alt: I do love gazing at the stars. You could join me, if you like. + Night4: Are you sure you're 21? ...Alright, fine, but don't tell anyone I sold you these. NightStylist: I should watch some movies with {0} tonight. You could come too, but only if you bring snacks for us. Party: You'll always find me at parties where booze is involved... well, you'll always find BOOZE where I'M involved! AcidRain: I'm melting! Put a stop to this inclement weather this instant before it ruins my hair! diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson index 1643ae16d0..72ae489a01 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson @@ -225,7 +225,6 @@ SanguineFuryWheel.DisplayName: Sanguine Bladewheel ScorcherExplosion.DisplayName: Scorching Crystal Blast ScourgeoftheCosmosMini.DisplayName: Miniature Cosmic Scourge ScourgeoftheCosmosProj.DisplayName: Cosmic Scourge -SeashineSwordProj.DisplayName: Seashine Beam SeekingScorcherProj.DisplayName: Scorching Seeker SolarNeedle.DisplayName: Solar Needle SolsticeBeam.DisplayName: Solstice Beam diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson index 45362a6559..275aa51dbc 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson @@ -103,7 +103,6 @@ ExecutionersBladeProj.DisplayName: Executioner's Blade ExecutionersBladeStealthProj.DisplayName: Executioner's Blade ExorcismProj.DisplayName: Exorcism ExorcismShockwave.DisplayName: Exorcism Shockwave -ExorcismStar.DisplayName: Exorcism Star FantasyTalismanProj.DisplayName: Talisman FantasyTalismanStealth.DisplayName: Talisman FeatherKnifeProjectile.DisplayName: Feather Knife diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Summon.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Summon.hjson index ff757f55ba..3be6965766 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Summon.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Summon.hjson @@ -244,6 +244,7 @@ SandTornado.DisplayName: Tornado SarosAura.DisplayName: Saros Aura SarosMicrosun.DisplayName: Saros Microsun SarosSunfire.DisplayName: Saros Sunfire +SeashineSwordProj.DisplayName: Seashine Sword SeekerSummonProj.DisplayName: Soul Seeker SepulcherMinion.DisplayName: Sepulcher Shellfish.DisplayName: Shellfish diff --git a/Localization/en-US/Mods.CalamityMod.Vanilla.Wings.hjson b/Localization/en-US/Mods.CalamityMod.Vanilla.Wings.hjson index c736eca357..c5f021c106 100644 --- a/Localization/en-US/Mods.CalamityMod.Vanilla.Wings.hjson +++ b/Localization/en-US/Mods.CalamityMod.Vanilla.Wings.hjson @@ -16,8 +16,8 @@ HarpyWings: With Harpy Ring or Angel Treads equipped, most attacks sometimes launch feathers ''' LeafWings: +10 defense and permanent Dryad's Blessing -WingsNebula: Increases the pickup range of Nebula armor's nebula boosters -WingsSolar: Increases Solar Flare armor's dash velocity by 25% -WingsStardust: Greatly increases Stardust armor's stardust guardian damage and attack range TatteredFairyWings: You leave a trail of fairy dust as you fly +WingsNebula: Increases the pickup range of Nebula armor's nebula boosters +WingsSolar: Allows Solar Flare armor's dash to be used without any charges +WingsStardust: Greatly increases Stardust armor's stardust guardian damage and attack range WingsVortex: Vortex armor's stealth ability is automatically reactivated 1 second after dashing diff --git a/NPCs/Abyss/ReaperShark.cs b/NPCs/Abyss/ReaperShark.cs index 0eed46ccb3..6fb205d54a 100644 --- a/NPCs/Abyss/ReaperShark.cs +++ b/NPCs/Abyss/ReaperShark.cs @@ -115,7 +115,9 @@ namespace CalamityMod.NPCs.Abyss NPC.soundDelay = 360; if (hasBeenHit) { - SoundEngine.PlaySound(EnragedRoarSound, NPC.Center); + // Roar becomes lower pitch when crippled + float pitch = phase3 ? -0.4f : 0; + SoundEngine.PlaySound(EnragedRoarSound with { Pitch = pitch }, NPC.Center); } else { diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index d21dfd4e62..fda4fffcfb 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -6920,7 +6920,7 @@ namespace CalamityMod.NPCs WeightedRandom pool = new WeightedRandom(); pool.Add(NPCID.None, 0f); pool.Add(NPCType(), 0.025f); - pool.Add(NPCType(), 0.001f); + pool.Add(NPCType(), 0.01f); // Normal droids are replaced with plague droids in the Jungle Lab. if (nearPlagueLab) { diff --git a/NPCs/CalamityGlobalTownNPC.cs b/NPCs/CalamityGlobalTownNPC.cs index 68a3d66585..599e4f4b0b 100644 --- a/NPCs/CalamityGlobalTownNPC.cs +++ b/NPCs/CalamityGlobalTownNPC.cs @@ -212,6 +212,7 @@ namespace CalamityMod.NPCs "Amber", // <@!114677116473180169> (mishirousui) "Faith", // <@!509050283871961123> (toasty1007) "Xsiana", // <@!625780237489143839> (lokistic) + "Lain", // <@!655201622863118337> (literallyadeerfr) }; private static readonly string[] TavernkeepNames = { diff --git a/NPCs/CalamityTileCollisionHarmNPC.cs b/NPCs/CalamityTileCollisionHarmNPC.cs index c9b5f5f155..0e1c4d420a 100644 --- a/NPCs/CalamityTileCollisionHarmNPC.cs +++ b/NPCs/CalamityTileCollisionHarmNPC.cs @@ -25,6 +25,10 @@ namespace CalamityMod.NPCs private float terminalVelocityForFullFallDamage = 0; private bool CheckTiles = false; private Vector2 ForcedVel = Vector2.Zero; + /// + /// Set to true if you only want the npc to receive forced velocity and not receive damage. + /// + private bool ForceVelocityOnly = false; private bool hitVoid = false; private Player attacker; private int packetTimer = 0; @@ -43,7 +47,7 @@ namespace CalamityMod.NPCs } } - public bool FallDamageSusceptible => PotentialEnergyDamage > 0; + public bool FallDamageSusceptible => PotentialEnergyDamage > 0 || ForceVelocityOnly; public override bool InstancePerEntity => true; @@ -67,7 +71,7 @@ namespace CalamityMod.NPCs } /// - /// Sets up a NPC to recieve fall damage when they hit the ground. + /// Sets up a NPC to recieve forced velocity in a direction and receive fall damage when they hit the ground. /// /// The npc to apply fall damage to /// The player applying fall damage to the npc @@ -89,6 +93,27 @@ namespace CalamityMod.NPCs attacker = player; } + /// + /// Sets up a NPC to recieve forced velocity in a direction. + /// + /// The npc to apply velocity to + /// The player applying velocity to the npc + /// The velocity being applied to the npc + /// Will check for tiles in the collision instead of velocity + public void ApplyForcedVelocity(NPC npc, Player player, Vector2 forcedVel, bool checkTiles = false) + { + // NPCs that don't collide with tiles simply don't get velocity, lol. + if (npc.noTileCollide) + return; + + OldVelocity = npc.velocity; + OlderVelocity = npc.velocity; + CheckTiles = checkTiles; + ForcedVel = forcedVel; + attacker = player; + ForceVelocityOnly = true; + } + public override void PostAI(NPC npc) { if (FallDamageSusceptible) @@ -99,15 +124,18 @@ namespace CalamityMod.NPCs if (Collision.SolidCollision(npc.Center, (int)(npc.width * 0.5f), (int)(npc.height * 0.5f)) || !WorldGen.InWorld(npc.Center.ToTileCoordinates().X, npc.Center.ToTileCoordinates().Y, 40)) { - int wallImpactDamage = (int)(PotentialEnergyDamage * Math.Clamp(oldVelocity / terminalVelocityForFullFallDamage, 0f, 1f)); - Projectile wallImpact = Projectile.NewProjectileDirect(attacker.GetSource_FromThis(), npc.Center, Vector2.Zero, ModContent.ProjectileType(), wallImpactDamage, 0f, attacker.whoAmI, npc.whoAmI); - wallImpact.DamageType = DamageClass.Melee; + if (!ForceVelocityOnly) + { + int wallImpactDamage = (int)(PotentialEnergyDamage * Math.Clamp(oldVelocity / terminalVelocityForFullFallDamage, 0f, 1f)); + Projectile wallImpact = Projectile.NewProjectileDirect(attacker.GetSource_FromThis(), npc.Center, Vector2.Zero, ModContent.ProjectileType(), wallImpactDamage, 0f, attacker.whoAmI, npc.whoAmI); + wallImpact.DamageType = DamageClass.Melee; + } PotentialEnergyDamage = 0; + ForceVelocityOnly = false; hitVoid = false; } - oldVelocity = npc.velocity.Length(); npc.Center += ForcedVel; ForcedVel *= 0.995f; if (packetTimer % 30 == 0) @@ -138,11 +166,15 @@ namespace CalamityMod.NPCs //If the npc hit a tile/Came to a stop after falling if (newVerticalVelocity == 0 && oldVerticalVelocity > 0) //Collision.SolidCollision(npc.Center, npc.width, npc.height)) { - int impactDamage = (int)(PotentialEnergyDamage * Math.Clamp(olderVerticalVelocity / terminalVelocityForFullFallDamage, 0f, 1f)); - Projectile impact = Projectile.NewProjectileDirect(attacker.GetSource_FromThis(), npc.Center, Vector2.Zero, ModContent.ProjectileType(), impactDamage, 0f, attacker.whoAmI, npc.whoAmI); - impact.DamageType = DamageClass.Melee; + if (!ForceVelocityOnly) + { + int impactDamage = (int)(PotentialEnergyDamage * Math.Clamp(olderVerticalVelocity / terminalVelocityForFullFallDamage, 0f, 1f)); + Projectile impact = Projectile.NewProjectileDirect(attacker.GetSource_FromThis(), npc.Center, Vector2.Zero, ModContent.ProjectileType(), impactDamage, 0f, attacker.whoAmI, npc.whoAmI); + impact.DamageType = DamageClass.Melee; + } PotentialEnergyDamage = 0; + ForceVelocityOnly = false; } OlderVelocity = OldVelocity; diff --git a/NPCs/TownNPCs/FAP.cs b/NPCs/TownNPCs/FAP.cs index d84ac9ed86..8c4f00cfe8 100644 --- a/NPCs/TownNPCs/FAP.cs +++ b/NPCs/TownNPCs/FAP.cs @@ -688,8 +688,8 @@ namespace CalamityMod.NPCs.TownNPCs int wife = NPC.FindFirstNPC(NPCID.Stylist); bool isHappy = Main.ShopHelper.GetShoppingSettings(player, NPC).PriceAdjustment < 1D; - bool wifeIsHappy = Main.ShopHelper.GetShoppingSettings(player, Main.npc[wife]).PriceAdjustment < 1D; bool wifeIsAround = wife != -1; + bool wifeIsHappy = wifeIsAround ? Main.ShopHelper.GetShoppingSettings(player, Main.npc[wife]).PriceAdjustment < 1D : false; bool worldIsSafer = NPC.downedMoonlord; bool beLessDrunk = wifeIsAround && worldIsSafer; @@ -715,7 +715,9 @@ namespace CalamityMod.NPCs.TownNPCs { dialogue.Add(this.GetLocalizedValue("Chat.Normal1")); dialogue.Add(this.GetLocalizedValue("Chat.Normal2")); - dialogue.Add(this.GetLocalizedValue("Chat.Normal3")); + + if (Main.zenithWorld) + dialogue.Add(this.GetLocalizedValue("Chat.Normal3")); if (ChildSafety.Disabled) dialogue.Add(this.GetLocalizedValue("Chat.Normal4")); @@ -776,10 +778,27 @@ namespace CalamityMod.NPCs.TownNPCs if (Main.dayTime) { - dialogue.Add(this.GetLocalizedValue("Chat.Day1")); - dialogue.Add(this.GetLocalizedValue("Chat.Day2")); - dialogue.Add(this.GetLocalizedValue("Chat.Day3")); - dialogue.Add(this.GetLocalizedValue("Chat.Day4")); + if (!beLessDrunk) + { + dialogue.Add(this.GetLocalizedValue("Chat.Day1")); + dialogue.Add(this.GetLocalizedValue("Chat.Day2")); + dialogue.Add(this.GetLocalizedValue("Chat.Day3")); + } + else + { + dialogue.Add(this.GetLocalizedValue("Chat.Day1Alt")); + dialogue.Add(this.GetLocalizedValue("Chat.Day2Alt")); + dialogue.Add(this.GetLocalizedValue("Chat.Day3Alt")); + } + + if (!isHappy) + { + int annoyingChild = NPC.FindFirstNPC(NPCID.Angler); + if (annoyingChild != -1) + dialogue.Add(this.GetLocalization("Chat.Day4").Format(Main.npc[annoyingChild].GivenName)); + } + else + dialogue.Add(this.GetLocalizedValue("Chat.Day4Alt")); if (beLessDrunk) { @@ -795,10 +814,21 @@ namespace CalamityMod.NPCs.TownNPCs else { dialogue.Add(this.GetLocalizedValue("Chat.Night1")); - dialogue.Add(this.GetLocalizedValue("Chat.Night2")); - dialogue.Add(this.GetLocalizedValue("Chat.Night3")); + + if (!isHappy) + { + if (Main.zenithWorld) + dialogue.Add(this.GetLocalizedValue("Chat.Night2")); + + dialogue.Add(this.GetLocalizedValue("Chat.Night3")); + } + else + { + dialogue.Add(this.GetLocalizedValue("Chat.Night2Alt")); + dialogue.Add(this.GetLocalizedValue("Chat.Night3Alt")); + } + dialogue.Add(this.GetLocalizedValue("Chat.Night4")); - dialogue.Add(this.GetLocalizedValue("Chat.Night5")); if (wifeIsAround) dialogue.Add(this.GetLocalization("Chat.NightStylist").Format(Main.npc[wife].GivenName)); diff --git a/Particles/BloomLineSoftEdge.png b/Particles/BloomLineSoftEdge.png new file mode 100644 index 0000000000..dc89fb2a82 Binary files /dev/null and b/Particles/BloomLineSoftEdge.png differ diff --git a/Particles/CustomSpark.cs b/Particles/CustomSpark.cs index f0fdc3c22b..eec7780240 100644 --- a/Particles/CustomSpark.cs +++ b/Particles/CustomSpark.cs @@ -20,13 +20,14 @@ namespace CalamityMod.Particles public Vector2 Stretch = new Vector2(0.5f, 1.6f); public float ShrinkSpeed = 0; public bool FlipHorizontal = false; + public bool NoShrink = false; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public bool AltVisual = true; public override bool UseAdditiveBlend => AltVisual; public override bool SetLifetime => true; public override bool UseCustomDraw => true; - public CustomSpark(Vector2 relativePosition, Vector2 velocity, string texture, bool affectedByGravity, int lifetime, float scale, Color color, Vector2 stretch, bool useAddativeBlend = true, bool glowCenter = false, float extraRotation = 0, bool fadeIn = false, bool affectedByLight = false, float shrinkSpeed = 0, float glowCenterScale = 1, float glowOpacity = 1, bool flipHorizontal = false) + public CustomSpark(Vector2 relativePosition, Vector2 velocity, string texture, bool affectedByGravity, int lifetime, float scale, Color color, Vector2 stretch, bool useAddativeBlend = true, bool glowCenter = false, float extraRotation = 0, bool fadeIn = false, bool affectedByLight = false, float shrinkSpeed = 0, float glowCenterScale = 1, float glowOpacity = 1, bool flipHorizontal = false, bool noShrink = false) { Position = relativePosition; Velocity = velocity; @@ -46,6 +47,7 @@ namespace CalamityMod.Particles GlowCenterScale = glowCenterScale; GlowOpacity = glowOpacity; FlipHorizontal = flipHorizontal; + NoShrink = noShrink; FadeIn = fadeIn; @@ -57,7 +59,8 @@ namespace CalamityMod.Particles { if (!FadeIn) { - Scale *= 0.95f; + if (!NoShrink) + Scale *= 0.95f; Color = Color.Lerp(InitialColor, Color.Transparent, (float)Math.Pow(LifetimeCompletion, 3D)); } else diff --git a/Particles/GlowBlade.png b/Particles/GlowBlade.png new file mode 100644 index 0000000000..3b0ee2a739 Binary files /dev/null and b/Particles/GlowBlade.png differ diff --git a/Particles/SeaPrismParticle.cs b/Particles/SeaPrismParticle.cs index 5df125c14e..9c33915342 100644 --- a/Particles/SeaPrismParticle.cs +++ b/Particles/SeaPrismParticle.cs @@ -50,7 +50,7 @@ namespace CalamityMod.Particles if (FadeIn) Scale = 0f; - Variant = Main.rand.Next(6); + Variant = Main.rand.Next(3); } public override void Update() diff --git a/Projectiles/BaseProjectiles/BaseCustomUseStyleProjectile.cs b/Projectiles/BaseProjectiles/BaseCustomUseStyleProjectile.cs index b99150bbcb..6e413c3fd5 100644 --- a/Projectiles/BaseProjectiles/BaseCustomUseStyleProjectile.cs +++ b/Projectiles/BaseProjectiles/BaseCustomUseStyleProjectile.cs @@ -12,9 +12,12 @@ namespace CalamityMod.Projectiles.BaseProjectiles { public abstract class BaseCustomUseStyleProjectile : ModProjectile { - + public bool whenSpawned = true; public override void SetDefaults() { + // Width and height are set here so it can destroy cobwebs better lol + Projectile.width = (int)Math.Max(HitboxSize.X, 1); + Projectile.height = (int)Math.Max(HitboxSize.Y, 1); Projectile.friendly = true; Projectile.tileCollide = false; Projectile.penetrate = -1; @@ -149,6 +152,10 @@ namespace CalamityMod.Projectiles.BaseProjectiles /// public virtual void ResetStyle() { } + /// + /// Determines the behavior of the projectile when spawned. (but it is multiplayer synced) + /// + public virtual void WhenSpawned() { } /// /// Determines the behavior of the projectile when the item is in use. /// @@ -167,6 +174,14 @@ namespace CalamityMod.Projectiles.BaseProjectiles public override void AI() { + if (whenSpawned) + { + WhenSpawned(); + whenSpawned = false; + Projectile.timeLeft = Owner.HeldItem.useAnimation + 1; + Projectile.netUpdate = true; + } + bool ItemAnimationActive = Owner.ItemAnimationActive; if (Owner.HeldItem.type != AssignedItemID || Owner.dead) diff --git a/Projectiles/Melee/BalefulHarvesterHoldout.cs b/Projectiles/Melee/BalefulHarvesterHoldout.cs index bcb77bd920..3363445afd 100644 --- a/Projectiles/Melee/BalefulHarvesterHoldout.cs +++ b/Projectiles/Melee/BalefulHarvesterHoldout.cs @@ -42,12 +42,11 @@ namespace CalamityMod.Projectiles.Melee Projectile.DamageType = TrueMeleeDamageClass.Instance; } - public override void OnSpawn(IEntitySource source) + public override void WhenSpawned() { Projectile.knockBack = 0; Projectile.scale = 1; Projectile.ai[1] = -1; - base.OnSpawn(source); mousePos = Owner.Calamity().mouseWorld; aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; diff --git a/Projectiles/Melee/BasherHoldout.cs b/Projectiles/Melee/BasherHoldout.cs index 1e2b9dd04c..defc0b40a2 100644 --- a/Projectiles/Melee/BasherHoldout.cs +++ b/Projectiles/Melee/BasherHoldout.cs @@ -42,12 +42,11 @@ namespace CalamityMod.Projectiles.Melee Projectile.localNPCHitCooldown = -1; Projectile.DamageType = TrueMeleeDamageClass.Instance; } - public override void OnSpawn(IEntitySource source) + public override void WhenSpawned() { Projectile.knockBack = 0; Projectile.scale = 1; Projectile.ai[1] = 1; - base.OnSpawn(source); // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction mousePos = Owner.Calamity().mouseWorld; aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; diff --git a/Projectiles/Melee/BrokenBiomeBlade_PureClarity.cs b/Projectiles/Melee/BrokenBiomeBlade_PureClarity.cs index 2b5428f25b..2f5da2023e 100644 --- a/Projectiles/Melee/BrokenBiomeBlade_PureClarity.cs +++ b/Projectiles/Melee/BrokenBiomeBlade_PureClarity.cs @@ -37,10 +37,9 @@ namespace CalamityMod.Projectiles.Melee Projectile.localNPCHitCooldown = -1; } - public override void OnSpawn(IEntitySource source) + public override void WhenSpawned() { SwingDir = 1f; - base.OnSpawn(source); mousePos = Owner.Calamity().mouseWorld; aimPos = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; useAnimation = Owner.itemAnimationMax; diff --git a/Projectiles/Melee/CometQuasherHoldout.cs b/Projectiles/Melee/CometQuasherHoldout.cs index c06fb4e466..ab6c6ec2b2 100644 --- a/Projectiles/Melee/CometQuasherHoldout.cs +++ b/Projectiles/Melee/CometQuasherHoldout.cs @@ -41,12 +41,11 @@ namespace CalamityMod.Projectiles.Melee Projectile.localNPCHitCooldown = -1; Projectile.DamageType = TrueMeleeDamageClass.Instance; } - public override void OnSpawn(IEntitySource source) + public override void WhenSpawned() { Projectile.knockBack = 0; Projectile.scale = 1; Projectile.ai[1] = -1; - base.OnSpawn(source); // 14NOV2024: Ozzatron: clamped mouse position unnecessary, it does not influence Comet Quasher's projectile spawning mousePos = Owner.Calamity().mouseWorld; diff --git a/Projectiles/Melee/DevilsDevastationHoldout.cs b/Projectiles/Melee/DevilsDevastationHoldout.cs index aa594d8fff..6f506700ea 100644 --- a/Projectiles/Melee/DevilsDevastationHoldout.cs +++ b/Projectiles/Melee/DevilsDevastationHoldout.cs @@ -62,7 +62,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.localNPCHitCooldown = -1; Projectile.DamageType = TrueMeleeDamageClass.Instance; } - public override void OnSpawn(IEntitySource source) + public override void WhenSpawned() { IgnoreActiveAnimation = true; DrawUnconditionally = true; @@ -70,7 +70,6 @@ namespace CalamityMod.Projectiles.Melee Projectile.knockBack = 0; Projectile.scale = 1.15f; Projectile.ai[1] = -1; - base.OnSpawn(source); // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction mousePos = Owner.Calamity().mouseWorld; aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; diff --git a/Projectiles/Melee/EarthHoldout.cs b/Projectiles/Melee/EarthHoldout.cs index 5c2c17864d..32426601ca 100644 --- a/Projectiles/Melee/EarthHoldout.cs +++ b/Projectiles/Melee/EarthHoldout.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Melee public override Vector2 HitboxSize => new Vector2(288, 288) * (1 + bladeFade * 1.2f); public override float HitboxRotationOffset => MathHelper.ToRadians(-45); - public override Vector2 SpriteOrigin => new(-3, 186f); + public override Vector2 SpriteOrigin => new(0, 186f); public Vector2 mousePos; public Vector2 aimVel; public bool doSwing = true; @@ -48,12 +48,11 @@ namespace CalamityMod.Projectiles.Melee Projectile.localNPCHitCooldown = -1; Projectile.DamageType = TrueMeleeDamageClass.Instance; } - public override void OnSpawn(IEntitySource source) + public override void WhenSpawned() { Projectile.knockBack = 0; Projectile.scale = 1; Projectile.ai[1] = 1; - base.OnSpawn(source); // 14NOV2024: Ozzatron: clamped mouse position unnecessary, it does not influence Earth's projectile spawning mousePos = Owner.Calamity().mouseWorld; @@ -101,7 +100,7 @@ namespace CalamityMod.Projectiles.Melee if (CanHit) fadeIn = MathHelper.Lerp(fadeIn, 1, 0.2f); else - fadeIn = MathHelper.Lerp(fadeIn, 0, 0.25f); + fadeIn = MathHelper.Lerp(fadeIn, 0, 0.28f); if (Projectile.ai[1] == -1) bladeFade = MathHelper.Lerp(bladeFade, 1, 0.15f); @@ -379,11 +378,14 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < draws; i++) { + bool swordTip = i > draws * 0.73f; + float swordTipScale = swordTip ? Utils.Remap(i, (int)(draws * 0.73f), draws, 0.9f, 0.35f) : 1; Vector2 offsetDir = Vector2.One.RotatedBy(Projectile.rotation + RotationOffset + MathHelper.ToRadians(90)); - Color auraColor = Color.Lerp(mainColor, Color.Lerp(mainColor, Color.White, 0.7f), Utils.GetLerpValue(0, draws - 1, i)) with { A = 0 } * 0.38f * bladeFade; + Color bladeColor = Color.Lerp(Color.MediumTurquoise, Color.Lerp(Color.LimeGreen, Color.OrangeRed, (i * 0.8f) / draws), i / (draws * 0.6f)); + Color auraColor = Color.Lerp(bladeColor, Color.White, 0.2f) with { A = 0 } * 0.4f * bladeFade; Vector2 drawOffset = -offsetDir * 9 * i * bladeFade; - Main.EntitySpriteDraw(tex2.Value, Projectile.Center - offsetDir * 70 - Main.screenPosition + drawOffset + new Vector2(0, Owner.gfxOffY) + Main.rand.NextVector2Circular(2, 2), tex2.Frame(1, FrameCount, 0, Frame), auraColor, Projectile.rotation + RotationOffset + r, tex2.Size() * 0.5f, Vector2.One * (1f - i * 0.03f) * 0.7f * bladeFade * spriteMult, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); + Main.EntitySpriteDraw(tex2.Value, Projectile.Center - offsetDir * 70 - Main.screenPosition + drawOffset + new Vector2(0, Owner.gfxOffY) + Main.rand.NextVector2Circular(2, 2), tex2.Frame(1, FrameCount, 0, Frame), auraColor, RotationOffset + Projectile.rotation + MathHelper.ToRadians(45), tex2.Size() * 0.5f, new Vector2(0.7f * swordTipScale, 1f) * (0.75f * swordTipScale) * 0.7f * bladeFade * spriteMult, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); } Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), tex.Frame(1, FrameCount, 0, Frame), lightColor, 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)); diff --git a/Projectiles/Melee/ExaltedOathbladeHoldout.cs b/Projectiles/Melee/ExaltedOathbladeHoldout.cs index 23ca636df8..3512cfa0cd 100644 --- a/Projectiles/Melee/ExaltedOathbladeHoldout.cs +++ b/Projectiles/Melee/ExaltedOathbladeHoldout.cs @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.localNPCHitCooldown = -1; Projectile.DamageType = TrueMeleeDamageClass.Instance; } - public override void OnSpawn(IEntitySource source) + public override void WhenSpawned() { IgnoreActiveAnimation = true; DrawUnconditionally = true; @@ -62,7 +62,6 @@ namespace CalamityMod.Projectiles.Melee Projectile.knockBack = 0; Projectile.scale = 1.15f; Projectile.ai[1] = -1; - base.OnSpawn(source); // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction mousePos = Owner.Calamity().mouseWorld; aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; diff --git a/Projectiles/Melee/ForbiddenOathbladeHoldout.cs b/Projectiles/Melee/ForbiddenOathbladeHoldout.cs index b42a40d9ca..edbf65fe72 100644 --- a/Projectiles/Melee/ForbiddenOathbladeHoldout.cs +++ b/Projectiles/Melee/ForbiddenOathbladeHoldout.cs @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.localNPCHitCooldown = -1; Projectile.DamageType = TrueMeleeDamageClass.Instance; } - public override void OnSpawn(IEntitySource source) + public override void WhenSpawned() { IgnoreActiveAnimation = true; DrawUnconditionally = true; @@ -62,7 +62,6 @@ namespace CalamityMod.Projectiles.Melee Projectile.knockBack = 0; Projectile.scale = 1.15f; Projectile.ai[1] = -1; - base.OnSpawn(source); // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction mousePos = Owner.Calamity().mouseWorld; aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; diff --git a/Projectiles/Melee/GrandDadHoldout.cs b/Projectiles/Melee/GrandDadHoldout.cs index f011482728..da3aea142e 100644 --- a/Projectiles/Melee/GrandDadHoldout.cs +++ b/Projectiles/Melee/GrandDadHoldout.cs @@ -40,9 +40,6 @@ namespace CalamityMod.Projectiles.Melee public bool swingSound = true; private NPC target => Main.npc[(int)Projectile.ai[0]]; - private bool hasSpawned; - private bool hasHit; - private int damageDone; public override void SetDefaults() { @@ -52,109 +49,26 @@ namespace CalamityMod.Projectiles.Melee Projectile.DamageType = TrueMeleeDamageClass.Instance; } - public override void OnSpawn(IEntitySource source) + public override void WhenSpawned() { - base.OnSpawn(source); + Projectile.timeLeft = Owner.HeldItem.useAnimation + 1; + Projectile.knockBack = 0; + Projectile.scale = 1; + Projectile.ai[1] = -1; + + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, as Grand Dad has no projectiles + mousePos = Owner.Calamity().mouseWorld; + aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + useAnim = Owner.itemAnimationMax; + + if (mousePos.X < Owner.Center.X) Owner.direction = -1; + else Owner.direction = 1; + + FlipAsSword = Owner.direction == -1; } public override void UseStyle() { - /* - * OnSpawn() method implemented inside AI(). - * This is done for MP syncing. - */ - if (!hasSpawned) - { - Projectile.timeLeft = Owner.HeldItem.useAnimation + 1; - Projectile.knockBack = 0; - Projectile.scale = 1; - Projectile.ai[1] = -1; - - // 14NOV2024: Ozzatron: clamped mouse position unnecessary, as Grand Dad has no projectiles - mousePos = Owner.Calamity().mouseWorld; - aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; - useAnim = Owner.itemAnimationMax; - - if (mousePos.X < Owner.Center.X) Owner.direction = -1; - else Owner.direction = 1; - - FlipAsSword = Owner.direction == -1; - hasSpawned = true; - } - - /* - * OnHitNPC() method implemented inside AI(). - * This is done for MP syncing. - */ - if (hasHit) - { - if ((damageDone <= 2 || (target.life <= 0 && target.realLife == -1)) && Projectile.numHits > 0) - Projectile.numHits -= 1; - - SoundStyle fire = new("CalamityMod/Sounds/NPCHit/ThanatosHitOpen1"); - SoundEngine.PlaySound(fire with { Volume = 0.75f, Pitch = -0.1f }, Projectile.Center); - SoundStyle fire2 = new("CalamityMod/Sounds/Item/FinalDawnSlash"); - SoundEngine.PlaySound(fire2 with { Volume = 0.65f, Pitch = Main.rand.NextFloat(-0.2f, -0.3f) }, Projectile.Center); - if (Main.zenithWorld && Projectile.numHits == 0 && target.type != ModContent.NPCType() && Main.rand.NextBool(5)) - { - SoundStyle fire3 = new("CalamityMod/Sounds/Item/GFBScreams/Scream", 8); - SoundEngine.PlaySound(fire3 with { Volume = 0.8f }, Projectile.Center); - } - if (Projectile.numHits == 0) - { - Owner.Calamity().GeneralScreenShakePower = 6.5f; - } - - int heal = (int)MathHelper.Clamp(20 - Projectile.numHits * 12, 1, 20); - if (Projectile.numHits < 10) - { - Owner.HealPlayer(heal); - } - - if (target.CanBeMoved(true) || Main.zenithWorld || target.type == ModContent.NPCType() || (DownedBossSystem.downedCalamitas && DownedBossSystem.downedExoMechs)) - { - if (target.type == ModContent.NPCType()) - { - CombatText.NewText(target.Hitbox, Color.Aqua, CalamityUtils.GetTextValue("Misc.HecBoop")); - SoundStyle boop = new("CalamityMod/Sounds/Item/SnootBooped"); - SoundEngine.PlaySound(boop with { Pitch = Main.rand.NextFloat(-0.15f, 0.15f) }, Projectile.Center); - } - - bool rightClicked = Owner.Calamity().mouseRight; - - // Make all hit enemies able to hit tiles, so you can dunk them - target.noTileCollide = false; - - // Launch the suckers - Vector2 launchVel = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld); - float launchPower = (Main.zenithWorld ? 50 : 30) * (rightClicked ? 2 : 1); - target.MoveNPC(launchVel, launchPower * 0.5f, true); - - // Remove knockback resist, just like it used to - target.knockBackResist = 1; - - // Apply tile collison damage (is bonus on GFB and even further is both final bosses are gone) - target.FlungNPC().ApplyCollisionDamage(target, Owner, Projectile.damage * (Main.zenithWorld ? (DownedBossSystem.downedCalamitas && DownedBossSystem.downedExoMechs ? 1000 : 77) : 3) * (rightClicked ? 3 : 1), launchVel * launchPower, 5f, true); - } - - if (Projectile.numHits < 3) - { - Particle spark = new VoidSparkParticle(target.Center, (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * (-45 + Projectile.numHits * 5), false, (int)(16 - Projectile.numHits * 3), 0.6f - Projectile.numHits * 0.15f, Color.DodgerBlue, 0.45f); - GeneralParticleHandler.SpawnParticle(spark); - } - - for (int i = 0; i < MathHelper.Clamp(10 - Projectile.numHits * 2, 2, 10); i++) - { - Particle spark2 = new SparkParticle(target.Center, ((Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -35).RotatedByRandom(0.7) * Main.rand.NextFloat(0.2f, 1f), false, 55, Main.rand.NextFloat(0.4f, 1.5f), Main.rand.NextBool(4) ? Color.DodgerBlue : Color.Blue); - GeneralParticleHandler.SpawnParticle(spark2); - Dust dust = Dust.NewDustPerfect(target.Center, ModContent.DustType(), ((Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -35).RotatedByRandom(0.7) * Main.rand.NextFloat(0.2f, 1f), 0, default, Main.rand.NextFloat(1.55f, 2.2f)); - dust.noGravity = true; - dust.color = Main.rand.NextBool() ? Color.DodgerBlue : Color.Blue; - } - - hasHit = false; - } - AnimationProgress = Animation % useAnim; DrawUnconditionally = false; @@ -294,10 +208,69 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - Projectile.ai[0] = target.whoAmI; - this.damageDone = damageDone; - hasHit = true; - Projectile.ForceNetUpdate(); + if ((damageDone <= 2 || (target.life <= 0 && target.realLife == -1)) && Projectile.numHits > 0) + Projectile.numHits -= 1; + + SoundStyle fire = new("CalamityMod/Sounds/NPCHit/ThanatosHitOpen1"); + SoundEngine.PlaySound(fire with { Volume = 0.75f, Pitch = -0.1f }, Projectile.Center); + SoundStyle fire2 = new("CalamityMod/Sounds/Item/FinalDawnSlash"); + SoundEngine.PlaySound(fire2 with { Volume = 0.65f, Pitch = Main.rand.NextFloat(-0.2f, -0.3f) }, Projectile.Center); + if (Main.zenithWorld && Projectile.numHits == 0 && target.type != ModContent.NPCType() && Main.rand.NextBool(5)) + { + SoundStyle fire3 = new("CalamityMod/Sounds/Item/GFBScreams/Scream", 8); + SoundEngine.PlaySound(fire3 with { Volume = 0.8f }, Projectile.Center); + } + if (Projectile.numHits == 0) + { + Owner.Calamity().GeneralScreenShakePower = 6.5f; + } + + int heal = (int)(MathHelper.Clamp(20 - Projectile.numHits * 12, 1, 20)); + if (Projectile.numHits < 10) + { + Owner.HealPlayer(heal); + } + + if (target.CanBeMoved(true) || Main.zenithWorld || target.type == ModContent.NPCType() || (DownedBossSystem.downedCalamitas && DownedBossSystem.downedExoMechs)) + { + if (target.type == ModContent.NPCType()) + { + CombatText.NewText(target.Hitbox, Color.Aqua, CalamityUtils.GetTextValue("Misc.HecBoop")); + SoundStyle boop = new("CalamityMod/Sounds/Item/SnootBooped"); + SoundEngine.PlaySound(boop with { Pitch = Main.rand.NextFloat(-0.15f, 0.15f) }, Projectile.Center); + } + + bool rightClicked = Owner.Calamity().mouseRight; + + // Make all hit enemies able to hit tiles, so you can dunk them + target.noTileCollide = false; + + // Launch the suckers + Vector2 launchVel = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld); + float launchPower = (Main.zenithWorld ? 50 : 30) * (rightClicked ? 2 : 1); + target.MoveNPC(launchVel, launchPower * 0.5f, true); + + // Remove knockback resist, just like it used to + target.knockBackResist = 1; + + // Apply tile collison damage (is bonus on GFB and even further is both final bosses are gone) + target.FlungNPC().ApplyCollisionDamage(target, Owner, Projectile.damage * (Main.zenithWorld ? (DownedBossSystem.downedCalamitas && DownedBossSystem.downedExoMechs ? 1000 : 77) : 3) * (rightClicked ? 3 : 1), launchVel * launchPower, 5f, true); + } + + if (Projectile.numHits < 3) + { + Particle spark = new VoidSparkParticle(target.Center, (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * (-45 + Projectile.numHits * 5), false, (int)(16 - Projectile.numHits * 3), 0.6f - Projectile.numHits * 0.15f, Color.DodgerBlue, 0.45f); + GeneralParticleHandler.SpawnParticle(spark); + } + + for (int i = 0; i < MathHelper.Clamp(10 - Projectile.numHits * 2, 2, 10); i++) + { + Particle spark2 = new SparkParticle(target.Center, ((Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -35).RotatedByRandom(0.7) * Main.rand.NextFloat(0.2f, 1f), false, 55, Main.rand.NextFloat(0.4f, 1.5f), Main.rand.NextBool(4) ? Color.DodgerBlue : Color.Blue); + GeneralParticleHandler.SpawnParticle(spark2); + Dust dust = Dust.NewDustPerfect(target.Center, ModContent.DustType(), ((Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -35).RotatedByRandom(0.7) * Main.rand.NextFloat(0.2f, 1f), 0, default, Main.rand.NextFloat(1.55f, 2.2f)); + dust.noGravity = true; + dust.color = Main.rand.NextBool() ? Color.DodgerBlue : Color.Blue; + } } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) @@ -341,17 +314,5 @@ namespace CalamityMod.Projectiles.Melee } return false; } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(hasHit); - writer.Write(damageDone); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - hasHit = reader.ReadBoolean(); - damageDone = reader.ReadInt32(); - } } } diff --git a/Projectiles/Melee/GrandGuardianHoldout.cs b/Projectiles/Melee/GrandGuardianHoldout.cs index 485229f91a..41156a4121 100644 --- a/Projectiles/Melee/GrandGuardianHoldout.cs +++ b/Projectiles/Melee/GrandGuardianHoldout.cs @@ -46,12 +46,11 @@ namespace CalamityMod.Projectiles.Melee Projectile.localNPCHitCooldown = -1; Projectile.DamageType = TrueMeleeDamageClass.Instance; } - public override void OnSpawn(IEntitySource source) + public override void WhenSpawned() { Projectile.knockBack = 0; Projectile.scale = 1; Projectile.ai[1] = 1; - base.OnSpawn(source); // 14NOV2024: Ozzatron: clamped mouse position unnecessary, as Grand Guardian has no projectiles mousePos = Owner.Calamity().mouseWorld; diff --git a/Projectiles/Melee/HellkiteHoldout.cs b/Projectiles/Melee/HellkiteHoldout.cs index b0fcd9f6c6..a268bfaeb9 100644 --- a/Projectiles/Melee/HellkiteHoldout.cs +++ b/Projectiles/Melee/HellkiteHoldout.cs @@ -52,13 +52,12 @@ namespace CalamityMod.Projectiles.Melee Projectile.localNPCHitCooldown = -1; Projectile.DamageType = TrueMeleeDamageClass.Instance; } - public override void OnSpawn(IEntitySource source) + public override void WhenSpawned() { CanHit = false; Projectile.knockBack = 0; Projectile.scale = 1; Projectile.ai[1] = -1; - base.OnSpawn(source); // 14NOV2024: Ozzatron: clamped mouse position unnecessary, as Hellkite has no projectiles mousePos = Owner.Calamity().mouseWorld; diff --git a/Projectiles/Melee/HolyColliderHoldout.cs b/Projectiles/Melee/HolyColliderHoldout.cs index 483b0807d4..d342eee4c5 100644 --- a/Projectiles/Melee/HolyColliderHoldout.cs +++ b/Projectiles/Melee/HolyColliderHoldout.cs @@ -55,12 +55,11 @@ namespace CalamityMod.Projectiles.Melee Projectile.localNPCHitCooldown = -1; Projectile.DamageType = TrueMeleeDamageClass.Instance; } - public override void OnSpawn(IEntitySource source) + public override void WhenSpawned() { Projectile.knockBack = 0; Projectile.scale = 1; Projectile.ai[1] = -1; - base.OnSpawn(source); // 14NOV2024: Ozzatron: clamped mouse position unnecessary, it does not influence Holy Collider's projectile spawning mousePos = Owner.Calamity().mouseWorld; diff --git a/Projectiles/Melee/MajesticGuardHoldout.cs b/Projectiles/Melee/MajesticGuardHoldout.cs index 3fbac724c3..0e1d75a86c 100644 --- a/Projectiles/Melee/MajesticGuardHoldout.cs +++ b/Projectiles/Melee/MajesticGuardHoldout.cs @@ -41,12 +41,11 @@ namespace CalamityMod.Projectiles.Melee Projectile.localNPCHitCooldown = -1; Projectile.DamageType = TrueMeleeDamageClass.Instance; } - public override void OnSpawn(IEntitySource source) + public override void WhenSpawned() { Projectile.knockBack = 0; Projectile.scale = 1; Projectile.ai[1] = 1; - base.OnSpawn(source); // 14NOV2024: Ozzatron: clamped mouse position unnecessary, as Majestic Guard has no projectiles mousePos = Owner.Calamity().mouseWorld; diff --git a/Projectiles/Melee/MantisClawHoldout.cs b/Projectiles/Melee/MantisClawHoldout.cs index 15eeb01f2f..190f752a77 100644 --- a/Projectiles/Melee/MantisClawHoldout.cs +++ b/Projectiles/Melee/MantisClawHoldout.cs @@ -270,6 +270,6 @@ namespace CalamityMod.Projectiles.Melee // The holdout cannot deal damage. public override bool? CanDamage() => false; - public override void OnSpawn(IEntitySource source) => Projectile.scale = 0f; + public override void WhenSpawned() => Projectile.scale = 0f; } } diff --git a/Projectiles/Melee/MendedBiomeBlade_TruePureClarity.cs b/Projectiles/Melee/MendedBiomeBlade_TruePureClarity.cs index 921c229c71..644d52dd2e 100644 --- a/Projectiles/Melee/MendedBiomeBlade_TruePureClarity.cs +++ b/Projectiles/Melee/MendedBiomeBlade_TruePureClarity.cs @@ -48,10 +48,9 @@ namespace CalamityMod.Projectiles.Melee Projectile.localNPCHitCooldown = -1; } - public override void OnSpawn(IEntitySource source) + public override void WhenSpawned() { SwingDir = 1f; - base.OnSpawn(source); mousePos = Owner.Calamity().mouseWorld; aimPos = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; useAnimation = Owner.itemAnimationMax; diff --git a/Projectiles/Melee/OldLordClaymoreHoldout.cs b/Projectiles/Melee/OldLordClaymoreHoldout.cs index e7daa112c0..d2b6619595 100644 --- a/Projectiles/Melee/OldLordClaymoreHoldout.cs +++ b/Projectiles/Melee/OldLordClaymoreHoldout.cs @@ -46,13 +46,12 @@ namespace CalamityMod.Projectiles.Melee Projectile.localNPCHitCooldown = -1; Projectile.DamageType = TrueMeleeDamageClass.Instance; } - public override void OnSpawn(IEntitySource source) + public override void WhenSpawned() { CanHit = false; Projectile.knockBack = 0; Projectile.scale = 1.15f; // Needs to be slightly bigger for viablility Projectile.ai[1] = -1; - base.OnSpawn(source); // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction mousePos = Owner.Calamity().mouseWorld; aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; diff --git a/Projectiles/Melee/SeashineSwordProj.cs b/Projectiles/Melee/SeashineSwordProj.cs deleted file mode 100644 index 00272dd585..0000000000 --- a/Projectiles/Melee/SeashineSwordProj.cs +++ /dev/null @@ -1,119 +0,0 @@ -using System; -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class SeashineSwordProj : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - - private const int TimeLeft = 600; - - private const int MaxAlpha = 255; - - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Type] = 10; - ProjectileID.Sets.TrailingMode[Type] = 1; - } - - public override void SetDefaults() - { - Projectile.width = 16; - Projectile.height = 16; - Projectile.friendly = true; - Projectile.penetrate = 1; - Projectile.tileCollide = true; - Projectile.DamageType = DamageClass.Melee; - Projectile.timeLeft = TimeLeft; - Projectile.alpha = MaxAlpha; - } - - public override void AI() - { - Lighting.AddLight(Projectile.Center, 0f, (byte.MaxValue - Projectile.alpha) * 0.5f / byte.MaxValue, (byte.MaxValue - Projectile.alpha) * 0.5f / byte.MaxValue); - - if (Projectile.localAI[1] < 7f) - { - Projectile.localAI[1] += 1f; - } - else - { - float dustScale = 1.8f * Projectile.scale; - int dust = Dust.NewDust(new Vector2(Projectile.position.X - Projectile.velocity.X + 2f, Projectile.position.Y + 2f - Projectile.velocity.Y), 8, 8, DustID.Flare_Blue, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, Projectile.alpha, default, dustScale); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= -0.25f; - - dust = Dust.NewDust(new Vector2(Projectile.position.X - Projectile.velocity.X + 2f, Projectile.position.Y + 2f - Projectile.velocity.Y), 8, 8, DustID.Flare_Blue, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, Projectile.alpha, default, dustScale); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= -0.25f; - Main.dust[dust].position -= Projectile.velocity * 0.5f; - - if (Projectile.localAI[0] == 0f) - { - Projectile.scale -= 0.02f; - Projectile.alpha += 10; - if (Projectile.alpha >= MaxAlpha - 5) - { - Projectile.alpha = MaxAlpha; - Projectile.localAI[0] = 1f; - } - } - else if (Projectile.localAI[0] == 1f) - { - Projectile.scale += 0.02f; - Projectile.alpha -= 10; - if (Projectile.alpha <= 0) - { - Projectile.alpha = 0; - Projectile.localAI[0] = 0f; - } - } - } - - if (Projectile.ai[1] == 0f) - { - Projectile.ai[1] = 1f; - SoundEngine.PlaySound(SoundID.Item8, Projectile.Center); - } - - Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver4; - } - - public override bool PreDraw(ref Color lightColor) - { - if (Projectile.timeLeft > TimeLeft - 5) - return false; - - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2); - return false; - } - public override Color? GetAlpha(Color lightColor) => new Color(128, byte.MaxValue, byte.MaxValue); - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 60); - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 60); - public override void OnKill(int timeLeft) - { - SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); - - for (int i = 4; i < 31; i++) - { - float oldXVel = Projectile.oldVelocity.X * (30f / (float)i); - float oldYVel = Projectile.oldVelocity.Y * (30f / (float)i); - - float dustScale = 3.6f * Projectile.scale; - int dust = Dust.NewDust(new Vector2(Projectile.oldPosition.X - oldXVel * 0.5f, Projectile.oldPosition.Y - oldYVel * 0.5f), 8, 8, DustID.Flare_Blue, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, Projectile.alpha, default, dustScale); - Main.dust[dust].noGravity = true; - - dustScale = 3f * Projectile.scale; - dust = Dust.NewDust(new Vector2(Projectile.oldPosition.X - oldXVel * 0.5f, Projectile.oldPosition.Y - oldYVel * 0.5f), 8, 8, DustID.Flare_Blue, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, Projectile.alpha, default, dustScale); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 0.1f; - } - } - } -} diff --git a/Projectiles/Melee/SkytideDragoonHoldout.cs b/Projectiles/Melee/SkytideDragoonHoldout.cs index 9d0c626cb5..bda0458693 100644 --- a/Projectiles/Melee/SkytideDragoonHoldout.cs +++ b/Projectiles/Melee/SkytideDragoonHoldout.cs @@ -52,12 +52,11 @@ namespace CalamityMod.Projectiles.Melee Projectile.localNPCHitCooldown = -1; Projectile.DamageType = DamageClass.Melee; } - public override void OnSpawn(IEntitySource source) + public override void WhenSpawned() { Projectile.knockBack = 0; Projectile.scale = 1; Projectile.ai[1] = 1; - base.OnSpawn(source); mousePos = Owner.Calamity().mouseWorld; aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; diff --git a/Projectiles/Melee/StellarStrikerHoldout.cs b/Projectiles/Melee/StellarStrikerHoldout.cs index e6bf1b5aeb..6b1346c954 100644 --- a/Projectiles/Melee/StellarStrikerHoldout.cs +++ b/Projectiles/Melee/StellarStrikerHoldout.cs @@ -42,12 +42,11 @@ namespace CalamityMod.Projectiles.Melee Projectile.localNPCHitCooldown = -1; Projectile.DamageType = TrueMeleeDamageClass.Instance; } - public override void OnSpawn(IEntitySource source) + public override void WhenSpawned() { Projectile.knockBack = 0; Projectile.scale = 1; Projectile.ai[1] = -1; - base.OnSpawn(source); // 14NOV2024: Ozzatron: clamped mouse position unnecessary, it does not influence Stellar Striker's projectile spawning mousePos = Owner.Calamity().mouseWorld; diff --git a/Projectiles/Ranged/KingsbaneHoldout.cs b/Projectiles/Ranged/KingsbaneHoldout.cs index c51582d6cc..9dd0bb0edc 100644 --- a/Projectiles/Ranged/KingsbaneHoldout.cs +++ b/Projectiles/Ranged/KingsbaneHoldout.cs @@ -101,7 +101,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.NewProjectile(Projectile.GetSource_FromThis(), tipPosition + Projectile.velocity * 5 + Main.rand.NextVector2Circular(7, 7), shootVelocity.RotatedByRandom(MathHelper.ToRadians(4f)), ModContent.ProjectileType(), (int)(Projectile.damage * 0.9f), Projectile.knockBack, Projectile.owner); SoundStyle fire = new("CalamityMod/Sounds/Item/GunShotSmall"); if (fullRevShots % 2 == 0) - SoundEngine.PlaySound(fire with { Volume = 0.8f }, Projectile.Center); + SoundEngine.PlaySound(fire with { Volume = 0.7f }, Projectile.Center); //SoundEngine.PlaySound(SoundID.Item40 with { PitchVariance = 0.4f }, Projectile.Center); Owner.channel = true; @@ -133,7 +133,7 @@ namespace CalamityMod.Projectiles.Ranged } Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.Center, shootVelocity.RotatedByRandom(MathHelper.ToRadians(1.5f)), bulletAMMO, Projectile.damage, Projectile.knockBack, Projectile.owner); SoundStyle fire = new("CalamityMod/Sounds/Item/GunShotMid"); - SoundEngine.PlaySound(fire with { Volume = 0.6f }, Projectile.Center); + SoundEngine.PlaySound(fire with { Volume = 0.4f }, Projectile.Center); framesBetweenShots = 3; } if (framesBetweenShots > 0) diff --git a/Projectiles/Rogue/EquanimityDarkShard.cs b/Projectiles/Rogue/EquanimityDarkShard.cs index 2d5cb1d87b..3945f25301 100644 --- a/Projectiles/Rogue/EquanimityDarkShard.cs +++ b/Projectiles/Rogue/EquanimityDarkShard.cs @@ -1,4 +1,6 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -9,7 +11,7 @@ namespace CalamityMod.Projectiles.Rogue public class EquanimityDarkShard : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; - public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; + public override string Texture => "Terraria/Images/Item_527"; public override void SetDefaults() { Projectile.width = 12; @@ -17,65 +19,23 @@ namespace CalamityMod.Projectiles.Rogue Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.alpha = 0; - Projectile.penetrate = 1; + Projectile.penetrate = 4; Projectile.tileCollide = true; - Projectile.timeLeft = 120; + Projectile.timeLeft = 45; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; Projectile.DamageType = RogueDamageClass.Instance; } public override void AI() { - Projectile.velocity.Y += 0.1f; - Projectile.rotation += 0.4f * Projectile.direction; - if (Projectile.timeLeft < 130) + Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.03f; + Projectile.velocity *= 0.94f; + if (Projectile.ai[0] == 1f) { - float minDist = 999f; - int index = 0; - foreach (NPC npc in Main.ActiveNPCs) - { - if (npc.CanBeChasedBy(Projectile, false)) - { - float dist = (Projectile.Center - npc.Center).Length(); - if (dist < minDist) - { - minDist = dist; - index = npc.whoAmI; - } - } - } - - Vector2 velocityNew; - if (minDist < 999f) - { - velocityNew = Main.npc[index].Center - Projectile.Center; - velocityNew.Normalize(); - Projectile.velocity += velocityNew; - if (Projectile.velocity.Length() > 10f) - { - Projectile.velocity.Normalize(); - Projectile.velocity *= 10f; - } - } - } - - if (Projectile.timeLeft < 51) - { - Projectile.alpha += 5; + Projectile.penetrate = -1; } } - - public override bool? CanHitNPC(NPC target) - { - if (Projectile.timeLeft < 130) - { - return null; - } - else - { - return false; - } - } - public override bool OnTileCollide(Vector2 oldVelocity) { Collision.HitTiles(Projectile.position + Projectile.velocity, Projectile.velocity, Projectile.width, Projectile.height); @@ -83,5 +43,34 @@ namespace CalamityMod.Projectiles.Rogue Projectile.Kill(); return true; } + public override void OnKill(int timeLeft) + { + if (Projectile.ai[0] == 1f) + { + + } + for (int i = 0; i < 16; i++) + { + int dust = Dust.NewDust(Projectile.Center - Projectile.velocity / 2f, 0, 0, DustID.Asphalt, 0f, 0f, 100, default, 1.5f); + Main.dust[dust].velocity *= 0.6f; + Main.dust[dust].noGravity = true; + } + } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D Texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + if (Projectile.ai[0] == 1f) + { + for (int i = 0; i < 3; i++) + { + Main.EntitySpriteDraw(Texture, Projectile.Center - Main.screenPosition, null, Color.Indigo with { A = 0 }, Projectile.rotation, Texture.Size() * 0.5f, Projectile.scale * 1.5f, SpriteEffects.None); + } + } + Rectangle frame = Texture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Vector2 origin = frame.Size() * 0.5f; + Main.EntitySpriteDraw(Texture, Projectile.Center - Main.screenPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); + return false; + } } } diff --git a/Projectiles/Rogue/EquanimityDarkShard.png b/Projectiles/Rogue/EquanimityDarkShard.png deleted file mode 100644 index 1ba148ffdc..0000000000 Binary files a/Projectiles/Rogue/EquanimityDarkShard.png and /dev/null differ diff --git a/Projectiles/Rogue/EquanimityLightShard.cs b/Projectiles/Rogue/EquanimityLightShard.cs index 1969d188fa..08d2cd1b20 100644 --- a/Projectiles/Rogue/EquanimityLightShard.cs +++ b/Projectiles/Rogue/EquanimityLightShard.cs @@ -1,4 +1,7 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -9,6 +12,10 @@ namespace CalamityMod.Projectiles.Rogue public class EquanimityLightShard : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; + public override string Texture => "Terraria/Images/Item_528"; + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; + + public int TimeBeforeHoming = 30; public override void SetDefaults() { Projectile.width = 12; @@ -16,22 +23,39 @@ namespace CalamityMod.Projectiles.Rogue Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.alpha = 0; - Projectile.penetrate = 3; Projectile.tileCollide = true; - Projectile.timeLeft = 120; + Projectile.timeLeft = 180; Projectile.DamageType = RogueDamageClass.Instance; - Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 10; + TimeBeforeHoming = Main.rand.Next(30, 60); + } + public override bool? CanDamage() + { + if (Projectile.ai[1] < TimeBeforeHoming) return false; + return base.CanDamage(); } - public override void AI() { - Projectile.velocity.Y += 0.1f; - Projectile.rotation += 0.4f * Projectile.direction; - - if (Projectile.timeLeft < 51) + Projectile.ai[1]++; + //Rotation and gravity + Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.03f; + if (Projectile.ai[1] < TimeBeforeHoming) { - Projectile.alpha += 5; + Projectile.velocity *= 0.94f; + } + else + { + Projectile.ai[2] = MathHelper.Lerp(Projectile.ai[2], 10, 0.05f); + CalamityUtils.HomeInOnNPC(Projectile, false, Projectile.ai[0] == 1f ? 800 : 400, Projectile.ai[2], 0.2f); + Projectile.velocity.Y += 0.25f; + } + } + public override void OnKill(int timeLeft) + { + for (int i = 0; i < 10; i++) + { + int dust = Dust.NewDust(Projectile.Center - Projectile.velocity / 2f, 0, 0, DustID.GemDiamond, 0f, 0f, 100, default, 1f); + Main.dust[dust].velocity *= 2f; + Main.dust[dust].noGravity = true; } } @@ -42,5 +66,21 @@ namespace CalamityMod.Projectiles.Rogue Projectile.Kill(); return true; } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D Texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + if (Projectile.ai[0] == 1f) + { + for (int i = 0; i < 3; i++) + { + Main.EntitySpriteDraw(Texture, Projectile.Center - Main.screenPosition, null, Color.White with { A = 0 }, Projectile.rotation, Texture.Size() * 0.5f, Projectile.scale * 1.25f, SpriteEffects.None); + } + } + Rectangle frame = Texture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Vector2 origin = frame.Size() * 0.5f; + Main.EntitySpriteDraw(Texture, Projectile.Center - Main.screenPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); + return false; + } } } diff --git a/Projectiles/Rogue/EquanimityLightShard.png b/Projectiles/Rogue/EquanimityLightShard.png deleted file mode 100644 index f3b3357126..0000000000 Binary files a/Projectiles/Rogue/EquanimityLightShard.png and /dev/null differ diff --git a/Projectiles/Rogue/EquanimityProj.cs b/Projectiles/Rogue/EquanimityProj.cs index 4c62672278..6ca0713e32 100644 --- a/Projectiles/Rogue/EquanimityProj.cs +++ b/Projectiles/Rogue/EquanimityProj.cs @@ -1,8 +1,16 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Projectiles.Melee; +using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; +using static CalamityMod.CalamityUtils; +using System.Collections.Generic; +using CalamityMod.Particles; +using CalamityMod.Items.Weapons.Typeless; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Projectiles.Typeless; namespace CalamityMod.Projectiles.Rogue { @@ -11,124 +19,279 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override string Texture => "CalamityMod/Items/Weapons/Rogue/Equanimity"; - private bool recall = false; + public static int ChargeupTime = 10; + public static int Lifetime = 500; + public float OverallProgress => 1 - Projectile.timeLeft / (float)Lifetime; + public float ThrowProgress => 1 - Projectile.timeLeft / (float)(Lifetime); + public float ChargeProgress => 1 - (Projectile.timeLeft - Lifetime) / (float)(ChargeupTime); - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Type] = 8; - ProjectileID.Sets.TrailingMode[Type] = 1; - } + public Player Owner => Main.player[Projectile.owner]; + public ref float Returning => ref Projectile.ai[0]; + public ref float Bouncing => ref Projectile.ai[2]; + + public bool swapType = false; public override void SetDefaults() { Projectile.width = 46; - Projectile.height = 58; + Projectile.height = 46; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.penetrate = -1; - Projectile.timeLeft = 600; + Projectile.timeLeft = Lifetime + ChargeupTime; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 15; + Projectile.localNPCHitCooldown = 10; Projectile.DamageType = RogueDamageClass.Instance; } + public override bool ShouldUpdatePosition() + { + return ChargeProgress >= 1; + } + + public override bool? CanDamage() + { + //We don't want the anticipation to deal damage. + if (ChargeProgress < 1) + return false; + + if (Returning == 1f) + return false; + + return base.CanDamage(); + } + + //Swing animation keys + public CurveSegment pullback = new CurveSegment(EasingType.PolyOut, 0f, 0f, MathHelper.PiOver4 * -1.2f, 2); + public CurveSegment throwout = new CurveSegment(EasingType.PolyOut, 0.7f, MathHelper.PiOver4 * -1.2f, MathHelper.PiOver4 * 1.2f + MathHelper.PiOver2, 3); + internal float ArmAnticipationMovement() => PiecewiseAnimation(ChargeProgress, new CurveSegment[] { pullback, throwout }); + public override void AI() { - if ((Main.player[Projectile.owner].position - Projectile.position).Length() > 600f) + //Anticipation animation. Make the player look like theyre holding the boomerang + if (ChargeProgress < 1) { - recall = true; + float armRotation = ArmAnticipationMovement() * Owner.direction; + + Owner.heldProj = Projectile.whoAmI; + + Projectile.Center = Owner.MountedCenter + Vector2.UnitY.RotatedBy(armRotation * Owner.gravDir) * -40f * Owner.gravDir; + Projectile.rotation = (-MathHelper.PiOver2 + armRotation) * Owner.gravDir; + + Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, MathHelper.Pi + armRotation); + Projectile.tileCollide = false; - } - - Projectile.rotation += 0.4f * Projectile.direction; - - if (recall) - { - if (Main.rand.Next(0, 10) == 0) - { - Vector2 shardVelocity = new Vector2(Main.rand.NextFloat(-1f, 1f), Main.rand.NextFloat(-1f, 1f)); - shardVelocity.Normalize(); - shardVelocity *= 5f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, shardVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.8f), 0f, Projectile.owner); - if (Projectile.Calamity().stealthStrike) - { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, -shardVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.8f), 0f, Projectile.owner); - } - } - - Vector2 posDiff = Main.player[Projectile.owner].position - Projectile.position; - if (posDiff.Length() > 30f) - { - posDiff.Normalize(); - Projectile.velocity = posDiff * 30f; - } - else - { - Projectile.timeLeft = 0; - OnKill(Projectile.timeLeft); - } return; } + + //Play the throw sound when the throw ACTUALLY BEGINS. + //Additionally, make the projectile collide and set its speed and velocity + if (Projectile.timeLeft == Lifetime) + { + SoundEngine.PlaySound(SoundID.DD2_GoblinBomberThrow, Projectile.Center); + Projectile.Center = Owner.MountedCenter + Projectile.velocity * 12f; + Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.Zero) * 17.5f; + Projectile.tileCollide = true; + } + + Projectile.rotation += (MathHelper.PiOver4 / 4f + MathHelper.PiOver4 / 2f * Math.Clamp(ThrowProgress * 2f, 0, 1)) * Math.Sign(Projectile.velocity.X); + + //Boomerang spinny sounds + if (Projectile.soundDelay <= 0) + { + SoundEngine.PlaySound(SoundID.Item7, Projectile.Center); + Projectile.soundDelay = 8; + } + + if (Projectile.velocity.Length() < 2f && Bouncing == 0f) + { + Returning = 1f; + Projectile.numHits = 0; + } + + if (Returning == 0f && Bouncing == 0f && Projectile.velocity.Length() > 2f && Projectile.timeLeft < (455 + ChargeupTime)) + { + Projectile.velocity *= 0.88f; + } + + if (Returning == 1f && Projectile.velocity.Length() < 20f) + { + Projectile.velocity *= 1.1f; + } + + for (int i = 0; i < 2; i++) + { + Vector2 dustPos = Projectile.Center + (i * MathHelper.Pi + Projectile.rotation + MathHelper.PiOver2).ToRotationVector2() * 14f; + Dust dust = Dust.NewDustPerfect(dustPos, Main.rand.NextBool() ? 91 : 109, (i * MathHelper.Pi + Projectile.rotation * Math.Sign(Projectile.velocity.X)).ToRotationVector2() * 3f); + dust.noGravity = true; + } + + if (Returning == 1f) + { + Projectile.tileCollide = false; + //Aim back at the player + Projectile.velocity = Projectile.velocity.Length() * (Owner.MountedCenter - Projectile.Center).SafeNormalize(Vector2.One); + + if ((Projectile.Center - Owner.MountedCenter).Length() < 24f) + { + Projectile.Kill(); + } + + if (Projectile.numHits >= 7) + { + Projectile.Kill(); + } + } + } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(BuffID.Confused, 30); - - if (!recall) + //If a non stealth strike, spawn no visuals and the regular versions of the shards + if (!Projectile.Calamity().stealthStrike) { - int shardCount = Main.rand.Next(1, 3); - for (int i = 0; i <= shardCount; i++) + float baseDirectionRotation = Main.rand.NextFloat(MathHelper.TwoPi); + Vector2 shootVelocity = new Vector2(5, 5).RotatedByRandom(100) * Main.rand.NextFloat(0.8f, 1.6f); + if (!swapType) { - Vector2 shardVelocity = new Vector2(Main.rand.NextFloat(-1f, 1f), Main.rand.NextFloat(-1f, 1f)); - shardVelocity.Normalize(); - shardVelocity *= 5f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, shardVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.8f), 0f, Projectile.owner); - if (Projectile.Calamity().stealthStrike) + for (int s = 0; s < 2; s++) + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, shootVelocity.RotatedByRandom(100), ModContent.ProjectileType(), (int)(Projectile.damage * 0.4f), 0f, Projectile.owner); + } + if (swapType) + { + for (int s = 0; s < 2; s++) + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, shootVelocity.RotatedByRandom(100), ModContent.ProjectileType(), (int)(Projectile.damage * 0.4f), 0f, Projectile.owner); + } + swapType = !swapType; + } + //If stealth strike, spawn the explosion visuals and enhance shards + else + { + float baseDirectionRotation = Main.rand.NextFloat(MathHelper.TwoPi); + Vector2 shootVelocity = new Vector2(5, 5).RotatedByRandom(100) * Main.rand.NextFloat(0.8f, 1.6f); + if (!swapType) + { + #region Visuals and Sounds + SoundEngine.PlaySound(DeadSunsWind.Explosion with { Volume = 0.4f }, Projectile.Center); + for (int i = 0; i < 3; i++) { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, -shardVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.8f), 0f, Projectile.owner); + Particle innerglow = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Indigo, "CalamityMod/Particles/LargeBloom", Vector2.One, Main.rand.NextFloat(-10, 10), 0, 0.3f, 15); + GeneralParticleHandler.SpawnParticle(innerglow); + } + Particle explosion = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Black, "CalamityMod/Particles/FlameExplosion2", Vector2.One, Main.rand.NextFloat(-5, 5), 0f, 0.04f, 25, false, 0.85f); + GeneralParticleHandler.SpawnParticle(explosion); + Particle explosion2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Black, "CalamityMod/Particles/FlameExplosion2", Vector2.One, Main.rand.NextFloat(-5, 5), 0f, 0.07f, 25, false, 0.85f); + GeneralParticleHandler.SpawnParticle(explosion2); + Particle explosion3 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Indigo * 0.55f, "CalamityMod/Particles/SoftRoundExplosion", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0.07f, 0.08f, 30); + GeneralParticleHandler.SpawnParticle(explosion3); + for (int s = 0; s < 13; s++) + { + Vector2 randVel = new Vector2(7, 7).RotatedByRandom(100) * Main.rand.NextFloat(0.8f, 1.6f); + Particle smoke = new HeavySmokeParticle(Projectile.Center + randVel, randVel, Color.Black, Main.rand.Next(15, 25 + 1), Main.rand.NextFloat(0.3f, 0.5f), 0.8f); + GeneralParticleHandler.SpawnParticle(smoke); + } + #endregion + // Create Blast + float blastSize = 90; + float minMultiplier = 0.25f; + int hitsToMinMult = 8; + Projectile blast = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5f), Projectile.knockBack, Projectile.owner, blastSize, minMultiplier, hitsToMinMult); + blast.DamageType = RogueDamageClass.Instance; + for (int s = 0; s < 2; s++) + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, shootVelocity.RotatedByRandom(100), ModContent.ProjectileType(), (int)(Projectile.damage * 0.8f), 0f, Projectile.owner, 1f, 1f); + } + if (swapType) + { + #region Visuals and Sounds + SoundEngine.PlaySound(LunicEye.UseSound with { Volume = 0.7f }, Projectile.Center); + for (int i = 0; i < 3; i++) + { + Particle innerglow = new CustomPulse(Projectile.Center, Vector2.Zero, Color.LightPink, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0, 0.3f, 15); + GeneralParticleHandler.SpawnParticle(innerglow); + } + Particle explosion = new CustomPulse(Projectile.Center, Vector2.Zero, Color.WhiteSmoke, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(-5, 5), 0f, 0.07f, 20, true); + GeneralParticleHandler.SpawnParticle(explosion); + Particle explosion2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.MediumVioletRed, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(-5, 5), 0f, 0.07f, 20, true); + GeneralParticleHandler.SpawnParticle(explosion2); + Particle explosion4 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.LightPink, "CalamityMod/Particles/DetailedExplosion", Vector2.One, Main.rand.NextFloat(-5, 5), 0f, 0.3f, 20, true); + GeneralParticleHandler.SpawnParticle(explosion4); + Particle explosion3 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.LightPink, "CalamityMod/Particles/SoftRoundExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0f, 0.04f, 20); + GeneralParticleHandler.SpawnParticle(explosion3); + Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/HighResHollowCircleHardEdge", Vector2.One, Main.rand.NextFloat(-10, 10), 0f, 0.09f, 25); + GeneralParticleHandler.SpawnParticle(blastRing2); + for (int i = 0; i < 10; i++) + { + CritSpark spark2 = new CritSpark(Projectile.Center, new Vector2(12, 12).RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 1f), Color.White, Color.Orchid, 0.9f, 20, 2f, 2.2f); + GeneralParticleHandler.SpawnParticle(spark2); + } + for (int k = 0; k < 10; k++) + { + Vector2 velocity = new Vector2(10, 10).RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 1.2f); + float colorRando = Main.rand.NextFloat(0, 1); + Particle spark = new GlowSparkParticle(Projectile.Center + velocity, velocity, false, 11, Main.rand.NextFloat(0.009f, 0.005f), Color.Lerp(Color.DarkOrchid, Color.IndianRed, colorRando), new Vector2(2.2f, 0.9f), true); + GeneralParticleHandler.SpawnParticle(spark); + } + #endregion + // Create Blast + float blastSize = 90; + float minMultiplier = 0.25f; + int hitsToMinMult = 8; + Projectile blast = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5f), Projectile.knockBack, Projectile.owner, blastSize, minMultiplier, hitsToMinMult); + blast.DamageType = RogueDamageClass.Instance; + for (int s = 0; s < 2; s++) + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, shootVelocity.RotatedByRandom(100), ModContent.ProjectileType(), (int)(Projectile.damage * 0.8f), 0f, Projectile.owner, 1f, 1f); + } + swapType = !swapType; + } + + if (Projectile.numHits > 4) + { + Projectile.velocity *= 0.3f; + Returning = 1f; + } + + else + { + //Retarget + NPC newTarget = null; + float closestNPCDistance = 10000f; + float targettingDistance = 900f; + + foreach (NPC n in Main.ActiveNPCs) + { + if (n.whoAmI == target.whoAmI) + continue; + + if (n.CanBeChasedBy(Projectile)) + { + float potentialNewDistance = (Projectile.Center - n.Center).Length(); + if (potentialNewDistance < targettingDistance && potentialNewDistance < closestNPCDistance) + { + closestNPCDistance = potentialNewDistance; + newTarget = n; + Projectile.velocity = CalamityUtils.CalculatePredictiveAimToTargetMaxUpdates(Projectile.Center, newTarget, 30f, 3); + } } } - } - } - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - target.AddBuff(BuffID.Confused, 30); - - if (!recall) - { - int shardCount = Main.rand.Next(1, 3); - for (int i = 0; i <= shardCount; i++) + if (newTarget == null) { - Vector2 shardVelocity = new Vector2(Main.rand.NextFloat(-1f, 1f), Main.rand.NextFloat(-1f, 1f)); - shardVelocity.Normalize(); - shardVelocity *= 5f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, shardVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.8f), 0f, Projectile.owner); - if (Projectile.Calamity().stealthStrike) - { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, -shardVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.8f), 0f, Projectile.owner); - } + Projectile.velocity *= 0.3f; + Returning = 1f; + return; } - } - } - public override bool PreDraw(ref Color lightColor) - { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 3); - return false; + // The boomerang loses 15% damage per bounce. + Projectile.damage = (int)(Projectile.damage * 0.85f); + Bouncing = 2f; + } } public override bool OnTileCollide(Vector2 oldVelocity) { - if (recall) - { - return false; - } - Collision.HitTiles(Projectile.position + Projectile.velocity, Projectile.velocity, Projectile.width, Projectile.height); - SoundEngine.PlaySound(SoundID.Dig, Projectile.position); - recall = true; - Projectile.tileCollide = false; + Projectile.velocity = Projectile.oldVelocity.Length() * 0.3f * (Owner.MountedCenter - Projectile.Center).SafeNormalize(Vector2.One); + Returning = 1f; return false; } } diff --git a/Projectiles/Rogue/ExorcismProj.cs b/Projectiles/Rogue/ExorcismProj.cs index 6757dae3cb..86102bdd3f 100644 --- a/Projectiles/Rogue/ExorcismProj.cs +++ b/Projectiles/Rogue/ExorcismProj.cs @@ -1,8 +1,15 @@ -using Microsoft.Xna.Framework; +using System; +using System.Collections.Generic; +using CalamityMod.Dusts; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using ReLogic.Utilities; using Terraria; using Terraria.Audio; -using Terraria.ID; +using Terraria.GameContent; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue @@ -12,105 +19,449 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override string Texture => "CalamityMod/Items/Weapons/Rogue/Exorcism"; + public ref float time => ref Projectile.ai[0]; + public Player Owner => Main.player[Projectile.owner]; + + public bool flung = false; // If the projectile has entered the thrown state. + public bool hitTiles => Projectile.ai[1] == -5; // In post hit tiles state + public bool inSky => Projectile.ai[1] == 5; // After being thrown, waiting to come down state + public bool falling => Projectile.ai[1] == 10; // Falling from the sky state + public int fallTime = 55; // Time spend in the sky + public NPC targeted; // Target impaled into + public Vector2 impaleDist; // Distance from impaled target's center + public int hitRate = 60; // How fast the cross burns with holy light + public float randpitch = 0; // Some random pitch for the looping sound + public bool stealth => Projectile.Calamity().stealthStrike; + public Vector2 storedStealthVel; // stored velocity for the boomerang turn around + public Vector2 crossCenter => Projectile.Center + (Vector2.UnitY * -11).RotatedBy(Projectile.rotation); // The center of the cross + + public Color mainColor = Color.Gold; + public SlotId AudSlot; public override void SetDefaults() { - Projectile.width = 20; - Projectile.height = 20; + Projectile.width = 25; + Projectile.height = 80; Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.alpha = 0; - Projectile.penetrate = 1; - Projectile.tileCollide = true; + Projectile.penetrate = -1; + Projectile.extraUpdates = 0; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.tileCollide = false; + Projectile.timeLeft = 600; Projectile.DamageType = RogueDamageClass.Instance; - Projectile.extraUpdates = 1; } - + public override bool ShouldUpdatePosition() => flung && !inSky && !hitTiles && (impaleDist == Vector2.Zero || stealth); + public override bool? CanDamage() => ((flung && !inSky && !hitTiles && impaleDist == Vector2.Zero) ? null : false); public override void AI() { - Projectile.velocity.Y += 0.1f; - Projectile.rotation += 0.05f * Projectile.direction; - - // Dust Effects - Vector2 dustLeft = (new Vector2(-1, 0)).RotatedBy(Projectile.rotation); - Vector2 dustRight = (new Vector2(1, 0)).RotatedBy(Projectile.rotation); - Vector2 dustUp = (new Vector2(0, -1)).RotatedBy(Projectile.rotation); - Vector2 dustDown = (new Vector2(0, 1) * 2f).RotatedBy(Projectile.rotation); - - float minSpeed = 1.5f; - float maxSpeed = 5f; - float minScale = 0.8f; - float maxScale = 1.4f; - - int dustType = 175; - int dustCount = (int)(5 * (Projectile.ai[0])); - - for (int i = 0; i < dustCount; i++) + if (stealth && Projectile.ai[2] != 5) // Multiplayer Syncing? { - int left = Dust.NewDust(Projectile.Center, 1, 1, dustType, 0f, 0f); - Main.dust[left].noGravity = true; - Main.dust[left].position = Projectile.Center; - Main.dust[left].velocity = dustLeft * Main.rand.NextFloat(minSpeed, maxSpeed) + Projectile.velocity; - Main.dust[left].scale = Main.rand.NextFloat(minScale, maxScale); + Projectile.ai[2] = 5; + Projectile.ForceNetUpdate(); + } + if (Projectile.ai[2] == 5) + Projectile.Calamity().stealthStrike = true; - int right = Dust.NewDust(Projectile.Center, 1, 1, dustType, 0f, 0f); - Main.dust[right].noGravity = true; - Main.dust[right].position = Projectile.Center; - Main.dust[right].velocity = dustRight * Main.rand.NextFloat(minSpeed, maxSpeed) + Projectile.velocity; - Main.dust[right].scale = Main.rand.NextFloat(minScale, maxScale); + if (!flung && time == 0) + randpitch = Main.rand.NextFloat(-0.1f, 0.1f); + if (flung) + { + if (hitTiles) + { + holySound(); + if (Projectile.timeLeft > 300) + Projectile.timeLeft = 300; + } + else if (inSky) + { + Projectile.Center = new Vector2(Owner.ClampedMouseWorld().X, Owner.Center.Y) + new Vector2(0, -700); + Projectile.Opacity = 0; + Projectile.extraUpdates = 0; + Projectile.timeLeft++; + fallTime--; + if (fallTime <= 0) + { + for (int i = 0; i < Main.maxNPCs; i++) + Projectile.localNPCImmunity[i] = 0; + Projectile.Opacity = 1; + Projectile.velocity = Utils.DirectionTo(Projectile.Center, Owner.Calamity().mouseWorld) * 7; + Projectile.numHits = 0; + Projectile.extraUpdates = 25; + Projectile.ai[1] = 10; + } + if (fallTime == 10) + { + for (int i = 0; i < 2; i++) + { + SoundStyle sound = new("CalamityMod/Sounds/Item/MissileNearing"); + SoundEngine.PlaySound(sound with { Volume = 0.5f, Pitch = 0.8f, MaxInstances = 2 }, Projectile.Center); + } + } + } + else if (falling) + { + if (Projectile.numHits == 0) + { + Projectile.timeLeft++; + if (Projectile.Center.Y + 80 > Owner.Calamity().mouseWorld.Y && Collision.SolidCollision(Projectile.Center, 20, 20)) + { + Projectile.netUpdate = true; + Projectile.extraUpdates = 3; + Projectile.ai[1] = -5; + SoundStyle sound = new("CalamityMod/Sounds/NPCHit/ExoHit2"); + SoundEngine.PlaySound(sound with { Volume = 0.6f, Pitch = Main.rand.NextFloat(0f, 0.1f) }, Projectile.Center); + SoundStyle sound2 = new("CalamityMod/Sounds/NPCHit/RavagerRockPillarHit", 3); + SoundEngine.PlaySound(sound2 with { Volume = 0.7f, Pitch = -0.3f }, Projectile.Center); + } - int up = Dust.NewDust(Projectile.Center, 1, 1, dustType, 0f, 0f); - Main.dust[up].noGravity = true; - Main.dust[up].position = Projectile.Center; - Main.dust[up].velocity = dustUp * Main.rand.NextFloat(minSpeed, maxSpeed) + Projectile.velocity; - Main.dust[up].scale = Main.rand.NextFloat(minScale, maxScale); + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; - int down = Dust.NewDust(Projectile.Center, 1, 1, dustType, 0f, 0f); - Main.dust[down].noGravity = true; - Main.dust[down].position = Projectile.Center; - Main.dust[down].velocity = dustDown * Main.rand.NextFloat(minSpeed, maxSpeed) + Projectile.velocity; - Main.dust[down].scale = Main.rand.NextFloat(minScale, maxScale); + float squash = Utils.GetLerpValue(1, 3, Projectile.velocity.Length(), true); + Particle trail = new CustomSpark(Projectile.Center - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 35, Projectile.velocity * 0.01f, "CalamityMod/Particles/BloomCircle", false, 43, 0.4f, mainColor * 0.4f * squash, new Vector2(1 - 0.15f * squash, 1f), true, false, shrinkSpeed: 0.07f * squash); + GeneralParticleHandler.SpawnParticle(trail); + } + else + { + Projectile.extraUpdates = 3; + Projectile.Center = targeted.Center + impaleDist; + if (stealth) + Projectile.rotation += (0.08f - hitRate * 0.001f) * Projectile.direction * 0.3f; + + holySound(); + + if (time >= hitRate) + { + impaleDist.Y *= 0.93f; + Projectile strike = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), targeted.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * Utils.Remap(hitRate, 50, 5, 0.05f, 0.1f)), 0f, Owner.whoAmI, targeted.whoAmI, 1f); + strike.ArmorPenetration = 30; + strike.DamageType = RogueDamageClass.Instance; + if (hitRate > 10) + hitRate -= 10; + time = 0; + } + } + } + else // State before it enters the sky + { + if (stealth) + { + if (Projectile.timeLeft > 240) + { + // Boomerang noises + if (Projectile.soundDelay == 0) + { + Projectile.soundDelay = 5 * Projectile.MaxUpdates; + SoundStyle sound = new("CalamityMod/Sounds/Item/SwooshMid"); + SoundEngine.PlaySound(sound with { MaxInstances = -1, Volume = 0.5f, Pitch = -0.2f }, Projectile.Center); + } + Projectile.rotation += 0.07f * Projectile.direction; + } + + if (time > 80) + { + if (Projectile.velocity.Length() < storedStealthVel.Length()) + Projectile.velocity += Utils.DirectionTo(Projectile.Center, Owner.Center) * 0.1f; + Projectile.velocity *= 0.99f; + if (time == 180) // Reset iframes when it starts to come back + { + for (int i = 0; i < Main.maxNPCs; i++) + Projectile.localNPCImmunity[i] = 0; + } + if (Projectile.timeLeft <= 240) + { + impaleDist = Vector2.One; // This is so the projectile stops dealing damage + Projectile.extraUpdates = 3; + float endLerp = Utils.GetLerpValue(240, 90, Projectile.timeLeft, true); + Vector2 endPos = Vector2.Lerp((Owner.Center + Vector2.UnitY * (-50 - 90 * endLerp)), Owner.ClampedMouseWorld(), (float)Math.Pow(endLerp, 5)); + Projectile.velocity = (endPos - Projectile.Center) / 25; + Projectile.rotation = Utils.AngleLerp(Projectile.rotation, 0, endLerp); + } + } + else + storedStealthVel = -Projectile.velocity * 1.1f; + + if (Projectile.timeLeft > 240) + { + int numParts = 2; + for (int i = 0; i < numParts; i++) + { + float fade = (Utils.GetLerpValue(5, 2, Projectile.velocity.Length(), true) * 3 + 1); + + float rot = Projectile.rotation + (MathHelper.TwoPi * i / numParts); + Vector2 vel = (Utils.MoveTowards(-Projectile.velocity, new Vector2(0, -130).RotatedBy(rot).RotatedBy(-1.3f * Projectile.direction), (Utils.GetLerpValue(5, 2, Projectile.velocity.Length(), true)))); + + if (time % 5 == 0) + { + Dust dust2 = Dust.NewDustPerfect(Projectile.Center + new Vector2(0, -70).RotatedBy(rot), Main.rand.NextBool(4) ? 278 : ModContent.DustType()); + dust2.noGravity = (dust2.type == 278 ? false : true); + dust2.scale = (dust2.type == 278 ? 0.95f : 1.2f) * 0.6f; + dust2.color = Color.Red; + dust2.velocity = (vel * 2).RotatedByRandom(0.4f) * fade; + } + if (time % 2 == 0) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + new Vector2(0, -70).RotatedBy(rot), Main.rand.NextBool(4) ? 278 : ModContent.DustType()); + dust.noGravity = (dust.type == 278 ? false : true); + dust.scale = (dust.type == 278 ? 0.75f : 0.9f) * 0.6f; + dust.color = Main.rand.NextBool(4) ? Color.Khaki : Color.Goldenrod; + dust.velocity = (vel * 2).RotatedByRandom(0.4f) * fade; + } + } + } + + holySound(); + } + else + { + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + if (time >= 120) + Projectile.ai[1] = 5; + if (time % 6 == 0 && time > 12) + { + Particle trail = new CustomSpark(Projectile.Center - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 35 + Main.rand.NextVector2Circular(10, 10), -Projectile.velocity * 0.01f, "CalamityMod/Particles/BloomCircle", false, 13, 0.2f, mainColor * 0.6f, new Vector2(0.6f, 1f), true, false, shrinkSpeed: 0.6f); + GeneralParticleHandler.SpawnParticle(trail); + } + } + } + } + else + { + Vector2 projToSky = Utils.DirectionTo(Projectile.Center, new Vector2(MathHelper.Lerp(Owner.ClampedMouseWorld().X, Owner.Center.X, 0.35f), Owner.Center.Y) + new Vector2(0, -500)); + Projectile.velocity = projToSky; + float completion = time / (Owner.HeldItem.useAnimation * 0.7f); // The completion of the throw animation. + if (completion >= 1) // The moment of being thrown. + { + Projectile.Center = Owner.Center; + Projectile.extraUpdates = stealth ? 9 : 6; + if (stealth) + Projectile.timeLeft = 560; + Vector2 velocity = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld); + float speed = 9; + Projectile.velocity = (stealth ? velocity : projToSky) * speed; + time = -1; + SoundStyle w = new("CalamityMod/Sounds/Item/SwooshMid"); + for (int i = 0; i < 2; i++) + SoundEngine.PlaySound(w with { Volume = 1f, Pitch = -0.4f + 0.2f * i, MaxInstances = 6 }, Projectile.Center); + + flung = true; + } + else + { + Owner.direction = Math.Sign(Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld).X); + float crossRot = 0; + // All the annoying to make rotation and placement code for the throw animation. + if (completion >= 0.7f) + { + float completionLerp = (float)Math.Pow(Utils.GetLerpValue(0.7f, 1f, completion, true), 7); + crossRot = MathHelper.ToRadians(MathHelper.Lerp(-45, 130f, completionLerp) * Owner.direction); + } + else + { + float completionLerp = (float)Math.Pow(Utils.GetLerpValue(0f, 0.7f, completion, true), 2); + crossRot = MathHelper.ToRadians(MathHelper.Lerp(120, -45f, completionLerp) * Owner.direction); + } + crossRot += Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld).ToRotation(); + Vector2 crossPos = Owner.MountedCenter + new Vector2(0, -24 * Owner.direction).RotatedBy(crossRot); + float completionLerp2 = (float)Math.Pow(Utils.GetLerpValue(0f, 0.7f, completion, true), 2); + + Projectile.Center = crossPos; + if (stealth) + Projectile.rotation = Projectile.velocity.ToRotation() + (float)Math.Pow(completion, 3) * 12 * Owner.direction; + else + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + + Owner.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld).ToRotation() - MathHelper.ToRadians(90)); + Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, crossRot - (Owner.direction == 1 ? MathHelper.ToRadians(180) : MathHelper.ToRadians(0))); + } + } + time++; + if (!inSky) + Lighting.AddLight(Projectile.Center, Color.Gold.ToVector3() * 0.5f); + if (targeted != null && ((targeted.life <= 0 && targeted.realLife == -1) || targeted.lifeMax == 1)) + Projectile.Kill(); + } + public void holySound() + { + if (SoundEngine.TryGetActiveSound(AudSlot, out var holy) && holy.IsPlaying) + { + holy.Position = Projectile.Center; + holy.Pitch = Utils.Remap(Projectile.timeLeft, 300, 0, -0.4f + randpitch, (stealth ? -0.15f : -0.3f) + randpitch); + holy.Volume = Utils.Remap(Projectile.timeLeft, 300, 0, 0f, 0.5f) * 100; + } + else if (Projectile.timeLeft > 1) + { + SoundStyle choir = new("CalamityMod/Sounds/Item/HolyLoop"); + AudSlot = SoundEngine.PlaySound(choir with { Volume = 0.01f, Pitch = 0 }, Projectile.Center); } } - + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (stealth) + { + float minMult = 0.35f; + int hitsToMinMult = 10; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult; + } + else if (!falling || Projectile.numHits != 0) + modifiers.SourceDamage *= 0.1f; + } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - // Stars - if (Projectile.Calamity().stealthStrike) + bool onKill = ((target.life <= 0 && target.realLife == -1) || target.lifeMax == 1); + if (!onKill && falling) { - for (int i = 0; i < 6; i++) + if (!stealth) { - Vector2 pos = new Vector2(Projectile.Center.X + (float)Projectile.width * 0.5f + (float)Main.rand.Next(-201, 201), Main.screenPosition.Y - 600f - Main.rand.Next(50)); - Vector2 starVelocity = CalamityUtils.CalculatePredictiveAimToTargetMaxUpdates(pos, target, 30f, 2); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), pos, starVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.75f), Projectile.knockBack * 0.5f, Projectile.owner, Main.rand.NextFloat(-3f, 3f), 0f); + time = 0; + SoundStyle sound = new("CalamityMod/Sounds/NPCHit/ExoHit4"); + SoundEngine.PlaySound(sound with { Volume = 0.7f, Pitch = Main.rand.NextFloat(0.15f, 0.25f) }, Projectile.Center); + SoundStyle sound2 = new("CalamityMod/Sounds/NPCHit/ExoHit3"); + SoundEngine.PlaySound(sound2 with { Volume = 0.5f, Pitch = Main.rand.NextFloat(-0.1f, 0f) }, Projectile.Center); + Owner.Calamity().GeneralScreenShakePower = 5.5f; + Projectile.timeLeft = 300; + targeted = target; + impaleDist = (Projectile.Center - targeted.Center); + } + } + else + Projectile.numHits--; + } + public override void OnKill(int timeLeft) + { + if (SoundEngine.TryGetActiveSound(AudSlot, out var holy)) + { + holy?.Stop(); + } + if (stealth) + { + if (Main.zenithWorld) + { + for (int index = 0; index < Main.npc.Length; index++) + { + NPC searchedTarget = Main.npc[index]; + searchedTarget.active = false; + } + + SoundStyle gfb = new("CalamityMod/Sounds/Item/HolyBurst"); + for (int i = 0; i < 7; i++) + SoundEngine.PlaySound(gfb with { Volume = 1f, Pitch = 0.2f * i, MaxInstances = 7 }, Projectile.Center); + } + else + { + Owner.Calamity().GeneralScreenShakePower = 7f; + SoundStyle soundBurst = new("CalamityMod/Sounds/Item/HolyBurst"); + for (int i = 0; i < 3; i++) + SoundEngine.PlaySound(soundBurst with { Volume = 0.8f, Pitch = 0.2f * i, MaxInstances = 3 }, Projectile.Center); + SoundStyle soundExplosion = new("CalamityMod/Sounds/Item/HolyColliderProjectileHit"); + SoundEngine.PlaySound(soundExplosion with { Volume = 0.65f, Pitch = 0.6f }, Projectile.Center); + + for (int i = 0; i < 4; i++) + { + for (int y = 0; y < 24; y++) + { + bool red = Main.rand.NextBool(5); + float variance = Main.rand.NextFloat(0.7f, 1); + float placementVariance = 35; + Vector2 fxVel = Vector2.UnitY.RotatedBy(MathHelper.PiOver2 * i) * Main.rand.NextFloat(y * 1.2f, y * 1.5f) * (i == 0 ? 1.7f : 1) * variance; + Vector2 fxPos = crossCenter + Main.rand.NextVector2CircularEdge(placementVariance - variance * placementVariance, placementVariance - variance * placementVariance); + Dust dust = Dust.NewDustPerfect(fxPos, ModContent.DustType(), fxVel * 1.7f, 0, default, Main.rand.NextFloat(1.2f, 1.6f)); + dust.noGravity = true; + dust.scale = (red ? 1.4f : 1.2f) * Main.rand.NextFloat(0.7f, 0.9f); + dust.color = red ? Color.Red : mainColor; + if (y % 2 == 0) + { + Particle spark = new GlowSparkParticle(fxPos, fxVel, false, 24, 0.065f, Main.rand.NextBool() ? Color.Khaki : mainColor, new Vector2(0.8f, 0.3f), true, false, 0.5f); + GeneralParticleHandler.SpawnParticle(spark); + } + } + Vector2 fxVel2 = Vector2.UnitY.RotatedBy(MathHelper.PiOver2 * i) * (i == 0 ? 1.7f : 1); + Particle bigCross = new CustomSpark(crossCenter + fxVel2 * 145, fxVel2, "CalamityMod/Particles/BloomLineFade", false, 15, 0.15f, mainColor, new Vector2(1.8f, 1.2f), true, true, 0, false, false, 0.8f, 0.8f, 0.8f); + GeneralParticleHandler.SpawnParticle(bigCross); + } + } + Projectile crossBurst = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), crossCenter, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 1.5f), 0f, Owner.whoAmI); + crossBurst.Calamity().stealthStrike = true; + } + else + { + SoundStyle soundBurst = new("CalamityMod/Sounds/Item/HolyBurst"); + SoundEngine.PlaySound(soundBurst with { Volume = 1f, Pitch = 0 }, Projectile.Center); + Projectile crossBurst = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), crossCenter, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.35f), 0f, Owner.whoAmI); + for (int i = 0; i < 4; i++) + { + for (int y = 0; y < 14; y++) + { + bool red = Main.rand.NextBool(5); + float variance = Main.rand.NextFloat(0.7f, 1); + float placementVariance = 27; + Vector2 fxVel = Vector2.UnitY.RotatedBy(MathHelper.PiOver2 * i) * Main.rand.NextFloat(y * 0.8f, y) * (i == 0 ? 1.7f : 1) * variance; + Vector2 fxPos = crossCenter + Main.rand.NextVector2CircularEdge(placementVariance - variance * placementVariance, placementVariance - variance * placementVariance); + Dust dust = Dust.NewDustPerfect(fxPos, ModContent.DustType(), fxVel * 1.5f, 0, default, Main.rand.NextFloat(1.2f, 1.6f)); + dust.noGravity = true; + dust.scale = (red ? 1.2f : 1) * Main.rand.NextFloat(0.7f, 0.9f); + dust.color = red ? Color.Red : mainColor; + if (y % 2 == 0) + { + Particle spark = new GlowSparkParticle(fxPos, fxVel, false, 18, 0.05f, Main.rand.NextBool() ? Color.Khaki : mainColor, new Vector2(0.8f, 0.3f), true, false, 0.6f); + GeneralParticleHandler.SpawnParticle(spark); + } + } } } } - + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + if (stealth) + return CalamityUtils.CircularHitboxCollision(Projectile.Center, 120, targetHitbox); + else + return base.Colliding(projHitbox, targetHitbox); + } public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Type].Value; - Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); + float glowUp = (1 + Utils.GetLerpValue(250, 0, Projectile.timeLeft, true)); + float throwCompletion = flung ? 1 : (float)Math.Pow(Math.Min(time / (Owner.HeldItem.useAnimation * 0.7f), 1), 5); + Color glowColor = Color.Lerp(mainColor, Color.Khaki, glowUp - 1); + Texture2D tex = TextureAssets.Projectile[Type].Value; + Asset glowBlade = ModContent.Request("CalamityMod/Particles/GlowBlade"); + Asset woosh = ModContent.Request("CalamityMod/Particles/VerticalSmearLarge"); + + if (hitTiles || falling || stealth) + { + for (int i = 0; i < 25; i++) + { + Vector2 drawPos = Projectile.Center; + Color auraColor = glowColor with { A = 0 } * 0.05f * glowUp; + Vector2 drawOffset = (MathHelper.TwoPi * i / 25f).ToRotationVector2() * glowUp * 2; + Main.EntitySpriteDraw(tex, drawPos - Main.screenPosition + drawOffset + Main.rand.NextVector2Circular(6, 6) * (1 - glowUp), null, auraColor with { A = 0 } * Projectile.Opacity, Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, SpriteEffects.None); + } + } + if (stealth) + { + for (int i = 0; i < 4; i++) + { + Vector2 fxVel = Vector2.UnitY.RotatedBy(MathHelper.PiOver2 * i).RotatedBy(Projectile.rotation) * (i == 0 ? 1.2f : 1) * 80 * throwCompletion; + Vector2 fxPos = crossCenter + fxVel; + + if (i == 0 && Projectile.timeLeft > 240) + { + Main.EntitySpriteDraw(woosh.Value, Projectile.Center - Main.screenPosition, null, Color.Khaki with { A = 0 } * 0.1f, fxVel.ToRotation() + Projectile.rotation + Main.GlobalTimeWrappedHourly * Projectile.direction * 27, woosh.Size() / 2f, Projectile.scale * 0.45f * throwCompletion, SpriteEffects.None, 0); + Main.EntitySpriteDraw(woosh.Value, Projectile.Center - Main.screenPosition, null, mainColor with { A = 0 } * 0.15f, fxVel.ToRotation() - 1.3f * Projectile.direction + Projectile.rotation + Main.GlobalTimeWrappedHourly * Projectile.direction * 27, woosh.Size() / 2f, Projectile.scale * 0.41f * throwCompletion, SpriteEffects.None, 0); + } + + for (int y = 0; y < 2; y++) + Main.EntitySpriteDraw(glowBlade.Value, fxPos - Main.screenPosition, null, (y != 0 ? Color.White : mainColor) with { A = 0 } * (0.3f * glowUp), fxVel.ToRotation() + MathHelper.PiOver2, glowBlade.Size() / 2f, new Vector2(0.4f * (y != 0 ? 0.65f : 1f), 1f * throwCompletion * glowUp * (i == 0 ? 1.5f : 1)) * Projectile.scale * 0.04f, SpriteEffects.None, 0); + } + } + + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Color.Lerp(Color.White with { A = 0 }, lightColor, (2 - glowUp)) * (inSky ? 0 : 1), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); + return false; } - - public override bool OnTileCollide(Vector2 oldVelocity) + public override void DrawBehind(int index, List behindNPCsAndTiles, List behindNPCs, List behindProjectiles, List overPlayers, List overWiresUI) { - Collision.HitTiles(Projectile.position + Projectile.velocity, Projectile.velocity, Projectile.width, Projectile.height); - SoundEngine.PlaySound(SoundID.Dig, Projectile.Center); - Projectile.Kill(); - return true; - } - - public override void OnKill(int timeLeft) - { - //Crystal smash sound - SoundEngine.PlaySound(SoundID.Item27, Projectile.Center); - // Light burst - int p = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.8f), 0, Projectile.owner, Projectile.ai[0], 0); - Main.projectile[p].rotation = Projectile.rotation; - if (Projectile.Calamity().stealthStrike) - Main.projectile[p].Calamity().stealthStrike = true; + overPlayers.Add(index); } } } diff --git a/Projectiles/Rogue/ExorcismShockwave.cs b/Projectiles/Rogue/ExorcismShockwave.cs index 03b4e58e09..40234674e5 100644 --- a/Projectiles/Rogue/ExorcismShockwave.cs +++ b/Projectiles/Rogue/ExorcismShockwave.cs @@ -1,6 +1,13 @@ -using Microsoft.Xna.Framework; +using CalamityMod.NPCs.Yharon; +using CalamityMod.UI; +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; +using Terraria.GameContent; using Terraria.ModLoader; +using System.Text.RegularExpressions; namespace CalamityMod.Projectiles.Rogue { @@ -8,116 +15,50 @@ namespace CalamityMod.Projectiles.Rogue { public new string LocalizationCategory => "Projectiles.Rogue"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public static float Radius = 100; - public static float RadiusStealth = 200; - public override void SetDefaults() { - Projectile.width = (int)(Projectile.Calamity().stealthStrike ? RadiusStealth * 2 : Radius * 2); - Projectile.height = (int)(Projectile.Calamity().stealthStrike ? RadiusStealth * 2 : Radius * 2); + Projectile.width = 5; + Projectile.height = 5; Projectile.friendly = true; Projectile.penetrate = -1; Projectile.tileCollide = false; Projectile.ignoreWater = true; - Projectile.timeLeft = 9; + Projectile.timeLeft = 14; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; Projectile.DamageType = RogueDamageClass.Instance; } - - public override void AI() + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { - if (Projectile.timeLeft >= 5) - { - Projectile.alpha = (int)((1 - Projectile.ai[0]) * 255f); + float minMult = 0.35f; + int hitsToMinMult = 15; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult; - // Blast wave should be brighter on stealth strikes - int numDust = (int)(40 * Projectile.ai[0]) + 10; - - for (int i = 0; i < numDust; i++) - { - // Dust Type - int dustToUse = Main.rand.Next(0, 3); - int dustType = 0; - switch (dustToUse) - { - case 0: - dustType = 175; - break; - case 1: - dustType = 229; - break; - case 2: - dustType = 263; - break; - } - - // Shockwave - Vector2 circleVelocity = new Vector2(Main.rand.NextFloat(-1, 1), Main.rand.NextFloat(-1, 1)); - circleVelocity.Normalize(); - circleVelocity *= (Projectile.Calamity().stealthStrike ? RadiusStealth : Radius) / 10f; - - int circle = Dust.NewDust(Projectile.Center, 1, 1, dustType, circleVelocity.X, circleVelocity.Y, 0, default, 1.5f); - Main.dust[circle].noGravity = true; - } - - // Cross - Vector2 dustLeft = (new Vector2(-1, 0)).RotatedBy(Projectile.rotation); - Vector2 dustRight = (new Vector2(1, 0)).RotatedBy(Projectile.rotation); - Vector2 dustUp = (new Vector2(0, -1)).RotatedBy(Projectile.rotation); - Vector2 dustDown = (new Vector2(0, 1) * 2f).RotatedBy(Projectile.rotation); - - int dustScale = 7; - Vector2 dustPos = Projectile.Center - new Vector2((dustScale - 1) * 0.5f, (dustScale - 1) * 0.5f); - - float minSpeed = 0f; - float maxSpeed = 5f; - float minScale = 1.9f; - float maxScale = 2.1f; - int dustCount = (int)(5 * Projectile.ai[0]); - - for (int i = 0; i < dustCount; i++) - { - // Dust Type - int dustToUse = Main.rand.Next(0, 3); - int dustType = 0; - switch (dustToUse) - { - case 0: - dustType = 175; - break; - case 1: - dustType = 229; - break; - case 2: - dustType = 263; - break; - } - - int left = Dust.NewDust(dustPos, dustScale, dustScale, dustType, 0f, 0f); - Main.dust[left].noGravity = true; - Main.dust[left].velocity = dustLeft * Main.rand.NextFloat(minSpeed, maxSpeed); - Main.dust[left].scale = Main.rand.NextFloat(minScale, maxScale); - - int right = Dust.NewDust(dustPos, dustScale, dustScale, dustType, 0f, 0f); - Main.dust[right].noGravity = true; - Main.dust[right].velocity = dustRight * Main.rand.NextFloat(minSpeed, maxSpeed); - Main.dust[right].scale = Main.rand.NextFloat(minScale, maxScale); - - int up = Dust.NewDust(dustPos, dustScale, dustScale, dustType, 0f, 0f); - Main.dust[up].noGravity = true; - Main.dust[up].velocity = dustUp * Main.rand.NextFloat(minSpeed, maxSpeed); - Main.dust[up].scale = Main.rand.NextFloat(minScale, maxScale); - - int down = Dust.NewDust(dustPos, dustScale, dustScale, dustType, 0f, 0f); - Main.dust[down].noGravity = true; - Main.dust[down].velocity = dustDown * Main.rand.NextFloat(minSpeed, maxSpeed); - Main.dust[down].scale = Main.rand.NextFloat(minScale, maxScale); - } - } + Vector2 launchVel = Utils.DirectionTo(Projectile.Center, target.Center) - Vector2.UnitY; + float launchPower = (Projectile.Calamity().stealthStrike ? 4f : 1) * 10; + target.MoveNPC(launchVel, launchPower, true); } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + float crossSize = (Projectile.Calamity().stealthStrike ? 4f : 1) * 130; + float crosThickness = (Projectile.Calamity().stealthStrike ? 4f : 1) * 25; + float _ = float.NaN; + bool horizontalHit = Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center - Vector2.UnitX * crossSize, Projectile.Center + Vector2.UnitX * crossSize, crosThickness, ref _); + bool verticalHit = Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center - Vector2.UnitY * crossSize, Projectile.Center + Vector2.UnitY * crossSize * 1.7f, crosThickness, ref _); + return (horizontalHit || verticalHit); + } + public override bool PreDraw(ref Color lightColor) + { + Player Owner = Main.player[Projectile.owner]; + float fade = Utils.GetLerpValue(0, 9, Projectile.timeLeft, true); + Asset him = ModContent.Request("CalamityMod/ExtraTextures/Jesus"); - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, (Projectile.Calamity().stealthStrike ? RadiusStealth : Radius), targetHitbox); + if (Projectile.Calamity().stealthStrike && Main.zenithWorld) + { + Main.EntitySpriteDraw(him.Value, Owner.Center - Main.screenPosition, null, Color.White * 0.45f * fade, 0, him.Size() / 2f, 10, SpriteEffects.None, 0); + } + return false; + } } } diff --git a/Projectiles/Rogue/ExorcismStar.cs b/Projectiles/Rogue/ExorcismStar.cs deleted file mode 100644 index 81f3637e11..0000000000 --- a/Projectiles/Rogue/ExorcismStar.cs +++ /dev/null @@ -1,59 +0,0 @@ -using System; -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class ExorcismStar : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Rogue"; - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Type] = 4; - ProjectileID.Sets.TrailingMode[Type] = 0; - } - - public override void SetDefaults() - { - Projectile.width = 32; - Projectile.height = 32; - Projectile.alpha = 50; - Projectile.friendly = true; - Projectile.penetrate = 1; - Projectile.tileCollide = false; - Projectile.ignoreWater = true; - Projectile.timeLeft = 300; - Projectile.MaxUpdates = 2; - Projectile.DamageType = RogueDamageClass.Instance; - } - - public override void AI() - { - Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.01f * Projectile.direction; - if (Projectile.soundDelay == 0) - { - Projectile.soundDelay = 20 + Main.rand.Next(40); - if (Main.rand.NextBool(5)) - SoundEngine.PlaySound(SoundID.Item9, Projectile.position); - } - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 60); - - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 60); - - public override Color? GetAlpha(Color lightColor) => new Color(250, 200, 45, Projectile.alpha); - - public override bool PreDraw(ref Color lightColor) - { - Projectile.DrawStarTrail(Color.DarkGoldenrod, Color.Gold); - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); - return false; - } - } -} diff --git a/Projectiles/Rogue/ExorcismStar.png b/Projectiles/Rogue/ExorcismStar.png deleted file mode 100644 index e31c55bba6..0000000000 Binary files a/Projectiles/Rogue/ExorcismStar.png and /dev/null differ diff --git a/Projectiles/Rogue/LuxorsGiftRogue.cs b/Projectiles/Rogue/LuxorsGiftRogue.cs index 4992f835b2..be8ef36f5a 100644 --- a/Projectiles/Rogue/LuxorsGiftRogue.cs +++ b/Projectiles/Rogue/LuxorsGiftRogue.cs @@ -41,10 +41,10 @@ namespace CalamityMod.Projectiles.Rogue if (Projectile.velocity.Y > 0) Projectile.velocity.X *= 0.99f; - if (Projectile.timeLeft > 60) + if (Projectile.timeLeft > 60 && Projectile.timeLeft % 2 == 0) { Vector2 dustVel = (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2().RotatedByRandom(0.05f) * Main.rand.NextFloat(0.1f, 0.3f); - Dust dust = Dust.NewDustPerfect(Projectile.Center, 278, dustVel); + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), dustVel); dust.noGravity = true; dust.scale = Main.rand.NextFloat(0.4f, 0.5f); dust.color = Color.Magenta; diff --git a/Projectiles/Rogue/SeafoamBombProj.cs b/Projectiles/Rogue/SeafoamBombProj.cs index 8afb260719..ea6787c932 100644 --- a/Projectiles/Rogue/SeafoamBombProj.cs +++ b/Projectiles/Rogue/SeafoamBombProj.cs @@ -70,16 +70,20 @@ namespace CalamityMod.Projectiles.Rogue } float throwCount = Projectile.localAI[0]; - for (int i = 0; i < (Main.zenithWorld ? 38 : 8); i++) + if (Main.myPlayer == Projectile.owner) { - throwCount++; - Vector2 vel = (Vector2.UnitY * -5).RotatedByRandom(0.6f) * Main.rand.NextFloat(0.8f, 1.3f); - int stealth = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, vel, Projectile.type, Projectile.damage / 4, Projectile.knockBack, Projectile.owner); - Main.projectile[stealth].Calamity().stealthStrike = true; - Main.projectile[stealth].localAI[0] = throwCount; - Main.projectile[stealth].ai[0] = 1; - Main.projectile[stealth].extraUpdates = 3; + for (int i = 0; i < (Main.zenithWorld ? 38 : 8); i++) + { + throwCount++; + Vector2 vel = (Vector2.UnitY * -5).RotatedByRandom(0.6f) * Main.rand.NextFloat(0.8f, 1.3f); + int stealth = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, vel, Projectile.type, Projectile.damage / 4, Projectile.knockBack, Projectile.owner); + Main.projectile[stealth].Calamity().stealthStrike = true; + Main.projectile[stealth].localAI[0] = throwCount; + Main.projectile[stealth].ai[0] = 1; + Main.projectile[stealth].extraUpdates = 3; + } } + SoundEngine.PlaySound(SoundID.DD2_ExplosiveTrapExplode with { Pitch = -0.3f, Volume = 0.8f }, Projectile.Center); } else // Normal bubble spawn diff --git a/Projectiles/Rogue/SeafoamBubble.cs b/Projectiles/Rogue/SeafoamBubble.cs index bf96565d51..5cd7cf61a0 100644 --- a/Projectiles/Rogue/SeafoamBubble.cs +++ b/Projectiles/Rogue/SeafoamBubble.cs @@ -179,7 +179,7 @@ namespace CalamityMod.Projectiles.Rogue int hitsToMinMult = 5; int debuff1 = ModContent.BuffType(); int debuffTime = 180; - if (Projectile.localAI[0] >= 0) // On kill but exclude small bubbles and bubbled that died in a fuse + if (Projectile.localAI[0] >= 0 && Main.myPlayer == Projectile.owner) // On kill but exclude small bubbles and bubbled that died in a fuse { Projectile blast = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack, Projectile.owner, blastSize, minMultiplier, hitsToMinMult); blast.localAI[0] = debuff1; diff --git a/Projectiles/Summon/SeashineSwordProj.cs b/Projectiles/Summon/SeashineSwordProj.cs new file mode 100644 index 0000000000..a138121bc1 --- /dev/null +++ b/Projectiles/Summon/SeashineSwordProj.cs @@ -0,0 +1,321 @@ +using System; +using System.Collections.Generic; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.Summon; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Summon; +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.Summon +{ + public class SeashineSwordProj : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Summon"; + public Player Owner => Main.player[Projectile.owner]; + public float attackTimer = 0; + public float time = 0; + public bool isSpawning => time < 180; + + public float bladeCharge = 0; // The charge level of the blade, ranges from 0 to 1 + + public Vector2 tipPosition; + public Vector2 savedTipPos = Vector2.Zero; + public bool attackMode => Owner.HeldItem.type == ModContent.ItemType(); // If not holding the weapon, the blades won't charge (no whips for you) + + // Values stored to create blade swing arc + public Vector2 startPos; + public Vector2 endPos; + public bool setPos = true; + + public bool isAttacking = false; // If the blade is in the swinging animation to attack + public bool readySound = true; + public static int baseReturnSpeed = 18; + public int returnSpeed = baseReturnSpeed; // How fast blades retun to you + public float bladeValue = 0; // The delay between each sword swing + public Color mainColor; + + public float bladeChargeSpeed = 0.0015f; + + public override void SetStaticDefaults() + { + ProjectileID.Sets.MinionSacrificable[Type] = true; + // Minion targeting feature is not active here since this isn't a normal summon weapon + } + public override void SetDefaults() + { + Projectile.width = 32; + Projectile.height = 34; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minionSlots = 0.5f; + Projectile.timeLeft = 90000; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.minion = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 70 * Projectile.MaxUpdates; + Projectile.DamageType = DamageClass.Summon; + Projectile.extraUpdates = 2; + } + + public override void AI() + { + // Color shifting + float rate = (Main.GlobalTimeWrappedHourly + Projectile.ai[1]) * 6; + List eColors = new List() + { + Color.RoyalBlue, + Color.Turquoise + }; + + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + mainColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); + + // This is the delay between each sword swing, the time bewteen gets shorter as you get more swords + // This is so it doesn't take forever for swords to come out when you have a lot of them + bladeValue = (Projectile.ai[1] * (6 / MathHelper.Clamp(Owner.ownedProjectileCounts[Projectile.type] * 0.1f, 1, 1000))) + 10; + + // This checks when the blade is told to attacking to see if it can attack + if (Projectile.ai[0] == 5 && bladeCharge >= 1) + isAttacking = true; + else if (attackTimer == 0) + Projectile.ai[0] = 0; + + Lighting.AddLight(Projectile.Center, Color.White.ToVector3() * 0.6f); + ApplyPlayerBuffs(); + + tipPosition = Projectile.Center + (Vector2.UnitX * MathHelper.Clamp(bladeCharge * 103, 0, 2000)).RotatedBy(Projectile.rotation) * Projectile.scale; + Vector2 tipVel = (savedTipPos - tipPosition); + savedTipPos = tipPosition; + + if (isSpawning) // The effects when you first throw out a summon + { + if (time >= 110) // Shine effect when spawning + { + if (time == 110) + { + for (int i = 0; i < 15; i++) + { + Dust dust = Dust.NewDustPerfect(tipPosition, ModContent.DustType(), Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(7f, 14f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.85f, 1.3f); + dust.color = mainColor; + dust.noLightEmittence = true; + } + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/ExobladeBeamSlash") with { Volume = 0.45f, Pitch = 0.9f }, Projectile.Center); + for (int i = 0; i < 2; i++) + { + Particle fx = new CustomSpark(tipPosition, (i == 0 ? Vector2.UnitY : Vector2.UnitX).RotatedBy(MathHelper.ToRadians(45)) * 0.01f, "CalamityMod/Particles/ThinEndedLine", false, 18, 1, mainColor, new Vector2(3.3f, 0.6f), extraRotation: 0, shrinkSpeed: 0.9f); + GeneralParticleHandler.SpawnParticle(fx); + } + } + Projectile.rotation = Utils.AngleLerp(Projectile.rotation, -Vector2.UnitY.ToRotation(), 0.1f); + Projectile.velocity *= 0.95f; + } + else // Spinning + { + Projectile.velocity *= 0.96f; + Dust dust = Dust.NewDustPerfect(tipPosition, ModContent.DustType(), Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 0.2f)); + dust.noGravity = false; + dust.scale = Main.rand.NextFloat(0.55f, 0.7f); + dust.color = mainColor; + dust.noLightEmittence = true; + if (time >= 80) + Projectile.rotation = Utils.AngleLerp(Projectile.rotation, -Vector2.UnitY.ToRotation(), 0.09f); + else + Projectile.rotation += 0.15f; + } + bladeCharge = 0.4f; + } + else // The actual active ai for the summon + { + if (isAttacking) // When commanded to attack and is fully charged + { + attackTimer++; + if (attackTimer >= 120 + bladeValue) // Reset values after a swing + { + Projectile.netUpdate = true; + attackTimer = 80; + Projectile.ai[0] = 0; + setPos = true; + isAttacking = false; + readySound = true; + bladeCharge = 0.9f; + Projectile.numHits = 0; + Projectile.scale = 1; + returnSpeed = 460; + } + + if (attackTimer > bladeValue && Projectile.ai[0] != 0) // The actual swing + { + Vector2 toMouse = Utils.DirectionTo(Projectile.Center, Owner.ClampedMouseWorld()); + float lerp = Utils.GetLerpValue(30 + bladeValue, 100 + bladeValue, attackTimer, true); + if (setPos) + { + Projectile.netUpdate = true; + startPos = Projectile.Center; + endPos = Owner.Calamity().mouseWorld + toMouse * 480; + Projectile.numHits = 0; + setPos = false; + } + + Projectile.velocity = (Vector2.Lerp(startPos, endPos, lerp) - Projectile.Center) / returnSpeed; + float angles = 180 * (Projectile.ai[1] % 2 == 0 ? -1 : 1); + float rot = Utils.DirectionTo(startPos, endPos).RotatedBy(MathHelper.Lerp(MathHelper.ToRadians(-angles), MathHelper.ToRadians(angles) / 5, (float)Math.Pow(lerp, 1.5f))).ToRotation(); + Projectile.rotation = Utils.AngleLerp(Projectile.rotation, rot, 0.1f); + + } + else // An altered version of the on back code to get them into position to swing + { + float sine = (float)Math.Sin((Main.GlobalTimeWrappedHourly + Projectile.ai[1]) * 4 / MathHelper.Pi); + Vector2 bonusPos = (Vector2.UnitY * 6).RotatedBy((Main.GlobalTimeWrappedHourly + Projectile.ai[1]) * 7); + Projectile.rotation = Utils.AngleLerp(Projectile.rotation, Utils.DirectionTo(Owner.Center, Projectile.Center).ToRotation(), 0.05f); + + float destLerp = Utils.GetLerpValue(0, bladeValue, attackTimer, true); + Vector2 destination = Owner.Center + bonusPos + (Vector2.UnitX * Owner.direction).RotatedBy(Projectile.ai[2] * Owner.direction / 2) * (-20 - 330 * (float)Math.Pow(destLerp, 2)); + Projectile.velocity = (destination - Projectile.Center) / (returnSpeed * 0.6f); + } + } + else // Chill on the players back while charging the blade + { + float sine = (float)Math.Sin((Main.GlobalTimeWrappedHourly + Projectile.ai[1]) * 4 / MathHelper.Pi); + Vector2 bonusPos = (Vector2.UnitY * 6).RotatedBy((Main.GlobalTimeWrappedHourly + Projectile.ai[1]) * 7); + + Projectile.rotation = Utils.AngleLerp(Projectile.rotation, Utils.DirectionTo(Owner.Center + Vector2.UnitY * -60, Projectile.Center).ToRotation(), Utils.Remap(returnSpeed, baseReturnSpeed, 460, 0.05f, 0.005f, true)); + + Vector2 destination = Owner.Center + bonusPos - Vector2.UnitY * 40 + (Vector2.UnitX * Owner.direction).RotatedBy(Projectile.ai[2] * Owner.direction / 3) * (-15 - Projectile.ai[1] * 18); + Projectile.velocity = (destination - Projectile.Center) / returnSpeed; + if (bladeCharge < 1f) + bladeCharge += bladeChargeSpeed; + + // The weapon theoretically works with projectile scale, though I ended up not using it + //if (Projectile.scale < 3) + //Projectile.scale += 0.01f; + } + if (readySound && bladeCharge >= 1) // Effect when the blade is fully charged + { + Projectile.netUpdate = true; + for (int i = 0; i < 8; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1.5f)); + dust.noGravity = false; + dust.scale = Main.rand.NextFloat(0.65f, 1f); + dust.color = mainColor; + dust.noLightEmittence = true; + } + SoundEngine.PlaySound(SoundID.Item27 with { Volume = 0.8f, Pitch = Main.rand.NextFloat(0.5f, 0.65f) + Projectile.ai[1] * 0.05f }, Projectile.Center); + readySound = false; + } + } + // This is the tip trail for the blades, it is a very consistently good looking trail, however it creates a LOT of particles + // I do not recommend reusing this effect unless you're using it carefully + if ((returnSpeed == baseReturnSpeed && bladeCharge >= 1 || (isAttacking && attackTimer > bladeValue + 5)) || isSpawning) + { + Particle orb = new CustomSpark(tipPosition, tipVel.SafeNormalize(Vector2.UnitX), "CalamityMod/Particles/BloomCircle", false, isAttacking ? 30 : 12, Utils.Remap(tipVel.Length(), 2, 15, 0.15f, 0.3f, true) * Projectile.scale, mainColor * 0.65f, new Vector2(1f, isAttacking ? 1.3f : 1), true, true, shrinkSpeed: Utils.Remap(tipVel.Length(), 1, 8, 0f, 0.4f, true), glowOpacity: 0.5f, glowCenterScale: 0.8f); + GeneralParticleHandler.SpawnParticle(orb); + } + // The uncharge of the blades when you're not holding the item or after they slash + if (!isAttacking && (attackTimer > 0 || !attackMode)) + { + bladeCharge = MathHelper.Clamp(MathHelper.Lerp(bladeCharge, 0, 0.025f), 0.4f, 1); + if (attackTimer > 0) + attackTimer--; + readySound = true; + } + // How fast the blades try to reach their goal position when not activley slashing + // Tries to get back to the base value when possible + if (returnSpeed > baseReturnSpeed) + { + returnSpeed = (int)(returnSpeed * 0.99f); + } + else + returnSpeed = baseReturnSpeed; + + time++; + } + public void ApplyPlayerBuffs() + { + Owner.AddBuff(ModContent.BuffType(), 3600); + if (Projectile.type == ModContent.ProjectileType()) + { + if (Owner.dead) + Owner.Calamity().seashineSwordBuff = false; + if (Owner.Calamity().seashineSwordBuff) + Projectile.timeLeft = 2; + } + } + public override bool PreDraw(ref Color lightColor) + { + Texture2D tex = ModContent.Request("CalamityMod/Items/Weapons/Summon/SeashineSword").Value; + Texture2D tex2 = ModContent.Request("CalamityMod/Particles/GlowBlade").Value; + Texture2D tex3 = ModContent.Request("CalamityMod/Particles/FullStar").Value; + + Vector2 drawPos = Projectile.Center - Main.screenPosition; + float extremeLerp = (float)Math.Pow(bladeCharge, 10); + for (int i = 0; i < 3; i++) + Main.EntitySpriteDraw(tex2, drawPos - (Vector2.UnitY.RotatedBy(Projectile.rotation + MathHelper.ToRadians(90)) * 59 * bladeCharge * Projectile.scale), null, Color.Lerp(mainColor, Color.White, i * 0.3f) with { A = 0 }, Projectile.rotation + MathHelper.ToRadians(90), tex2.Size() * 0.5f, new Vector2(0.33f - i * 0.05f, (0.75f + i * 0.03f) * bladeCharge) * 0.05f * Projectile.scale, SpriteEffects.None); + + for (int i = 0; i < 2; i++) + Main.EntitySpriteDraw(tex, drawPos, null, Color.Lerp(lightColor, (i == 0 ? Color.White : mainColor) with { A = 0 }, extremeLerp), Projectile.rotation + MathHelper.ToRadians(45), tex.Size() * 0.5f, (i == 0 ? 0.8f : 1) * Projectile.scale, SpriteEffects.None); + + if (!isAttacking && bladeCharge < 1) + { + for (int i = 0; i < 2; i++) + Main.EntitySpriteDraw(tex3, drawPos, null, mainColor with { A = 0 }, Projectile.rotation + MathHelper.ToRadians(45), tex3.Size() * 0.5f, new Vector2(i == 0 ? 1 : 3, i == 0 ? 3 : 1) * Main.rand.NextFloat(0.8f, 1.1f) * extremeLerp, SpriteEffects.None); + } + return false; + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 120); + if (isAttacking) + { + for (int i = 0; i < 6; i++) + { + if (i % 2 == 0) + { + Particle spark = new SeaPrismParticle(Projectile.Center, (Projectile.velocity.SafeNormalize(Vector2.UnitX)).RotatedByRandom(0.6f) * Main.rand.NextFloat(10f, 30f), true, 40, Main.rand.NextFloat(0.85f, 1.3f), Color.White, Vector2.One, false, Main.rand.NextFloat(-0.3f, 0.3f), affectedByLight: false); + GeneralParticleHandler.SpawnParticle(spark); + } + + Particle e = new CustomSpark(Projectile.Center, (Projectile.velocity.SafeNormalize(Vector2.UnitX)).RotatedByRandom(0.6f) * Main.rand.NextFloat(7f, 20f), "CalamityMod/Particles/WaterFoam", false, 14, Main.rand.NextFloat(0.1f, 0.2f) * 2.5f, Main.rand.NextBool() ? Color.Cyan : Color.DodgerBlue, new Vector2(1f, 1f), true, false, shrinkSpeed: 0.4f); + GeneralParticleHandler.SpawnParticle(e); + } + for (int i = 0; i < 3; i++) + { + //Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), (Projectile.velocity.SafeNormalize(Vector2.UnitX)).RotatedByRandom(0.6f) * Main.rand.NextFloat(5f, 15f)); + //dust.noGravity = false; + //dust.scale = Main.rand.NextFloat(0.95f, 1.4f); + //dust.color = mainColor; + //dust.noLightEmittence = true; + } + SoundEngine.PlaySound(SoundID.DD2_WitherBeastCrystalImpact with { Volume = 0.7f, PitchVariance = 0.3f }, Projectile.Center); + } + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + // Blades should do big damage on the inital hit due to the large delay between attacks + // However, it's pierce reduction is quite severe (at least right now) + float minMult = 0.1f; + int hitsToMinMult = 4; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult; + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) // Custom collision since it's a spear + { + // Perform an AABB line collision check to check the whole spear. + float _ = float.NaN; + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, tipPosition, 30 * Projectile.scale, ref _); + } + public override bool? CanDamage() => (isAttacking && attackTimer > bladeValue && Projectile.ai[0] != 0) ? null : false; + } +} diff --git a/Projectiles/Melee/SeashineSwordProj.png b/Projectiles/Summon/SeashineSwordProj.png similarity index 100% rename from Projectiles/Melee/SeashineSwordProj.png rename to Projectiles/Summon/SeashineSwordProj.png diff --git a/Sounds/Custom/BubbleCracklePop.ogg b/Sounds/Custom/BubbleCracklePop.ogg new file mode 100644 index 0000000000..f1f0f2deca Binary files /dev/null and b/Sounds/Custom/BubbleCracklePop.ogg differ diff --git a/Sounds/Custom/GFB/OceanShieldParryGFB.ogg b/Sounds/Custom/GFB/OceanShieldParryGFB.ogg new file mode 100644 index 0000000000..89985cebee Binary files /dev/null and b/Sounds/Custom/GFB/OceanShieldParryGFB.ogg differ diff --git a/Sounds/Item/HolyBurst.ogg b/Sounds/Item/HolyBurst.ogg new file mode 100644 index 0000000000..d98119c2fa Binary files /dev/null and b/Sounds/Item/HolyBurst.ogg differ diff --git a/Sounds/Item/HolyLoop.ogg b/Sounds/Item/HolyLoop.ogg new file mode 100644 index 0000000000..191e4f1bc8 Binary files /dev/null and b/Sounds/Item/HolyLoop.ogg differ diff --git a/Systems/TileMerging/TileBlendMergeSystem.cs b/Systems/TileMerging/TileBlendMergeSystem.cs index 88658e9bc5..5da7dde7a6 100644 --- a/Systems/TileMerging/TileBlendMergeSystem.cs +++ b/Systems/TileMerging/TileBlendMergeSystem.cs @@ -28,6 +28,8 @@ namespace CalamityMod.Systems static void SetupTileTypeToBlendTextureSlot() { + if (TileBlendTextureLoader.AllTextures == null) + return; foreach (var blendTexture in TileBlendTextureLoader.AllTextures) { _TileTypeToBlendTextureSlot[blendTexture.TileType] = (byte)blendTexture.Slot;