Fixed crashes for ranged weapons.

Optimized code.
This commit is contained in:
Big Duckie
2022-07-05 16:08:31 -06:00
parent 8f5ec80722
commit eb2cb27e79
51 changed files with 513 additions and 501 deletions
+9 -8
View File
@@ -18,6 +18,7 @@ public class LunarBow : ModItem
public override void SetDefaults()
{
Item.damage = 240;
Item.DamageType = DamageClass.Ranged;
Item.width = 27;
Item.height = 69;
Item.useTime = 9;
@@ -33,8 +34,8 @@ public class LunarBow : ModItem
Item.shoot = ModContent.ProjectileType<LunarBolt>();
}
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
{
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
{
if (player.altFunctionUse == 2)
{
if (!player.HasBuff(ModContent.BuffType<Buffs.LunarBow.ShatteredMoonsCurse>()) && player.statLife < player.statLifeMax2)
@@ -62,11 +63,11 @@ public class LunarBow : ModItem
public override void AddRecipes()
{
Recipe val = CreateRecipe();
val.AddIngredient(ItemID.LifeFruit, 5);
val.AddIngredient(ItemID.LifeCrystal, 5);
val.AddIngredient(ItemID.FragmentVortex, 14);
val.AddTile(TileID.LunarCraftingStation);
val.Register();
CreateRecipe()
.AddIngredient(ItemID.LifeFruit, 5)
.AddIngredient(ItemID.LifeCrystal, 5)
.AddIngredient(ItemID.FragmentVortex, 14)
.AddTile(TileID.LunarCraftingStation)
.Register();
}
}