Add old Boss Rush tier animation effects
This commit is contained in:
1 parent
4bd6b8c2c9
commit
c693eaa211
6 files changed
+71
No files matched your search
@@ -323,18 +323,22 @@ namespace CalamityMod.Events
|
||||
[NPCID.TheDestroyer] = npc =>
|
||||
{
|
||||
CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.BossRushTierOneEndText", XerocTextColor);
|
||||
CreateTierAnimation(2);
|
||||
},
|
||||
[NPCID.CultistBoss] = npc =>
|
||||
{
|
||||
CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.BossRushTierTwoEndText", XerocTextColor);
|
||||
CreateTierAnimation(3);
|
||||
},
|
||||
[NPCID.DukeFishron] = npc =>
|
||||
{
|
||||
CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.BossRushTierThreeEndText", XerocTextColor);
|
||||
CreateTierAnimation(4);
|
||||
},
|
||||
[ModContent.NPCType<Providence>()] = npc =>
|
||||
{
|
||||
CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.BossRushTierFourEndText", XerocTextColor);
|
||||
CreateTierAnimation(5);
|
||||
},
|
||||
[ModContent.NPCType<DevourerofGodsHead>()] = npc =>
|
||||
{
|
||||
@@ -609,6 +613,22 @@ namespace CalamityMod.Events
|
||||
|
||||
BossRushSky.CurrentInterest = 0.85f;
|
||||
}
|
||||
|
||||
public static void CreateTierAnimation(int tier)
|
||||
{
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
for (int i = 0; i < Main.maxPlayers; i++)
|
||||
{
|
||||
if (!Main.player[i].active || Main.player[i].dead)
|
||||
continue;
|
||||
|
||||
int animation = Projectile.NewProjectile(new EntitySource_WorldEvent(), Main.player[i].Center, Vector2.Zero, ModContent.ProjectileType<BossRushTierAnimation>(), 0, 0f, i);
|
||||
if (Main.projectile.IndexInRange(animation))
|
||||
Main.projectile[animation].ai[0] = tier;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Netcode
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
@@ -0,0 +1,51 @@
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
|
||||
namespace CalamityMod.Projectiles.Typeless
|
||||
{
|
||||
public class BossRushTierAnimation : ModProjectile
|
||||
{
|
||||
public int Tier => (int)Projectile.ai[0];
|
||||
|
||||
public Player Owner => Main.player[Projectile.owner];
|
||||
|
||||
public const int FrameChangeRate = 4;
|
||||
|
||||
public const int TotalFrames = 56;
|
||||
|
||||
public override string Texture => "CalamityMod/Projectiles/Typeless/BossRushTier2Animation";
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 76;
|
||||
Projectile.height = 180;
|
||||
Projectile.aiStyle = -1;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.timeLeft = FrameChangeRate * TotalFrames;
|
||||
Projectile.penetrate = -1;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Projectile.Bottom = Owner.Top - Vector2.UnitY * Projectile.scale * 36f;
|
||||
Projectile.frameCounter++;
|
||||
Projectile.frame = Projectile.frameCounter / FrameChangeRate;
|
||||
if (Projectile.frame >= TotalFrames)
|
||||
Projectile.frame = TotalFrames;
|
||||
}
|
||||
|
||||
public override Color? GetAlpha(Color lightColor) => Color.White * Projectile.Opacity;
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
Texture2D texture = ModContent.Request<Texture2D>($"CalamityMod/Projectiles/Typeless/BossRushTier{Tier}Animation").Value;
|
||||
Rectangle frame = texture.Frame(14, 4, Projectile.frame % 14, Projectile.frame / 14);
|
||||
Vector2 origin = frame.Size() * 0.5f;
|
||||
Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, frame, Projectile.GetAlpha(lightColor), 0f, origin, Projectile.scale, 0, 0f);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user