diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 900423cb23..100cdd3b34 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -9344,7 +9344,8 @@ namespace CalamityMod.CalPlayer bool isAxe = it.axe > 0; bool isHammer = it.hammer > 0; bool isPlaced = it.createTile != -1; - bool hasNonWeaponFunction = isPickaxe || isAxe || isHammer || isPlaced; + bool isChannelable = it.channel; + bool hasNonWeaponFunction = isPickaxe || isAxe || isHammer || isPlaced || isChannelable; bool playerUsingWeapon = hasDamage && hasHitboxes && !hasNonWeaponFunction; if (!stealthStrikeThisFrame && player.itemAnimation == player.itemAnimationMax - 1 && playerUsingWeapon) ConsumeStealthByAttacking(); @@ -9448,7 +9449,7 @@ namespace CalamityMod.CalPlayer return rogueStealth >= rogueStealthMax * (stealthStrikeHalfCost ? 0.5f : 1f); } - private void ConsumeStealthByAttacking() + internal void ConsumeStealthByAttacking() { stealthStrikeThisFrame = true; stealthAcceleration = 1f; // Reset acceleration when you attack diff --git a/Dusts/FinalFlame.cs b/Dusts/FinalFlame.cs new file mode 100644 index 0000000000..efeceeea56 --- /dev/null +++ b/Dusts/FinalFlame.cs @@ -0,0 +1,33 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Dusts +{ + public class FinalFlame : ModDust + { + public override void OnSpawn(Dust dust) + { + dust.color = default; + dust.velocity *= 0.5f; + dust.noGravity = true; + dust.noLight = true; + dust.alpha = 50; + } + + public override bool Update(Dust dust) + { + dust.position += dust.velocity; + dust.scale *= 0.94f; + dust.velocity *= 0.90f; + Lighting.AddLight(dust.position, 0.255f, 0.185f, 0.094f); + if (dust.scale < 0.4f) + { + dust.active = false; + } + return false; + } + + public override Color? GetAlpha(Dust dust, Color lightColor) => new Color(Color.White.R, Color.White.G, Color.White.B, dust.alpha); + } +} \ No newline at end of file diff --git a/Dusts/FinalFlame.png b/Dusts/FinalFlame.png new file mode 100644 index 0000000000..5e75ebb88b Binary files /dev/null and b/Dusts/FinalFlame.png differ diff --git a/Items/TreasureBags/YharonBag.cs b/Items/TreasureBags/YharonBag.cs index 09c35732ef..46cf9622e8 100644 --- a/Items/TreasureBags/YharonBag.cs +++ b/Items/TreasureBags/YharonBag.cs @@ -52,6 +52,7 @@ namespace CalamityMod.Items.TreasureBags DropHelper.DropItemChance(player, ModContent.ItemType(), 3); DropHelper.DropItemChance(player, ModContent.ItemType(), 3); // Yharon Kindle Staff DropHelper.DropItemChance(player, ModContent.ItemType(), 3); // Infernal Spear + DropHelper.DropItemChance(player, ModContent.ItemType(), 3); // Equipment DropHelper.DropItem(player, ModContent.ItemType()); diff --git a/Items/Weapons/Rogue/FinalDawn.cs b/Items/Weapons/Rogue/FinalDawn.cs new file mode 100644 index 0000000000..c234a38f1c --- /dev/null +++ b/Items/Weapons/Rogue/FinalDawn.cs @@ -0,0 +1,45 @@ +using CalamityMod.Projectiles.Rogue; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Rogue +{ + public class FinalDawn : RogueWeapon + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Final Dawn"); + Tooltip.SetDefault("'We shall ride into the sunrise once more'\n" + + "Attack enemies with a giant scythe swing to replenish stealth\n" + + "Press up and attack to throw the scythe \n" + + "Stealth Strikes allow you to perform a vertical swing that leaves a lingering fire aura\n" + + "Stealth Strike performed while pressing up allow you to fling yourself at the enemy and slice through them, causing homing fireballs to emerge"); + } + public override void SafeSetDefaults() + { + item.damage = 5000; + item.Calamity().rogue = true; + item.width = 78; + item.height = 66; + item.noMelee = true; + item.useTime = item.useAnimation = 15; + item.useStyle = ItemUseStyleID.SwingThrow; + item.knockBack = 4; + item.rare = 10; + item.Calamity().customRarity = CalamityRarity.Dedicated ; + item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; + item.autoReuse = false; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 1f; + item.useTurn = false; + item.channel = true; + item.noUseGraphic = true; + } + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] + + player.ownedProjectileCounts[ModContent.ProjectileType()] + + player.ownedProjectileCounts[ModContent.ProjectileType()] + + player.ownedProjectileCounts[ModContent.ProjectileType()] + + player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0; + } +} \ No newline at end of file diff --git a/Items/Weapons/Rogue/FinalDawn.png b/Items/Weapons/Rogue/FinalDawn.png new file mode 100644 index 0000000000..e5cbf9feb9 Binary files /dev/null and b/Items/Weapons/Rogue/FinalDawn.png differ diff --git a/NPCs/Yharon/Yharon.cs b/NPCs/Yharon/Yharon.cs index 83849aeff2..9663b6d4fd 100644 --- a/NPCs/Yharon/Yharon.cs +++ b/NPCs/Yharon/Yharon.cs @@ -3015,6 +3015,7 @@ namespace CalamityMod.NPCs.Yharon DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); + DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); // Vanity DropHelper.DropItemChance(npc, ModContent.ItemType(), 7); diff --git a/Projectiles/Rogue/FinalDawnFireSlash.cs b/Projectiles/Rogue/FinalDawnFireSlash.cs new file mode 100644 index 0000000000..d3f7feedbb --- /dev/null +++ b/Projectiles/Rogue/FinalDawnFireSlash.cs @@ -0,0 +1,131 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Microsoft.Xna.Framework.Graphics; +using CalamityMod.CalPlayer; +using CalamityMod.Buffs.DamageOverTime; + +namespace CalamityMod.Projectiles.Rogue +{ + public class FinalDawnFireSlash : ModProjectile + { + public bool HasRegeneratedStealth = false; + public const float StealthReturnRatio = 0.25f; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("FinalDawnFireSlash"); + Main.projFrames[projectile.type] = 11; + } + public override void SetDefaults() + { + projectile.width = 300; + projectile.height = 398; + projectile.friendly = false; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.Calamity().rogue = true; + projectile.ownerHitCheck = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + } + public override void AI() + { + Player player = Main.player[projectile.owner]; + + player.direction = projectile.direction; + player.heldProj = projectile.whoAmI; + + AdjustPlayerPositionValues(player); + + projectile.ai[0]++; + if(projectile.ai[0] >= 4) + { + projectile.ai[1]++; + projectile.ai[0] = 0; + if (projectile.ai[1] == 5) + { + projectile.friendly = true; + Main.PlaySound(SoundID.Item71, (int)projectile.position.X, (int)projectile.position.Y); + } + } + if (projectile.ai[1] >= 11) + { + projectile.Kill(); + return; + } + projectile.frame = (int)projectile.ai[1]; + + AdjustPlayerItemFrameValues(player); + } + public void AdjustPlayerPositionValues(Player player) + { + projectile.Center = player.Center; + projectile.position.X += 60 * player.direction; + projectile.position.Y -= 30; + } + + public void AdjustPlayerItemFrameValues(Player player) + { + if (projectile.ai[1] < 5) + { + player.bodyFrame.Y = player.bodyFrame.Height; + } + else if (projectile.ai[1] < 8) + { + player.bodyFrame.Y = 3 * player.bodyFrame.Height; + } + else + { + player.bodyFrame.Y = 4 * player.bodyFrame.Height; + } + + projectile.spriteDirection = player.direction; + player.heldProj = projectile.whoAmI; + } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + CalamityPlayer calamityPlayer = Main.player[projectile.owner].Calamity(); + // Restore stealth + if (!HasRegeneratedStealth) + { + calamityPlayer.rogueStealth += calamityPlayer.rogueStealthMax * StealthReturnRatio; + if (calamityPlayer.rogueStealth > calamityPlayer.rogueStealthMax) + calamityPlayer.rogueStealth = calamityPlayer.rogueStealthMax; + HasRegeneratedStealth = true; + target.AddBuff(ModContent.BuffType(), 600); + } + } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + int width = 918 / 3; + int height = 1990 / 5; + + Vector2 drawCenter = projectile.Center; + Rectangle frameRectangle = new Rectangle(projectile.frame / 5 * width, projectile.frame % 5 * height, width, height); + + Texture2D scytheTexture = Main.projectileTexture[projectile.type]; + Texture2D glowTexture = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/FinalDawnFireSlash_Glow"); + + Main.spriteBatch.Draw(scytheTexture, + drawCenter - Main.screenPosition, + frameRectangle, + projectile.GetAlpha(lightColor), + projectile.rotation, + frameRectangle.Size() / 2, + projectile.scale, + projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, + 0f); + Main.spriteBatch.Draw(glowTexture, + drawCenter - Main.screenPosition, + frameRectangle, + projectile.GetAlpha(Color.White), + projectile.rotation, + frameRectangle.Size() / 2, + projectile.scale, + projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, + 0f); + return false; + } + } +} \ No newline at end of file diff --git a/Projectiles/Rogue/FinalDawnFireSlash.png b/Projectiles/Rogue/FinalDawnFireSlash.png new file mode 100644 index 0000000000..560fd43ef7 Binary files /dev/null and b/Projectiles/Rogue/FinalDawnFireSlash.png differ diff --git a/Projectiles/Rogue/FinalDawnFireSlash_Glow.png b/Projectiles/Rogue/FinalDawnFireSlash_Glow.png new file mode 100644 index 0000000000..cfb5a2729a Binary files /dev/null and b/Projectiles/Rogue/FinalDawnFireSlash_Glow.png differ diff --git a/Projectiles/Rogue/FinalDawnFireball.cs b/Projectiles/Rogue/FinalDawnFireball.cs new file mode 100644 index 0000000000..2df97df18e --- /dev/null +++ b/Projectiles/Rogue/FinalDawnFireball.cs @@ -0,0 +1,89 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class FinalDawnFireball : ModProjectile + { + public const float DesiredSpeed = 30; + public const float InterpolationTime = 10; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Final Dawn"); + Main.projFrames[projectile.type] = 4; + } + public override void SetDefaults() + { + projectile.width = 36; + projectile.height = 80; + projectile.Calamity().rogue = true; + projectile.penetrate = 1; + projectile.hostile = false; + projectile.friendly = false; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.alpha = 50; + projectile.timeLeft = 180; + } + public override void AI() + { + NPC chargeAt = Main.npc[(int)projectile.ai[1]]; + if(!chargeAt.active) + projectile.Kill(); + + int idx = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width , projectile.height, ModContent.DustType(), 0f, 0f, 0, default, 1.0f); + Main.dust[idx].velocity = projectile.velocity * 0.5f; + Main.dust[idx].noGravity = true; + Main.dust[idx].noLight = true; + + projectile.ai[0]++; + if(projectile.ai[0] >= 20) + { + projectile.friendly = true; + NPC npc = Main.npc[(int)projectile.ai[1]]; + Vector2 desiredVelocity = projectile.DirectionTo(npc.Center) * DesiredSpeed; + projectile.velocity = Vector2.Lerp(projectile.velocity, desiredVelocity, 1f / InterpolationTime); + if(!npc.active) + projectile.Kill(); + } + + projectile.frameCounter++; + if (projectile.frameCounter >= 5) + { + projectile.frame++; + projectile.frameCounter = 0; + if (projectile.frame >= Main.projFrames[projectile.type]) + projectile.frame = 0; + } + } + public override void Kill(int timeLeft) + { + if (Main.myPlayer == projectile.owner) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); + } + } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D glowmask = Main.projectileTexture[projectile.type]; + int height = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int yStart = height * projectile.frame; + Main.spriteBatch.Draw(glowmask, + projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), + new Rectangle?(new Rectangle(0, yStart, glowmask.Width, height)), + projectile.GetAlpha(Color.White), projectile.rotation, + new Vector2(glowmask.Width / 2f, height / 2f), projectile.scale, + projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, + 0f); + return false; + } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 600); + } + } +} \ No newline at end of file diff --git a/Projectiles/Rogue/FinalDawnFireball.png b/Projectiles/Rogue/FinalDawnFireball.png new file mode 100644 index 0000000000..e4558d9715 Binary files /dev/null and b/Projectiles/Rogue/FinalDawnFireball.png differ diff --git a/Projectiles/Rogue/FinalDawnFlame.cs b/Projectiles/Rogue/FinalDawnFlame.cs new file mode 100644 index 0000000000..c5ba6d565f --- /dev/null +++ b/Projectiles/Rogue/FinalDawnFlame.cs @@ -0,0 +1,152 @@ +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class FinalDawnFlame : ModProjectile + { + internal struct Flame + { + public Vector2 Position; + + public int FrameCounter; + + public int Frame; + + public float Alpha; + + public float Scale; + + public int Direction; + } + private Flame[] Flames; + public const int TotalFlames = 120; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Final Dawn"); + Main.projFrames[projectile.type] = 8; + } + public override void SetDefaults() + { + projectile.scale = 1f; + projectile.width = 1000; + projectile.height = 100; + projectile.penetrate = -1; + projectile.hostile = false; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.Calamity().rogue = true; + projectile.alpha = 255; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 30; + + Flames = new Flame[TotalFlames]; + for (int i = 0; i < Flames.Length; i++) + { + Vector2 flamePosition = Main.rand.NextVector2Circular(projectile.width / 2, projectile.height / 2); + + Flames[i].Position = flamePosition; + Flames[i].Frame = Main.rand.Next(8); + Flames[i].FrameCounter = Main.rand.Next(5); + Flames[i].Alpha = 1f; + Flames[i].Scale = 0.8f + 0.4f * Main.rand.NextFloat(); + Flames[i].Direction = Main.rand.Next(2); + } + } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture = Main.projectileTexture[projectile.type]; + int frameHeight = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + + + if (Flames.Length > 0) + { + for(int i = 0; i < Flames.Length; i++) + { + int frameHeight2 = frameHeight * Flames[i].Frame; + spriteBatch.Draw(texture, + projectile.Center + Flames[i].Position - Main.screenPosition, + new Rectangle?(new Rectangle(0, frameHeight2, texture.Width, frameHeight)), + projectile.GetAlpha(Color.White) * Flames[i].Alpha, + projectile.rotation, + new Vector2(texture.Width / 2f, frameHeight / 2f), + Flames[i].Scale, + Flames[i].Direction == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, + 0f); + } + } + return false; + } + + public override void AI() + { + if (Flames.Length > 0) + { + for (int i = 0; i < Flames.Length; i++) + { + AdjustFlameValues(ref Flames[i]); + } + } + AlphaAdjustments(); + } + // The internal is to match consistency with the Flame struct. If you want to make this class public, you must also make the struct public. + internal void AdjustFlameValues(ref Flame flame) + { + flame.FrameCounter++; + if (flame.FrameCounter >= 5) + { + flame.Frame++; + flame.FrameCounter = 0; + + if (flame.Frame >= 8) + { + if (projectile.ai[0] < 570) + { + Vector2 pos = new Vector2(Main.rand.NextFloat(projectile.width / 2)).RotatedByRandom(MathHelper.TwoPi); + float widthHeightRatio = (float)projectile.height / projectile.width; + pos.Y *= widthHeightRatio; + + flame.Position = pos; + flame.Scale = 0.8f + 0.4f * Main.rand.NextFloat(); + flame.Direction = Main.rand.Next(2); + flame.Frame = 0; + } + else + { + flame.Alpha = 0f; + } + } + } + } + public void AlphaAdjustments() + { + projectile.ai[0]++; + if (projectile.ai[0] < 570) + { + projectile.alpha -= 10; + if (projectile.alpha < 0) projectile.alpha = 0; + } + else + { + projectile.friendly = false; + projectile.alpha += 5; + if (projectile.alpha > 255) + { + projectile.alpha = 255; + } + } + if (projectile.ai[0] >= 600 && projectile.alpha >= 255) + { + projectile.Kill(); + } + } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 600); + } + } +} \ No newline at end of file diff --git a/Projectiles/Rogue/FinalDawnFlame.png b/Projectiles/Rogue/FinalDawnFlame.png new file mode 100644 index 0000000000..39cfd79c74 Binary files /dev/null and b/Projectiles/Rogue/FinalDawnFlame.png differ diff --git a/Projectiles/Rogue/FinalDawnHorizontalSlash.cs b/Projectiles/Rogue/FinalDawnHorizontalSlash.cs new file mode 100644 index 0000000000..d7d6474030 --- /dev/null +++ b/Projectiles/Rogue/FinalDawnHorizontalSlash.cs @@ -0,0 +1,95 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Microsoft.Xna.Framework.Graphics; +using CalamityMod.Buffs.DamageOverTime; + +namespace CalamityMod.Projectiles.Rogue +{ + public class FinalDawnHorizontalSlash : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Final Dawn"); + Main.projFrames[projectile.type] = 9; + } + public override void SetDefaults() + { + projectile.width = 600; + projectile.height = 156; + projectile.friendly = false; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.Calamity().rogue = true; + projectile.ownerHitCheck = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + } + public override void AI() + { + Player player = Main.player[projectile.owner]; + projectile.Center = player.Center; + player.heldProj = projectile.whoAmI; + projectile.spriteDirection = (projectile.velocity.X > 0).ToDirectionInt(); + + projectile.ai[0]++; + if (projectile.ai[0] >= 4) + { + projectile.ai[1]++; + projectile.ai[0] = 0; + if (projectile.ai[1] == 3) + { + projectile.friendly = true; + Main.PlaySound(SoundID.Item71, projectile.position); + + if(projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage / 2, 0f, projectile.owner); + } + } + } + if (projectile.ai[1] >= 9) + { + projectile.Kill(); + return; + } + + projectile.frame = (int)projectile.ai[1]; + + if (projectile.ai[1] < 2) player.bodyFrame.Y = 1 * player.bodyFrame.Height; + else player.bodyFrame.Y = 3 * player.bodyFrame.Height; + + if (projectile.ai[1] == 4 || projectile.ai[1] == 5) player.direction = -1 * projectile.spriteDirection; + else player.direction = 1 * projectile.spriteDirection; + } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D scytheTexture = Main.projectileTexture[projectile.type]; + Texture2D scytheGlowTexture = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/FinalDawnHorizontalSlash_Glow"); + int height = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int yStart = height * projectile.frame; + Main.spriteBatch.Draw(scytheTexture, + projectile.Center - Main.screenPosition + projectile.gfxOffY * Vector2.UnitY, + new Rectangle?(new Rectangle(0, yStart, scytheTexture.Width, height)), + projectile.GetAlpha(lightColor), projectile.rotation, + new Vector2((float)scytheTexture.Width / 2f, (float)height / 2f), projectile.scale, + projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, + 0f); + Main.spriteBatch.Draw(scytheGlowTexture, + projectile.Center - Main.screenPosition + projectile.gfxOffY * Vector2.UnitY, + new Rectangle?(new Rectangle(0, yStart, scytheTexture.Width, height)), + projectile.GetAlpha(Color.White), + projectile.rotation, + new Vector2((float)scytheTexture.Width / 2f, (float)height / 2f), + projectile.scale, + projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, + 0f); + return false; + } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 600); + } + } +} \ No newline at end of file diff --git a/Projectiles/Rogue/FinalDawnHorizontalSlash.png b/Projectiles/Rogue/FinalDawnHorizontalSlash.png new file mode 100644 index 0000000000..5f4aa41f47 Binary files /dev/null and b/Projectiles/Rogue/FinalDawnHorizontalSlash.png differ diff --git a/Projectiles/Rogue/FinalDawnHorizontalSlash_Glow.png b/Projectiles/Rogue/FinalDawnHorizontalSlash_Glow.png new file mode 100644 index 0000000000..d45779cf18 Binary files /dev/null and b/Projectiles/Rogue/FinalDawnHorizontalSlash_Glow.png differ diff --git a/Projectiles/Rogue/FinalDawnProjectile.cs b/Projectiles/Rogue/FinalDawnProjectile.cs new file mode 100644 index 0000000000..c2f298dd27 --- /dev/null +++ b/Projectiles/Rogue/FinalDawnProjectile.cs @@ -0,0 +1,172 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class FinalDawnProjectile : ModProjectile + { + public const float MaxChargeTime = 20f; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Final Dawn"); + } + public override void SetDefaults() + { + projectile.width = 16; + projectile.height = 16; + projectile.friendly = false; + projectile.Calamity().rogue = true; + projectile.penetrate = -1; + projectile.tileCollide = false; + Main.projFrames[projectile.type] = 2; + //projectile.extraUpdates = 2; + } + public override bool ShouldUpdatePosition() => false; + public override void AI() + { + Player player = Main.player[projectile.owner]; + + if (Main.myPlayer == player.whoAmI) + { + projectile.velocity = Main.MouseWorld - player.Center; + projectile.velocity.Normalize(); + } + player.direction = projectile.direction; + player.heldProj = projectile.whoAmI; + projectile.Center = player.Center; + projectile.position.Y -= 44; + projectile.position.X -= 46 * player.direction; + player.bodyFrame.Y = player.bodyFrame.Height; + + if (projectile.ai[0] < MaxChargeTime) + { + // Charging dust + Vector2 dustCenter = new Vector2(projectile.Center.X, projectile.Center.Y - 40); + int flame = Dust.NewDust(dustCenter, projectile.width, projectile.height, ModContent.DustType(), 0, 0, 100, default, 2f); + Main.dust[flame].noGravity = true; + Main.dust[flame].fadeIn = 1.5f; + Main.dust[flame].scale = 1.4f; + Vector2 offsetVector = Utils.NextVector2CircularEdge(Main.rand, 100f, 100f); + Main.dust[flame].position = dustCenter - offsetVector; + Vector2 newVelocity = dustCenter - Main.dust[flame].position; + Main.dust[flame].velocity = newVelocity * 0.1f; + } + if (projectile.ai[0] == MaxChargeTime) + { + int dustCount = 36; + for (int i = 0; i < dustCount; i++) + { + Vector2 startingPosition = projectile.Center + new Vector2(0, -40); + Vector2 offset = Vector2.UnitX * projectile.width * 0.1875f; + offset = offset.RotatedBy((i - (dustCount / 2 - 1)) * MathHelper.TwoPi / dustCount); + int dustIdx = Dust.NewDust(startingPosition + offset, 0, 0, ModContent.DustType(), offset.X * 2f, offset.Y * 2f, 100, default, 3.4f); + Main.dust[dustIdx].noGravity = true; + Main.dust[dustIdx].noLight = true; + Main.dust[dustIdx].velocity = Vector2.Normalize(offset) * 5f; + } + projectile.frame = 1; + } + projectile.ai[0]++; + + projectile.spriteDirection = (projectile.velocity.X > 0).ToDirectionInt(); + + if (Main.myPlayer == projectile.owner) + { + if (!player.channel || player.noItems || player.CCed) + { + AttemptExecuteAttacks(player); + projectile.Kill(); + } + } + } + + public void AttemptExecuteAttacks(Player player) + { + if (projectile.ai[0] >= MaxChargeTime && !player.noItems && !player.CCed) + { + // Far range attack + if (player.controlUp) + { + // Stealth Strike + if (player.Calamity().StealthStrikeAvailable()) + { + Projectile.NewProjectile(player.Center, + player.DirectionTo(Main.MouseWorld) * 38f, + ModContent.ProjectileType(), + (int)(projectile.damage * 2.5f), + projectile.knockBack, + projectile.owner); + player.Calamity().ConsumeStealthByAttacking(); + } + else + { + Projectile.NewProjectile(projectile.Center, + projectile.DirectionTo(Main.MouseWorld) * 38f, + ModContent.ProjectileType(), projectile.damage, + projectile.knockBack, projectile.owner); + } + } + // Close range attack + else + { + // Stealth + if (player.Calamity().StealthStrikeAvailable()) + { + Projectile.NewProjectile(projectile.Center, + projectile.velocity, + ModContent.ProjectileType(), + (int)(projectile.damage * 2.5f), + projectile.knockBack, + projectile.owner); + player.Calamity().ConsumeStealthByAttacking(); + } + else + { + Projectile.NewProjectile(projectile.Center, + projectile.velocity, + ModContent.ProjectileType(), + (int)(projectile.damage * 1.5f), + projectile.knockBack, + projectile.owner); + } + } + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D scytheTexture = Main.projectileTexture[projectile.type]; + Texture2D glowmask = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/FinalDawnProjectile_Glow"); + int height = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int yStart = height * projectile.frame; + Main.spriteBatch.Draw(scytheTexture, + projectile.Center - Main.screenPosition + Vector2.UnitY * projectile.gfxOffY, + new Rectangle?(new Rectangle(0, yStart, scytheTexture.Width, height)), + projectile.GetAlpha(lightColor), + projectile.rotation, + new Vector2(scytheTexture.Width / 2f, height / 2f), + projectile.scale, + projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, + 0f); + Main.spriteBatch.Draw(glowmask, + projectile.Center - Main.screenPosition + Vector2.UnitY * projectile.gfxOffY, + new Rectangle?(new Rectangle(0, yStart, scytheTexture.Width, height)), + projectile.GetAlpha(Color.White), + projectile.rotation, + new Vector2(scytheTexture.Width / 2f, height / 2f), + projectile.scale, + projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, + 0f); + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 600); + } + } +} \ No newline at end of file diff --git a/Projectiles/Rogue/FinalDawnProjectile.png b/Projectiles/Rogue/FinalDawnProjectile.png new file mode 100644 index 0000000000..08ceda6fff Binary files /dev/null and b/Projectiles/Rogue/FinalDawnProjectile.png differ diff --git a/Projectiles/Rogue/FinalDawnProjectile_Glow.png b/Projectiles/Rogue/FinalDawnProjectile_Glow.png new file mode 100644 index 0000000000..d8050e928e Binary files /dev/null and b/Projectiles/Rogue/FinalDawnProjectile_Glow.png differ diff --git a/Projectiles/Rogue/FinalDawnReticle.cs b/Projectiles/Rogue/FinalDawnReticle.cs new file mode 100644 index 0000000000..a2c4fc0de4 --- /dev/null +++ b/Projectiles/Rogue/FinalDawnReticle.cs @@ -0,0 +1,81 @@ +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class FinalDawnReticle : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Final Dawn"); + } + public override void SetDefaults() + { + projectile.scale = 1.5f; + projectile.width = 120; + projectile.height = 120; + projectile.penetrate = -1; + projectile.hostile = false; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.Calamity().rogue = true; + projectile.alpha = 0; + + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = -1; + } + public override void AI() + { + if (projectile.ai[1] == 0) + projectile.ai[1] = 1; + if (projectile.ai[0] == 0) + { + int dustCount = 36; + for (int i = 0; i < dustCount; i++) + { + Vector2 startingPosition = projectile.Center + 10f * Vector2.UnitX; + Vector2 offset = Vector2.UnitX * projectile.width * 0.1875f; + offset = offset.RotatedBy((i - (dustCount / 2 - 1)) * MathHelper.TwoPi / 20f); + int dustIdx = Dust.NewDust(startingPosition + offset, 0, 0, ModContent.DustType(), offset.X * 2f, offset.Y * 2f, 100, default, 3.4f); + Main.dust[dustIdx].noGravity = true; + Main.dust[dustIdx].noLight = true; + Main.dust[dustIdx].velocity = Vector2.Normalize(offset) * 5f; + } + projectile.ai[0] = 1; + } + projectile.alpha += 8; + projectile.scale *= 0.98f; + projectile.ai[1] *= 1.01f; + if(projectile.alpha >= 255) + projectile.Kill(); + } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D ring = Main.projectileTexture[projectile.type]; + Texture2D symbol = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/FinalDawnReticleSymbol"); + spriteBatch.Draw(symbol, + projectile.Center - Main.screenPosition, + null, + projectile.GetAlpha(Color.White), + projectile.rotation, + new Vector2(symbol.Width / 2, symbol.Height / 2), + projectile.scale, + projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, + 0f); + spriteBatch.Draw(ring, + projectile.Center - Main.screenPosition, + null, + projectile.GetAlpha(Color.White), + projectile.rotation, + new Vector2(ring.Width / 2, ring.Height / 2), + projectile.ai[1], + projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, + 0f); + return false; + } + } +} \ No newline at end of file diff --git a/Projectiles/Rogue/FinalDawnReticle.png b/Projectiles/Rogue/FinalDawnReticle.png new file mode 100644 index 0000000000..3b92c7069d Binary files /dev/null and b/Projectiles/Rogue/FinalDawnReticle.png differ diff --git a/Projectiles/Rogue/FinalDawnReticleSymbol.png b/Projectiles/Rogue/FinalDawnReticleSymbol.png new file mode 100644 index 0000000000..27f3d33fbc Binary files /dev/null and b/Projectiles/Rogue/FinalDawnReticleSymbol.png differ diff --git a/Projectiles/Rogue/FinalDawnThrow.cs b/Projectiles/Rogue/FinalDawnThrow.cs new file mode 100644 index 0000000000..04c7a8ceae --- /dev/null +++ b/Projectiles/Rogue/FinalDawnThrow.cs @@ -0,0 +1,95 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class FinalDawnThrow : ModProjectile + { + public const float DesiredSpeed = 38; + public const float InterpolationTime = 15; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Final Dawn"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + public override void SetDefaults() + { + projectile.width = 80; + projectile.height = 80; + projectile.friendly = true; + projectile.Calamity().rogue = true; + projectile.penetrate = -1; + projectile.light = 0.0f; + projectile.extraUpdates = 2; + projectile.tileCollide = false; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 5; + } + public override void AI() + { + if (projectile.localAI[0] == 0) + { + Main.PlaySound(SoundID.Item71, (int)projectile.position.X, (int)projectile.position.Y); + projectile.localAI[0] = 1; + } + Player player = Main.player[projectile.owner]; + + projectile.spriteDirection = (projectile.velocity.X > 0).ToDirectionInt(); + projectile.rotation += 0.25f * projectile.direction; + + projectile.ai[0]++; + if (projectile.ai[0] >= 30) + { + Vector2 desiredVelocity = projectile.DirectionTo(player.Center) * DesiredSpeed; + projectile.velocity = Vector2.Lerp(projectile.velocity, desiredVelocity, 1f / InterpolationTime); + + float distance = projectile.Distance(player.Center); + if (distance < 64) + projectile.Kill(); + } + + int idx = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width , projectile.height, ModContent.DustType(), 0f, 0f, 0, default, 0.5f); + Main.dust[idx].velocity *= 0.5f; + Main.dust[idx].velocity += projectile.velocity * 0.5f; + Main.dust[idx].noGravity = true; + Main.dust[idx].noLight = false; + Main.dust[idx].scale = 1.0f; + } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D scytheTexture = Main.projectileTexture[projectile.type]; + Texture2D scytheGlowTexture = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/FinalDawnThrow_Glow"); + int height = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int yStart = height * projectile.frame; + Main.spriteBatch.Draw(scytheTexture, + projectile.Center - Main.screenPosition + Vector2.UnitY * projectile.gfxOffY, + new Rectangle?(new Rectangle(0, yStart, scytheTexture.Width, height)), + projectile.GetAlpha(lightColor), + projectile.rotation, + new Vector2(scytheTexture.Width / 2f, height / 2f), + projectile.scale, + projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, + 0f); + Main.spriteBatch.Draw(scytheGlowTexture, + projectile.Center - Main.screenPosition + Vector2.UnitY * projectile.gfxOffY, + new Rectangle?(new Rectangle(0, yStart, scytheTexture.Width, height)), + projectile.GetAlpha(Color.White), + projectile.rotation, + new Vector2(scytheTexture.Width / 2f, height / 2f), + projectile.scale, + projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, + 0f); + return false; + } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 600); + } + } +} \ No newline at end of file diff --git a/Projectiles/Rogue/FinalDawnThrow.png b/Projectiles/Rogue/FinalDawnThrow.png new file mode 100644 index 0000000000..4ee5e2a8dd Binary files /dev/null and b/Projectiles/Rogue/FinalDawnThrow.png differ diff --git a/Projectiles/Rogue/FinalDawnThrow2.cs b/Projectiles/Rogue/FinalDawnThrow2.cs new file mode 100644 index 0000000000..cb1c736e3c --- /dev/null +++ b/Projectiles/Rogue/FinalDawnThrow2.cs @@ -0,0 +1,127 @@ +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class FinalDawnThrow2 : ModProjectile + { + bool HasHitEnemy = false; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Final Dawn"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + public override void SetDefaults() + { + projectile.width = 200; + projectile.height = 200; + projectile.friendly = true; + projectile.Calamity().rogue = true; + projectile.penetrate = -1; + projectile.light = 0.0f; + projectile.extraUpdates = 1; + projectile.tileCollide = true; // We don't want people getting stuck in walls right + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 5; + } + public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough) + { + //should be self explanatory + width = 32; + height = 32; + return true; + } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + // Spawn homing flames that chase the HIT enemy only. This is also limited to one burst + if (Main.myPlayer == projectile.owner && !HasHitEnemy) + { + for (int i = 0; i < 6; i++) + { + Vector2 velocity = Utils.NextVector2Circular(Main.rand, 7.2f, 7.2f); + Projectile.NewProjectile(projectile.Center, velocity, + ModContent.ProjectileType(), + (int)(projectile.damage * 0.8), projectile.knockBack, projectile.owner, 0f, + target.whoAmI); + } + HasHitEnemy = true; + } + } + public override void AI() + { + if (projectile.localAI[0] == 0) + { + Main.PlaySound(SoundID.Item71, projectile.position); + projectile.localAI[0] = 1; + } + Player player = Main.player[projectile.owner]; + + projectile.spriteDirection = projectile.velocity.X > 0 ? 1 : -1; + projectile.rotation += 0.25f * projectile.direction; + player.Center = projectile.Center; + player.fullRotationOrigin = player.Center - player.position; + player.fullRotation = projectile.rotation; + player.direction = projectile.direction; + player.heldProj = projectile.whoAmI; + player.bodyFrame.Y = 1 * player.bodyFrame.Height; + player.immuneNoBlink = true; + player.immuneTime = 10; + + // This is to make sure the player doesn't get yeeted out of the world, which crashes the game pretty much all of the time + bool worldEdge = projectile.Center.X < 1000 || projectile.Center.Y < 1000 || projectile.Center.X > Main.maxTilesX * 16 - 1000 || projectile.Center.Y > Main.maxTilesY * 16 - 1000; + + projectile.ai[0]++; + if(projectile.ai[0] >= 60 || worldEdge) + { + projectile.Kill(); + } + + int idx = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width , projectile.height, mod.DustType("FinalFlame"), 0f, 0f, 0, default, 2.5f); + Main.dust[idx].velocity = projectile.velocity * -0.5f; + Main.dust[idx].noGravity = true; + Main.dust[idx].noLight = false; + } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Player player = Main.player[projectile.owner]; + float scytheRotation = player.fullRotation; + + Texture2D scytheTexture = Main.projectileTexture[projectile.type]; + Texture2D glowScytheTexture = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/FinalDawnThrow2_Glow"); + int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y6 = num214 * projectile.frame; + + Vector2 origin = new Vector2(scytheTexture.Width / 2f + 40f * player.direction, num214 * 1.1f); + + Main.spriteBatch.Draw(scytheTexture, + player.Center - Main.screenPosition + Vector2.UnitY * projectile.gfxOffY, + new Rectangle?(new Rectangle(0, y6, scytheTexture.Width, num214)), + projectile.GetAlpha(lightColor), + scytheRotation, + origin, + projectile.scale, + projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, + 0f); + Main.spriteBatch.Draw(glowScytheTexture, + player.Center - Main.screenPosition + Vector2.UnitY * projectile.gfxOffY, + new Rectangle?(new Rectangle(0, y6, scytheTexture.Width, num214)), + projectile.GetAlpha(Color.White), + scytheRotation, + origin, + projectile.scale, + projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, + 0f); + return false; + } + public override void Kill(int timeLeft) + { + Player player = Main.player[projectile.owner]; + player.fullRotation = 0; + } + } +} \ No newline at end of file diff --git a/Projectiles/Rogue/FinalDawnThrow2.png b/Projectiles/Rogue/FinalDawnThrow2.png new file mode 100644 index 0000000000..5e8c222953 Binary files /dev/null and b/Projectiles/Rogue/FinalDawnThrow2.png differ diff --git a/Projectiles/Rogue/FinalDawnThrow2_Glow.png b/Projectiles/Rogue/FinalDawnThrow2_Glow.png new file mode 100644 index 0000000000..23146bdc0c Binary files /dev/null and b/Projectiles/Rogue/FinalDawnThrow2_Glow.png differ diff --git a/Projectiles/Rogue/FinalDawnThrow_Glow.png b/Projectiles/Rogue/FinalDawnThrow_Glow.png new file mode 100644 index 0000000000..430a5f16bd Binary files /dev/null and b/Projectiles/Rogue/FinalDawnThrow_Glow.png differ