Merge: Xyk's Greatsword of Judgement and Orderbringer reworks

Also fixes Calamity to universally use Judgement (with the E) everywhere
This commit is contained in:
Cameron Ewell authored and GitHub committed 2024-08-08 13:18:16 -04:00
commit 6e2affc68a
19 files changed
+547 -180

No files matched your search

+67 -6
View File
@@ -1,31 +1,92 @@
using CalamityMod.Projectiles.Melee;
using CalamityMod.Dusts;
using CalamityMod.Particles;
using CalamityMod.Projectiles.Melee;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria.Audio;
namespace CalamityMod.Items.Weapons.Melee
{
public class GreatswordofJudgement : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Weapons.Melee";
private float swingRoatation = 0;
private int time = 0;
private Color mainColor;
private int swordDirection;
private int useTime = 20;
private int opacityAdjust = 0;
private float smearOpacity = 0;
private bool smearGrowth = true;
public override void SetDefaults()
{
Item.width = 78;
Item.height = 78;
Item.damage = 85;
Item.damage = 155;
Item.DamageType = DamageClass.Melee;
Item.useAnimation = 18;
Item.useStyle = ItemUseStyleID.Swing;
Item.useTime = 18;
Item.useTime = Item.useAnimation = useTime;
Item.useTurn = true;
Item.knockBack = 7f;
Item.UseSound = SoundID.Item1;
Item.UseSound = SoundID.Item60;
Item.autoReuse = true;
Item.value = CalamityGlobalItem.RarityPurpleBuyPrice;
Item.rare = ItemRarityID.Purple;
Item.shoot = ModContent.ProjectileType<JudgementProj>();
Item.shootSpeed = 10f;
Item.shootSpeed = 5f;
}
public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox)
{
float scale = 1.1f;
Vector2 newSize = new Point(hitbox.Width, hitbox.Height).ToVector2() * scale;
hitbox = new Rectangle(hitbox.X - (int)((newSize.X - hitbox.Width) / 2f), hitbox.Y - (int)((newSize.Y - hitbox.Height) / 2f), (int)newSize.X, (int)newSize.Y);
}
public override void UseAnimation(Player player)
{
swordDirection = player.direction;
time = 0;
swingRoatation = 0;
mainColor = Main.rand.NextBool() ? Color.MediumPurple : Color.MediumOrchid;
opacityAdjust = 0;
smearOpacity = 0;
}
public override void MeleeEffects(Player player, Rectangle hitbox)
{
opacityAdjust++;
if (opacityAdjust >= 5 && opacityAdjust <= 15 && smearOpacity < 0.9f)
smearOpacity += 0.1f;
else if (smearOpacity > 0)
smearOpacity -= 0.2f;
time++;
swingRoatation += swordDirection == 1 ? 0.13f : -0.13f;
float Rot = (swordDirection == -1 ? 1.8f : -1.8f) + swingRoatation;
if (swordDirection != player.direction)
{
swingRoatation *= -1;
swordDirection = player.direction;
}
Particle Smear = new SemiCircularSmearFade(player.Center, Vector2.Zero, mainColor * smearOpacity, Rot, Main.rand.NextFloat(1.95f, 2.2f), new Vector2(1, 1), 2, true, false, true, player.direction);
GeneralParticleHandler.SpawnParticle(Smear);
if (Main.rand.NextBool(3))
{
Vector2 dustVel = new Vector2(5 * swordDirection, -5).RotatedByRandom(1.55f) * Main.rand.NextFloat(0.7f, 1.3f);
Dust dust = Dust.NewDustPerfect(player.Center + dustVel * 9, 278);
dust.scale = Main.rand.NextFloat(0.4f, 0.55f);
dust.velocity = dustVel * 0.55f;
dust.color = Main.rand.NextBool() ? Color.MediumPurple : Color.MediumOrchid;
dust.noGravity = true;
}
}
public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI)
{
Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/Melee/GreatswordofJudgementGlow").Value);
}
public override void AddRecipes()
{
CreateRecipe().
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

+98 -8
View File
@@ -2,8 +2,17 @@
using CalamityMod.Projectiles.Melee;
using CalamityMod.Rarities;
using CalamityMod.Tiles.Furniture.CraftingStations;
using Terraria.Audio;
using Terraria.ID;
using Microsoft.Xna.Framework;
using Terraria.ModLoader;
using CalamityMod.Particles;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.DataStructures;
using Basic.Reference.Assemblies;
using System;
using Mono.Cecil;
namespace CalamityMod.Items.Weapons.Melee
{
@@ -11,23 +20,104 @@ namespace CalamityMod.Items.Weapons.Melee
public class Orderbringer : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Weapons.Melee";
private float swingRoatation = 0;
private int time = 0;
private Color mainColor;
private int swordDirection;
private int useTime = 18;
private int opacityAdjust = 0;
private float smearOpacity = 0;
private bool smearGrowth = true;
public override void SetDefaults()
{
Item.width = Item.height = 108;
Item.damage = 128;
Item.damage = 400;
Item.DamageType = DamageClass.Melee;
Item.useAnimation = 18;
Item.useTime = Item.useAnimation = useTime;
Item.useStyle = ItemUseStyleID.Swing;
Item.useTime = 18;
Item.useTurn = true;
Item.knockBack = 7f;
Item.UseSound = SoundID.Item1;
Item.knockBack = 8f;
Item.UseSound = SoundID.Item60;
Item.autoReuse = true;
Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice;
Item.rare = ModContent.RarityType<DarkBlue>();
Item.shoot = ModContent.ProjectileType<OrderbringerBeam>();
Item.shootSpeed = 6f;
Item.shoot = ModContent.ProjectileType<OrderbringerWaveProj>();
Item.shootSpeed = 5.5f;
}
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
{
Projectile.NewProjectile(source, position, velocity, type, (int)(damage * 0.5f), knockback, player.whoAmI, 0f);
for (int i = 0; i < 4; i++)
{
Vector2 vel = (velocity * 2.5f).RotatedByRandom(0.6f);
Projectile.NewProjectile(source, Main.MouseWorld - (velocity * 40) + Main.rand.NextVector2Circular(130, 130), vel * Main.rand.NextFloat(0.8f, 1.2f), ModContent.ProjectileType<StarofJudgement>(), (int)(damage * 0.25f), knockback * 0.2f, player.whoAmI, 0, 0, 1);
}
return false;
}
public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox)
{
float scale = 1.2f;
Vector2 newSize = new Point(hitbox.Width, hitbox.Height).ToVector2() * scale;
hitbox = new Rectangle(hitbox.X - (int)((newSize.X - hitbox.Width) / 2f), hitbox.Y - (int)((newSize.Y - hitbox.Height) / 2f), (int)newSize.X, (int)newSize.Y);
}
public override void UseAnimation(Player player)
{
swordDirection = player.direction;
time = 0;
swingRoatation = 0;
mainColor = Main.rand.NextBool() ? Color.MediumPurple : Color.MediumOrchid;
opacityAdjust = 0;
smearOpacity = 0;
}
public override void MeleeEffects(Player player, Rectangle hitbox)
{
opacityAdjust++;
if (opacityAdjust >= 5 && opacityAdjust <= 15 && smearOpacity < 0.9f)
smearOpacity += 0.1f;
else if (smearOpacity > 0)
smearOpacity -= 0.2f;
time++;
swingRoatation += swordDirection == 1 ? 0.17f : -0.17f;
float Rot = (swordDirection == -1 ? 1.8f : -1.8f) + swingRoatation;
if (swordDirection != player.direction)
{
swingRoatation *= -1;
swordDirection = player.direction;
}
Particle Smear = new SemiCircularSmearFade(player.Center, Vector2.Zero, mainColor * smearOpacity, Rot, Main.rand.NextFloat(2.8f, 3.2f), new Vector2(1, 1), 2, true, false, true, player.direction);
GeneralParticleHandler.SpawnParticle(Smear);
if (Main.rand.NextBool())
{
Vector2 dustVel = new Vector2(5 * swordDirection, -5).RotatedByRandom(1.55f) * Main.rand.NextFloat(0.7f, 1.3f) * 2;
Dust dust = Dust.NewDustPerfect(player.Center + dustVel * 9, 278);
dust.scale = Main.rand.NextFloat(0.5f, 0.75f);
dust.velocity = dustVel * 0.55f;
dust.color = Main.rand.NextBool() ? Color.MediumPurple : Color.MediumOrchid;
dust.noGravity = true;
}
}
public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone)
{
int beamDamage = player.CalcIntDamage<MeleeDamageClass>(Item.damage * 1.5f);
for (int i = 0; i < 2; i++)
{
Vector2 targetPos = Main.MouseWorld;
NPC target2 = Main.MouseWorld.ClosestNPCAt(650);
if (target2 != null)
targetPos = target2.Center + target2.velocity * 14;
Vector2 spawnPos = Main.MouseWorld + new Vector2(Main.rand.NextFloat(-300, 300), -900);
Vector2 vel = (targetPos - spawnPos).SafeNormalize(Vector2.UnitY) * 10;
Projectile.NewProjectile(player.GetSource_ItemUse(Item), spawnPos, vel, ModContent.ProjectileType<OrderbringerBeam>(), beamDamage, 0, player.whoAmI);
}
}
public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI)
{
Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/Melee/GreatswordofJudgementGlow").Value);
}
public override void AddRecipes()
@@ -466,7 +466,7 @@ LorePerforators: {
These creatures were unique. They wielded the slain Gods' power as purely as possible, veins flowing with spilt ichor.
All that exists in the Crimson is truly the divine turned inside out; their gore now glistens with perverse treachery for all to bear witness.
The mire reeks of centuries of vile manipulation and callous domination of the hapless.
Judgment has long passed and only extinction is left waiting.
Judgement has long passed and only extinction is left waiting.
'''
Tooltip: ""
}
@@ -674,14 +674,7 @@ GrandGuardian: {
GreatswordofJudgement: {
DisplayName: Greatsword of Judgement
Tooltip:
'''
Fires a white orb that emits white rain from where it dissipates for a time
A pale white sword from a forgotten land
You can hear faint yet comforting whispers emanating from the blade
'No matter where you may be you are never alone
I shall always be at your side, my lord'
'''
Tooltip: Fires a piercing energy wave that releases homing stars as it flies
}
Greentide: {
@@ -917,11 +910,10 @@ Orderbringer: {
DisplayName: Orderbringer
Tooltip:
'''
Fires a rainbow blade that emits rainbow rain from where it dissipated for a time
A pale white sword from a forgotten land
You can hear faint yet comforting whispers emanating from the blade
'No matter where you may be you are never alone
I shall always be at your side, my lord'
Fires piercing energy waves and summons four homing stars near your cursor
Energy waves deal more damage with each consecutive hit
Hits with the blade summon two beams from the sky
'No matter where you may be you are never alone'
'''
}
@@ -348,7 +348,7 @@ EclipsesFall: {
'''
Summons spears from the sky on hit
Stealth strikes impale enemies and summon a constant barrage of spears over time
'When the sun goes dark, you will know judgment'
'When the sun goes dark, you will know judgement'
'''
}
@@ -191,6 +191,7 @@ Orbacle.DisplayName: Auric Orb
OrderbringerAura.DisplayName: Aura
OrderbringerBeam.DisplayName: Orderbringer Beam
OrderbringerRain.DisplayName: Rain
OrderbringerWaveProj.DisplayName: Order-bringing Wave
OrderbringerWhiteOrb.DisplayName: Orderbringer Orb
PhoenixsPride.DisplayName: Phoenix's Pride
PhosphorescentGauntletPunches.DisplayName: Gauntlet Punch
@@ -240,6 +241,7 @@ SpineOfThanatosProjectile.DisplayName: Spine of Thanatos
StarburstBeam.DisplayName: Star Shiv
StarburstSHIV.DisplayName: SHIV
StarnightBeam.DisplayName: Starnight Beam
StarofJudgement.DisplayName: Star of Judgement
StellarContemptBlast.DisplayName: Stellar Blast
StellarContemptEcho.DisplayName: Echoes of Contempt
StellarContemptHammer.DisplayName: Stellar Contempt
+4 -3
View File
@@ -19,7 +19,8 @@ namespace CalamityMod.Particles
public bool RotateToVelocity;
public Vector2 Squish;
public bool ProduceLight;
public SemiCircularSmearFade(Vector2 position, Vector2 velocity, Color color, float rotation, float scale, Vector2 squish, int lifetime, bool playerCentered = false, bool rotateToVelocity = false, bool produceLight = true)
public int Direction = 1;
public SemiCircularSmearFade(Vector2 position, Vector2 velocity, Color color, float rotation, float scale, Vector2 squish, int lifetime, bool playerCentered = false, bool rotateToVelocity = false, bool produceLight = true, int direction = 1)
{
Position = position;
Velocity = velocity;
@@ -31,7 +32,7 @@ namespace CalamityMod.Particles
PlayerCentered = playerCentered;
RotateToVelocity = rotateToVelocity;
ProduceLight = produceLight;
Direction = direction;
}
public override void Update()
{
@@ -53,7 +54,7 @@ namespace CalamityMod.Particles
public override void CustomDraw(SpriteBatch spriteBatch)
{
Texture2D tex = ModContent.Request<Texture2D>(Texture).Value;
spriteBatch.Draw(tex, Position - Main.screenPosition, null, Color, Rotation, tex.Size() * 0.5f, Scale * Squish, 0, 0f);
spriteBatch.Draw(tex, Position - Main.screenPosition, null, Color, Rotation, tex.Size() * 0.5f, Scale * Squish, Direction == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, 0f);
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

+88 -47
View File
@@ -1,81 +1,122 @@
using System;
using CalamityMod.Buffs.DamageOverTime;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using CalamityMod.Particles;
using Terraria.ModLoader;
using CalamityMod.Projectiles.Ranged;
using Microsoft.Xna.Framework.Graphics;
using System.ComponentModel;
using Terraria.Utilities.Terraria.Utilities;
namespace CalamityMod.Projectiles.Melee
{
public class JudgementProj : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Melee";
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
int whiteLightTimer = 15;
public override string Texture => "CalamityMod/Projectiles/Melee/JudgementProj";
public ref float time => ref Projectile.ai[0];
public float hitboxSize = 10;
public Color mainColor;
public float fade = 1;
public float fadeOut = 1;
public override void SetDefaults()
{
Projectile.width = 12;
Projectile.height = 12;
Projectile.width = 336;
Projectile.height = 274;
Projectile.friendly = true;
Projectile.ignoreWater = true;
Projectile.penetrate = -1;
Projectile.timeLeft = 90;
Projectile.tileCollide = false;
Projectile.timeLeft = 450;
Projectile.DamageType = DamageClass.Melee;
Projectile.usesIDStaticNPCImmunity = true;
Projectile.idStaticNPCHitCooldown = 10;
Projectile.extraUpdates = 9;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = -1;
}
public override void AI()
{
whiteLightTimer--;
if (whiteLightTimer == 0)
Vector2 topCorner = Projectile.Center + (Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(100f)) * Projectile.scale) * 137;
Vector2 bottomCorner = Projectile.Center + (Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(-100f)) * Projectile.scale) * 137;
if (time == 0)
{
float spread = 180f * 0.0174f;
double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2;
double deltaAngle = spread / 8f;
double offsetAngle;
int i;
if (Projectile.owner == Main.myPlayer)
Projectile.scale = 0.0875f;
Projectile.velocity *= 0.9f;
mainColor = Main.rand.NextBool() ? Color.MediumPurple : Color.MediumOrchid;
}
Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2;
if (time < 200)
{
Projectile.scale += 0.0026f;
hitboxSize += 0.4525f;
Projectile.velocity *= 0.995f;
// Spawn 3
if (time % 50 == 0 && time > 10)
{
for (i = 0; i < 1; i++)
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center + Main.rand.NextVector2Circular(hitboxSize * 0.8f, hitboxSize * 0.8f) - Projectile.velocity * 2, (-Projectile.velocity * 3).RotatedByRandom(0.9f), ModContent.ProjectileType<StarofJudgement>(), (int)(Projectile.damage * 0.2f), 3f, Projectile.owner, 0f);
}
}
else
{
Projectile.velocity *= 0.975f;
}
if (time > 300 && fade > 0)
fade -= 0.0065f;
if (time < 250 && time > 20)
{
if (time < 200)
{
if (Projectile.timeLeft % 4 == 0)
{
offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i;
int projectile1 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType<WhiteOrb>(), Projectile.damage / 2, Projectile.knockBack * 0.5f, Projectile.owner);
int projectile2 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType<WhiteOrb>(), Projectile.damage / 2, Projectile.knockBack * 0.5f, Projectile.owner);
Main.projectile[projectile1].velocity.X *= 0.1f;
Main.projectile[projectile1].velocity.Y *= 0.1f;
Main.projectile[projectile2].velocity.X *= 0.1f;
Main.projectile[projectile2].velocity.Y *= 0.1f;
SparkParticle spark = new SparkParticle(topCorner, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(185f)), false, 15, 1f, mainColor * 0.25f);
GeneralParticleHandler.SpawnParticle(spark);
}
if (Projectile.timeLeft % 4 == 0)
{
SparkParticle spark = new SparkParticle(bottomCorner, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(-185f)), false, 15, 1f, mainColor * 0.25f);
GeneralParticleHandler.SpawnParticle(spark);
}
}
whiteLightTimer = 15;
if (Main.rand.NextBool(3))
{
Dust trailDust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(hitboxSize, hitboxSize) - Projectile.velocity * 2, 66);
trailDust.scale = Main.rand.NextFloat(0.7f, 0.85f) - (time < 150 ? 0 : time * 0.001f);
trailDust.velocity = -Projectile.velocity * Main.rand.NextFloat(0.85f, 1.5f);
trailDust.color = Main.rand.NextBool() ? Color.MediumPurple : Color.MediumOrchid;
trailDust.noGravity = true;
}
if (Main.rand.NextBool(12))
{
GlowOrbParticle orb = new GlowOrbParticle(topCorner, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(170f)) * Main.rand.NextFloat(10f, 30f), false, 17, Main.rand.NextFloat(0.4f, 0.75f), mainColor, true, true);
GeneralParticleHandler.SpawnParticle(orb);
GlowOrbParticle orb2 = new GlowOrbParticle(bottomCorner, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(-170f)) * Main.rand.NextFloat(10f, 30f), false, 17, Main.rand.NextFloat(0.4f, 0.75f), mainColor, true, true);
GeneralParticleHandler.SpawnParticle(orb2);
}
}
Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0.5f / 255f);
for (int i = 0; i < 2; i++)
{
int shinyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GemDiamond, 0f, 0f, 100, default, 1.25f);
Main.dust[shinyDust].noGravity = true;
Main.dust[shinyDust].velocity *= 0.5f;
Main.dust[shinyDust].velocity += Projectile.velocity * 0.1f;
}
CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 200f, 10f, 20f);
fadeOut = Utils.GetLerpValue(0, 180, Projectile.timeLeft, true);
time++;
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
public override bool PreDraw(ref Color lightColor)
{
target.AddBuff(ModContent.BuffType<Nightwither>(), 180);
Texture2D tex = ModContent.Request<Texture2D>(Texture).Value;
float waveFade = Utils.GetLerpValue(0, 300, Projectile.timeLeft);
Main.spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, mainColor with { A = 0 } * fadeOut, Projectile.rotation, tex.Size() / 2f, new Vector2(1 - (0.2f * waveFade), 1 + (0.45f * waveFade)) * Projectile.scale, SpriteEffects.None, 0);
return false;
}
public override void OnKill(int timeLeft)
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
{
SoundEngine.PlaySound(SoundID.Item122, Projectile.position);
if (Projectile.owner == Main.myPlayer)
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y - 100, 0f, 0f, ModContent.ProjectileType<WhiteBoltAura>(), Projectile.damage, Projectile.knockBack, Projectile.owner);
if (Projectile.numHits > 0)
Projectile.damage = (int)(Projectile.damage * 0.88f);
if (Projectile.damage < 1)
Projectile.damage = 1;
}
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, hitboxSize, targetHitbox);
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

+29 -93
View File
@@ -1,5 +1,5 @@
using System;
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Particles;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
@@ -11,125 +11,61 @@ namespace CalamityMod.Projectiles.Melee
public class OrderbringerBeam : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Melee";
public override string Texture => "CalamityMod/Projectiles/Melee/OrderbringerBeam";
private int whiteLightTimer = 5;
public int time = 0;
public Color mainColor = Color.White;
public override void SetStaticDefaults()
{
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4;
ProjectileID.Sets.TrailingMode[Projectile.type] = 0;
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 12;
ProjectileID.Sets.TrailingMode[Projectile.type] = 2;
}
public override void SetDefaults()
{
Projectile.width = 20;
Projectile.height = 20;
Projectile.extraUpdates = 3;
Projectile.width = 100;
Projectile.height = 100;
Projectile.tileCollide = false;
Projectile.friendly = true;
Projectile.ignoreWater = true;
Projectile.penetrate = 1;
Projectile.timeLeft = 120;
Projectile.penetrate = -1;
Projectile.extraUpdates = 6;
Projectile.timeLeft = 180;
Projectile.DamageType = DamageClass.Melee;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = -1;
}
public override void AI()
{
if (time == 0)
{
mainColor = Main.rand.NextBool() ? Color.MediumPurple : Color.MediumOrchid;
}
Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4;
if (Projectile.ai[1] == 0f)
Player Owner = Main.player[Projectile.owner];
float targetDist = Vector2.Distance(Owner.Center, Projectile.Center);
if (Projectile.timeLeft % 3 == 0 && targetDist < 1400f)
{
Projectile.ai[1] = 1f;
SoundEngine.PlaySound(SoundID.Item60, Projectile.position);
Particle spark = new SparkParticle(Projectile.Center - Projectile.velocity * 3, -Projectile.velocity * 0.05f, false, 17, 1.5f, mainColor * 0.7f);
GeneralParticleHandler.SpawnParticle(spark);
}
if (Projectile.localAI[0] == 0f)
{
Projectile.scale -= 0.02f;
Projectile.alpha += 30;
if (Projectile.alpha >= 250)
{
Projectile.alpha = 255;
Projectile.localAI[0] = 1f;
}
}
else if (Projectile.localAI[0] == 1f)
{
Projectile.scale += 0.02f;
Projectile.alpha -= 30;
if (Projectile.alpha <= 0)
{
Projectile.alpha = 0;
Projectile.localAI[0] = 0f;
}
}
Lighting.AddLight((int)Projectile.Center.X / 16, (int)Projectile.Center.Y / 16, (float)Main.DiscoR / 200f, (float)Main.DiscoG / 200f, (float)Main.DiscoB / 200f);
whiteLightTimer--;
if (whiteLightTimer == 0)
{
float spread = 180f * 0.0174f;
double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2;
double deltaAngle = spread / 8f;
double offsetAngle;
int i;
if (Projectile.owner == Main.myPlayer)
{
for (i = 0; i < 1; i++)
{
offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i;
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 0.6f), (float)(Math.Cos(offsetAngle) * 0.6f), ModContent.ProjectileType<OrderbringerWhiteOrb>(), Projectile.damage, Projectile.knockBack, Projectile.owner);
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 0.6f), (float)(-Math.Cos(offsetAngle) * 0.6f), ModContent.ProjectileType<OrderbringerWhiteOrb>(), Projectile.damage, Projectile.knockBack, Projectile.owner);
}
}
whiteLightTimer = 5;
}
int rainbow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowTorch, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 0.6f);
Main.dust[rainbow].noGravity = true;
Main.dust[rainbow].velocity *= 0.5f;
Main.dust[rainbow].velocity += Projectile.velocity * 0.1f;
CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 200f, 10f, 20f);
time++;
}
public override Color? GetAlpha(Color lightColor)
{
return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, Projectile.alpha);
}
public override bool PreDraw(ref Color lightColor)
{
if (Projectile.timeLeft > 115)
return false;
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1);
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], Color.Lerp(mainColor, Color.White, 0.3f) with { A = 0 }, 1, null, true, true);
return false;
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
target.AddBuff(ModContent.BuffType<Voidfrost>(), 800);
}
public override void OnKill(int timeLeft)
{
SoundEngine.PlaySound(SoundID.Item122, Projectile.Center);
for (int i = 0; i < 2; i++)
if (Projectile.numHits < 1)
{
int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowTorch, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.5f);
Main.dust[dust].noGravity = true;
}
for (int j = 0; j < 20; j++)
{
int deathRainbow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowTorch, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 2.5f);
Main.dust[deathRainbow].noGravity = true;
Main.dust[deathRainbow].velocity *= 3f;
deathRainbow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowTorch, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.5f);
Main.dust[deathRainbow].velocity *= 2f;
Main.dust[deathRainbow].noGravity = true;
}
if (Projectile.owner == Main.myPlayer)
{
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y - 100, 0f, 0f, ModContent.ProjectileType<OrderbringerAura>(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f);
Particle orb = new GlowSparkParticle(target.Center, Projectile.velocity.SafeNormalize(Vector2.UnitY), false, 12, 0.07f, mainColor, new Vector2(1.5f, 0.8f), true);
GeneralParticleHandler.SpawnParticle(orb);
}
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 861 B

After

Width:  |  Height:  |  Size: 5.0 KiB

+120
View File
@@ -0,0 +1,120 @@
using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using CalamityMod.Particles;
using Terraria.ModLoader;
using CalamityMod.Projectiles.Ranged;
using Microsoft.Xna.Framework.Graphics;
using System.ComponentModel;
namespace CalamityMod.Projectiles.Melee
{
public class OrderbringerWaveProj : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Melee";
public override string Texture => "CalamityMod/Projectiles/Melee/JudgementProj";
public ref float time => ref Projectile.ai[0];
public float hitboxSize = 10;
public Color mainColor;
public float fade = 1;
public float damageMult = 1;
public float fadeOut = 1;
public override void SetDefaults()
{
Projectile.width = 336;
Projectile.height = 274;
Projectile.friendly = true;
Projectile.ignoreWater = true;
Projectile.penetrate = -1;
Projectile.tileCollide = false;
Projectile.timeLeft = 450;
Projectile.DamageType = DamageClass.Melee;
Projectile.extraUpdates = 10;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = -1;
}
public override void AI()
{
Vector2 topCorner = Projectile.Center + (Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(100f)) * Projectile.scale) * 157;
Vector2 bottomCorner = Projectile.Center + (Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(-100f)) * Projectile.scale) * 157;
if (time == 0)
{
Projectile.scale = 0.0875f;
Projectile.velocity *= 0.9f;
mainColor = Main.rand.NextBool() ? Color.MediumPurple : Color.MediumOrchid;
}
Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2;
if (time < 200)
{
Projectile.scale += 0.0026f;
hitboxSize += 0.4525f;
Projectile.velocity *= 0.995f;
if (time % 50 == 0 && time > 10)
{
//Projectile stars = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center + Main.rand.NextVector2Circular(hitboxSize * 0.8f, hitboxSize * 0.8f) - Projectile.velocity * 2, (-Projectile.velocity * 3).RotatedByRandom(0.9f), ModContent.ProjectileType<StarofJudgement>(), (int)(Projectile.damage * 0.2f), 3f, Projectile.owner, 0f);
//stars.penetrate = 1;
}
}
else
{
Projectile.velocity *= 0.975f;
}
if (time > 300 && fade > 0)
fade -= 0.0065f;
if (time < 250 && time > 20)
{
if (Main.rand.NextBool(3))
{
Dust trailDust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(hitboxSize, hitboxSize) - Projectile.velocity * 2, 66);
trailDust.scale = Main.rand.NextFloat(0.7f, 0.85f) - (time < 150 ? 0 : time * 0.001f);
trailDust.velocity = -Projectile.velocity * Main.rand.NextFloat(0.85f, 1.5f);
trailDust.color = Main.rand.NextBool() ? Color.MediumPurple : Color.MediumOrchid;
trailDust.noGravity = true;
}
if (time % 9 == 0)
{
Particle orb = new GlowSparkParticle(topCorner, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(170f)), false, 15, Main.rand.NextFloat(0.03f, 0.055f) * Utils.GetLerpValue(250, 150, time, true), mainColor, new Vector2(1, 0.8f), true, false, 0.3f);
GeneralParticleHandler.SpawnParticle(orb);
Particle orb2 = new GlowSparkParticle(bottomCorner, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(-170f)), false, 15, Main.rand.NextFloat(0.03f, 0.055f) * Utils.GetLerpValue(250, 150, time, true), mainColor, new Vector2(1, 0.8f), true, false, 0.3f);
GeneralParticleHandler.SpawnParticle(orb2);
}
if (Main.rand.NextBool(12))
{
Particle orb3 = new SparkParticle(topCorner, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(170f)) * Main.rand.NextFloat(5f, 20f), false, 15, Main.rand.NextFloat(0.8f, 1.35f), mainColor);
GeneralParticleHandler.SpawnParticle(orb3);
Particle orb4 = new SparkParticle(bottomCorner, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(-170f)) * Main.rand.NextFloat(5f, 20f), false, 15, Main.rand.NextFloat(0.8f, 1.35f), mainColor);
GeneralParticleHandler.SpawnParticle(orb4);
}
}
fadeOut = Utils.GetLerpValue(0, 180, Projectile.timeLeft, true);
time++;
}
public override bool PreDraw(ref Color lightColor)
{
Texture2D tex = ModContent.Request<Texture2D>(Texture).Value;
float waveFade = Utils.GetLerpValue(0, 300, Projectile.timeLeft);
for (int i = 1; i < 6; i++) // Weird for loop because of squash code
Main.spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, mainColor with { A = 0 } * fadeOut, Projectile.rotation, tex.Size() / 2f, new Vector2(1 - (i * 0.2f * waveFade), 1 + (i * 0.35f * waveFade)) * Projectile.scale * 1.1f, SpriteEffects.None, 0);
return false;
}
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
{
// Deal more damage on pierce
modifiers.SourceDamage *= damageMult;
if (damageMult < 2f)
damageMult += 0.25f;
}
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, hitboxSize, targetHitbox);
}
}
+120
View File
@@ -0,0 +1,120 @@
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using CalamityMod.Particles;
using Terraria.ModLoader;
using Microsoft.Xna.Framework.Graphics;
using System;
namespace CalamityMod.Projectiles.Melee
{
public class StarofJudgement : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Melee";
public override string Texture => "CalamityMod/Projectiles/Melee/StarofJudgement";
public ref float time => ref Projectile.ai[0];
public Color mainColor;
public override void SetStaticDefaults()
{
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 12;
ProjectileID.Sets.TrailingMode[Projectile.type] = 2;
}
public override void SetDefaults()
{
Projectile.width = 44;
Projectile.height = 44;
Projectile.friendly = true;
Projectile.ignoreWater = true;
Projectile.penetrate = 2;
Projectile.tileCollide = false;
Projectile.timeLeft = 180;
Projectile.DamageType = DamageClass.Melee;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = 20;
}
public override void AI()
{
if (time == 0)
{
Projectile.scale = (Projectile.ai[2] == 1 ? 0.75f : 0.5f);
mainColor = Main.rand.NextBool() ? Color.MediumPurple : Color.MediumOrchid;
if (Projectile.ai[2] == 1)
{
Projectile.localNPCHitCooldown = 7;
Projectile.penetrate = 4;
}
}
Projectile.rotation += (Projectile.velocity.X + MathF.Abs(Projectile.velocity.Y) * Projectile.direction) * 0.01f;
if (Projectile.ai[2] == 1)
{
CalamityUtils.HomeInOnNPC(Projectile, true, 900f, 25, MathHelper.Clamp(30 - time, 15, 30));
if (Main.rand.NextBool(4) && Projectile.numHits < 1)
{
Particle spark = new GlowOrbParticle(Projectile.Center + Main.rand.NextVector2Circular(7, 7) - Projectile.velocity, -Projectile.velocity * Main.rand.NextFloat(0.5f, 0.8f), false, 13, 1f, mainColor * 0.5f);
GeneralParticleHandler.SpawnParticle(spark);
}
}
else if (time > 15)
{
CalamityUtils.HomeInOnNPC(Projectile, true, 700f * (Projectile.numHits > 1 ? 2 : 1), 20, 20f * (Projectile.numHits > 1 ? 5 : 1));
if (Main.rand.NextBool(3))
{
Dust trailDust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(5, 5) - Projectile.velocity, 66);
trailDust.scale = Main.rand.NextFloat(0.7f, 0.85f);
trailDust.velocity = -Projectile.velocity * Main.rand.NextFloat(0.3f, 0.5f);
trailDust.color = Main.rand.NextBool() ? Color.MediumPurple : Color.MediumOrchid;
trailDust.noGravity = true;
}
}
time++;
}
public override bool PreDraw(ref Color lightColor)
{
Texture2D texture = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Melee/StarofJudgement").Value;
Vector2 drawPosition = Projectile.Center - Main.screenPosition;
Color drawColor = Color.Lerp(mainColor, Color.White, 0.2f) with { A = 0 };
float drawRotation = Projectile.rotation;
Vector2 rotationPoint = texture.Size() * 0.5f;
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], drawColor * 0.5f, 1, texture, true, true);
Main.EntitySpriteDraw(texture, drawPosition, null, drawColor, drawRotation, rotationPoint, Projectile.scale, SpriteEffects.None);
return false;
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
if (Projectile.ai[2] == 0)
{
Projectile.timeLeft = 180;
time = 0;
Projectile.velocity *= 1.2f;
}
}
public override void OnKill(int timeLeft)
{
if (Projectile.ai[2] == 1)
{
int points = 5;
float radians = MathHelper.TwoPi / points;
Vector2 spinningPoint = Vector2.Normalize(new Vector2(-1f, -1f).RotatedByRandom(100));
for (int k = 0; k < points; k++)
{
Vector2 velocity = spinningPoint.RotatedBy(radians * k).RotatedBy(-0.45f);
Particle spark = new PointParticle((Projectile.Center + velocity * 7.5f), velocity * 5.5f, false, 9, 1.2f, mainColor);
GeneralParticleHandler.SpawnParticle(spark);
}
}
else
{
for (int k = 0; k < 3; k++)
{
GlowOrbParticle orb = new GlowOrbParticle(Projectile.Center, new Vector2(4, 4).RotatedByRandom(100f) * Main.rand.NextFloat(0.3f, 0.8f), false, 15, Main.rand.NextFloat(0.6f, 0.95f), mainColor);
GeneralParticleHandler.SpawnParticle(orb);
}
}
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

+1 -1
View File
@@ -173,7 +173,7 @@ namespace CalamityMod.Projectiles.Ranged
{
Player coinOwner = Main.player[struckCoin.owner];
if (coinOwner.name.ToLower() == "v1" || coinOwner.name.ToLower() == "v2" || coinOwner.name.ToLower() == "mirage")
ORDERSystem.JUDGMENT();
ORDERSystem.JUDGEMENT();
}
}
+1 -1
View File
@@ -56,7 +56,7 @@ namespace CalamityMod.Systems
}
// DIE!
public static void JUDGMENT()
public static void JUDGEMENT()
{
if (!currentlyPlaying)
orderSoundSlot = SoundEngine.PlaySound(ORDERTrack);
+10 -6
View File
@@ -52,7 +52,7 @@ namespace CalamityMod
/// <param name="typeOneIncrement">If mode 1 is used, this controls the loop increment. Set it to more than 1 to skip afterimages.</param>
/// <param name="texture">The texture to draw. Set to <b>null</b> to draw the projectile's own loaded texture.</param>
/// <param name="drawCentered">If <b>false</b>, the afterimages will be centered on the projectile's position instead of its own center.</param>
public static void DrawAfterimagesCentered(Projectile proj, int mode, Color lightColor, int typeOneIncrement = 1, Texture2D texture = null, bool drawCentered = true)
public static void DrawAfterimagesCentered(Projectile proj, int mode, Color lightColor, int typeOneIncrement = 1, Texture2D texture = null, bool drawCentered = true, bool shrink = false)
{
if (texture is null)
texture = TextureAssets.Projectile[proj.type].Value;
@@ -85,8 +85,9 @@ namespace CalamityMod
{
Vector2 drawPos = proj.oldPos[i] + centerOffset - Main.screenPosition + new Vector2(0f, proj.gfxOffY);
// DO NOT REMOVE THESE "UNNECESSARY" FLOAT CASTS. THIS WILL BREAK THE AFTERIMAGES.
Color color = alphaColor * ((float)(proj.oldPos.Length - i) / (float)proj.oldPos.Length);
Main.spriteBatch.Draw(texture, drawPos, new Rectangle?(rectangle), color, rotation, origin, scale, spriteEffects, 0f);
float interpolant = ((float)(proj.oldPos.Length - i) / (float)proj.oldPos.Length);
Color color = alphaColor * interpolant;
Main.spriteBatch.Draw(texture, drawPos, new Rectangle?(rectangle), color, rotation, origin, shrink ? scale * interpolant : scale, spriteEffects, 0f);
}
break;
@@ -102,13 +103,14 @@ namespace CalamityMod
while (k < afterimageCount)
{
Vector2 drawPos = proj.oldPos[k] + centerOffset - Main.screenPosition + new Vector2(0f, proj.gfxOffY);
float interpolant = ((float)(proj.oldPos.Length - k) / (float)proj.oldPos.Length);
// DO NOT REMOVE THESE "UNNECESSARY" FLOAT CASTS EITHER.
if (k > 0)
{
float colorMult = (float)(afterimageCount - k);
drawColor *= colorMult / afterimageColorCount;
}
Main.spriteBatch.Draw(texture, drawPos, new Rectangle?(rectangle), drawColor, rotation, origin, scale, spriteEffects, 0f);
Main.spriteBatch.Draw(texture, drawPos, new Rectangle?(rectangle), drawColor, rotation, origin, shrink ? scale * interpolant : scale, spriteEffects, 0f);
k += increment;
}
break;
@@ -123,8 +125,10 @@ namespace CalamityMod
Vector2 drawPos = proj.oldPos[i] + centerOffset - Main.screenPosition + new Vector2(0f, proj.gfxOffY);
// DO NOT REMOVE THESE "UNNECESSARY" FLOAT CASTS. THIS WILL BREAK THE AFTERIMAGES.
Color color = alphaColor * ((float)(proj.oldPos.Length - i) / (float)proj.oldPos.Length);
Main.spriteBatch.Draw(texture, drawPos, new Rectangle?(rectangle), color, afterimageRot, origin, scale, sfxForThisAfterimage, 0f);
float interpolant = ((float)(proj.oldPos.Length - i) / (float)proj.oldPos.Length);
Color color = alphaColor * interpolant;
Main.spriteBatch.Draw(texture, drawPos, new Rectangle?(rectangle), color, afterimageRot, origin, shrink ? scale * interpolant : scale, sfxForThisAfterimage, 0f);
}
break;