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
@@ -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