diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index b8cb6ab1f0..ef23eeb8b3 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -5206,19 +5206,17 @@ namespace CalamityMod.CalPlayer { if (flag) { - nPC.StrikeNPC(num3, 0f, 0, false, false, false); - if (Main.netMode != NetmodeID.SinglePlayer) + if (player.whoAmI == Main.myPlayer) { - NetMessage.SendData(28, -1, -1, null, l, (float)num3, 0f, 0f, 0, 0, 0); + Projectile p = Projectile.NewProjectileDirect(nPC.Center, Vector2.Zero, ModContent.ProjectileType(), num3, 0f, player.whoAmI, l); + p.minion = true; + p.Calamity().forceMinion = true; } } } } } lifeCounter++; - if (lifeCounter >= 180) - { - } } if (player.inventory[player.selectedItem].type == ModContent.ItemType() && player.ownedProjectileCounts[ModContent.ProjectileType()] != 0) @@ -5239,12 +5237,11 @@ namespace CalamityMod.CalPlayer { if (flag) { - nPC.StrikeNPC(num3, 0f, 0, false, false, false); - if (Main.netMode != NetmodeID.SinglePlayer) - { - NetMessage.SendData(28, -1, -1, null, l, (float)num3, 0f, 0f, 0, 0, 0); - } - Vector2 value15 = new Vector2((float)Main.rand.Next(-50, 51), (float)Main.rand.Next(-50, 51)); + if (player.whoAmI == Main.myPlayer) + { + Projectile p = Projectile.NewProjectileDirect(nPC.Center, Vector2.Zero, ModContent.ProjectileType(), num3, 0f, player.whoAmI, l); + } + Vector2 value15 = new Vector2((float)Main.rand.Next(-50, 51), (float)Main.rand.Next(-50, 51)); while (value15.X == 0f && value15.Y == 0f) { value15 = new Vector2((float)Main.rand.Next(-50, 51), (float)Main.rand.Next(-50, 51)); @@ -5260,9 +5257,6 @@ namespace CalamityMod.CalPlayer } } auraCounter++; - if (auraCounter >= 180) - { - } } if (brimstoneElementalLore && player.inferno) diff --git a/Items/Accessories/BloomStone.cs b/Items/Accessories/BloomStone.cs index 1a2a2a3af4..b30a539f2e 100644 --- a/Items/Accessories/BloomStone.cs +++ b/Items/Accessories/BloomStone.cs @@ -1,4 +1,5 @@ using CalamityMod.CalPlayer; +using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -53,10 +54,9 @@ namespace CalamityMod.Items.Accessories } if (flag) { - nPC.StrikeNPC(num3, 0f, 0, false, false, false); - if (Main.netMode != NetmodeID.SinglePlayer) + if (player.whoAmI == Main.myPlayer) { - NetMessage.SendData(28, -1, -1, null, l, (float)num3, 0f, 0f, 0, 0, 0); + Projectile p = Projectile.NewProjectileDirect(nPC.Center, Vector2.Zero, ModContent.ProjectileType(), num3, 0f, player.whoAmI, l); } } } @@ -64,9 +64,6 @@ namespace CalamityMod.Items.Accessories } } bloomCounter++; - if (bloomCounter >= 180) - { - } if (player.whoAmI == Main.myPlayer && player.velocity.Y == 0f && player.grappling[0] == -1) { int num4 = (int)player.Center.X / 16; diff --git a/Items/Accessories/LeviathanAmbergris.cs b/Items/Accessories/LeviathanAmbergris.cs index 0f877d3c59..4efd95bcc2 100644 --- a/Items/Accessories/LeviathanAmbergris.cs +++ b/Items/Accessories/LeviathanAmbergris.cs @@ -73,10 +73,9 @@ namespace CalamityMod.Items.Accessories } if (flag) { - nPC.StrikeNPC(num3, 0f, 0, false, false, false); - if (Main.netMode != NetmodeID.SinglePlayer) + if (player.whoAmI == Main.myPlayer) { - NetMessage.SendData(28, -1, -1, null, l, (float)num3, 0f, 0f, 0, 0, 0); + Projectile p = Projectile.NewProjectileDirect(nPC.Center, Vector2.Zero, ModContent.ProjectileType(), num3, 0f, player.whoAmI, l); } } } @@ -84,9 +83,6 @@ namespace CalamityMod.Items.Accessories } } seaCounter++; - if (seaCounter >= 180) - { - } } } } diff --git a/Items/Accessories/PlagueHive.cs b/Items/Accessories/PlagueHive.cs index 3cd9b72779..cc33b3d11b 100644 --- a/Items/Accessories/PlagueHive.cs +++ b/Items/Accessories/PlagueHive.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.CalPlayer; +using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -73,10 +74,11 @@ namespace CalamityMod.Items.Accessories } if (flag) { - nPC.StrikeNPC(num3, 0f, 0, false, false, false); - if (Main.netMode != NetmodeID.SinglePlayer) + if (player.whoAmI == Main.myPlayer) { - NetMessage.SendData(28, -1, -1, null, l, (float)num3, 0f, 0f, 0, 0, 0); + Projectile p = Projectile.NewProjectileDirect(nPC.Center, Vector2.Zero, ModContent.ProjectileType(), num3, 0f, player.whoAmI, l); + p.minion = true; + p.Calamity().forceMinion = true; } } } diff --git a/Items/Accessories/TheAmalgam.cs b/Items/Accessories/TheAmalgam.cs index c1ad433bfb..714d62af2c 100644 --- a/Items/Accessories/TheAmalgam.cs +++ b/Items/Accessories/TheAmalgam.cs @@ -141,10 +141,11 @@ namespace CalamityMod.Items.Accessories } if (flag) { - nPC.StrikeNPC(num3, 0f, 0, false, false, false); - if (Main.netMode != NetmodeID.SinglePlayer) + if (player.whoAmI == Main.myPlayer) { - NetMessage.SendData(28, -1, -1, null, l, (float)num3, 0f, 0f, 0, 0, 0); + Projectile p = Projectile.NewProjectileDirect(nPC.Center, Vector2.Zero, ModContent.ProjectileType(), num3, 0f, player.whoAmI, l); + p.minion = true; + p.Calamity().forceMinion = true; } } } diff --git a/Items/Accessories/ToxicHeart.cs b/Items/Accessories/ToxicHeart.cs index 3bb39cf667..05cd3d3166 100644 --- a/Items/Accessories/ToxicHeart.cs +++ b/Items/Accessories/ToxicHeart.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -48,10 +49,11 @@ namespace CalamityMod.Items.Accessories } if (flag) { - nPC.StrikeNPC(num3, 0f, 0, false, false, false); - if (Main.netMode != NetmodeID.SinglePlayer) + if (player.whoAmI == Main.myPlayer) { - NetMessage.SendData(28, -1, -1, null, l, (float)num3, 0f, 0f, 0, 0, 0); + Projectile p = Projectile.NewProjectileDirect(nPC.Center, Vector2.Zero, ModContent.ProjectileType(), num3, 0f, player.whoAmI, l); + p.minion = true; + p.Calamity().forceMinion = true; } } } diff --git a/Items/Weapons/Melee/Oracle.cs b/Items/Weapons/Melee/Oracle.cs index b9fd0539ad..a97dc1d01f 100644 --- a/Items/Weapons/Melee/Oracle.cs +++ b/Items/Weapons/Melee/Oracle.cs @@ -1,5 +1,4 @@ using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Ores; using CalamityMod.Projectiles.Melee.Yoyos; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; @@ -11,36 +10,38 @@ namespace CalamityMod.Items.Weapons.Melee { public class Oracle : ModItem { - public static int BaseDamage = 480; - public override void SetStaticDefaults() { DisplayName.SetDefault("The Oracle"); Tooltip.SetDefault("Emits an aura of red lightning\nFires auric orbs when supercharged\nHitting enemies charges the yoyo\n'Gaze into the past, the present, the future... and the circumstances of your inevitable demise'"); + ItemID.Sets.Yoyo[item.type] = true; + ItemID.Sets.GamepadExtraRange[item.type] = 15; + ItemID.Sets.GamepadSmartQuickReach[item.type] = true; } public override void SetDefaults() { - item.CloneDefaults(ItemID.Kraken); - ItemID.Sets.Yoyo[item.type] = true; - item.width = 54; item.height = 42; item.melee = true; - item.damage = BaseDamage; + item.damage = 420; item.knockBack = 4f; item.useTime = 20; item.useAnimation = 20; item.autoReuse = true; item.useStyle = 5; + item.UseSound = SoundID.Item1; item.channel = true; + item.noUseGraphic = true; + item.noMelee = true; + + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 16f; item.rare = 10; item.Calamity().postMoonLordRarity = 21; item.value = Item.buyPrice(2, 50, 0, 0); - - item.shoot = ModContent.ProjectileType(); } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Projectiles/Melee/Yoyos/OracleYoyo.cs b/Projectiles/Melee/Yoyos/OracleYoyo.cs index ab37dbeae1..4af9bdc38a 100644 --- a/Projectiles/Melee/Yoyos/OracleYoyo.cs +++ b/Projectiles/Melee/Yoyos/OracleYoyo.cs @@ -1,5 +1,7 @@ using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -19,23 +21,29 @@ namespace CalamityMod.Projectiles.Melee.Yoyos private static float MaxAuraRadius = 100f; private static float MinDischargeRate = 0.05f; private static float MaxDischargeRate = 0.53f; - private static float ChargePerHit = 6f; + private static float ChargePerHit = 2.2f; private static int AuraBaseDamage = 160; - private static int HitsPerOrbVolley = 6; + private static int HitsPerOrbVolley = 10; public override void SetStaticDefaults() { DisplayName.SetDefault("The Oracle"); + ProjectileID.Sets.YoyosLifeTimeMultiplier[projectile.type] = -1f; + ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 800f; + ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 24f; + + ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; } public override void SetDefaults() { - projectile.CloneDefaults(ProjectileID.Terrarian); - aiType = 554; + projectile.aiStyle = 99; projectile.width = 20; projectile.height = 20; projectile.scale = 1.2f; + projectile.friendly = true; projectile.melee = true; projectile.penetrate = -1; projectile.extraUpdates = 1; @@ -91,6 +99,12 @@ namespace CalamityMod.Projectiles.Melee.Yoyos projectile.netUpdate = true; } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { // The yoyo does nothing versus normal dummies @@ -190,12 +204,13 @@ namespace CalamityMod.Projectiles.Melee.Yoyos if (dist <= radius) { - int finalDamage = (int)(baseDamage * owner.meleeDamage * Main.rand.NextFloat(0.85f, 1.15f)); - bool crit = Main.rand.Next(100) <= owner.meleeCrit + 4; - target.StrikeNPC(finalDamage, 0f, 0, crit, false, false); - - if (Main.netMode != NetmodeID.SinglePlayer) - NetMessage.SendData(28, -1, -1, null, i, finalDamage, 0f, 0f, crit ? 1 : 0, 0, 0); + int finalDamage = (int)(baseDamage * (owner.allDamage + owner.meleeDamage - 1f)); + if (projectile.owner == Main.myPlayer) + { + Projectile p = Projectile.NewProjectileDirect(target.Center, Vector2.Zero, ModContent.ProjectileType(), finalDamage, 0f, projectile.owner, i); + p.melee = true; + p.Calamity().forceMelee = true; + } } } } @@ -207,7 +222,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos int numOrbs = 3; int orbID = ModContent.ProjectileType(); - int orbDamage = Oracle.BaseDamage * 3; + int orbDamage = projectile.damage * 3; float orbKB = 8f; float angleVariance = MathHelper.TwoPi / numOrbs; float spinOffsetAngle = MathHelper.Pi / (2f * numOrbs); diff --git a/Projectiles/Typeless/DirectStrike.cs b/Projectiles/Typeless/DirectStrike.cs new file mode 100644 index 0000000000..f39fc3bbd9 --- /dev/null +++ b/Projectiles/Typeless/DirectStrike.cs @@ -0,0 +1,32 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class DirectStrike : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Nondescript Damaging Entity"); + } + + public override void SetDefaults() + { + projectile.width = 2; + projectile.height = 2; + projectile.penetrate = 1; + projectile.extraUpdates = 0; + projectile.ignoreWater = true; + projectile.alpha = 255; + projectile.timeLeft = 2; + } + + // Can only strike the given NPC slot (assuming it's a valid identifier) + public override bool? CanHitNPC(NPC target) + { + if (projectile.ai[0] < 0f || projectile.ai[0] > 199f) + return null; + return projectile.ai[0] == target.whoAmI; + } + } +} diff --git a/Projectiles/Typeless/DirectStrike.png b/Projectiles/Typeless/DirectStrike.png new file mode 100644 index 0000000000..50986e43ef Binary files /dev/null and b/Projectiles/Typeless/DirectStrike.png differ