changed some projectiles to use the new spawn life steal projectile method

This commit is contained in:
termigator1359 committed 2020-04-29 15:12:15 -04:00
1 parent 3de6fc8337
commit 077fa6f8e7
15 files changed
+41 -159

No files matched your search

+4 -3
View File
@@ -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<RoyalKnifeMelee>();
item.shoot = ModContent.ProjectileType<IllustriousKnife>();
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<RoyalKnifeMelee>(), 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;
}
+2 -2
View File
@@ -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<IllustriousKnife>(), damage, knockBack, player.whoAmI, 0f, 0f);
Projectile.NewProjectile(x4, y4, num148, num149, type, damage, knockBack, player.whoAmI, 0f, 0f);
}
return false;
}
+2 -6
View File
@@ -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);
}
}
}
+2 -6
View File
@@ -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);
}
}
}
+9 -13
View File
@@ -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)
@@ -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<RoyalHeal>(), 0, 0f, projectile.owner, (float)num2, num);
CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], healAmt, ModContent.ProjectileType<RoyalHeal>(), 1200f, 1.5f);
}
public override void OnHitPvp(Player target, int damage, bool crit)
{
target.AddBuff(ModContent.BuffType<HolyFlames>(), 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<RoyalHeal>(), 0, 0f, projectile.owner, (float)num2, num);
CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], healAmt, ModContent.ProjectileType<RoyalHeal>(), 1200f, 1.5f);
}
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
File renamed without changes.

Before

Width:  |  Height:  |  Size: 253 B

After

Width:  |  Height:  |  Size: 253 B

+3 -5
View File
@@ -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<EarthHealOrb>(), 0, 0f, projectile.owner, (float)num2, num);
CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], healAmt, ModContent.ProjectileType<EarthHealOrb>(), 1200f, 1.5f);
}
}
}
+1 -1
View File
@@ -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<EssenceFlame>(), 0, 0, projectile.owner, 0f, 0f);
CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], 8, ModContent.ProjectileType<EssenceFlame>(), 1200f, 0f);
}
}
}
+3 -5
View File
@@ -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<Exoheal>(), 0, 0f, projectile.owner, (float)num2, num);
CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], healAmt, ModContent.ProjectileType<Exoheal>(), 1200f, 1f);
}
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
-95
View File
@@ -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<HolyFlames>(), 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<RoyalHeal>(), 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;
}
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 253 B

+3 -5
View File
@@ -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<TransfusionTrail>(), 0, 0f, projectile.owner, (float)num2, num);
CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], healAmt, ModContent.ProjectileType<TransfusionTrail>(), 1200f, 1.5f);
}
}
}
+2 -2
View File
@@ -57,7 +57,7 @@ namespace CalamityMod.Projectiles.Rogue
{
if (target.life <= 0)
{
Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType<ShinobiHealOrb>(), 0, 0, Main.myPlayer, 0, 10);
CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], 10, ModContent.ProjectileType<ShinobiHealOrb>(), 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<ShinobiHealOrb>(), 0, 0, Main.myPlayer, 0, 10);
CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], 10, ModContent.ProjectileType<ShinobiHealOrb>(), 1200f, 0f);
}
}
+3 -5
View File
@@ -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<FungalHeal>(), 0, 0f, projectile.owner, (float)num2, num);
CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], healAmt, ModContent.ProjectileType<FungalHeal>(), 1200f, 1f);
}
}
}