From 077fa6f8e7674d93de4f1f53feaee1bf8e76f3ef Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Wed, 29 Apr 2020 15:12:15 -0400 Subject: [PATCH] changed some projectiles to use the new spawn life steal projectile method --- Items/Weapons/Melee/RoyalKnivesMelee.cs | 7 +- Items/Weapons/Rogue/RoyalKnives.cs | 4 +- Projectiles/Hybrid/CorpusAvertorClone.cs | 8 +- Projectiles/Hybrid/CorpusAvertorProj.cs | 8 +- Projectiles/Hybrid/EmpyreanKnife.cs | 22 ++-- .../{Rogue => Hybrid}/IllustriousKnife.cs | 18 ++-- .../{Rogue => Hybrid}/IllustriousKnife.png | Bin Projectiles/Melee/Earth4.cs | 8 +- Projectiles/Melee/EssenceScythe.cs | 2 +- Projectiles/Melee/Exocomet.cs | 8 +- Projectiles/Melee/RoyalKnifeMelee.cs | 95 ------------------ Projectiles/Melee/RoyalKnifeMelee.png | Bin 253 -> 0 bytes Projectiles/Ranged/ShockblastRound.cs | 8 +- Projectiles/Rogue/ShinobiBladeProjectile.cs | 4 +- Projectiles/Summon/FungalClumpMinion.cs | 8 +- 15 files changed, 41 insertions(+), 159 deletions(-) rename Projectiles/{Rogue => Hybrid}/IllustriousKnife.cs (81%) rename Projectiles/{Rogue => Hybrid}/IllustriousKnife.png (100%) delete mode 100644 Projectiles/Melee/RoyalKnifeMelee.cs delete mode 100644 Projectiles/Melee/RoyalKnifeMelee.png diff --git a/Items/Weapons/Melee/RoyalKnivesMelee.cs b/Items/Weapons/Melee/RoyalKnivesMelee.cs index 9abe8467c3..c502b927d9 100644 --- a/Items/Weapons/Melee/RoyalKnivesMelee.cs +++ b/Items/Weapons/Melee/RoyalKnivesMelee.cs @@ -1,5 +1,5 @@ using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Melee; +using CalamityMod.Projectiles.Hybrid; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using System; @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Melee item.height = 20; item.value = Item.buyPrice(5, 0, 0, 0); item.rare = 10; - item.shoot = ModContent.ProjectileType(); + item.shoot = ModContent.ProjectileType(); item.shootSpeed = 9f; item.Calamity().customRarity = CalamityRarity.Developer; } @@ -93,7 +93,8 @@ namespace CalamityMod.Items.Weapons.Melee num149 *= num80; float x4 = vector2.X; float y4 = vector2.Y; - Projectile.NewProjectile(x4, y4, num148, num149, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + int knife = Projectile.NewProjectile(x4, y4, num148, num149, type, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[knife].Calamity().forceMelee = true; } return false; } diff --git a/Items/Weapons/Rogue/RoyalKnives.cs b/Items/Weapons/Rogue/RoyalKnives.cs index 491cb3d31e..2814bc4c33 100644 --- a/Items/Weapons/Rogue/RoyalKnives.cs +++ b/Items/Weapons/Rogue/RoyalKnives.cs @@ -1,5 +1,5 @@ using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Hybrid; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using System; @@ -93,7 +93,7 @@ namespace CalamityMod.Items.Weapons.Rogue num149 *= num80; float x4 = vector2.X; float y4 = vector2.Y; - Projectile.NewProjectile(x4, y4, num148, num149, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(x4, y4, num148, num149, type, damage, knockBack, player.whoAmI, 0f, 0f); } return false; } diff --git a/Projectiles/Hybrid/CorpusAvertorClone.cs b/Projectiles/Hybrid/CorpusAvertorClone.cs index 1bd9edd5c9..1210f3270e 100644 --- a/Projectiles/Hybrid/CorpusAvertorClone.cs +++ b/Projectiles/Hybrid/CorpusAvertorClone.cs @@ -85,9 +85,7 @@ namespace CalamityMod.Projectiles.Hybrid if (Main.player[Main.myPlayer].lifeSteal <= 0f) return; - Main.player[Main.myPlayer].lifeSteal -= heal * 1.5f; - int owner = projectile.owner; - Projectile.NewProjectile(target.position.X, target.position.Y, 0f, 0f, ProjectileID.VampireHeal, 0, 0f, projectile.owner, (float)owner, heal); + CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], heal, ProjectileID.VampireHeal, 1200f, 1.5f); } public override void OnHitPvp(Player target, int damage, bool crit) @@ -98,9 +96,7 @@ namespace CalamityMod.Projectiles.Hybrid if (Main.player[Main.myPlayer].lifeSteal <= 0f) return; - Main.player[Main.myPlayer].lifeSteal -= heal * 1.5f; - int owner = projectile.owner; - Projectile.NewProjectile(target.position.X, target.position.Y, 0f, 0f, ProjectileID.VampireHeal, 0, 0f, projectile.owner, (float)owner, heal); + CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], heal, ProjectileID.VampireHeal, 1200f, 1.5f); } } } diff --git a/Projectiles/Hybrid/CorpusAvertorProj.cs b/Projectiles/Hybrid/CorpusAvertorProj.cs index 0d6d1935cb..4e41dfb165 100644 --- a/Projectiles/Hybrid/CorpusAvertorProj.cs +++ b/Projectiles/Hybrid/CorpusAvertorProj.cs @@ -90,9 +90,7 @@ namespace CalamityMod.Projectiles.Hybrid if (Main.player[Main.myPlayer].lifeSteal <= 0f) return; - Main.player[Main.myPlayer].lifeSteal -= heal * 1.5f; - int owner = projectile.owner; - Projectile.NewProjectile(target.position.X, target.position.Y, 0f, 0f, ProjectileID.VampireHeal, 0, 0f, projectile.owner, (float)owner, heal); + CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], heal, ProjectileID.VampireHeal, 1200f, 1.5f); } public override void OnHitPvp(Player target, int damage, bool crit) @@ -103,9 +101,7 @@ namespace CalamityMod.Projectiles.Hybrid if (Main.player[Main.myPlayer].lifeSteal <= 0f) return; - Main.player[Main.myPlayer].lifeSteal -= heal * 1.5f; - int owner = projectile.owner; - Projectile.NewProjectile(target.position.X, target.position.Y, 0f, 0f, ProjectileID.VampireHeal, 0, 0f, projectile.owner, (float)owner, heal); + CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], heal, ProjectileID.VampireHeal, 1200f, 1.5f); } } } diff --git a/Projectiles/Hybrid/EmpyreanKnife.cs b/Projectiles/Hybrid/EmpyreanKnife.cs index 0ccd843fb8..17908efb24 100644 --- a/Projectiles/Hybrid/EmpyreanKnife.cs +++ b/Projectiles/Hybrid/EmpyreanKnife.cs @@ -40,8 +40,8 @@ namespace CalamityMod.Projectiles.Hybrid if (projectile.ai[0] >= 75f) { projectile.alpha += 10; - projectile.damage = (int)((double)projectile.damage * 0.95); - projectile.knockBack = (float)(int)((double)projectile.knockBack * 0.95); + projectile.damage = (int)(projectile.damage * 0.95); + projectile.knockBack = projectile.knockBack * 0.95f; if (projectile.alpha >= 255) { projectile.active = false; @@ -49,7 +49,7 @@ namespace CalamityMod.Projectiles.Hybrid } if (projectile.ai[0] < 75f) { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + MathHelper.PiOver2; } else { @@ -100,8 +100,8 @@ namespace CalamityMod.Projectiles.Hybrid { return; } - float num = (float)damage * 0.005f; - if ((int)num == 0) + float healAmt = (float)damage * 0.005f; + if ((int)healAmt == 0) { return; } @@ -109,15 +109,13 @@ namespace CalamityMod.Projectiles.Hybrid { return; } - Main.player[Main.myPlayer].lifeSteal -= num * 1.5f; - int num2 = projectile.owner; - Projectile.NewProjectile(target.position.X, target.position.Y, 0f, 0f, 305, 0, 0f, projectile.owner, (float)num2, num); + CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], healAmt, ProjectileID.VampireHeal, 1200f, 1.5f); } public override void OnHitPvp(Player target, int damage, bool crit) { - float num = (float)damage * 0.005f; - if ((int)num == 0) + float healAmt = (float)damage * 0.005f; + if ((int)healAmt == 0) { return; } @@ -125,9 +123,7 @@ namespace CalamityMod.Projectiles.Hybrid { return; } - Main.player[Main.myPlayer].lifeSteal -= num * 1.5f; - int num2 = projectile.owner; - Projectile.NewProjectile(target.position.X, target.position.Y, 0f, 0f, 305, 0, 0f, projectile.owner, (float)num2, num); + CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], healAmt, ProjectileID.VampireHeal, 1200f, 1.5f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Rogue/IllustriousKnife.cs b/Projectiles/Hybrid/IllustriousKnife.cs similarity index 81% rename from Projectiles/Rogue/IllustriousKnife.cs rename to Projectiles/Hybrid/IllustriousKnife.cs index 4d27eeea5e..843ec6fe90 100644 --- a/Projectiles/Rogue/IllustriousKnife.cs +++ b/Projectiles/Hybrid/IllustriousKnife.cs @@ -6,7 +6,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Rogue +namespace CalamityMod.Projectiles.Hybrid { public class IllustriousKnife : ModProjectile { @@ -69,8 +69,8 @@ namespace CalamityMod.Projectiles.Rogue { return; } - float num = (float)damage * 0.015f; - if ((int)num == 0) + float healAmt = (float)damage * 0.015f; + if ((int)healAmt == 0) { return; } @@ -78,16 +78,14 @@ namespace CalamityMod.Projectiles.Rogue { return; } - Main.player[Main.myPlayer].lifeSteal -= num * 1.5f; - int num2 = projectile.owner; - Projectile.NewProjectile(target.position.X, target.position.Y, 0f, 0f, ModContent.ProjectileType(), 0, 0f, projectile.owner, (float)num2, num); + CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], healAmt, ModContent.ProjectileType(), 1200f, 1.5f); } public override void OnHitPvp(Player target, int damage, bool crit) { target.AddBuff(ModContent.BuffType(), 600); - float num = (float)damage * 0.015f; - if ((int)num == 0) + float healAmt = (float)damage * 0.015f; + if ((int)healAmt == 0) { return; } @@ -95,9 +93,7 @@ namespace CalamityMod.Projectiles.Rogue { return; } - Main.player[Main.myPlayer].lifeSteal -= num * 1.5f; - int num2 = projectile.owner; - Projectile.NewProjectile(target.position.X, target.position.Y, 0f, 0f, ModContent.ProjectileType(), 0, 0f, projectile.owner, (float)num2, num); + CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], healAmt, ModContent.ProjectileType(), 1200f, 1.5f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Rogue/IllustriousKnife.png b/Projectiles/Hybrid/IllustriousKnife.png similarity index 100% rename from Projectiles/Rogue/IllustriousKnife.png rename to Projectiles/Hybrid/IllustriousKnife.png diff --git a/Projectiles/Melee/Earth4.cs b/Projectiles/Melee/Earth4.cs index 4be8960038..75586af9c4 100644 --- a/Projectiles/Melee/Earth4.cs +++ b/Projectiles/Melee/Earth4.cs @@ -95,8 +95,8 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 4); - float num = (float)damage * 0.075f; - if ((int)num == 0) + float healAmt = (float)damage * 0.075f; + if ((int)healAmt == 0) { return; } @@ -104,9 +104,7 @@ namespace CalamityMod.Projectiles.Melee { return; } - Main.player[Main.myPlayer].lifeSteal -= num * 1.5f; - int num2 = projectile.owner; - Projectile.NewProjectile(target.position.X, target.position.Y, 0f, 0f, ModContent.ProjectileType(), 0, 0f, projectile.owner, (float)num2, num); + CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], healAmt, ModContent.ProjectileType(), 1200f, 1.5f); } } } diff --git a/Projectiles/Melee/EssenceScythe.cs b/Projectiles/Melee/EssenceScythe.cs index 3a0999fd64..d863436f56 100644 --- a/Projectiles/Melee/EssenceScythe.cs +++ b/Projectiles/Melee/EssenceScythe.cs @@ -80,7 +80,7 @@ namespace CalamityMod.Projectiles.Melee { if (projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f, ModContent.ProjectileType(), 0, 0, projectile.owner, 0f, 0f); + CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], 8, ModContent.ProjectileType(), 1200f, 0f); } } } diff --git a/Projectiles/Melee/Exocomet.cs b/Projectiles/Melee/Exocomet.cs index 77f949596a..6cbfc7d942 100644 --- a/Projectiles/Melee/Exocomet.cs +++ b/Projectiles/Melee/Exocomet.cs @@ -103,8 +103,8 @@ namespace CalamityMod.Projectiles.Melee { return; } - float num = (float)damage * 0.01f; - if ((int)num == 0) + float healAmt = (float)damage * 0.01f; + if ((int)healAmt == 0) { return; } @@ -112,9 +112,7 @@ namespace CalamityMod.Projectiles.Melee { return; } - Main.player[Main.myPlayer].lifeSteal -= num; - int num2 = projectile.owner; - Projectile.NewProjectile(target.position.X, target.position.Y, 0f, 0f, ModContent.ProjectileType(), 0, 0f, projectile.owner, (float)num2, num); + CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], healAmt, ModContent.ProjectileType(), 1200f, 1f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Melee/RoyalKnifeMelee.cs b/Projectiles/Melee/RoyalKnifeMelee.cs deleted file mode 100644 index 6b0648ec3b..0000000000 --- a/Projectiles/Melee/RoyalKnifeMelee.cs +++ /dev/null @@ -1,95 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Projectiles.Healing; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Melee -{ - public class RoyalKnifeMelee : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Knife"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } - - public override void SetDefaults() - { - projectile.width = 18; - projectile.height = 18; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.melee = true; - } - - public override void AI() - { - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 240f) - { - projectile.alpha += 4; - projectile.damage = (int)((double)projectile.damage * 0.95); - projectile.knockBack = (float)(int)((double)projectile.knockBack * 0.95); - } - - if (projectile.ai[0] < 240f) - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - } - else - { - projectile.rotation += 0.5f; - } - - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 800f, 35f, 20f); - - if (Main.rand.NextBool(6)) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 20, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - } - - public override void Kill(int timeLeft) - { - for (int num303 = 0; num303 < 3; num303++) - { - int num304 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 20, 0f, 0f, 100, default, 0.8f); - Main.dust[num304].noGravity = true; - Main.dust[num304].velocity *= 1.2f; - Main.dust[num304].velocity -= projectile.oldVelocity * 0.3f; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 600); - if (target.type == NPCID.TargetDummy) - { - return; - } - float num = (float)damage * 0.015f; - if ((int)num == 0) - { - return; - } - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - { - return; - } - Main.player[Main.myPlayer].lifeSteal -= num * 1.5f; - int num2 = projectile.owner; - Projectile.NewProjectile(target.position.X, target.position.Y, 0f, 0f, ModContent.ProjectileType(), 0, 0f, projectile.owner, (float)num2, num); - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - } -} diff --git a/Projectiles/Melee/RoyalKnifeMelee.png b/Projectiles/Melee/RoyalKnifeMelee.png deleted file mode 100644 index d8793dd62483e3a93076e0a99980c2ffa4e705de..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 253 zcmeAS@N?(olHy`uVBq!ia0vp^LO`sw)N7dHKXT_F?9oysLz`O9724`)IkmQHf5bF}p zulBcIYfSpwm2{Gi@l0&x^o|*fSARFE87X*idU!5bq+}5v}_2vSD?%V)=?u~^B+#nA!c)I$ztaD0e0sx1}U%~(Y diff --git a/Projectiles/Ranged/ShockblastRound.cs b/Projectiles/Ranged/ShockblastRound.cs index af488c6eb4..fd7f0cefa0 100644 --- a/Projectiles/Ranged/ShockblastRound.cs +++ b/Projectiles/Ranged/ShockblastRound.cs @@ -90,8 +90,8 @@ namespace CalamityMod.Projectiles.Ranged { return; } - float num = (float)damage * 0.05f; - if ((int)num == 0) + float healAmt = (float)damage * 0.05f; + if ((int)healAmt == 0) { return; } @@ -99,9 +99,7 @@ namespace CalamityMod.Projectiles.Ranged { return; } - Main.player[Main.myPlayer].lifeSteal -= num * 1.5f; - int num2 = projectile.owner; - Projectile.NewProjectile(target.position.X, target.position.Y, 0f, 0f, ModContent.ProjectileType(), 0, 0f, projectile.owner, (float)num2, num); + CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], healAmt, ModContent.ProjectileType(), 1200f, 1.5f); } } } diff --git a/Projectiles/Rogue/ShinobiBladeProjectile.cs b/Projectiles/Rogue/ShinobiBladeProjectile.cs index 19d008caaa..af1ab201fa 100644 --- a/Projectiles/Rogue/ShinobiBladeProjectile.cs +++ b/Projectiles/Rogue/ShinobiBladeProjectile.cs @@ -57,7 +57,7 @@ namespace CalamityMod.Projectiles.Rogue { if (target.life <= 0) { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), 0, 0, Main.myPlayer, 0, 10); + CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], 10, ModContent.ProjectileType(), 1200f, 0f); } } @@ -65,7 +65,7 @@ namespace CalamityMod.Projectiles.Rogue { if (target.statLife <= 0) { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), 0, 0, Main.myPlayer, 0, 10); + CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], 10, ModContent.ProjectileType(), 1200f, 0f); } } diff --git a/Projectiles/Summon/FungalClumpMinion.cs b/Projectiles/Summon/FungalClumpMinion.cs index bfe0d78b96..5eeb251297 100644 --- a/Projectiles/Summon/FungalClumpMinion.cs +++ b/Projectiles/Summon/FungalClumpMinion.cs @@ -90,8 +90,8 @@ namespace CalamityMod.Projectiles.Summon { return; } - float num = (float)damage * 0.25f; - if ((int)num == 0) + float healAmt = (float)damage * 0.25f; + if ((int)healAmt == 0) { return; } @@ -99,9 +99,7 @@ namespace CalamityMod.Projectiles.Summon { return; } - Main.player[Main.myPlayer].lifeSteal -= num; - int num2 = projectile.owner; - Projectile.NewProjectile(target.position.X, target.position.Y, 0f, 0f, ModContent.ProjectileType(), 0, 0f, projectile.owner, (float)num2, num); + CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], healAmt, ModContent.ProjectileType(), 1200f, 1f); } } }