Commit of decompiled and "updated" code.

This commit is contained in:
Big Duckie
2022-07-03 14:13:26 -06:00
parent 3d34e53842
commit e1441e74a5
731 changed files with 18423 additions and 0 deletions
+42
View File
@@ -0,0 +1,42 @@
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
namespace FabusMod.Projectiles.Arrows;
public class DemonArrow : ModProjectile
{
public override void SetDefaults()
{
Projectile.width = 10;
Projectile.height = 10;
Projectile.friendly = true;
Projectile.tileCollide = true;
Projectile.ignoreWater = false;
Projectile.timeLeft = 1000;
Projectile.light = 1f;
Projectile.penetrate = 1;
AIType = 1;
Projectile.aiStyle = 1;
}
public override void AI()
{
if (Utils.NextFloat(Main.rand) < 0.1f && Projectile.alpha <= 100)
{
int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.RyuuDust3>(), 0f, 0f, 0, default, 1f);
Dust obj = Main.dust[dust];
obj.velocity /= 2f;
}
}
public override void Kill(int timeLeft)
{
for (int i = 0; i < 5; i++)
{
Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, ModContent.DustType<Dusts.RyuuDust3>(), Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f, 0, default, 1f);
}
SoundEngine.PlaySound(SoundID.Item2, Projectile.position);
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 337 B

+42
View File
@@ -0,0 +1,42 @@
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
namespace FabusMod.Projectiles.Arrows;
public class GoldenSpiritArrow : ModProjectile
{
public override void SetDefaults()
{
Projectile.width = 10;
Projectile.height = 10;
Projectile.friendly = true;
Projectile.tileCollide = true;
Projectile.ignoreWater = false;
Projectile.timeLeft = 1000;
Projectile.light = 1f;
Projectile.penetrate = 1;
AIType = 1;
Projectile.aiStyle = 1;
}
public override void AI()
{
if (Utils.NextFloat(Main.rand) < 0.1f && Projectile.alpha <= 100)
{
int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.MeatDust>(), 0f, 0f, 0, default, 1f);
Dust obj = Main.dust[dust];
obj.velocity /= 2f;
}
}
public override void Kill(int timeLeft)
{
for (int i = 0; i < 5; i++)
{
Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, ModContent.DustType<Dusts.MeatDust>(), Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f, 0, default, 1f);
}
SoundEngine.PlaySound(SoundID.Item1, Projectile.position);
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 335 B

+55
View File
@@ -0,0 +1,55 @@
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
namespace FabusMod.Projectiles.Arrows;
public class LegendaryArrow : ModProjectile
{
public override void SetDefaults()
{
Projectile.width = 18;
Projectile.height = 34;
Projectile.friendly = true;
Projectile.tileCollide = true;
Projectile.ignoreWater = false;
Projectile.timeLeft = 1000;
Projectile.light = 1f;
AIType = 1;
Projectile.aiStyle = 1;
}
public override void AI()
{
if (Utils.NextFloat(Main.rand) < 0.1f && Projectile.alpha <= 100)
{
int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.LegendaryDust>(), 0f, 0f, 0, default, 1f);
Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.LegendarySparkle>(), 0f, 0f, 0, default, 1f);
Dust obj = Main.dust[dust];
obj.velocity /= 2f;
}
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
if (Main.rand.NextBool(1))
{
target.AddBuff(69, 900, false);
target.AddBuff(70, 900, false);
}
}
public override void Kill(int timeLeft)
{
for (int i = 0; i < 5; i++)
{
Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, ModContent.DustType<Dusts.LegendaryDust>(), Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f, 0, default, 1f);
}
for (int j = 0; j < 5; j++)
{
Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, ModContent.DustType<Dusts.LegendarySparkle>(), Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f, 0, default, 1f);
}
SoundEngine.PlaySound(SoundID.Item1, Projectile.position);
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 392 B

+29
View File
@@ -0,0 +1,29 @@
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
namespace FabusMod.Projectiles.Arrows;
public class PiercingArrow : ModProjectile
{
public override void SetDefaults()
{
Projectile.width = 14;
Projectile.height = 40;
Projectile.friendly = true;
Projectile.tileCollide = true;
Projectile.ignoreWater = false;
Projectile.timeLeft = 1000;
Projectile.light = 1f;
Projectile.penetrate = -1;
AIType = 1;
Projectile.aiStyle = 1;
}
public override void Kill(int timeLeft)
{
SoundEngine.PlaySound(SoundID.Dig, Projectile.position);
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 378 B

+80
View File
@@ -0,0 +1,80 @@
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
namespace FabusMod.Projectiles.Arrows;
public class RainbowArrow : ModProjectile
{
public override void SetDefaults()
{
Projectile.width = 10;
Projectile.height = 10;
Projectile.friendly = true;
Projectile.tileCollide = true;
Projectile.ignoreWater = false;
Projectile.timeLeft = 1000;
Projectile.light = 1f;
AIType = 1;
Projectile.aiStyle = 1;
}
public override void AI()
{
if (Utils.NextFloat(Main.rand) < 0.1f && Projectile.alpha <= 100)
{
int dust1 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.RainbowDust>(), 0f, 0f, 0, default, 1f);
int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.RainbowDust2>(), 0f, 0f, 0, default, 1f);
int dust3 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.RainbowDust3>(), 0f, 0f, 0, default, 1f);
Main.dust[dust1].scale = 0.9f;
Dust obj = Main.dust[dust1];
obj.velocity *= 0.1f;
Main.dust[dust1].noGravity = true;
Main.dust[dust2].scale = 0.9f;
Dust obj2 = Main.dust[dust2];
obj2.velocity *= 0.1f;
Main.dust[dust2].noGravity = true;
Main.dust[dust3].scale = 0.9f;
Dust obj3 = Main.dust[dust3];
obj3.velocity *= 0.1f;
Main.dust[dust3].noGravity = true;
}
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
if (Main.rand.NextBool(1))
{
target.AddBuff(69, 900, false);
target.AddBuff(70, 900, false);
}
}
public override void Kill(int timeLeft)
{
for (int i = 0; i < 5; i++)
{
if (Utils.NextFloat(Main.rand) < 0.1f && Projectile.alpha <= 100)
{
int dust1 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.RainbowDust>(), 0f, 0f, 0, default, 1f);
int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.RainbowDust2>(), 0f, 0f, 0, default, 1f);
int dust3 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.RainbowDust3>(), 0f, 0f, 0, default, 1f);
Main.dust[dust1].scale = 0.9f;
Dust obj = Main.dust[dust1];
obj.velocity *= 0.1f;
Main.dust[dust1].noGravity = true;
Main.dust[dust2].scale = 0.9f;
Dust obj2 = Main.dust[dust2];
obj2.velocity *= 0.1f;
Main.dust[dust2].noGravity = true;
Main.dust[dust3].scale = 0.9f;
Dust obj3 = Main.dust[dust3];
obj3.velocity *= 0.1f;
Main.dust[dust3].noGravity = true;
}
}
SoundEngine.PlaySound(SoundID.Item1, Projectile.position);
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 583 B

+42
View File
@@ -0,0 +1,42 @@
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
namespace FabusMod.Projectiles.Arrows;
public class StormArrow : ModProjectile
{
public override void SetDefaults()
{
Projectile.width = 10;
Projectile.height = 10;
Projectile.friendly = true;
Projectile.tileCollide = true;
Projectile.ignoreWater = false;
Projectile.timeLeft = 1000;
Projectile.light = 1f;
Projectile.penetrate = 1;
AIType = 1;
Projectile.aiStyle = 1;
}
public override void AI()
{
if (Utils.NextFloat(Main.rand) < 0.1f && Projectile.alpha <= 100)
{
int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.RyuuDust2>(), 0f, 0f, 0, default, 1f);
Dust obj = Main.dust[dust];
obj.velocity /= 2f;
}
}
public override void Kill(int timeLeft)
{
for (int i = 0; i < 5; i++)
{
Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, ModContent.DustType<Dusts.RyuuDust2>(), Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f, 0, default, 1f);
}
SoundEngine.PlaySound(SoundID.Item1, Projectile.position);
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 334 B

+81
View File
@@ -0,0 +1,81 @@
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
using Terraria.ModLoader;
using Terraria.ID;
namespace FabusMod.Projectiles.Daggers;
public class ColorfulSolution : ModProjectile
{
private const float maxTicks = 70f;
private const int alphaReducation = 25;
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Colorful Solution");
}
public override void SetDefaults()
{
Projectile.width = 16;
Projectile.height = 34;
Projectile.aiStyle = 2;
Projectile.friendly = true;
Projectile.penetrate = 1;
AIType = 48;
}
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
{
if (targetHitbox.Width > 8 && targetHitbox.Height > 8)
{
targetHitbox.Inflate(-targetHitbox.Width / 8, -targetHitbox.Height / 8);
}
return projHitbox.Intersects(targetHitbox);
}
public override void Kill(int timeLeft)
{
SoundEngine.PlaySound(SoundID.Dig, Projectile.position);
Vector2 position = Projectile.position;
Vector2 rotVector = Utils.ToRotationVector2(Projectile.rotation - MathHelper.ToRadians(90f));
_ = position + rotVector * 16f;
int item = 0;
if (Main.netMode == NetmodeID.MultiplayerClient && item >= 0)
{
NetMessage.SendData(MessageID.KillProjectile, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0);
}
}
public override void AI()
{
if (Utils.NextFloat(Main.rand) < 0.1f && Projectile.alpha <= 100)
{
int dust1 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.RainbowDust>(), 0f, 0f, 0, default, 1f);
int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.RainbowDust2>(), 0f, 0f, 0, default, 1f);
int dust3 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.RainbowDust3>(), 0f, 0f, 0, default, 1f);
Main.dust[dust1].scale = 0.9f;
Dust obj = Main.dust[dust1];
obj.velocity *= 0.1f;
Main.dust[dust1].noGravity = true;
Main.dust[dust2].scale = 0.9f;
Dust obj2 = Main.dust[dust2];
obj2.velocity *= 0.1f;
Main.dust[dust2].noGravity = true;
Main.dust[dust3].scale = 0.9f;
Dust obj3 = Main.dust[dust3];
obj3.velocity *= 0.1f;
Main.dust[dust3].noGravity = true;
}
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
if (Main.rand.NextBool(1))
{
target.AddBuff(70, 720, false);
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 508 B

+53
View File
@@ -0,0 +1,53 @@
using Terraria;
using Terraria.ModLoader;
namespace FabusMod.Projectiles.FoxPistol;
public class BlueBolt : ModProjectile
{
public override void SetDefaults()
{
Projectile.width = 16;
Projectile.height = 16;
Projectile.aiStyle = 1;
Projectile.friendly = true;
Projectile.hostile = false;
Projectile.penetrate = 1;
Projectile.timeLeft = 600;
Projectile.alpha = 255;
Projectile.light = 0.5f;
Projectile.ignoreWater = false;
Projectile.tileCollide = true;
Projectile.extraUpdates = 2;
AIType = 14;
}
public override void AI()
{
Projectile.velocity.Y += Projectile.ai[0];
if (Utils.NextFloat(Main.rand) < 0.1f && Projectile.alpha <= 100)
{
int dust1 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.FoxDustBlue>(), 0f, 0f, 0, default, 1f);
Main.dust[dust1].scale = 0.9f;
Dust obj = Main.dust[dust1];
obj.velocity *= 0.5f;
Main.dust[dust1].noGravity = true;
}
}
public override void Kill(int timeLeft)
{
for (int i = 0; i < 5; i++)
{
if (Utils.NextFloat(Main.rand) < 0.1f && Projectile.alpha <= 100)
{
int dust1 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.FoxDustBlue>(), 0f, 0f, 0, default, 1f);
Main.dust[dust1].scale = 0.9f;
Dust obj = Main.dust[dust1];
obj.velocity *= 0.5f;
Main.dust[dust1].noGravity = true;
}
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 431 B

+68
View File
@@ -0,0 +1,68 @@
using Terraria;
using Terraria.ModLoader;
namespace FabusMod.Projectiles.FoxPistol;
public class BlueBoltRMB : ModProjectile
{
public override void SetDefaults()
{
Projectile.width = 16;
Projectile.height = 16;
Projectile.aiStyle = 1;
Projectile.friendly = true;
Projectile.hostile = false;
Projectile.penetrate = 1;
Projectile.timeLeft = 600;
Projectile.alpha = 255;
Projectile.light = 0.5f;
Projectile.ignoreWater = false;
Projectile.tileCollide = true;
Projectile.extraUpdates = 2;
AIType = 14;
}
public override void AI()
{
Projectile.velocity.Y += Projectile.ai[0];
if (Utils.NextFloat(Main.rand) < 0.1f && Projectile.alpha <= 100)
{
int dust1 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.FoxDustBlue>(), 0f, 0f, 0, default, 1f);
int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.FoxWitherDust>(), 0f, 0f, 0, default, 1f);
Main.dust[dust1].scale = 1f;
Dust obj = Main.dust[dust1];
obj.velocity *= 0.5f;
Main.dust[dust1].noGravity = true;
Main.dust[dust2].scale = 0.8f;
Dust obj2 = Main.dust[dust2];
obj2.velocity *= 0.5f;
Main.dust[dust2].noGravity = true;
}
}
public override void Kill(int timeLeft)
{
for (int i = 0; i < 5; i++)
{
if (Utils.NextFloat(Main.rand) < 0.1f && Projectile.alpha <= 100)
{
int dust1 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.FoxDustBlue>(), 0f, 0f, 0, default, 1f);
int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.FoxWitherDust>(), 0f, 0f, 0, default, 1f);
Main.dust[dust1].scale = 1f;
Dust obj = Main.dust[dust1];
obj.velocity *= 0.5f;
Main.dust[dust1].noGravity = true;
Main.dust[dust2].scale = 0.8f;
Dust obj2 = Main.dust[dust2];
obj2.velocity *= 0.5f;
Main.dust[dust2].noGravity = true;
}
}
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
target.AddBuff(ModContent.BuffType<Buffs.FoxPistol.FoxWither>(), 240, false);
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 415 B

