diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 19334b4218..123ceb6319 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -5718,10 +5718,6 @@ namespace CalamityMod.CalPlayer Player.handon = -1; } } - - //Give the braids variant to w*men - if (!Player.Male && Player.head == EquipLoader.GetEquipSlot(Mod, "WulfrumHat", EquipType.Head)) - Player.head = EquipLoader.GetEquipSlot(Mod, "WulfrumHatFemale", EquipType.Head); } #endregion diff --git a/ILEditing/ILChangesLoading.cs b/ILEditing/ILChangesLoading.cs index 2626a1fdf5..b46b86aba3 100644 --- a/ILEditing/ILChangesLoading.cs +++ b/ILEditing/ILChangesLoading.cs @@ -51,6 +51,7 @@ namespace CalamityMod.ILEditing IL.Terraria.Player.QuickMana += ConditionallyReplaceManaSickness; IL.Terraria.Player.ItemCheck_Inner += ConditionallyReplaceManaSickness; On.Terraria.Main.SortDrawCacheWorms += DrawFusableParticles; + On.Terraria.Main.DrawInfernoRings += DrawForegroundParticles; On.Terraria.Main.SetDisplayMode += ResetRenderTargetSizes; IL.Terraria.GameContent.Drawing.TileDrawing.DrawPartialLiquid += DrawCustomLava; IL.Terraria.GameContent.Liquid.LiquidRenderer.InternalDraw += DrawCustomLava2; @@ -155,6 +156,7 @@ namespace CalamityMod.ILEditing IL.Terraria.Player.QuickMana -= ConditionallyReplaceManaSickness; IL.Terraria.Player.ItemCheck_Inner -= ConditionallyReplaceManaSickness; On.Terraria.Main.SortDrawCacheWorms -= DrawFusableParticles; + On.Terraria.Main.DrawInfernoRings -= DrawForegroundParticles; On.Terraria.Main.SetDisplayMode -= ResetRenderTargetSizes; IL.Terraria.GameContent.Drawing.TileDrawing.DrawPartialLiquid -= DrawCustomLava; IL.Terraria.GameContent.Liquid.LiquidRenderer.InternalDraw -= DrawCustomLava2; diff --git a/ILEditing/MechanicILChanges.cs b/ILEditing/MechanicILChanges.cs index 73b0c75f8d..8736272473 100644 --- a/ILEditing/MechanicILChanges.cs +++ b/ILEditing/MechanicILChanges.cs @@ -647,7 +647,7 @@ namespace CalamityMod.ILEditing #region General Particle Rendering private static void DrawFusableParticles(On.Terraria.Main.orig_SortDrawCacheWorms orig, Main self) { - GeneralParticleHandler.DrawAllParticles(Main.spriteBatch); + DeathAshParticle.DrawAll(); FusableParticleManager.RenderAllFusableParticles(); @@ -657,6 +657,10 @@ namespace CalamityMod.ILEditing orig(self); } + private static void DrawForegroundParticles(On.Terraria.Main.orig_DrawInfernoRings orig, Main self) + { + GeneralParticleHandler.DrawAllParticles(Main.spriteBatch); + } #endregion General Particle Rendering #region Custom Lava Visuals diff --git a/Items/Accessories/Vanity/AbandonnedWulfrumHelmet.cs b/Items/Accessories/Vanity/AbandonnedWulfrumHelmet.cs index ecd283d27c..e26bfb95cb 100644 --- a/Items/Accessories/Vanity/AbandonnedWulfrumHelmet.cs +++ b/Items/Accessories/Vanity/AbandonnedWulfrumHelmet.cs @@ -67,32 +67,44 @@ namespace CalamityMod.Items.Accessories.Vanity public override void UpdateVanity(Player player) { player.GetModPlayer().transformationActive = true; + player.GetModPlayer().vanityEquipped = true; } public override void UpdateAccessory(Player player, bool hideVisual) { if (!hideVisual) + { player.GetModPlayer().transformationActive = true; + player.GetModPlayer().vanityEquipped = true; + } } } public class WulfrumTransformationPlayer : ModPlayer { + public bool vanityEquipped = false; public bool transformationActive = false; + public bool forceHelmetOn = false; public override void ResetEffects() { + vanityEquipped = false; transformationActive = false; + forceHelmetOn = false; } public override void FrameEffects() { + if (forceHelmetOn || transformationActive) + { + Player.head = EquipLoader.GetEquipSlot(Mod, "WulfrumOldSetHead", EquipType.Head); + Player.face = -1; + } + if (transformationActive) { Player.legs = EquipLoader.GetEquipSlot(Mod, "AbandonnedWulfrumHelmet", EquipType.Legs); Player.body = EquipLoader.GetEquipSlot(Mod, "AbandonnedWulfrumHelmet", EquipType.Body); - Player.head = EquipLoader.GetEquipSlot(Mod, "WulfrumOldSetHead", EquipType.Head); - Player.face = -1; } } } diff --git a/Items/Armor/Wulfrum/WulfrumSet.cs b/Items/Armor/Wulfrum/WulfrumSet.cs index f0f3092db9..aaccf8d848 100644 --- a/Items/Armor/Wulfrum/WulfrumSet.cs +++ b/Items/Armor/Wulfrum/WulfrumSet.cs @@ -26,6 +26,7 @@ using static Microsoft.Xna.Framework.Input.Keys; using System; using CalamityMod.Items.BaseItems; using System.Collections.Generic; +using CalamityMod.Particles; namespace CalamityMod.Items.Armor.Wulfrum { @@ -47,14 +48,12 @@ namespace CalamityMod.Items.Armor.Wulfrum public static readonly SoundStyle SetActivationSound = new("CalamityMod/Sounds/Custom/AbilitySounds/WulfrumBastionActivate"); public static readonly SoundStyle SetBreakSound = new("CalamityMod/Sounds/Custom/AbilitySounds/WulfrumBastionBreak"); public static readonly SoundStyle SetBreakSoundSafe = new("CalamityMod/Sounds/Custom/AbilitySounds/WulfrumBastionBreakSafely"); - + + public static int BastionBuildTime = (int)(0.25f * 60); public static int BastionTime = 30 * 60; public static int TimeLostPerHit = 2 * 60; public static int BastionCooldown = 20 * 60; - public static int BastionShootDamage = 10; - public static float BastionShootSpeed = 18f; - public static int BastionShootTime = 10; internal static Item DummyCannon = new Item(); //Used for the attack swap. Basically we force the player to hold a fake item. @@ -88,6 +87,8 @@ namespace CalamityMod.Items.Armor.Wulfrum private void ActivateSetBonus(On.Terraria.Player.orig_KeyDoubleTap orig, Player player, int keyDir) { + BastionBuildTime = (int)(0.55f * 60); + if (keyDir == 0 && HasArmorSet(player)) { //Only activate if no cooldown & available scrap. @@ -98,8 +99,6 @@ namespace CalamityMod.Items.Armor.Wulfrum player.AddCooldown(WulfrumBastion.ID, BastionCooldown + BastionTime); //Though do i need to sync that or is the player inventory auto synced? DummyCannon.SetDefaults(ItemType()); - - SoundEngine.PlaySound(SetActivationSound); } } @@ -129,10 +128,8 @@ namespace CalamityMod.Items.Armor.Wulfrum SacrificeTotal = 1; DisplayName.SetDefault("Wulfrum Hat & Goggles"); Tooltip.SetDefault("10% increased minion damage\n"+ - "Comes equipped with hair extensions" - ); + "Comes equipped with hair extensions" ); } - public override void SetDefaults() { Item.width = 18; @@ -149,17 +146,40 @@ namespace CalamityMod.Items.Armor.Wulfrum public override void UpdateArmorSet(Player player) { - player.GetModPlayer().wulfrumSet = true; + WulfrumArmorPlayer armorPlayer = player.GetModPlayer(); + WulfrumTransformationPlayer transformationPlayer = player.GetModPlayer(); + + armorPlayer.wulfrumSet = true; player.setBonus = "+3 defense and +1 max minion"; //The cooler part of the set bonus happens in modifytooltips because i can't recolor it otherwise. Madge player.statDefense += 3; player.maxMinions++; - if (PowerModeEngaged(player, out _)) + if (PowerModeEngaged(player, out var cd)) { - player.GetModPlayer().transformationActive = true; + if (cd.timeLeft == BastionCooldown + BastionTime) + { + ActivationEffects(player); + } + + //Can't account for previous fullbody transformations but at this point, whatever. + Item headItem = player.armor[10] ?? player.armor[0]; + bool hatVisible = !transformationPlayer.transformationActive && headItem.type == ItemType(); + + //Spawn the hat + if (cd.timeLeft == BastionCooldown + BastionTime - (int)(BastionBuildTime * 0.9f) && hatVisible) + { + Particle leftoverHat = new WulfrumHatParticle(player, -Vector2.UnitY.RotatedByRandom(MathHelper.PiOver4) * Main.rand.NextFloat(3f, 7f), 25); + GeneralParticleHandler.SpawnParticle(leftoverHat); + } + + if (cd.timeLeft < BastionCooldown + BastionTime - BastionBuildTime) + player.GetModPlayer().transformationActive = true; + else if (cd.timeLeft <= BastionCooldown + BastionTime - (int)(BastionBuildTime * 0.9f)) + player.GetModPlayer().forceHelmetOn = true; + + player.moveSpeed *= 0.8f; player.statDefense += 15; - //Drop the player's held item if they were holding something before if (!(Main.mouseItem.type == DummyCannon.type) && !Main.mouseItem.IsAir) Main.LocalPlayer.QuickSpawnClonedItem(null, Main.mouseItem, Main.mouseItem.stack); @@ -180,6 +200,33 @@ namespace CalamityMod.Items.Armor.Wulfrum } } + public void ActivationEffects(Player player) + { + SoundEngine.PlaySound(SetActivationSound); + + //Do'nt do the effect ifthe player is already using the wulfrum vanity lol. + bool transformedAlready = player.GetModPlayer().transformationActive; + + if (!transformedAlready) + { + for (int i = 0; i < 5; i++) + { + Particle part = new WulfrumBastionPartsParticle(player, i, BastionBuildTime + 2); + GeneralParticleHandler.SpawnParticle(part); + } + } + + //Do spawn the cannon always though + Particle gun = new WulfrumBastionPartsParticle(player, 5, BastionBuildTime + 2); + + if (transformedAlready) + { + (gun as WulfrumBastionPartsParticle).TimeOffset = 0; + (gun as WulfrumBastionPartsParticle).AnimationTime = BastionBuildTime + 2; + } + GeneralParticleHandler.SpawnParticle(gun); + } + public static void ModifySetTooltips(ModItem item, List tooltips) { if (HasArmorSet(Main.LocalPlayer)) @@ -196,7 +243,7 @@ namespace CalamityMod.Items.Armor.Wulfrum setBonus2.OverrideColor = new Color(110, 192, 93); tooltips.Insert(setBonusIndex + 2, setBonus2); - TooltipLine setBonus3 = new TooltipLine(item.Mod, "CalamityMod:SetBonus3", "Calling down the armor consumes one piece of wulfrum scrap, and the armor will loose durability faster when hit"); + TooltipLine setBonus3 = new TooltipLine(item.Mod, "CalamityMod:SetBonus3", "Calling down the armor consumes one piece of wulfrum scrap, and the armor will lose durability faster when hit"); setBonus3.OverrideColor = new Color(110, 192, 93); tooltips.Insert(setBonusIndex + 3, setBonus3); } @@ -316,8 +363,9 @@ namespace CalamityMod.Items.Armor.Wulfrum public override void SetStaticDefaults() { DisplayName.SetDefault("Experimental Wulfrum Fusion Array"); - Tooltip.SetDefault("Fires quick bursts of medium-range pellets\n"); - //Imaging hiding lore in there... :drool: that would be so dark souls + Tooltip.SetDefault("Fires quick bursts of medium-range pellets\n" + + "[c/878787:\"Who needs whips when you can simply become the summon yourself?\"]"); + //Imaging hiding actually important/interesting/funny lore in there... :drool: that would be so dark souls } public override string Texture => "CalamityMod/Items/Armor/Wulfrum/WulfrumFusionCannon"; @@ -343,6 +391,12 @@ namespace CalamityMod.Items.Armor.Wulfrum Item.reuseDelay = 17; } + public override void ModifyTooltips(List tooltips) + { + var name = tooltips.FirstOrDefault(x => x.Name == "ItemName" && x.Mod == "Terraria"); + name.OverrideColor = Color.Lerp(new Color(194, 255, 67), new Color(112, 244, 244), 0.5f + 0.5f * (float)Math.Sin(Main.GlobalTimeWrappedHourly * 3f)); + } + public override void HoldItem(Player player) { player.Calamity().mouseWorldListener = true; @@ -355,6 +409,12 @@ namespace CalamityMod.Items.Armor.Wulfrum Main.mouseItem = new Item(); } } + + Item.noUseGraphic = false; + + if (!player.Calamity().cooldowns.TryGetValue(WulfrumBastion.ID, out var cd) || cd.timeLeft > WulfrumHat.BastionCooldown + WulfrumHat.BastionTime - WulfrumHat.BastionBuildTime) + Item.noUseGraphic = true; + } public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) @@ -362,6 +422,11 @@ namespace CalamityMod.Items.Armor.Wulfrum velocity = velocity.RotatedByRandom(MathHelper.PiOver4 * 0.1f); } + public override bool CanUseItem(Player player) + { + return player.Calamity().cooldowns.TryGetValue(WulfrumBastion.ID, out var cd) && cd.timeLeft < WulfrumHat.BastionCooldown + WulfrumHat.BastionTime - WulfrumHat.BastionBuildTime; + } + public void SetItemInHand(Player player, Rectangle heldItemFrame) { //Make the player face where they're aiming. @@ -374,6 +439,9 @@ namespace CalamityMod.Items.Armor.Wulfrum player.ChangeDir(-1); } + if (!player.Calamity().cooldowns.TryGetValue(WulfrumBastion.ID, out var cd) || cd.timeLeft > WulfrumHat.BastionCooldown + WulfrumHat.BastionTime - WulfrumHat.BastionBuildTime) + return; + float animProgress = 1 - player.itemAnimation / (float)player.itemAnimationMax; //Default @@ -415,7 +483,6 @@ namespace CalamityMod.Items.Armor.Wulfrum public bool wulfrumSet = false; - public override void ResetEffects() { wulfrumSet = false; @@ -430,14 +497,8 @@ namespace CalamityMod.Items.Armor.Wulfrum { if (WulfrumHat.PowerModeEngaged(Player, out var cd) && Main.netMode != NetmodeID.Server) { - for (int i = 1; i < 9; i++) - { - Vector2 shrapnelVelocity = Main.rand.NextVector2Circular(9f, 9f); - string goreType = "WulfrumPowerSuit" + i.ToString(); - Gore.NewGore(Player.GetSource_Death(), Player.Center, shrapnelVelocity, Mod.Find(goreType).Type); - } - - SoundEngine.PlaySound(WulfrumHat.SetBreakSound, Player.Center); + SetBonusEndEffect(true); + Player.GetModPlayer().transformationActive = false; } } @@ -445,19 +506,7 @@ namespace CalamityMod.Items.Armor.Wulfrum { if (wulfrumSet && Player.Calamity().cooldowns.TryGetValue(WulfrumBastion.ID, out var cd) && cd.timeLeft == WulfrumHat.BastionCooldown) { - int j = 1; - for (int i = 1; i < 4; i++) - { - j = (int)Math.Clamp(j, 1, 8); - - Vector2 shrapnelVelocity = Main.rand.NextVector2Circular(3f, 3f); - string goreType = "WulfrumPowerSuit" + j.ToString(); - Gore.NewGore(Player.GetSource_FromThis(), Player.Center, shrapnelVelocity, Mod.Find(goreType).Type); - - j += Main.rand.Next(1, 2); - } - - SoundEngine.PlaySound(WulfrumHat.SetBreakSoundSafe, Player.Center); + SetBonusEndEffect(false); } } @@ -467,12 +516,54 @@ namespace CalamityMod.Items.Armor.Wulfrum { cd.timeLeft -= WulfrumHat.TimeLostPerHit; if (cd.timeLeft < WulfrumHat.BastionCooldown) - cd.timeLeft = WulfrumHat.BastionCooldown; - - //Gore + { + cd.timeLeft = WulfrumHat.BastionCooldown - 1; + if (Main.netMode != NetmodeID.Server) + SetBonusEndEffect(true); + } } } + public void SetBonusEndEffect(bool violent) + { + SoundStyle breakSound = WulfrumHat.SetBreakSoundSafe; + float goreSpeed = 3f; + int goreCount = 4; + int goreIncrement = 2; + + if (violent) + { + breakSound = WulfrumHat.SetBreakSound; + goreSpeed = 9f; + goreCount = 9; + goreIncrement = 1; + } + + SoundEngine.PlaySound(breakSound, Player.Center); + //Only spawn the cannon gore if the player already has the vanity on. + if (Player.GetModPlayer().vanityEquipped) + { + Vector2 shrapnelVelocity = Main.rand.NextVector2Circular(goreSpeed, goreSpeed); + Gore.NewGore(Player.GetSource_Death(), Player.Center, shrapnelVelocity, Mod.Find("WulfrumPowerSuit1").Type); + } + + else + { + int j = 1; + + for (int i = 1; i < goreCount; i++) + { + Vector2 shrapnelVelocity = Main.rand.NextVector2Circular(goreSpeed, goreSpeed); + string goreType = "WulfrumPowerSuit" + j.ToString(); + Gore.NewGore(Player.GetSource_Death(), Player.Center, shrapnelVelocity, Mod.Find(goreType).Type); + + j += Main.rand.Next(1, goreIncrement); + } + } + } + + + //This shouldn't ever be possible since the power mode prevents you from using or moving items around public override void PostUpdateMiscEffects() { if (!wulfrumSet && WulfrumHat.PowerModeEngaged(Player, out var cd)) @@ -480,5 +571,12 @@ namespace CalamityMod.Items.Armor.Wulfrum cd.timeLeft = WulfrumHat.BastionCooldown; } } + + public override void FrameEffects() + { + //Give the braids variant to w*men + if (!Player.Male && Player.head == EquipLoader.GetEquipSlot(Mod, "WulfrumHat", EquipType.Head)) + Player.head = EquipLoader.GetEquipSlot(Mod, "WulfrumHatFemale", EquipType.Head); + } } } diff --git a/Items/Weapons/Melee/WulfrumScrewdriver.cs b/Items/Weapons/Melee/WulfrumScrewdriver.cs index 543264404a..9c10f0509b 100644 --- a/Items/Weapons/Melee/WulfrumScrewdriver.cs +++ b/Items/Weapons/Melee/WulfrumScrewdriver.cs @@ -32,8 +32,8 @@ namespace CalamityMod.Items.Weapons.Melee public static float ScrewTime = 40; public static Asset ScrewTex; public static Asset ScrewOutlineTex; - public static float ScrewBaseDamageMult = 2f; - public static float ScrewBazingaModeDamageMult = 4.5f; + public static float ScrewBaseDamageMult = 1f; + public static float ScrewBazingaModeDamageMult = 6.5f; public static float ScrewBazingaAimAssistAngle = 0.52f; //This may look high but remebmer this is the FULL angle, so it actually checks for half that angle deviation public static float ScrewBazingaAimAssistReach = 600f; diff --git a/Particles/GeneralParticleHandler.cs b/Particles/GeneralParticleHandler.cs index 827da34280..1c8907b360 100644 --- a/Particles/GeneralParticleHandler.cs +++ b/Particles/GeneralParticleHandler.cs @@ -114,6 +114,11 @@ namespace CalamityMod.Particles public static void DrawAllParticles(SpriteBatch sb) { + if (particles.Count == 0) + return; + + sb.End(); + //Batch the particles to avoid constant restarting of the spritebatch foreach (Particle particle in particles) { @@ -183,6 +188,8 @@ namespace CalamityMod.Particles batchedAlphaBlendParticles.Clear(); batchedNonPremultipliedParticles.Clear(); batchedAdditiveBlendParticles.Clear(); + + sb.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.Transform); } /// diff --git a/Particles/WulfrumBastionParts.png b/Particles/WulfrumBastionParts.png new file mode 100644 index 0000000000..1ef46a52d2 Binary files /dev/null and b/Particles/WulfrumBastionParts.png differ diff --git a/Particles/WulfrumBastionPartsParticle.cs b/Particles/WulfrumBastionPartsParticle.cs new file mode 100644 index 0000000000..47e8a93281 --- /dev/null +++ b/Particles/WulfrumBastionPartsParticle.cs @@ -0,0 +1,121 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using System; +using Microsoft.Xna.Framework.Graphics; + +namespace CalamityMod.Particles +{ + public class WulfrumBastionPartsParticle : Particle + { + public override bool SetLifetime => true; + public override string Texture => "CalamityMod/Particles/WulfrumBastionParts"; + public override bool UseCustomDraw => true; + + internal Rectangle Frame; + internal Vector2 DestinationOffset; + public Vector2 Offset; + public float RotationOffset; + public Player Owner; + public float TimeOffset; + public int AnimationTime; + public float LifetimeCompletionAdjusted => Math.Clamp((Time - Lifetime * TimeOffset) / (float)AnimationTime, 0, 1f); + + public WulfrumBastionPartsParticle(Player owner, int variant, int lifetime) + { + Offset = (-Vector2.UnitY * (40f + Main.rand.NextFloat(34f))).RotatedByRandom(MathHelper.PiOver4 * 0.04f); + Owner = owner; + Position = Owner.Center; + Scale = 1f; + Color = Color.White; + Velocity = Vector2.Zero; + Rotation = 0f; + RotationOffset = Main.rand.NextFloat(MathHelper.PiOver4 * 0f) * (Main.rand.NextBool() ? -1f : 1f); + Lifetime = lifetime; + AnimationTime = (int)(lifetime * 0.44f); + + switch (variant) + { + case 0: //Back leg + Frame = new Rectangle(46, 4, 10, 14); + DestinationOffset = new Vector2(7f, 16f); //1f? + TimeOffset = 0; + break; + case 1: //Front leg + Frame = new Rectangle(30, 4, 12, 14); + DestinationOffset = new Vector2(-4f, 16f); + TimeOffset = 0; + break; + case 2: //Bottom torso + Frame = new Rectangle(4, 30, 22, 12); + DestinationOffset = new Vector2(1f, 5f); + TimeOffset = 0.15f; + break; + case 3: //Torso + Frame = new Rectangle(30, 24, 30, 16); + DestinationOffset = new Vector2(1f, -3f); + TimeOffset = 0.35f; + break; + case 4: //Helmet + Frame = new Rectangle(2, 2, 22, 24); + DestinationOffset = new Vector2(-1f, -15f); + TimeOffset = 0.43f; + break; + case 5: //Fusion Cannon + Frame = new Rectangle(14, 46, 38, 18); + DestinationOffset = new Vector2(-2f, -2f); + TimeOffset = 0.6f; + break; + } + + Origin = Frame.Size() / 2; + + //Fusion Cannon rotates around the shoulder + if (variant == 5) + Origin.X -= 12f; + + } + + public override void Update() + { + Rotation = MathHelper.Lerp(RotationOffset, 0f, (float)Math.Pow(LifetimeCompletionAdjusted, 0.8f)); + + if (Owner.dead || !Owner.active) + Kill(); + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + if (Owner.dead || !Owner.active) + return; + + Texture2D baseTex = GeneralParticleHandler.GetTexture(Type); + Vector2 center = new Vector2((int)Owner.MountedCenter.X, (int)(Owner.MountedCenter.Y + Owner.gfxOffY)); + Vector2 currentOffset = Vector2.Lerp(Offset, Vector2.Zero, (float)Math.Pow(LifetimeCompletionAdjusted, 0.8f)); + //Vector2 currentOffset = Vector2.Lerp(Offset, Vector2.Zero, 1f); + Color lightColor = Lighting.GetColor(Owner.Center.ToTileCoordinates()); + + Vector2 realDestinationOffset = new Vector2(DestinationOffset.X * Owner.direction, DestinationOffset.Y * Owner.gravDir); + Vector2 realCurrentOffset = new Vector2(currentOffset.X * Owner.direction, currentOffset.Y * Owner.gravDir); + + + SpriteEffects spriteEffect = SpriteEffects.None; + Vector2 origin = Origin; + + if (Owner.direction < 0) + { + spriteEffect = SpriteEffects.FlipHorizontally; + origin.X = Frame.Width - Origin.X; + } + + + float opacity = Math.Clamp(LifetimeCompletionAdjusted * 4f ,0f, 1f); + + spriteBatch.Draw(baseTex, center + realDestinationOffset + realCurrentOffset - Main.screenPosition, Frame, lightColor * opacity, Rotation, origin, Scale, spriteEffect, 0); + } + } +} + + + + diff --git a/Particles/WulfrumHat.png b/Particles/WulfrumHat.png new file mode 100644 index 0000000000..1a11e8e9ef Binary files /dev/null and b/Particles/WulfrumHat.png differ diff --git a/Particles/WulfrumHatParticle.cs b/Particles/WulfrumHatParticle.cs new file mode 100644 index 0000000000..18650cc909 --- /dev/null +++ b/Particles/WulfrumHatParticle.cs @@ -0,0 +1,55 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using System; +using Microsoft.Xna.Framework.Graphics; + +namespace CalamityMod.Particles +{ + public class WulfrumHatParticle : Particle + { + public override bool SetLifetime => true; + public override string Texture => "CalamityMod/Particles/WulfrumHat"; + public override bool UseCustomDraw => true; + + public int Direction ; + + public WulfrumHatParticle(Player owner, Vector2 velocity, int lifetime) + { + Position = owner.Center - Vector2.UnitY * 20f;; + Direction = owner.direction; + Scale = 1f; + Color = Color.White; + Velocity = velocity; + Rotation = 0f; + Lifetime = lifetime; + } + + public override void Update() + { + Rotation = 0.15f * Math.Sign(Velocity.X); + + Velocity *= 0.95f; + Velocity.Y += 0.34f; + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + Texture2D baseTex = GeneralParticleHandler.GetTexture(Type); + Color lightColor = Lighting.GetColor(Position.ToTileCoordinates()); + + SpriteEffects spriteEffect = SpriteEffects.None; + if (Direction < 0) + { + spriteEffect = SpriteEffects.FlipHorizontally; + } + + float opacity = Math.Clamp(1 - (float)Math.Pow(LifetimeCompletion , 3f),0f, 1f); + spriteBatch.Draw(baseTex, Position - Main.screenPosition, null, lightColor * opacity, Rotation, baseTex.Size()/2f, Scale, spriteEffect, 0); + } + } +} + + + + diff --git a/Sounds/Custom/AbilitySounds/WulfrumBastionActivate.ogg b/Sounds/Custom/AbilitySounds/WulfrumBastionActivate.ogg index 5de8afb4f0..8805e86459 100644 Binary files a/Sounds/Custom/AbilitySounds/WulfrumBastionActivate.ogg and b/Sounds/Custom/AbilitySounds/WulfrumBastionActivate.ogg differ