Roverdrive visuels

This commit is contained in:
IbanPlay authored and Cameron Ewell committed 2022-07-11 19:05:37 -04:00
1 parent b2973aa53a
commit 900239a849
12 files changed
+224 -27

No files matched your search

+11
View File
@@ -42,6 +42,14 @@ namespace CalamityMod.Cooldowns
GameShaders.Misc["CalamityMod:CircularBarShader"].Apply();
}
public override void DrawExpanded(SpriteBatch spriteBatch, Vector2 position, float opacity, float scale)
{
base.DrawExpanded(spriteBatch, position, opacity, scale);
float Xoffset = instance.timeLeft > 9 ? -10f : -5;
DrawBorderStringEightWay(spriteBatch, FontAssets.MouseText.Value, instance.timeLeft.ToString(), position + new Vector2(Xoffset, 4) * scale, Color.Lerp(ringColorLerpStart, Color.OrangeRed, 1 - instance.Completion), Color.Black, scale);
}
public override void DrawCompact(SpriteBatch spriteBatch, Vector2 position, float opacity, float scale)
{
Texture2D sprite = Request<Texture2D>(Texture).Value;
@@ -58,6 +66,9 @@ namespace CalamityMod.Cooldowns
int lostHeight = (int)Math.Ceiling(overlay.Height * AdjustedCompletion);
Rectangle crop = new Rectangle(0, lostHeight, overlay.Width, overlay.Height - lostHeight);
spriteBatch.Draw(overlay, position + Vector2.UnitY * lostHeight * scale, crop, OutlineColor * opacity * 0.9f, 0, sprite.Size() * 0.5f, scale, SpriteEffects.None, 0f);
float Xoffset = instance.timeLeft > 9 ? -10f : -5;
DrawBorderStringEightWay(spriteBatch, FontAssets.MouseText.Value, instance.timeLeft.ToString(), position + new Vector2(Xoffset, 4) * scale, Color.Lerp(ringColorLerpStart, Color.OrangeRed, 1 - instance.Completion), Color.Black, scale);
}
}
+4
View File
@@ -133,6 +133,10 @@ namespace CalamityMod.Effects
screenRef = new Ref<Effect>(CalamityMod.Instance.Assets.Request<Effect>("Effects/WulfrumScaffoldSelection", AssetRequestMode.ImmediateLoad).Value);
Filters.Scene["WulfrumScaffoldSelection"] = new Filter(new ScreenShaderData(screenRef, "TilePingPass"), EffectPriority.High);
Filters.Scene["WulfrumScaffoldSelection"].Load();
screenRef = new Ref<Effect>(CalamityMod.Instance.Assets.Request<Effect>("Effects/Compiler/RoverDriveShield", AssetRequestMode.ImmediateLoad).Value);
Filters.Scene["RoverDriveShield"] = new Filter(new ScreenShaderData(screenRef, "ShieldPass"), EffectPriority.High);
Filters.Scene["RoverDriveShield"].Load();
}
}
}
+53
View File
@@ -0,0 +1,53 @@
float time;
float blowUpPower; //The power the blow up effect is set as. Ideally betwen 0 and 1
float blowUpSize; //The strenght of the expansion caused by the blow up effect
float3 shieldColor;
float shieldOpacity;
float3 shieldEdgeColor;
float shieldEdgeBlendStrenght;
float noiseScale;
float resolution;
texture sampleTexture;
sampler2D Texture1Sampler = sampler_state { texture = <sampleTexture>; magfilter = LINEAR; minfilter = LINEAR; mipfilter = LINEAR; AddressU = wrap; AddressV = wrap; };
float4 main(float2 uv : TEXCOORD) : COLOR
{
//Pixelate?
//uv.x -= uv.x % (1 / resolution);
//uv.y -= uv.y % (1 / resolution);
//Crop in a circle
float distanceFromCenter = length(uv - float2(0.5, 0.5)) * 2;
if (distanceFromCenter > 1)
return float4(0, 0, 0, 0);
//"Blow up" the noise map so it looks circular.
float blownUpUVX = pow((abs(uv.x - 0.5)) * 2, blowUpPower);
float blownUpUVY = pow((abs(uv.y - 0.5)) * 2, blowUpPower);
float2 blownUpUV = float2(-blownUpUVY * blowUpSize * 0.5 + uv.x * (1 + blownUpUVY * blowUpSize), -blownUpUVX * blowUpSize * 0.5 + uv.y * (1 + blownUpUVX * blowUpSize));
//Rescale
blownUpUV *= noiseScale;
//Scroll effect
blownUpUV.x = (blownUpUV.x + time) % 1;
//Get the noise color
float4 noiseColor = tex2D(Texture1Sampler, blownUpUV);
//Apply a layers of fake fresnel
noiseColor += pow(distanceFromCenter, 6); // + pow(distanceFromCenter, 3) * 0.6; <- Brings us over into ps 3.0 territory if we have pixelation on.
//Fade the edges
if (distanceFromCenter > 0.95)
noiseColor *= (1 - ((distanceFromCenter - 0.95) / 0.05));
return noiseColor * float4(lerp(shieldColor, shieldEdgeColor, pow(distanceFromCenter, shieldEdgeBlendStrenght)), shieldOpacity);
}
technique Technique1
{
pass ShieldPass
{
PixelShader = compile ps_2_0 main();
}
}
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 187 KiB