+53
View File
@@ -0,0 +1,53 @@
using Terraria;
using Terraria.ModLoader;
namespace FabusMod.Projectiles.FoxPistol;
public class OrangeBolt : ModProjectile
{
public override void SetDefaults()
{
Projectile.width = 16;
Projectile.height = 16;
Projectile.aiStyle = 1;
Projectile.friendly = true;
Projectile.hostile = false;
Projectile.penetrate = 1;
Projectile.timeLeft = 600;
Projectile.alpha = 255;
Projectile.light = 0.5f;
Projectile.ignoreWater = false;
Projectile.tileCollide = true;
Projectile.extraUpdates = 2;
AIType = 14;
}
public override void AI()
{
Projectile.velocity.Y += Projectile.ai[0];
if (Utils.NextFloat(Main.rand) < 0.1f && Projectile.alpha <= 100)
{
int dust1 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.FoxDust>(), 0f, 0f, 0, default, 1f);
Main.dust[dust1].scale = 0.9f;
Dust obj = Main.dust[dust1];
obj.velocity *= 0.5f;
Main.dust[dust1].noGravity = true;
}
}
public override void Kill(int timeLeft)
{
for (int i = 0; i < 5; i++)
{
if (Utils.NextFloat(Main.rand) < 0.1f && Projectile.alpha <= 100)
{
int dust1 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.FoxDust>(), 0f, 0f, 0, default, 1f);
Main.dust[dust1].scale = 0.9f;
Dust obj = Main.dust[dust1];
obj.velocity *= 0.5f;
Main.dust[dust1].noGravity = true;
}
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 436 B

+68
View File
@@ -0,0 +1,68 @@
using Terraria;
using Terraria.ModLoader;
namespace FabusMod.Projectiles.FoxPistol;
public class OrangeBoltRMB : ModProjectile
{
public override void SetDefaults()
{
Projectile.width = 16;
Projectile.height = 16;
Projectile.aiStyle = 1;
Projectile.friendly = true;
Projectile.hostile = false;
Projectile.penetrate = 1;
Projectile.timeLeft = 600;
Projectile.alpha = 255;
Projectile.light = 0.5f;
Projectile.ignoreWater = false;
Projectile.tileCollide = true;
Projectile.extraUpdates = 2;
AIType = 14;
}
public override void AI()
{
Projectile.velocity.Y += Projectile.ai[0];
if (Utils.NextFloat(Main.rand) < 0.1f && Projectile.alpha <= 100)
{
int dust1 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.FoxDust>(), 0f, 0f, 0, default, 1f);
int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.FoxWitherDust>(), 0f, 0f, 0, default, 1f);
Main.dust[dust1].scale = 1f;
Dust obj = Main.dust[dust1];
obj.velocity *= 0.5f;
Main.dust[dust1].noGravity = true;
Main.dust[dust2].scale = 0.8f;
Dust obj2 = Main.dust[dust2];
obj2.velocity *= 0.5f;
Main.dust[dust2].noGravity = true;
}
}
public override void Kill(int timeLeft)
{
for (int i = 0; i < 5; i++)
{
if (Utils.NextFloat(Main.rand) < 0.1f && Projectile.alpha <= 100)
{
int dust1 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.FoxDust>(), 0f, 0f, 0, default, 1f);
int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.FoxWitherDust>(), 0f, 0f, 0, default, 1f);
Main.dust[dust1].scale = 1f;
Dust obj = Main.dust[dust1];
obj.velocity *= 0.5f;
Main.dust[dust1].noGravity = true;
Main.dust[dust2].scale = 0.8f;
Dust obj2 = Main.dust[dust2];
obj2.velocity *= 0.5f;
Main.dust[dust2].noGravity = true;
}
}
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
target.AddBuff(ModContent.BuffType<Buffs.FoxPistol.FoxWither>(), 240, false);
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 415 B

+73
View File
@@ -0,0 +1,73 @@
using Terraria;
using Terraria.ModLoader;
namespace FabusMod.Projectiles.FoxPistol;
public class RainbowBolt : ModProjectile
{
public override void SetDefaults()
{
Projectile.width = 16;
Projectile.height = 16;
Projectile.aiStyle = 1;
Projectile.friendly = true;
Projectile.hostile = false;
Projectile.penetrate = 1;
Projectile.timeLeft = 600;
Projectile.alpha = 255;
Projectile.light = 0.5f;
Projectile.ignoreWater = false;
Projectile.tileCollide = true;
Projectile.extraUpdates = 2;
AIType = 14;
}
public override void AI()
{
Projectile.velocity.Y += Projectile.ai[0];
if (Utils.NextFloat(Main.rand) < 0.1f && Projectile.alpha <= 100)
{
int dust1 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.RainbowDust>(), 0f, 0f, 0, default, 1f);
int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.RainbowDust2>(), 0f, 0f, 0, default, 1f);
int dust3 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.RainbowDust3>(), 0f, 0f, 0, default, 1f);
Main.dust[dust1].scale = 0.9f;
Dust obj = Main.dust[dust1];
obj.velocity *= 0.1f;
Main.dust[dust1].noGravity = true;
Main.dust[dust2].scale = 0.9f;
Dust obj2 = Main.dust[dust2];
obj2.velocity *= 0.1f;
Main.dust[dust2].noGravity = true;
Main.dust[dust3].scale = 0.9f;
Dust obj3 = Main.dust[dust3];
obj3.velocity *= 0.1f;
Main.dust[dust3].noGravity = true;
}
}
public override void Kill(int timeLeft)
{
for (int i = 0; i < 5; i++)
{
if (Utils.NextFloat(Main.rand) < 0.1f && Projectile.alpha <= 100)
{
int dust1 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.RainbowDust>(), 0f, 0f, 0, default, 1f);
int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.RainbowDust2>(), 0f, 0f, 0, default, 1f);
int dust3 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.RainbowDust3>(), 0f, 0f, 0, default, 1f);
Main.dust[dust1].scale = 0.9f;
Dust obj = Main.dust[dust1];
obj.velocity *= 0.1f;
Main.dust[dust1].noGravity = true;
Main.dust[dust2].scale = 0.9f;
Dust obj2 = Main.dust[dust2];
obj2.velocity *= 0.1f;
Main.dust[dust2].noGravity = true;
Main.dust[dust3].scale = 0.9f;
Dust obj3 = Main.dust[dust3];
obj3.velocity *= 0.1f;
Main.dust[dust3].noGravity = true;
}
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 646 B

+88
View File
@@ -0,0 +1,88 @@
using Terraria;
using Terraria.ModLoader;
namespace FabusMod.Projectiles.FoxPistol;
public class RainbowBoltRMB : ModProjectile
{
public override void SetDefaults()
{
Projectile.width = 16;
Projectile.height = 16;
Projectile.aiStyle = 1;
Projectile.friendly = true;
Projectile.hostile = false;
Projectile.penetrate = 1;
Projectile.timeLeft = 600;
Projectile.alpha = 255;
Projectile.light = 0.5f;
Projectile.ignoreWater = false;
Projectile.tileCollide = true;
Projectile.extraUpdates = 2;
AIType = 14;
}
public override void AI()
{
Projectile.velocity.Y += Projectile.ai[0];
if (Utils.NextFloat(Main.rand) < 0.1f && Projectile.alpha <= 100)
{
int dust1 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.RainbowDust>(), 0f, 0f, 0, default, 1f);
int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.RainbowDust2>(), 0f, 0f, 0, default, 1f);
int dust3 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.RainbowDust3>(), 0f, 0f, 0, default, 1f);
int dust4 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.SpectralWitherDust>(), 0f, 0f, 0, default, 1f);
Main.dust[dust1].scale = 0.9f;
Dust obj = Main.dust[dust1];
obj.velocity *= 0.1f;
Main.dust[dust1].noGravity = true;
Main.dust[dust2].scale = 0.9f;
Dust obj2 = Main.dust[dust2];
obj2.velocity *= 0.1f;
Main.dust[dust2].noGravity = true;
Main.dust[dust3].scale = 0.9f;
Dust obj3 = Main.dust[dust3];
obj3.velocity *= 0.1f;
Main.dust[dust3].noGravity = true;
Main.dust[dust4].scale = 0.7f;
Dust obj4 = Main.dust[dust4];
obj4.velocity *= 0.1f;
Main.dust[dust4].noGravity = true;
}
}
public override void Kill(int timeLeft)
{
for (int i = 0; i < 5; i++)
{
if (Utils.NextFloat(Main.rand) < 0.1f && Projectile.alpha <= 100)
{
int dust1 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.RainbowDust>(), 0f, 0f, 0, default, 1f);
int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.RainbowDust2>(), 0f, 0f, 0, default, 1f);
int dust3 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.RainbowDust3>(), 0f, 0f, 0, default, 1f);
int dust4 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.SpectralWitherDust>(), 0f, 0f, 0, default, 1f);
Main.dust[dust1].scale = 0.9f;
Dust obj = Main.dust[dust1];
obj.velocity *= 0.1f;
Main.dust[dust1].noGravity = true;
Main.dust[dust2].scale = 0.9f;
Dust obj2 = Main.dust[dust2];
obj2.velocity *= 0.1f;
Main.dust[dust2].noGravity = true;
Main.dust[dust3].scale = 0.9f;
Dust obj3 = Main.dust[dust3];
obj3.velocity *= 0.1f;
Main.dust[dust3].noGravity = true;
Main.dust[dust4].scale = 0.7f;
Dust obj4 = Main.dust[dust4];
obj4.velocity *= 0.1f;
Main.dust[dust4].noGravity = true;
}
}
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
target.AddBuff(ModContent.BuffType<Buffs.RainbowsWrath>(), 480, false);
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 648 B

+99
View File
@@ -0,0 +1,99 @@
using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ModLoader;
namespace FabusMod.Projectiles;
public class GoldenOrb : ModProjectile
{
public override void SetStaticDefaults()
{
//Sets.Homing[Projectile.type] = true;
Main.projFrames[Projectile.type] = 4;
}
public override void SetDefaults()
{
Projectile.width = 40;
Projectile.height = 42;
Projectile.alpha = 255;
Projectile.friendly = true;
Projectile.tileCollide = false;
Projectile.ignoreWater = true;
Projectile.timeLeft = 300;
}
public override void AI()
{
if (Projectile.alpha > 70)
{
Projectile projectile = Projectile;
projectile.alpha -= 15;
if (Projectile.alpha < 70)
{
Projectile.alpha = 70;
}
}
if (Projectile.localAI[0] == 0f)
{
AdjustMagnitude(ref Projectile.velocity);
Projectile.localAI[0] = 1f;
}
Vector2 move = Vector2.Zero;
float distance = 400f;
bool target = false;
for (int i = 0; i < 200; i++)
{
if (Main.npc[i].active && !Main.npc[i].dontTakeDamage && !Main.npc[i].friendly && Main.npc[i].lifeMax > 5)
{
Vector2 newMove = ((Entity)Main.npc[i]).Center - Projectile.Center;
float distanceTo = (float)Math.Sqrt(newMove.X * newMove.X + newMove.Y * newMove.Y);
if (distanceTo < distance)
{
move = newMove;
distance = distanceTo;
target = true;
}
}
}
if (target)
{
AdjustMagnitude(ref move);
Projectile.velocity = (10f * Projectile.velocity + move) / 11f;
AdjustMagnitude(ref Projectile.velocity);
}
if (Utils.NextFloat(Main.rand) < 0.1f && Projectile.alpha <= 100)
{
int dust1 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.MeatDust>(), 0f, 0f, 0, default, 1f);
Main.dust[dust1].scale = 0.9f;
Dust obj = Main.dust[dust1];
obj.velocity *= 0.1f;
Main.dust[dust1].noGravity = true;
}
AnimateProjectile();
}
private void AdjustMagnitude(ref Vector2 vector)
{
float magnitude = (float)Math.Sqrt(vector.X * vector.X + vector.Y * vector.Y);
if (magnitude > 6f)
{
vector *= 6f / magnitude;
}
}
public void AnimateProjectile()
{
Projectile projectile = Projectile;
projectile.frameCounter++;
if (Projectile.frameCounter >= 5)
{
Projectile projectile2 = Projectile;
projectile2.frame++;
Projectile projectile3 = Projectile;
projectile3.frame %= 3;
Projectile.frameCounter = 0;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

@@ -0,0 +1,49 @@
using Terraria;
using Terraria.ModLoader;
namespace FabusMod.Projectiles.IllusoryMirror;
public class IllusoryMirrorProj : ModProjectile
{
private const int alphaReducation = 50;
public override void SetDefaults()
{
Projectile.width = 2;
Projectile.height = 20;
Projectile.aiStyle = -1;
Projectile.friendly = true;
Projectile.hostile = false;
Projectile.penetrate = 1;
Projectile.timeLeft = 600;
Projectile.alpha = 255;
Projectile.light = 0.5f;
Projectile.ignoreWater = false;
Projectile.tileCollide = true;
Projectile.extraUpdates = 100;
}
public override void AI()
{
int num1 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.IllusoryMirrorDust>(), 0f, 0f, 0, default, 1f);
Dust obj = Main.dust[num1];
obj.velocity *= 0f;
Main.dust[num1].noGravity = true;
int num2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.IllusoryMirrorDust>(), 0f, 0f, 0, default, 1f);
Dust obj2 = Main.dust[num2];
obj2.velocity *= 0f;
Main.dust[num2].noGravity = true;
int num3 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.IllusoryMirrorDust>(), 0f, 0f, 0, default, 1f);
Dust obj3 = Main.dust[num3];
obj3.velocity *= 0f;
Main.dust[num3].noGravity = true;
int num4 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.IllusoryMirrorDust>(), 0f, 0f, 0, default, 1f);
Dust obj4 = Main.dust[num4];
obj4.velocity *= 0f;
Main.dust[num4].noGravity = true;
int num5 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.IllusoryMirrorDust>(), 0f, 0f, 0, default, 1f);
Dust obj5 = Main.dust[num5];
obj5.velocity *= 0f;
Main.dust[num5].noGravity = true;
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 148 B

