diff --git a/Buffs/StatBuffs/ForbiddenBuff.cs b/Buffs/StatBuffs/ForbiddenBuff.cs new file mode 100644 index 0000000000..35986d9956 --- /dev/null +++ b/Buffs/StatBuffs/ForbiddenBuff.cs @@ -0,0 +1,21 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.StatBuffs +{ + public class ForbiddenBuff : ModBuff + { + public override void SetStaticDefaults() + { + Main.buffNoTimeDisplay[Type] = false; + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().trinketOfChiBuff = true; + } + } +} diff --git a/Buffs/StatBuffs/ForbiddenBuff.png b/Buffs/StatBuffs/ForbiddenBuff.png new file mode 100644 index 0000000000..c0d7d5d851 Binary files /dev/null and b/Buffs/StatBuffs/ForbiddenBuff.png differ diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 00d0ec34c4..127d379201 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -898,6 +898,7 @@ namespace CalamityMod.CalPlayer #region Buff public bool trinketOfChiBuff = false; + public bool forbiddenBuff = false; public int chiBuffTimer = 0; public bool corrEffigy = false; public bool crimEffigy = false; @@ -1953,6 +1954,7 @@ namespace CalamityMod.CalPlayer ManaBurn = false; trinketOfChiBuff = false; + forbiddenBuff = false; corrEffigy = false; crimEffigy = false; decayEffigy = false; @@ -2407,6 +2409,7 @@ namespace CalamityMod.CalPlayer aquaticHeartWaterBuff = false; aquaticHeartIce = false; trinketOfChiBuff = false; + forbiddenBuff = false; chiBuffTimer = 0; corrEffigy = false; crimEffigy = false; diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index f421d2bacc..9ddcee330e 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -3010,6 +3010,12 @@ namespace CalamityMod.CalPlayer bonusStealthDamage += nanotech ? 0.05f : 0.08f; } + if (forbiddenBuff) + { + Player.GetDamage() += 0.10f; + Player.statDefense += 10; + } + if (frostFlare) { Player.resistCold = true; diff --git a/Items/Weapons/Magic/DeathValleyDuster.cs b/Items/Weapons/Magic/DeathValleyDuster.cs index d028ceb6f6..f3a87a4a75 100644 --- a/Items/Weapons/Magic/DeathValleyDuster.cs +++ b/Items/Weapons/Magic/DeathValleyDuster.cs @@ -1,6 +1,9 @@ using CalamityMod.Projectiles.Magic; using Terraria; +using Terraria.DataStructures; using Terraria.ID; +using Terraria.Audio; +using Microsoft.Xna.Framework; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Magic @@ -13,27 +16,33 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 36; Item.height = 40; - Item.damage = 83; + Item.damage = 143; Item.DamageType = DamageClass.Magic; - Item.mana = 9; - Item.useTime = 25; - Item.useAnimation = 25; + Item.mana = 38; + Item.useTime = 50; + Item.useAnimation = 50; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; - Item.knockBack = 5f; - Item.value = CalamityGlobalItem.RarityPinkBuyPrice; - Item.rare = ItemRarityID.Pink; - Item.UseSound = SoundID.Item20; + Item.knockBack = 8f; + Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; + Item.rare = ItemRarityID.LightRed; + Item.UseSound = new SoundStyle("CalamityMod/Sounds/Item/MagicRockSound") with { Volume = 0.4f, Pitch = -0.1f }; Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 5f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 6.5f; + } + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + bool MaxMana = player.statMana >= (player.statManaMax2 - ((int)(Item.mana * player.manaCost))) && !player.HasBuff(BuffID.ManaSickness); + Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, 0f, MaxMana ? 1f : 0f); + + return false; } - public override void AddRecipes() { CreateRecipe(). AddIngredient(ItemID.SpellTome). - AddRecipeGroup("AnyAdamantiteBar", 5). + AddIngredient(ItemID.AncientCloth, 2). AddIngredient(ItemID.AncientBattleArmorMaterial). AddIngredient(ItemID.FossilOre, 25). AddTile(TileID.Bookcases). diff --git a/Localization/en-US/Mods.CalamityMod.Buffs.hjson b/Localization/en-US/Mods.CalamityMod.Buffs.hjson index a8eac3ec2b..04c0e8b099 100644 --- a/Localization/en-US/Mods.CalamityMod.Buffs.hjson +++ b/Localization/en-US/Mods.CalamityMod.Buffs.hjson @@ -1525,3 +1525,12 @@ LiliesOfFinalityBuff: { DisplayName: Finality Description: Remember our promise } + +ForbiddenBuff: { + DisplayName: Forbidden Buff + Description: + ''' + You are strengthened by ancient powers + Defense increased by 10, damage increased by 10% + ''' +} diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson index 4a2ee65579..c7ce2ec6e1 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson @@ -218,7 +218,12 @@ DeathhailStaff: { DeathValleyDuster: { DisplayName: Death Valley Duster - Tooltip: Casts a large blast of dust + Tooltip: + ''' + Casts an enchanted blast of sand that passes through enemies and tiles + Casting this spell at max mana while without mana sickness will cause it to give you and any player it hits the Forbidden Buff + The Forbidden Buff increases your defense by 10 and damage by 10% + ''' } DivineRetribution: { diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson index cf3b8f5fa3..9c72304f1d 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson @@ -260,3 +260,4 @@ WyvernFeatherPurple.DisplayName: Feather WyvernProjectile.DisplayName: Wyvern YharimsCrystalBeam.DisplayName: Yharim's Beam YharimsCrystalPrism.DisplayName: Yermes Christal +DeathValleyDusterProjectile.DisplayName: Death Valley Duster Projectile diff --git a/Projectiles/Magic/DeathValleyDusterProjectile.cs b/Projectiles/Magic/DeathValleyDusterProjectile.cs new file mode 100644 index 0000000000..bd981bed29 --- /dev/null +++ b/Projectiles/Magic/DeathValleyDusterProjectile.cs @@ -0,0 +1,171 @@ +using System; +using CalamityMod.Buffs.StatBuffs; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.DataStructures; +using CalamityMod.Particles; +using Microsoft.CodeAnalysis; +using Microsoft.Xna.Framework; +using Terraria.Audio; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Magic +{ + public class DeathValleyDusterProjectile : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Magic"; + + public ref float time => ref Projectile.ai[0]; + public override void SetStaticDefaults() + { + Main.projFrames[Projectile.type] = 6; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 15; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + } + public override void SetDefaults() + { + Projectile.width = 64; + Projectile.height = 64; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Magic; + Projectile.penetrate = -1; + Projectile.extraUpdates = 4; + Projectile.timeLeft = 400; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + + public override void AI() + { + if (time == 0) + Projectile.rotation = Main.rand.NextFloat(-20, 20); + Lighting.AddLight(Projectile.Center, Color.Gold.ToVector3()); + + if (Projectile.ai[2] == 1) + { + for (int playerIndex = 0; playerIndex < Main.maxPlayers; playerIndex++) + { + Player player = Main.player[playerIndex]; + float targetDist = Vector2.Distance(player.Center, Projectile.Center); + if (targetDist < Projectile.width * 0.5f * Projectile.scale) + { + player.AddBuff(ModContent.BuffType(), 240); + + int Dusts = 12; + float radians = MathHelper.TwoPi / Dusts; + Vector2 spinningPoint = Vector2.Normalize(new Vector2(-1f, -1f)); + for (int i = 0; i < Dusts; i++) + { + Vector2 dustVelocity = spinningPoint.RotatedBy(radians * i) * 12.5f; + Dust dust = Dust.NewDustPerfect(player.Center, 262, dustVelocity, 0, default, 0.9f); + dust.noGravity = true; + + Dust dust2 = Dust.NewDustPerfect(player.Center, 262, dustVelocity * 0.6f, 0, default, 1.2f); + dust2.noGravity = true; + } + + SoundStyle buff = new("CalamityMod/Sounds/Custom/Ravager/RavagerPillarSummon"); + SoundEngine.PlaySound(buff with { Volume = 0.65f, Pitch = 0.8f }, player.Center); + } + } + } + + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) + { + Projectile.frame++; + Projectile.frameCounter = 0; + } + if (Projectile.frame >= Main.projFrames[Projectile.type]) + { + Projectile.frame = 0; + } + + if (time > 80) + Projectile.velocity *= 0.984f; + else + Projectile.scale *= 1.004f; + + if (time > 5) + { + int chance = (time > 136 ? 3 : Projectile.Opacity < 1 ? 5 : 1); + + if (Main.rand.NextBool(chance)) + { + for (int i = 0; i < 2; i++) + { + Vector2 dustPos = Projectile.Center + (i * MathHelper.Pi + Projectile.rotation + MathHelper.PiOver2).ToRotationVector2() * 20f * Projectile.scale; + Dust dust = Dust.NewDustPerfect(dustPos, Main.rand.NextBool(10) ? 262 : 287, (i * MathHelper.Pi + Projectile.rotation * Math.Sign(Projectile.velocity.Length())).ToRotationVector2() * (chance > 1 ? 7 : 3)); + dust.noGravity = false; + dust.scale = Main.rand.NextFloat(0.75f, 1.2f); + dust.alpha = Main.rand.Next(100, 170 + 1); + if (dust.type == 262) + { + dust.noGravity = true; + } + if (chance > 1) + dust.noGravity = true; + } + } + + if (Main.rand.NextBool(4)) + { + MediumMistParticle SandCloud = new MediumMistParticle(Projectile.Center + new Vector2(25, 25).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 1.3f) * Projectile.scale, (-Projectile.velocity * 0.2f).RotatedByRandom(0.2f) + (new Vector2(3, 3).RotatedByRandom(100) * (time > 96 ? 1 : 0)), Color.Peru, Color.PeachPuff, Main.rand.NextFloat(0.4f, 1.3f), 120f, Main.rand.NextFloat(0.03f, -0.03f)); + GeneralParticleHandler.SpawnParticle(SandCloud); + } + + if (time < 136) + { + for (int i = 0; i < 2; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + new Vector2(25, 25).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 1.3f) * Projectile.scale, Main.rand.NextBool(8) ? 262 : 287, -Projectile.velocity * Main.rand.NextFloat(0.1f, 1.3f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.4f, 0.7f); + dust.alpha = 100; + } + } + } + + Projectile.rotation += Main.rand.NextFloat(0.01f, 0.18f) * (float)Projectile.direction * Projectile.Opacity; + + + if (Projectile.timeLeft <= 45) + { + Projectile.extraUpdates = 1; + Projectile.Opacity = MathHelper.Lerp(0f, 1f, (float)Projectile.timeLeft / 45f); + } + + time++; + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + if (Projectile.numHits >= 3 && Projectile.timeLeft > 45) + { + Projectile.timeLeft = 45; + Projectile.velocity *= 0.4f; + } + } + public override void OnKill(int timeLeft) + { + for (int i = 0; i < 20; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + new Vector2(30, 30).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 1.3f) * Projectile.scale, Main.rand.NextBool(8) ? 262 : 287, (Projectile.velocity * 4).RotatedByRandom(0.5) * Main.rand.NextFloat(0.1f, 1.3f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.4f, 0.7f); + dust.alpha = 100; + } + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width * 0.5f * Projectile.scale, targetHitbox); + public override bool? CanDamage() => Projectile.Opacity == 1; + + public override bool PreDraw(ref Color lightColor) + { + if (Projectile.timeLeft > 50) + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor * 0.4f * Projectile.Opacity, 1); + return true; + } + } +} diff --git a/Projectiles/Magic/DustProjectile.png b/Projectiles/Magic/DeathValleyDusterProjectile.png similarity index 100% rename from Projectiles/Magic/DustProjectile.png rename to Projectiles/Magic/DeathValleyDusterProjectile.png diff --git a/Projectiles/Magic/DustProjectile.cs b/Projectiles/Magic/DustProjectile.cs deleted file mode 100644 index 656d045e7f..0000000000 --- a/Projectiles/Magic/DustProjectile.cs +++ /dev/null @@ -1,103 +0,0 @@ -using System; -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.DataStructures; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Magic -{ - public class DustProjectile : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Magic"; - public override void SetStaticDefaults() - { - Main.projFrames[Projectile.type] = 6; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; - } - - public override void SetDefaults() - { - Projectile.width = 64; - Projectile.height = 64; - Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.tileCollide = false; - Projectile.DamageType = DamageClass.Magic; - Projectile.penetrate = 3; - Projectile.MaxUpdates = 4; - Projectile.timeLeft = 30 * Projectile.MaxUpdates; // 30 effectively, 120 total - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10 * Projectile.MaxUpdates; // 10 effective, 40 total - } - - public override void AI() - { - Lighting.AddLight(Projectile.Center, 0.5f, 0.4f, 0.01f); - Projectile.frameCounter++; - if (Projectile.frameCounter > 6) - { - Projectile.frame++; - Projectile.frameCounter = 0; - } - if (Projectile.frame >= Main.projFrames[Projectile.type]) - { - Projectile.frame = 0; - } - Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.01f * (float)Projectile.direction; - if (Projectile.ai[0] > 7f) - { - int dustType = 22; - int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f, 100, default, 1f); - Dust dust = Main.dust[idx]; - if (Main.rand.NextBool(3)) - { - dust.noGravity = true; - dust.scale *= 2f; - dust.velocity.X *= 3f; - dust.velocity.Y *= 3f; - } - dust.velocity.X *= 1.5f; - dust.velocity.Y *= 1.5f; - } - Projectile.ai[0] += 1f; - Projectile.rotation += 0.3f * (float)Projectile.direction; - if (Projectile.timeLeft < 5) - Projectile.Opacity = MathHelper.Lerp(0f, 1f, (float)Projectile.timeLeft / 5f); - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 180); - - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 180); - - public override bool? CanDamage() => Projectile.timeLeft > 5; - - public override bool PreDraw(ref Color lightColor) - { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); - - // Dust effects - Circle dustCircle = new Circle(Projectile.Center, Projectile.width / 2); - - for (int i = 0; i < 20; i++) - { - // Dust - Vector2 dustPos = dustCircle.RandomPointInCircle(); - if ((dustPos - Projectile.Center).Length() > 48) - { - int dustIndex = Dust.NewDust(dustPos, 1, 1, DustID.Pot); - Main.dust[dustIndex].noGravity = true; - Main.dust[dustIndex].fadeIn = 1f; - Vector2 dustVelocity = Projectile.Center - Main.dust[dustIndex].position; - float distToCenter = dustVelocity.Length(); - dustVelocity.Normalize(); - dustVelocity = dustVelocity.RotatedBy(MathHelper.ToRadians(-90f)); - dustVelocity *= distToCenter * 0.04f; - Main.dust[dustIndex].velocity = dustVelocity; - } - } - return false; - } - } -} diff --git a/Sounds/Item/MagicRockSound.ogg b/Sounds/Item/MagicRockSound.ogg new file mode 100644 index 0000000000..4b7f939425 Binary files /dev/null and b/Sounds/Item/MagicRockSound.ogg differ