Commit of decompiled and "updated" code.
@@ -0,0 +1,52 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.ID;
|
||||
|
||||
namespace FabusMod.Projectiles.Shortsword;
|
||||
|
||||
public class CarbonKnife : ModProjectile
|
||||
{
|
||||
private const float maxTicks = 70f;
|
||||
|
||||
private const int alphaReducation = 25;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Carbon Knife");
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.CloneDefaults(304);
|
||||
AIType = 304;
|
||||
Projectile.width = 14;
|
||||
Projectile.height = 30;
|
||||
Projectile.aiStyle = 2;
|
||||
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 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 297 B |
@@ -0,0 +1,52 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.ID;
|
||||
|
||||
namespace FabusMod.Projectiles.Shortsword;
|
||||
|
||||
public class CarbonKnifeNihon : ModProjectile
|
||||
{
|
||||
private const float maxTicks = 70f;
|
||||
|
||||
private const int alphaReducation = 25;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Carbon Knife - Nihon");
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.CloneDefaults(304);
|
||||
AIType = 304;
|
||||
Projectile.width = 14;
|
||||
Projectile.height = 30;
|
||||
Projectile.aiStyle = 2;
|
||||
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 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 297 B |
@@ -0,0 +1,52 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.ID;
|
||||
|
||||
namespace FabusMod.Projectiles.Shortsword;
|
||||
|
||||
public class DeathBlossom : ModProjectile
|
||||
{
|
||||
private const float maxTicks = 70f;
|
||||
|
||||
private const int alphaReducation = 25;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Death Blossom Knife");
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.CloneDefaults(304);
|
||||
AIType = 304;
|
||||
Projectile.width = 14;
|
||||
Projectile.height = 30;
|
||||
Projectile.aiStyle = 2;
|
||||
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 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 297 B |
@@ -0,0 +1,73 @@
|
||||
using System;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace FabusMod.Projectiles.Shortsword;
|
||||
|
||||
public class FumaShuriken : ModProjectile
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
//Sets.Homing[Projectile.type] = true;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 32;
|
||||
Projectile.height = 32;
|
||||
Projectile.aiStyle = 2;
|
||||
Projectile.friendly = true;
|
||||
Projectile.penetrate = 1;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.tileCollide = true;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
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 = 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 num1 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.RyuuDust>(), 0f, 0f, 0, default, 1f);
|
||||
Dust obj = Main.dust[num1];
|
||||
obj.velocity *= 0f;
|
||||
Main.dust[num1].noGravity = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void AdjustMagnitude(ref Vector2 vector)
|
||||
{
|
||||
float magnitude = (float)Math.Sqrt(vector.X * vector.X + vector.Y * vector.Y);
|
||||
if (magnitude > 16f)
|
||||
{
|
||||
vector *= 16f / magnitude;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 488 B |
@@ -0,0 +1,52 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.ID;
|
||||
|
||||
namespace FabusMod.Projectiles.Shortsword;
|
||||
|
||||
public class GoldenKnife : ModProjectile
|
||||
{
|
||||
private const float maxTicks = 70f;
|
||||
|
||||
private const int alphaReducation = 25;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Golden Knife");
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.CloneDefaults(304);
|
||||
AIType = 304;
|
||||
Projectile.width = 14;
|
||||
Projectile.height = 30;
|
||||
Projectile.aiStyle = 2;
|
||||
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 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 315 B |
@@ -0,0 +1,52 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.ID;
|
||||
|
||||
namespace FabusMod.Projectiles.Shortsword;
|
||||
|
||||
public class RainbowKnife : ModProjectile
|
||||
{
|
||||
private const float maxTicks = 70f;
|
||||
|
||||
private const int alphaReducation = 25;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Rainbow Knife");
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.CloneDefaults(304);
|
||||
AIType = 304;
|
||||
Projectile.width = 14;
|
||||
Projectile.height = 30;
|
||||
Projectile.aiStyle = 2;
|
||||
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 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 375 B |
@@ -0,0 +1,14 @@
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace FabusMod.Projectiles.Shortsword;
|
||||
|
||||
public class Substitute : ModProjectile
|
||||
{
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 32;
|
||||
Projectile.height = 32;
|
||||
Projectile.friendly = true;
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 127 B |