@@ -0,0 +1,68 @@
using Terraria;
using Terraria.ModLoader;
namespace FabusMod.Projectiles.IllusoryMirror;
public class IllusoryMirrorRMB : ModProjectile
{
public override void SetStaticDefaults()
{
Main.projFrames[Projectile.type] = 6;
}
public override void SetDefaults()
{
Projectile.width = 400;
Projectile.height = 360;
Projectile.friendly = false;
Projectile.hostile = false;
Projectile.penetrate = 1;
Projectile.timeLeft = 1200;
Projectile.alpha = 80;
Projectile.light = 0.5f;
Projectile.ignoreWater = true;
Projectile.tileCollide = false;
Projectile.extraUpdates = 0;
Projectile.velocity = Projectile.velocity * 0f;
}
public override void AI()
{
AnimateProjectile();
if (Main.rand.NextBool(2))
{
int num1 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.HealingDust>(), 0f, 0f, 0, default, 1f);
Main.dust[num1].scale = 2f;
Main.dust[num1].velocity.Y -= 0.5f;
Main.dust[num1].velocity.X = 0f;
Main.dust[num1].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;
Main.dust[num2].velocity.Y += 0.5f;
Main.dust[num2].velocity.X = 0f;
Main.dust[num2].noGravity = true;
}
for (int i = 0; i < 255; i++)
{
Player player = Main.player[i];
if (player.active && player.Distance(Projectile.Center) < 200f)
{
player.AddBuff(ModContent.BuffType<Buffs.IllusoryMirror.StrongerTogether>(), 20, true);
}
}
}
public void AnimateProjectile()
{
Projectile projectile = Projectile;
projectile.frameCounter++;
if (Projectile.frameCounter >= 7)
{
Projectile projectile2 = Projectile;
projectile2.frame++;
Projectile projectile3 = Projectile;
projectile3.frame %= 5;
Projectile.frameCounter = 0;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

@@ -0,0 +1,49 @@
using Terraria;
using Terraria.ModLoader;
namespace FabusMod.Projectiles.IllusoryMirror;
public class SpectralIllusionProj : ModProjectile
{
private const int alphaReducation = 50;
public override void SetDefaults()
{
Projectile.width = 2;
Projectile.height = 20;
Projectile.aiStyle = -1;
Projectile.friendly = true;
Projectile.hostile = false;
Projectile.penetrate = 1;
Projectile.timeLeft = 600;
Projectile.alpha = 255;
Projectile.light = 0.5f;
Projectile.ignoreWater = false;
Projectile.tileCollide = true;
Projectile.extraUpdates = 100;
}
public override void AI()
{
int num1 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.SpectralIllusionDust>(), 0f, 0f, 0, default, 1f);
Dust obj = Main.dust[num1];
obj.velocity *= 0f;
Main.dust[num1].noGravity = true;
int num2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.SpectralIllusionDust2>(), 0f, 0f, 0, default, 1f);
Dust obj2 = Main.dust[num2];
obj2.velocity *= 0f;
Main.dust[num2].noGravity = true;
int num3 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.SpectralIllusionDust3>(), 0f, 0f, 0, default, 1f);
Dust obj3 = Main.dust[num3];
obj3.velocity *= 0f;
Main.dust[num3].noGravity = true;
int num4 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.SpectralIllusionDust4>(), 0f, 0f, 0, default, 1f);
Dust obj4 = Main.dust[num4];
obj4.velocity *= 0f;
Main.dust[num4].noGravity = true;
int num5 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.SpectralIllusionDust4>(), 0f, 0f, 0, default, 1f);
Dust obj5 = Main.dust[num5];
obj5.velocity *= 0f;
Main.dust[num5].noGravity = true;
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 148 B

