Fixed up some old stealth strike code

This commit is contained in:
Dominic committed 2020-12-12 22:31:45 -06:00
1 parent 9155554016
commit fc2c262761
6 files changed
+29 -11

No files matched your search

+9
View File
@@ -2,6 +2,7 @@ using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using CalamityMod.Projectiles.Rogue;
using Microsoft.Xna.Framework;
namespace CalamityMod.Items.Weapons.Rogue
{
@@ -34,5 +35,13 @@ namespace CalamityMod.Items.Weapons.Rogue
item.shootSpeed = 15f;
item.Calamity().rogue = true;
}
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
{
int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI);
if (Main.projectile.IndexInRange(proj))
Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable();
return false;
}
}
}
+9
View File
@@ -3,6 +3,7 @@ using Terraria.ID;
using Terraria.ModLoader;
using CalamityMod.Items.Materials;
using CalamityMod.Projectiles.Rogue;
using Microsoft.Xna.Framework;
namespace CalamityMod.Items.Weapons.Rogue
{
@@ -37,6 +38,14 @@ namespace CalamityMod.Items.Weapons.Rogue
item.Calamity().rogue = true;
}
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
{
int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI);
if (Main.projectile.IndexInRange(proj))
Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable();
return false;
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
+9
View File
@@ -1,6 +1,7 @@
using CalamityMod.Items.Materials;
using CalamityMod.Projectiles.Rogue;
using CalamityMod.Tiles.Furniture.CraftingStations;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
@@ -39,6 +40,14 @@ namespace CalamityMod.Items.Weapons.Rogue
item.Calamity().customRarity = CalamityRarity.ItemSpecific;
}
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
{
int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI);
if (Main.projectile.IndexInRange(proj))
Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable();
return false;
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
+1 -6
View File
@@ -43,18 +43,13 @@ namespace CalamityMod.Projectiles.Rogue
projectile.velocity.Y *= 0.99f;
}
projectile.ai[0] += 1f;
if(projectile.ai[0] == 1f && modPlayer.StealthStrikeAvailable())
{
stealthBubbles = true;
projectile.Calamity().stealthStrike = true;
}
if (projectile.ai[0] == 5f)
projectile.tileCollide = true;
if ((projectile.ai[0] % 15f) == 0f && rotationAmount > 0)
{
rotationAmount -= 0.05f;
if(stealthBubbles == true && projectile.owner == Main.myPlayer)
if (modPlayer.StealthStrikeAvailable() && projectile.owner == Main.myPlayer)
{
float velocityX = Main.rand.NextFloat(-0.8f, 0.8f);
float velocityY = Main.rand.NextFloat(-0.8f, -0.8f);
+1 -3
View File
@@ -31,10 +31,8 @@ namespace CalamityMod.Projectiles.Rogue
public override void AI()
{
CalamityPlayer modPlayer = Main.player[projectile.owner].Calamity();
if (projectile.ai[0] == 0f && modPlayer.StealthStrikeAvailable())
if (projectile.ai[0] == 0f && projectile.Calamity().stealthStrike)
{
projectile.Calamity().stealthStrike = true;
projectile.timeLeft = 600;
projectile.ai[0] = 1f;
}
@@ -48,8 +48,6 @@ namespace CalamityMod.Projectiles.Rogue
}
ShootTimer++;
if (ShootTimer == 1f && modPlayer.StealthStrikeAvailable())
projectile.Calamity().stealthStrike = true;
if (!projectile.Calamity().stealthStrike && projectile.oldPos.Length != 6)
projectile.oldPos = new Vector2[6];