Updated GoJ

Is now more Orderbringer-like
This commit is contained in:
Xyk committed 2025-06-03 01:15:00 -07:00
1 parent 3b7f72a288
commit 46339f2fc1
5 files changed
+136 -68

No files matched your search

+106 -45
View File
@@ -1,85 +1,144 @@
using CalamityMod.Dusts;
using System;
using CalamityMod.Items.Materials;
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;
using Terraria.Audio;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
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;
public int time = 0;
public Vector2 bladeHitboxPos;
public float bladeRotation = 0;
public int bladeDirection = 0;
public float completion = 0;
public bool canHit => (completion >= 0.35f && completion <= 0.8f);
public int swingCount = 0;
public bool spawnProj = true;
public bool playSound = true;
public Color clr = Color.MediumOrchid;
public override void SetDefaults()
{
Item.width = 78;
Item.height = 78;
Item.damage = 155;
Item.damage = 240;
Item.DamageType = DamageClass.Melee;
Item.useStyle = ItemUseStyleID.Swing;
Item.useAnimation = Item.useTime = useTime;
Item.useAnimation = Item.useTime = 20;
Item.useTurn = true;
Item.knockBack = 7f;
Item.UseSound = SoundID.Item60;
Item.autoReuse = true;
Item.value = CalamityGlobalItem.RarityPurpleBuyPrice;
Item.rare = ItemRarityID.Purple;
Item.shoot = ModContent.ProjectileType<JudgementProj>();
Item.shootSpeed = 5f;
Item.shootSpeed = 5.5f;
}
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
{
return false;
}
public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox)
{
float scale = 1.1f;
// Basically just insures the enemy is always able to be hit if they're in range, the actual collision check is done in CanHitNPC
float scale = 8f;
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);
hitbox = new Rectangle((int)(bladeHitboxPos.X - newSize.X / 2f), (int)(bladeHitboxPos.Y - newSize.Y / 2f), (int)newSize.X, (int)newSize.Y);
}
public override bool? CanHitNPC(Player player, NPC target)
{
Vector2 mPos = player.Calamity().mouseWorld;
Vector2 shootDir = player.Center.DirectionTo(mPos);
float _ = float.NaN;
bool hitCheck = Collision.CheckAABBvLineCollision(target.Hitbox.TopLeft(), target.Hitbox.Size(), player.Center - shootDir * 30, player.Center + shootDir * 145, Item.width * 3f, ref _);
return ((canHit && hitCheck) ? null : false);
}
public override void UseAnimation(Player player)
{
swordDirection = player.direction;
swingCount++;
time = 0;
swingRoatation = 0;
mainColor = Main.rand.NextBool() ? Color.MediumPurple : Color.MediumOrchid;
opacityAdjust = 0;
smearOpacity = 0;
bladeDirection = player.direction;
bladeHitboxPos = player.Center;
bladeRotation = 0;
spawnProj = true;
playSound = true;
int dir = -Math.Sign(player.Center.X - player.Calamity().mouseWorld.X);
float startRot = MathHelper.ToRadians(-90) * dir * (swingCount % 2 == 0 ? 1 : -1);
clr = Main.rand.NextBool() ? Color.MediumPurple : Color.MediumOrchid;
}
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;
Vector2 mPos = player.Calamity().mouseWorld;
completion = (float)((float)time / ((float)(Item.useAnimation / player.GetAttackSpeed(DamageClass.Melee))));
int dir = -Math.Sign(player.Center.X - mPos.X);
float startRot = MathHelper.ToRadians(-110) * dir * (swingCount % 2 == 0 ? 1 : -1);
float endRot = MathHelper.ToRadians(-110) * dir * (swingCount % 2 == 0 ? -1 : 1);
float minRot = MathHelper.ToRadians(-150) * dir * (swingCount % 2 == 0 ? 1 : -1);
float cutoff = 0.2f;
float cutoff2 = 0.95f;
Vector2 shootDir = player.Center.DirectionTo(mPos) * Item.shootSpeed;
if (completion <= cutoff)
{
float lerp = Utils.GetLerpValue(0, cutoff, completion, true);
player.itemRotation = player.Center.DirectionTo(mPos).ToRotation() + MathHelper.Lerp(startRot, minRot, CalamityUtils.EaseInOutExp(lerp, 4f, 4f));
player.itemRotation += (MathHelper.Pi) * (dir == 1 ? 0 : 1) + MathHelper.PiOver4 * dir;
}
else
{
if (playSound)
{
SoundStyle swing = new("CalamityMod/Sounds/Item/SwooshMid");
SoundEngine.PlaySound(swing with { Pitch = Main.rand.NextFloat(0.1f, 0.3f), Volume = 1f }, player.Center);
playSound = false;
}
if (completion >= 0.65f && spawnProj)
{
Projectile.NewProjectile(player.GetSource_FromThis(), player.Center, shootDir, Item.shoot, Item.damage, Item.knockBack, player.whoAmI, 0f);
Particle swipe = new CustomSpark(player.Center - shootDir * 5, shootDir.RotatedBy(0.4f * (dir * (swingCount % 2 == 0 ? 1 : -1))) * 2.5f, "CalamityMod/Particles/VerticalSmearLarge", false, (int)(14 / player.GetAttackSpeed(DamageClass.Melee)), 0.6f, clr, new Vector2(1f, 1f), true, false, 0, false, false);
GeneralParticleHandler.SpawnParticle(swipe);
SoundEngine.PlaySound(SoundID.Item60, player.Center);
spawnProj = false;
}
float lerp = Utils.GetLerpValue(cutoff, cutoff2, completion, true);
player.itemRotation = player.Center.DirectionTo(mPos).ToRotation() + MathHelper.Lerp(minRot, endRot, CalamityUtils.EaseInOutExp(lerp, 6f, 2f));
player.itemRotation += (MathHelper.Pi) * (dir == 1 ? 0 : 1) + MathHelper.PiOver4 * dir;
}
float extraRot = (dir == 1 ? -MathHelper.PiOver4 : MathHelper.ToRadians(225));
bladeHitboxPos = player.Center + (player.itemRotation + extraRot).ToRotationVector2() * 180;
player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, player.itemRotation + MathHelper.ToRadians(-130) * dir);
player.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, player.itemRotation + MathHelper.ToRadians(-130) * dir);
player.itemLocation = player.Center;
player.direction = dir;
time++;
swingRoatation += swordDirection == 1 ? 0.13f : -0.13f;
float Rot = (swordDirection == -1 ? 1.8f : -1.8f) + swingRoatation;
if (swordDirection != player.direction)
}
public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone)
{
int beamDamage = player.CalcIntDamage<MeleeDamageClass>(Item.damage * 0.4f);
Vector2 mouseClamped = player.ClampedMouseWorld();
SoundEngine.PlaySound(SoundID.Item84 with { Volume = 1f, Pitch = Main.rand.NextFloat(0.5f, 0.7f) }, player.Center);
for (int i = 0; i < 2; i++)
{
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;
Vector2 vel = player.Center.DirectionFrom(target.Center).RotatedByRandom(0.7f) * Main.rand.NextFloat(18, 20);
Projectile.NewProjectile(player.GetSource_ItemUse(Item), player.Center, vel, ModContent.ProjectileType<StarofJudgement>(), beamDamage, 0, player.whoAmI, 0, (i == 0 ? -1 : 1), 1);
}
}
public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI)
@@ -90,6 +149,8 @@ namespace CalamityMod.Items.Weapons.Melee
{
CreateRecipe().
AddIngredient(ItemID.LunarBar, 7).
AddIngredient<CoreofCalamity>().
AddIngredient<GalacticaSingularity>(5).
AddTile(TileID.LunarCraftingStation).
Register();
}
+1 -3
View File
@@ -25,7 +25,6 @@ namespace CalamityMod.Items.Weapons.Melee
public Vector2 bladeHitboxPos;
public float bladeRotation = 0;
public int bladeDirection = 0;
public float bladeFX = 0;
public float completion = 0;
public bool canHit => (completion >= 0.35f && completion <= 0.8f);
public int swingCount = 0;
@@ -62,7 +61,7 @@ namespace CalamityMod.Items.Weapons.Melee
Vector2 mPos = player.Calamity().mouseWorld;
Vector2 shootDir = player.Center.DirectionTo(mPos);
float _ = float.NaN;
bool hitCheck = Collision.CheckAABBvLineCollision(target.Hitbox.TopLeft(), target.Hitbox.Size(), player.Center, player.Center + shootDir * 245, Item.width * 3f, ref _);
bool hitCheck = Collision.CheckAABBvLineCollision(target.Hitbox.TopLeft(), target.Hitbox.Size(), player.Center - shootDir * 30, player.Center + shootDir * 245, Item.width * 3f, ref _);
return ((canHit && hitCheck) ? null : false);
}
public override void UseAnimation(Player player)
@@ -72,7 +71,6 @@ namespace CalamityMod.Items.Weapons.Melee
bladeDirection = player.direction;
bladeHitboxPos = player.Center;
bladeRotation = 0;
bladeFX = 0;
spawnProj = true;
playSound = true;
int dir = -Math.Sign(player.Center.X - player.Calamity().mouseWorld.X);
@@ -695,7 +695,11 @@ GrandGuardian: {
GreatswordofJudgement: {
DisplayName: Greatsword of Judgement
Tooltip: Fires a piercing energy wave that releases homing stars as it flies
Tooltip:
'''
Fires a piercing energy wave that releases homing stars as it flies
Hits with the blade summon two stronger stars from behind you
'''
}
Greentide: {
+8 -8
View File
@@ -1,4 +1,5 @@
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Dusts;
using CalamityMod.Particles;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
@@ -26,7 +27,7 @@ namespace CalamityMod.Projectiles.Melee
Projectile.tileCollide = false;
Projectile.timeLeft = 450;
Projectile.DamageType = DamageClass.Melee;
Projectile.extraUpdates = 9;
Projectile.extraUpdates = 14;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = -1;
}
@@ -49,10 +50,10 @@ namespace CalamityMod.Projectiles.Melee
Projectile.scale += 0.0026f;
hitboxSize += 0.4525f;
Projectile.velocity *= 0.995f;
// Spawn 3
if (time % 50 == 0 && time > 10)
// Spawn 2
if (time % 85 == 0 && time > 10)
{
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);
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.35f), 3f, Projectile.owner, 0f);
}
}
else
@@ -80,7 +81,7 @@ namespace CalamityMod.Projectiles.Melee
if (Main.rand.NextBool(3))
{
Dust trailDust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(hitboxSize, hitboxSize) - Projectile.velocity * 2, 66);
Dust trailDust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(hitboxSize, hitboxSize) - Projectile.velocity * 2, ModContent.DustType<SquashDust>());
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;
@@ -102,11 +103,10 @@ namespace CalamityMod.Projectiles.Melee
{
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);
for (int i = 0; i < 5; i++)
Main.spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition + (Projectile.rotation + MathHelper.PiOver2).ToRotationVector2() * 9 * i, null, mainColor with { A = 0 } * fadeOut * 0.6f, Projectile.rotation, tex.Size() / 2f, new Vector2(1 - (0.2f * waveFade) + 0.01f * i, 1 + (0.45f * waveFade) - 0.06f * i) * Projectile.scale, SpriteEffects.None, 0);
return false;
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType<Nightwither>(), 180);
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
{
if (Projectile.numHits > 0)
+16 -11
View File
@@ -7,6 +7,7 @@ using Terraria.ModLoader;
using Microsoft.Xna.Framework.Graphics;
using System;
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Dusts;
namespace CalamityMod.Projectiles.Melee
{
@@ -44,27 +45,33 @@ namespace CalamityMod.Projectiles.Melee
Projectile.scale = (Projectile.ai[2] == 1 ? 0.75f : 0.5f);
if (Projectile.ai[2] == 1)
{
Projectile.localNPCHitCooldown = 7;
Projectile.penetrate = 4;
Projectile.localNPCHitCooldown = -1;
Projectile.penetrate = 1;
Projectile.extraUpdates = 1;
}
}
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)
if (time > 18)
{
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);
CalamityUtils.HomeInOnNPC(Projectile, true, 900f, 25, MathHelper.Clamp(30 - time, 15, 30));
}
else
Projectile.velocity = Projectile.velocity.RotatedBy(0.085f * Projectile.ai[1]);
if (time % 2 == 0)
{
Particle spark = new CustomSpark(Projectile.Center, Projectile.velocity * 0.2f, "CalamityMod/Particles/BloomCircle", false, 13, 0.35f, mainColor * 0.75f, new Vector2(0.8f, 1.35f), true, false, shrinkSpeed: 0.3f);
GeneralParticleHandler.SpawnParticle(spark);
}
}
else if (time > 15)
if (Projectile.ai[2] != 1 && time > 10)
{
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);
Dust trailDust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(5, 5) - Projectile.velocity, ModContent.DustType<SquashDust>());
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;
@@ -84,6 +91,7 @@ namespace CalamityMod.Projectiles.Melee
Vector2 rotationPoint = texture.Size() * 0.5f;
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], drawColor * 0.5f, 1, texture, true, true);
Main.EntitySpriteDraw(texture, drawPosition, null, drawColor, drawRotation, rotationPoint, Projectile.scale, SpriteEffects.None);
Main.EntitySpriteDraw(texture, drawPosition, null, Color.White with { A = 0 }, drawRotation, rotationPoint, Projectile.scale * 0.8f, SpriteEffects.None);
return false;
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
@@ -91,14 +99,11 @@ namespace CalamityMod.Projectiles.Melee
if (!target.CanBeChasedBy())
Projectile.penetrate++;
int buffType = ModContent.BuffType<Nightwither>();
target.AddBuff(buffType, 60);
if (Projectile.ai[2] == 0)
{
Projectile.timeLeft = 180;
time = 0;
Projectile.velocity *= 1.2f;
Projectile.velocity *= 1.1f;
}
}
public override void OnKill(int timeLeft)