@@ -0,0 +1,78 @@
using Terraria;
using Terraria.ModLoader;
namespace FabusMod.Projectiles.IllusoryMirror;
public class SpectralIllusionRMB : ModProjectile
{
public override void SetStaticDefaults()
{
Main.projFrames[Projectile.type] = 8;
}
public override void SetDefaults()
{
Projectile.width = 400;
Projectile.height = 360;
Projectile.friendly = false;
Projectile.hostile = false;
Projectile.penetrate = 1;
Projectile.timeLeft = 1200;
Projectile.alpha = 80;
Projectile.light = 0.5f;
Projectile.ignoreWater = true;
Projectile.tileCollide = false;
Projectile.extraUpdates = 0;
Projectile.velocity = Projectile.velocity * 0f;
}
public override void AI()
{
AnimateProjectile();
if (Main.rand.NextBool(2))
{
int num1 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.RainbowHealingDust>(), 0f, 0f, 0, default, 1f);
Main.dust[num1].scale = 2f;
Main.dust[num1].velocity.Y -= 0.5f;
Main.dust[num1].velocity.X = 0f;
Main.dust[num1].noGravity = true;
int num2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.RainbowDust>(), 0f, 0f, 0, default, 1f);
int num3 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.RainbowDust2>(), 0f, 0f, 0, default, 1f);
int num4 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.RainbowDust3>(), 0f, 0f, 0, default, 1f);
Main.dust[num2].scale = 2f;
Main.dust[num2].velocity.Y += 0.5f;
Main.dust[num2].velocity.X = 0f;
Main.dust[num2].noGravity = true;
Main.dust[num3].scale = 2f;
Main.dust[num3].velocity.Y += 0.5f;
Main.dust[num3].velocity.X = 0f;
Main.dust[num3].noGravity = true;
Main.dust[num4].scale = 2f;
Main.dust[num4].velocity.Y += 0.5f;
Main.dust[num4].velocity.X = 0f;
Main.dust[num4].noGravity = true;
}
for (int i = 0; i < 255; i++)
{
Player player = Main.player[i];
if (player.active && player.Distance(Projectile.Center) < 200f)
{
player.AddBuff(ModContent.BuffType<Buffs.IllusoryMirror.SpectralBloom>(), 20, true);
}
}
}
public void AnimateProjectile()
{
Projectile projectile = Projectile;
projectile.frameCounter++;
if (Projectile.frameCounter >= 8)
{
Projectile projectile2 = Projectile;
projectile2.frame++;
Projectile projectile3 = Projectile;
projectile3.frame %= 7;
Projectile.frameCounter = 0;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

+28
View File
@@ -0,0 +1,28 @@
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
namespace FabusMod.Projectiles;
public class IronStinger : ModProjectile
{
public override void SetDefaults()
{
Projectile.width = 22;
Projectile.height = 32;
Projectile.friendly = true;
Projectile.tileCollide = true;
Projectile.ignoreWater = false;
Projectile.timeLeft = 300;
Projectile.light = 1f;
Projectile.penetrate = -1;
AIType = 1;
Projectile.aiStyle = 1;
}
public override void Kill(int timeLeft)
{
SoundEngine.PlaySound(SoundID.Dig, Projectile.position);
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 484 B

+189
View File
@@ -0,0 +1,189 @@
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.Audio;
using Terraria.Enums;
using Terraria.GameContent;
using Terraria.ModLoader;
using Terraria.ID;
namespace FabusMod.Projectiles.Lasers;
public class CoalescenceBeam : ModProjectile
{
private const int MAX_CHARGE = 50;
private const float MOVE_DISTANCE = 60f;
public float Distance
{
get
{
return Projectile.ai[0];
}
set
{
Projectile.ai[0] = value;
}
}
public float Charge
{
get
{
return Projectile.localAI[0];
}
set
{
Projectile.localAI[0] = value;
}
}
public override void SetDefaults()
{
Projectile.width = 5;
Projectile.height = 5;
Projectile.friendly = true;
Projectile.penetrate = -1;
Projectile.tileCollide = false;
Projectile.hide = true;
}
public override bool PreDraw(ref Color lightColor)
{
if (Charge == MAX_CHARGE)
{
Vector2 unit = Projectile.velocity;
DrawLaser(TextureAssets.Projectile[Projectile.type].Value, Main.player[Projectile.owner].Center, unit, 10f, Projectile.damage, -1.57f, 1f, 1000f, Color.White, 60);
}
return false;
}
public void DrawLaser(Texture2D texture, Vector2 start, Vector2 unit, float step, int damage, float rotation = 0f, float scale = 1f, float maxDist = 2000f, Color color = default, int transDist = 50)
{
float r = Utils.ToRotation(unit) + rotation;
for (float i = transDist; i <= Distance; i += step)
{
Color c = Color.White;
Vector2 origin = start + i * unit;
Main.EntitySpriteDraw(texture, origin - Main.screenPosition, new Rectangle(0, 26, 28, 26), (i < transDist) ? Color.Transparent : c, r, new Vector2(14f, 13f), scale, SpriteEffects.None, 0);
}
Main.EntitySpriteDraw(texture, start + unit * (transDist - step) - Main.screenPosition, new Rectangle(0, 0, 28, 26), Color.White, r, new Vector2(14f, 13f), scale, SpriteEffects.None, 0);
Main.EntitySpriteDraw(texture, start + (Distance + step) * unit - Main.screenPosition, new Rectangle(0, 52, 28, 26), Color.White, r, new Vector2(14f, 13f), scale, SpriteEffects.None, 0);
}
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
{
if (Charge == MAX_CHARGE)
{
Player p = Main.player[Projectile.owner];
Vector2 unit = Projectile.velocity;
float point = 0f;
if (Collision.CheckAABBvLineCollision(Utils.TopLeft(targetHitbox), Utils.Size(targetHitbox), p.Center, p.Center + unit * Distance, 22f, ref point))
{
return true;
}
}
return false;
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
target.immune[Projectile.owner] = 8;
}
public override void AI()
{
Vector2 mousePos = Main.MouseWorld;
Player player = Main.player[Projectile.owner];
if (Projectile.owner == Main.myPlayer)
{
Vector2 diff = mousePos - player.Center;
diff.Normalize();
Projectile.velocity = diff;
Projectile.direction = ((Main.MouseWorld.X > player.position.X) ? 1 : (-1));
Projectile.netUpdate = true;
}
Projectile.position = player.Center + Projectile.velocity * MOVE_DISTANCE;
Projectile.timeLeft = 2;
int dir = Projectile.direction;
player.ChangeDir(dir);
player.heldProj = Projectile.whoAmI;
player.itemTime = 2;
player.itemAnimation = 2;
player.itemRotation = (float)Math.Atan2(Projectile.velocity.Y * dir, Projectile.velocity.X * dir);
if (!player.channel)
{
Projectile.Kill();
}
else
{
if (Main.time % 10.0 < 1.0 && !player.CheckMana(player.inventory[player.selectedItem].mana, true, false))
{
Projectile.Kill();
}
Vector2 offset = Projectile.velocity;
offset *= 40f;
Vector2 pos = player.Center + offset - new Vector2(10f, 10f);
if (Charge < MAX_CHARGE)
{
Charge++;
}
int chargeFact = (int)(Charge / 20f);
Vector2 dustVelocity = Vector2.UnitX * 18f;
dustVelocity = Utils.RotatedBy(dustVelocity, (double)(Projectile.rotation - 1.57f), default);
Vector2 spawnPos = Projectile.Center + dustVelocity;
for (int j = 0; j < chargeFact + 1; j++)
{
Vector2 spawn = spawnPos + Utils.ToRotationVector2((float)Main.rand.NextDouble() * 6.28f) * (12f - chargeFact * 2);
Dust obj = Main.dust[Dust.NewDust(pos, 20, 20, DustID.YellowTorch, Projectile.velocity.X / 2f, Projectile.velocity.Y / 2f, 0, default, 1f)];
obj.velocity = Vector2.Normalize(spawnPos - spawn) * 1.5f * (10f - chargeFact * 2f) / 10f;
obj.noGravity = true;
obj.scale = Main.rand.Next(10, 20) * 0.05f;
}
}
if (Charge < MAX_CHARGE)
{
return;
}
Vector2 start = player.Center;
_ = Projectile.velocity * -1f;
for (Distance = MOVE_DISTANCE; Distance <= 2200f; Distance += 5f)
{
start = player.Center + Projectile.velocity * Distance;
if (!Collision.CanHit(player.Center, 1, 1, start, 1, 1))
{
Distance -= 5f;
break;
}
}
if (Projectile.soundDelay <= 0)
{
SoundEngine.PlaySound(SoundID.Item15, Projectile.Center);
Projectile.soundDelay = 40;
}
for (int i = 0; i < 2; i++)
{
float num1 = Utils.ToRotation(Projectile.velocity) + ((Main.rand.NextBool(2)) ? (-1f) : 1f) * 1.57f;
float num2 = (float)(Main.rand.NextDouble() * 0.800000011920929 + 1.0);
//new Vector2((float)Math.Cos(num1) * num2, (float)Math.Sin(num1) * num2);
Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.TerraDust2>(), 0f, 0f, 0, default, 1f);
Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.FoxWitherDust>(), 0f, 0f, 0, default, 1f);
}
DelegateMethods.v3_1 = new Vector3(0.8f, 0.8f, 1f);
Utils.PlotTileLine(Projectile.Center, Projectile.Center + Projectile.velocity * (Distance - MOVE_DISTANCE), 26f, new Utils.TileActionAttempt(DelegateMethods.CastLight));
}
public override bool ShouldUpdatePosition()
{
return false;
}
public override void CutTiles()
{
DelegateMethods.tilecut_0 = (TileCuttingContext)2;
Vector2 unit = Projectile.velocity;
Utils.PlotTileLine(Projectile.Center, Projectile.Center + unit * Distance, (Projectile.width + 16) * Projectile.scale, new Utils.TileActionAttempt(DelegateMethods.CutTiles));
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 797 B

+190
View File
@@ -0,0 +1,190 @@
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.Audio;
using Terraria.Enums;
using Terraria.GameContent;
using Terraria.ModLoader;
using Terraria.ID;
namespace FabusMod.Projectiles.Lasers;
public class GoldenBeam : ModProjectile
{
private const int MAX_CHARGE = 50;
private const float MOVE_DISTANCE = 60f;
public float Distance
{
get
{
return Projectile.ai[0];
}
set
{
Projectile.ai[0] = value;
}
}
public float Charge
{
get
{
return Projectile.localAI[0];
}
set
{
Projectile.localAI[0] = value;
}
}
public override void SetDefaults()
{
Projectile.width = 10;
Projectile.height = 10;
Projectile.friendly = true;
Projectile.penetrate = -1;
Projectile.tileCollide = false;
Projectile.hide = true;
}
public override bool PreDraw(ref Color lightColor)
{
if (Charge == MAX_CHARGE)
{
Vector2 unit = Projectile.velocity;
DrawLaser(TextureAssets.Projectile[Projectile.type].Value, Main.player[Projectile.owner].Center, unit, 10f, Projectile.damage, -1.57f, 1f, 1000f, Color.White, 60);
}
return false;
}
public void DrawLaser(Texture2D texture, Vector2 start, Vector2 unit, float step, int damage, float rotation = 0f, float scale = 1f, float maxDist = 2000f, Color color = default, int transDist = 50)
{
float r = Utils.ToRotation(unit) + rotation;
for (float i = transDist; i <= Distance; i += step)
{
Color c = Color.White;
Vector2 origin = start + i * unit;
Main.EntitySpriteDraw(texture, origin - Main.screenPosition, (Rectangle?)new Rectangle(0, 26, 28, 26), (i < transDist) ? Color.Transparent : c, r, new Vector2(14f, 13f), scale, SpriteEffects.None, 0);
}
Main.EntitySpriteDraw(texture, start + unit * (transDist - step) - Main.screenPosition, (Rectangle?)new Rectangle(0, 0, 28, 26), Color.White, r, new Vector2(14f, 13f), scale, SpriteEffects.None, 0);
Main.EntitySpriteDraw(texture, start + (Distance + step) * unit - Main.screenPosition, (Rectangle?)new Rectangle(0, 52, 28, 26), Color.White, r, new Vector2(14f, 13f), scale, SpriteEffects.None, 0);
}
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
{
if (Charge == 50f)
{
Player p = Main.player[Projectile.owner];
Vector2 unit = Projectile.velocity;
float point = 0f;
if (Collision.CheckAABBvLineCollision(Utils.TopLeft(targetHitbox), Utils.Size(targetHitbox), p.Center, p.Center + unit * Distance, 22f, ref point))
{
return true;
}
}
return false;
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
target.immune[Projectile.owner] = 4;
target.AddBuff(ModContent.BuffType<Buffs.HolySmite>(), 240, false);
target.AddBuff(72, 180, false);
}
public override void AI()
{
Vector2 mousePos = Main.MouseWorld;
Player player = Main.player[Projectile.owner];
if (Projectile.owner == Main.myPlayer)
{
Vector2 diff = mousePos - player.Center;
diff.Normalize();
Projectile.velocity = diff;
Projectile.direction = ((Main.MouseWorld.X > player.position.X) ? 1 : (-1));
Projectile.netUpdate = true;
}
Projectile.position = player.Center + Projectile.velocity * MOVE_DISTANCE;
Projectile.timeLeft = 2;
int dir = Projectile.direction;
player.ChangeDir(dir);
player.heldProj = Projectile.whoAmI;
player.itemTime = 2;
player.itemAnimation = 2;
player.itemRotation = (float)Math.Atan2(Projectile.velocity.Y * dir, Projectile.velocity.X * dir);
if (!player.channel)
{
Projectile.Kill();
}
else
{
if (Main.time % 10.0 < 1.0 && !player.CheckMana(player.inventory[player.selectedItem].mana, true, false))
{
Projectile.Kill();
}
Vector2 offset = Projectile.velocity;
offset *= 40f;
Vector2 pos = player.Center + offset - new Vector2(10f, 10f);
if (Charge < MAX_CHARGE)
{
Charge++;
}
int chargeFact = (int)(Charge / 20f);
Vector2 dustVelocity = Vector2.UnitX * 18f;
dustVelocity = Utils.RotatedBy(dustVelocity, (double)(Projectile.rotation - 1.57f), default);
Vector2 spawnPos = Projectile.Center + dustVelocity;
for (int j = 0; j < chargeFact + 1; j++)
{
Vector2 spawn = spawnPos + Utils.ToRotationVector2((float)Main.rand.NextDouble() * 6.28f) * (12f - chargeFact * 2);
Dust obj = Main.dust[Dust.NewDust(pos, 20, 20, DustID.YellowTorch, Projectile.velocity.X / 2f, Projectile.velocity.Y / 2f, 0, default, 1f)];
obj.velocity = Vector2.Normalize(spawnPos - spawn) * 1.5f * (10f - chargeFact * 2f) / 10f;
obj.noGravity = true;
obj.scale = Main.rand.Next(10, 20) * 0.05f;
}
}
if (Charge < 50f)
{
return;
}
Vector2 start = player.Center;
_ = Projectile.velocity * -1f;
for (Distance = MOVE_DISTANCE; Distance <= 2200f; Distance += 5f)
{
start = player.Center + Projectile.velocity * Distance;
if (!Collision.CanHit(player.Center, 1, 1, start, 1, 1))
{
Distance -= 5f;
break;
}
}
if (Projectile.soundDelay <= 0)
{
SoundEngine.PlaySound(SoundID.Item15, Projectile.Center);
Projectile.soundDelay = 40;
}
for (int i = 0; i < 2; i++)
{
float num1 = Utils.ToRotation(Projectile.velocity) + ((Main.rand.NextBool(2)) ? (-1f) : 1f) * 1.57f;
float num2 = (float)(Main.rand.NextDouble() * 0.800000011920929 + 1.0);
new Vector2((float)Math.Cos(num1) * num2, (float)Math.Sin(num1) * num2);
Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.MeatDust>(), 0f, 0f, 0, default, 1f);
}
DelegateMethods.v3_1 = new Vector3(0.8f, 0.8f, 1f);
Utils.PlotTileLine(Projectile.Center, Projectile.Center + Projectile.velocity * (Distance - MOVE_DISTANCE), 26f, new Utils.TileActionAttempt(DelegateMethods.CastLight));
}
public override bool ShouldUpdatePosition()
{
return false;
}
public override void CutTiles()
{
DelegateMethods.tilecut_0 = (TileCuttingContext)2;
Vector2 unit = Projectile.velocity;
Utils.PlotTileLine(Projectile.Center, Projectile.Center + unit * Distance, (Projectile.width + 16) * Projectile.scale, new Utils.TileActionAttempt(DelegateMethods.CutTiles));
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 894 B

+190
View File
@@ -0,0 +1,190 @@
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.Audio;
using Terraria.Enums;
using Terraria.GameContent;
using Terraria.ModLoader;
using Terraria.ID;
namespace FabusMod.Projectiles.Lasers;
public class HellfireBeamProj : ModProjectile
{
private const int MAX_CHARGE = 50;
private const float MOVE_DISTANCE = 60f;
public float Distance
{
get
{
return Projectile.ai[0];
}
set
{
Projectile.ai[0] = value;
}
}
public float Charge
{
get
{
return Projectile.localAI[0];
}
set
{
Projectile.localAI[0] = value;
}
}
public override void SetDefaults()
{
Projectile.width = 10;
Projectile.height = 10;
Projectile.friendly = true;
Projectile.penetrate = -1;
Projectile.tileCollide = false;
Projectile.hide = true;
}
public override bool PreDraw(ref Color lightColor)
{
if (Charge == MAX_CHARGE)
{
Vector2 unit = Projectile.velocity;
DrawLaser(TextureAssets.Projectile[Projectile.type].Value, Main.player[Projectile.owner].Center, unit, 10f, Projectile.damage, -1.57f, 1f, 1000f, Color.White, 60);
}
return false;
}
public void DrawLaser(Texture2D texture, Vector2 start, Vector2 unit, float step, int damage, float rotation = 0f, float scale = 1f, float maxDist = 2000f, Color color = default, int transDist = 50)
{
float r = Utils.ToRotation(unit) + rotation;
for (float i = transDist; i <= Distance; i += step)
{
Color c = Color.White;
Vector2 origin = start + i * unit;
Main.EntitySpriteDraw(texture, origin - Main.screenPosition, (Rectangle?)new Rectangle(0, 26, 28, 26), (i < transDist) ? Color.Transparent : c, r, new Vector2(14f, 13f), scale, SpriteEffects.None, 0);
}
Main.EntitySpriteDraw(texture, start + unit * (transDist - step) - Main.screenPosition, (Rectangle?)new Rectangle(0, 0, 28, 26), Color.White, r, new Vector2(14f, 13f), scale, SpriteEffects.None, 0);
Main.EntitySpriteDraw(texture, start + (Distance + step) * unit - Main.screenPosition, (Rectangle?)new Rectangle(0, 52, 28, 26), Color.White, r, new Vector2(14f, 13f), scale, SpriteEffects.None, 0);
}
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
{
if (Charge == MAX_CHARGE)
{
Player p = Main.player[Projectile.owner];
Vector2 unit = Projectile.velocity;
float point = 0f;
if (Collision.CheckAABBvLineCollision(Utils.TopLeft(targetHitbox), Utils.Size(targetHitbox), p.Center, p.Center + unit * Distance, 22f, ref point))
{
return true;
}
}
return false;
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
target.immune[Projectile.owner] = 5;
target.AddBuff(24, 120, false);
}
public override void AI()
{
Vector2 mousePos = Main.MouseWorld;
Player player = Main.player[Projectile.owner];
if (Projectile.owner == Main.myPlayer)
{
Vector2 diff = mousePos - player.Center;
diff.Normalize();
Projectile.velocity = diff;
Projectile.direction = (Main.MouseWorld.X > player.position.X) ? 1 : (-1);
Projectile.netUpdate = true;
}
Projectile.position = player.Center + Projectile.velocity * MOVE_DISTANCE;
Projectile.timeLeft = 2;
int dir = Projectile.direction;
player.ChangeDir(dir);
player.heldProj = Projectile.whoAmI;
player.itemTime = 2;
player.itemAnimation = 2;
player.itemRotation = (float)Math.Atan2(Projectile.velocity.Y * dir, Projectile.velocity.X * dir);
if (!player.channel)
{
Projectile.Kill();
}
else
{
if (Main.time % 10.0 < 1.0 && !player.CheckMana(player.inventory[player.selectedItem].mana, true, false))
{
Projectile.Kill();
}
Vector2 offset = Projectile.velocity;
offset *= 40f;
Vector2 pos = player.Center + offset - new Vector2(10f, 10f);
if (Charge < MAX_CHARGE)
{
Charge++;
}
int chargeFact = (int)(Charge / 20f);
Vector2 dustVelocity = Vector2.UnitX * 18f;
dustVelocity = Utils.RotatedBy(dustVelocity, (double)(Projectile.rotation - 1.57f), default);
Vector2 spawnPos = Projectile.Center + dustVelocity;
for (int j = 0; j < chargeFact + 1; j++)
{
Vector2 spawn = spawnPos + Utils.ToRotationVector2((float)Main.rand.NextDouble() * 6.28f) * (12f - chargeFact * 2);
Dust obj = Main.dust[Dust.NewDust(pos, 20, 20, DustID.YellowTorch, Projectile.velocity.X / 2f, Projectile.velocity.Y / 2f, 0, default, 1f)];
obj.velocity = Vector2.Normalize(spawnPos - spawn) * 1.5f * (10f - chargeFact * 2f) / 10f;
obj.noGravity = true;
obj.scale = Main.rand.Next(10, 20) * 0.05f;
}
}
if (Charge < MAX_CHARGE)
{
return;
}
Vector2 start = player.Center;
_ = Projectile.velocity * -1f;
for (Distance = MOVE_DISTANCE; Distance <= 2200f; Distance += 5f)
{
start = player.Center + Projectile.velocity * Distance;
if (!Collision.CanHit(player.Center, 1, 1, start, 1, 1))
{
Distance -= 5f;
break;
}
}
if (Projectile.soundDelay <= 0)
{
SoundEngine.PlaySound(SoundID.Item15, Projectile.Center);
Projectile.soundDelay = 40;
}
for (int i = 0; i < 2; i++)
{
float num1 = Utils.ToRotation(Projectile.velocity) + (Main.rand.NextBool(2) ? (-1f) : 1f) * 1.57f;
float num2 = (float)(Main.rand.NextDouble() * 0.800000011920929 + 1.0);
//new Vector2((float)Math.Cos(num1) * num2, (float)Math.Sin(num1) * num2);
Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.BloodDust>(), 0f, 0f, 0, default, 1f);
Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.FoxWitherDust>(), 0f, 0f, 0, default, 1f);
}
DelegateMethods.v3_1 = new Vector3(0.8f, 0.8f, 1f);
Utils.PlotTileLine(Projectile.Center, Projectile.Center + Projectile.velocity * (Distance - MOVE_DISTANCE), 26f, new Utils.TileActionAttempt(DelegateMethods.CastLight));
}
public override bool ShouldUpdatePosition()
{
return false;
}
public override void CutTiles()
{
DelegateMethods.tilecut_0 = (TileCuttingContext)2;
Vector2 unit = Projectile.velocity;
Utils.PlotTileLine(Projectile.Center, Projectile.Center + unit * Distance, (Projectile.width + 16) * Projectile.scale, new Utils.TileActionAttempt(DelegateMethods.CutTiles));
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 819 B

+192
View File
@@ -0,0 +1,192 @@
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.Audio;
using Terraria.Enums;
using Terraria.GameContent;
using Terraria.ID;
using Terraria.ModLoader;
namespace FabusMod.Projectiles.Lasers;
public class RainbowBeam : ModProjectile
{
private const int MAX_CHARGE = 50;
private const float MOVE_DISTANCE = 60f;
public float Distance
{
get
{
return Projectile.ai[0];
}
set
{
Projectile.ai[0] = value;
}
}
public float Charge
{
get
{
return Projectile.localAI[0];
}
set
{
Projectile.localAI[0] = value;
}
}
public override void SetDefaults()
{
Projectile.width = 10;
Projectile.height = 10;
Projectile.friendly = true;
Projectile.penetrate = -1;
Projectile.tileCollide = false;
Projectile.hide = true;
}
public override bool PreDraw(ref Color lightColor)
{
if (Charge == MAX_CHARGE)
{
Vector2 unit = Projectile.velocity;
DrawLaser(TextureAssets.Projectile[Projectile.type].Value, Main.player[Projectile.owner].Center, unit, 10f, Projectile.damage, -1.57f, 1f, 1000f, Color.White, 60);
}
return false;
}
public void DrawLaser(Texture2D texture, Vector2 start, Vector2 unit, float step, int damage, float rotation = 0f, float scale = 1f, float maxDist = 2000f, Color color = default, int transDist = 50)
{
float r = Utils.ToRotation(unit) + rotation;
for (float i = transDist; i <= Distance; i += step)
{
Color c = Color.White;
Vector2 origin = start + i * unit;
Main.EntitySpriteDraw(texture, origin - Main.screenPosition, new Rectangle(0, 26, 28, 26), (i < transDist) ? Color.Transparent : c, r, new Vector2(14f, 13f), scale, SpriteEffects.None, 0);
}
Main.EntitySpriteDraw(texture, start + unit * (transDist - step) - Main.screenPosition, new Rectangle(0, 0, 28, 26), Color.White, r, new Vector2(14f, 13f), scale, SpriteEffects.None, 0);
Main.EntitySpriteDraw(texture, start + (Distance + step) * unit - Main.screenPosition, new Rectangle(0, 52, 28, 26), Color.White, r, new Vector2(14f, 13f), scale, SpriteEffects.None, 0);
}
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
{
if (Charge == MAX_CHARGE)
{
Player p = Main.player[Projectile.owner];
Vector2 unit = Projectile.velocity;
float point = 0f;
if (Collision.CheckAABBvLineCollision(Utils.TopLeft(targetHitbox), Utils.Size(targetHitbox), p.Center, p.Center + unit * Distance, 22f, ref point))
{
return true;
}
}
return false;
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
target.immune[Projectile.owner] = 3;
target.AddBuff(72, 180, false);
target.AddBuff(ModContent.BuffType<Buffs.RainbowsWrath>(), 120, false);
}
public override void AI()
{
Vector2 mousePos = Main.MouseWorld;
Player player = Main.player[Projectile.owner];
if (Projectile.owner == Main.myPlayer)
{
Vector2 diff = mousePos - player.Center;
diff.Normalize();
Projectile.velocity = diff;
Projectile.direction = ((Main.MouseWorld.X > player.position.X) ? 1 : (-1));
Projectile.netUpdate = true;
}
Projectile.position = player.Center + Projectile.velocity * MOVE_DISTANCE;
Projectile.timeLeft = 2;
int dir = Projectile.direction;
player.ChangeDir(dir);
player.heldProj = Projectile.whoAmI;
player.itemTime = 2;
player.itemAnimation = 2;
player.itemRotation = (float)Math.Atan2(Projectile.velocity.Y * dir, Projectile.velocity.X * dir);
if (!player.channel)
{
Projectile.Kill();
}
else
{
if (Main.time % 10.0 < 1.0 && !player.CheckMana(player.inventory[player.selectedItem].mana, true, false))
{
Projectile.Kill();
}
Vector2 offset = Projectile.velocity;
offset *= 40f;
Vector2 pos = player.Center + offset - new Vector2(10f, 10f);
if (Charge < MAX_CHARGE)
{
Charge++;
}
int chargeFact = (int)(Charge / 20f);
Vector2 dustVelocity = Vector2.UnitX * 18f;
dustVelocity = Utils.RotatedBy(dustVelocity, (double)(Projectile.rotation - 1.57f), default);
Vector2 spawnPos = Projectile.Center + dustVelocity;
for (int j = 0; j < chargeFact + 1; j++)
{
Vector2 spawn = spawnPos + Utils.ToRotationVector2((float)Main.rand.NextDouble() * 6.28f) * (12f - chargeFact * 2);
Dust obj = Main.dust[Dust.NewDust(pos, 20, 20, DustID.YellowTorch, Projectile.velocity.X / 2f, Projectile.velocity.Y / 2f, 0, default, 1f)];
obj.velocity = Vector2.Normalize(spawnPos - spawn) * 1.5f * (10f - chargeFact * 2f) / 10f;
obj.noGravity = true;
obj.scale = Main.rand.Next(10, 20) * 0.05f;
}
}
if (Charge < MAX_CHARGE)
{
return;
}
Vector2 start = player.Center;
_ = Projectile.velocity * -1f;
for (Distance = MOVE_DISTANCE; Distance <= 2200f; Distance += 5f)
{
start = player.Center + Projectile.velocity * Distance;
if (!Collision.CanHit(player.Center, 1, 1, start, 1, 1))
{
Distance -= 5f;
break;
}
}
if (Projectile.soundDelay <= 0)
{
SoundEngine.PlaySound(SoundID.Item15, Projectile.Center);
Projectile.soundDelay = 40;
}
for (int i = 0; i < 2; i++)
{
float num1 = Utils.ToRotation(Projectile.velocity) + ((Main.rand.NextBool(2)) ? (-1f) : 1f) * 1.57f;
float num2 = (float)(Main.rand.NextDouble() * 0.800000011920929 + 1.0);
//new Vector2((float)Math.Cos(num1) * num2, (float)Math.Sin(num1) * num2);
Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.RainbowDust>(), 0f, 0f, 0, default, 1f);
Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.RainbowDust2>(), 0f, 0f, 0, default, 1f);
Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.RainbowDust3>(), 0f, 0f, 0, default, 1f);
}
DelegateMethods.v3_1 = new Vector3(0.8f, 0.8f, 1f);
Utils.PlotTileLine(Projectile.Center, Projectile.Center + Projectile.velocity * (Distance - MOVE_DISTANCE), 26f, new Utils.TileActionAttempt(DelegateMethods.CastLight));
}
public override bool ShouldUpdatePosition()
{
return false;
}
public override void CutTiles()
{
DelegateMethods.tilecut_0 = (TileCuttingContext)2;
Vector2 unit = Projectile.velocity;
Utils.PlotTileLine(Projectile.Center, Projectile.Center + unit * Distance, (Projectile.width + 16) * Projectile.scale, new Utils.TileActionAttempt(DelegateMethods.CutTiles));
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

+191
View File
@@ -0,0 +1,191 @@
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.Audio;
using Terraria.Enums;
using Terraria.GameContent;
using Terraria.ID;
using Terraria.ModLoader;
namespace FabusMod.Projectiles.Lasers;
public class VengeanceBeam : ModProjectile
{
private const int MAX_CHARGE = 50;
private const float MOVE_DISTANCE = 60f;
public float Distance
{
get
{
return Projectile.ai[0];
}
set
{
Projectile.ai[0] = value;
}
}
public float Charge
{
get
{
return Projectile.localAI[0];
}
set
{
Projectile.localAI[0] = value;
}
}
public override void SetDefaults()
{
Projectile.width = 10;
Projectile.height = 10;
Projectile.friendly = true;
Projectile.penetrate = -1;
Projectile.tileCollide = false;
Projectile.hide = true;
}
public override bool PreDraw(ref Color lightColor)
{
if (Charge == MAX_CHARGE)
{
Vector2 unit = Projectile.velocity;
DrawLaser(TextureAssets.Projectile[Projectile.type].Value, Main.player[Projectile.owner].Center, unit, 10f, Projectile.damage, -1.57f, 1f, 1000f, Color.White, 60);
}
return false;
}
public void DrawLaser(Texture2D texture, Vector2 start, Vector2 unit, float step, int damage, float rotation = 0f, float scale = 1f, float maxDist = 2000f, Color color = default, int transDist = 50)
{
Vector2 origin = start;
float r = Utils.ToRotation(unit) + rotation;
for (float i = transDist; i <= Distance; i += step)
{
Color c = Color.White;
origin = start + i * unit;
Main.EntitySpriteDraw(texture, origin - Main.screenPosition, new Rectangle(0, 26, 28, 26), (i < transDist) ? Color.Transparent : c, r, new Vector2(14f, 13f), scale, SpriteEffects.None, 0);
}
Main.EntitySpriteDraw(texture, start + unit * (transDist - step) - Main.screenPosition, new Rectangle(0, 0, 28, 26), Color.White, r, new Vector2(14f, 13f), scale, SpriteEffects.None, 0);
Main.EntitySpriteDraw(texture, start + (Distance + step) * unit - Main.screenPosition, new Rectangle(0, 52, 28, 26), Color.White, r, new Vector2(14f, 13f), scale, SpriteEffects.None, 0);
}
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
{
if (Charge == MAX_CHARGE)
{
Player p = Main.player[Projectile.owner];
Vector2 unit = Projectile.velocity;
float point = 0f;
if (Collision.CheckAABBvLineCollision(Utils.TopLeft(targetHitbox), Utils.Size(targetHitbox), p.Center, p.Center + unit * Distance, 22f, ref point))
{
return true;
}
}
return false;
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
target.immune[Projectile.owner] = 4;
target.AddBuff(ModContent.BuffType<Buffs.HolySmite>(), 180, false);
}
public override void AI()
{
Vector2 mousePos = Main.MouseWorld;
Player player = Main.player[Projectile.owner];
if (Projectile.owner == Main.myPlayer)
{
Vector2 diff = mousePos - player.Center;
diff.Normalize();
Projectile.velocity = diff;
Projectile.direction = ((Main.MouseWorld.X > player.position.X) ? 1 : (-1));
Projectile.netUpdate = true;
}
Projectile.position = player.Center + Projectile.velocity * MOVE_DISTANCE;
Projectile.timeLeft = 2;
int dir = Projectile.direction;
player.ChangeDir(dir);
player.heldProj = Projectile.whoAmI;
player.itemTime = 2;
player.itemAnimation = 2;
player.itemRotation = (float)Math.Atan2(Projectile.velocity.Y * dir, Projectile.velocity.X * dir);
if (!player.channel)
{
Projectile.Kill();
}
else
{
if (Main.time % 10.0 < 1.0 && !player.CheckMana(player.inventory[player.selectedItem].mana, true, false))
{
Projectile.Kill();
}
Vector2 offset = Projectile.velocity;
offset *= 40f;
Vector2 pos = player.Center + offset - new Vector2(10f, 10f);
if (Charge < MAX_CHARGE)
{
Charge++;
}
int chargeFact = (int)(Charge / 20f);
Vector2 dustVelocity = Vector2.UnitX * 18f;
dustVelocity = Utils.RotatedBy(dustVelocity, (double)(Projectile.rotation - 1.57f), default);
Vector2 spawnPos = Projectile.Center + dustVelocity;
for (int j = 0; j < chargeFact + 1; j++)
{
Vector2 spawn = spawnPos + Utils.ToRotationVector2((float)Main.rand.NextDouble() * 6.28f) * (12f - chargeFact * 2);
Dust obj = Main.dust[Dust.NewDust(pos, 20, 20, DustID.YellowTorch, Projectile.velocity.X / 2f, Projectile.velocity.Y / 2f, 0, default, 1f)];
obj.velocity = Vector2.Normalize(spawnPos - spawn) * 1.5f * (10f - chargeFact * 2f) / 10f;
obj.noGravity = true;
obj.scale = Main.rand.Next(10, 20) * 0.05f;
}
}
if (Charge < MAX_CHARGE)
{
return;
}
Vector2 start = player.Center;
_ = Projectile.velocity * -1f;
for (Distance = MOVE_DISTANCE; Distance <= 2200f; Distance += 5f)
{
start = player.Center + Projectile.velocity * Distance;
if (!Collision.CanHit(player.Center, 1, 1, start, 1, 1))
{
Distance -= 5f;
break;
}
}
if (Projectile.soundDelay <= 0)
{
SoundEngine.PlaySound(SoundID.Item15, Projectile.Center);
Projectile.soundDelay = 40;
}
for (int i = 0; i < 2; i++)
{
float num1 = Utils.ToRotation(Projectile.velocity) + ((Main.rand.NextBool(2)) ? (-1f) : 1f) * 1.57f;
float num2 = (float)(Main.rand.NextDouble() * 0.800000011920929 + 1.0);
new Vector2((float)Math.Cos(num1) * num2, (float)Math.Sin(num1) * num2);
Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.HolyDust>(), 0f, 0f, 0, default, 1f);
Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.FoxDust>(), 0f, 0f, 0, default, 1f);
}
DelegateMethods.v3_1 = new Vector3(0.8f, 0.8f, 1f);
Utils.PlotTileLine(Projectile.Center, Projectile.Center + Projectile.velocity * (Distance - MOVE_DISTANCE), 26f, new Utils.TileActionAttempt(DelegateMethods.CastLight));
}
public override bool ShouldUpdatePosition()
{
return false;
}
public override void CutTiles()
{
DelegateMethods.tilecut_0 = (TileCuttingContext)2;
Vector2 unit = Projectile.velocity;
Utils.PlotTileLine(Projectile.Center, Projectile.Center + unit * Distance, (Projectile.width + 16) * Projectile.scale, new Utils.TileActionAttempt(DelegateMethods.CutTiles));
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 877 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

@@ -0,0 +1,53 @@
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
namespace FabusMod.Projectiles.LightBlasts;
public class GoldenLightBlast : ModProjectile
{
public override void SetDefaults()
{
Projectile.width = 16;
Projectile.height = 16;
Projectile.aiStyle = 1;
Projectile.friendly = true;
Projectile.hostile = false;
Projectile.penetrate = 1;
Projectile.timeLeft = 600;
Projectile.alpha = 255;
Projectile.light = 0.5f;
Projectile.ignoreWater = false;
Projectile.tileCollide = true;
Projectile.extraUpdates = 2;
AIType = 14;
}
public override void AI()
{
Projectile.velocity.Y += Projectile.ai[0];
if (Utils.NextFloat(Main.rand) < 0.1f && Projectile.alpha <= 100)
{
int dust1 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.MeatDust>(), 0f, 0f, 0, default, 1f);
Main.dust[dust1].scale = 0.9f;
Dust obj = Main.dust[dust1];
obj.velocity *= 0.1f;
Main.dust[dust1].noGravity = true;
}
}
public override void Kill(int timeLeft)
{
for (int i = 0; i < 5; i++)
{
int dust1 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.MeatDust>(), 0f, 0f, 0, default, 1f);
Main.dust[dust1].scale = 0.9f;
Dust obj = Main.dust[dust1];
obj.velocity *= 0.1f;
Main.dust[dust1].noGravity = true;
}
SoundEngine.PlaySound(SoundID.DD2_BetsyFireballShot, Projectile.position);
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 430 B

+53
View File
@@ -0,0 +1,53 @@
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
namespace FabusMod.Projectiles.LightBlasts;
public class LightBlast : ModProjectile
{
public override void SetDefaults()
{
Projectile.width = 16;
Projectile.height = 16;
Projectile.aiStyle = 1;
Projectile.friendly = true;
Projectile.hostile = false;
Projectile.penetrate = 1;
Projectile.timeLeft = 600;
Projectile.alpha = 255;
Projectile.light = 0.5f;
Projectile.ignoreWater = false;
Projectile.tileCollide = true;
Projectile.extraUpdates = 2;
AIType = 14;
}
public override void AI()
{
Projectile.velocity.Y += Projectile.ai[0];
if (Utils.NextFloat(Main.rand) < 0.1f && Projectile.alpha <= 100)
{
int dust1 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.RyuuDust2>(), 0f, 0f, 0, default, 1f);
Main.dust[dust1].scale = 0.9f;
Dust obj = Main.dust[dust1];
obj.velocity *= 0.1f;
Main.dust[dust1].noGravity = true;
}
}
public override void Kill(int timeLeft)
{
for (int i = 0; i < 5; i++)
{
int dust1 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.RyuuDust2>(), 0f, 0f, 0, default, 1f);
Main.dust[dust1].scale = 0.9f;
Dust obj = Main.dust[dust1];
obj.velocity *= 0.1f;
Main.dust[dust1].noGravity = true;
}
SoundEngine.PlaySound(SoundID.DD2_BetsyFireballShot, Projectile.position);
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 428 B

@@ -0,0 +1,75 @@
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
namespace FabusMod.Projectiles.LightBlasts;
public class RainbowLightBlast : ModProjectile
{
public override void SetDefaults()
{
Projectile.width = 16;
Projectile.height = 16;
Projectile.aiStyle = 1;
Projectile.friendly = true;
Projectile.hostile = false;
Projectile.penetrate = 1;
Projectile.timeLeft = 600;
Projectile.alpha = 255;
Projectile.light = 0.5f;
Projectile.ignoreWater = false;
Projectile.tileCollide = true;
Projectile.extraUpdates = 2;
AIType = 14;
}
public override void AI()
{
if (Utils.NextFloat(Main.rand) < 0.1f && Projectile.alpha <= 100)
{
int dust1 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.RainbowDust>(), 0f, 0f, 0, default, 1f);
int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.RainbowDust2>(), 0f, 0f, 0, default, 1f);
int dust3 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.RainbowDust3>(), 0f, 0f, 0, default, 1f);
Main.dust[dust1].scale = 0.9f;
Dust obj = Main.dust[dust1];
obj.velocity *= 0.1f;
Main.dust[dust1].noGravity = true;
Main.dust[dust2].scale = 0.9f;
Dust obj2 = Main.dust[dust2];
obj2.velocity *= 0.1f;
Main.dust[dust2].noGravity = true;
Main.dust[dust3].scale = 0.9f;
Dust obj3 = Main.dust[dust3];
obj3.velocity *= 0.1f;
Main.dust[dust3].noGravity = true;
}
}
public override void Kill(int timeLeft)
{
for (int i = 0; i < 5; i++)
{
if (Utils.NextFloat(Main.rand) < 0.1f && Projectile.alpha <= 100)
{
int dust1 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.RainbowDust>(), 0f, 0f, 0, default, 1f);
int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.RainbowDust2>(), 0f, 0f, 0, default, 1f);
int dust3 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.RainbowDust3>(), 0f, 0f, 0, default, 1f);
Main.dust[dust1].scale = 0.9f;
Dust obj = Main.dust[dust1];
obj.velocity *= 0.1f;
Main.dust[dust1].noGravity = true;
Main.dust[dust2].scale = 0.9f;
Dust obj2 = Main.dust[dust2];
obj2.velocity *= 0.1f;
Main.dust[dust2].noGravity = true;
Main.dust[dust3].scale = 0.9f;
Dust obj3 = Main.dust[dust3];
obj3.velocity *= 0.1f;
Main.dust[dust3].noGravity = true;
}
}
SoundEngine.PlaySound(SoundID.DD2_BetsyFireballShot, Projectile.position);
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 646 B

