Merge branch '1.4.4' of https://github.com/CalamityTeam/CalamityMod into 1.4.4
This commit is contained in:
commit
fe158cd2f4
9 files changed
+173
-235
No files matched your search
@@ -120,27 +120,82 @@ namespace CalamityMod.CalPlayer
|
||||
}
|
||||
if (DoG != null && Main.mapStyle != 2)
|
||||
{
|
||||
Rectangle screen = new((int)Main.screenPosition.X, (int)Main.screenPosition.Y, Main.screenWidth, Main.screenHeight);
|
||||
var rift = DoG.GetRiftLocation();
|
||||
if (rift != Vector2.Zero && !Main.zenithWorld)
|
||||
int drawCount = calamityPlayer.trippy ? 4 : 1;
|
||||
|
||||
for (int i = 0; i < drawCount; i++)
|
||||
{
|
||||
var dist = Player.Distance(rift);
|
||||
var tex = ModContent.Request<Texture2D>("Terraria/Images/Extra_173").Value;
|
||||
float scale = 1f;
|
||||
Main.spriteBatch.Draw(tex, Player.Center + Player.DirectionTo(rift) * 196 * Math.Min(dist / 2400f, 2) - Main.screenPosition, null, Color.White * 0.9f * Math.Clamp(MathHelper.Lerp(0, 1, (dist - 300) / 600), 0, 1), 0, tex.Size() / 2f, scale * 0.9f, SpriteEffects.FlipHorizontally, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
var dis = Player.Distance(DoG.NPC.Center);
|
||||
if ((DoG.NPC.ai[3] < 3 || !DoG.Phase2Started) && DoG.NPC.Opacity > 0.5f && !DoG.Dying && !drawInfo.drawPlayer.isDisplayDollOrInanimate)
|
||||
var rift = DoG.GetRiftLocation();
|
||||
bool drawingRift = rift != Vector2.Zero && !Main.zenithWorld;
|
||||
|
||||
Vector2 targetCenter = drawingRift ? rift : DoG.NPC.Center;
|
||||
float diffX = targetCenter.X - Player.Center.X;
|
||||
float diffY = targetCenter.Y - Player.Center.Y;
|
||||
|
||||
// Mirror the offset based on i's index
|
||||
if (calamityPlayer.trippy)
|
||||
{
|
||||
string phase1IconPath = "CalamityMod/NPCs/DevourerofGods/DevourerofGodsHead_Head_Boss";
|
||||
string phase2IconPath = "CalamityMod/NPCs/DevourerofGods/DevourerofGodsHead_P2_Head_Boss";
|
||||
var tex = ModContent.Request<Texture2D>((DoG.Phase2Started && DoG.NPC.localAI[2] < 300) ? phase2IconPath : phase1IconPath).Value;
|
||||
Main.spriteBatch.Draw(tex, Player.Center + Player.DirectionTo(DoG.NPC.Center) * 196 * Math.Min(dis / 2400f, 2) - Main.screenPosition, null, Color.White * 0.9f * Math.Clamp(MathHelper.Lerp(0, 1, (dis - 600) / 300), 0, 1), DoG.NPC.rotation, tex.Size() / 2f, 1, SpriteEffects.None, 0);
|
||||
switch (i)
|
||||
{
|
||||
case 0: diffX = -Math.Abs(diffX); diffY = -Math.Abs(diffY); break; // Top Left
|
||||
case 1: diffX = Math.Abs(diffX); diffY = -Math.Abs(diffY); break; // Top Right
|
||||
case 2: diffX = Math.Abs(diffX); diffY = Math.Abs(diffY); break; // Bottom Right
|
||||
case 3: diffX = -Math.Abs(diffX); diffY = Math.Abs(diffY); break; // Bottom Left
|
||||
}
|
||||
}
|
||||
|
||||
Vector2 virtualTargetPos = Player.Center + new Vector2(diffX, diffY);
|
||||
float dist = Player.Distance(virtualTargetPos);
|
||||
Vector2 directionToTarget = Player.DirectionTo(virtualTargetPos);
|
||||
|
||||
if (drawingRift)
|
||||
{
|
||||
var tex = ModContent.Request<Texture2D>("Terraria/Images/Extra_173").Value;
|
||||
float opacity = 0.9f * Math.Clamp(MathHelper.Lerp(0, 1, (dist - 300) / 600), 0, 1);
|
||||
|
||||
Color drawColor = calamityPlayer.trippy ? Main.DiscoColor : Color.White * 0.9f;
|
||||
|
||||
Main.spriteBatch.Draw(tex, Player.Center + directionToTarget * 196 * Math.Min(dist / 2400f, 2) - Main.screenPosition,
|
||||
null, drawColor * opacity, 0, tex.Size() / 2f, 0.9f, SpriteEffects.FlipHorizontally, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
var dis = Player.Distance(virtualTargetPos);
|
||||
if ((DoG.NPC.ai[3] < 3 || !DoG.Phase2Started) && DoG.NPC.Opacity > 0.5f && !DoG.Dying && !drawInfo.drawPlayer.isDisplayDollOrInanimate)
|
||||
{
|
||||
string phase1IconPath = "CalamityMod/NPCs/DevourerofGods/DevourerofGodsHead_Head_Boss";
|
||||
string phase2IconPath = "CalamityMod/NPCs/DevourerofGods/DevourerofGodsHead_P2_Head_Boss";
|
||||
var tex = ModContent.Request<Texture2D>((DoG.Phase2Started && DoG.NPC.localAI[2] < 300) ? phase2IconPath : phase1IconPath).Value;
|
||||
|
||||
float baseRotation = DoG.NPC.rotation;
|
||||
|
||||
if (calamityPlayer.trippy)
|
||||
{
|
||||
Vector2 rotVec = baseRotation.ToRotationVector2();
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
rotVec.X *= -1;
|
||||
rotVec.Y *= -1;
|
||||
break;
|
||||
case 1:
|
||||
rotVec.Y *= -1;
|
||||
break;
|
||||
case 2:
|
||||
break;
|
||||
case 3:
|
||||
rotVec.X *= -1;
|
||||
break;
|
||||
}
|
||||
baseRotation = rotVec.ToRotation();
|
||||
}
|
||||
|
||||
float opacity = 0.9f * Math.Clamp(MathHelper.Lerp(0, 1, (dis - 600) / 300), 0, 1);
|
||||
Color drawColor = calamityPlayer.trippy ? new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, (int)(255 * 0.9f)) : Color.White * 0.9f;
|
||||
|
||||
Main.spriteBatch.Draw(tex, Player.Center + directionToTarget * 196 * Math.Min(dis / 2400f, 2) - Main.screenPosition, null, drawColor * opacity, baseRotation, tex.Size() / 2f, 1, SpriteEffects.None, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//Charge animation for Thread of Eradication
|
||||
|
||||
@@ -13,6 +13,10 @@ namespace CalamityMod.Items.Dyes
|
||||
{
|
||||
public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(Mod.Assets.Request<Effect>("Effects/Dyes/TarragonDyeShader"), "DyePass").
|
||||
UseColor(new Color(20, 117, 70)).UseSecondaryColor(new Color(28, 255, 55)).UseImage(Request<Texture2D>("CalamityMod/ExtraTextures/GreyscaleGradients/Bark"));
|
||||
public override void SafeSetStaticDefaults()
|
||||
{
|
||||
Item.ResearchUnlockCount = 3;
|
||||
}
|
||||
|
||||
public override void SafeSetDefaults()
|
||||
{
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using CalamityMod.Enums;
|
||||
using CalamityMod.Graphics.Primitives;
|
||||
using CalamityMod.Particles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using CalamityMod.Particles;
|
||||
using CalamityMod.Graphics.Primitives;
|
||||
using System;
|
||||
using Terraria.GameContent;
|
||||
using Terraria.Graphics.Shaders;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Magic
|
||||
{
|
||||
public class AquaSigilWaterdroplet : ModProjectile, ILocalizedModType
|
||||
public class AquaSigilWaterdroplet : ModProjectile, ILocalizedModType, IPixelatedPrimitiveRenderer
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Magic";
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
@@ -50,13 +51,20 @@ namespace CalamityMod.Projectiles.Magic
|
||||
return;
|
||||
}
|
||||
|
||||
GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Projectile.Center, Projectile.velocity, false, 2, Projectile.scale * 1.525f, Color.LightSkyBlue));
|
||||
|
||||
// Gravity!
|
||||
Projectile.velocity.Y = Projectile.velocity.Y + 0.35f;
|
||||
}
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
Texture2D texture = TextureAssets.Projectile[Type].Value;
|
||||
int frameHeight = texture.Height / Main.projFrames[Type];
|
||||
Rectangle sourceRect = new Rectangle(0, frameHeight * Projectile.frame, texture.Width, frameHeight);
|
||||
|
||||
// Standard trail drawing logic
|
||||
Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, sourceRect, Color.White, Projectile.rotation, sourceRect.Size() * 0.5f, 1f, 0);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Handle the projectile's trail from here
|
||||
private float WidthFunction(float completionRatio, Vector2 vertexPos) => MathHelper.Lerp(0f, MathHelper.Lerp(Projectile.scale * 48f, 0f, completionRatio), MathF.Pow(completionRatio, 1f / 2.5f));
|
||||
private Color ColorFunction(float completionRatio, Vector2 vertexPos)
|
||||
{
|
||||
@@ -65,19 +73,11 @@ namespace CalamityMod.Projectiles.Magic
|
||||
Color endColor = Color.LightSkyBlue;
|
||||
return Color.Lerp(endColor, Color.White, completionRatio) * fadeOpacity;
|
||||
}
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
public void RenderPixelatedPrimitives(SpriteBatch spriteBatch, GeneralDrawLayer layer)
|
||||
{
|
||||
GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/Trails/SylvestaffStreak"));
|
||||
PrimitiveRenderer.RenderTrail(Projectile.oldPos, new PrimitiveSettings(WidthFunction, ColorFunction, (_,_) => Projectile.Size * 0.5f, pixelate: false, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 32);
|
||||
|
||||
|
||||
Texture2D texture = TextureAssets.Projectile[Type].Value;
|
||||
int frameHeight = texture.Height / Main.projFrames[Type];
|
||||
Rectangle sourceRect = new Rectangle(0, frameHeight * Projectile.frame, texture.Width, frameHeight);
|
||||
|
||||
Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, sourceRect, Color.White, Projectile.rotation, sourceRect.Size() * 0.5f, 1f, 0);
|
||||
|
||||
return false;
|
||||
PrimitiveRenderer.RenderTrail(Projectile.oldPos, new PrimitiveSettings(WidthFunction, ColorFunction, (_,_) => Projectile.Size * 0.5f, pixelate: true, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 32);
|
||||
GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Projectile.Center, Projectile.velocity, false, 2, Projectile.scale * 1.525f, Color.LightSkyBlue), pixelate: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,17 +1,18 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using CalamityMod.Enums;
|
||||
using CalamityMod.Graphics.Primitives;
|
||||
using CalamityMod.Particles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using CalamityMod.Particles;
|
||||
using CalamityMod.Graphics.Primitives;
|
||||
using System;
|
||||
using Terraria.GameContent;
|
||||
using Terraria.Graphics.Shaders;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Magic
|
||||
{
|
||||
public class IgnisSigilEmbers : ModProjectile, ILocalizedModType
|
||||
public class IgnisSigilEmbers : ModProjectile, ILocalizedModType, IPixelatedPrimitiveRenderer
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Magic";
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
@@ -49,12 +50,21 @@ namespace CalamityMod.Projectiles.Magic
|
||||
return;
|
||||
}
|
||||
|
||||
GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Projectile.Center, Projectile.velocity, false, 2, Projectile.scale * 1.45f, Color.Salmon));
|
||||
|
||||
// Gravity!
|
||||
Projectile.velocity.Y = Projectile.velocity.Y + 0.35f;
|
||||
}
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
Texture2D texture = TextureAssets.Projectile[Type].Value;
|
||||
int frameHeight = texture.Height / Main.projFrames[Type];
|
||||
Rectangle sourceRect = new Rectangle(0, frameHeight * Projectile.frame, texture.Width, frameHeight);
|
||||
|
||||
Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, sourceRect, Color.White, Projectile.rotation, sourceRect.Size() * 0.5f, 1f, 0);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Handle the projectile's trail from here
|
||||
private float WidthFunction(float completionRatio, Vector2 vertexPos) => MathHelper.Lerp(0f, MathHelper.Lerp(Projectile.scale * 48f, 0f, completionRatio), MathF.Pow(completionRatio, 1f / 2.5f));
|
||||
private Color ColorFunction(float completionRatio, Vector2 vertexPos)
|
||||
{
|
||||
@@ -63,19 +73,11 @@ namespace CalamityMod.Projectiles.Magic
|
||||
Color endColor = Color.DarkOrange;
|
||||
return Color.Lerp(endColor, Color.DarkSalmon, completionRatio) * fadeOpacity;
|
||||
}
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
public void RenderPixelatedPrimitives(SpriteBatch spriteBatch, GeneralDrawLayer layer)
|
||||
{
|
||||
GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/Trails/SylvestaffStreak"));
|
||||
PrimitiveRenderer.RenderTrail(Projectile.oldPos, new PrimitiveSettings(WidthFunction, ColorFunction, (_, _) => Projectile.Size * 0.5f, pixelate: false, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 32);
|
||||
|
||||
|
||||
Texture2D texture = TextureAssets.Projectile[Type].Value;
|
||||
int frameHeight = texture.Height / Main.projFrames[Type];
|
||||
Rectangle sourceRect = new Rectangle(0, frameHeight * Projectile.frame, texture.Width, frameHeight);
|
||||
|
||||
Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, sourceRect, Color.White, Projectile.rotation, sourceRect.Size() * 0.5f, 1f, 0);
|
||||
|
||||
return false;
|
||||
PrimitiveRenderer.RenderTrail(Projectile.oldPos, new PrimitiveSettings(WidthFunction, ColorFunction, (_, _) => Projectile.Size * 0.5f, pixelate: true, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 32);
|
||||
GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Projectile.Center, Projectile.velocity, false, 2, Projectile.scale * 1.45f, Color.Salmon), pixelate: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,17 +1,18 @@
|
||||
using System;
|
||||
using CalamityMod.Enums;
|
||||
using CalamityMod.Graphics.Primitives;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using CalamityMod.Particles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.GameContent;
|
||||
using Terraria.Graphics.Shaders;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria;
|
||||
using CalamityMod.Particles;
|
||||
|
||||
namespace CalamityMod.Projectiles.Magic
|
||||
{
|
||||
public class VisNeedle : ModProjectile, ILocalizedModType
|
||||
public class VisNeedle : ModProjectile, ILocalizedModType, IPixelatedPrimitiveRenderer
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Magic";
|
||||
public override void SetStaticDefaults()
|
||||
@@ -47,6 +48,16 @@ namespace CalamityMod.Projectiles.Magic
|
||||
}
|
||||
}
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
Texture2D texture = TextureAssets.Projectile[Type].Value;
|
||||
int frameHeight = texture.Height / Main.projFrames[Type];
|
||||
Rectangle sourceRect = new Rectangle(0, frameHeight * Projectile.frame, texture.Width, frameHeight);
|
||||
|
||||
Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, sourceRect, Color.White, Projectile.rotation, sourceRect.Size() * 0.5f, 1f, 0);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Handle the projectile's trail from here
|
||||
private float WidthFunction(float completionRatio, Vector2 vertexPos) => MathHelper.Lerp(0f, MathHelper.Lerp(10f, 0f, completionRatio), MathF.Pow(completionRatio, 1f / 2.5f));
|
||||
@@ -57,19 +68,10 @@ namespace CalamityMod.Projectiles.Magic
|
||||
Color endColor = Color.Lerp(Color.Magenta, Color.Violet, (float)Math.Sin(completionRatio * MathHelper.Pi * 2f - offsetTime * 4f) * 0.5f + 0.5f);
|
||||
return Color.Lerp(endColor, Color.White, completionRatio) * fadeOpacity;
|
||||
}
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
public void RenderPixelatedPrimitives(SpriteBatch spriteBatch, GeneralDrawLayer layer)
|
||||
{
|
||||
GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/Trails/SylvestaffStreak"));
|
||||
PrimitiveRenderer.RenderTrail(Projectile.oldPos, new PrimitiveSettings(WidthFunction, ColorFunction, (_,_) => Projectile.Size * 0.5f, pixelate: false, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 30);
|
||||
|
||||
|
||||
Texture2D texture = TextureAssets.Projectile[Type].Value;
|
||||
int frameHeight = texture.Height / Main.projFrames[Type];
|
||||
Rectangle sourceRect = new Rectangle(0, frameHeight * Projectile.frame, texture.Width, frameHeight);
|
||||
|
||||
Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, sourceRect, Color.White, Projectile.rotation, sourceRect.Size() * 0.5f, 1f, 0);
|
||||
|
||||
return false;
|
||||
PrimitiveRenderer.RenderTrail(Projectile.oldPos, new PrimitiveSettings(WidthFunction, ColorFunction, (_, _) => Projectile.Size* 0.5f, pixelate: true, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 30);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,19 +1,20 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using CalamityMod.Dusts;
|
||||
using CalamityMod.Enums;
|
||||
using CalamityMod.Graphics.Primitives;
|
||||
using CalamityMod.Particles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.ID;
|
||||
using Terraria.Audio;
|
||||
using CalamityMod.Graphics.Primitives;
|
||||
using Terraria.GameContent;
|
||||
using Terraria.Graphics.Shaders;
|
||||
using CalamityMod.Particles;
|
||||
using System;
|
||||
using CalamityMod.Dusts;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Magic
|
||||
{
|
||||
public class WarpSigilShot : ModProjectile, ILocalizedModType
|
||||
public class WarpSigilShot : ModProjectile, ILocalizedModType, IPixelatedPrimitiveRenderer
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Magic";
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
@@ -79,9 +80,6 @@ namespace CalamityMod.Projectiles.Magic
|
||||
}
|
||||
Projectile.friendly = DamageStatus == 1 ? true : false;
|
||||
|
||||
// Main orb/center of the projectile
|
||||
GeneralParticleHandler.SpawnParticle(new SquishyLightParticle(Projectile.Center, Projectile.velocity, Projectile.scale * 0.425f, Color.Magenta, 2, 1f, 0f, 1f));
|
||||
|
||||
float sine = (float)Math.Sin(Projectile.timeLeft * 0.575f / MathHelper.Pi);
|
||||
Vector2 offset = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.PiOver2) * sine * 16f;
|
||||
if (Main.rand.NextBool(5))
|
||||
@@ -93,32 +91,6 @@ namespace CalamityMod.Projectiles.Magic
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Standard trail drawing logic
|
||||
private float WidthFunction(float completionRatio, Vector2 vertexPos) => MathHelper.Lerp(0f, MathHelper.Lerp(32f, 0f, completionRatio), MathF.Pow(completionRatio, 1f / 2.5f));
|
||||
|
||||
private Color ColorFunction(float completionRatio, Vector2 vertexPos)
|
||||
{
|
||||
float offsetTime = Main.GlobalTimeWrappedHourly;
|
||||
float fadeOpacity = Utils.GetLerpValue(0.5f, 0f, completionRatio, true) * Projectile.Opacity;
|
||||
Color endColor = Color.Lerp(Color.Magenta, Color.DarkMagenta, (float)Math.Sin(completionRatio * MathHelper.Pi * 1.6f - offsetTime * 4f) * 0.5f + 0.5f);
|
||||
return Color.Lerp(endColor, Color.White, completionRatio) * fadeOpacity;
|
||||
}
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/Trails/SylvestaffStreak"));
|
||||
PrimitiveRenderer.RenderTrail(Projectile.oldPos, new PrimitiveSettings(WidthFunction, ColorFunction, (_,_) => Projectile.Size * 0.5f, pixelate: false, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 32);
|
||||
|
||||
Texture2D texture = TextureAssets.Projectile[Type].Value;
|
||||
int frameHeight = texture.Height / Main.projFrames[Type];
|
||||
Rectangle sourceRect = new Rectangle(0, frameHeight * Projectile.frame, texture.Width, frameHeight);
|
||||
|
||||
Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, sourceRect, Color.White, Projectile.rotation, sourceRect.Size() * 0.5f, 1f, SpriteEffects.None, 0);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void OnKill(int timeLeft)
|
||||
{
|
||||
SoundStyle w = new("CalamityMod/Sounds/Custom/PlagueSounds/PlagueBoom4");
|
||||
@@ -134,5 +106,32 @@ namespace CalamityMod.Projectiles.Magic
|
||||
dust.scale = 0.5f;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
Texture2D texture = TextureAssets.Projectile[Type].Value;
|
||||
int frameHeight = texture.Height / Main.projFrames[Type];
|
||||
Rectangle sourceRect = new Rectangle(0, frameHeight * Projectile.frame, texture.Width, frameHeight);
|
||||
|
||||
Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, sourceRect, Color.White, Projectile.rotation, sourceRect.Size() * 0.5f, 1f, SpriteEffects.None, 0);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Handle the projectile's trail from here
|
||||
private float WidthFunction(float completionRatio, Vector2 vertexPos) => MathHelper.Lerp(0f, MathHelper.Lerp(32f, 0f, completionRatio), MathF.Pow(completionRatio, 1f / 2.5f));
|
||||
private Color ColorFunction(float completionRatio, Vector2 vertexPos)
|
||||
{
|
||||
float offsetTime = Main.GlobalTimeWrappedHourly;
|
||||
float fadeOpacity = Utils.GetLerpValue(0.5f, 0f, completionRatio, true) * Projectile.Opacity;
|
||||
Color endColor = Color.Lerp(Color.Magenta, Color.DarkMagenta, (float)Math.Sin(completionRatio * MathHelper.Pi * 1.6f - offsetTime * 4f) * 0.5f + 0.5f);
|
||||
return Color.Lerp(endColor, Color.White, completionRatio) * fadeOpacity;
|
||||
}
|
||||
public void RenderPixelatedPrimitives(SpriteBatch spriteBatch, GeneralDrawLayer layer)
|
||||
{
|
||||
GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/Trails/SylvestaffStreak"));
|
||||
PrimitiveRenderer.RenderTrail(Projectile.oldPos, new PrimitiveSettings(WidthFunction, ColorFunction, (_,_) => Projectile.Size * 0.5f, pixelate: true, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 32);
|
||||
|
||||
GeneralParticleHandler.SpawnParticle(new SquishyLightParticle(Projectile.Center, Projectile.velocity, Projectile.scale * 0.4f, Color.Magenta, 2, 1f, 0.5f, 1f), pixelate: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -45,17 +45,6 @@ namespace CalamityMod.Systems
|
||||
});
|
||||
}
|
||||
|
||||
// Replace the shimmer gen to make it place sanely
|
||||
int shimmerIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Shimmer"));
|
||||
if (shimmerIndex != -1)
|
||||
{
|
||||
tasks[shimmerIndex] = new PassLegacy("Shimmer", (progress, config) =>
|
||||
{
|
||||
progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.BetterShimmer").Value;
|
||||
CustomShimmer.NewShimmer();
|
||||
});
|
||||
}
|
||||
|
||||
// Better Underworld structures after the world has been smoothed
|
||||
int underworldStructuresIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Smooth World"));
|
||||
if (underworldStructuresIndex != -1)
|
||||
|
||||
@@ -304,7 +304,7 @@ namespace CalamityMod.Tiles
|
||||
AchievementsHelper.NotifyProgressionEvent(6); // Gives the Begone, Evil! achievement
|
||||
}
|
||||
|
||||
// Drop Evil Smasher on every 12 alter smashed
|
||||
// Drop Evil Smasher on every 12 altar smashed
|
||||
if (WorldGen.altarCount > 1 && WorldGen.altarCount % 12 == 0)
|
||||
DropItem(i, j, ItemType<EvilSmasher>(), quantity: 1, asStack: true, prefix: true);
|
||||
}
|
||||
@@ -315,46 +315,6 @@ namespace CalamityMod.Tiles
|
||||
if (Main.rand.NextBool(300))
|
||||
DropItem(i, j, ItemType<GoldenBomb>(), quantity: 1, asStack: true);
|
||||
}
|
||||
|
||||
// Mature herbs always drop 1 seed (Blooming herbs drop between 1 and 3 seeds, more with Regrowth items)
|
||||
if (type == TileID.MatureHerbs)
|
||||
{
|
||||
int herbType = Main.tile[i, j].TileFrameX / 18;
|
||||
int seedQuantity = Main.rand.Next(2) + 1;
|
||||
switch (herbType)
|
||||
{
|
||||
default:
|
||||
break;
|
||||
|
||||
case (int)HerbType.Daybloom:
|
||||
DropItem(i, j, ItemID.DaybloomSeeds, quantity: seedQuantity, asStack: true);
|
||||
break;
|
||||
|
||||
case (int)HerbType.Moonglow:
|
||||
DropItem(i, j, ItemID.MoonglowSeeds, quantity: seedQuantity, asStack: true);
|
||||
break;
|
||||
|
||||
case (int)HerbType.Blinkroot:
|
||||
DropItem(i, j, ItemID.BlinkrootSeeds, quantity: seedQuantity, asStack: true);
|
||||
break;
|
||||
|
||||
case (int)HerbType.Deathweed:
|
||||
DropItem(i, j, ItemID.DeathweedSeeds, quantity: seedQuantity, asStack: true);
|
||||
break;
|
||||
|
||||
case (int)HerbType.Waterleaf:
|
||||
DropItem(i, j, ItemID.WaterleafSeeds, quantity: seedQuantity, asStack: true);
|
||||
break;
|
||||
|
||||
case (int)HerbType.Fireblossom:
|
||||
DropItem(i, j, ItemID.FireblossomSeeds, quantity: seedQuantity, asStack: true);
|
||||
break;
|
||||
|
||||
case (int)HerbType.Shiverthorn:
|
||||
DropItem(i, j, ItemID.ShiverthornSeeds, quantity: seedQuantity, asStack: true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void DropItem(int i, int j, int itemType, int quantity, bool asStack, Vector2 spreadMinMax = default, bool prefix = false)
|
||||
|
||||
@@ -1,73 +0,0 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using ReLogic.Utilities;
|
||||
using Terraria;
|
||||
using Terraria.WorldBuilding;
|
||||
|
||||
namespace CalamityMod.World
|
||||
{
|
||||
public class CustomShimmer
|
||||
{
|
||||
public static void NewShimmer()
|
||||
{
|
||||
// Large = 4, Medium = 3, Small = 2
|
||||
int worldSize = (int)(Main.maxTilesX / 4200f * 2f);
|
||||
int minOffsetX = 240;
|
||||
int maxOffsetX;
|
||||
switch (worldSize)
|
||||
{
|
||||
default:
|
||||
case 2:
|
||||
maxOffsetX = 300;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
maxOffsetX = 360;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
maxOffsetX = 420;
|
||||
break;
|
||||
}
|
||||
|
||||
int offset = 50;
|
||||
int shimmerMinDepth = (int)((Main.worldSurface + Main.rockLayer) * 0.5) + offset;
|
||||
int shimmerMaxDepth = (int)(((double)((Main.maxTilesY - 250) * 2) + Main.rockLayer) * 0.33);
|
||||
shimmerMaxDepth = (int)MathHelper.Clamp(shimmerMaxDepth, shimmerMinDepth + 50, Main.maxTilesY - 460);
|
||||
|
||||
int shimmerPositionY = WorldGen.genRand.Next(shimmerMinDepth, shimmerMaxDepth);
|
||||
int shimmerPositionX = ((GenVars.dungeonSide < 0) ? WorldGen.genRand.Next(Main.maxTilesX - maxOffsetX, Main.maxTilesX - minOffsetX) : WorldGen.genRand.Next(minOffsetX, maxOffsetX));
|
||||
int remixSeedShimmerMinDepth = (int)Main.worldSurface + 150;
|
||||
int remixSeedShimmerMaxDepth = (int)((Main.rockLayer + Main.worldSurface + 200D) * 0.5);
|
||||
if (remixSeedShimmerMaxDepth <= remixSeedShimmerMinDepth)
|
||||
remixSeedShimmerMaxDepth = remixSeedShimmerMinDepth + 50;
|
||||
|
||||
if (WorldGen.tenthAnniversaryWorldGen)
|
||||
shimmerPositionY = WorldGen.genRand.Next(remixSeedShimmerMinDepth, remixSeedShimmerMaxDepth);
|
||||
|
||||
int attempts = 0;
|
||||
while (!WorldGen.ShimmerMakeBiome(shimmerPositionX, shimmerPositionY))
|
||||
{
|
||||
attempts++;
|
||||
if (WorldGen.tenthAnniversaryWorldGen && attempts < 10000)
|
||||
{
|
||||
shimmerPositionY = WorldGen.genRand.Next(remixSeedShimmerMinDepth, remixSeedShimmerMaxDepth);
|
||||
shimmerPositionX = ((GenVars.dungeonSide < 0) ? WorldGen.genRand.Next(Main.maxTilesX - maxOffsetX, Main.maxTilesX - minOffsetX) : WorldGen.genRand.Next(minOffsetX, maxOffsetX));
|
||||
}
|
||||
else if (attempts > 20000)
|
||||
{
|
||||
shimmerPositionY = WorldGen.genRand.Next((int)Main.worldSurface + 120, shimmerMaxDepth);
|
||||
shimmerPositionX = ((GenVars.dungeonSide < 0) ? WorldGen.genRand.Next(Main.maxTilesX - maxOffsetX * 2, Main.maxTilesX - minOffsetX) : WorldGen.genRand.Next(minOffsetX, maxOffsetX * 2));
|
||||
}
|
||||
else
|
||||
{
|
||||
shimmerPositionY = WorldGen.genRand.Next((int)((Main.worldSurface + Main.rockLayer) * 0.5) + 20, shimmerMaxDepth);
|
||||
shimmerPositionX = ((GenVars.dungeonSide < 0) ? WorldGen.genRand.Next(Main.maxTilesX - maxOffsetX, Main.maxTilesX - minOffsetX) : WorldGen.genRand.Next(minOffsetX, maxOffsetX));
|
||||
}
|
||||
}
|
||||
|
||||
GenVars.shimmerPosition = new Vector2D(shimmerPositionX, shimmerPositionY);
|
||||
int genArea = 200;
|
||||
GenVars.structures.AddProtectedStructure(new Rectangle(shimmerPositionX - (int)(genArea * 0.5f), shimmerPositionY - (int)(genArea * 0.5f), genArea, genArea));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user