diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 330294da96..b614c38804 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -3472,10 +3472,8 @@ namespace CalamityMod.CalPlayer for (int j = 0; j < 2; j++) { int num = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 157, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 2f); - Dust expr_A4_cp_0 = Main.dust[num]; - expr_A4_cp_0.position.X += (float)Main.rand.Next(-20, 21); - Dust expr_CB_cp_0 = Main.dust[num]; - expr_CB_cp_0.position.Y += (float)Main.rand.Next(-20, 21); + Main.dust[num].position.X += (float)Main.rand.Next(-20, 21); + Main.dust[num].position.Y += (float)Main.rand.Next(-20, 21); Main.dust[num].velocity *= 0.9f; Main.dust[num].noGravity = true; Main.dust[num].scale *= 1f + (float)Main.rand.Next(40) * 0.01f; diff --git a/Items/Weapons/Rogue/SylvanSlasher.cs b/Items/Weapons/Rogue/SylvanSlasher.cs new file mode 100644 index 0000000000..052c86c567 --- /dev/null +++ b/Items/Weapons/Rogue/SylvanSlasher.cs @@ -0,0 +1,42 @@ +using CalamityMod.Projectiles.Rogue; +using Terraria; +using Terraria.ModLoader; +namespace CalamityMod.Items.Weapons.Rogue +{ + public class SylvanSlasher : RogueWeapon + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sylvan Slasher"); + Tooltip.SetDefault(@"Summons sword waves and builds stealth on enemy hits +Does not consume stealth and cannot stealth strike"); + } + + public override void SafeSetDefaults() + { + item.width = 72; + item.damage = 300; + item.Calamity().rogue = true; + item.noMelee = true; + item.noUseGraphic = true; + item.channel = true; + item.useAnimation = 25; + item.useStyle = 5; + item.useTime = 5; + item.knockBack = 3f; + item.autoReuse = false; + item.height = 78; + item.value = Item.buyPrice(1, 20, 0, 0); + item.rare = 10; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 24f; + item.Calamity().postMoonLordRarity = 12; + } + + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + } +} diff --git a/Items/Weapons/Rogue/SylvanSlasher.png b/Items/Weapons/Rogue/SylvanSlasher.png new file mode 100644 index 0000000000..3113ba4cca Binary files /dev/null and b/Items/Weapons/Rogue/SylvanSlasher.png differ diff --git a/Projectiles/Rogue/SylvanSlash.cs b/Projectiles/Rogue/SylvanSlash.cs new file mode 100644 index 0000000000..b8e0046a4f --- /dev/null +++ b/Projectiles/Rogue/SylvanSlash.cs @@ -0,0 +1,78 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class SylvanSlash : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Slash"); + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + aiType = 348; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.Calamity().rogue = true; + projectile.penetrate = 2; + projectile.alpha = 120; + projectile.timeLeft = 200; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.tileCollide = false; + } + + public override void AI() + { + if (projectile.localAI[0] == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 92); + projectile.localAI[0] += 1f; + } + Lighting.AddLight(projectile.Center, 0f, 0.2f, 0.4f); + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.velocity.Y += projectile.ai[0]; + if (Main.rand.NextBool(2)) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 111, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + if (projectile.timeLeft > 195) + return false; + + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + return false; + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(200, 200, 200, projectile.alpha); + } + + public override void Kill(int timeLeft) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 111, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + projectile.velocity *= 0.5f; + } + } +} diff --git a/Projectiles/Rogue/SylvanSlash.png b/Projectiles/Rogue/SylvanSlash.png new file mode 100644 index 0000000000..851332c289 Binary files /dev/null and b/Projectiles/Rogue/SylvanSlash.png differ diff --git a/Projectiles/Rogue/SylvanSlashAttack.cs b/Projectiles/Rogue/SylvanSlashAttack.cs new file mode 100644 index 0000000000..f6cd1e6e00 --- /dev/null +++ b/Projectiles/Rogue/SylvanSlashAttack.cs @@ -0,0 +1,127 @@ +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.CalPlayer; + +namespace CalamityMod.Projectiles.Rogue +{ + public class SylvanSlashAttack : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sylvan Slash"); + Main.projFrames[projectile.type] = 28; + } + + public override void SetDefaults() + { + projectile.width = 68; + projectile.height = 68; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.Calamity().rogue = true; + projectile.ownerHitCheck = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 4; + } + + public override void AI() + { + Player player = Main.player[projectile.owner]; + float num = 0f; + Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); + if (projectile.spriteDirection == -1) + { + num = 3.14159274f; + } + if (++projectile.frame >= Main.projFrames[projectile.type]) + { + projectile.frame = 0; + } + projectile.soundDelay--; + if (projectile.soundDelay <= 0) + { + Main.PlaySound(SoundID.Item15, projectile.Center); + projectile.soundDelay = 24; + } + if (Main.myPlayer == projectile.owner) + { + if (player.channel && !player.noItems && !player.CCed) + { + float scaleFactor6 = 1f; + if (player.inventory[player.selectedItem].shoot == projectile.type) + { + scaleFactor6 = player.inventory[player.selectedItem].shootSpeed * projectile.scale; + } + Vector2 vector13 = Main.MouseWorld - vector; + vector13.Normalize(); + if (vector13.HasNaNs()) + { + vector13 = Vector2.UnitX * (float)player.direction; + } + vector13 *= scaleFactor6; + if (vector13.X != projectile.velocity.X || vector13.Y != projectile.velocity.Y) + { + projectile.netUpdate = true; + } + projectile.velocity = vector13; + } + else + { + projectile.Kill(); + } + } + Vector2 vector14 = projectile.Center + projectile.velocity * 3f; + Lighting.AddLight(vector14, 3f, 0.2f, 0.2f); + if (Main.rand.NextBool(3)) + { + int num30 = Dust.NewDust(vector14 - projectile.Size / 2f, projectile.width, projectile.height, 111, projectile.velocity.X, projectile.velocity.Y, 100, default, 2f); + Main.dust[num30].noGravity = true; + Main.dust[num30].position -= projectile.velocity; + } + projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; + projectile.rotation = projectile.velocity.ToRotation() + num; + projectile.spriteDirection = projectile.direction; + projectile.timeLeft = 2; + player.ChangeDir(projectile.direction); + player.heldProj = projectile.whoAmI; + player.itemTime = 2; + player.itemAnimation = 2; + player.itemRotation = (float)Math.Atan2((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)projectile.direction)); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + CalamityPlayer modPlayer = Main.player[Main.myPlayer].Calamity(); + if (projectile.owner == Main.myPlayer) + { + if ((target.damage > 5 || target.boss) && !target.SpawnedFromStatue) + { + if (modPlayer.wearingRogueArmor && modPlayer.rogueStealthMax != 0) + { + if (modPlayer.rogueStealth < modPlayer.rogueStealthMax) + modPlayer.rogueStealth += 0.01f; + } + } + if (Main.rand.NextBool(8)) + { + if (Main.rand.NextBool(3)) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, Main.rand.Next(-3,-1), ModContent.ProjectileType(), (int)((double)projectile.damage * 0.5), projectile.knockBack, projectile.owner, 0f, 0f); + } + else if (Main.rand.NextBool(2)) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, Main.rand.Next(2,4), 0f, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.5), projectile.knockBack, projectile.owner, 0f, 0f); + } + else + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, Main.rand.Next(-3,-1), 0f, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.5), projectile.knockBack, projectile.owner, 0f, 0f); + } + } + } + } + } +} diff --git a/Projectiles/Rogue/SylvanSlashAttack.png b/Projectiles/Rogue/SylvanSlashAttack.png new file mode 100644 index 0000000000..e807c7f93a Binary files /dev/null and b/Projectiles/Rogue/SylvanSlashAttack.png differ