Murasama Resprite + Slight changes

The large slash has more range to fit with the new sprite
This commit is contained in:
Xyk committed 2023-12-05 07:44:26 -08:00
1 parent 0809682aa7
commit 73d55e981e
2 files changed
+43 -43

No files matched your search

+43 -43
View File
@@ -18,27 +18,21 @@ namespace CalamityMod.Projectiles.Melee
public override LocalizedText DisplayName => CalamityUtils.GetItemName<Murasama>();
private Player Owner => Main.player[Projectile.owner];
public ref int hitCooldown => ref Main.player[Projectile.owner].Calamity().murasamaHitCooldown;
public int frameX = 0;
public int frameY = 0;
public int time = 0;
public int CurrentFrame
public override void SetStaticDefaults()
{
get => frameX * 7 + frameY;
set
{
frameX = value / 7;
frameY = value % 7;
}
Main.projFrames[Projectile.type] = 14;
}
public bool Slashing = false;
public bool Slash1 => Projectile.frame == 10;
public bool Slash2 => Projectile.frame == 0;
public bool Slash3 => Projectile.frame == 6;
public override void SetDefaults()
{
Projectile.width = 236;
Projectile.height = 236;
Projectile.scale = 1f;
Projectile.width = 216;
Projectile.height = 216;
Projectile.friendly = true;
Projectile.penetrate = -1;
Projectile.tileCollide = false;
@@ -54,10 +48,10 @@ namespace CalamityMod.Projectiles.Melee
if (Projectile.frameCounter <= 1)
return false;
Texture2D texture = ModContent.Request<Texture2D>(Texture).Value;
Vector2 origin = texture.Size() / new Vector2(2f, 7f) * 0.5f;
Rectangle frame = texture.Frame(2, 7, frameX, frameY);
SpriteEffects spriteEffects = Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally;
Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, frame, Color.White, Projectile.rotation, origin, Projectile.scale, spriteEffects, 0);
Rectangle frame = texture.Frame(verticalFrames: Main.projFrames[Type], frameY:Projectile.frame);
Vector2 origin = frame.Size() * 0.5f;
SpriteEffects spriteEffects = Projectile.direction == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally;
Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition + (Projectile.velocity * 0.3f) + new Vector2(0, -32).RotatedBy(Projectile.rotation), frame, Color.White, Projectile.rotation, origin, Projectile.scale, spriteEffects, 0);
return false;
}
@@ -66,27 +60,30 @@ namespace CalamityMod.Projectiles.Melee
if (time == 0)
{
if (Main.zenithWorld)
{
Projectile.scale = 2;
CurrentFrame = Main.zenithWorld ? 6 : 10;
Projectile.damage = (int)(Projectile.damage * 2);
}
Projectile.frame = Main.zenithWorld ? 6 : 10;
Projectile.alpha = 0;
time++;
}
Player player = Main.player[Projectile.owner];
if (CurrentFrame == 0)
if (Slash2)
{
SoundEngine.PlaySound(Murasama.Swing with { Pitch = -0.1f }, Projectile.Center);
if (hitCooldown == 0)
Slashing = true;
Projectile.numHits = 0;
}
else if (CurrentFrame == 6)
else if (Slash3)
{
SoundEngine.PlaySound(Murasama.BigSwing with { Pitch = 0f }, Projectile.Center);
if (hitCooldown == 0)
Slashing = true;
Projectile.numHits = 0;
}
else if (CurrentFrame == 10)
else if (Slash1)
{
SoundEngine.PlaySound(Murasama.Swing with { Pitch = -0.05f }, Projectile.Center);
if (hitCooldown == 0)
@@ -96,11 +93,11 @@ namespace CalamityMod.Projectiles.Melee
else
Slashing = false;
if (CurrentFrame == 5 && Projectile.frameCounter % 3 == 0)
if (Projectile.frame == 5 && Projectile.frameCounter % 3 == 0)
{
Projectile.damage = (int)(Projectile.damage * 2);
}
if (CurrentFrame == 7 && Projectile.frameCounter % 3 == 0)
if (Projectile.frame == 7 && Projectile.frameCounter % 3 == 0)
{
Projectile.damage = (int)(Projectile.damage * 0.5f);
}
@@ -109,9 +106,7 @@ namespace CalamityMod.Projectiles.Melee
Projectile.frameCounter++;
if (Projectile.frameCounter % 3 == 0)
{
CurrentFrame++;
if (frameX >= 2)
CurrentFrame = 0;
Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Type];
}
Vector2 origin = Projectile.Center + Projectile.velocity * 3f;
@@ -130,20 +125,19 @@ namespace CalamityMod.Projectiles.Melee
}
// Rotation and directioning.
if (Slashing || CurrentFrame == 10)
if (Slashing || Slash1)
{
float velocityAngle = Projectile.velocity.ToRotation();
Projectile.rotation = velocityAngle + (Projectile.spriteDirection == -1).ToInt() * MathHelper.Pi;
Projectile.rotation = velocityAngle + (Projectile.direction == -1).ToInt() * MathHelper.Pi;
}
float velocityAngle2 = Projectile.velocity.ToRotation();
Projectile.direction = (Math.Cos(velocityAngle2) > 0).ToDirectionInt();
// Positioning close to the end of the player's arm.
float offset = 80f * Projectile.scale;
Projectile.position = playerRotatedPoint - Projectile.Size * 0.5f + velocityAngle2.ToRotationVector2() * offset;
Projectile.Center = playerRotatedPoint + velocityAngle2.ToRotationVector2() * offset;
// Sprite and player directioning.
Projectile.spriteDirection = Projectile.direction;
player.ChangeDir(Projectile.direction);
// Prevents the projectile from dying
@@ -175,19 +169,25 @@ namespace CalamityMod.Projectiles.Melee
Projectile.velocity = newVelocity;
}
}
public override void ModifyDamageHitbox(ref Rectangle hitbox)
{
int size = 60;
if (Slash3)
hitbox.Inflate(size, size);
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
if (target.Organic())
SoundEngine.PlaySound(Murasama.OrganicHit with { Pitch = (CurrentFrame == 0 ? -0.1f : CurrentFrame == 6 ? 0.1f : CurrentFrame == 10 ? -0.15f : 0) }, Projectile.Center);
SoundEngine.PlaySound(Murasama.OrganicHit with { Pitch = (Slash2 ? -0.1f : Slash3 ? 0.1f : Slash1 ? -0.15f : 0) }, Projectile.Center);
else
SoundEngine.PlaySound(Murasama.InorganicHit with { Pitch = (CurrentFrame == 0 ? -0.1f : CurrentFrame == 6 ? 0.1f : CurrentFrame == 10 ? -0.15f : 0) }, Projectile.Center);
SoundEngine.PlaySound(Murasama.InorganicHit with { Pitch = (Slash2 ? -0.1f : Slash3 ? 0.1f : Slash1 ? -0.15f : 0) }, Projectile.Center);
for (int i = 0; i < 3; i++)
{
Color impactColor = CurrentFrame == 6 ? Main.rand.NextBool(3) ? Color.LightCoral : Color.White : Main.rand.NextBool(4) ? Color.LightCoral : Color.Crimson;
Color impactColor = Slash3 ? Main.rand.NextBool(3) ? Color.LightCoral : Color.White : Main.rand.NextBool(4) ? Color.LightCoral : Color.Crimson;
float impactParticleScale = Main.rand.NextFloat(1f, 1.75f);
if (CurrentFrame == 6)
if (Slash3)
{
SparkleParticle impactParticle2 = new SparkleParticle(target.Center + Main.rand.NextVector2Circular(target.width * 0.75f, target.height * 0.75f), Vector2.Zero, Color.White, Color.Red, impactParticleScale * 1.2f, 8, 0, 4.5f);
GeneralParticleHandler.SpawnParticle(impactParticle2);
@@ -196,34 +196,34 @@ namespace CalamityMod.Projectiles.Melee
GeneralParticleHandler.SpawnParticle(impactParticle);
}
float sparkCount = MathHelper.Clamp(CurrentFrame == 6 ? 18 - Projectile.numHits * 3 : 5 - Projectile.numHits * 2, 0, 18);
float sparkCount = MathHelper.Clamp(Slash3 ? 18 - Projectile.numHits * 3 : 5 - Projectile.numHits * 2, 0, 18);
for (int i = 0; i < sparkCount; i++)
{
Vector2 sparkVelocity2 = Projectile.velocity.RotatedBy(CurrentFrame == 0 ? -0.45f * Owner.direction : CurrentFrame == 6 ? 0 : CurrentFrame == 10 ? 0.45f * Owner.direction : 0).RotatedByRandom(0.35f) * Main.rand.NextFloat(0.5f, 1.8f);
Vector2 sparkVelocity2 = Projectile.velocity.RotatedBy(Slash2 ? -0.45f * Owner.direction : Slash3 ? 0 : Slash1 ? 0.45f * Owner.direction : 0).RotatedByRandom(0.35f) * Main.rand.NextFloat(0.5f, 1.8f);
int sparkLifetime2 = Main.rand.Next(23, 35);
float sparkScale2 = Main.rand.NextFloat(0.95f, 1.8f);
Color sparkColor2 = CurrentFrame == 6 ? Main.rand.NextBool(3) ? Color.Red : Color.IndianRed : Main.rand.NextBool() ? Color.Red : Color.Firebrick;
Color sparkColor2 = Slash3 ? Main.rand.NextBool(3) ? Color.Red : Color.IndianRed : Main.rand.NextBool() ? Color.Red : Color.Firebrick;
if (Main.rand.NextBool())
{
AltSparkParticle spark = new AltSparkParticle(target.Center + Main.rand.NextVector2Circular(target.width * 0.5f, target.height * 0.5f) + Projectile.velocity * 1.2f, sparkVelocity2 * (CurrentFrame == 6 ? 1f : 0.65f), false, (int)(sparkLifetime2 * (CurrentFrame == 6 ? 1.2f : 1f)), sparkScale2 * (CurrentFrame == 6 ? 1.4f : 1f), sparkColor2);
AltSparkParticle spark = new AltSparkParticle(target.Center + Main.rand.NextVector2Circular(target.width * 0.5f, target.height * 0.5f) + Projectile.velocity * 1.2f, sparkVelocity2 * (Slash3 ? 1f : 0.65f), false, (int)(sparkLifetime2 * (Slash3 ? 1.2f : 1f)), sparkScale2 * (Slash3 ? 1.4f : 1f), sparkColor2);
GeneralParticleHandler.SpawnParticle(spark);
}
else
{
LineParticle spark = new LineParticle(target.Center + Main.rand.NextVector2Circular(target.width * 0.5f, target.height * 0.5f) + Projectile.velocity * 1.2f, sparkVelocity2 * (CurrentFrame == 7 ? 1f : 0.65f), false, (int)(sparkLifetime2 * (CurrentFrame == 7 ? 1.2f : 1f)), sparkScale2 * (CurrentFrame == 7 ? 1.4f : 1f), Main.rand.NextBool() ? Color.Red : Color.Firebrick);
LineParticle spark = new LineParticle(target.Center + Main.rand.NextVector2Circular(target.width * 0.5f, target.height * 0.5f) + Projectile.velocity * 1.2f, sparkVelocity2 * (Projectile.frame == 7 ? 1f : 0.65f), false, (int)(sparkLifetime2 * (Projectile.frame == 7 ? 1.2f : 1f)), sparkScale2 * (Projectile.frame == 7 ? 1.4f : 1f), Main.rand.NextBool() ? Color.Red : Color.Firebrick);
GeneralParticleHandler.SpawnParticle(spark);
}
}
float dustCount = MathHelper.Clamp(CurrentFrame == 6 ? 25 - Projectile.numHits * 3 : 12 - Projectile.numHits * 2, 0, 25);
float dustCount = MathHelper.Clamp(Slash3 ? 25 - Projectile.numHits * 3 : 12 - Projectile.numHits * 2, 0, 25);
for (int i = 0; i <= dustCount; i++)
{
int dustID = Main.rand.NextBool(3) ? 182 : Main.rand.NextBool() ? CurrentFrame == 6 ? 309 : 296 : 90;
Dust dust2 = Dust.NewDustPerfect(target.Center + Main.rand.NextVector2Circular(target.width * 0.5f, target.height * 0.5f), dustID, Projectile.velocity.RotatedBy(CurrentFrame == 0 ? -0.45f * Owner.direction : CurrentFrame == 6 ? 0 : CurrentFrame == 10 ? 0.45f * Owner.direction : 0).RotatedByRandom(0.55f) * Main.rand.NextFloat(0.3f, 1.1f));
int dustID = Main.rand.NextBool(3) ? 182 : Main.rand.NextBool() ? Slash3 ? 309 : 296 : 90;
Dust dust2 = Dust.NewDustPerfect(target.Center + Main.rand.NextVector2Circular(target.width * 0.5f, target.height * 0.5f), dustID, Projectile.velocity.RotatedBy(Slash2 ? -0.45f * Owner.direction : Slash3 ? 0 : Slash1 ? 0.45f * Owner.direction : 0).RotatedByRandom(0.55f) * Main.rand.NextFloat(0.3f, 1.1f));
dust2.scale = Main.rand.NextFloat(0.9f, 2.4f);
dust2.noGravity = true;
}
}
public override Color? GetAlpha(Color lightColor) => new Color(200, 0, 0, 0);
public override Color? GetAlpha(Color lightColor) => new Color(100, 0, 0, 0);
public override bool? CanDamage() => Slashing == false ? false : null;
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 80 KiB