+43
View File
@@ -0,0 +1,43 @@
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
namespace FabusMod.Projectiles;
public class LunarBolt : ModProjectile
{
public override void SetDefaults()
{
Projectile.width = 16;
Projectile.height = 16;
Projectile.friendly = true;
Projectile.tileCollide = true;
Projectile.ignoreWater = true;
Projectile.timeLeft = 600;
Projectile.light = 1f;
Projectile.penetrate = 1;
AIType = 1;
Projectile.aiStyle = 1;
}
public override void AI()
{
if (Utils.NextFloat(Main.rand) < 0.1f && Projectile.alpha <= 100)
{
int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.CrystalDust2>(), 0f, 0f, 0, default, 1f);
Dust obj = Main.dust[dust];
obj.velocity /= 2f;
}
}
public override void Kill(int timeLeft)
{
for (int i = 0; i < 5; i++)
{
Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, ModContent.DustType<Dusts.CrystalDust2>(), Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f, 0, default, 1f);
}
SoundEngine.PlaySound(SoundID.Item1, Projectile.position);
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 306 B

+74
View File
@@ -0,0 +1,74 @@
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace FabusMod.Projectiles.Minions;
public class GoddessMinion : Minion
{
public override void SetDefaults()
{
Projectile.netImportant = true;
Projectile.CloneDefaults(388);
AIType = 388;
Projectile.width = 50;
Projectile.height = 50;
Main.projFrames[Projectile.type] = 8;
Projectile.friendly = true;
Projectile.minion = true;
Projectile.minionSlots = 1f;
Projectile.penetrate = -1;
Projectile.timeLeft = 18000;
Projectile.ignoreWater = true;
Projectile.tileCollide = false;
ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true;
AnimateProjectile();
}
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Goddess' Summoner");
}
public override bool OnTileCollide(Vector2 oldVelocity)
{
if (Projectile.velocity.X != oldVelocity.X)
{
Projectile.velocity.X = oldVelocity.X;
}
if (Projectile.velocity.Y != oldVelocity.Y)
{
Projectile.velocity.Y = oldVelocity.Y;
}
return false;
}
public override void CheckActive()
{
Player obj = Main.player[Projectile.owner];
FabuPlayer modPlayer = obj.GetModPlayer<FabuPlayer>();
if (obj.dead)
{
modPlayer.goddessMinion = false;
}
if (modPlayer.goddessMinion)
{
Projectile.timeLeft = 2;
}
}
public void AnimateProjectile()
{
Projectile projectile = Projectile;
projectile.frameCounter++;
if (Projectile.frameCounter >= 2)
{
Projectile projectile2 = Projectile;
projectile2.frame++;
Projectile projectile3 = Projectile;
projectile3.frame %= 3;
Projectile.frameCounter = 0;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

+13
View File
@@ -0,0 +1,13 @@
using Terraria.ModLoader;
namespace FabusMod.Projectiles.Minions;
public abstract class Minion : ModProjectile
{
public override void AI()
{
CheckActive();
}
public abstract void CheckActive();
}
+42
View File
@@ -0,0 +1,42 @@
using Terraria;
using Terraria.ModLoader;
namespace FabusMod.Projectiles.Pets;
public class FoxPet : ModProjectile
{
public override void SetDefaults()
{
Projectile.CloneDefaults(111);
AIType = 111;
Main.projFrames[Projectile.type] = 8;
Projectile.width = 70;
Projectile.height = 48;
Main.projPet[Projectile.type] = true;
}
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Fox Pet");
}
public override bool PreAI()
{
Main.player[Projectile.owner].bunny = false;
return true;
}
public override void AI()
{
Player obj = Main.player[Projectile.owner];
FabuPlayer modPlayer = obj.GetModPlayer<FabuPlayer>();
if (obj.dead)
{
modPlayer.foxPet = false;
}
if (modPlayer.foxPet)
{
Projectile.timeLeft = 2;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

+42
View File
@@ -0,0 +1,42 @@
using Terraria;
using Terraria.ModLoader;
namespace FabusMod.Projectiles.Pets;
public class MechanicalTooth : ModProjectile
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Mechanical Tooth");
Main.projFrames[Projectile.type] = 4;
Main.projPet[Projectile.type] = true;
}
public override void SetDefaults()
{
Projectile.width = 26;
Projectile.height = 20;
Projectile.CloneDefaults(380);
AIType = 380;
}
public override bool PreAI()
{
Main.player[Projectile.owner].zephyrfish = false;
return true;
}
public override void AI()
{
Player obj = Main.player[Projectile.owner];
FabuPlayer modPlayer = obj.GetModPlayer<FabuPlayer>();
if (obj.dead)
{
modPlayer.kregPet = false;
}
if (modPlayer.kregPet)
{
Projectile.timeLeft = 2;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 653 B

+42
View File
@@ -0,0 +1,42 @@
using Terraria;
using Terraria.ModLoader;
namespace FabusMod.Projectiles.Pets;
public class PinkFoxPet : ModProjectile
{
public override void SetDefaults()
{
Projectile.CloneDefaults(111);
AIType = 111;
Main.projFrames[Projectile.type] = 8;
Projectile.width = 70;
Projectile.height = 48;
Main.projPet[Projectile.type] = true;
}
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Pink Fox Pet");
}
public override bool PreAI()
{
Main.player[Projectile.owner].bunny = false;
return true;
}
public override void AI()
{
Player obj = Main.player[Projectile.owner];
FabuPlayer modPlayer = obj.GetModPlayer<FabuPlayer>();
if (obj.dead)
{
modPlayer.pinkFoxPet = false;
}
if (modPlayer.pinkFoxPet)
{
Projectile.timeLeft = 2;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

+42
View File
@@ -0,0 +1,42 @@
using Terraria;
using Terraria.ModLoader;
namespace FabusMod.Projectiles.Pets;
public class WindUpFabu : ModProjectile
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Wind-Up Fabu");
Main.projFrames[Projectile.type] = 3;
Main.projPet[Projectile.type] = true;
}
public override void SetDefaults()
{
Projectile.CloneDefaults(112);
Projectile.width = 34;
Projectile.height = 34;
AIType = 112;
}
public override bool PreAI()
{
Main.player[Projectile.owner].penguin = false;
return true;
}
public override void AI()
{
Player obj = Main.player[Projectile.owner];
FabuPlayer modPlayer = obj.GetModPlayer<FabuPlayer>();
if (obj.dead)
{
modPlayer.fabu = false;
}
if (modPlayer.fabu)
{
Projectile.timeLeft = 2;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

+25
View File
@@ -0,0 +1,25 @@
using Terraria;
using Terraria.ModLoader;
namespace FabusMod.Projectiles;
public class PulseBullet : ModProjectile
{
public override void SetDefaults()
{
Projectile.width = 2;
Projectile.height = 20;
Projectile.aiStyle = 1;
Projectile.friendly = true;
Projectile.hostile = false;
Projectile.penetrate = 1;
Projectile.timeLeft = 600;
Projectile.alpha = 255;
Projectile.light = 0.5f;
Projectile.ignoreWater = false;
Projectile.tileCollide = true;
Projectile.extraUpdates = 2;
AIType = 14;
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 148 B

+25
View File
@@ -0,0 +1,25 @@
using Terraria;
using Terraria.ModLoader;
namespace FabusMod.Projectiles;
public class PulseBulletBlue : ModProjectile
{
public override void SetDefaults()
{
Projectile.width = 2;
Projectile.height = 20;
Projectile.aiStyle = 1;
Projectile.friendly = true;
Projectile.hostile = false;
Projectile.penetrate = 1;
Projectile.timeLeft = 600;
Projectile.alpha = 255;
Projectile.light = 0.5f;
Projectile.ignoreWater = false;
Projectile.tileCollide = true;
Projectile.extraUpdates = 2;
AIType = 14;
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 155 B

+25
View File
@@ -0,0 +1,25 @@
using Terraria;
using Terraria.ModLoader;
namespace FabusMod.Projectiles;
public class PulseBulletGolden : ModProjectile
{
public override void SetDefaults()
{
Projectile.width = 2;
Projectile.height = 20;
Projectile.aiStyle = 1;
Projectile.friendly = true;
Projectile.hostile = false;
Projectile.penetrate = 1;
Projectile.timeLeft = 600;
Projectile.alpha = 255;
Projectile.light = 0.5f;
Projectile.ignoreWater = false;
Projectile.tileCollide = true;
Projectile.extraUpdates = 2;
AIType = 14;
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 157 B

+25
View File
@@ -0,0 +1,25 @@
using Terraria;
using Terraria.ModLoader;
namespace FabusMod.Projectiles;
public class PulseBulletPink : ModProjectile
{
public override void SetDefaults()
{
Projectile.width = 2;
Projectile.height = 20;
Projectile.aiStyle = 1;
Projectile.friendly = true;
Projectile.hostile = false;
Projectile.penetrate = 1;
Projectile.timeLeft = 600;
Projectile.alpha = 255;
Projectile.light = 0.5f;
Projectile.ignoreWater = false;
Projectile.tileCollide = true;
Projectile.extraUpdates = 2;
AIType = 14;
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 158 B

+57
View File
@@ -0,0 +1,57 @@
using Terraria;
using Terraria.ModLoader;
namespace FabusMod.Projectiles;
public class RainbowAxeBeam : ModProjectile
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Rainbow Axe Beam");
}
public override void SetDefaults()
{
Projectile.width = 46;
Projectile.height = 52;
Projectile.aiStyle = 18;
Projectile.friendly = true;
Projectile.penetrate = -1;
Projectile.tileCollide = false;
AIType = 274;
Projectile.timeLeft = 200;
Projectile.alpha = 0;
}
public override void AI()
{
if (Projectile.alpha <= 140)
{
Projectile projectile = Projectile;
projectile.alpha++;
}
if (Projectile.alpha > 140)
{
Projectile projectile2 = Projectile;
projectile2.alpha += 15;
}
if (Utils.NextFloat(Main.rand) < 0.1f && Projectile.alpha <= 100)
{
int dust1 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.RainbowDust>(), 0f, 0f, 0, default, 1f);
int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.RainbowDust2>(), 0f, 0f, 0, default, 1f);
int dust3 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.RainbowDust3>(), 0f, 0f, 0, default, 1f);
Main.dust[dust1].scale = 0.9f;
Dust obj = Main.dust[dust1];
obj.velocity *= 0.1f;
Main.dust[dust1].noGravity = true;
Main.dust[dust2].scale = 0.9f;
Dust obj2 = Main.dust[dust2];
obj2.velocity *= 0.1f;
Main.dust[dust2].noGravity = true;
Main.dust[dust3].scale = 0.9f;
Dust obj3 = Main.dust[dust3];
obj3.velocity *= 0.1f;
Main.dust[dust3].noGravity = true;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

+97
View File
@@ -0,0 +1,97 @@
using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ModLoader;
namespace FabusMod.Projectiles;
public class RainbowBullet : ModProjectile
{
public override void SetStaticDefaults()
{
//Sets.Homing[Projectile.type] = true;
}
public override void SetDefaults()
{
Projectile.width = 2;
Projectile.height = 20;
Projectile.aiStyle = 1;
Projectile.friendly = true;
Projectile.hostile = false;
Projectile.penetrate = 1;
Projectile.timeLeft = 600;
Projectile.alpha = 255;
Projectile.light = 0.5f;
Projectile.ignoreWater = false;
Projectile.tileCollide = true;
Projectile.extraUpdates = 2;
AIType = 14;
}
public override void AI()
{
if (Projectile.alpha > 70)
{
Projectile projectile = Projectile;
projectile.alpha -= 15;
if (Projectile.alpha < 70)
{
Projectile.alpha = 70;
}
}
if (Projectile.localAI[0] == 0f)
{
AdjustMagnitude(ref Projectile.velocity);
Projectile.localAI[0] = 1f;
}
Vector2 move = Vector2.Zero;
float distance = 200f;
bool target = false;
for (int i = 0; i < 200; i++)
{
if (Main.npc[i].active && !Main.npc[i].dontTakeDamage && !Main.npc[i].friendly && Main.npc[i].lifeMax > 5)
{
Vector2 newMove = Main.npc[i].Center - Projectile.Center;
float distanceTo = (float)Math.Sqrt(newMove.X * newMove.X + newMove.Y * newMove.Y);
if (distanceTo < distance)
{
move = newMove;
distance = distanceTo;
target = true;
}
}
}
if (target)
{
AdjustMagnitude(ref move);
Projectile.velocity = (5f * Projectile.velocity + move) / 6f;
AdjustMagnitude(ref Projectile.velocity);
}
if (Main.rand.NextBool(3))
{
int dust1 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.RainbowDust>(), 0f, 0f, 0, default, 1f);
int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.RainbowDust2>(), 0f, 0f, 0, default, 1f);
int dust3 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.RainbowDust3>(), 0f, 0f, 0, default, 1f);
Dust obj = Main.dust[dust1];
obj.velocity *= 0f;
Main.dust[dust1].noGravity = true;
Dust obj2 = Main.dust[dust2];
obj2.velocity *= 0f;
Main.dust[dust2].noGravity = true;
Dust obj3 = Main.dust[dust3];
obj3.velocity *= 0f;
Main.dust[dust3].noGravity = true;
}
}
private void AdjustMagnitude(ref Vector2 vector)
{
float magnitude = (float)Math.Sqrt(vector.X * vector.X + vector.Y * vector.Y);
if (magnitude > 6f)
{
vector *= 6f / magnitude;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 200 B

@@ -0,0 +1,83 @@
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
namespace FabusMod.Projectiles.RainbowDemon;
public class RainbowDemonArrow : ModProjectile
{
private const int alphaReducation = 25;
public override void SetDefaults()
{
Projectile.width = 18;
Projectile.height = 34;
Projectile.friendly = true;
Projectile.tileCollide = true;
Projectile.ignoreWater = false;
Projectile.timeLeft = 1000;
Projectile.light = 1f;
AIType = 1;
Projectile.aiStyle = 1;
Projectile.alpha = 0;
}
public override void AI()
{
if (Projectile.alpha > 30)
{
Projectile projectile = Projectile;
projectile.alpha -= 15;
if (Projectile.alpha < 30)
{
Projectile.alpha = 30;
}
}
if (Utils.NextFloat(Main.rand) < 0.1f && Projectile.alpha <= 100)
{
int dust1 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.RainbowDust>(), 0f, 0f, 0, default, 1f);
int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.RainbowDust2>(), 0f, 0f, 0, default, 1f);
int dust3 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.RainbowDust3>(), 0f, 0f, 0, default, 1f);
Main.dust[dust1].scale = 0.9f;
Dust obj = Main.dust[dust1];
obj.velocity *= 0.1f;
Main.dust[dust1].noGravity = true;
Main.dust[dust2].scale = 0.9f;
Dust obj2 = Main.dust[dust2];
obj2.velocity *= 0.1f;
Main.dust[dust2].noGravity = true;
Main.dust[dust3].scale = 0.9f;
Dust obj3 = Main.dust[dust3];
obj3.velocity *= 0.1f;
Main.dust[dust3].noGravity = true;
}
}
public override void Kill(int timeLeft)
{
for (int i = 0; i < 5; i++)
{
if (Utils.NextFloat(Main.rand) < 0.1f && Projectile.alpha <= 100)
{
int dust1 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.RainbowDust>(), 0f, 0f, 0, default, 1f);
int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.RainbowDust2>(), 0f, 0f, 0, default, 1f);
int dust3 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.RainbowDust3>(), 0f, 0f, 0, default, 1f);
Main.dust[dust1].scale = 0.9f;
Dust obj = Main.dust[dust1];
obj.velocity *= 0.1f;
Main.dust[dust1].noGravity = true;
Main.dust[dust2].scale = 0.9f;
Dust obj2 = Main.dust[dust2];
obj2.velocity *= 0.1f;
Main.dust[dust2].noGravity = true;
Main.dust[dust3].scale = 0.9f;
Dust obj3 = Main.dust[dust3];
obj3.velocity *= 0.1f;
Main.dust[dust3].noGravity = true;
}
}
SoundEngine.PlaySound(SoundID.Item1, Projectile.position);
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 583 B

@@ -0,0 +1,110 @@
using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace FabusMod.Projectiles.RainbowDemon;
public class RainbowDemonClaymoreProj : ModProjectile
{
public override void SetStaticDefaults()
{
//ProjectileID.Sets.Homing[Projectile.type] = true;
Main.projFrames[Projectile.type] = 4;
}
public override void SetDefaults()
{
Projectile.width = 40;
Projectile.height = 42;
Projectile.alpha = 255;
Projectile.friendly = true;
Projectile.tileCollide = false;
Projectile.ignoreWater = true;
Projectile.timeLeft = 300;
}
public override void AI()
{
if (Projectile.alpha > 70)
{
Projectile projectile = Projectile;
projectile.alpha -= 15;
if (Projectile.alpha < 70)
{
Projectile.alpha = 70;
}
}
if (Projectile.localAI[0] == 0f)
{
AdjustMagnitude(ref Projectile.velocity);
Projectile.localAI[0] = 1f;
}
Vector2 move = Vector2.Zero;
float distance = 200f;
bool target = false;
for (int i = 0; i < 200; i++)
{
if (Main.npc[i].active && !Main.npc[i].dontTakeDamage && !Main.npc[i].friendly && Main.npc[i].lifeMax > 5)
{
Vector2 newMove = Main.npc[i].Center - Projectile.Center;
float distanceTo = (float)Math.Sqrt(newMove.X * newMove.X + newMove.Y * newMove.Y);
if (distanceTo < distance)
{
move = newMove;
distance = distanceTo;
target = true;
}
}
}
if (target)
{
AdjustMagnitude(ref move);
Projectile.velocity = (10f * Projectile.velocity + move) / 11f;
AdjustMagnitude(ref Projectile.velocity);
}
if (Utils.NextFloat(Main.rand) < 0.1f && Projectile.alpha <= 100)
{
int dust1 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.RainbowDust>(), 0f, 0f, 0, default, 1f);
int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.RainbowDust2>(), 0f, 0f, 0, default, 1f);
int dust3 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.RainbowDust3>(), 0f, 0f, 0, default, 1f);
Main.dust[dust1].scale = 0.9f;
Dust obj = Main.dust[dust1];
obj.velocity *= 0.1f;
Main.dust[dust1].noGravity = true;
Main.dust[dust2].scale = 0.9f;
Dust obj2 = Main.dust[dust2];
obj2.velocity *= 0.1f;
Main.dust[dust2].noGravity = true;
Main.dust[dust3].scale = 0.9f;
Dust obj3 = Main.dust[dust3];
obj3.velocity *= 0.1f;
Main.dust[dust3].noGravity = true;
}
AnimateProjectile();
}
private void AdjustMagnitude(ref Vector2 vector)
{
float magnitude = (float)Math.Sqrt(vector.X * vector.X + vector.Y * vector.Y);
if (magnitude > 6f)
{
vector *= 6f / magnitude;
}
}
public void AnimateProjectile()
{
Projectile projectile = Projectile;
projectile.frameCounter++;
if (Projectile.frameCounter >= 5)
{
Projectile projectile2 = Projectile;
projectile2.frame++;
Projectile projectile3 = Projectile;
projectile3.frame %= 3;
Projectile.frameCounter = 0;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

@@ -0,0 +1,84 @@
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ModLoader;
using Terraria.ID;
namespace FabusMod.Projectiles.RainbowDemon;
public class RainbowDemonKnife : ModProjectile
{
private const int alphaReducation = 25;
private const float maxTicks = 70f;
public override void SetDefaults()
{
Projectile.width = 16;
Projectile.height = 34;
Projectile.aiStyle = 2;
Projectile.friendly = true;
Projectile.penetrate = 1;
AIType = 48;
Projectile.alpha = 255;
}
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
{
if (targetHitbox.Width > 8 && targetHitbox.Height > 8)
{
targetHitbox.Inflate(-targetHitbox.Width / 8, -targetHitbox.Height / 8);
}
return projHitbox.Intersects(targetHitbox);
}
public override void Kill(int timeLeft)
{
Vector2 position = Projectile.position;
Vector2 rotVector = Utils.ToRotationVector2(Projectile.rotation - MathHelper.ToRadians(90f));
_ = position + rotVector * 16f;
int item = 0;
if (Main.netMode == NetmodeID.MultiplayerClient && item >= 0)
{
NetMessage.SendData(MessageID.KillProjectile, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0);
}
}
public override void AI()
{
if (Projectile.alpha > 30)
{
Projectile projectile = Projectile;
projectile.alpha -= 15;
if (Projectile.alpha < 30)
{
Projectile.alpha = 30;
}
}
if (Utils.NextFloat(Main.rand) < 0.1f && Projectile.alpha <= 100)
{
int dust1 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.RainbowDust>(), 0f, 0f, 0, default, 1f);
int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.RainbowDust2>(), 0f, 0f, 0, default, 1f);
int dust3 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.RainbowDust3>(), 0f, 0f, 0, default, 1f);
Main.dust[dust1].scale = 0.9f;
Dust obj = Main.dust[dust1];
obj.velocity *= 0.1f;
Main.dust[dust1].noGravity = true;
Main.dust[dust2].scale = 0.9f;
Dust obj2 = Main.dust[dust2];
obj2.velocity *= 0.1f;
Main.dust[dust2].noGravity = true;
Main.dust[dust3].scale = 0.9f;
Dust obj3 = Main.dust[dust3];
obj3.velocity *= 0.1f;
Main.dust[dust3].noGravity = true;
}
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
if (Main.rand.NextBool(1))
{
target.AddBuff(70, 720, false);
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 508 B

@@ -0,0 +1,78 @@
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
namespace FabusMod.Projectiles.RainbowDemon;
public class RainbowDemonMagicBall : ModProjectile
{
private const int alphaReducation = 25;
public override void SetDefaults()
{
Projectile.width = 10;
Projectile.height = 10;
Projectile.light = 1f;
AIType = 1;
Projectile.aiStyle = 1;
Projectile.friendly = true;
Projectile.penetrate = 1;
Projectile.timeLeft = 600;
Projectile.alpha = 0;
}
public override void AI()
{
if (Utils.NextFloat(Main.rand) < 0.1f && Projectile.alpha <= 100)
{
int dust1 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.RainbowDust>(), 0f, 0f, 0, default, 1f);
int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.RainbowDust2>(), 0f, 0f, 0, default, 1f);
int dust3 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.RainbowDust3>(), 0f, 0f, 0, default, 1f);
Main.dust[dust1].scale = 0.9f;
Dust obj = Main.dust[dust1];
obj.velocity *= 0.1f;
Main.dust[dust1].noGravity = true;
Main.dust[dust2].scale = 0.9f;
Dust obj2 = Main.dust[dust2];
obj2.velocity *= 0.1f;
Main.dust[dust2].noGravity = true;
Main.dust[dust3].scale = 0.9f;
Dust obj3 = Main.dust[dust3];
obj3.velocity *= 0.1f;
Main.dust[dust3].noGravity = true;
}
}
public override bool OnTileCollide(Vector2 oldVelocity)
{
Projectile projectile = Projectile;
projectile.penetrate--;
if (Projectile.penetrate <= 0)
{
Projectile.Kill();
}
else
{
Projectile.ai[0] += 0.1f;
if (Projectile.velocity.X != oldVelocity.X)
{
Projectile.velocity.X = 0f - oldVelocity.X;
}
if (Projectile.velocity.Y != oldVelocity.Y)
{
Projectile.velocity.Y = 0f - oldVelocity.Y;
}
Projectile projectile2 = Projectile;
projectile2.velocity = projectile2.velocity * 0.75f;
SoundEngine.PlaySound(SoundID.Item27, Projectile.position);
}
return false;
}
public override void Kill(int timeLeft)
{
SoundEngine.PlaySound(SoundID.Item27, Projectile.position);
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 414 B

@@ -0,0 +1,90 @@
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ModLoader;
using Terraria.ID;
namespace FabusMod.Projectiles.RainbowDemon;
public class RainbowDemonMelee : ModProjectile
{
private const float maxTicks = 300f;
private const int alphaReducation = 25;
public override void SetDefaults()
{
Projectile.width = 80;
Projectile.height = 48;
Projectile.aiStyle = 28;
Projectile.friendly = true;
Projectile.penetrate = 1;
Projectile.tileCollide = false;
Projectile.timeLeft = 200;
Projectile.alpha = 255;
}
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
{
if (targetHitbox.Width > 8 && targetHitbox.Height > 8)
{
targetHitbox.Inflate(-targetHitbox.Width / 8, -targetHitbox.Height / 8);
}
return projHitbox.Intersects(targetHitbox);
}
public override void Kill(int timeLeft)
{
Vector2 position = Projectile.position;
Vector2 rotVector = Utils.ToRotationVector2(Projectile.rotation - MathHelper.ToRadians(90f));
_ = position + rotVector * 16f;
int item = 0;
if (Main.netMode == NetmodeID.MultiplayerClient && item >= 0)
{
NetMessage.SendData(MessageID.KillProjectile, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0);
}
}
public override void AI()
{
if (Projectile.alpha > 30)
{
Projectile projectile = Projectile;
projectile.alpha -= 15;
if (Projectile.alpha < 30)
{
Projectile.alpha = 30;
}
}
if (Projectile.ai[0] == 0f)
{
Projectile.ai[1] += 1f;
if (Projectile.ai[1] >= maxTicks)
{
float velXmult = 0.98f;
float velYmult = 0.35f;
Projectile.ai[1] = maxTicks;
Projectile.velocity.X = Projectile.velocity.X * velXmult;
Projectile.velocity.Y = Projectile.velocity.Y + velYmult;
}
Projectile.rotation = Utils.ToRotation(Projectile.velocity) + MathHelper.ToRadians(90f);
}
if (Utils.NextFloat(Main.rand) < 0.1f && Projectile.alpha <= 100)
{
int dust1 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.RainbowDust>(), 0f, 0f, 0, default, 1f);
int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.RainbowDust2>(), 0f, 0f, 0, default, 1f);
int dust3 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.RainbowDust3>(), 0f, 0f, 0, default, 1f);
Main.dust[dust1].scale = 0.9f;
Dust obj = Main.dust[dust1];
obj.velocity *= 0.1f;
Main.dust[dust1].noGravity = true;
Main.dust[dust2].scale = 0.9f;
Dust obj2 = Main.dust[dust2];
obj2.velocity *= 0.1f;
Main.dust[dust2].noGravity = true;
Main.dust[dust3].scale = 0.9f;
Dust obj3 = Main.dust[dust3];
obj3.velocity *= 0.1f;
Main.dust[dust3].noGravity = true;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

@@ -0,0 +1,53 @@
using Terraria;
using Terraria.ModLoader;
namespace FabusMod.Projectiles.RainbowDemon;
public class RainbowDemonShredderProj : ModProjectile
{
private const int alphaReducation = 25;
public override void SetDefaults()
{
Projectile.width = 46;
Projectile.height = 52;
Projectile.aiStyle = 18;
Projectile.friendly = true;
Projectile.penetrate = 1;
Projectile.tileCollide = false;
AIType = 274;
Projectile.timeLeft = 200;
Projectile.alpha = 255;
}
public override void AI()
{
if (Projectile.alpha > 30)
{
Projectile projectile = Projectile;
projectile.alpha -= 15;
if (Projectile.alpha < 30)
{
Projectile.alpha = 30;
}
}
if (Utils.NextFloat(Main.rand) < 0.1f && Projectile.alpha <= 100)
{
int dust1 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.RainbowDust>(), 0f, 0f, 0, default, 1f);
int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.RainbowDust2>(), 0f, 0f, 0, default, 1f);
int dust3 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.RainbowDust3>(), 0f, 0f, 0, default, 1f);
Main.dust[dust1].scale = 0.9f;
Dust obj = Main.dust[dust1];
obj.velocity *= 0.1f;
Main.dust[dust1].noGravity = true;
Main.dust[dust2].scale = 0.9f;
Dust obj2 = Main.dust[dust2];
obj2.velocity *= 0.1f;
Main.dust[dust2].noGravity = true;
Main.dust[dust3].scale = 0.9f;
Dust obj3 = Main.dust[dust3];
obj3.velocity *= 0.1f;
Main.dust[dust3].noGravity = true;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

+109
View File
@@ -0,0 +1,109 @@
using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ModLoader;
namespace FabusMod.Projectiles;
public class RainbowOrb : ModProjectile
{
public override void SetStaticDefaults()
{
//Sets.Homing[Projectile.type] = true;
Main.projFrames[Projectile.type] = 4;
}
public override void SetDefaults()
{
Projectile.width = 40;
Projectile.height = 42;
Projectile.alpha = 255;
Projectile.friendly = true;
Projectile.tileCollide = false;
Projectile.ignoreWater = true;
Projectile.timeLeft = 300;
}
public override void AI()
{
if (Projectile.alpha > 70)
{
Projectile projectile = Projectile;
projectile.alpha -= 15;
if (Projectile.alpha < 70)
{
Projectile.alpha = 70;
}
}
if (Projectile.localAI[0] == 0f)
{
AdjustMagnitude(ref Projectile.velocity);
Projectile.localAI[0] = 1f;
}
Vector2 move = Vector2.Zero;
float distance = 200f;
bool target = false;
for (int i = 0; i < 200; i++)
{
if (Main.npc[i].active && !Main.npc[i].dontTakeDamage && !Main.npc[i].friendly && Main.npc[i].lifeMax > 5)
{
Vector2 newMove = Main.npc[i].Center - Projectile.Center;
float distanceTo = (float)Math.Sqrt(newMove.X * newMove.X + newMove.Y * newMove.Y);
if (distanceTo < distance)
{
move = newMove;
distance = distanceTo;
target = true;
}
}
}
if (target)
{
AdjustMagnitude(ref move);
Projectile.velocity = (10f * Projectile.velocity + move) / 11f;
AdjustMagnitude(ref Projectile.velocity);
}
if (Utils.NextFloat(Main.rand) < 0.1f && Projectile.alpha <= 100)
{
int dust1 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.RainbowDust>(), 0f, 0f, 0, default, 1f);
int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.RainbowDust2>(), 0f, 0f, 0, default, 1f);
int dust3 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.RainbowDust3>(), 0f, 0f, 0, default, 1f);
Main.dust[dust1].scale = 0.9f;
Dust obj = Main.dust[dust1];
obj.velocity *= 0.1f;
Main.dust[dust1].noGravity = true;
Main.dust[dust2].scale = 0.9f;
Dust obj2 = Main.dust[dust2];
obj2.velocity *= 0.1f;
Main.dust[dust2].noGravity = true;
Main.dust[dust3].scale = 0.9f;
Dust obj3 = Main.dust[dust3];
obj3.velocity *= 0.1f;
Main.dust[dust3].noGravity = true;
}
AnimateProjectile();
}
private void AdjustMagnitude(ref Vector2 vector)
{
float magnitude = (float)Math.Sqrt(vector.X * vector.X + vector.Y * vector.Y);
if (magnitude > 6f)
{
vector *= 6f / magnitude;
}
}
public void AnimateProjectile()
{
Projectile projectile = Projectile;
projectile.frameCounter++;
if (Projectile.frameCounter >= 5)
{
Projectile projectile2 = Projectile;
projectile2.frame++;
Projectile projectile3 = Projectile;
projectile3.frame %= 3;
Projectile.frameCounter = 0;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

+39
View File
@@ -0,0 +1,39 @@
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ModLoader;
namespace FabusMod.Projectiles.Shimada;
public class BloodDrop : ModProjectile
{
private const float maxTicks = 45f;
private const int alphaReducation = 25;
public override void SetDefaults()
{
Projectile.width = 16;
Projectile.height = 20;
AIType = 1;
Projectile.aiStyle = 1;
Projectile.friendly = true;
Projectile.penetrate = 1;
}
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
{
if (targetHitbox.Width > 8 && targetHitbox.Height > 8)
{
targetHitbox.Inflate(-targetHitbox.Width / 8, -targetHitbox.Height / 8);
}
return projHitbox.Intersects(targetHitbox);
}
public override void AI()
{
if (Main.rand.NextBool(3)&& Projectile.alpha <= 100)
{
Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.BloodDust>(), 0f, 0f, 0, default, 1f);
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 244 B

+108
View File
@@ -0,0 +1,108 @@
using FabusMod.Buffs.ShimadaSword.Stacks;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
namespace FabusMod.Projectiles.Shimada;
public class DemonProjRMB : ModProjectile
{
public override void SetStaticDefaults()
{
Main.projFrames[Projectile.type] = 14;
}
public override void SetDefaults()
{
Projectile.width = 300;
Projectile.height = 132;
Projectile.friendly = true;
Projectile.hostile = false;
Projectile.penetrate = -1;
Projectile.timeLeft = 42;
Projectile.alpha = 80;
Projectile.light = 0.5f;
Projectile.ignoreWater = true;
Projectile.tileCollide = false;
Projectile.extraUpdates = 0;
Projectile.velocity = Projectile.velocity * 0f;
}
public override void AI()
{
AnimateProjectile();
if (Main.rand.NextBool(2))
{
int num1 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.BloodDust>(), 0f, 0f, 0, default, 1f);
Main.dust[num1].scale = 1.9f;
Main.dust[num1].velocity.Y -= 1.5f;
Main.dust[num1].velocity.X = 0f;
Main.dust[num1].noGravity = true;
}
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
if (Projectile.owner != Main.myPlayer)
{
return;
}
Player player = Main.player[Projectile.owner];
if (!(Utils.NextFloat(Main.rand) < 0.02f))
{
return;
}
if (!player.HasBuff(ModContent.BuffType<SouleaterOne>()) && !player.HasBuff(ModContent.BuffType<SouleaterTwo>()) && !player.HasBuff(ModContent.BuffType<SouleaterThree>()) && !player.HasBuff(ModContent.BuffType<SouleaterFour>()) && !player.HasBuff(ModContent.BuffType<SouleaterFive>()))
{
player.AddBuff(ModContent.BuffType<SouleaterOne>(), 960, true);
}
else if (player.HasBuff(ModContent.BuffType<SouleaterOne>()))
{
player.ClearBuff(ModContent.BuffType<SouleaterOne>());
player.AddBuff(ModContent.BuffType<SouleaterTwo>(), 960, true);
}
else if (player.HasBuff(ModContent.BuffType<SouleaterTwo>()))
{
player.ClearBuff(ModContent.BuffType<SouleaterTwo>());
player.AddBuff(ModContent.BuffType<SouleaterThree>(), 960, true);
}
else if (player.HasBuff(ModContent.BuffType<SouleaterThree>()))
{
player.ClearBuff(ModContent.BuffType<SouleaterThree>());
player.AddBuff(ModContent.BuffType<SouleaterFour>(), 960, true);
}
else if (player.HasBuff(ModContent.BuffType<SouleaterFour>()))
{
player.ClearBuff(ModContent.BuffType<SouleaterFour>());
player.AddBuff(ModContent.BuffType<SouleaterFive>(), 960, true);
}
else if (player.HasBuff(ModContent.BuffType<SouleaterFive>()))
{
player.ClearBuff(ModContent.BuffType<SouleaterFive>());
player.statLife += 75;
player.statMana += 75;
if (Main.myPlayer == player.whoAmI)
{
player.HealEffect(75, true);
player.ManaEffect(75);
SoundEngine.PlaySound(SoundID.Item3);
SoundEngine.PlaySound(SoundID.Item4);
}
}
}
public void AnimateProjectile()
{
Projectile projectile = Projectile;
projectile.frameCounter++;
if (Projectile.frameCounter >= 3)
{
Projectile projectile2 = Projectile;
projectile2.frame++;
Projectile projectile3 = Projectile;
projectile3.frame %= 14;
Projectile.frameCounter = 0;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Some files were not shown because too many files have changed in this diff Show More