Fixed Illusory Mirror crash. Cleaned up item & projectile code.
This commit is contained in:
@@ -1,4 +1,3 @@
|
|||||||
using FabusMod.Projectiles.IllusoryMirror;
|
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Terraria;
|
using Terraria;
|
||||||
using Terraria.ID;
|
using Terraria.ID;
|
||||||
@@ -19,6 +18,7 @@ public class IllusoryMirror : ModItem
|
|||||||
Item.CloneDefaults(ItemID.ShadowbeamStaff);
|
Item.CloneDefaults(ItemID.ShadowbeamStaff);
|
||||||
Item.damage = 175;
|
Item.damage = 175;
|
||||||
Item.noMelee = true;
|
Item.noMelee = true;
|
||||||
|
Item.DamageType = DamageClass.Magic;
|
||||||
Item.mana = 7;
|
Item.mana = 7;
|
||||||
Item.width = 29;
|
Item.width = 29;
|
||||||
Item.height = 21;
|
Item.height = 21;
|
||||||
@@ -32,7 +32,7 @@ public class IllusoryMirror : ModItem
|
|||||||
Item.expert = true;
|
Item.expert = true;
|
||||||
Item.reuseDelay = 20;
|
Item.reuseDelay = 20;
|
||||||
Item.UseSound = SoundID.Item72;
|
Item.UseSound = SoundID.Item72;
|
||||||
Item.shoot = ModContent.ProjectileType<IllusoryMirrorProj>();
|
Item.shoot = ModContent.ProjectileType<Projectiles.IllusoryMirror.IllusoryMirrorProj>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Vector2? HoldoutOffset()
|
public override Vector2? HoldoutOffset()
|
||||||
@@ -56,7 +56,7 @@ public class IllusoryMirror : ModItem
|
|||||||
Item.shootSpeed = 0f;
|
Item.shootSpeed = 0f;
|
||||||
Item.mana = 50;
|
Item.mana = 50;
|
||||||
player.AddBuff(ModContent.BuffType<Buffs.IllusoryMirror.BlossomActive>(), 1200, true);
|
player.AddBuff(ModContent.BuffType<Buffs.IllusoryMirror.BlossomActive>(), 1200, true);
|
||||||
Item.shoot = ModContent.ProjectileType<IllusoryMirrorRMB>();
|
Item.shoot = ModContent.ProjectileType<Projectiles.IllusoryMirror.IllusoryMirrorRMB>();
|
||||||
Item.UseSound = SoundID.Item76;
|
Item.UseSound = SoundID.Item76;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -66,7 +66,7 @@ public class IllusoryMirror : ModItem
|
|||||||
Item.useAnimation = 20;
|
Item.useAnimation = 20;
|
||||||
Item.shootSpeed = 7f;
|
Item.shootSpeed = 7f;
|
||||||
Item.mana = 7;
|
Item.mana = 7;
|
||||||
Item.shoot = ModContent.ProjectileType<IllusoryMirrorProj>();
|
Item.shoot = ModContent.ProjectileType<Projectiles.IllusoryMirror.IllusoryMirrorProj>();
|
||||||
Item.UseSound = SoundID.Item72;
|
Item.UseSound = SoundID.Item72;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -75,19 +75,19 @@ public class IllusoryMirror : ModItem
|
|||||||
Item.useTime = 5;
|
Item.useTime = 5;
|
||||||
Item.shootSpeed = 7f;
|
Item.shootSpeed = 7f;
|
||||||
Item.mana = 7;
|
Item.mana = 7;
|
||||||
Item.shoot = ModContent.ProjectileType<IllusoryMirrorProj>();
|
Item.shoot = ModContent.ProjectileType<Projectiles.IllusoryMirror.IllusoryMirrorProj>();
|
||||||
Item.UseSound = SoundID.Item72;
|
Item.UseSound = SoundID.Item72;
|
||||||
}
|
}
|
||||||
return this.CanUseItem(player);
|
return base.CanUseItem(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void AddRecipes()
|
public override void AddRecipes()
|
||||||
{
|
{
|
||||||
Recipe val = CreateRecipe();
|
Recipe recipe = CreateRecipe();
|
||||||
val.AddIngredient(ItemID.LifeFruit, 5);
|
recipe.AddIngredient(ItemID.LifeFruit, 5);
|
||||||
val.AddIngredient(ItemID.LifeCrystal, 5);
|
recipe.AddIngredient(ItemID.LifeCrystal, 5);
|
||||||
val.AddIngredient(ItemID.FragmentNebula, 14);
|
recipe.AddIngredient(ItemID.FragmentNebula, 14);
|
||||||
val.AddTile(TileID.LunarCraftingStation);
|
recipe.AddTile(TileID.LunarCraftingStation);
|
||||||
val.Register();
|
recipe.Register();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,8 +5,6 @@ namespace FabusMod.Projectiles.IllusoryMirror;
|
|||||||
|
|
||||||
public class IllusoryMirrorProj : ModProjectile
|
public class IllusoryMirrorProj : ModProjectile
|
||||||
{
|
{
|
||||||
private const int alphaReducation = 50;
|
|
||||||
|
|
||||||
public override void SetDefaults()
|
public override void SetDefaults()
|
||||||
{
|
{
|
||||||
Projectile.width = 2;
|
Projectile.width = 2;
|
||||||
@@ -14,7 +12,7 @@ public class IllusoryMirrorProj : ModProjectile
|
|||||||
Projectile.aiStyle = -1;
|
Projectile.aiStyle = -1;
|
||||||
Projectile.friendly = true;
|
Projectile.friendly = true;
|
||||||
Projectile.hostile = false;
|
Projectile.hostile = false;
|
||||||
Projectile.penetrate = 1;
|
Projectile.penetrate += 1;
|
||||||
Projectile.timeLeft = 600;
|
Projectile.timeLeft = 600;
|
||||||
Projectile.alpha = 255;
|
Projectile.alpha = 255;
|
||||||
Projectile.light = 0.5f;
|
Projectile.light = 0.5f;
|
||||||
@@ -25,25 +23,24 @@ public class IllusoryMirrorProj : ModProjectile
|
|||||||
|
|
||||||
public override void AI()
|
public override void AI()
|
||||||
{
|
{
|
||||||
int num1 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.IllusoryMirrorDust>(), 0f, 0f, 0, default, 1f);
|
int dust1 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.IllusoryMirrorDust>());
|
||||||
Dust obj = Main.dust[num1];
|
Main.dust[dust1].velocity *= 0f;
|
||||||
obj.velocity *= 0f;
|
Main.dust[dust1].noGravity = true;
|
||||||
Main.dust[num1].noGravity = true;
|
|
||||||
int num2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.IllusoryMirrorDust>(), 0f, 0f, 0, default, 1f);
|
int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.IllusoryMirrorDust>());
|
||||||
Dust obj2 = Main.dust[num2];
|
Main.dust[dust2].velocity *= 0f;
|
||||||
obj2.velocity *= 0f;
|
Main.dust[dust2].noGravity = true;
|
||||||
Main.dust[num2].noGravity = true;
|
|
||||||
int num3 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.IllusoryMirrorDust>(), 0f, 0f, 0, default, 1f);
|
int dust3 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.IllusoryMirrorDust>());
|
||||||
Dust obj3 = Main.dust[num3];
|
Main.dust[dust3].velocity *= 0f;
|
||||||
obj3.velocity *= 0f;
|
Main.dust[dust3].noGravity = true;
|
||||||
Main.dust[num3].noGravity = true;
|
|
||||||
int num4 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.IllusoryMirrorDust>(), 0f, 0f, 0, default, 1f);
|
int dust4 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.IllusoryMirrorDust>());
|
||||||
Dust obj4 = Main.dust[num4];
|
Main.dust[dust4].velocity *= 0f;
|
||||||
obj4.velocity *= 0f;
|
Main.dust[dust4].noGravity = true;
|
||||||
Main.dust[num4].noGravity = true;
|
|
||||||
int num5 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.IllusoryMirrorDust>(), 0f, 0f, 0, default, 1f);
|
int dust5 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.IllusoryMirrorDust>());
|
||||||
Dust obj5 = Main.dust[num5];
|
Main.dust[dust5].velocity *= 0f;
|
||||||
obj5.velocity *= 0f;
|
Main.dust[dust5].noGravity = true;
|
||||||
Main.dust[num5].noGravity = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,16 +31,17 @@ public class IllusoryMirrorRMB : ModProjectile
|
|||||||
AnimateProjectile();
|
AnimateProjectile();
|
||||||
if (Main.rand.NextBool(2))
|
if (Main.rand.NextBool(2))
|
||||||
{
|
{
|
||||||
int num1 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.HealingDust>(), 0f, 0f, 0, default, 1f);
|
int dust1 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.HealingDust>());
|
||||||
Main.dust[num1].scale = 2f;
|
Main.dust[dust1].scale = 2f;
|
||||||
Main.dust[num1].velocity.Y -= 0.5f;
|
Main.dust[dust1].velocity.Y -= 0.5f;
|
||||||
Main.dust[num1].velocity.X = 0f;
|
Main.dust[dust1].velocity.X = 0f;
|
||||||
Main.dust[num1].noGravity = true;
|
Main.dust[dust1].noGravity = true;
|
||||||
int num2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.IllusoryMirrorRMBDust>(), 0f, 0f, 0, default, 1f);
|
|
||||||
Main.dust[num2].scale = 2f;
|
int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.IllusoryMirrorRMBDust>());
|
||||||
Main.dust[num2].velocity.Y += 0.5f;
|
Main.dust[dust2].scale = 2f;
|
||||||
Main.dust[num2].velocity.X = 0f;
|
Main.dust[dust2].velocity.Y += 0.5f;
|
||||||
Main.dust[num2].noGravity = true;
|
Main.dust[dust2].velocity.X = 0f;
|
||||||
|
Main.dust[dust2].noGravity = true;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < 255; i++)
|
for (int i = 0; i < 255; i++)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user