+1
View File
@@ -660,6 +660,7 @@ namespace CalamityMod.ILEditing
private static void DrawForegroundParticles(On.Terraria.Main.orig_DrawInfernoRings orig, Main self)
{
GeneralParticleHandler.DrawAllParticles(Main.spriteBatch);
orig(self);
}
#endregion General Particle Rendering
+105 -18
View File
@@ -5,6 +5,13 @@ using Terraria.ID;
using CalamityMod.Cooldowns;
using CalamityMod.Items.Materials;
using Terraria.Audio;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria.Graphics.Shaders;
using Terraria.Graphics.Effects;
using System;
using CalamityMod.Particles;
using ReLogic.Content;
namespace CalamityMod.Items.Accessories
{
@@ -12,18 +19,96 @@ namespace CalamityMod.Items.Accessories
{
public static readonly SoundStyle ShieldHurtSound = new("CalamityMod/Sounds/Custom/RoverDriveHit") { PitchVariance = 0.6f, Volume = 0.6f, MaxInstances = 0 };
public static readonly SoundStyle ActivationSound = new("CalamityMod/Sounds/Custom/RoverDriveActivate") { Volume = 0.85f };
public static readonly SoundStyle BreakSound = new("CalamityMod/Sounds/Custom/RoverDriveBreak") { Volume = 0.75f };
public static int ProtectionMatrixDurabilityMax = 50;
public static int ProtectionMatrixRechargeTime = 60 * 10;
public static Asset<Texture2D> NoiseTex;
public override void Load()
{
On.Terraria.Main.DrawInfernoRings += DrawRoverDriveShields;
}
public override void Unload()
{
On.Terraria.Main.DrawInfernoRings -= DrawRoverDriveShields;
}
private void DrawRoverDriveShields(On.Terraria.Main.orig_DrawInfernoRings orig, Main self)
{
bool playerFound = false;
for (int i = 0; i < 255; i++)
{
if (!Main.player[i].active || Main.player[i].outOfRange || Main.player[i].dead)
continue;
if (Main.player[i].GetModPlayer<RoverDrivePlayer>().ProtectionMatrixDurability <= 0)
continue;
float scale = 0.15f + 0.03f * (0.5f + 0.5f * (float)Math.Sin(Main.GlobalTimeWrappedHourly * 0.5f + i * 0.2f));
if (playerFound == false)
{
float noiseScale = 0.6f;
Effect shieldEffect = Filters.Scene["RoverDriveShield"].GetShader().Shader;
shieldEffect.Parameters["time"].SetValue(Main.GlobalTimeWrappedHourly * 0.24f);
shieldEffect.Parameters["blowUpPower"].SetValue(2.5f);
shieldEffect.Parameters["blowUpSize"].SetValue(0.5f);
shieldEffect.Parameters["noiseScale"].SetValue(noiseScale);
//shieldEffect.Parameters["resolution"].SetValue(resolution);
float baseShieldOpacity = 0.9f + 0.1f * (float)Math.Sin(Main.GlobalTimeWrappedHourly * 2f);
shieldEffect.Parameters["shieldOpacity"].SetValue(baseShieldOpacity * (0.5f + 0.5f * (float)Math.Pow(Main.LocalPlayer.GetModPlayer<RoverDrivePlayer>().ProtectionMatrixDurability / (float)ProtectionMatrixDurabilityMax, 0.5f)));
shieldEffect.Parameters["shieldEdgeBlendStrenght"].SetValue(4f);
Color blueTint = new Color(51, 102, 255);
Color cyanTint = new Color(71, 202, 255);
Color wulfGreen = new Color(194, 255, 67) * 0.8f;
Color edgeColor = CalamityUtils.MulticolorLerp(Main.GlobalTimeWrappedHourly * 0.2f, blueTint, cyanTint, wulfGreen);
shieldEffect.Parameters["shieldColor"].SetValue(blueTint.ToVector3());
shieldEffect.Parameters["shieldEdgeColor"].SetValue(edgeColor.ToVector3());
Main.spriteBatch.End();
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, shieldEffect, Main.GameViewMatrix.TransformationMatrix);
}
playerFound = true;
Player myPlayer = Main.player[i];
if (NoiseTex == null)
NoiseTex = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/TechyNoise");
Texture2D tex = NoiseTex.Value;
Vector2 pos = myPlayer.MountedCenter + myPlayer.gfxOffY * Vector2.UnitY - Main.screenPosition;
Main.spriteBatch.Draw(tex, pos, null, Color.White, 0, tex.Size() / 2f, scale, 0, 0);
}
if (playerFound)
{
Main.spriteBatch.End();
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.Transform);
}
orig(self);
}
public override void SetStaticDefaults()
{
SacrificeTotal = 1;
DisplayName.SetDefault("Rover Drive");
Tooltip.SetDefault("Activates a protective shield that grants 15 defense for 10 seconds\n" +
//Actually 10.1 seconds at full power with a dissipation across 0.1666 seconds but whatever
"The shield then dissipates and recharges for 20 seconds before being reactivated\n" +
Tooltip.SetDefault($"Activates a protective matrix that can absorb {ProtectionMatrixDurabilityMax} damage and grants 8 defense\n" +
$"However, the systems are fickle and the shield will need {ProtectionMatrixRechargeTime / 60} seconds to charge up fully\n" +
"Getting hit during the shield recharge period will reset it back to zero\n" +
"Can also be scrapped at an extractinator");
ItemID.Sets.ExtractinatorMode[Item.type] = Item.type;
@@ -46,10 +131,12 @@ namespace CalamityMod.Items.Accessories
public override void UpdateAccessory(Player player, bool hideVisual)
{
CalamityPlayer modPlayer = player.Calamity();
modPlayer.roverDrive = true;
RoverDrivePlayer modPlayer = player.GetModPlayer<RoverDrivePlayer>();
//modPlayer.roverDrive = true;
player.GetModPlayer<RoverDrivePlayer>().RoverDriveOn = true;
modPlayer.RoverDriveOn = true;
if (modPlayer.ProtectionMatrixDurability > 0)
player.statDefense += 8;
}
//Scrappable for 3-6 wulfrum scrap or a 20% chance to get an energy core
@@ -94,9 +181,16 @@ namespace CalamityMod.Items.Accessories
if (ProtectionMatrixDurability <= 0)
{
ProtectionMatrixDurability = 0;
SoundEngine.PlaySound(RoverDrive.BreakSound, Player.Center);
Player.Calamity().GeneralScreenShakePower += 2f;
}
//Switch CD
//Sound effect of engine shutting down
int numParticles = Main.rand.Next(2, 6);
for (int i = 0; i < numParticles; i++)
{
Vector2 velocity = Main.rand.NextVector2CircularEdge(1f, 1f) * Main.rand.NextFloat(3, 14);
velocity.X += 5f * hitDirection;
GeneralParticleHandler.SpawnParticle(new TechyHoloysquareParticle(Player.Center, velocity, Main.rand.NextFloat(2.5f, 3f), Main.rand.NextBool() ? new Color(99, 255, 229) : new Color(25, 132, 247), 25));
}
}
@@ -119,6 +213,7 @@ namespace CalamityMod.Items.Accessories
ProtectionMatrixDurability = 0;
}
public override void PostUpdateMiscEffects()
{
if (!RoverDriveOn)
@@ -147,15 +242,7 @@ namespace CalamityMod.Items.Accessories
if (ProtectionMatrixDurability > 0)
{
Player.Calamity().roverDrive = true;
Player.Calamity().roverDriveTimer = 2;
}
else
{
Player.Calamity().roverDriveTimer = 618;
Player.Calamity().roverDrive = false;
Lighting.AddLight(Player.Center, Color.DeepSkyBlue.ToVector3() * 0.2f);
}
}
}
+5 -8
View File
@@ -49,7 +49,7 @@ namespace CalamityMod.Items.Armor.Wulfrum
public static readonly SoundStyle SetBreakSound = new("CalamityMod/Sounds/Custom/AbilitySounds/WulfrumBastionBreak");
public static readonly SoundStyle SetBreakSoundSafe = new("CalamityMod/Sounds/Custom/AbilitySounds/WulfrumBastionBreakSafely");
public static int BastionBuildTime = (int)(0.25f * 60);
public static int BastionBuildTime = (int)(0.55f * 60);
public static int BastionTime = 30 * 60;
public static int TimeLostPerHit = 2 * 60;
public static int BastionCooldown = 20 * 60;
@@ -87,9 +87,7 @@ namespace CalamityMod.Items.Armor.Wulfrum
private void ActivateSetBonus(On.Terraria.Player.orig_KeyDoubleTap orig, Player player, int keyDir)
{
BastionBuildTime = (int)(0.55f * 60);
if (keyDir == 0 && HasArmorSet(player))
if (keyDir == 0 && HasArmorSet(player) && !player.mount.Active)
{
//Only activate if no cooldown & available scrap.
if (!player.Calamity().cooldowns.TryGetValue(WulfrumBastion.ID, out CooldownInstance cd) && player.HasItem(ModContent.ItemType<WulfrumMetalScrap>()))
@@ -151,8 +149,7 @@ namespace CalamityMod.Items.Armor.Wulfrum
armorPlayer.wulfrumSet = true;
player.setBonus = "+3 defense and +1 max minion"; //The cooler part of the set bonus happens in modifytooltips because i can't recolor it otherwise. Madge
player.statDefense += 3;
player.setBonus = "+1 max minion"; //The cooler part of the set bonus happens in modifytooltips because i can't recolor it otherwise. Madge
player.maxMinions++;
if (PowerModeEngaged(player, out var cd))
{
@@ -179,7 +176,7 @@ namespace CalamityMod.Items.Armor.Wulfrum
player.moveSpeed *= 0.8f;
player.statDefense += 15;
player.statDefense += 13;
//Drop the player's held item if they were holding something before
if (!(Main.mouseItem.type == DummyCannon.type) && !Main.mouseItem.IsAir)
Main.LocalPlayer.QuickSpawnClonedItem(null, Main.mouseItem, Main.mouseItem.stack);
@@ -235,7 +232,7 @@ namespace CalamityMod.Items.Armor.Wulfrum
if (setBonusIndex != -1)
{
TooltipLine setBonus1 = new TooltipLine(item.Mod, "CalamityMod:SetBonus1", "Wulfrum Bastion - Double tap DOWN to equip a heavy wulfrum armor");
TooltipLine setBonus1 = new TooltipLine(item.Mod, "CalamityMod:SetBonus1", "Wulfrum Bastion - Double tap DOWN while dismounted to equip a heavy wulfrum armor");
setBonus1.OverrideColor = Color.Lerp(new Color(194, 255, 67), new Color(112, 244, 244), 0.5f + 0.5f * (float)Math.Sin(Main.GlobalTimeWrappedHourly * 3f));
tooltips.Insert(setBonusIndex + 1, setBonus1);
+40
View File
@@ -10,6 +10,7 @@ using Terraria.ID;
using Terraria.ModLoader;
using Terraria.ModLoader.Utilities;
using CalamityMod.Sounds;
using Terraria.Graphics.Effects;
namespace CalamityMod.NPCs.NormalNPCs
{
@@ -164,6 +165,8 @@ namespace CalamityMod.NPCs.NormalNPCs
{
if (Supercharged)
{
//old
/*
Texture2D shieldTexture = ModContent.Request<Texture2D>("CalamityMod/NPCs/NormalNPCs/WulfrumRoverShield").Value;
Rectangle frame = shieldTexture.Frame(1, 11, 0, (int)(Main.GlobalTimeWrappedHourly * 8) % 11);
spriteBatch.Draw(shieldTexture,
@@ -175,6 +178,43 @@ namespace CalamityMod.NPCs.NormalNPCs
NPC.scale + (float)Math.Cos(Main.GlobalTimeWrappedHourly) * 0.1f,
SpriteEffects.None,
0f);
*/
//0.6 : The noise upscale
//0.15 the scale its drawn at
float scale = 0.15f + 0.03f * (0.5f + 0.5f * (float)Math.Sin(Main.GlobalTimeWrappedHourly * 0.5f + NPC.whoAmI * 0.2f));
float noiseScale = 0.6f;
Effect shieldEffect = Terraria.Graphics.Effects.Filters.Scene["RoverDriveShield"].GetShader().Shader;
shieldEffect.Parameters["time"].SetValue(Main.GlobalTimeWrappedHourly * 0.24f);
shieldEffect.Parameters["blowUpPower"].SetValue(2.5f);
shieldEffect.Parameters["blowUpSize"].SetValue(0.5f);
shieldEffect.Parameters["noiseScale"].SetValue(noiseScale);
float baseShieldOpacity = 0.9f + 0.1f * (float)Math.Sin(Main.GlobalTimeWrappedHourly * 2f);
shieldEffect.Parameters["shieldOpacity"].SetValue(baseShieldOpacity);
shieldEffect.Parameters["shieldEdgeBlendStrenght"].SetValue(4f);
Color blueTint = new Color(51, 102, 255);
Color cyanTint = new Color(71, 202, 255);
Color wulfGreen = new Color(194, 255, 67) * 0.8f;
Color edgeColor = CalamityUtils.MulticolorLerp(Main.GlobalTimeWrappedHourly * 0.2f, blueTint, cyanTint, wulfGreen);
shieldEffect.Parameters["shieldColor"].SetValue(blueTint.ToVector3());
shieldEffect.Parameters["shieldEdgeColor"].SetValue(edgeColor.ToVector3());
Main.spriteBatch.End();
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, shieldEffect, Main.GameViewMatrix.TransformationMatrix);
if (RoverDrive.NoiseTex == null)
RoverDrive.NoiseTex = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/TechyNoise");
Texture2D tex = RoverDrive.NoiseTex.Value;
Vector2 pos = NPC.Center + NPC.gfxOffY * Vector2.UnitY - Main.screenPosition;
Main.spriteBatch.Draw(tex, pos, null, Color.White, 0, tex.Size() / 2f, scale, 0, 0);
Main.spriteBatch.End();
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.Transform);
}
}
+1
View File
@@ -33,6 +33,7 @@ namespace CalamityMod.Projectiles.Melee
public static int Lifetime = 950;
public float LifetimeCompletion => MathHelper.Clamp((Lifetime - Projectile.timeLeft) / (float)Lifetime, 0f, 1f);
public ref float BazingaTime => ref Projectile.ai[0];
public ref float AlreadyBazinged => ref Projectile.ai[1];
public static float BazingaTimeMax = 120f;
public float BazingaTimeCompletion => (BazingaTimeMax - BazingaTime) / BazingaTimeMax;
public float FadePercent => Math.Clamp(Projectile.timeLeft / FadeTime, 0f, 1f);
+4 -1
View File
@@ -101,11 +101,14 @@ namespace CalamityMod.Projectiles.Melee
screw.BazingaTime = WulfrumScrew.BazingaTimeMax;
proj.velocity = thudVelocity;
proj.damage = (int)(proj.damage * WulfrumScrewdriver.ScrewBazingaModeDamageMult);
if (screw.AlreadyBazinged == 0)
proj.damage = (int)(proj.damage * WulfrumScrewdriver.ScrewBazingaModeDamageMult);
proj.timeLeft = WulfrumScrew.Lifetime;
proj.knockBack *= 2.5f;
screw.AlreadyBazinged++;
SoundEngine.PlaySound(WulfrumScrewdriver.ScrewHitSound);
//Todo - put a funny sound that plays if you manage to pogo around the screw 3 times
if (Main.myPlayer == proj.owner)
{
Binary file not shown.