Fixes + Cinders of Lament integration
This commit is contained in:
1 parent
c598449d6a
commit
36dfa5e48d
4 files changed
+67
-30
No files matched your search
@@ -77,7 +77,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas
|
||||
}
|
||||
else
|
||||
{
|
||||
CurrentFrame = (int)Math.Round(MathHelper.Lerp(7f, 15f, slashInterpolant));
|
||||
CurrentFrame = (int)Math.Round(MathHelper.Lerp(6f, 15f, slashInterpolant));
|
||||
}
|
||||
|
||||
int xFrame = CurrentFrame / Main.npcFrameCount[npc.type];
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace CalamityMod.Projectiles.Boss
|
||||
|
||||
SpriteEffects direction = projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
|
||||
Texture2D texture = Main.projectileTexture[projectile.type];
|
||||
if (projectile.ai[1] == 1f)
|
||||
if (projectile.ai[1] == 0f)
|
||||
texture = ModContent.GetTexture("CalamityMod/Projectiles/Boss/SupremeCatastropheSlashAlt");
|
||||
|
||||
Vector2 drawPosition = projectile.Center - Main.screenPosition + Vector2.UnitY * projectile.gfxOffY;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
@@ -36,12 +37,21 @@ namespace CalamityMod.Projectiles.Summon
|
||||
projectile.minion = true;
|
||||
}
|
||||
|
||||
public override void AI() => Behavior(projectile, Main.player[projectile.owner], ref Time);
|
||||
public override void AI()
|
||||
{
|
||||
if (LookingAtPlayer)
|
||||
projectile.frame = (int)Math.Round(MathHelper.Lerp(0f, 9f, Time / 45f));
|
||||
else
|
||||
{
|
||||
float punchInterpolant = ((Time - 45f) / 35f) % 1f;
|
||||
projectile.frame = (int)Math.Round(MathHelper.Lerp(12f, 21f, punchInterpolant));
|
||||
}
|
||||
|
||||
Behavior(projectile, Main.player[projectile.owner], ref Time);
|
||||
}
|
||||
|
||||
public static void Behavior(Projectile projectile, Player owner, ref float time)
|
||||
{
|
||||
DoFrameEffects(projectile);
|
||||
|
||||
if (time < 40f)
|
||||
FadeIn(projectile);
|
||||
|
||||
@@ -52,21 +62,16 @@ namespace CalamityMod.Projectiles.Summon
|
||||
projectile.Kill();
|
||||
}
|
||||
|
||||
if (time < 25f)
|
||||
if (time < 40f)
|
||||
{
|
||||
float idealRotation = projectile.AngleTo(owner.Center) - MathHelper.PiOver2;
|
||||
projectile.rotation = projectile.rotation.AngleLerp(idealRotation, 0.08f);
|
||||
projectile.rotation = projectile.rotation.AngleTowards(idealRotation, 0.2f);
|
||||
}
|
||||
else if (time < 40f)
|
||||
{
|
||||
projectile.rotation = projectile.AngleTo(owner.Center) - MathHelper.PiOver2;
|
||||
projectile.velocity = projectile.SafeDirectionTo(owner.Center) * -5f;
|
||||
projectile.rotation = projectile.velocity.X * 0.01f;
|
||||
projectile.spriteDirection = (owner.Center.X < projectile.Center.X).ToDirectionInt();
|
||||
}
|
||||
else if (time == 40f)
|
||||
{
|
||||
projectile.rotation = projectile.AngleTo(owner.Center) - MathHelper.PiOver2;
|
||||
projectile.velocity = projectile.SafeDirectionTo(owner.Center) * 31f;
|
||||
projectile.rotation = projectile.velocity.X * 0.0125f;
|
||||
projectile.damage = (int)(projectile.damage * 1.45);
|
||||
|
||||
Main.PlaySound(SoundID.DD2_BetsyFlameBreath, owner.Center);
|
||||
@@ -77,11 +82,11 @@ namespace CalamityMod.Projectiles.Summon
|
||||
}
|
||||
|
||||
public static void FadeIn(Projectile projectile)
|
||||
{
|
||||
{
|
||||
if (projectile.localAI[0] == 0f)
|
||||
{
|
||||
{
|
||||
for (int i = 0; i < 40; i++)
|
||||
{
|
||||
{
|
||||
Dust brimstone = Dust.NewDustPerfect(projectile.Center + Main.rand.NextVector2Square(-65f, 65f), 267);
|
||||
brimstone.velocity = -Vector2.UnitY * Main.rand.NextFloat(1.8f, 3.6f);
|
||||
brimstone.scale = Main.rand.NextFloat(1.65f, 1.85f);
|
||||
@@ -90,22 +95,29 @@ namespace CalamityMod.Projectiles.Summon
|
||||
brimstone.noGravity = true;
|
||||
}
|
||||
projectile.localAI[0] = 1f;
|
||||
}
|
||||
}
|
||||
|
||||
projectile.Opacity = MathHelper.Clamp(projectile.Opacity + 0.075f, 0f, 1f);
|
||||
}
|
||||
|
||||
public static void DoFrameEffects(Projectile projectile)
|
||||
{
|
||||
projectile.frameCounter++;
|
||||
if (projectile.frameCounter % 5f == 4f)
|
||||
projectile.frame = (projectile.frame + 1) % Main.projFrames[projectile.type];
|
||||
}
|
||||
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
|
||||
{
|
||||
CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], Color.Red, 1);
|
||||
return true;
|
||||
Texture2D texture = Main.projectileTexture[projectile.type];
|
||||
Rectangle frame = texture.Frame(3, 9, projectile.frame / 9, projectile.frame % 9);
|
||||
Vector2 origin = frame.Size() * 0.5f;
|
||||
for (int i = 0; i < projectile.oldPos.Length; i++)
|
||||
{
|
||||
float afterimageRot = projectile.oldRot[i];
|
||||
SpriteEffects sfxForThisAfterimage = projectile.oldSpriteDirection[i] == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
|
||||
|
||||
Vector2 drawPos = projectile.oldPos[i] + projectile.Size * 0.5f - Main.screenPosition + Vector2.UnitY * projectile.gfxOffY;
|
||||
Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - i) / projectile.oldPos.Length);
|
||||
spriteBatch.Draw(texture, drawPos, frame, color, afterimageRot, origin, projectile.scale, sfxForThisAfterimage, 0f);
|
||||
}
|
||||
|
||||
SpriteEffects direction = projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
|
||||
spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, frame, projectile.GetAlpha(lightColor), projectile.rotation, origin, projectile.scale, direction, 0f);
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) => damage = 70;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
@@ -36,12 +37,36 @@ namespace CalamityMod.Projectiles.Summon
|
||||
projectile.minion = true;
|
||||
}
|
||||
|
||||
public override void AI() => CataclysmSummon.Behavior(projectile, Main.player[projectile.owner], ref Time);
|
||||
public override void AI()
|
||||
{
|
||||
if (LookingAtPlayer)
|
||||
projectile.frame = (int)Math.Round(MathHelper.Lerp(0f, 6f, Time / 45f));
|
||||
else
|
||||
{
|
||||
float slashInterpolant = ((Time - 45f) / 27f) % 1f;
|
||||
projectile.frame = (int)Math.Round(MathHelper.Lerp(6f, 15f, slashInterpolant));
|
||||
}
|
||||
CataclysmSummon.Behavior(projectile, Main.player[projectile.owner], ref Time);
|
||||
}
|
||||
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
|
||||
{
|
||||
CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], Color.Red, 1);
|
||||
return true;
|
||||
Texture2D texture = Main.projectileTexture[projectile.type];
|
||||
Rectangle frame = texture.Frame(2, 8, projectile.frame / 8, projectile.frame % 8);
|
||||
Vector2 origin = frame.Size() * 0.5f;
|
||||
for (int i = 0; i < projectile.oldPos.Length; i++)
|
||||
{
|
||||
float afterimageRot = projectile.oldRot[i];
|
||||
SpriteEffects sfxForThisAfterimage = projectile.oldSpriteDirection[i] == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
|
||||
|
||||
Vector2 drawPos = projectile.oldPos[i] + projectile.Size * 0.5f - Main.screenPosition + Vector2.UnitY * projectile.gfxOffY;
|
||||
Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - i) / projectile.oldPos.Length);
|
||||
spriteBatch.Draw(texture, drawPos, frame, color, afterimageRot, origin, projectile.scale, sfxForThisAfterimage, 0f);
|
||||
}
|
||||
|
||||
SpriteEffects direction = projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
|
||||
spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, frame, projectile.GetAlpha(lightColor), projectile.rotation, origin, projectile.scale, direction, 0f);
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) => damage = 70;
|
||||
|
||||
Reference in new issue
Block a user