diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 012e3e3ee2..ff6a70dc85 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -233,6 +233,10 @@ namespace CalamityMod.CalPlayer public int danceOfLightCharge = 0; public int shadowPotCooldown = 0; public int dogTextCooldown = 0; + public float auralisStealthCounter = 0f; + public int auralisAuroraCounter = 0; + public int auralisAuroraCooldown = 0; + public int auralisAurora = 0; #endregion #region Sound @@ -2032,6 +2036,10 @@ namespace CalamityMod.CalPlayer soundCooldown = 0; shadowPotCooldown = 0; dogTextCooldown = 0; + auralisStealthCounter = 0f; + auralisAuroraCounter = 0; + auralisAuroraCooldown = 0; + auralisAurora = 0; rage = 0; adrenaline = 0; raiderStack = 0; @@ -6309,6 +6317,15 @@ namespace CalamityMod.CalPlayer } } + if (auralisAuroraCounter >= 300) + { + damage -= 100; + if (damage < 1) + damage = 1; + auralisAuroraCounter = 0; + auralisAuroraCooldown = CalamityUtils.SecondsToFrames(30f); + } + if (proj.type == ModContent.ProjectileType()) { damage = 0; diff --git a/CalPlayer/CalamityPlayerDrawEffects.cs b/CalPlayer/CalamityPlayerDrawEffects.cs index 87a5a65203..8af757f693 100644 --- a/CalPlayer/CalamityPlayerDrawEffects.cs +++ b/CalPlayer/CalamityPlayerDrawEffects.cs @@ -215,7 +215,8 @@ namespace CalamityMod.CalPlayer currentlyHeldItem.type == ModContent.ItemType() || currentlyHeldItem.type == ModContent.ItemType() || currentlyHeldItem.type == ModContent.ItemType() || - currentlyHeldItem.type == ModContent.ItemType()) + currentlyHeldItem.type == ModContent.ItemType() || + currentlyHeldItem.type == ModContent.ItemType()) { Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Ranged/DeathwindGlow"); int offsetX = 10; @@ -239,6 +240,11 @@ namespace CalamityMod.CalPlayer texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Ranged/AuroraBlazerGlow"); offsetX = 44; } + else if (currentlyHeldItem.type == ModContent.ItemType()) + { + texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Ranged/AuralisGlow"); + offsetX = 62; + } Vector2 center = Main.itemTexture[currentlyHeldItem.type].Size() * 0.5f; int originOffsetX = (int)center.X - offsetX; @@ -494,6 +500,38 @@ namespace CalamityMod.CalPlayer } }); + public static readonly PlayerLayer AuralisAuroraEffects = new PlayerLayer("CalamityMod", "AuralisAurora", PlayerLayer.Body, drawInfo => + { + Player drawPlayer = drawInfo.drawPlayer; + CalamityPlayer modPlayer = drawPlayer.Calamity(); + if (modPlayer.auralisAuroraCounter < 300 || modPlayer.auralisAuroraCooldown > 0) + return; + float auroraCount = 7; + float opacity = 0.4f; + + float time = Main.GlobalTime % 3f / 3f; + Texture2D auroraTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/AuroraTexture"); + for (int i = 0; i < auroraCount; i++) + { + float incrementOffsetAngle = MathHelper.TwoPi * i / auroraCount; + float xOffset = (float)Math.Sin(time * MathHelper.TwoPi + incrementOffsetAngle * 2f) * 20f; + float yOffset = (float)Math.Sin(time * MathHelper.TwoPi + incrementOffsetAngle * 2f + MathHelper.ToRadians(60f)) * 6f; + float rotation = (float)Math.Sin(incrementOffsetAngle) * MathHelper.Pi / 12f; + Color color = CalamityUtils.ColorSwap(Auralis.blueColor, Auralis.greenColor, 3f); + Vector2 offset = new Vector2(xOffset, yOffset - 14f); + DrawData drawData = new DrawData(auroraTexture, + drawPlayer.Top + offset - Main.screenPosition, + null, + color * opacity, + rotation + MathHelper.PiOver2, + auroraTexture.Size() * 0.5f, + 0.135f, + SpriteEffects.None, + 1); + Main.playerDrawData.Add(drawData); + } + }); + public static readonly PlayerLayer IbanDevRobot = new PlayerLayer("CalamityMod", "IbanDevRobot", PlayerLayer.Body, drawInfo => { Player drawPlayer = drawInfo.drawPlayer; @@ -647,6 +685,7 @@ namespace CalamityMod.CalPlayer list.Add(RoverDriveShield); list.Add(StratusSphereDrawing); list.Add(ProfanedMoonlightDyeEffects); + list.Add(AuralisAuroraEffects); list.Add(IbanDevRobot); list.Add(DyeInvisibilityFix); } diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 2e1c5d9e47..3e6ce38d6b 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -1014,6 +1014,10 @@ namespace CalamityMod.CalPlayer } else modPlayer.roverDriveTimer = 616; //Doesn't reset to zero to prevent exploits + if (modPlayer.auralisAurora > 0) + modPlayer.auralisAurora--; + if (modPlayer.auralisAuroraCooldown > 0) + modPlayer.auralisAuroraCooldown--; // Silva invincibility effects if (modPlayer.silvaCountdown > 0 && modPlayer.hasSilvaEffect && modPlayer.silvaSet) @@ -2326,6 +2330,80 @@ namespace CalamityMod.CalPlayer } else modPlayer.modStealth = 1f; + + if (player.ActiveItem().type == ModContent.ItemType() && player.StandingStill(0.1f)) + { + if (modPlayer.auralisStealthCounter < 300f) + modPlayer.auralisStealthCounter++; + + bool usingScope = false; + if (!Main.gameMenu && Main.netMode != NetmodeID.Server) + { + if (player.noThrow <= 0 && !player.lastMouseInterface || (Main.zoomX != 0f || Main.zoomY != 0f)) + { + if (PlayerInput.UsingGamepad) + { + if (PlayerInput.GamepadThumbstickRight.Length() != 0f || !Main.SmartCursorEnabled) + { + usingScope = true; + } + } + else if (Main.mouseRight) + usingScope = true; + } + } + + int chargeDuration = CalamityUtils.SecondsToFrames(5f); + int auroraDuration = CalamityUtils.SecondsToFrames(20f); + + if (usingScope && modPlayer.auralisAuroraCounter < chargeDuration + auroraDuration) + modPlayer.auralisAuroraCounter++; + + if (modPlayer.auralisAuroraCounter > chargeDuration + auroraDuration) + { + modPlayer.auralisAuroraCounter = 0; + modPlayer.auralisAuroraCooldown = CalamityUtils.SecondsToFrames(30f); + } + + if (modPlayer.auralisAuroraCounter > 0 && modPlayer.auralisAuroraCounter < chargeDuration && !usingScope) + modPlayer.auralisAuroraCounter--; + + if (modPlayer.auralisAuroraCounter > chargeDuration && modPlayer.auralisAuroraCounter < chargeDuration + auroraDuration && !usingScope) + modPlayer.auralisAuroraCounter = 0; + } + else + { + modPlayer.auralisStealthCounter = 0f; + modPlayer.auralisAuroraCounter = 0; + } + if (modPlayer.auralisAuroraCooldown > 0) + { + if (modPlayer.auralisAuroraCooldown == 1) + { + int dustAmt = 36; + for (int d = 0; d < dustAmt; d++) + { + Vector2 source = Vector2.Normalize(player.velocity) * new Vector2((float)player.width / 2f, (float)player.height) * 1f; //0.75 + source = source.RotatedBy((double)((float)(d - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + player.Center; + Vector2 dustVel = source - player.Center; + int blue = Dust.NewDust(source + dustVel, 0, 0, 229, dustVel.X, dustVel.Y, 100, default, 1.2f); + Main.dust[blue].noGravity = true; + Main.dust[blue].noLight = false; + Main.dust[blue].velocity = dustVel; + } + for (int d = 0; d < dustAmt; d++) + { + Vector2 source = Vector2.Normalize(player.velocity) * new Vector2((float)player.width / 2f, (float)player.height) * 0.75f; + source = source.RotatedBy((double)((float)(d - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + player.Center; + Vector2 dustVel = source - player.Center; + int green = Dust.NewDust(source + dustVel, 0, 0, 107, dustVel.X, dustVel.Y, 100, default, 1.2f); + Main.dust[green].noGravity = true; + Main.dust[green].noLight = false; + Main.dust[green].velocity = dustVel; + } + } + modPlayer.auralisAuroraCounter = 0; + } } #endregion diff --git a/CalamityLists.cs b/CalamityLists.cs index 615a6084d5..f5ef7a1226 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -1655,6 +1655,7 @@ namespace CalamityMod scopedWeaponList = new List() { ModContent.ItemType(), + ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), diff --git a/Items/Weapons/Ranged/Auralis.cs b/Items/Weapons/Ranged/Auralis.cs new file mode 100644 index 0000000000..8f29ddde43 --- /dev/null +++ b/Items/Weapons/Ranged/Auralis.cs @@ -0,0 +1,85 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Items.Potions; +using CalamityMod.Projectiles.Ranged; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Ranged +{ + public class Auralis : ModItem + { + public static readonly Color blueColor = new Color(0, 77, 255); + public static readonly Color greenColor = new Color(0, 255, 77); + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Auralis"); + Tooltip.SetDefault("Fires a high speed glowing bullet that inflicts debilitating debuffs\n" + + "Right click to zoom out\n" + + "Standing still provides increasing damage bonuses up to 25%\n" + + "Standing still for 5 or more seconds while using the scope ability will summon an aurora\n" + + "The aurora reduces the damage of the next projectile hit by a flat 100\n" + + "This effect lasts up to 20 seconds and has a 30 second cooldown\n" + + "50% chance to not consume bullets"); + } + + public override void SetDefaults() + { + item.damage = 650; + item.ranged = true; + item.useTime = item.useAnimation = 30; + item.knockBack = 10f; + item.autoReuse = true; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 7.5f; + item.useAmmo = AmmoID.Bullet; + + item.width = 96; + item.height = 34; + item.useStyle = ItemUseStyleID.HoldingOut; + item.noMelee = true; + item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaBlast"); + item.value = CalamityGlobalItem.Rarity13BuyPrice; + item.rare = 10; + item.Calamity().customRarity = CalamityRarity.Dedicated; + } + + public override void ModifyWeaponDamage(Player player, ref float add, ref float mult, ref float flat) + { + float damageMult = MathHelper.Lerp(0f, 0.25f, player.Calamity().auralisStealthCounter / 300f); + add += damageMult; + } + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Projectile.NewProjectile(position, new Vector2(speedX, speedY), item.shoot, damage, knockBack, player.whoAmI); + return false; + } + + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Texture2D glowmask = ModContent.GetTexture("CalamityMod/Items/Weapons/Ranged/AuralisGlow"); + Vector2 origin = new Vector2(glowmask.Width / 2f, glowmask.Height / 2f - 2f); + spriteBatch.Draw(glowmask, item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); + } + + public override Vector2? HoldoutOffset() => new Vector2(-10, 0); + + public override bool ConsumeAmmo(Player player) => Main.rand.Next(100) >= 50; + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddIngredient(ModContent.ItemType(), 50); + recipe.AddIngredient(ItemID.SniperRifle); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Ranged/Auralis.png b/Items/Weapons/Ranged/Auralis.png new file mode 100644 index 0000000000..88f823e30a Binary files /dev/null and b/Items/Weapons/Ranged/Auralis.png differ diff --git a/Items/Weapons/Ranged/AuralisGlow.png b/Items/Weapons/Ranged/AuralisGlow.png new file mode 100644 index 0000000000..8abfbe742e Binary files /dev/null and b/Items/Weapons/Ranged/AuralisGlow.png differ diff --git a/Items/Weapons/Ranged/AuroraBlazer.cs b/Items/Weapons/Ranged/AuroraBlazer.cs index 6d6583af85..d772a1b0fc 100644 --- a/Items/Weapons/Ranged/AuroraBlazer.cs +++ b/Items/Weapons/Ranged/AuroraBlazer.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Ranged item.width = 68; item.height = 36; - item.useStyle = 5; + item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.UseSound = SoundID.Item34; item.value = CalamityGlobalItem.Rarity7BuyPrice; diff --git a/NPCs/CalamityAI.cs b/NPCs/CalamityAI.cs index df50cbd21f..dfede287b0 100644 --- a/NPCs/CalamityAI.cs +++ b/NPCs/CalamityAI.cs @@ -318,7 +318,7 @@ namespace CalamityMod.NPCs // Despawn bool notOcean = player.position.X > 7680f && player.position.X < (Main.maxTilesX * 16 - 7680); - if (player.dead || player.Calamity().ZoneAbyss || (notOcean && !BossRushEvent.BossRushActive && !player.Calamity().ZoneSulphur))\ + if (player.dead || player.Calamity().ZoneAbyss || (notOcean && !BossRushEvent.BossRushActive && !player.Calamity().ZoneSulphur)) { calamityGlobalNPC.newAI[1] = 1f; npc.TargetClosest(false); diff --git a/Projectiles/Magic/ThunderstormShot.cs b/Projectiles/Magic/ThunderstormShot.cs index b72603d63b..5d197669c0 100644 --- a/Projectiles/Magic/ThunderstormShot.cs +++ b/Projectiles/Magic/ThunderstormShot.cs @@ -47,26 +47,12 @@ namespace CalamityMod.Projectiles.Magic public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item125, projectile.position); + Main.PlaySound(SoundID.Item125, projectile.Center); for (int n = 0; n < 5; n++) { - float x = projectile.position.X + (float)Main.rand.Next(-200, 200); - float y = projectile.position.Y - 1500f; - Vector2 vector = new Vector2(x, y); - float num13 = projectile.position.X + (float)(projectile.width / 2) - vector.X; - float num14 = projectile.position.Y + (float)(projectile.height / 2) - vector.Y; - num13 += (float)Main.rand.Next(-100, 101); - int num15 = 29; - float num16 = (float)Math.Sqrt((double)(num13 * num13 + num14 * num14)); - num16 = (float)num15 / num16; - num13 *= num16; - num14 *= num16; - Projectile.NewProjectile(x, y, num13, num14, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + CalamityUtils.ProjectileRain(projectile.Center, 200f, 100f, 1500f, 1500f, 29f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, projectile.owner); } - projectile.position = projectile.Center; - projectile.width = projectile.height = 36; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + CalamityGlobalProjectile.ExpandHitboxBy(projectile, 36); int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { @@ -88,6 +74,8 @@ namespace CalamityMod.Projectiles.Magic Main.dust[num228].noLight = true; Main.dust[num228].velocity = vector7; } + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; projectile.Damage(); } } diff --git a/Projectiles/Ranged/AuralisBullet.cs b/Projectiles/Ranged/AuralisBullet.cs new file mode 100644 index 0000000000..8d2362aff0 --- /dev/null +++ b/Projectiles/Ranged/AuralisBullet.cs @@ -0,0 +1,64 @@ +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Items.Weapons.Ranged; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Ranged +{ + public class AuralisBullet : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bullet"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 5; + projectile.alpha = 255; + projectile.timeLeft = 200; + projectile.extraUpdates = 10; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + } + + public override void AI() + { + projectile.ai[0] += 1f; + if (projectile.ai[0] > 6f) + { + for (int d = 0; d < 5; d++) + { + Dust dust = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 229, projectile.velocity.X, projectile.velocity.Y, 100, CalamityUtils.ColorSwap(Auralis.blueColor, Auralis.greenColor, 1f), 1f)]; + dust.velocity = Vector2.Zero; + dust.position -= projectile.velocity / 5f * d; + dust.noGravity = true; + dust.scale = 0.65f; + dust.noLight = true; + dust.color = CalamityUtils.ColorSwap(Auralis.blueColor, Auralis.greenColor, 1f); + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + int duration = 600; + target.AddBuff(ModContent.BuffType(), duration); + target.AddBuff(BuffID.Ichor, duration); + target.AddBuff(BuffID.CursedInferno, duration); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + int duration = 600; + target.AddBuff(ModContent.BuffType(), duration); + target.AddBuff(BuffID.Ichor, duration); + target.AddBuff(BuffID.CursedInferno, duration); + } + } +} diff --git a/Projectiles/Ranged/AuralisBullet.png b/Projectiles/Ranged/AuralisBullet.png new file mode 100644 index 0000000000..0056fc1e24 Binary files /dev/null and b/Projectiles/Ranged/AuralisBullet.png differ