MERGE: Dozezoze's Devourer of Gods Rework
No files matched your search
@@ -1,4 +1,6 @@
|
||||
using Terraria;
|
||||
using CalamityMod.Particles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.Localization;
|
||||
using Terraria.ModLoader;
|
||||
@@ -23,6 +25,18 @@ namespace CalamityMod.Buffs.StatDebuffs
|
||||
public override void Update(Player player, ref int buffIndex)
|
||||
{
|
||||
player.Calamity().DoGExtremeGravity = true;
|
||||
if (player.miscCounter % 10 == 0)
|
||||
{
|
||||
float halfWidth = player.width * 0.5f;
|
||||
float halfHeight = player.height * 0.5f;
|
||||
for (var i = 0; i < 1; i++)
|
||||
{
|
||||
var position = player.Center + new Vector2(Main.rand.NextFloat(-halfWidth, halfWidth), Main.rand.NextFloat(-halfHeight, halfHeight));
|
||||
Particle arrow = new StatChangeArrow(position, -(Vector2.UnitY * 5).RotatedByRandom(1f), MathHelper.PiOver2, Color.Fuchsia, Color.Fuchsia * 0f, 0.75f, 60);
|
||||
((StatChangeArrow)arrow).AffectedByGravity = true;
|
||||
GeneralParticleHandler.SpawnParticle(arrow);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,6 @@
|
||||
using Terraria;
|
||||
using CalamityMod.Particles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
@@ -18,6 +20,18 @@ namespace CalamityMod.Buffs.StatDebuffs
|
||||
public override void Update(Player player, ref int buffIndex)
|
||||
{
|
||||
player.Calamity().warped = true;
|
||||
if (player.miscCounter % 10 == 0)
|
||||
{
|
||||
float halfWidth = player.width * 0.5f;
|
||||
float halfHeight = player.height * 0.5f;
|
||||
for (var i = 0; i < 1; i++)
|
||||
{
|
||||
var position = player.Center + new Vector2(Main.rand.NextFloat(-halfWidth, halfWidth), Main.rand.NextFloat(-halfHeight, halfHeight));
|
||||
Particle arrow = new StatChangeArrow(position, -(Vector2.UnitY * 5).RotatedByRandom(1f), -MathHelper.PiOver2, Color.Cyan, Color.Cyan * 0f, 0.75f, 60);
|
||||
((StatChangeArrow)arrow).AffectedByGravity = true;
|
||||
GeneralParticleHandler.SpawnParticle(arrow);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -194,6 +194,10 @@ namespace CalamityMod.CalPlayer
|
||||
public FishingMinigames SelectedFishingMinigame = FishingMinigames.None;
|
||||
public bool countsAsAnyWet => (Player.armor[0].type == ItemID.FishBowl || Player.wetCount > 0 || Player.wet || Player.honeyWet || Player.lavaWet);
|
||||
|
||||
public CombatText subtitletext = null;
|
||||
public Color[] subtitleColors = new Color[] { Color.White, Color.White };
|
||||
public int DoGHeadHitCounter = 0;
|
||||
|
||||
public StatModifier TypelessDebuffMultiplier = new();
|
||||
public StatModifier HeatDebuffMultiplier = new();
|
||||
public StatModifier ColdDebuffMultiplier = new();
|
||||
@@ -2011,6 +2015,10 @@ namespace CalamityMod.CalPlayer
|
||||
#region ResetEffects
|
||||
public override void ResetEffects()
|
||||
{
|
||||
if (!areThereAnyDamnBosses)
|
||||
{
|
||||
DoGHeadHitCounter = 0;
|
||||
}
|
||||
ViridVanguardActiveAttackerThisFrame = Main.projectile.Any(x => x.active && x.type == ModContent.ProjectileType<ViridVanguardBlade>() && x.owner == Player.whoAmI && x.ModProjectile<ViridVanguardBlade>().CurrentState == ViridVanguardBlade.ViridVanguardAIState.PhotonRipperZenithSlashes);
|
||||
ViridVanguardRotation = MathHelper.WrapAngle(ViridVanguardRotation + ViridVanguardRotationToAdd);
|
||||
ViridVanguardRotationToAdd = ViridVanguard.IdleCirclingSpeed;
|
||||
@@ -4512,6 +4520,20 @@ namespace CalamityMod.CalPlayer
|
||||
|
||||
public override void PostUpdate()
|
||||
{
|
||||
|
||||
if (subtitletext != null)
|
||||
{
|
||||
if (!subtitletext.active)
|
||||
{
|
||||
subtitletext = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
subtitletext.position = Player.Center + new Vector2(-FontAssets.CombatText[subtitletext.crit ? 1 : 0].Value.MeasureString(subtitletext.text).X * 0.5f, 64);
|
||||
subtitletext.color = Color.Lerp(subtitleColors[1], subtitleColors[0], subtitletext.lifeTime / 120f);
|
||||
}
|
||||
}
|
||||
|
||||
#region Managing time control
|
||||
if (Main.netMode != NetmodeID.Server && Player == Main.LocalPlayer)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.Buffs.StatBuffs;
|
||||
using CalamityMod.Buffs.StatDebuffs;
|
||||
@@ -7,6 +8,7 @@ using CalamityMod.CalPlayer.DrawLayers;
|
||||
using CalamityMod.Dusts;
|
||||
using CalamityMod.Items.Weapons.Magic;
|
||||
using CalamityMod.Items.Weapons.Ranged;
|
||||
using CalamityMod.NPCs.DevourerofGods;
|
||||
using CalamityMod.Particles;
|
||||
using CalamityMod.Projectiles.Typeless;
|
||||
using CalamityMod.Systems.Collections;
|
||||
@@ -65,6 +67,40 @@ namespace CalamityMod.CalPlayer
|
||||
|
||||
CalamityPlayer calamityPlayer = Player.Calamity();
|
||||
|
||||
//DoG Boss Cursor
|
||||
DevourerofGodsHead DoG = null;
|
||||
foreach (var item in Main.ActiveNPCs)
|
||||
{
|
||||
if (item.type == ModContent.NPCType<DevourerofGodsHead>()) {
|
||||
DoG = item.ModNPC<DevourerofGodsHead>();
|
||||
break;
|
||||
}
|
||||
}
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Dust modifications while high.
|
||||
if (calamityPlayer.trippy)
|
||||
{
|
||||
|
||||
@@ -36,6 +36,7 @@ using CalamityMod.Items.Weapons.Melee;
|
||||
using CalamityMod.Items.Weapons.Rogue;
|
||||
using CalamityMod.NPCs;
|
||||
using CalamityMod.NPCs.Cryogen;
|
||||
using CalamityMod.NPCs.DevourerofGods;
|
||||
using CalamityMod.NPCs.Other;
|
||||
using CalamityMod.NPCs.ProfanedGuardians;
|
||||
using CalamityMod.NPCs.Providence;
|
||||
@@ -510,6 +511,24 @@ namespace CalamityMod.CalPlayer
|
||||
damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.Norfleet").ToNetworkText(Player.name));
|
||||
NorfleetCounter = 0;
|
||||
|
||||
if (damageSource.TryGetCausingEntity(out var Entity) && Entity is NPC && (Entity as NPC).type == ModContent.NPCType<DevourerofGodsHead>())
|
||||
{
|
||||
var npc = Main.npc[damageSource.SourceNPCIndex];
|
||||
if (npc.ai[3] < 2) //Divinity Devourer
|
||||
{
|
||||
damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.DivinityDevourer"+Main.rand.Next(1,4)).ToNetworkText(Player.name));
|
||||
}
|
||||
else if (npc.ai[3] >= 3)
|
||||
if (npc.life > npc.lifeMax / 4) //Dimensional Drive
|
||||
{
|
||||
damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.DimensionalDrive").ToNetworkText(Player.name));
|
||||
}
|
||||
else //Ultracosmic Maelstrom
|
||||
{
|
||||
damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.UltracosmicMaelstrom" + Main.rand.Next(1, 3)).ToNetworkText(Player.name));
|
||||
}
|
||||
}
|
||||
|
||||
if (NPC.AnyNPCs(ModContent.NPCType<SupremeCalamitas>()))
|
||||
{
|
||||
if (sCalDeathCount < 51)
|
||||
|
||||
@@ -3769,7 +3769,7 @@ namespace CalamityMod.CalPlayer
|
||||
|
||||
if ((warped || caribbeanRum) && !Player.slowFall && !Player.mount.Active)
|
||||
{
|
||||
float velocityYMultiplier = (warped && Main.getGoodWorld) ? 1.02f : 1.01f;
|
||||
float velocityYMultiplier = 1.01f;
|
||||
Player.velocity.Y *= velocityYMultiplier;
|
||||
}
|
||||
|
||||
|
||||
@@ -55,6 +55,10 @@ namespace CalamityMod
|
||||
[DefaultValue(true)]
|
||||
public bool SunkenSeaBackgroundDistortion { get; set; }
|
||||
|
||||
[BackgroundColor(192, 54, 64, 192)]
|
||||
[DefaultValue(true)]
|
||||
public bool FancyBackgroundVisuals { get; set; }
|
||||
|
||||
private const int MinParticleLimit = 500;
|
||||
private const int MaxParticleLimit = 10000;
|
||||
|
||||
|
||||
@@ -225,6 +225,22 @@ namespace CalamityMod.Effects
|
||||
|
||||
// The underwater rays seen at the top of the Sunken Sea Mod Menu.
|
||||
internal static Effect UnderwaterRaysShader;
|
||||
|
||||
// The blowing wind-like effect seen in the background during DoG's fight.
|
||||
internal static Effect DoGDistortionWindsShader;
|
||||
|
||||
// The rolling fog clouds seen behind the Distortion Winds effect during DoG's fight.
|
||||
internal static Effect DoGBackgroundFogShader;
|
||||
|
||||
// Allows a texture to control its opacity from the edges to the center in the shape of a circle.
|
||||
internal static Effect CircularOpacityShader;
|
||||
|
||||
// The shader effect imposed onto the static crack textures seen during DoG's fight. Fades out the texture from its edges to its center and
|
||||
// allows it to lerp between two colors depending on the brightness of individual pixels along the sampled texture.
|
||||
internal static Effect DoGRealityCrackShader;
|
||||
|
||||
// The distorted circular effect seen emanating from the distortion rift during DoG's fight.
|
||||
internal static Effect DoGRiftAuraShader;
|
||||
#endregion
|
||||
|
||||
internal static Asset<Effect> SunkenSeaMenuLogoWater;
|
||||
@@ -450,6 +466,21 @@ namespace CalamityMod.Effects
|
||||
|
||||
UnderwaterRaysShader = LoadShader("UnderwaterRaysShader");
|
||||
RegisterMiscShader(UnderwaterRaysShader, "UnderwaterRayPass", "UnderwaterRays");
|
||||
|
||||
DoGDistortionWindsShader = LoadShader("DoGDistortionWindsShader");
|
||||
RegisterMiscShader(DoGDistortionWindsShader, "DistortionWindsPass", "DoGDistortionWinds");
|
||||
|
||||
DoGBackgroundFogShader = LoadShader("DoGBackgroundFogShader");
|
||||
RegisterMiscShader(DoGBackgroundFogShader, "DoGFogPass", "DoGBackgroundFog");
|
||||
|
||||
CircularOpacityShader = LoadShader("CircularOpacityShader");
|
||||
RegisterMiscShader(CircularOpacityShader, "CircularOpacityPass", "CircularOpacity");
|
||||
|
||||
DoGRealityCrackShader = LoadShader("DoGRealityCrackShader");
|
||||
RegisterMiscShader(DoGRealityCrackShader, "DoGRealityCrackPass", "DoGRealityCrack");
|
||||
|
||||
DoGRiftAuraShader = LoadShader("DoGRiftAuraShader");
|
||||
RegisterMiscShader(DoGRiftAuraShader, "DoGRiftAuraPass", "DoGRiftAura");
|
||||
#endregion
|
||||
|
||||
SunkenSeaMenuLogoWater = LoadShaderAsset("UI/SunkenSeaMenuLogoWater");
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
sampler baseTexture : register(s0);
|
||||
|
||||
float opacityCutoffValue;
|
||||
float fadeoutPower;
|
||||
float overallOpacity;
|
||||
|
||||
float4 PixelShaderFunction(float4 sampleColor : COLOR0, float2 coords : TEXCOORD0) : COLOR0
|
||||
{
|
||||
// Convert the regular coordinates to polar coordinates to get a circle shape.
|
||||
float2 centeredCoords = coords - 0.5;
|
||||
float polarAngle = atan2(centeredCoords.y, centeredCoords.x) / 6.283;
|
||||
float distanceToCenter = length(centeredCoords);
|
||||
|
||||
float2 polarCoords = float2(polarAngle, distanceToCenter);
|
||||
float4 color = tex2D(baseTexture, coords);
|
||||
|
||||
// Fade out from the edges of the texture to the middle depending on the cutoff value.
|
||||
// "fadeoutPower" values which vary from 1 will affect how strong the edges fade while also increasing the brightness of
|
||||
// the non-faded parts of the image to the middle. Use this wisely.
|
||||
if (-polarCoords.y < opacityCutoffValue)
|
||||
color.rgba *= pow(-polarCoords.y / (polarCoords.y - opacityCutoffValue), -fadeoutPower);
|
||||
|
||||
return color * sampleColor * overallOpacity;
|
||||
}
|
||||
|
||||
technique Technique1
|
||||
{
|
||||
pass CircularOpacityPass
|
||||
{
|
||||
PixelShader = compile ps_2_0 PixelShaderFunction();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
sampler cloudsTexture : register(s0);
|
||||
sampler distortionTexture : register(s1);
|
||||
sampler erosionTexture : register(s2);
|
||||
|
||||
float time;
|
||||
float overallOpacity;
|
||||
float distortionStrength;
|
||||
float mainNoiseTextureScale;
|
||||
float distortionTextureScale;
|
||||
float erosionTextureScale;
|
||||
float erosionMin;
|
||||
float gradientPrecision;
|
||||
|
||||
float2 pixelationFactor;
|
||||
float2 worldOffset;
|
||||
|
||||
float3 darkerPixelColor;
|
||||
float3 brighterPixelColor;
|
||||
|
||||
float4 PixelShaderFunction(float4 sampleColor : COLOR0, float2 coords : TEXCOORD0) : COLOR0
|
||||
{
|
||||
// Pixelation.
|
||||
coords = round(coords * pixelationFactor) / pixelationFactor;
|
||||
|
||||
// Stretch the coords out to better mimic a blowing wind effect.
|
||||
coords *= float2(0.95, 1.05);
|
||||
|
||||
// Move with the player in the world.
|
||||
coords += worldOffset;
|
||||
|
||||
// Calculate the distortion that'll be applied to our base noise coordinates.
|
||||
float2 distortedCoords = coords + float2(time * -0.03, time * -0.01) * distortionTextureScale;
|
||||
float distortion = tex2D(distortionTexture, distortedCoords).r * distortionStrength;
|
||||
|
||||
// Calculate the base noise colors.
|
||||
float2 adjustedCoords = (coords + distortion) * mainNoiseTextureScale;
|
||||
float4 scrollingNoise1 = tex2D(cloudsTexture, adjustedCoords + float2(time * -0.065, 0));
|
||||
float4 scrollingNoise2 = tex2D(cloudsTexture, adjustedCoords + float2(time * -0.015, 0));
|
||||
|
||||
// Multiply the red values of the noise maps together to get the horizontal brightness of both noise maps.
|
||||
float combinedBrightness = scrollingNoise1.r * scrollingNoise2.r;
|
||||
|
||||
// Lerp between the two colors based on the brightness of a pixel.
|
||||
float3 colorFromBrightness = lerp(darkerPixelColor, brighterPixelColor, combinedBrightness);
|
||||
|
||||
// Erode the final output to break up the entire effect slightly.
|
||||
float erosionColor = tex2D(erosionTexture, adjustedCoords + float2(time * -0.07, time * -0.02) * erosionTextureScale);
|
||||
float erosionMax = erosionMin + 1;
|
||||
float erosion = smoothstep(erosionMin, erosionMax, erosionColor.r);
|
||||
|
||||
float4 finalColor = (float4(colorFromBrightness, 1) * (scrollingNoise1 + scrollingNoise2));
|
||||
finalColor *= erosion;
|
||||
|
||||
// Apply posterization.
|
||||
finalColor = round(finalColor * gradientPrecision) / gradientPrecision;
|
||||
|
||||
return finalColor * overallOpacity;
|
||||
|
||||
}
|
||||
|
||||
technique Technique1
|
||||
{
|
||||
pass DoGFogPass
|
||||
{
|
||||
PixelShader = compile ps_2_0 PixelShaderFunction();
|
||||
}
|
||||
}
|
||||
@@ -1,39 +1,35 @@
|
||||
sampler uImage0 : register(s0);
|
||||
sampler uImage1 : register(s1);
|
||||
float3 uColor;
|
||||
float3 uSecondaryColor;
|
||||
float uOpacity : register(C0);
|
||||
float uSaturation;
|
||||
float uRotation;
|
||||
float uTime;
|
||||
float4 uSourceRect;
|
||||
float2 uWorldPosition;
|
||||
float uDirection;
|
||||
float3 uLightSource;
|
||||
float2 uImageSize0;
|
||||
float2 uImageSize1;
|
||||
float4 uShaderSpecificData;
|
||||
sampler baseTexture : register(s0);
|
||||
sampler disintegrationTexture : register(s1);
|
||||
|
||||
float disintegrationProgress : register(C0);
|
||||
float disintegrationScale;
|
||||
float2 worldPosition;
|
||||
float2 pixelSize;
|
||||
|
||||
// This shader is largely based on code used for ExampleMod's cool death animation thing; it is suprisingly useful for this use case.
|
||||
float4 PixelShaderFunction(float2 coords : TEXCOORD0) : COLOR0
|
||||
{
|
||||
float4 color = tex2D(uImage0, coords);
|
||||
float4 color = tex2D(baseTexture, coords);
|
||||
if (!any(color))
|
||||
return color;
|
||||
|
||||
float fade = pow(saturate(1 - uOpacity), 0.7);
|
||||
float4 color1 = tex2D(uImage1, float2(coords.x, frac(coords.y + uSaturation * 0.11)) * 0.3);
|
||||
coords += worldPosition;
|
||||
coords = round(coords * pixelSize) / pixelSize;
|
||||
|
||||
float disintegration = pow(saturate(1 - disintegrationProgress), 0.7);
|
||||
float2 disintegrationCoords = coords * disintegrationScale;
|
||||
float4 disintegrationColor = tex2D(disintegrationTexture, disintegrationCoords);
|
||||
|
||||
float readRed = fade * 1.05;
|
||||
|
||||
if (color1.r > readRed)
|
||||
float disappearThreshold = disintegration * 1.05;
|
||||
if (disintegrationColor.r > disappearThreshold)
|
||||
{
|
||||
color.rgba = 0;
|
||||
}
|
||||
else if (color1.b > fade)
|
||||
else if (disintegrationColor.b > disintegration)
|
||||
{
|
||||
color = float4(1, 105.0 / 255, 180.0 / 255, 1);
|
||||
}
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
@@ -41,6 +37,6 @@ technique Technique1
|
||||
{
|
||||
pass DisintegrationPass
|
||||
{
|
||||
PixelShader = compile ps_2_0 PixelShaderFunction();
|
||||
PixelShader = compile ps_3_0 PixelShaderFunction();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
sampler mainWindTexture : register(s0);
|
||||
sampler windHighlightsTexture : register(s1);
|
||||
sampler distortionTexture : register(s2);
|
||||
sampler erosionTexture : register(s3);
|
||||
|
||||
float time;
|
||||
float overallOpacity;
|
||||
float distortionStrength;
|
||||
float mainNoiseTextureScale;
|
||||
float distortionTextureScale;
|
||||
float erosionTextureScale;
|
||||
float erosionMin;
|
||||
float gradientPrecision;
|
||||
|
||||
float2 pixelationFactor;
|
||||
float2 worldOffset;
|
||||
|
||||
float3 darkerPixelColor;
|
||||
float3 brighterPixelColor;
|
||||
float3 highlightsColor;
|
||||
|
||||
float4 PixelShaderFunction(float4 sampleColor : COLOR0, float2 coords : TEXCOORD0) : COLOR0
|
||||
{
|
||||
// Pixelation.
|
||||
coords = round(coords * pixelationFactor) / pixelationFactor;
|
||||
|
||||
// Stretch the coords out to better mimic a blowing wind effect.
|
||||
coords *= float2(0.25, 1.25);
|
||||
|
||||
// Distort the coords in a sine wave so that they bend up and down.
|
||||
coords.y += sin(coords.x * 10 + time) * 0.25;
|
||||
|
||||
// Move with the player in the world.
|
||||
coords += worldOffset;
|
||||
|
||||
// Calculate the distortion that'll be applied to our base noise coordinates.
|
||||
float2 distortedCoords = coords + float2(time * -0.18, 0) * distortionTextureScale;
|
||||
float distortion = tex2D(distortionTexture, distortedCoords).r * distortionStrength;
|
||||
|
||||
// Calculate the base noise colors.
|
||||
float2 adjustedCoords = (coords + distortion) * mainNoiseTextureScale;
|
||||
float4 scrollingNoise1 = tex2D(mainWindTexture, adjustedCoords + float2(time * -0.092, 0));
|
||||
float4 scrollingNoise2 = tex2D(mainWindTexture, adjustedCoords + float2(time * -0.031, 0));
|
||||
|
||||
// Multiply the red values of the noise maps together to get the horizontal brightness of both noise maps.
|
||||
float combinedBrightness = scrollingNoise1.r * scrollingNoise2.r;
|
||||
|
||||
// Lerp between the two colors based on the brightness of a pixel.
|
||||
float3 colorFromBrightness = lerp(darkerPixelColor, brighterPixelColor, combinedBrightness);
|
||||
|
||||
// Sample another texture to be used as highlights alongside the two noise textures.
|
||||
float4 highlightNoise = tex2D(windHighlightsTexture, adjustedCoords + float2(time * -0.115, 0));
|
||||
float4 windHighlights = highlightNoise * float4(highlightsColor, 1);
|
||||
|
||||
// Erode the final output to break up the entire effect slightly.
|
||||
float erosionColor = tex2D(erosionTexture, adjustedCoords + float2(time * -0.087, 0) * erosionTextureScale);
|
||||
float erosionMax = erosionMin + 1;
|
||||
float erosion = smoothstep(erosionMin, erosionMax, erosionColor.r);
|
||||
|
||||
float4 finalColor = (float4(colorFromBrightness, 1) * (scrollingNoise1 + scrollingNoise2)) + (windHighlights * 2.25);
|
||||
finalColor *= erosion;
|
||||
|
||||
// Apply posterization.
|
||||
finalColor = round(finalColor * gradientPrecision) / gradientPrecision;
|
||||
|
||||
return finalColor * overallOpacity;
|
||||
|
||||
}
|
||||
|
||||
technique Technique1
|
||||
{
|
||||
pass DistortionWindsPass
|
||||
{
|
||||
PixelShader = compile ps_2_0 PixelShaderFunction();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
sampler baseTexture : register(s0);
|
||||
|
||||
float overallOpacity;
|
||||
float opacityCutoffValue;
|
||||
float fadeoutPower;
|
||||
float minBrightnessValue;
|
||||
float gradientPrecision;
|
||||
|
||||
float3 brighterPixelColor;
|
||||
float3 darkerPixelColor;
|
||||
|
||||
float InverseLerp(float from, float to, float value)
|
||||
{
|
||||
return (value - from) / (to - from);
|
||||
}
|
||||
|
||||
float4 PixelShaderFunction(float4 sampleColor : COLOR0, float2 coords : TEXCOORD0) : COLOR0
|
||||
{
|
||||
// Convert the regular coordinates to polar coordinates to get a circle shape.
|
||||
float2 centeredCoords = coords - 0.5;
|
||||
float polarAngle = atan2(centeredCoords.y, centeredCoords.x) / 6.283;
|
||||
float distanceToCenter = length(centeredCoords);
|
||||
|
||||
float2 polarCoords = float2(polarAngle, distanceToCenter);
|
||||
float4 color = tex2D(baseTexture, coords);
|
||||
|
||||
// Get the horizontal brightness of the sampled texture and apply coloration.
|
||||
float brightness = (color.r + color.g + color.b) / 3;
|
||||
float brightnessRatio = InverseLerp(minBrightnessValue, 1, brightness);
|
||||
float3 colorFromBrightness = lerp(darkerPixelColor, brighterPixelColor, brightnessRatio);
|
||||
|
||||
float4 coloredSample = color * float4(colorFromBrightness, 1);
|
||||
|
||||
// Fade out from the edges of the texture to the middle depending on the cutoff value.
|
||||
// "fadeoutPower" values which vary from 1 will affect how strong the edges fade while also increasing the brightness of
|
||||
// the non-faded parts of the image to the middle. Use this wisely.
|
||||
if (-polarCoords.y < opacityCutoffValue)
|
||||
coloredSample.rgba *= pow(-polarCoords.y / (polarCoords.y - opacityCutoffValue), -fadeoutPower);
|
||||
|
||||
// Apply optional posterization.
|
||||
/*if (gradientPrecision > 0)
|
||||
finalColor = round(finalColor * gradientPrecision) / gradientPrecision;
|
||||
*/
|
||||
return coloredSample * sampleColor * overallOpacity;
|
||||
}
|
||||
|
||||
technique Technique1
|
||||
{
|
||||
pass DoGRealityCrackPass
|
||||
{
|
||||
PixelShader = compile ps_2_0 PixelShaderFunction();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
sampler baseTexture : register(s0);
|
||||
sampler distortionTexture : register(s1);
|
||||
|
||||
float time;
|
||||
float overallOpacity;
|
||||
float distortionStrength;
|
||||
float opacityCutoffValue;
|
||||
float fadeoutPower;
|
||||
float minBrightnessValue;
|
||||
float gradientPrecision;
|
||||
float2 pixelSize;
|
||||
float3 brighterPixelColor;
|
||||
|
||||
float InverseLerp(float from, float to, float value)
|
||||
{
|
||||
return (value - from) / (to - from);
|
||||
}
|
||||
|
||||
float4 PixelShaderFunction(float4 sampleColor : COLOR0, float2 coords : TEXCOORD0) : COLOR0
|
||||
{
|
||||
// Pixelate.
|
||||
coords = round(coords * pixelSize) / pixelSize;
|
||||
|
||||
// Convert the regular coordinates to polar coordinates to get a circle shape.
|
||||
float2 centeredCoords = coords - 0.5;
|
||||
float polarAngle = atan2(centeredCoords.y, centeredCoords.x) / 6.283;
|
||||
float distanceToCenter = length(centeredCoords);
|
||||
float2 polarCoords = float2(polarAngle, distanceToCenter);
|
||||
|
||||
// Apply distortion to the main texture.
|
||||
float distortion = tex2D(distortionTexture, polarCoords + float2(time * 0.017, time * -0.026)).r * distortionStrength;
|
||||
float2 baseCoords = coords * distortion;
|
||||
baseCoords *= 0.4;
|
||||
float4 color = tex2D(baseTexture, baseCoords);
|
||||
|
||||
// Get the horizontal brightness of the sampled texture and apply coloration.
|
||||
float brightness = (color.r + color.g + color.b) / 3;
|
||||
float brightnessRatio = InverseLerp(minBrightnessValue, 1, brightness);
|
||||
float3 colorFromBrightness = lerp(float3(0, 0, 0), brighterPixelColor, brightnessRatio);
|
||||
|
||||
float4 coloredSample = color * float4(colorFromBrightness, 1);
|
||||
|
||||
// Fade out from the edges of the texture to the middle depending on the cutoff value.
|
||||
// "fadeoutPower" values which vary from 1 will affect how strong the edges fade while also increasing/decreasing the brightness of
|
||||
// the non-faded parts of the image to the middle. Use this wisely.
|
||||
if (-polarCoords.y < opacityCutoffValue)
|
||||
coloredSample.rgba *= pow(-polarCoords.y / (polarCoords.y - opacityCutoffValue), -fadeoutPower);
|
||||
|
||||
// Apply optional posterization.
|
||||
if (gradientPrecision > 0)
|
||||
coloredSample = round(coloredSample * gradientPrecision) / gradientPrecision;
|
||||
|
||||
return coloredSample * sampleColor * overallOpacity;
|
||||
}
|
||||
|
||||
technique Technique1
|
||||
{
|
||||
pass DoGRiftAuraPass
|
||||
{
|
||||
PixelShader = compile ps_3_0 PixelShaderFunction();
|
||||
}
|
||||
}
|
||||
@@ -373,7 +373,7 @@ namespace CalamityMod.Events
|
||||
|
||||
SoundEngine.PlaySound(DevourerofGodsHead.SpawnSound, player.Center);
|
||||
NPC.SpawnOnPlayer(ClosestPlayerToWorldCenter, type);
|
||||
}, usesSpecialSound: true, permittedNPCs: new int[] { ModContent.NPCType<DevourerofGodsBody>(), ModContent.NPCType<DevourerofGodsTail>(), ModContent.NPCType<CosmicGuardianHead>(), ModContent.NPCType<CosmicGuardianBody>(), ModContent.NPCType<CosmicGuardianTail>() }),
|
||||
}, usesSpecialSound: true, permittedNPCs: new int[] { ModContent.NPCType<DevourerofGodsBody>(), ModContent.NPCType<DevourerofGodsTail>() }),
|
||||
|
||||
new Boss(ModContent.NPCType<Yharon>(), spawnContext: type =>
|
||||
{
|
||||
|
||||
|
After Width: | Height: | Size: 108 KiB |
|
After Width: | Height: | Size: 112 KiB |
@@ -0,0 +1,106 @@
|
||||
using System.Collections.Generic;
|
||||
using CalamityMod.Effects;
|
||||
using CalamityMod.Projectiles.Boss;
|
||||
using CalamityMod.Systems.Graphic;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Graphics.Metaballs
|
||||
{
|
||||
public class DoGDistortionMetaball : Metaball
|
||||
{
|
||||
public class DistortionParticle(Vector2 center, Vector2 velocity, float size, bool square = false, float rotation = 0f)
|
||||
{
|
||||
public Vector2 Center = center;
|
||||
|
||||
public Vector2 Velocity = velocity;
|
||||
|
||||
public float Size = size;
|
||||
|
||||
public bool Square = square;
|
||||
|
||||
public float Rotation = rotation;
|
||||
|
||||
public void Update()
|
||||
{
|
||||
Center += Velocity;
|
||||
Velocity *= 0.96f;
|
||||
Size *= 0.91f;
|
||||
}
|
||||
}
|
||||
|
||||
public static List<DistortionParticle> Particles { get; private set; } = [];
|
||||
|
||||
public override MetaballDrawLayer DrawContext => MetaballDrawLayer.AfterProjectiles;
|
||||
|
||||
public override bool AnythingToDraw => Particles.Count > 0 || CalamityUtils.AnyProjectiles(ModContent.ProjectileType<DoGRiftCrack>());
|
||||
|
||||
public override Color EdgeColor => new(136, 26, 186);
|
||||
|
||||
public override IEnumerable<Texture2D> Layers
|
||||
{
|
||||
get
|
||||
{
|
||||
yield return ModContent.Request<Texture2D>("CalamityMod/Projectiles/InvisibleProj").Value;
|
||||
}
|
||||
}
|
||||
|
||||
public static void SpawnParticle(Vector2 position, Vector2 velocity, float size, bool square = false, float rotation = 0f) =>
|
||||
Particles.Add(new(position, velocity, size, square, rotation));
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
for (int i = 0; i < Particles.Count; i++)
|
||||
Particles[i].Update();
|
||||
Particles.RemoveAll(p => p.Size <= 2f);
|
||||
}
|
||||
|
||||
public override void PrepareShaderForTarget(int layerIndex)
|
||||
{
|
||||
var metaballShader = CalamityShaders.MetaballEdgeShader;
|
||||
var gd = Main.instance.GraphicsDevice;
|
||||
|
||||
Vector2 screenSize = new(Main.screenWidth, Main.screenHeight);
|
||||
Vector2 layerScrollOffset = Main.screenPosition / screenSize + CalculateManualOffsetForLayer(layerIndex);
|
||||
if (FixedToScreen)
|
||||
layerScrollOffset = Vector2.Zero;
|
||||
|
||||
metaballShader.Parameters["layerSize"]?.SetValue(DoGVisualsManager.DistortionForegroundContentsTarget.Target.Size());
|
||||
metaballShader.Parameters["screenSize"]?.SetValue(screenSize);
|
||||
metaballShader.Parameters["layerOffset"]?.SetValue(layerScrollOffset);
|
||||
metaballShader.Parameters["edgeColor"]?.SetValue(EdgeColor.ToVector4());
|
||||
metaballShader.Parameters["singleFrameScreenOffset"]?.SetValue((Main.screenLastPosition - Main.screenPosition) / screenSize);
|
||||
|
||||
gd.Textures[1] = DoGVisualsManager.DistortionForegroundContentsTarget;
|
||||
gd.SamplerStates[1] = SamplerState.LinearWrap;
|
||||
|
||||
metaballShader.CurrentTechnique.Passes[0].Apply();
|
||||
}
|
||||
|
||||
public override void DrawInstances()
|
||||
{
|
||||
Texture2D metaballTexture = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/BasicCircle").Value;
|
||||
Texture2D squareTexture = ModContent.Request<Texture2D>("CalamityMod/Particles/Square").Value;
|
||||
|
||||
foreach (DistortionParticle particle in Particles)
|
||||
{
|
||||
Texture2D textureToUse = particle.Square ? squareTexture : metaballTexture;
|
||||
Vector2 drawPosition = particle.Center - Main.screenPosition;
|
||||
Vector2 origin = textureToUse.Size() * 0.5f;
|
||||
Vector2 scale = Vector2.One * particle.Size / textureToUse.Size();
|
||||
Main.spriteBatch.Draw(textureToUse, drawPosition, null, Color.White, particle.Rotation, origin, scale, SpriteEffects.None, 0f);
|
||||
}
|
||||
|
||||
foreach (Projectile proj in Main.ActiveProjectiles)
|
||||
{
|
||||
if (proj.type == ModContent.ProjectileType<DoGRiftCrack>())
|
||||
{
|
||||
Color lightColor = Color.White;
|
||||
proj.ModProjectile.PreDraw(ref lightColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -125,7 +125,7 @@ namespace CalamityMod.Graphics.Primitives
|
||||
|
||||
Matrix view;
|
||||
Matrix projection;
|
||||
if (MainSettings.Pixelate)
|
||||
if (MainSettings.Pixelate || MainSettings.UseUnscaledMatrices)
|
||||
CalcuatePixelatedPerspectiveMatrices(out view, out projection);
|
||||
else
|
||||
CalamityUtils.CalculatePerspectiveMatricies(out view, out projection);
|
||||
|
||||
@@ -57,6 +57,12 @@ namespace CalamityMod.Graphics.Primitives
|
||||
/// </summary>
|
||||
public readonly bool Pixelate;
|
||||
|
||||
/// <summary>
|
||||
/// Whether to use unscaled perspective matrices when rendering the primitives. Recommended only when the system is being used outside of its typical context
|
||||
/// i.e. rendering primitives in the background via a CustomSky.
|
||||
/// </summary>
|
||||
public readonly bool UseUnscaledMatrices;
|
||||
|
||||
/// <summary>
|
||||
/// The shader to apply when rendering.
|
||||
/// </summary>
|
||||
@@ -77,8 +83,9 @@ namespace CalamityMod.Graphics.Primitives
|
||||
/// <param name="smoothen">Whether to use smoothening when generating the vertex positions from the provided ones. Recommended to be enabled.</param>
|
||||
/// <param name="pixelate">Whether to pixelate the primitives. Recommended to be enabled if the effect was designed with this in mind.</param>
|
||||
/// <param name="shader">The shader to apply when rendering the primitives.</param>
|
||||
/// <param name="useUnscaledMatrices">Whether to use unscaled perspective matrices when rendering primitives. Recommended when using this system outside of its typical context; i.e. rendering primitives in the background via a CustomSky.</param>
|
||||
/// <param name="initialVertexPositionsOverride">An optional override to force the trail to use the provided positions as the side positions of the initial vertex. They are the left and right positions respectively and should be in screen space.</param>
|
||||
public PrimitiveSettings(VertexWidthFunction widthFunction, VertexColorFunction colorFunction, VertexOffsetFunction offsetFunction = null, bool smoothen = true, bool pixelate = false, MiscShaderData shader = null, (Vector2, Vector2)? initialVertexPositionsOverride = null)
|
||||
public PrimitiveSettings(VertexWidthFunction widthFunction, VertexColorFunction colorFunction, VertexOffsetFunction offsetFunction = null, bool smoothen = true, bool pixelate = false, MiscShaderData shader = null, bool useUnscaledMatrices = false, (Vector2, Vector2)? initialVertexPositionsOverride = null)
|
||||
{
|
||||
WidthFunction = widthFunction;
|
||||
ColorFunction = colorFunction;
|
||||
@@ -86,6 +93,7 @@ namespace CalamityMod.Graphics.Primitives
|
||||
Smoothen = smoothen;
|
||||
Pixelate = pixelate;
|
||||
Shader = shader;
|
||||
UseUnscaledMatrices = useUnscaledMatrices;
|
||||
InitialVertexPositionsOverride = initialVertexPositionsOverride;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,110 @@
|
||||
using CalamityMod.NPCs;
|
||||
using CalamityMod.NPCs.DevourerofGods;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.Graphics.Shaders;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Graphics.Renderers.CalamityRenderers
|
||||
{
|
||||
public class DoGDeathAnimationRenderer : BaseRenderer
|
||||
{
|
||||
private static DevourerofGodsHead DoGHead
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!Main.npc.IndexInRange(CalamityGlobalNPC.DoGHead))
|
||||
return null;
|
||||
|
||||
if (Main.npc[CalamityGlobalNPC.DoGHead].type != ModContent.NPCType<DevourerofGodsHead>())
|
||||
return null;
|
||||
|
||||
if (Main.npc[CalamityGlobalNPC.DoGHead].ModNPC is not null && Main.npc[CalamityGlobalNPC.DoGHead].ModNPC is DevourerofGodsHead dogHead)
|
||||
return dogHead;
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used to determine whether the npc should return true in predraw or not, for exclusively drawing to the drawer target.
|
||||
/// </summary>
|
||||
public static bool ActuallyDoPreDraw
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public override DrawLayer Layer => DrawLayer.NPC;
|
||||
|
||||
public override bool ShouldDraw => !Main.gameMenu && CalamityGlobalNPC.DoGHead != -1 && Main.npc[CalamityGlobalNPC.DoGHead].active && DoGHead.DeathAnimationTimer > 0;
|
||||
|
||||
public static bool ValidToDraw(NPC npc)
|
||||
{
|
||||
// Do not draw inactive npcs, or ones with weird MP types less than or equal to 0.
|
||||
if (!npc.active || npc.type <= NPCID.None)
|
||||
return false;
|
||||
|
||||
// Don't consider any other NPCs besides the DoG NPCs valid.
|
||||
if (npc.type != ModContent.NPCType<DevourerofGodsHead>() && npc.type != ModContent.NPCType<DevourerofGodsBody>() && npc.type != ModContent.NPCType<DevourerofGodsTail>())
|
||||
return false;
|
||||
|
||||
// Don't draw if DoG's Head cannot be found active.
|
||||
if (DoGHead is null)
|
||||
return false;
|
||||
|
||||
// Don't draw if DoG hasn't started it's death animation yet.
|
||||
if (DoGHead.DeathAnimationTimer <= 0)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void DrawToTarget(SpriteBatch spriteBatch)
|
||||
{
|
||||
// Indicate that DoG and his segments should draw.
|
||||
ActuallyDoPreDraw = true;
|
||||
|
||||
// Draw every npc to a single target that should have the disintegration visual.
|
||||
foreach (NPC npc in Main.ActiveNPCs)
|
||||
{
|
||||
// Extra check to ensure that index errors will not occur. If not in range, something has gone wrong and the loop should terminate.
|
||||
if (!Main.npc.IndexInRange(npc.whoAmI))
|
||||
break;
|
||||
|
||||
// Draw the NPCs to the target once everything is valid and set the disintegration progress variable.
|
||||
// Also ensure to indicate that the renderer should allow drawing the target here as well.
|
||||
if (ValidToDraw(npc))
|
||||
Main.instance.DrawNPC(npc.whoAmI, npc.behindTiles);
|
||||
}
|
||||
|
||||
// Indicate that DoG and his segments should no longer draw.
|
||||
ActuallyDoPreDraw = false;
|
||||
}
|
||||
|
||||
public override void DrawTarget(SpriteBatch spriteBatch)
|
||||
{
|
||||
var disintegrationShader = GameShaders.Misc["CalamityMod:DoGDisintegration"].Shader;
|
||||
NPC npc = DoGHead.NPC;
|
||||
if (npc == null || !npc.active)
|
||||
return;
|
||||
|
||||
Vector2 screenSize = new(Main.screenWidth, Main.screenHeight);
|
||||
Vector2 worldPosition = Main.screenPosition / MainTarget.Size;
|
||||
float disintegrationProgress = DoGHead.DeathAnimationTimer / 600f;
|
||||
|
||||
disintegrationShader.Parameters["disintegrationProgress"].SetValue(disintegrationProgress);
|
||||
disintegrationShader.Parameters["disintegrationScale"].SetValue(1.75f);
|
||||
disintegrationShader.Parameters["worldPosition"].SetValue(new Vector2(worldPosition.X, worldPosition.Y));
|
||||
disintegrationShader.Parameters["pixelSize"].SetValue(screenSize * 0.5f);
|
||||
|
||||
Main.instance.GraphicsDevice.Textures[1] = Main.Assets.Request<Texture2D>("Images/Misc/Perlin").Value;
|
||||
Main.instance.GraphicsDevice.SamplerStates[1] = SamplerState.LinearWrap;
|
||||
|
||||
disintegrationShader.Techniques[0].Passes[0].Apply();
|
||||
Main.spriteBatch.Draw(MainTarget, Vector2.Zero, Color.White);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ using CalamityMod.Rarities;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.Localization;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Items.SummonItems
|
||||
@@ -40,11 +41,13 @@ namespace CalamityMod.Items.SummonItems
|
||||
|
||||
public override bool? UseItem(Player player)
|
||||
{
|
||||
string key = "Mods.CalamityMod.Status.Boss.EdgyBossText7";
|
||||
string key = "Mods.CalamityMod.Status.Boss.DoGSpawn";
|
||||
Color messageColor = Color.Cyan;
|
||||
CalamityUtils.DisplayLocalizedText(key, messageColor);
|
||||
|
||||
CalamityUtils.SpawnBossUsingItem<DevourerofGodsHead>(player, DevourerofGodsHead.SpawnSound);
|
||||
var subtitle = Main.combatText[CombatText.NewText(player.Hitbox, messageColor, Language.GetTextValue(key), true)];
|
||||
player.Calamity().subtitletext = subtitle;
|
||||
player.Calamity().subtitleColors = new Color[] { Color.Cyan, Color.Fuchsia };
|
||||
CalamityUtils.SpawnBossOnPosUsingItem<DevourerofGodsHead>(player, (int)player.Center.X, (int)player.Center.Y - 1600, DevourerofGodsHead.SpawnSound);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using CalamityMod.Projectiles.BaseProjectiles;
|
||||
using CalamityMod.Projectiles.Boss;
|
||||
using CalamityMod.Projectiles.Melee;
|
||||
using CalamityMod.Rarities;
|
||||
using CalamityMod.Systems.Collections;
|
||||
@@ -68,8 +69,8 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
if (reflectTimer <= 50)
|
||||
{
|
||||
|
||||
float coneLength = 80f;
|
||||
float maximumAngle = 0.8f;
|
||||
float coneLength = 96f;
|
||||
float maximumAngle = 1f;
|
||||
float coneRotation = player.DirectionTo(Main.MouseWorld).ToRotation();
|
||||
var shardCount = 0;
|
||||
foreach (var proj in Main.projectile)
|
||||
@@ -81,19 +82,45 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
}
|
||||
foreach (var proj in Main.ActiveProjectiles)
|
||||
{
|
||||
if (proj.hostile && proj.damage > 0 && proj.Hitbox.IntersectsConeSlowMoreAccurate(player.Center, coneLength, coneRotation, maximumAngle))
|
||||
if (proj.type == ModContent.ProjectileType<DoGLaserWalls>() && proj.ModProjectile<DoGLaserWalls>().time >= 29)
|
||||
{
|
||||
if (shardCount > 0)
|
||||
{
|
||||
SoundEngine.PlaySound(SeekingScorcher.LightShatterSound, player.Center);
|
||||
SoundEngine.PlaySound(SoundID.DD2_WitherBeastDeath,player.Center);
|
||||
SoundEngine.PlaySound(SoundID.DD2_WitherBeastDeath, player.Center);
|
||||
}
|
||||
if (shardCount >= 10)
|
||||
{
|
||||
player.SetImmuneTimeForAllTypes(player.longInvince ? 60 : 30);
|
||||
}
|
||||
proj.Calamity().multiplicativeDR += shardCount / 10f;
|
||||
proj.Calamity().multiplicativeDRTimer = 60;
|
||||
proj.Calamity().multiplicativeDR += shardCount / 10f;
|
||||
proj.Calamity().multiplicativeDRTimer = 60;
|
||||
foreach (var proj2 in Main.projectile)
|
||||
{
|
||||
if (proj2.active && proj2.type == ModContent.ProjectileType<MirrorBlast>() && proj2.owner == player.whoAmI && (proj2.ModProjectile as MirrorBlast).isShard)
|
||||
{
|
||||
proj2.damage = (int)(proj2.damage * (shardCount >= 10 ? 3f : 2f));
|
||||
(proj2.ModProjectile as MirrorBlast).shardShield = 0;
|
||||
(proj2.ModProjectile as MirrorBlast).shardNum = 11;
|
||||
proj2.netUpdate = true;
|
||||
}
|
||||
}
|
||||
reflectTimer = 0;
|
||||
return;
|
||||
} else
|
||||
if (proj.hostile && proj.damage > 0 && proj.Hitbox.IntersectsConeSlowMoreAccurate(player.Center, coneLength, coneRotation, maximumAngle))
|
||||
{
|
||||
if (shardCount > 0)
|
||||
{
|
||||
SoundEngine.PlaySound(SeekingScorcher.LightShatterSound, player.Center);
|
||||
SoundEngine.PlaySound(SoundID.DD2_WitherBeastDeath, player.Center);
|
||||
}
|
||||
if (shardCount >= 10)
|
||||
{
|
||||
player.SetImmuneTimeForAllTypes(player.longInvince ? 60 : 30);
|
||||
}
|
||||
proj.Calamity().multiplicativeDR += shardCount / 10f;
|
||||
proj.Calamity().multiplicativeDRTimer = 60;
|
||||
foreach (var proj2 in Main.projectile)
|
||||
{
|
||||
if (proj2.active && proj2.type == ModContent.ProjectileType<MirrorBlast>() && proj2.owner == player.whoAmI && (proj2.ModProjectile as MirrorBlast).isShard)
|
||||
|
||||
@@ -35,8 +35,7 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
|
||||
public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone)
|
||||
{
|
||||
bool isDoGSegment = target.type == ModContent.NPCType<DevourerofGodsBody>() || target.type == ModContent.NPCType<CosmicGuardianBody>();
|
||||
if (!isDoGSegment || Main.rand.NextBool(3))
|
||||
if (target.type != ModContent.NPCType<DevourerofGodsBody>() || Main.rand.NextBool(3))
|
||||
{
|
||||
CalamityPlayer.HorsemansBladeOnHit(player, target.whoAmI, Item.damage, Item.knockBack, 0, ModContent.ProjectileType<MourningSkull>());
|
||||
CalamityPlayer.HorsemansBladeOnHit(player, target.whoAmI, Item.damage, Item.knockBack, 1);
|
||||
|
||||
@@ -123,6 +123,16 @@ CalamityClientConfig: {
|
||||
'''
|
||||
}
|
||||
|
||||
FancyBackgroundVisuals: {
|
||||
Label: "[i:CalamityMod/BlueDistortedMonolith] Toggle Fancy Background Visuals"
|
||||
Tooltip:
|
||||
'''
|
||||
Controls whether or not fancy background visuals will be displayed during certain parts of the game, such as boss fights.
|
||||
When disabled, a simplified version of the main visual will be displayed in certain cases.
|
||||
Recommended to have disabled if you struggle with visibility issues or low performance.
|
||||
'''
|
||||
}
|
||||
|
||||
FasterFallHotkey: {
|
||||
Label: "[i:CalamityMod/BallAndChain] Enable Fast Falling"
|
||||
Tooltip:
|
||||
|
||||
@@ -51,9 +51,12 @@ DoGBeam.DisplayName: Portal Laser
|
||||
DoGBeamPortal.DisplayName: Beam Portal
|
||||
DoGDeath.DisplayName: Death Beam
|
||||
DoGDeathBoom.DisplayName: Cosmic Explosion
|
||||
DoGFire.DisplayName: Death Fire
|
||||
DoGFire.DisplayName: Faith Incinerator
|
||||
DoGLaserWalls.DisplayName: God's Bane Doombeam Array
|
||||
DoGLaserWallsBigBeam.DisplayName: Hyperdeath Rift Ripper
|
||||
DoGP1EndPortal.DisplayName: Portal
|
||||
DoGTeleportRift.DisplayName: Rift
|
||||
DoGRiftCrack.DisplayName: DoG Distortion Crack
|
||||
DoGTeleportRift.DisplayName: DoG Distortion Rift
|
||||
DoGWingdings.DisplayName: Ramblings of Wing DoGster
|
||||
DraedonSummonLaser.DisplayName: Giant Fuck-off Deathray of Doom
|
||||
DyingSun.DisplayName: Dying Sun
|
||||
|
||||
@@ -19,14 +19,30 @@ ProfanedBossText: Holy flames burn away at your wings...
|
||||
GhostBossText2: Wails echo through the dilapidated dungeon halls...
|
||||
GhostBossText3: Long-dead prisoners seek their zealous revenge...
|
||||
// Devourer of Gods
|
||||
EdgyBossText: Don't get cocky!
|
||||
EdgyBossText2: A fatal mistake!
|
||||
EdgyBossText3: Delicious...
|
||||
EdgyBossText4: Did that hurt?
|
||||
EdgyBossText5: It's not over yet!
|
||||
EdgyBossText6: A GOD DOES NOT FEAR DEATH!
|
||||
EdgyBossText7: You are no god... but I shall feast upon your essence regardless!
|
||||
EdgyBossText8: You think...you can butcher...ME!?
|
||||
DoGSpawn: You are no god... but I shall feast upon your essence regardless!
|
||||
DoGSubphase1: You've done better than most, but don't get cocky!
|
||||
DoGPhase2: It's not over yet, kid!
|
||||
DoGPhase3: A GOD DOES NOT FEAR DEATH!
|
||||
DoGHead1: Fall to your knees, worm!
|
||||
DoGHead2: Let's see how much longer you'll last...
|
||||
DoGHead3: Getting tired yet?
|
||||
DoGHead4: You'll fall, just like the others!
|
||||
DoGHead5: Give up! It'll be easier for both of us!
|
||||
DoGHead6: Let me end you already!
|
||||
DoGHead7: This is starting to get ridiculous...!
|
||||
DoGHead8: How are you doing this?!
|
||||
DoGHead9: Are you playing me for a fool?!
|
||||
DoGHead10: Why won't you DIE?!
|
||||
DoGHead11: FALL!
|
||||
DoGHead12: BEGONE!
|
||||
DoGHead13: DIE!
|
||||
DoGHeadDeath1: Tasteless slop.
|
||||
DoGHeadDeath2: Delicious... A feast worthy of a god!
|
||||
DoGHeadDeath3: And STAY dead!
|
||||
DoGHeadDeath4: WEAK.
|
||||
DoGHeadDeath5: PATHETIC. ALL THAT RUNNING JUST TO DIE TO A SINGLE TOUCH?!
|
||||
DoGHeadRunning: You can't run forever!
|
||||
DoGHeadRunning2: WHAT'S THE PROBLEM?! CAN'T RUN ANYMORE?!
|
||||
// Yharon
|
||||
FlameText: The air is getting warmer around you.
|
||||
// Draedon (introduction)
|
||||
|
||||
@@ -58,13 +58,17 @@ Dragonfire1: "{0}'s ashes scatter in the wind."
|
||||
Dragonfire2: "{0}'s embers fade away in a warm glow."
|
||||
Dragonfire3: "{0} can no longer feel the heat of the dragonfire."
|
||||
Dragonfire4: This was a fight {0} could not win.
|
||||
DimensionalDrive: "{0} was blasted apart into space dust by the Dimensional Drive."
|
||||
DivinityDevourer1: "{0} fell victim to the Divinity Devourer."
|
||||
DivinityDevourer2: "{0} was consumed by the Divinity Devourer."
|
||||
DivinityDevourer3: "{0}'s essence was snuffed by the Divinity Devourer."
|
||||
ElementalMix1: "{0} was reduced to technicolor confetti."
|
||||
ElementalMix2: "{0} was blasted apart by a harmonized elemental onslaught."
|
||||
ElementalMix3: "{0} was overwhelmed by elemental turbulence."
|
||||
FlareGunOverheat: "{0}'s gun was simply too hot to handle."
|
||||
GodSlayerInferno1: "{0} imploded into nothingness."
|
||||
GodSlayerInferno2: "{0}'s body slipped into oblivion."
|
||||
GodSlayerInferno3: "{0} ceased being a part of our universe."
|
||||
GodSlayerInferno1: "{0}'s hopes and dreams were cremated."
|
||||
GodSlayerInferno2: "{0}'s consciousness slipped into oblivion."
|
||||
GodSlayerInferno3: "{0} ceased to be part of our universe."
|
||||
Goldfish: "{0} was once again impaled by Goldfish."
|
||||
HeavyBleeding1: "{0} expired from heavy internal bleeding."
|
||||
HeavyBleeding2: "{0} forgot that blood is supposed to stay inside the body."
|
||||
@@ -103,6 +107,8 @@ SulphuricPoisoning1: "{0} was melted by the toxic waste."
|
||||
SulphuricPoisoning2: "{0} ingested too many caustic chemicals."
|
||||
SulphuricPoisoning3: "{0} couldn't handle the industrial backwash."
|
||||
ThornBlossom: "{0} was violently pricked by a flower."
|
||||
UltracosmicMaelstrom1: "{0} was sublimated by the Ultracosmic Maelstrom."
|
||||
UltracosmicMaelstrom2: "{0} got cut down to size by the Ultracosmic Maelstrom."
|
||||
Vaporfied: "{0} vaporized into thin air."
|
||||
VermillionFlux1: "{0} burst apart in a shower of scarlet sparks."
|
||||
VermillionFlux2: "{0} went deathly stiff, still crackling with crimson."
|
||||
|
||||
@@ -7108,6 +7108,10 @@ namespace CalamityMod.NPCs
|
||||
// Only draw the NPC if told to by the miracle blight drawer.
|
||||
if (MiracleBlightRenderer.ValidToDraw(npc))
|
||||
return MiracleBlightRenderer.ActuallyDoPreDraw;
|
||||
|
||||
// Only draw DoG's death animation when told to by the renderer.
|
||||
if (DoGDeathAnimationRenderer.ValidToDraw(npc))
|
||||
return DoGDeathAnimationRenderer.ActuallyDoPreDraw;
|
||||
}
|
||||
|
||||
if (Main.zenithWorld)
|
||||
|
||||
@@ -1,221 +0,0 @@
|
||||
using System.IO;
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.Dusts;
|
||||
using CalamityMod.Events;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Content;
|
||||
using Terraria;
|
||||
using Terraria.GameContent;
|
||||
using Terraria.ID;
|
||||
using Terraria.Localization;
|
||||
using Terraria.ModLoader;
|
||||
namespace CalamityMod.NPCs.DevourerofGods
|
||||
{
|
||||
[HasPierceResist]
|
||||
[LongDistanceNetSync(SyncWith = typeof(CosmicGuardianHead))]
|
||||
public class CosmicGuardianBody : ModNPC
|
||||
{
|
||||
public int invinceTime = 180;
|
||||
public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.CosmicGuardianHead.DisplayName");
|
||||
|
||||
public static Asset<Texture2D> GlowTexture;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
this.HideFromBestiary();
|
||||
if (!Main.dedServ)
|
||||
{
|
||||
GlowTexture = ModContent.Request<Texture2D>(Texture + "Glow", AssetRequestMode.AsyncLoad);
|
||||
}
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
NPC.damage = 120; // 240
|
||||
NPC.width = 34;
|
||||
NPC.height = 34;
|
||||
NPC.defense = 60;
|
||||
CalamityGlobalNPC global = NPC.Calamity();
|
||||
global.DR = 0.5f;
|
||||
global.unbreakableDR = true;
|
||||
NPC.lifeMax = 50000;
|
||||
NPC.aiStyle = -1;
|
||||
AIType = -1;
|
||||
NPC.knockBackResist = 0f;
|
||||
NPC.Opacity = 0f;
|
||||
NPC.behindTiles = true;
|
||||
NPC.noGravity = true;
|
||||
NPC.noTileCollide = true;
|
||||
NPC.HitSound = SoundID.NPCHit4;
|
||||
NPC.DeathSound = SoundID.NPCDeath14;
|
||||
NPC.netAlways = true;
|
||||
NPC.dontCountMe = true;
|
||||
}
|
||||
|
||||
public override void SendExtraAI(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(invinceTime);
|
||||
writer.Write(NPC.dontTakeDamage);
|
||||
}
|
||||
|
||||
public override void ReceiveExtraAI(BinaryReader reader)
|
||||
{
|
||||
invinceTime = reader.ReadInt32();
|
||||
NPC.dontTakeDamage = reader.ReadBoolean();
|
||||
}
|
||||
|
||||
public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
if (invinceTime > 0)
|
||||
{
|
||||
invinceTime--;
|
||||
NPC.damage = 0;
|
||||
NPC.dontTakeDamage = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
NPC.damage = NPC.defDamage;
|
||||
NPC.dontTakeDamage = false;
|
||||
}
|
||||
|
||||
if (NPC.ai[2] > 0f)
|
||||
NPC.realLife = (int)NPC.ai[2];
|
||||
|
||||
// Check if other segments are still alive, if not, die
|
||||
bool shouldDespawn = !NPC.AnyNPCs(ModContent.NPCType<CosmicGuardianHead>());
|
||||
if (!shouldDespawn)
|
||||
{
|
||||
if (NPC.ai[1] <= 0f)
|
||||
shouldDespawn = true;
|
||||
else if (Main.npc[(int)NPC.ai[1]].life <= 0)
|
||||
shouldDespawn = true;
|
||||
}
|
||||
if (shouldDespawn)
|
||||
{
|
||||
NPC.life = 0;
|
||||
NPC.HitEffect(0, 10.0);
|
||||
NPC.checkDead();
|
||||
NPC.active = false;
|
||||
}
|
||||
|
||||
NPC.Opacity = Main.npc[(int)NPC.ai[2]].Opacity;
|
||||
|
||||
Vector2 segmentPosition = NPC.Center;
|
||||
float targetX = Main.player[NPC.target].position.X + (Main.player[NPC.target].width / 2);
|
||||
float targetY = Main.player[NPC.target].position.Y + (Main.player[NPC.target].height / 2);
|
||||
targetX = (int)(targetX / 16f) * 16;
|
||||
targetY = (int)(targetY / 16f) * 16;
|
||||
segmentPosition.X = (int)(segmentPosition.X / 16f) * 16;
|
||||
segmentPosition.Y = (int)(segmentPosition.Y / 16f) * 16;
|
||||
targetX -= segmentPosition.X;
|
||||
targetY -= segmentPosition.Y;
|
||||
float targetDistance = (float)System.Math.Sqrt(targetX * targetX + targetY * targetY);
|
||||
if (NPC.ai[1] > 0f && NPC.ai[1] < Main.npc.Length)
|
||||
{
|
||||
try
|
||||
{
|
||||
segmentPosition = NPC.Center;
|
||||
targetX = Main.npc[(int)NPC.ai[1]].position.X + (Main.npc[(int)NPC.ai[1]].width / 2) - segmentPosition.X;
|
||||
targetY = Main.npc[(int)NPC.ai[1]].position.Y + (Main.npc[(int)NPC.ai[1]].height / 2) - segmentPosition.Y;
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
NPC.rotation = (float)System.Math.Atan2(targetY, targetX) + 1.57f;
|
||||
targetDistance = (float)System.Math.Sqrt(targetX * targetX + targetY * targetY);
|
||||
int segmentWidth = NPC.width;
|
||||
targetDistance = (targetDistance - segmentWidth) / targetDistance;
|
||||
targetX *= targetDistance;
|
||||
targetY *= targetDistance;
|
||||
NPC.velocity = Vector2.Zero;
|
||||
NPC.position.X = NPC.position.X + targetX;
|
||||
NPC.position.Y = NPC.position.Y + targetY;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor)
|
||||
{
|
||||
SpriteEffects spriteEffects = SpriteEffects.None;
|
||||
if (NPC.spriteDirection == 1)
|
||||
spriteEffects = SpriteEffects.FlipHorizontally;
|
||||
|
||||
Texture2D texture2D15 = TextureAssets.Npc[Type].Value;
|
||||
Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[Type].Value.Width / 2), (float)(TextureAssets.Npc[Type].Value.Height / 2));
|
||||
|
||||
Vector2 drawLocation = NPC.Center - screenPos;
|
||||
drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f;
|
||||
drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY);
|
||||
spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
|
||||
|
||||
texture2D15 = GlowTexture.Value;
|
||||
Color glowmaskColor = Color.Lerp(Color.White, Color.Fuchsia, 0.5f);
|
||||
|
||||
spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool CanHitPlayer(Player target, ref int cooldownSlot)
|
||||
{
|
||||
cooldownSlot = ImmunityCooldownID.Bosses;
|
||||
return NPC.Opacity >= 1f && invinceTime <= 0;
|
||||
}
|
||||
|
||||
public override bool CheckActive()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void HitEffect(NPC.HitInfo hit)
|
||||
{
|
||||
if (NPC.life <= 0)
|
||||
{
|
||||
if (!Main.dedServ)
|
||||
{
|
||||
float randomSpread = Main.rand.Next(-200, 201) / 100f;
|
||||
Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread * Main.rand.NextFloat(), Mod.Find<ModGore>("DoT2").Type, 1f);
|
||||
Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread * Main.rand.NextFloat(), Mod.Find<ModGore>("DoT3").Type, 1f);
|
||||
Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread * Main.rand.NextFloat(), Mod.Find<ModGore>("DoT4").Type, 1f);
|
||||
Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread * Main.rand.NextFloat(), Mod.Find<ModGore>("DoT5").Type, 1f);
|
||||
}
|
||||
NPC.position.X = NPC.position.X + (float)(NPC.width / 2);
|
||||
NPC.position.Y = NPC.position.Y + (float)(NPC.height / 2);
|
||||
NPC.width = 50;
|
||||
NPC.height = 50;
|
||||
NPC.position.X = NPC.position.X - (float)(NPC.width / 2);
|
||||
NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2);
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
int cosmiliteDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f);
|
||||
Main.dust[cosmiliteDust].velocity *= 3f;
|
||||
if (Main.rand.NextBool())
|
||||
{
|
||||
Main.dust[cosmiliteDust].scale = 0.5f;
|
||||
Main.dust[cosmiliteDust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f;
|
||||
}
|
||||
}
|
||||
for (int j = 0; j < 20; j++)
|
||||
{
|
||||
int cosmiliteDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f);
|
||||
Main.dust[cosmiliteDust2].noGravity = true;
|
||||
Main.dust[cosmiliteDust2].velocity *= 5f;
|
||||
cosmiliteDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f);
|
||||
Main.dust[cosmiliteDust2].velocity *= 2f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo)
|
||||
{
|
||||
if (hurtInfo.Damage > 0)
|
||||
target.AddBuff(ModContent.BuffType<GodSlayerInferno>(), 120);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 599 B |
@@ -1,440 +0,0 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.Dusts;
|
||||
using CalamityMod.Events;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Content;
|
||||
using Terraria;
|
||||
using Terraria.GameContent;
|
||||
using Terraria.GameContent.Bestiary;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.NPCs.DevourerofGods
|
||||
{
|
||||
[HasPierceResist]
|
||||
[LongDistanceNetSync]
|
||||
public class CosmicGuardianHead : ModNPC
|
||||
{
|
||||
private bool tail = false;
|
||||
private const int minLength = 10;
|
||||
private const int maxLength = 11;
|
||||
private int invinceTime = 180;
|
||||
|
||||
public static Asset<Texture2D> GlowTexture;
|
||||
public static Asset<Texture2D> GlowTexture2;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
NPCID.Sets.BossBestiaryPriority.Add(Type);
|
||||
NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers()
|
||||
{
|
||||
Scale = 0.75f,
|
||||
PortraitScale = 0.75f,
|
||||
PortraitPositionXOverride = 40,
|
||||
PortraitPositionYOverride = 40
|
||||
};
|
||||
value.Position.X += 62f;
|
||||
value.Position.Y += 35f;
|
||||
NPCID.Sets.NPCBestiaryDrawOffset[Type] = value;
|
||||
if (!Main.dedServ)
|
||||
{
|
||||
GlowTexture = ModContent.Request<Texture2D>(Texture + "Glow", AssetRequestMode.AsyncLoad);
|
||||
GlowTexture2 = ModContent.Request<Texture2D>(Texture + "Glow2", AssetRequestMode.AsyncLoad);
|
||||
}
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
NPC.Calamity().canBreakPlayerDefense = true;
|
||||
NPC.damage = 180; // 360
|
||||
NPC.width = 64;
|
||||
NPC.height = 76;
|
||||
NPC.defense = 40;
|
||||
NPC.lifeMax = 50000;
|
||||
NPC.aiStyle = -1;
|
||||
AIType = -1;
|
||||
NPC.knockBackResist = 0f;
|
||||
NPC.Opacity = 0f;
|
||||
NPC.behindTiles = true;
|
||||
NPC.noGravity = true;
|
||||
NPC.noTileCollide = true;
|
||||
NPC.HitSound = SoundID.NPCHit4;
|
||||
NPC.DeathSound = SoundID.NPCDeath14;
|
||||
NPC.netAlways = true;
|
||||
}
|
||||
|
||||
public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry)
|
||||
{
|
||||
int associatedNPCType = ModContent.NPCType<DevourerofGodsHead>();
|
||||
bestiaryEntry.UIInfoProvider = new CommonEnemyUICollectionInfoProvider(ContentSamples.NpcBestiaryCreditIdsByNpcNetIds[associatedNPCType], quickUnlock: true);
|
||||
|
||||
bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[]
|
||||
{
|
||||
new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.CosmicGuardian")
|
||||
});
|
||||
}
|
||||
|
||||
public override void SendExtraAI(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(invinceTime);
|
||||
writer.Write(NPC.dontTakeDamage);
|
||||
}
|
||||
|
||||
public override void ReceiveExtraAI(BinaryReader reader)
|
||||
{
|
||||
invinceTime = reader.ReadInt32();
|
||||
NPC.dontTakeDamage = reader.ReadBoolean();
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
if (invinceTime > 0)
|
||||
{
|
||||
invinceTime--;
|
||||
NPC.damage = 0;
|
||||
NPC.dontTakeDamage = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
NPC.damage = NPC.defDamage;
|
||||
NPC.dontTakeDamage = false;
|
||||
}
|
||||
|
||||
Vector2 vector = NPC.Center;
|
||||
|
||||
if (NPC.ai[2] > 0f)
|
||||
NPC.realLife = (int)NPC.ai[2];
|
||||
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
if (!tail && NPC.ai[0] == 0f)
|
||||
{
|
||||
int Previous = NPC.whoAmI;
|
||||
for (int segmentSpawn = 0; segmentSpawn < maxLength; segmentSpawn++)
|
||||
{
|
||||
int segment;
|
||||
if (segmentSpawn >= 0 && segmentSpawn < minLength)
|
||||
{
|
||||
segment = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType<CosmicGuardianBody>(), NPC.whoAmI);
|
||||
}
|
||||
else
|
||||
{
|
||||
segment = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType<CosmicGuardianTail>(), NPC.whoAmI);
|
||||
}
|
||||
Main.npc[segment].realLife = NPC.whoAmI;
|
||||
Main.npc[segment].ai[2] = NPC.whoAmI;
|
||||
Main.npc[segment].ai[1] = Previous;
|
||||
Main.npc[Previous].ai[0] = segment;
|
||||
NPC.netUpdate = true;
|
||||
Previous = segment;
|
||||
}
|
||||
tail = true;
|
||||
}
|
||||
if (!NPC.active && Main.dedServ)
|
||||
{
|
||||
NetMessage.SendData(MessageID.DamageNPC, -1, -1, null, NPC.whoAmI, -1f, 0f, 0f, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (CalamityGlobalNPC.DoGHead < 0 || !Main.npc[CalamityGlobalNPC.DoGHead].active)
|
||||
{
|
||||
NPC.velocity.Y -= 4f;
|
||||
|
||||
if ((double)NPC.position.Y < Main.topWorld + 16f)
|
||||
{
|
||||
for (int a = 0; a < Main.maxNPCs; a++)
|
||||
{
|
||||
if (Main.npc[a].type == NPC.type || Main.npc[a].type == ModContent.NPCType<CosmicGuardianBody>() || Main.npc[a].type == ModContent.NPCType<CosmicGuardianTail>())
|
||||
Main.npc[a].active = false;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = Main.player[Main.npc[CalamityGlobalNPC.DoGHead].target];
|
||||
|
||||
bool increaseSpeed = Vector2.Distance(player.Center, vector) > CalamityGlobalNPC.CatchUpDistance200Tiles;
|
||||
bool increaseSpeedMore = Vector2.Distance(player.Center, vector) > CalamityGlobalNPC.CatchUpDistance350Tiles;
|
||||
|
||||
NPC.Opacity = Main.npc[CalamityGlobalNPC.DoGHead].Opacity;
|
||||
|
||||
// Fly up and despawn if DoG enters phase 2 and isn't in the final Cosmic Guardian spawn phase.
|
||||
bool flyAwayAndDespawn = (Main.npc[CalamityGlobalNPC.DoGHead].life / (float)Main.npc[CalamityGlobalNPC.DoGHead].lifeMax < 0.6f && Main.npc[CalamityGlobalNPC.DoGHead].life / (float)Main.npc[CalamityGlobalNPC.DoGHead].lifeMax > 0.2f) || Main.npc[CalamityGlobalNPC.DoGHead].life <= 1;
|
||||
if (flyAwayAndDespawn)
|
||||
{
|
||||
// Prevents them from doing damage while despawning.
|
||||
NPC.Opacity = 0.99f;
|
||||
|
||||
NPC.velocity.Y -= 4f;
|
||||
|
||||
if ((double)NPC.position.Y < Main.topWorld + 16f)
|
||||
{
|
||||
for (int a = 0; a < Main.maxNPCs; a++)
|
||||
{
|
||||
if (Main.npc[a].type == NPC.type || Main.npc[a].type == ModContent.NPCType<CosmicGuardianBody>() || Main.npc[a].type == ModContent.NPCType<CosmicGuardianTail>())
|
||||
Main.npc[a].active = false;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Vector2 segmentDirection = NPC.Center;
|
||||
float dogHeadX = Main.npc[CalamityGlobalNPC.DoGHead].position.X + (Main.npc[CalamityGlobalNPC.DoGHead].width / 2);
|
||||
float dogHeadY = Main.npc[CalamityGlobalNPC.DoGHead].position.Y + (Main.npc[CalamityGlobalNPC.DoGHead].height / 2);
|
||||
float segmentVelocity = CalamityWorld.revenge ? 25f : 23f;
|
||||
float velocityMult = CalamityWorld.revenge ? 0.75f : 0.23f;
|
||||
float maxDistanceFromDoGHead = 160f;
|
||||
|
||||
if (increaseSpeedMore)
|
||||
velocityMult *= 4f;
|
||||
else if (increaseSpeed)
|
||||
velocityMult *= 2f;
|
||||
|
||||
foreach (NPC n in Main.ActiveNPCs)
|
||||
{
|
||||
if ((n.type == NPC.type || n.type == ModContent.NPCType<DevourerofGodsHead>()) && n.whoAmI != NPC.whoAmI)
|
||||
{
|
||||
Vector2 distFromHead = n.Center - NPC.Center;
|
||||
if (distFromHead.Length() < maxDistanceFromDoGHead)
|
||||
{
|
||||
distFromHead.Normalize();
|
||||
distFromHead *= maxDistanceFromDoGHead;
|
||||
dogHeadX -= distFromHead.X;
|
||||
dogHeadY -= distFromHead.Y;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
float higherMaxDistance = segmentVelocity * 1.3f;
|
||||
float lowerMaxDistance = segmentVelocity * 0.7f;
|
||||
float npcSpeed = NPC.velocity.Length();
|
||||
if (npcSpeed > 0f)
|
||||
{
|
||||
if (npcSpeed > higherMaxDistance)
|
||||
{
|
||||
NPC.velocity.Normalize();
|
||||
NPC.velocity *= higherMaxDistance;
|
||||
}
|
||||
else if (npcSpeed < lowerMaxDistance)
|
||||
{
|
||||
NPC.velocity.Normalize();
|
||||
NPC.velocity *= lowerMaxDistance;
|
||||
}
|
||||
}
|
||||
|
||||
dogHeadX = (int)(dogHeadX / 16f) * 16;
|
||||
dogHeadY = (int)(dogHeadY / 16f) * 16;
|
||||
segmentDirection.X = (int)(segmentDirection.X / 16f) * 16;
|
||||
segmentDirection.Y = (int)(segmentDirection.Y / 16f) * 16;
|
||||
dogHeadX -= segmentDirection.X;
|
||||
dogHeadY -= segmentDirection.Y;
|
||||
float targetDistance = (float)Math.Sqrt(dogHeadX * dogHeadX + dogHeadY * dogHeadY);
|
||||
float absoluteDoGX = Math.Abs(dogHeadX);
|
||||
float absoluteDoGY = Math.Abs(dogHeadY);
|
||||
float timeToReachTarget = segmentVelocity / targetDistance;
|
||||
dogHeadX *= timeToReachTarget;
|
||||
dogHeadY *= timeToReachTarget;
|
||||
if ((NPC.velocity.X > 0f && dogHeadX > 0f) || (NPC.velocity.X < 0f && dogHeadX < 0f) || (NPC.velocity.Y > 0f && dogHeadY > 0f) || (NPC.velocity.Y < 0f && dogHeadY < 0f))
|
||||
{
|
||||
if (NPC.velocity.X < dogHeadX)
|
||||
{
|
||||
NPC.velocity.X = NPC.velocity.X + velocityMult;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (NPC.velocity.X > dogHeadX)
|
||||
{
|
||||
NPC.velocity.X = NPC.velocity.X - velocityMult;
|
||||
}
|
||||
}
|
||||
if (NPC.velocity.Y < dogHeadY)
|
||||
{
|
||||
NPC.velocity.Y = NPC.velocity.Y + velocityMult;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (NPC.velocity.Y > dogHeadY)
|
||||
{
|
||||
NPC.velocity.Y = NPC.velocity.Y - velocityMult;
|
||||
}
|
||||
}
|
||||
if (Math.Abs(dogHeadY) < segmentVelocity * 0.2 && ((NPC.velocity.X > 0f && dogHeadX < 0f) || (NPC.velocity.X < 0f && dogHeadX > 0f)))
|
||||
{
|
||||
if (NPC.velocity.Y > 0f)
|
||||
{
|
||||
NPC.velocity.Y = NPC.velocity.Y + velocityMult * 2f;
|
||||
}
|
||||
else
|
||||
{
|
||||
NPC.velocity.Y = NPC.velocity.Y - velocityMult * 2f;
|
||||
}
|
||||
}
|
||||
if (Math.Abs(dogHeadX) < segmentVelocity * 0.2 && ((NPC.velocity.Y > 0f && dogHeadY < 0f) || (NPC.velocity.Y < 0f && dogHeadY > 0f)))
|
||||
{
|
||||
if (NPC.velocity.X > 0f)
|
||||
{
|
||||
NPC.velocity.X = NPC.velocity.X + velocityMult * 2f; //changed from 2
|
||||
}
|
||||
else
|
||||
{
|
||||
NPC.velocity.X = NPC.velocity.X - velocityMult * 2f; //changed from 2
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (absoluteDoGX > absoluteDoGY)
|
||||
{
|
||||
if (NPC.velocity.X < dogHeadX)
|
||||
{
|
||||
NPC.velocity.X = NPC.velocity.X + velocityMult * 1.1f; //changed from 1.1
|
||||
}
|
||||
else if (NPC.velocity.X > dogHeadX)
|
||||
{
|
||||
NPC.velocity.X = NPC.velocity.X - velocityMult * 1.1f; //changed from 1.1
|
||||
}
|
||||
if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < segmentVelocity * 0.5)
|
||||
{
|
||||
if (NPC.velocity.Y > 0f)
|
||||
{
|
||||
NPC.velocity.Y = NPC.velocity.Y + velocityMult;
|
||||
}
|
||||
else
|
||||
{
|
||||
NPC.velocity.Y = NPC.velocity.Y - velocityMult;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (NPC.velocity.Y < dogHeadY)
|
||||
{
|
||||
NPC.velocity.Y = NPC.velocity.Y + velocityMult * 1.1f;
|
||||
}
|
||||
else if (NPC.velocity.Y > dogHeadY)
|
||||
{
|
||||
NPC.velocity.Y = NPC.velocity.Y - velocityMult * 1.1f;
|
||||
}
|
||||
if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < segmentVelocity * 0.5)
|
||||
{
|
||||
if (NPC.velocity.X > 0f)
|
||||
{
|
||||
NPC.velocity.X = NPC.velocity.X + velocityMult;
|
||||
}
|
||||
else
|
||||
{
|
||||
NPC.velocity.X = NPC.velocity.X - velocityMult;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X) + MathHelper.PiOver2;
|
||||
}
|
||||
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor)
|
||||
{
|
||||
if (NPC.IsABestiaryIconDummy)
|
||||
NPC.Opacity = 1f;
|
||||
|
||||
SpriteEffects spriteEffects = SpriteEffects.None;
|
||||
if (NPC.spriteDirection == 1)
|
||||
spriteEffects = SpriteEffects.FlipHorizontally;
|
||||
|
||||
Texture2D texture2D15 = TextureAssets.Npc[Type].Value;
|
||||
Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[Type].Value.Width / 2), (float)(TextureAssets.Npc[Type].Value.Height / 2));
|
||||
|
||||
|
||||
if (NPC.IsABestiaryIconDummy)
|
||||
{
|
||||
return CalamityUtils.DrawAnimatedBestiaryWorm(spriteBatch, NPC, drawColor, texture2D15, TextureAssets.Npc[ModContent.NPCType<CosmicGuardianBody>()].Value, 8, 26, 0.2f, new Vector2(-10, 0), 4, 5);
|
||||
}
|
||||
|
||||
Vector2 distFromHead3 = NPC.Center - screenPos;
|
||||
distFromHead3 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f;
|
||||
distFromHead3 += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY);
|
||||
spriteBatch.Draw(texture2D15, distFromHead3, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
|
||||
|
||||
texture2D15 = GlowTexture.Value;
|
||||
Color glowmaskColor = Color.Lerp(Color.White, Color.Fuchsia, 0.5f);
|
||||
|
||||
spriteBatch.Draw(texture2D15, distFromHead3, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
|
||||
|
||||
texture2D15 = GlowTexture2.Value;
|
||||
glowmaskColor = Color.Lerp(Color.White, Color.Cyan, 0.5f);
|
||||
|
||||
spriteBatch.Draw(texture2D15, distFromHead3, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void OnKill()
|
||||
{
|
||||
int heartAmt = Main.rand.Next(3) + 3;
|
||||
for (int i = 0; i < heartAmt; i++)
|
||||
Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart);
|
||||
}
|
||||
|
||||
public override bool CanHitPlayer(Player target, ref int cooldownSlot)
|
||||
{
|
||||
cooldownSlot = ImmunityCooldownID.Bosses;
|
||||
return NPC.Opacity >= 1f && invinceTime <= 0;
|
||||
}
|
||||
|
||||
public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position)
|
||||
{
|
||||
scale = 1.5f;
|
||||
return null;
|
||||
}
|
||||
|
||||
public override bool CheckActive()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void HitEffect(NPC.HitInfo hit)
|
||||
{
|
||||
if (NPC.life <= 0)
|
||||
{
|
||||
if (!Main.dedServ)
|
||||
{
|
||||
Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find<ModGore>("DoT").Type, 1f);
|
||||
}
|
||||
NPC.position.X = NPC.position.X + (float)(NPC.width / 2);
|
||||
NPC.position.Y = NPC.position.Y + (float)(NPC.height / 2);
|
||||
NPC.width = 50;
|
||||
NPC.height = 50;
|
||||
NPC.position.X = NPC.position.X - (float)(NPC.width / 2);
|
||||
NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2);
|
||||
for (int i = 0; i < 15; i++)
|
||||
{
|
||||
int cosmiliteDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f);
|
||||
Main.dust[cosmiliteDust].velocity *= 3f;
|
||||
if (Main.rand.NextBool())
|
||||
{
|
||||
Main.dust[cosmiliteDust].scale = 0.5f;
|
||||
Main.dust[cosmiliteDust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f;
|
||||
}
|
||||
}
|
||||
for (int j = 0; j < 30; j++)
|
||||
{
|
||||
int cosmiliteDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f);
|
||||
Main.dust[cosmiliteDust2].noGravity = true;
|
||||
Main.dust[cosmiliteDust2].velocity *= 5f;
|
||||
cosmiliteDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f);
|
||||
Main.dust[cosmiliteDust2].velocity *= 2f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo)
|
||||
{
|
||||
if (hurtInfo.Damage > 0)
|
||||
target.AddBuff(ModContent.BuffType<GodSlayerInferno>(), 240);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 366 B |
|
Before Width: | Height: | Size: 573 B |
@@ -1,218 +0,0 @@
|
||||
using System.IO;
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.Dusts;
|
||||
using CalamityMod.Events;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Content;
|
||||
using Terraria;
|
||||
using Terraria.GameContent;
|
||||
using Terraria.ID;
|
||||
using Terraria.Localization;
|
||||
using Terraria.ModLoader;
|
||||
namespace CalamityMod.NPCs.DevourerofGods
|
||||
{
|
||||
[HasPierceResist]
|
||||
[LongDistanceNetSync(SyncWith = typeof(CosmicGuardianHead))]
|
||||
public class CosmicGuardianTail : ModNPC
|
||||
{
|
||||
public int invinceTime = 180;
|
||||
public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.CosmicGuardianHead.DisplayName");
|
||||
|
||||
public static Asset<Texture2D> GlowTexture;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
this.HideFromBestiary();
|
||||
if (!Main.dedServ)
|
||||
{
|
||||
GlowTexture = ModContent.Request<Texture2D>(Texture + "Glow", AssetRequestMode.AsyncLoad);
|
||||
}
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
NPC.damage = 90; // 180
|
||||
NPC.width = 30;
|
||||
NPC.height = 50;
|
||||
NPC.defense = 70;
|
||||
NPC.lifeMax = 50000;
|
||||
NPC.aiStyle = -1;
|
||||
AIType = -1;
|
||||
NPC.knockBackResist = 0f;
|
||||
NPC.Opacity = 0f;
|
||||
NPC.behindTiles = true;
|
||||
NPC.noGravity = true;
|
||||
NPC.noTileCollide = true;
|
||||
NPC.HitSound = SoundID.NPCHit4;
|
||||
NPC.DeathSound = SoundID.NPCDeath14;
|
||||
NPC.netAlways = true;
|
||||
NPC.dontCountMe = true;
|
||||
}
|
||||
|
||||
public override void SendExtraAI(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(invinceTime);
|
||||
writer.Write(NPC.dontTakeDamage);
|
||||
}
|
||||
|
||||
public override void ReceiveExtraAI(BinaryReader reader)
|
||||
{
|
||||
invinceTime = reader.ReadInt32();
|
||||
NPC.dontTakeDamage = reader.ReadBoolean();
|
||||
}
|
||||
|
||||
public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
if (invinceTime > 0)
|
||||
{
|
||||
invinceTime--;
|
||||
NPC.damage = 0;
|
||||
NPC.dontTakeDamage = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
NPC.damage = NPC.defDamage;
|
||||
NPC.dontTakeDamage = false;
|
||||
}
|
||||
|
||||
if (NPC.ai[2] > 0f)
|
||||
NPC.realLife = (int)NPC.ai[2];
|
||||
|
||||
// Check if other segments are still alive, if not, die
|
||||
bool shouldDespawn = !NPC.AnyNPCs(ModContent.NPCType<CosmicGuardianHead>());
|
||||
if (!shouldDespawn)
|
||||
{
|
||||
if (NPC.ai[1] <= 0f)
|
||||
shouldDespawn = true;
|
||||
else if (Main.npc[(int)NPC.ai[1]].life <= 0)
|
||||
shouldDespawn = true;
|
||||
}
|
||||
if (shouldDespawn)
|
||||
{
|
||||
NPC.life = 0;
|
||||
NPC.HitEffect(0, 10.0);
|
||||
NPC.checkDead();
|
||||
NPC.active = false;
|
||||
}
|
||||
|
||||
NPC.Opacity = Main.npc[(int)NPC.ai[2]].Opacity;
|
||||
|
||||
Vector2 segmentPosition = NPC.Center;
|
||||
float targetX = Main.player[NPC.target].position.X + (Main.player[NPC.target].width / 2);
|
||||
float targetY = Main.player[NPC.target].position.Y + (Main.player[NPC.target].height / 2);
|
||||
targetX = (int)(targetX / 16f) * 16;
|
||||
targetY = (int)(targetY / 16f) * 16;
|
||||
segmentPosition.X = (int)(segmentPosition.X / 16f) * 16;
|
||||
segmentPosition.Y = (int)(segmentPosition.Y / 16f) * 16;
|
||||
targetX -= segmentPosition.X;
|
||||
targetY -= segmentPosition.Y;
|
||||
float targetDistance = (float)System.Math.Sqrt(targetX * targetX + targetY * targetY);
|
||||
if (NPC.ai[1] > 0f && NPC.ai[1] < Main.npc.Length)
|
||||
{
|
||||
try
|
||||
{
|
||||
segmentPosition = NPC.Center;
|
||||
targetX = Main.npc[(int)NPC.ai[1]].position.X + (Main.npc[(int)NPC.ai[1]].width / 2) - segmentPosition.X;
|
||||
targetY = Main.npc[(int)NPC.ai[1]].position.Y + (Main.npc[(int)NPC.ai[1]].height / 2) - segmentPosition.Y;
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
NPC.rotation = (float)System.Math.Atan2(targetY, targetX) + 1.57f;
|
||||
targetDistance = (float)System.Math.Sqrt(targetX * targetX + targetY * targetY);
|
||||
int segmentWidth = NPC.width;
|
||||
targetDistance = (targetDistance - segmentWidth) / targetDistance;
|
||||
targetX *= targetDistance;
|
||||
targetY *= targetDistance;
|
||||
NPC.velocity = Vector2.Zero;
|
||||
NPC.position.X = NPC.position.X + targetX;
|
||||
NPC.position.Y = NPC.position.Y + targetY;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor)
|
||||
{
|
||||
SpriteEffects spriteEffects = SpriteEffects.None;
|
||||
if (NPC.spriteDirection == 1)
|
||||
spriteEffects = SpriteEffects.FlipHorizontally;
|
||||
|
||||
Texture2D texture2D15 = TextureAssets.Npc[Type].Value;
|
||||
Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[Type].Value.Width / 2), (float)(TextureAssets.Npc[Type].Value.Height / 2));
|
||||
|
||||
Vector2 drawLocation = NPC.Center - screenPos;
|
||||
drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f;
|
||||
drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY);
|
||||
spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
|
||||
|
||||
texture2D15 = GlowTexture.Value;
|
||||
Color glowmaskColor = Color.Lerp(Color.White, Color.Cyan, 0.5f);
|
||||
|
||||
spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool CanHitPlayer(Player target, ref int cooldownSlot)
|
||||
{
|
||||
cooldownSlot = ImmunityCooldownID.Bosses;
|
||||
return NPC.Opacity >= 1f && invinceTime <= 0;
|
||||
}
|
||||
|
||||
public override void HitEffect(NPC.HitInfo hit)
|
||||
{
|
||||
if (NPC.life <= 0)
|
||||
{
|
||||
if (!Main.dedServ)
|
||||
{
|
||||
float randomSpread = Main.rand.Next(-200, 201) / 100f;
|
||||
Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread * Main.rand.NextFloat(), Mod.Find<ModGore>("DoT2").Type, 1f);
|
||||
Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread * Main.rand.NextFloat(), Mod.Find<ModGore>("DoT3").Type, 1f);
|
||||
Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread * Main.rand.NextFloat(), Mod.Find<ModGore>("DoT4").Type, 1f);
|
||||
Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread * Main.rand.NextFloat(), Mod.Find<ModGore>("DoT5").Type, 1f);
|
||||
}
|
||||
NPC.position.X = NPC.position.X + (float)(NPC.width / 2);
|
||||
NPC.position.Y = NPC.position.Y + (float)(NPC.height / 2);
|
||||
NPC.width = 50;
|
||||
NPC.height = 50;
|
||||
NPC.position.X = NPC.position.X - (float)(NPC.width / 2);
|
||||
NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2);
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
int cosmiliteDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f);
|
||||
Main.dust[cosmiliteDust].velocity *= 3f;
|
||||
if (Main.rand.NextBool())
|
||||
{
|
||||
Main.dust[cosmiliteDust].scale = 0.5f;
|
||||
Main.dust[cosmiliteDust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f;
|
||||
}
|
||||
}
|
||||
for (int j = 0; j < 20; j++)
|
||||
{
|
||||
int cosmiliteDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f);
|
||||
Main.dust[cosmiliteDust2].noGravity = true;
|
||||
Main.dust[cosmiliteDust2].velocity *= 5f;
|
||||
cosmiliteDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f);
|
||||
Main.dust[cosmiliteDust2].velocity *= 2f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override bool CheckActive()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo)
|
||||
{
|
||||
if (hurtInfo.Damage > 0)
|
||||
target.AddBuff(ModContent.BuffType<GodSlayerInferno>(), 60, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 640 B |
@@ -4,6 +4,7 @@ using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.Buffs.StatDebuffs;
|
||||
using CalamityMod.Dusts;
|
||||
using CalamityMod.Events;
|
||||
using CalamityMod.Graphics.Renderers.CalamityRenderers;
|
||||
using CalamityMod.Projectiles.Boss;
|
||||
using CalamityMod.Projectiles.Melee.Yoyos;
|
||||
using CalamityMod.World;
|
||||
@@ -27,7 +28,7 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
|
||||
public override void Load()
|
||||
{
|
||||
string phase2IconPath = "CalamityMod/NPCs/DevourerofGods/DevourerofGodsBodyS_Head_Boss";
|
||||
string phase2IconPath = "CalamityMod/NPCs/DevourerofGods/DevourerofGodsBody_P2_Head_Boss";
|
||||
phase2IconIndex = CalamityMod.Instance.AddBossHeadTexture(phase2IconPath, -1);
|
||||
}
|
||||
|
||||
@@ -41,9 +42,9 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
public int SegmentIndex;
|
||||
|
||||
public static Asset<Texture2D> Texture_Glow;
|
||||
public static Asset<Texture2D> Phase2Texture;
|
||||
public static Asset<Texture2D> Phase2Texture_Glow;
|
||||
public static Asset<Texture2D> Phase2Texture_Glow2;
|
||||
public static Asset<Texture2D> TextureP2;
|
||||
public static Asset<Texture2D> TextureP2_Glow_Purple;
|
||||
public static Asset<Texture2D> TextureP2_Glow_Cyan;
|
||||
|
||||
public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.DevourerofGodsHead.DisplayName");
|
||||
|
||||
@@ -52,16 +53,15 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
this.HideFromBestiary();
|
||||
if (!Main.dedServ)
|
||||
{
|
||||
Texture_Glow = ModContent.Request<Texture2D>(Texture + "Glow", AssetRequestMode.AsyncLoad);
|
||||
Phase2Texture = ModContent.Request<Texture2D>(Texture + "S", AssetRequestMode.AsyncLoad);
|
||||
Phase2Texture_Glow = ModContent.Request<Texture2D>(Texture + "SGlow", AssetRequestMode.AsyncLoad);
|
||||
Phase2Texture_Glow2 = ModContent.Request<Texture2D>(Texture + "SGlow2", AssetRequestMode.AsyncLoad);
|
||||
Texture_Glow = ModContent.Request<Texture2D>(Texture + "_Glow", AssetRequestMode.AsyncLoad);
|
||||
TextureP2 = ModContent.Request<Texture2D>(Texture + "_P2", AssetRequestMode.AsyncLoad);
|
||||
TextureP2_Glow_Purple = ModContent.Request<Texture2D>(Texture + "_P2_Glow_Purple", AssetRequestMode.AsyncLoad);
|
||||
TextureP2_Glow_Cyan = ModContent.Request<Texture2D>(Texture + "_P2_Glow_Cyan", AssetRequestMode.AsyncLoad);
|
||||
}
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
NPC.Calamity().canBreakPlayerDefense = true;
|
||||
NPC.damage = 120; // 240
|
||||
NPC.npcSlots = 5f;
|
||||
NPC.width = 56;
|
||||
@@ -74,7 +74,7 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
global.unbreakableDR = true;
|
||||
NPC.chaseable = false;
|
||||
}
|
||||
NPC.LifeMaxNERB(887500, 1065000, 1500000); // Phase 1 is 355000, Phase 2 is 532500
|
||||
NPC.LifeMaxNERB(760000, 910000, 1500000);
|
||||
NPC.aiStyle = -1;
|
||||
AIType = -1;
|
||||
NPC.knockBackResist = 0f;
|
||||
@@ -89,7 +89,7 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
NPC.BossBar = Main.BigBossProgressBar.NeverValid;
|
||||
NPC.dontCountMe = true;
|
||||
|
||||
if (Main.getGoodWorld)
|
||||
if (Main.zenithWorld)
|
||||
NPC.scale *= 1.5f;
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
{
|
||||
NPC head = CalamityGlobalNPC.DoGHead >= 0 ? Main.npc[CalamityGlobalNPC.DoGHead] : null;
|
||||
DevourerofGodsHead modNPC = head?.ModNPC<DevourerofGodsHead>() ?? null;
|
||||
if (head is null || modNPC.AwaitingPhase2Teleport || !modNPC.Phase2Started)
|
||||
if (head is null || modNPC.AwaitingPhase2Teleport || !modNPC.Phase2Started || NPC.Opacity < 0.1f)
|
||||
{
|
||||
index = -1;
|
||||
return;
|
||||
@@ -149,19 +149,20 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
if (NPC.ai[2] > 0f)
|
||||
NPC.realLife = (int)NPC.ai[2];
|
||||
|
||||
if (NPC.life > Main.npc[(int)NPC.ai[1]].life)
|
||||
NPC.life = Main.npc[(int)NPC.ai[1]].life;
|
||||
NPC.life = Main.npc[(int)NPC.ai[2]].life;
|
||||
NPC.lifeMax = Main.npc[(int)NPC.ai[2]].lifeMax;NPC.life = NPC.lifeMax;
|
||||
|
||||
// Percent life remaining
|
||||
float lifeRatio = NPC.life / (float)NPC.lifeMax;
|
||||
float lifeRatio = Main.npc[(int)NPC.ai[2]].life / (float)Main.npc[(int)NPC.ai[2]].lifeMax;
|
||||
|
||||
bool phase2 = lifeRatio < 0.6f;
|
||||
bool phase2 = lifeRatio < 0.65f;
|
||||
bool expertMode = Main.expertMode || BossRushEvent.BossRushActive;
|
||||
bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive;
|
||||
bool death = CalamityWorld.death || BossRushEvent.BossRushActive;
|
||||
|
||||
if (phase2)
|
||||
if (phase2 && !phase2Started && Main.npc[(int)NPC.ai[2]].localAI[2] <= 60)
|
||||
{
|
||||
|
||||
phase2Started = true;
|
||||
|
||||
// Once before DoG spawns, set new size
|
||||
@@ -264,7 +265,7 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
|
||||
// Decide segment offset stuff.
|
||||
NPC.rotation = directionToNextSegment.ToRotation() + MathHelper.PiOver2;
|
||||
NPC.Center = aheadSegment.Center - directionToNextSegment.SafeNormalize(Vector2.Zero) * NPC.scale * NPC.width;
|
||||
NPC.Center = aheadSegment.Center - directionToNextSegment.SafeNormalize(Vector2.Zero) * NPC.scale * (phase2Started ? 80 : NPC.width );
|
||||
NPC.spriteDirection = (directionToNextSegment.X > 0).ToDirectionInt();
|
||||
|
||||
// Velocity variables
|
||||
@@ -282,22 +283,12 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
if (Main.npc[NPC.realLife].type != ModContent.NPCType<DevourerofGodsHead>())
|
||||
return true;
|
||||
|
||||
float disintegrationFactor = Main.npc[NPC.realLife].ModNPC<DevourerofGodsHead>().DeathAnimationTimer / 640f;
|
||||
if (disintegrationFactor > 0f)
|
||||
{
|
||||
spriteBatch.EnterShaderRegion();
|
||||
GameShaders.Misc["CalamityMod:DoGDisintegration"].UseOpacity(disintegrationFactor);
|
||||
GameShaders.Misc["CalamityMod:DoGDisintegration"].UseSaturation(NPC.whoAmI);
|
||||
GameShaders.Misc["CalamityMod:DoGDisintegration"].UseImage1("Images/Misc/Perlin");
|
||||
GameShaders.Misc["CalamityMod:DoGDisintegration"].Apply();
|
||||
}
|
||||
|
||||
SpriteEffects spriteEffects = SpriteEffects.None;
|
||||
if (NPC.spriteDirection == 1)
|
||||
spriteEffects = SpriteEffects.FlipHorizontally;
|
||||
|
||||
bool useOtherTextures = phase2Started && Main.npc[(int)NPC.ai[2]].localAI[2] <= 60f;
|
||||
Texture2D texture2D15 = useOtherTextures ? Phase2Texture.Value : TextureAssets.Npc[Type].Value;
|
||||
Texture2D texture2D15 = useOtherTextures ? TextureP2.Value : TextureAssets.Npc[Type].Value;
|
||||
Vector2 halfSizeTexture = new Vector2(texture2D15.Width / 2, texture2D15.Height / 2);
|
||||
|
||||
Vector2 drawLocation = NPC.Center - screenPos;
|
||||
@@ -305,25 +296,21 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY);
|
||||
spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
|
||||
|
||||
if (!NPC.dontTakeDamage)
|
||||
if (!Main.npc[(int)NPC.ai[2]].ModNPC<DevourerofGodsHead>().isInPassiveState && NPC.Opacity > 0.25f && useOtherTextures)
|
||||
{
|
||||
if (useOtherTextures)
|
||||
{
|
||||
texture2D15 = Phase2Texture_Glow.Value;
|
||||
Color glowmaskColor = Color.Lerp(Color.White, Color.Fuchsia, 0.5f);
|
||||
texture2D15 = TextureP2_Glow_Purple.Value;
|
||||
Color glowmaskColor = Color.Lerp(Color.White, Color.Fuchsia, 0.5f);
|
||||
|
||||
spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
|
||||
}
|
||||
|
||||
texture2D15 = useOtherTextures ? Phase2Texture_Glow2.Value : Texture_Glow.Value;
|
||||
spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
|
||||
}
|
||||
if ((!Main.npc[(int)NPC.ai[2]].ModNPC<DevourerofGodsHead>().isInAgressiveState || !useOtherTextures) && NPC.Opacity > 0.25f)
|
||||
{
|
||||
texture2D15 = useOtherTextures ? TextureP2_Glow_Cyan.Value : Texture_Glow.Value;
|
||||
Color glowmaskColor2 = Color.Lerp(Color.White, Color.Cyan, 0.5f);
|
||||
|
||||
spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor2, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
|
||||
}
|
||||
|
||||
if (disintegrationFactor > 0f)
|
||||
spriteBatch.ExitShaderRegion();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -421,14 +408,5 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
{
|
||||
NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment);
|
||||
}
|
||||
|
||||
public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo)
|
||||
{
|
||||
if (hurtInfo.Damage > 0)
|
||||
{
|
||||
target.AddBuff(ModContent.BuffType<GodSlayerInferno>(), 180);
|
||||
target.AddBuff(ModContent.BuffType<WhisperingDeath>(), 480);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 983 B After Width: | Height: | Size: 983 B |
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 672 B After Width: | Height: | Size: 672 B |
|
Before Width: | Height: | Size: 672 B After Width: | Height: | Size: 672 B |
|
Before Width: | Height: | Size: 441 B After Width: | Height: | Size: 441 B |
|
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 708 B After Width: | Height: | Size: 708 B |
|
After Width: | Height: | Size: 325 B |
|
After Width: | Height: | Size: 790 B |
|
After Width: | Height: | Size: 333 B |
|
After Width: | Height: | Size: 867 B |
|
After Width: | Height: | Size: 423 B |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 516 B |
|
After Width: | Height: | Size: 379 B |
|
Before Width: | Height: | Size: 7.4 KiB After Width: | Height: | Size: 7.4 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 682 B After Width: | Height: | Size: 682 B |
@@ -3,6 +3,7 @@ using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.Buffs.StatDebuffs;
|
||||
using CalamityMod.Dusts;
|
||||
using CalamityMod.Events;
|
||||
using CalamityMod.Graphics.Renderers.CalamityRenderers;
|
||||
using CalamityMod.Projectiles.Melee.Yoyos;
|
||||
using CalamityMod.Sounds;
|
||||
using CalamityMod.World;
|
||||
@@ -25,16 +26,16 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
public static int phase1IconIndex;
|
||||
public static int phase2IconIndex;
|
||||
|
||||
public static Asset<Texture2D> Texture_Glow;
|
||||
public static Asset<Texture2D> Texture_Glow2;
|
||||
public static Asset<Texture2D> Phase2Texture;
|
||||
public static Asset<Texture2D> Phase2Texture_Glow;
|
||||
public static Asset<Texture2D> Phase2Texture_Glow2;
|
||||
public static Asset<Texture2D> Texture_Glow_Purple;
|
||||
public static Asset<Texture2D> Texture_Glow_Cyan;
|
||||
public static Asset<Texture2D> TextureP2;
|
||||
public static Asset<Texture2D> TextureP2_Glow_Purple;
|
||||
public static Asset<Texture2D> TextureP2_Glow_Cyan;
|
||||
|
||||
public override void Load()
|
||||
{
|
||||
string phase1IconPath = "CalamityMod/NPCs/DevourerofGods/DevourerofGodsTail_Head_Boss";
|
||||
string phase2IconPath = "CalamityMod/NPCs/DevourerofGods/DevourerofGodsTailS_Head_Boss";
|
||||
string phase2IconPath = "CalamityMod/NPCs/DevourerofGods/DevourerofGodsTail_P2_Head_Boss";
|
||||
|
||||
phase1IconIndex = CalamityMod.Instance.AddBossHeadTexture(phase1IconPath, -1);
|
||||
phase2IconIndex = CalamityMod.Instance.AddBossHeadTexture(phase2IconPath, -1);
|
||||
@@ -49,11 +50,11 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
this.HideFromBestiary();
|
||||
if (!Main.dedServ)
|
||||
{
|
||||
Texture_Glow = ModContent.Request<Texture2D>(Texture + "Glow", AssetRequestMode.AsyncLoad);
|
||||
Texture_Glow2 = ModContent.Request<Texture2D>(Texture + "Glow2", AssetRequestMode.AsyncLoad);
|
||||
Phase2Texture = ModContent.Request<Texture2D>(Texture + "S", AssetRequestMode.AsyncLoad);
|
||||
Phase2Texture_Glow = ModContent.Request<Texture2D>(Texture + "SGlow", AssetRequestMode.AsyncLoad);
|
||||
Phase2Texture_Glow2 = ModContent.Request<Texture2D>(Texture + "SGlow2", AssetRequestMode.AsyncLoad);
|
||||
Texture_Glow_Purple = ModContent.Request<Texture2D>(Texture + "_Glow_Purple", AssetRequestMode.AsyncLoad);
|
||||
Texture_Glow_Cyan = ModContent.Request<Texture2D>(Texture + "_Glow_Cyan", AssetRequestMode.AsyncLoad);
|
||||
TextureP2 = ModContent.Request<Texture2D>(Texture + "_P2", AssetRequestMode.AsyncLoad);
|
||||
TextureP2_Glow_Purple = ModContent.Request<Texture2D>(Texture + "_P2_Glow_Purple", AssetRequestMode.AsyncLoad);
|
||||
TextureP2_Glow_Cyan = ModContent.Request<Texture2D>(Texture + "_P2_Glow_Cyan", AssetRequestMode.AsyncLoad);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,13 +65,12 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
NPC.Calamity().canBreakPlayerDefense = true;
|
||||
NPC.damage = 100; // 200
|
||||
NPC.npcSlots = 5f;
|
||||
NPC.width = 66;
|
||||
NPC.height = 66;
|
||||
NPC.defense = 50;
|
||||
NPC.LifeMaxNERB(887500, 1065000, 1500000); // Phase 1 is 355000, Phase 2 is 532500
|
||||
NPC.LifeMaxNERB(760000, 910000, 1500000);
|
||||
NPC.aiStyle = -1;
|
||||
AIType = -1;
|
||||
NPC.knockBackResist = 0f;
|
||||
@@ -82,11 +82,13 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
NPC.netAlways = true;
|
||||
NPC.boss = true;
|
||||
NPC.BossBar = Main.BigBossProgressBar.NeverValid;
|
||||
NPC.takenDamageMultiplier = 1.25f;
|
||||
NPC.dontCountMe = true;
|
||||
|
||||
if (Main.getGoodWorld)
|
||||
if (Main.zenithWorld)
|
||||
NPC.scale *= 1.5f;
|
||||
|
||||
if (Main.getGoodWorld)
|
||||
NPC.takenDamageMultiplier = 2;
|
||||
}
|
||||
|
||||
public override void BossHeadSlot(ref int index)
|
||||
@@ -95,7 +97,7 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
DevourerofGodsHead modNPC = head?.ModNPC<DevourerofGodsHead>() ?? null;
|
||||
|
||||
index = -1;
|
||||
if (head is null)
|
||||
if (head is null || NPC.Opacity < 0.1f)
|
||||
return;
|
||||
|
||||
if (!modNPC.Phase2Started)
|
||||
@@ -150,30 +152,26 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
if (NPC.ai[2] > 0f)
|
||||
NPC.realLife = (int)NPC.ai[2];
|
||||
|
||||
if (NPC.life > Main.npc[(int)NPC.ai[1]].life)
|
||||
NPC.life = Main.npc[(int)NPC.ai[1]].life;
|
||||
NPC.life = Main.npc[(int)NPC.ai[2]].life;
|
||||
NPC.lifeMax = Main.npc[(int)NPC.ai[2]].lifeMax;
|
||||
|
||||
|
||||
// Percent life remaining
|
||||
float lifeRatio = NPC.life / (float)NPC.lifeMax;
|
||||
float lifeRatio = Main.npc[(int)NPC.ai[2]].life / (float)Main.npc[(int)NPC.ai[2]].lifeMax;
|
||||
|
||||
bool phase2 = lifeRatio < 0.6f;
|
||||
bool phase2 = lifeRatio < 0.65f;
|
||||
bool expertMode = Main.expertMode || BossRushEvent.BossRushActive;
|
||||
bool death = CalamityWorld.death || BossRushEvent.BossRushActive;
|
||||
|
||||
if (phase2)
|
||||
if (phase2 && !phase2Started && Main.npc[(int)NPC.ai[2]].localAI[2] <= 60)
|
||||
{
|
||||
phase2Started = true;
|
||||
|
||||
// Once before DoG spawns, set new size
|
||||
if (Main.npc[(int)NPC.ai[2]].localAI[2] == 60f)
|
||||
{
|
||||
NPC.position = NPC.Center;
|
||||
NPC.width = (int)(80 * NPC.scale);
|
||||
NPC.height = (int)(140 * NPC.scale);
|
||||
NPC.height = (int)(80 * NPC.scale);
|
||||
NPC.frame = new Rectangle(0, 0, 86, 148);
|
||||
NPC.position -= NPC.Size * 0.5f;
|
||||
NPC.ForceNetUpdate(false);
|
||||
}
|
||||
}
|
||||
|
||||
if (invinceTime > 0)
|
||||
@@ -193,16 +191,6 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
|
||||
Player player = Main.player[NPC.target];
|
||||
|
||||
float distanceFromTarget = Vector2.Distance(player.Center, NPC.Center);
|
||||
float takeLessDamageDistance = 1600f;
|
||||
if (distanceFromTarget > takeLessDamageDistance)
|
||||
{
|
||||
float damageTakenScalar = MathHelper.Clamp(1f - ((distanceFromTarget - takeLessDamageDistance) / takeLessDamageDistance), 0f, 1f);
|
||||
NPC.takenDamageMultiplier = MathHelper.Lerp(1f, 1.25f, damageTakenScalar);
|
||||
}
|
||||
else
|
||||
NPC.takenDamageMultiplier = 1.25f;
|
||||
|
||||
// Check if other segments are still alive, if not, die
|
||||
bool shouldDespawn = !NPC.AnyNPCs(ModContent.NPCType<DevourerofGodsHead>());
|
||||
if (!shouldDespawn)
|
||||
@@ -315,22 +303,12 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
if (Main.npc[NPC.realLife].type != ModContent.NPCType<DevourerofGodsHead>())
|
||||
return true;
|
||||
|
||||
float disintegrationFactor = Main.npc[NPC.realLife].ModNPC<DevourerofGodsHead>().DeathAnimationTimer / 640f;
|
||||
if (disintegrationFactor > 0f)
|
||||
{
|
||||
spriteBatch.EnterShaderRegion();
|
||||
GameShaders.Misc["CalamityMod:DoGDisintegration"].UseOpacity(disintegrationFactor);
|
||||
GameShaders.Misc["CalamityMod:DoGDisintegration"].UseSaturation(NPC.whoAmI);
|
||||
GameShaders.Misc["CalamityMod:DoGDisintegration"].UseImage1("Images/Misc/Perlin");
|
||||
GameShaders.Misc["CalamityMod:DoGDisintegration"].Apply();
|
||||
}
|
||||
|
||||
SpriteEffects spriteEffects = SpriteEffects.None;
|
||||
if (NPC.spriteDirection == 1)
|
||||
spriteEffects = SpriteEffects.FlipHorizontally;
|
||||
|
||||
bool useOtherTextures = phase2Started && Main.npc[(int)NPC.ai[2]].localAI[2] <= 60f;
|
||||
Texture2D texture2D15 = useOtherTextures ? Phase2Texture.Value : TextureAssets.Npc[Type].Value;
|
||||
Texture2D texture2D15 = useOtherTextures ? TextureP2.Value : TextureAssets.Npc[Type].Value;
|
||||
Vector2 halfSizeTexture = new Vector2(texture2D15.Width / 2, texture2D15.Height / 2);
|
||||
|
||||
Vector2 drawPosition = NPC.Center - screenPos;
|
||||
@@ -338,22 +316,21 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
drawPosition += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY);
|
||||
spriteBatch.Draw(texture2D15, drawPosition, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
|
||||
|
||||
if (!NPC.dontTakeDamage)
|
||||
if ((!Main.npc[(int)NPC.ai[2]].ModNPC<DevourerofGodsHead>().isInPassiveState || !useOtherTextures) && NPC.Opacity > 0.25f)
|
||||
{
|
||||
texture2D15 = useOtherTextures ? Phase2Texture_Glow.Value : Texture_Glow.Value;
|
||||
texture2D15 = useOtherTextures ? TextureP2_Glow_Purple.Value : Texture_Glow_Purple.Value;
|
||||
Color glowmaskColor = Color.Lerp(Color.White, Color.Fuchsia, 0.5f);
|
||||
|
||||
spriteBatch.Draw(texture2D15, drawPosition, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
|
||||
|
||||
texture2D15 = useOtherTextures ? Phase2Texture_Glow2.Value : Texture_Glow2.Value;
|
||||
glowmaskColor = Color.Lerp(Color.White, Color.Cyan, 0.5f);
|
||||
}
|
||||
if (!Main.npc[(int)NPC.ai[2]].ModNPC<DevourerofGodsHead>().isInAgressiveState && NPC.Opacity > 0.25f)
|
||||
{
|
||||
texture2D15 = useOtherTextures ? TextureP2_Glow_Cyan.Value : Texture_Glow_Cyan.Value;
|
||||
Color glowmaskColor = Color.Lerp(Color.White, Color.Cyan, 0.5f);
|
||||
|
||||
spriteBatch.Draw(texture2D15, drawPosition, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
|
||||
}
|
||||
|
||||
if (disintegrationFactor > 0f)
|
||||
spriteBatch.ExitShaderRegion();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -457,14 +434,5 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
{
|
||||
NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment);
|
||||
}
|
||||
|
||||
public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo)
|
||||
{
|
||||
if (hurtInfo.Damage > 0)
|
||||
{
|
||||
target.AddBuff(ModContent.BuffType<GodSlayerInferno>(), 120, true);
|
||||
target.AddBuff(ModContent.BuffType<WhisperingDeath>(), 360, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 444 B After Width: | Height: | Size: 444 B |
|
Before Width: | Height: | Size: 429 B After Width: | Height: | Size: 429 B |
|
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 3.9 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 568 B After Width: | Height: | Size: 568 B |
@@ -1,148 +0,0 @@
|
||||
using CalamityMod.Events;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.GameContent;
|
||||
using Terraria.Graphics.Effects;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.NPCs.DevourerofGods
|
||||
{
|
||||
public class DoGSky : CustomSky
|
||||
{
|
||||
private bool isActive = false;
|
||||
private float intensity = 0f;
|
||||
private int DoGIndex = -1;
|
||||
|
||||
public override void Update(GameTime gameTime)
|
||||
{
|
||||
if (DoGIndex == -1)
|
||||
{
|
||||
UpdateDoGIndex();
|
||||
if (DoGIndex == -1 && Main.LocalPlayer.Calamity().monolithDevourerBShader <= 0 && Main.LocalPlayer.Calamity().monolithDevourerPShader <= 0)
|
||||
isActive = false;
|
||||
}
|
||||
|
||||
if (isActive && intensity < 1f)
|
||||
{
|
||||
intensity += 0.01f;
|
||||
}
|
||||
else if (!isActive && intensity > 0f)
|
||||
{
|
||||
intensity -= 0.01f;
|
||||
}
|
||||
}
|
||||
|
||||
private float GetIntensity()
|
||||
{
|
||||
if (UpdateDoGIndex())
|
||||
{
|
||||
float x = 0f;
|
||||
if (DoGIndex != -1)
|
||||
x = Vector2.Distance(Main.LocalPlayer.Center, Main.npc[DoGIndex].Center);
|
||||
|
||||
float intensityScalar = 0.5f;
|
||||
return (1f - Utils.SmoothStep(3000f, 6000f, x)) * intensityScalar;
|
||||
}
|
||||
return 0f;
|
||||
}
|
||||
|
||||
public override Color OnTileColor(Color inColor)
|
||||
{
|
||||
float intensity = GetIntensity();
|
||||
return new Color(Vector4.Lerp(new Vector4(0.5f, 0.8f, 1f, 1f), inColor.ToVector4(), 1f - intensity));
|
||||
}
|
||||
|
||||
private bool UpdateDoGIndex()
|
||||
{
|
||||
int DoGType = ModContent.NPCType<DevourerofGodsHead>();
|
||||
if (DoGIndex >= 0 && Main.npc[DoGIndex].active && Main.npc[DoGIndex].type == DoGType)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
DoGIndex = -1;
|
||||
foreach (NPC n in Main.ActiveNPCs)
|
||||
{
|
||||
if (n.type == DoGType)
|
||||
{
|
||||
DoGIndex = n.whoAmI;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return DoGIndex != -1;
|
||||
}
|
||||
|
||||
public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth)
|
||||
{
|
||||
if (maxDepth >= 0 && minDepth < 0)
|
||||
{
|
||||
if (DoGIndex != -1)
|
||||
{
|
||||
if (Main.npc[DoGIndex].active)
|
||||
{
|
||||
float intensity = GetIntensity();
|
||||
float lifeRatio = Main.npc[DoGIndex].life / (float)Main.npc[DoGIndex].lifeMax;
|
||||
double blackScreenLife_GateValue = (lifeRatio < 0.6f && Main.npc[DoGIndex].localAI[2] <= 2f) ? 0.15 : 0.75;
|
||||
|
||||
float timeToReachNextColor = DevourerofGodsHead.SkyColorTransitionTime;
|
||||
float phaseTimer = Main.npc[DoGIndex].Calamity().newAI[2];
|
||||
float colorChangeProgress = phaseTimer / timeToReachNextColor;
|
||||
if (colorChangeProgress > 1f)
|
||||
colorChangeProgress = 1f;
|
||||
|
||||
bool death = CalamityWorld.death || BossRushEvent.BossRushActive;
|
||||
Color regularSkyColor = (Main.npc[DoGIndex].ai[3] == 0f ? Color.Lerp(Color.Fuchsia, Color.Cyan, colorChangeProgress) : Color.Lerp(Color.Cyan, Color.Fuchsia, colorChangeProgress)) * intensity;
|
||||
if (Main.npc[DoGIndex].life < Main.npc[DoGIndex].lifeMax * blackScreenLife_GateValue || death || Main.npc[DoGIndex].localAI[3] > 0f)
|
||||
{
|
||||
float blackSkyTransitionProgress = death ? 1f : Main.npc[DoGIndex].localAI[3] / timeToReachNextColor;
|
||||
spriteBatch.Draw(TextureAssets.BlackTile.Value, new Rectangle(0, 0, Main.screenWidth * 2, Main.screenHeight * 2), Color.Lerp(regularSkyColor, Color.Black * (intensity + 0.5f), blackSkyTransitionProgress));
|
||||
}
|
||||
else
|
||||
spriteBatch.Draw(TextureAssets.BlackTile.Value, new Rectangle(0, 0, Main.screenWidth * 2, Main.screenHeight * 2), regularSkyColor);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Main.LocalPlayer.Calamity().monolithDevourerBShader > 0)
|
||||
{
|
||||
float intensity = MathHelper.Min(MathHelper.Lerp(0, 0.5f, (float)Main.LocalPlayer.Calamity().monolithDevourerBShader / 15), 0.45f);
|
||||
Color regularSkyColor = Color.Cyan;
|
||||
spriteBatch.Draw(TextureAssets.BlackTile.Value, new Rectangle(0, 0, Main.screenWidth * 2, Main.screenHeight * 2), regularSkyColor * intensity);
|
||||
}
|
||||
if (Main.LocalPlayer.Calamity().monolithDevourerPShader > 0)
|
||||
{
|
||||
float intensity = MathHelper.Min(MathHelper.Lerp(0, 0.5f, (float)Main.LocalPlayer.Calamity().monolithDevourerPShader / 15), 0.45f);
|
||||
Color regularSkyColor = Color.Fuchsia;
|
||||
spriteBatch.Draw(TextureAssets.BlackTile.Value, new Rectangle(0, 0, Main.screenWidth * 2, Main.screenHeight * 2), regularSkyColor * intensity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetCloudAlpha()
|
||||
{
|
||||
return 0f;
|
||||
}
|
||||
|
||||
public override void Activate(Vector2 position, params object[] args)
|
||||
{
|
||||
isActive = true;
|
||||
}
|
||||
|
||||
public override void Deactivate(params object[] args)
|
||||
{
|
||||
isActive = false;
|
||||
}
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
isActive = false;
|
||||
}
|
||||
|
||||
public override bool IsActive()
|
||||
{
|
||||
return isActive || intensity > 0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 4.7 KiB |
|
After Width: | Height: | Size: 31 KiB |
@@ -5,17 +5,19 @@ using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Particles
|
||||
{
|
||||
public class StatDownArrow : Particle
|
||||
public class StatChangeArrow : Particle
|
||||
{
|
||||
public override string Texture => "CalamityMod/Particles/StatDownArrow";
|
||||
public override string Texture => "CalamityMod/Particles/StatChangeArrow";
|
||||
public override bool UseAdditiveBlend => true;
|
||||
public override bool UseCustomDraw => true;
|
||||
public override bool SetLifetime => true;
|
||||
|
||||
public bool AffectedByGravity = false;
|
||||
|
||||
public Color StartColor;
|
||||
public Color EndColor;
|
||||
|
||||
public StatDownArrow(Vector2 position, Vector2 velocity, Color startColor, Color endColor, float scale, int lifetime)
|
||||
public StatChangeArrow(Vector2 position, Vector2 velocity, float rotation, Color startColor, Color endColor, float scale, int lifetime)
|
||||
{
|
||||
Position = position;
|
||||
Velocity = velocity;
|
||||
@@ -24,24 +26,27 @@ namespace CalamityMod.Particles
|
||||
EndColor = endColor;
|
||||
Scale = scale;
|
||||
Lifetime = lifetime;
|
||||
Rotation = 0;
|
||||
Rotation = rotation;
|
||||
}
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
Color = Color.Lerp(StartColor, EndColor, LifetimeCompletion);
|
||||
Lighting.AddLight(Position, Color.ToVector3() * 0.2f);
|
||||
if (Velocity.Length() < 12f && AffectedByGravity)
|
||||
{
|
||||
Velocity.X *= 0.94f;
|
||||
Velocity.Y += 0.25f;
|
||||
}
|
||||
}
|
||||
|
||||
public override void CustomDraw(SpriteBatch spriteBatch)
|
||||
{
|
||||
Texture2D texture = ModContent.Request<Texture2D>(Texture).Value;
|
||||
Vector2 DrawSize = new Vector2(Scale);
|
||||
Vector2 Origin = new Vector2(texture.Width, texture.Height);
|
||||
Vector2 Origin = new Vector2(texture.Width, texture.Height) /2f;
|
||||
|
||||
Vector2 PositionAdjust = new Vector2(-5, -11);
|
||||
|
||||
spriteBatch.Draw(texture, Position - Main.screenPosition - PositionAdjust, null, Color, Rotation, Origin, DrawSize, SpriteEffects.None, 0);
|
||||
spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color, Rotation, Origin, DrawSize, SpriteEffects.None, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 442 B |
|
Before Width: | Height: | Size: 236 B |
@@ -41,7 +41,7 @@ namespace CalamityMod.Projectiles.Boss
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.Opacity = 0f;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.timeLeft = 480;
|
||||
Projectile.timeLeft = 300;
|
||||
CooldownSlot = ImmunityCooldownID.Bosses;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,25 +1,37 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.DataStructures;
|
||||
using CalamityMod.Graphics.Primitives;
|
||||
using CalamityMod.Particles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.Graphics.Shaders;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
namespace CalamityMod.Projectiles.Boss
|
||||
{
|
||||
public class DoGFire : ModProjectile, ILocalizedModType
|
||||
public class DoGFire : ModProjectile, ILocalizedModType, IPixelatedPrimitiveRenderer
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Boss";
|
||||
public override void SetStaticDefaults()
|
||||
public bool IsAPassiveFireball
|
||||
{
|
||||
Main.projFrames[Type] = 6;
|
||||
ProjectileID.Sets.TrailCacheLength[Type] = 3;
|
||||
ProjectileID.Sets.TrailingMode[Type] = 0;
|
||||
get => Projectile.ai[0] == 2f;
|
||||
set => Projectile.ai[0] = value.ToInt();
|
||||
}
|
||||
|
||||
public new string LocalizationCategory => "Projectiles.Boss";
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
ProjectileID.Sets.TrailCacheLength[Type] = 14;
|
||||
ProjectileID.Sets.TrailingMode[Type] = 2;
|
||||
}
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.Calamity().DealsDefenseDamage = true;
|
||||
Projectile.width = 34;
|
||||
Projectile.height = 34;
|
||||
Projectile.hostile = true;
|
||||
@@ -27,129 +39,134 @@ namespace CalamityMod.Projectiles.Boss
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.extraUpdates = 1;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.timeLeft = 480;
|
||||
Projectile.timeLeft = 300;
|
||||
CooldownSlot = ImmunityCooldownID.Bosses;
|
||||
}
|
||||
|
||||
public override void OnSpawn(IEntitySource source)
|
||||
{
|
||||
if (IsAPassiveFireball)
|
||||
SoundEngine.PlaySound(SoundID.Item20, Projectile.Center);
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
if (Projectile.localAI[0] == 0f && Projectile.ai[1] == 0f)
|
||||
Projectile.rotation = Projectile.velocity.ToRotation();
|
||||
if (Main.rand.NextBool(12))
|
||||
{
|
||||
Projectile.localAI[0] = 1f;
|
||||
SoundEngine.PlaySound(SoundID.Item20, Projectile.Center);
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
Vector2 dustSpawnPosition = Projectile.Center + Main.rand.NextVector2Circular(6f, 6f);
|
||||
Vector2 dustVelocity = Projectile.velocity * -1.2f;
|
||||
float dustScale = Main.rand.NextFloat(0.6f, 0.8f);
|
||||
Color dustColor = Color.Lerp(Color.White, IsAPassiveFireball ? Color.SkyBlue : Color.Purple, Main.rand.NextFloat(0.5f, 1f));
|
||||
|
||||
Dust dust = Dust.NewDustDirect(dustSpawnPosition, 1, 1, DustID.TintableDustLighted, dustVelocity.X, dustVelocity.Y, 0, dustColor, dustScale);
|
||||
dust.noGravity = true;
|
||||
dust.noLight = false;
|
||||
dust.noLightEmittence = false;
|
||||
}
|
||||
}
|
||||
|
||||
Projectile.frameCounter++;
|
||||
if (Projectile.frameCounter > 4)
|
||||
if (Main.rand.NextBool(2))
|
||||
{
|
||||
Projectile.frame++;
|
||||
Projectile.frameCounter = 0;
|
||||
}
|
||||
if (Projectile.frame > 5)
|
||||
Projectile.frame = 0;
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
Vector2 smokeVelocity = -Projectile.velocity * 0.7f + Main.rand.NextVector2Circular(1f, 1f) * 0.65f;
|
||||
int smokeLifetime = Main.rand.Next(20, 30);
|
||||
float smokeScale = Main.rand.NextFloat(0.25f, 0.45f);
|
||||
float smokeOpacity = Main.rand.NextFloat(0.7f, 0.9f);
|
||||
Color flameColor = Color.Lerp(Color.White, IsAPassiveFireball ? Color.SkyBlue : Color.Purple, Main.rand.NextFloat(0.5f, 1f));
|
||||
|
||||
int dust = Dust.NewDust(new Vector2(Projectile.position.X + Projectile.velocity.X, Projectile.position.Y + Projectile.velocity.Y), Projectile.width, Projectile.height, DustID.ShadowbeamStaff, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 0.8f);
|
||||
Main.dust[dust].noGravity = true;
|
||||
|
||||
Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2;
|
||||
|
||||
if (Projectile.ai[1] > 0f)
|
||||
{
|
||||
if (Projectile.velocity.Length() < Projectile.ai[1])
|
||||
Projectile.velocity *= Projectile.ai[0];
|
||||
HeavySmokeParticle ghastlySmoke = new(Projectile.Center + Main.rand.NextVector2Circular(8f, 8f), smokeVelocity, flameColor, smokeLifetime, smokeScale, smokeOpacity, 0.02f, true);
|
||||
GeneralParticleHandler.SpawnParticle(ghastlySmoke);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1);
|
||||
return false;
|
||||
}
|
||||
|
||||
public override Color? GetAlpha(Color lightColor) => new Color(255, 255, 255, 0);
|
||||
|
||||
public override void OnHitPlayer(Player target, Player.HurtInfo info)
|
||||
{
|
||||
if (info.Damage <= 0)
|
||||
return;
|
||||
|
||||
target.AddBuff(ModContent.BuffType<GodSlayerInferno>(), 160);
|
||||
target.AddBuff(ModContent.BuffType<GodSlayerInferno>(), CalamityUtils.SecondsToFrames(5));
|
||||
}
|
||||
|
||||
public override void OnKill(int timeLeft)
|
||||
{
|
||||
SoundEngine.PlaySound(SoundID.Item74, Projectile.Center);
|
||||
Projectile.position = Projectile.Center;
|
||||
Projectile.width = Projectile.height = 64;
|
||||
Projectile.position.X = Projectile.position.X - Projectile.width / 2;
|
||||
Projectile.position.Y = Projectile.position.Y - Projectile.height / 2;
|
||||
for (int i = 0; i < 5; i++)
|
||||
// Spawn a burst of dust at the center.
|
||||
for (int i = 0; i < 12; i++)
|
||||
{
|
||||
int godSlay = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, 0f, 0f, 100, default, 2f);
|
||||
Main.dust[godSlay].velocity *= 3f;
|
||||
if (Main.rand.NextBool())
|
||||
{
|
||||
Main.dust[godSlay].scale = 0.5f;
|
||||
Main.dust[godSlay].fadeIn = 1f + Main.rand.Next(10) * 0.1f;
|
||||
}
|
||||
}
|
||||
for (int j = 0; j < 10; j++)
|
||||
{
|
||||
int godSlay2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, 0f, 0f, 100, default, 3f);
|
||||
Main.dust[godSlay2].noGravity = true;
|
||||
Main.dust[godSlay2].velocity *= 5f;
|
||||
godSlay2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, 0f, 0f, 100, default, 2f);
|
||||
Main.dust[godSlay2].velocity *= 2f;
|
||||
}
|
||||
for (int k = 0; k < 200; k++)
|
||||
{
|
||||
float dustScale = 12f;
|
||||
if (k < 150)
|
||||
dustScale = 9f;
|
||||
if (k < 100)
|
||||
dustScale = 6f;
|
||||
if (k < 50)
|
||||
dustScale = 3f;
|
||||
Vector2 dustVelocity = Main.rand.NextVector2Circular(1f, 1f) * 6f;
|
||||
float dustScale = Main.rand.NextFloat(3f, 5f);
|
||||
Color dustColor = Color.Lerp(Color.White, IsAPassiveFireball ? Color.SkyBlue : Color.Purple, Main.rand.NextFloat(0.5f, 1f));
|
||||
|
||||
int scalingDust = Dust.NewDust(Projectile.Center, 6, 6, DustID.ShadowbeamStaff, 0f, 0f, 100, default, 1f);
|
||||
float scalingDustVelX = Main.dust[scalingDust].velocity.X;
|
||||
float scalingDustVelY = Main.dust[scalingDust].velocity.Y;
|
||||
|
||||
if (scalingDustVelX == 0f && scalingDustVelY == 0f)
|
||||
scalingDustVelX = 1f;
|
||||
|
||||
float scalingDustVelocity = (float)Math.Sqrt(scalingDustVelX * scalingDustVelX + scalingDustVelY * scalingDustVelY);
|
||||
scalingDustVelocity = dustScale / scalingDustVelocity;
|
||||
scalingDustVelX *= scalingDustVelocity;
|
||||
scalingDustVelY *= scalingDustVelocity;
|
||||
|
||||
float scale = 1f;
|
||||
switch ((int)dustScale)
|
||||
{
|
||||
case 4:
|
||||
scale = 1.2f;
|
||||
break;
|
||||
case 8:
|
||||
scale = 1.1f;
|
||||
break;
|
||||
case 12:
|
||||
scale = 1f;
|
||||
break;
|
||||
case 16:
|
||||
scale = 0.9f;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
Dust dust = Main.dust[scalingDust];
|
||||
dust.velocity *= 0.5f;
|
||||
dust.velocity.X += scalingDustVelX;
|
||||
dust.velocity.Y += scalingDustVelY;
|
||||
dust.scale = scale;
|
||||
Dust dust = Dust.NewDustDirect(Projectile.Center, 1, 1, DustID.TintableDustLighted, dustVelocity.X, dustVelocity.Y, 0, dustColor, dustScale);
|
||||
dust.noGravity = true;
|
||||
dust.noLight = false;
|
||||
dust.noLightEmittence = false;
|
||||
}
|
||||
Projectile.Damage();
|
||||
}
|
||||
|
||||
public override bool PreDraw(ref Color lightColor) => false;
|
||||
|
||||
public float FireWidthFunction(float completion)
|
||||
{
|
||||
float width;
|
||||
float maxBodyWidth = 72f * Projectile.scale;
|
||||
float curveRatio = 0.2f;
|
||||
|
||||
// Crop the tip of the trail into a conic shape.
|
||||
if (completion < curveRatio)
|
||||
width = MathF.Sin(completion / curveRatio * MathHelper.PiOver2) * maxBodyWidth + curveRatio;
|
||||
else
|
||||
width = Utils.Remap(completion, curveRatio, 1f, maxBodyWidth, 0f);
|
||||
|
||||
// Pulse inwards and outwards over time.
|
||||
float pulseInterpolant = MathF.Cos(MathHelper.Pi * completion - Main.GlobalTimeWrappedHourly * 20f) * 0.5f + 0.5f;
|
||||
float additionalPulseWidth = MathHelper.Lerp(0f, 12f, pulseInterpolant);
|
||||
return width + additionalPulseWidth;
|
||||
}
|
||||
|
||||
public Color FireColorFunction(float completion)
|
||||
{
|
||||
Color mainColor = IsAPassiveFireball ? Color.Cyan : Color.Purple * 1.3f;
|
||||
Color endColor = Color.Lerp(mainColor, Color.Transparent, Utils.GetLerpValue(0.8f, 1f, completion, true));
|
||||
return Color.Lerp(mainColor, endColor, completion);
|
||||
}
|
||||
|
||||
public float FireCoreWidthFunction(float completion)
|
||||
{
|
||||
float width;
|
||||
float maxBodyWidth = Projectile.scale * (IsAPassiveFireball ? 24f : 32f);
|
||||
float curveRatio = 0.25f;
|
||||
|
||||
if (completion < curveRatio)
|
||||
width = MathF.Sin(completion / curveRatio * MathHelper.PiOver2) * maxBodyWidth + curveRatio;
|
||||
else
|
||||
width = Utils.Remap(completion, curveRatio, 1f, maxBodyWidth, 0f);
|
||||
return width;
|
||||
}
|
||||
|
||||
public Color FireCoreColorFunction(float completion)
|
||||
{
|
||||
Color mainColor = IsAPassiveFireball ? Color.SkyBlue : Color.Fuchsia;
|
||||
Color tipColor = Color.Lerp(mainColor, Color.Transparent, Utils.GetLerpValue(0.8f, 1f, completion, true));
|
||||
Color fullBodyColor = Color.Lerp(mainColor, tipColor, completion);
|
||||
return Color.Lerp(fullBodyColor, Color.White, 0.175f);
|
||||
}
|
||||
|
||||
public void RenderPixelatedPrimitives(SpriteBatch spriteBatch, PixelationPrimitiveLayer layer)
|
||||
{
|
||||
// Render the main trail for the body for the flame.
|
||||
GameShaders.Misc["CalamityMod:ImpFlameTrail"].SetShaderTexture(ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/Trails/ScarletDevilStreak"));
|
||||
PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(FireWidthFunction, FireColorFunction, (_) => Projectile.Size * 0.5f + Projectile.velocity.SafeNormalize(Vector2.Zero)*24f, true, true, GameShaders.Misc["CalamityMod:ImpFlameTrail"]), Projectile.oldPos.Length + 32);
|
||||
|
||||
// Render a smaller, pure white trail in the same position to represent the glowing core of the flame.
|
||||
Vector2[] fireCoreLength = Projectile.oldPos.Take(8).ToArray();
|
||||
GameShaders.Misc["CalamityMod:ImpFlameTrail"].SetShaderTexture(ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/Trails/SylvestaffStreak"));
|
||||
PrimitiveRenderer.RenderTrail(fireCoreLength, new(FireCoreWidthFunction, FireCoreColorFunction, (_) => Projectile.Size * 0.5f + Projectile.velocity.SafeNormalize(Vector2.Zero) * 24f, true, true, GameShaders.Misc["CalamityMod:ImpFlameTrail"]), fireCoreLength.Length + 24);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 918 B |
@@ -0,0 +1,204 @@
|
||||
using System;
|
||||
using System.Net;
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.Items.Weapons.Rogue;
|
||||
using CalamityMod.Particles;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using static System.Runtime.InteropServices.JavaScript.JSType;
|
||||
|
||||
namespace CalamityMod.Projectiles.Boss
|
||||
{
|
||||
public class DoGLaserWalls : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
public new string LocalizationCategory => "Projectiles.Boss";
|
||||
public float time = 0;
|
||||
public ref float attackSpeed => ref Projectile.ai[0]; // How fast the attack goes, higher is faster
|
||||
public ref float laserDist => ref Projectile.ai[1]; // The spacing between lasers
|
||||
public ref float laserType => ref Projectile.ai[2]; // The style of laser wall, ranging from 0 - 5 (6 for GFB circular variant)
|
||||
public bool canDamage => doneAttack && laserFX >= 1f;
|
||||
public bool doneAttack = false;
|
||||
public int attackTime = 30;
|
||||
public int laserCount => (int)(6000 / Math.Max(laserDist, 1));
|
||||
public float laserLength => laserDist * laserCount / 2;
|
||||
public float laserFX = 0;
|
||||
public float storedTime = 0;
|
||||
public Color drawColor = Color.Cyan;
|
||||
public float sine = 0;
|
||||
public Vector2 storedTargetPos;
|
||||
public Player targeted;
|
||||
public Vector2 targetPos => (targeted == null ? Projectile.Center : targeted.Center);
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
ProjectileID.Sets.DrawScreenCheckFluff[Type] = 10000;
|
||||
}
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 1;
|
||||
Projectile.height = 1;
|
||||
Projectile.hostile = true;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.timeLeft = 6000;
|
||||
}
|
||||
public override void AI()
|
||||
{
|
||||
if (laserFX > 0)
|
||||
laserFX = MathHelper.Lerp(laserFX, 0, time > 15 ? 0.12f : 0.01f);
|
||||
sine = (float)Math.Sin(time * 4f / MathHelper.Pi);
|
||||
|
||||
if (time == 0)
|
||||
{
|
||||
targeted = Main.player[Player.FindClosest(Projectile.Center, 1, 1)];
|
||||
// Some default values for if the projectile spawns without them set
|
||||
if (attackSpeed == 0)
|
||||
attackSpeed = 0.5f;
|
||||
if (laserDist == 0)
|
||||
laserDist = 250;
|
||||
Projectile.velocity = Vector2.Zero;
|
||||
laserFX = 1f;
|
||||
|
||||
SoundStyle appear = new("CalamityMod/Sounds/Custom/DoGLaserWallSpawn");
|
||||
SoundEngine.PlaySound(appear with { Volume = 1f, Pitch = 0f, MaxInstances = -1 }, targetPos);
|
||||
storedTargetPos = targetPos;
|
||||
Projectile.ForceNetUpdate();
|
||||
}
|
||||
if (time >= attackTime && !doneAttack)
|
||||
{
|
||||
SoundStyle attack = new("CalamityMod/Sounds/Custom/DoGLaserWallLightAttack");
|
||||
for (int i = 0; i < 2; i++)
|
||||
SoundEngine.PlaySound(attack with { Volume = 0.9f, Pitch = 0, MaxInstances = -1 }, targetPos);
|
||||
laserFX = 3;
|
||||
doneAttack = true;
|
||||
storedTime = time;
|
||||
Projectile.ForceNetUpdate();
|
||||
}
|
||||
float endTime = storedTime + 10;
|
||||
if (time >= endTime && doneAttack)
|
||||
{
|
||||
Projectile.Kill();
|
||||
return;
|
||||
}
|
||||
else if (doneAttack)
|
||||
{
|
||||
drawColor = Color.Lerp(Color.Cyan, Color.Magenta, (float)Math.Pow(Utils.GetLerpValue(endTime, storedTime, time, true), 2));
|
||||
}
|
||||
time += attackSpeed;
|
||||
}
|
||||
public override bool CanHitPlayer(Player target)
|
||||
{
|
||||
if (canDamage)
|
||||
{
|
||||
if (laserType == 6)
|
||||
{
|
||||
float distance = Vector2.Distance(Projectile.Center, target.Center);
|
||||
float expand = MathF.Min(target.width, target.height);
|
||||
if (distance < laserDist * 1.5f || distance > laserDist * 10f + 40f)
|
||||
return false;
|
||||
|
||||
if (distance % laserDist > (laserDist - Utils.Remap(distance, 240f, 1440f, 8f, 56f) - expand) || distance % laserDist < expand)
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public override void OnHitPlayer(Player target, Player.HurtInfo info)
|
||||
{
|
||||
target.AddBuff(ModContent.BuffType<GodSlayerInferno>(), 60);
|
||||
base.OnHitPlayer(target, info);
|
||||
}
|
||||
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
|
||||
{
|
||||
if (!canDamage)
|
||||
return false;
|
||||
else if (laserType == 6) // Custom hit check through CanHitPlayer
|
||||
return true;
|
||||
else
|
||||
{
|
||||
float _ = float.NaN;
|
||||
bool hit = false;
|
||||
Vector2 X = Vector2.UnitX.RotatedBy((laserType == 1 || laserType == 3 || laserType == 5) ? MathHelper.PiOver4 : 0);
|
||||
Vector2 Y = Vector2.UnitY.RotatedBy((laserType == 1 || laserType == 3 || laserType == 5) ? MathHelper.PiOver4 : 0);
|
||||
for (int l = 0; l < 2; l++)
|
||||
{
|
||||
bool horizontal = (l != 0);
|
||||
bool crossLasers = ((laserType == 2 && !horizontal) || (laserType == 3 && !horizontal) || (laserType == 4 && horizontal) || (laserType == 5 && horizontal));
|
||||
float length = laserLength * (horizontal ? 1f : 1f);
|
||||
for (int i = 0; i < laserCount; i += (crossLasers ? 2 : 1))
|
||||
{
|
||||
Vector2 startPoint = Projectile.Center - (horizontal ? Y : X) * (length);
|
||||
Vector2 laserPoint = startPoint + (horizontal ? X : Y) * (laserDist * i) - (horizontal ? X : Y) * (laserDist * laserCount / 2);
|
||||
Vector2 rot = laserPoint.DirectionTo(storedTargetPos);
|
||||
|
||||
Vector2 start = laserPoint;
|
||||
Vector2 end = laserPoint + (crossLasers ? rot : (horizontal ? Y : X)) * laserLength * 2;
|
||||
|
||||
bool hitCheck = Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), start, end, 10, ref _);
|
||||
if (hitCheck)
|
||||
{
|
||||
hit = true;
|
||||
i = laserCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
return hit;
|
||||
}
|
||||
}
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
if (laserFX == 0)
|
||||
return false;
|
||||
Texture2D beam = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomLineThick").Value;
|
||||
Texture2D bBeam = ModContent.Request<Texture2D>("CalamityMod/Particles/LineThick").Value;
|
||||
Texture2D bloom = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomCircle").Value;
|
||||
float opacity = (doneAttack ? 0.65f : 0.3f) * (float)Math.Pow(Math.Min(laserFX, 1), 2);
|
||||
if (CalamityClientConfig.Instance.Photosensitivity)
|
||||
opacity = 0.2f;
|
||||
|
||||
Color beamColor = drawColor with { A = 0 };
|
||||
if (laserType == 6)
|
||||
{
|
||||
Texture2D ring = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomRingThinLarge").Value;
|
||||
for (float scale = 0.25f * laserDist / 120f; scale < 1.25f; scale += 0.125f * laserDist / 120f)
|
||||
Main.EntitySpriteDraw(ring, Projectile.Center - Main.screenPosition, null, beamColor * opacity, 0f, ring.Size() * 0.5f, scale, SpriteEffects.None);
|
||||
return false;
|
||||
}
|
||||
|
||||
Vector2 X = Vector2.UnitX.RotatedBy((laserType == 1 || laserType == 3 || laserType == 5) ? MathHelper.PiOver4 : 0);
|
||||
Vector2 Y = Vector2.UnitY.RotatedBy((laserType == 1 || laserType == 3 || laserType == 5) ? MathHelper.PiOver4 : 0);
|
||||
for (int l = 0; l < 2; l++)
|
||||
{
|
||||
bool horizontal = (l != 0);
|
||||
float length = laserLength;
|
||||
bool crossLasers = ((laserType == 2 && !horizontal) || (laserType == 3 && !horizontal) || (laserType == 4 && horizontal) || (laserType == 5 && horizontal));
|
||||
for (int i = 0; i < laserCount; i += (crossLasers ? 2 : 1))
|
||||
{
|
||||
Vector2 startPoint = Projectile.Center - (horizontal ? Y : X) * (length);
|
||||
Vector2 laserPoint = startPoint + (horizontal ? X : Y) * (laserDist * i) - (horizontal ? X : Y) * (laserDist * laserCount / 2);
|
||||
|
||||
for (int t = 0; t < (!doneAttack ? 1 : 5); t++)
|
||||
{
|
||||
bool black = (t > 0);
|
||||
Texture2D usedTex = (black ? bBeam : beam);
|
||||
|
||||
float beamThickness = 0.03f * (black ? (0.8f - 0.15f * t) : 1f) * (laserFX <= 1 ? (float)Math.Pow(Math.Min(laserFX, 1), 2) : laserFX) * Utils.Remap(sine, -1, 1, 0.8f, 1.1f);
|
||||
float rot = (horizontal ? MathHelper.Pi : MathHelper.PiOver2) + ((laserType == 1 || laserType == 3 || laserType == 5) ? MathHelper.PiOver4 : 0);
|
||||
if (crossLasers)
|
||||
rot = laserPoint.DirectionTo(storedTargetPos).ToRotation() + (MathHelper.PiOver2);
|
||||
Main.EntitySpriteDraw(usedTex, laserPoint - Main.screenPosition, null, (black ? Color.Black * opacity : beamColor * opacity) * (black ? (0.2f + 0.15f * t) : 1), rot, new Vector2(beam.Width / 2, beam.Height), new Vector2(beamThickness, length / 975) * Projectile.scale, SpriteEffects.None);
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,146 @@
|
||||
using System;
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.Projectiles.Rogue;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Boss
|
||||
{
|
||||
public class DoGLaserWallsBigBeam : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
public new string LocalizationCategory => "Projectiles.Boss";
|
||||
public float time = 0;
|
||||
public ref float attackSpeed => ref Projectile.ai[0];
|
||||
public ref float laserType => ref Projectile.ai[2];
|
||||
public bool canDamage => doneAttack && laserFX >= 1f;
|
||||
public bool doneAttack = false;
|
||||
public int attackTime = 30;
|
||||
public float laserLength => 3000;
|
||||
public float laserFX = 0;
|
||||
public float storedTime = 0;
|
||||
public Color drawColor = Color.Magenta;
|
||||
public float sine = 0;
|
||||
public float laserRot = 0;
|
||||
Vector2 beamStart = Vector2.Zero;
|
||||
Vector2 directionToTarget = Vector2.Zero;
|
||||
public Player targeted;
|
||||
public Vector2 targetPos => (targeted == null ? Projectile.Center : targeted.Center);
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
ProjectileID.Sets.DrawScreenCheckFluff[Type] = 10000;
|
||||
}
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 1;
|
||||
Projectile.height = 1;
|
||||
Projectile.hostile = true;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.timeLeft = 6000;
|
||||
Projectile.scale = 2;
|
||||
}
|
||||
public override void AI()
|
||||
{
|
||||
if (laserFX > 0)
|
||||
laserFX = MathHelper.Lerp(laserFX, 0, time > 15 ? 0.07f : 0.01f);
|
||||
sine = (float)Math.Sin(time * 4f / MathHelper.Pi);
|
||||
if (time == 0)
|
||||
{
|
||||
targeted = Main.player[Player.FindClosest(Projectile.Center, 1, 1)];
|
||||
if (CalamityWorld.LegendaryMode)
|
||||
Projectile.scale = 6;
|
||||
laserRot = Main.rand.NextFloat(-0.4f, 0.4f);
|
||||
|
||||
beamStart = targetPos + ((laserType == 0 || laserType == 4 || laserType == 5) ? Vector2.UnitX : Vector2.UnitY).RotatedBy(laserRot) * laserLength;
|
||||
directionToTarget = beamStart.DirectionTo(targetPos);
|
||||
|
||||
Projectile.Center += Main.rand.NextVector2CircularEdge(400, 400);
|
||||
// Some default values for if the projectile spawns without them set
|
||||
if (attackSpeed == 0)
|
||||
attackSpeed = 0.5f;
|
||||
Projectile.velocity = Vector2.Zero;
|
||||
laserFX = 1f;
|
||||
Projectile.ForceNetUpdate();
|
||||
}
|
||||
if (time >= attackTime && !doneAttack)
|
||||
{
|
||||
if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < 7f)
|
||||
Main.LocalPlayer.Calamity().GeneralScreenShakePower = 7f;
|
||||
SoundStyle attack = new("CalamityMod/Sounds/Custom/DoGLaserWallBigAttack2");
|
||||
for (int i = 0; i < 2; i++)
|
||||
SoundEngine.PlaySound(attack with { Volume = 0.8f, Pitch = 0, MaxInstances = -1 }, targetPos);
|
||||
laserFX = 2.5f;
|
||||
doneAttack = true;
|
||||
storedTime = time;
|
||||
Projectile.ForceNetUpdate();
|
||||
}
|
||||
float endTime = storedTime + 10;
|
||||
if (time >= endTime && doneAttack)
|
||||
{
|
||||
Projectile.Kill();
|
||||
return;
|
||||
}
|
||||
else if (doneAttack)
|
||||
{
|
||||
drawColor = Color.Lerp(Color.Magenta, Color.Cyan, (float)Math.Pow(Utils.GetLerpValue(endTime, storedTime, time, true), 2));
|
||||
}
|
||||
time += attackSpeed;
|
||||
}
|
||||
public override bool CanHitPlayer(Player target)
|
||||
{
|
||||
if (canDamage)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
public override void OnHitPlayer(Player target, Player.HurtInfo info)
|
||||
{
|
||||
target.AddBuff(ModContent.BuffType<GodSlayerInferno>(), 60);
|
||||
base.OnHitPlayer(target, info);
|
||||
}
|
||||
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
|
||||
{
|
||||
if (!canDamage)
|
||||
return false;
|
||||
else
|
||||
{
|
||||
float _ = float.NaN;
|
||||
Vector2 start = beamStart;
|
||||
Vector2 end = beamStart + directionToTarget * laserLength * 2;
|
||||
bool hitCheck = Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), start, end, 30 * Projectile.scale, ref _);
|
||||
|
||||
return hitCheck;
|
||||
}
|
||||
}
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
if (laserFX == 0)
|
||||
return false;
|
||||
Texture2D beam = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomLineThick").Value;
|
||||
Texture2D bBeam = ModContent.Request<Texture2D>("CalamityMod/Particles/LineThick").Value;
|
||||
Texture2D bloom = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomCircle").Value;
|
||||
float opacity = (doneAttack ? 0.65f : 0.35f) * (float)Math.Pow(Math.Min(laserFX, 1), 2);
|
||||
Color beamColor = drawColor with { A = 0 };
|
||||
|
||||
if (CalamityClientConfig.Instance.Photosensitivity)
|
||||
opacity = 0.2f;
|
||||
for (int t = 0; t < (!doneAttack ? 1 : 4 * Projectile.scale); t ++)
|
||||
{
|
||||
bool black = (t > 0 + (Projectile.scale - 1));
|
||||
if (black)
|
||||
beam = bBeam;
|
||||
|
||||
float beamThickness = 0.09f * (black ? (0.8f - 0.15f * t / Projectile.scale) : 1f) * (laserFX <= 1 ? (float)Math.Pow(Math.Min(laserFX, 1), 2) : laserFX) * Utils.Remap(sine, -1, 1, 0.8f, 1.1f);
|
||||
Main.EntitySpriteDraw(beam, beamStart - Main.screenPosition, null, (black ? Color.Black * opacity : beamColor * (1 - t * 0.3f) * opacity) * (black ? (0.2f + 0.15f * t / Projectile.scale) : 1), directionToTarget.ToRotation() + MathHelper.PiOver2, new Vector2(beam.Width / 2, beam.Height), new Vector2(beamThickness, laserLength / 975) * Projectile.scale, SpriteEffects.None);
|
||||
}
|
||||
//Main.EntitySpriteDraw(bloom, Projectile.Center - Main.screenPosition, null, Color.Red with { A = 0 }, 0, bloom.Size() / 2, 0.3f, SpriteEffects.None);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
using System.Collections.Generic;
|
||||
using CalamityMod.Graphics.Primitives;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Boss
|
||||
{
|
||||
public class DoGRiftCrack : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public Vector2[] CrackPoints;
|
||||
|
||||
public ref float Timer => ref Projectile.ai[0];
|
||||
|
||||
public ref float MaxWidth => ref Projectile.ai[1];
|
||||
|
||||
public new string LocalizationCategory => "Projectiles.Boss";
|
||||
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = Projectile.height = 30;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.timeLeft = 30;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
float minDistanceBetweenPoints = 25f;
|
||||
float maxDistanceBetweenPoints = 50f;
|
||||
if (CrackPoints is null)
|
||||
{
|
||||
CrackPoints = new Vector2[25];
|
||||
|
||||
Vector2 startingPosition = Projectile.Center;
|
||||
for (int i = 0; i < CrackPoints.Length; i++)
|
||||
{
|
||||
// First point should always be the starting position.
|
||||
if (i == 0)
|
||||
{
|
||||
CrackPoints[i] = startingPosition;
|
||||
}
|
||||
// Next point pivots away from the starting position in the direction of the velocity.
|
||||
else if (i == 1)
|
||||
{
|
||||
Vector2 nextPointPosition = startingPosition + Projectile.velocity * Main.rand.NextFloat(0.8f, 1.2f) + Main.rand.NextVector2Circular(30f, 30f);
|
||||
CrackPoints[i] = nextPointPosition;
|
||||
}
|
||||
// All other points follow after the last one with the same slight offset to resemble cracks.
|
||||
else
|
||||
{
|
||||
Vector2 previousPoint = CrackPoints[i - 2];
|
||||
float distanceFromLastPoint = Main.rand.NextFloat(minDistanceBetweenPoints, maxDistanceBetweenPoints);
|
||||
if (i == CrackPoints.Length - 1)
|
||||
distanceFromLastPoint = Main.rand.NextFloat(minDistanceBetweenPoints, maxDistanceBetweenPoints) * 0.5f;
|
||||
|
||||
Vector2 newPoint = CrackPoints[i - 1] + (previousPoint.DirectionTo(CrackPoints[i - 1]) * distanceFromLastPoint).RotatedBy(MathHelper.ToRadians(Main.rand.NextFloat(-5f, 5f) * i * 0.25f));
|
||||
CrackPoints[i] = newPoint;
|
||||
}
|
||||
|
||||
if (Main.rand.NextBool(9))
|
||||
CrackPoints[i] += Main.rand.NextVector2Circular(10f, 10f);
|
||||
}
|
||||
}
|
||||
|
||||
Projectile.scale = MathHelper.Lerp(1f, 0f, Timer / 30f);
|
||||
Timer++;
|
||||
}
|
||||
|
||||
public float CrackWidthFunction(float completion) => Projectile.scale * MathHelper.Lerp(MaxWidth, 0f, completion);
|
||||
|
||||
public Color CrackColorFunction(float completion) => Projectile.GetAlpha(Color.White);
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
if (CrackPoints is not null)
|
||||
{
|
||||
PrimitiveRenderer.RenderTrail(CrackPoints, new(CrackWidthFunction, CrackColorFunction, null, false));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,14 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using CalamityMod.Dusts;
|
||||
using CalamityMod.Effects;
|
||||
using CalamityMod.Graphics.Metaballs;
|
||||
using CalamityMod.Particles;
|
||||
using CalamityMod.Skies;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
@@ -10,124 +16,273 @@ namespace CalamityMod.Projectiles.Boss
|
||||
{
|
||||
public class DoGTeleportRift : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public static readonly SoundStyle CrackSound = new("CalamityMod/Sounds/NPCHit/CryogenHit", 3);
|
||||
|
||||
public static readonly SoundStyle BreakSound = new("CalamityMod/Sounds/NPCHit/CryogenPhaseTransitionCrack");
|
||||
|
||||
// GFB exclusive; DoG can spawn fake rifts on that seed to confuse the player.
|
||||
public bool FakeRift;
|
||||
|
||||
public int RiftLifetime;
|
||||
|
||||
public NPC DoGHead => Main.npc[(int)Projectile.ai[0]];
|
||||
|
||||
public ref float Timer => ref Projectile.ai[1];
|
||||
|
||||
public ref float CrackScale => ref Projectile.ai[2];
|
||||
|
||||
public ref float AIState => ref Projectile.localAI[0];
|
||||
|
||||
public ref float CrackExposure => ref Projectile.localAI[1];
|
||||
|
||||
public ref float MaxExposure => ref Projectile.localAI[2];
|
||||
|
||||
public new string LocalizationCategory => "Projectiles.Boss";
|
||||
public override string Texture => "CalamityMod/Projectiles/StarProj";
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = Projectile.height = 30;
|
||||
Projectile.scale = 2.5f;
|
||||
Projectile.hostile = true;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.Opacity = 0f;
|
||||
Projectile.scale = 0f;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.timeLeft = 200;
|
||||
Projectile.timeLeft = RiftLifetime;
|
||||
}
|
||||
|
||||
public override bool? CanDamage() => false;
|
||||
|
||||
public override bool ShouldUpdatePosition() => false;
|
||||
|
||||
public override void SendExtraAI(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(FakeRift);
|
||||
writer.Write(RiftLifetime);
|
||||
for (int i = 0; i < Projectile.localAI.Length; i++)
|
||||
writer.Write(Projectile.localAI[i]);
|
||||
}
|
||||
|
||||
public override void ReceiveExtraAI(BinaryReader reader)
|
||||
{
|
||||
FakeRift = reader.ReadBoolean();
|
||||
RiftLifetime = reader.ReadInt32();
|
||||
for (int i = 0; i < Projectile.localAI.Length; i++)
|
||||
Projectile.localAI[i] = reader.ReadSingle();
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
if (Projectile.ai[0] == -1f)
|
||||
return;
|
||||
|
||||
if (Projectile.timeLeft < 160)
|
||||
Projectile.timeLeft = 160;
|
||||
|
||||
if (!Main.npc[(int)Projectile.ai[0]].active)
|
||||
Projectile.Kill();
|
||||
|
||||
Projectile.ai[1] += MathHelper.Pi / 30f;
|
||||
Projectile.Opacity = MathHelper.Clamp(Projectile.ai[1], 0f, 1f);
|
||||
|
||||
if (Projectile.Opacity == 1f && Main.rand.NextBool(15))
|
||||
if (DoGHead is null || !DoGHead.active)
|
||||
{
|
||||
Dust dust = Main.dust[Dust.NewDust(Projectile.Top, 0, 0, DustID.RainbowMk2, 0f, 0f, 100, new Color(150, 100, 255, 255), 1f)];
|
||||
dust.velocity.X = 0f;
|
||||
dust.noGravity = true;
|
||||
dust.fadeIn = 1f;
|
||||
dust.position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi) * (4f * Main.rand.NextFloat() + 26f);
|
||||
dust.scale = 0.5f;
|
||||
Projectile.Kill();
|
||||
return;
|
||||
}
|
||||
|
||||
// Pre-explosion, charge-up.
|
||||
if (AIState == 0f)
|
||||
{
|
||||
int riftCrackInterval = (int)(RiftLifetime / 3f);
|
||||
if (Timer % riftCrackInterval == 0f)
|
||||
{
|
||||
// Increase the intensity of certain effects as the crack gets bigger.
|
||||
float effectsLifetimeInterpolant = MathHelper.Lerp(1f, 2f, Timer / RiftLifetime);
|
||||
|
||||
// Only let the real rift on GFB perform these additional effects.
|
||||
if (!FakeRift)
|
||||
{
|
||||
float crackPitch = MathHelper.Lerp(-0.75f, 0f, Timer / RiftLifetime);
|
||||
SoundEngine.PlaySound(CrackSound with { Pitch = crackPitch }, Projectile.Center);
|
||||
|
||||
for (int i = 0; i < 12; i++)
|
||||
{
|
||||
Vector2 sparkVelocity = Vector2.UnitX.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(8f, 12f) * effectsLifetimeInterpolant * 0.7f;
|
||||
float sparkScale = Main.rand.NextFloat(1.2f, 1.6f) * effectsLifetimeInterpolant * 0.62f;
|
||||
Color sparkColor = Color.Lerp(Utils.SelectRandom(Main.rand, Color.Fuchsia, DoGSky.DoGLightBlue, DoGSky.DoGTwlight), Color.White, 0.65f);
|
||||
SparkParticle crackSpark = new(Projectile.Center, sparkVelocity, false, Main.rand.Next(30, 45), sparkScale, sparkColor);
|
||||
GeneralParticleHandler.SpawnParticle(crackSpark);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
Vector2 lightVelocity = Vector2.UnitX.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(12f, 14f) * effectsLifetimeInterpolant * 0.5f;
|
||||
float lightScale = Main.rand.NextFloat(1.2f, 1.6f) * effectsLifetimeInterpolant * 0.62f;
|
||||
Color lightColor = Color.Lerp(Utils.SelectRandom(Main.rand, Color.Fuchsia, DoGSky.DoGLightBlue, DoGSky.DoGTwlight), Color.White, 0.65f);
|
||||
SquishyLightParticle crackLight = new(Projectile.Center, lightVelocity, lightScale, lightColor, Main.rand.Next(30, 45));
|
||||
GeneralParticleHandler.SpawnParticle(crackLight);
|
||||
}
|
||||
|
||||
CalamityUtils.AddScreenshakeAt(Projectile.Center, 6f * effectsLifetimeInterpolant * 0.8f);
|
||||
}
|
||||
|
||||
float brightnessMultiplier = FakeRift ? 0.75f : 1f;
|
||||
CustomPulse shineExplosion2 = new(Projectile.Center, Vector2.Zero, Color.White * brightnessMultiplier, "CalamityMod/Particles/ShineExplosion2", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0f, 0.5f * effectsLifetimeInterpolant, 45);
|
||||
GeneralParticleHandler.SpawnParticle(shineExplosion2);
|
||||
|
||||
// Increase the scale and exposure of the actual crack at each interval.
|
||||
CrackScale += 0.525f * effectsLifetimeInterpolant * 0.75f;
|
||||
MaxExposure = MathHelper.Clamp(MaxExposure + 0.25f * effectsLifetimeInterpolant, 0f, 0.95f);
|
||||
}
|
||||
|
||||
// Perform the explosion right at the point where DoG emerges.
|
||||
if (Timer >= RiftLifetime)
|
||||
SwitchAIStates();
|
||||
|
||||
if (Projectile.timeLeft < 45)
|
||||
Projectile.timeLeft = 45;
|
||||
|
||||
CrackExposure = MathHelper.Lerp(CrackExposure, MaxExposure, 0.075f);
|
||||
Projectile.Opacity = MathHelper.Clamp(Projectile.Opacity + 0.05f, 0f, 1f);
|
||||
Projectile.scale = MathHelper.Clamp(Projectile.scale + 0.02f, 0f, 1f);
|
||||
}
|
||||
|
||||
// Post-explosion, slowly fade out.
|
||||
if (AIState == 1f)
|
||||
{
|
||||
Projectile.Opacity = MathHelper.Lerp(1f, 0f, Timer / 45f);
|
||||
CrackExposure = MathHelper.Lerp(MaxExposure, 0f, Timer / 45f);
|
||||
}
|
||||
|
||||
Timer++;
|
||||
}
|
||||
|
||||
public void SwitchAIStates()
|
||||
{
|
||||
AIState = 1f;
|
||||
Timer = 0f;
|
||||
CrackScale += 3f;
|
||||
Projectile.timeLeft = 30;
|
||||
SpawnExplosionVisuals();
|
||||
Projectile.netUpdate = true;
|
||||
}
|
||||
|
||||
public void SpawnExplosionVisuals()
|
||||
{
|
||||
float brightnessMultiplier = CalamityClientConfig.Instance.Photosensitivity ? 0.6f : 1f;
|
||||
if (!FakeRift)
|
||||
{
|
||||
// Spawn the rift cracks.
|
||||
for (int i = 0; i < 25; i++)
|
||||
{
|
||||
Vector2 crackOffset = Vector2.UnitX.RotatedBy(i * MathHelper.TwoPi / 25) * Main.rand.NextFloat(20f, 80f);
|
||||
Vector2 crackDestination = Projectile.Center + crackOffset;
|
||||
Vector2 crackLength = crackDestination - Projectile.Center;
|
||||
float riftWidth = Main.rand.NextFloat(20f, 30f);
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromAI(), Projectile.Center, crackLength, ModContent.ProjectileType<DoGRiftCrack>(), 0, 0f, ai1: riftWidth);
|
||||
}
|
||||
|
||||
// Spawn a bunch of square-shaped metaballs at the impact zone as well.
|
||||
for (int i = 0; i < 35; i++)
|
||||
DoGDistortionMetaball.SpawnParticle(Projectile.Center + Main.rand.NextVector2Circular(25f, 25f), Vector2.Zero, 500f, true, Main.rand.NextFloat(MathHelper.TwoPi));
|
||||
|
||||
// More metaballs flying away from the impact zone for extra flavor.
|
||||
int metaballAmount = Main.rand.Next(15, 21);
|
||||
for (int i = 0; i < metaballAmount; i++)
|
||||
DoGDistortionMetaball.SpawnParticle(Projectile.Center, Main.rand.NextVector2Unit() * Main.rand.NextFloat(25f, 35f), Main.rand.NextFloat(30f, 50f));
|
||||
|
||||
// Addtional particles and effects.
|
||||
for (int i = 0; i < 25; i++)
|
||||
{
|
||||
Vector2 sparkVelocity = Vector2.UnitX.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(12f, 16f);
|
||||
float sparkScale = Main.rand.NextFloat(1.8f, 2f);
|
||||
Color sparkColor = Color.Lerp(Utils.SelectRandom(Main.rand, Color.Fuchsia, DoGSky.DoGLightBlue, DoGSky.DoGTwlight), Color.White, 0.65f);
|
||||
SparkParticle crackSpark = new(Projectile.Center, sparkVelocity, false, Main.rand.Next(30, 45), sparkScale, sparkColor);
|
||||
GeneralParticleHandler.SpawnParticle(crackSpark);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 20; i++)
|
||||
{
|
||||
Vector2 lightVelocity = Vector2.UnitX.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(16f, 20f);
|
||||
float lightScale = Main.rand.NextFloat(1.8f, 2f);
|
||||
Color lightColor = Color.Lerp(Utils.SelectRandom(Main.rand, Color.Fuchsia, DoGSky.DoGLightBlue, DoGSky.DoGTwlight), Color.White, 0.65f);
|
||||
SquishyLightParticle crackLight = new(Projectile.Center, lightVelocity, lightScale, lightColor, Main.rand.Next(30, 45));
|
||||
GeneralParticleHandler.SpawnParticle(crackLight);
|
||||
}
|
||||
|
||||
// Explosion visuals.
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
CustomPulse plasmaExplosion = new(Projectile.Center, Vector2.Zero, DoGSky.DoGTwlight * 0.8f * brightnessMultiplier, "CalamityMod/Particles/PlasmaExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0f, 1.25f + i * 0.05f, 45);
|
||||
GeneralParticleHandler.SpawnParticle(plasmaExplosion);
|
||||
}
|
||||
|
||||
CustomPulse shineExplosion = new(Projectile.Center, Vector2.Zero, DoGSky.DoGTwlight * brightnessMultiplier, "CalamityMod/Particles/ShineExplosion1", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0f, 0.75f, 45);
|
||||
GeneralParticleHandler.SpawnParticle(shineExplosion);
|
||||
CustomPulse shineExplosion2 = new(Projectile.Center, Vector2.Zero, Color.White * 0.6f * brightnessMultiplier, "CalamityMod/Particles/ShineExplosion2", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0f, 0.5f, 45);
|
||||
GeneralParticleHandler.SpawnParticle(shineExplosion2);
|
||||
StrongBloom bloom = new(Projectile.Center, Vector2.Zero, Color.White * 0.8f * brightnessMultiplier, 8f, 30);
|
||||
GeneralParticleHandler.SpawnParticle(bloom);
|
||||
|
||||
SoundEngine.PlaySound(BreakSound, Projectile.Center);
|
||||
CalamityUtils.AddScreenshakeAt(Projectile.Center, 14f);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
PulseRing fakerDeathRing = new(Projectile.Center, Vector2.Zero, Color.White * 0.45f * brightnessMultiplier, 0f, 3f + i * 0.1f, 30 + i * 15);
|
||||
GeneralParticleHandler.SpawnParticle(fakerDeathRing);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
float lerpMult = Utils.GetLerpValue(15f, 30f, Projectile.timeLeft, clamped: true) * Utils.GetLerpValue(240f, 200f, Projectile.timeLeft, clamped: true) * (1f + 0.2f * (float)Math.Cos(Main.GlobalTimeWrappedHourly % 30f / 0.5f * (MathHelper.Pi * 2f) * 3f)) * 0.8f;
|
||||
Texture2D crackTexture = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/CrackedGlass_Glowing").Value;
|
||||
Texture2D starTexture = ModContent.Request<Texture2D>("CalamityMod/Projectiles/StarProj").Value;
|
||||
Texture2D bloomRingTexture = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomRing").Value;
|
||||
|
||||
Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value;
|
||||
Vector2 drawPos = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY);
|
||||
Color baseColor = new Color(150, 100, 255, 255) * Projectile.Opacity;
|
||||
baseColor *= 0.5f;
|
||||
baseColor.A = 0;
|
||||
Color colorA = baseColor;
|
||||
Color colorB = baseColor * 0.5f;
|
||||
colorA *= lerpMult;
|
||||
colorB *= lerpMult;
|
||||
Vector2 origin = texture.Size() / 2f;
|
||||
Vector2 scale = new Vector2(3f, 9f) * Projectile.Opacity * lerpMult;
|
||||
float chargeInterpolant = CalamityUtils.SineInOutEasing(Timer / RiftLifetime, 1);
|
||||
float brightnessMultiplier = FakeRift ? 0.6f : 1f;
|
||||
|
||||
SpriteEffects spriteEffects = SpriteEffects.None;
|
||||
if (Projectile.spriteDirection == -1)
|
||||
spriteEffects = SpriteEffects.FlipHorizontally;
|
||||
Vector2 drawPosition = Projectile.Center - Main.screenPosition;
|
||||
Vector2 verticalStarPartScale = new Vector2(1f, 8f) * chargeInterpolant * Projectile.scale * 3.25f;
|
||||
Vector2 horizontalStarPartScale = new Vector2(1f, 5f) * chargeInterpolant * Projectile.scale * 3.25f;
|
||||
|
||||
Main.EntitySpriteDraw(texture, drawPos, null, colorA, MathHelper.PiOver2, origin, scale, spriteEffects, 0);
|
||||
Main.EntitySpriteDraw(texture, drawPos, null, colorA, 0f, origin, scale, spriteEffects, 0);
|
||||
Main.EntitySpriteDraw(texture, drawPos, null, colorB, MathHelper.PiOver2, origin, scale * 0.8f, spriteEffects, 0);
|
||||
Main.EntitySpriteDraw(texture, drawPos, null, colorB, 0f, origin, scale * 0.8f, spriteEffects, 0);
|
||||
Main.spriteBatch.SetBlendState(BlendState.Additive);
|
||||
|
||||
Main.EntitySpriteDraw(texture, drawPos, null, colorA, MathHelper.PiOver2 + Projectile.ai[1] * 0.25f, origin, scale, spriteEffects, 0);
|
||||
Main.EntitySpriteDraw(texture, drawPos, null, colorA, Projectile.ai[1] * 0.25f, origin, scale, spriteEffects, 0);
|
||||
Main.EntitySpriteDraw(texture, drawPos, null, colorB, MathHelper.PiOver2 + Projectile.ai[1] * 0.5f, origin, scale * 0.8f, spriteEffects, 0);
|
||||
Main.EntitySpriteDraw(texture, drawPos, null, colorB, Projectile.ai[1] * 0.5f, origin, scale * 0.8f, spriteEffects, 0);
|
||||
// Draw the glowing star.
|
||||
Main.EntitySpriteDraw(starTexture, drawPosition, null, Color.White * 0.7f * brightnessMultiplier * chargeInterpolant, 0f, starTexture.Size() * 0.5f, verticalStarPartScale, 0);
|
||||
Main.EntitySpriteDraw(starTexture, drawPosition, null, Color.White * 0.7f * brightnessMultiplier * chargeInterpolant, MathHelper.PiOver2, starTexture.Size() * 0.5f, horizontalStarPartScale, 0);
|
||||
|
||||
Main.EntitySpriteDraw(texture, drawPos, null, colorA, MathHelper.PiOver4, origin, scale * 0.6f, spriteEffects, 0);
|
||||
Main.EntitySpriteDraw(texture, drawPos, null, colorA, MathHelper.PiOver4 * 3f, origin, scale * 0.6f, spriteEffects, 0);
|
||||
Main.EntitySpriteDraw(texture, drawPos, null, colorB, MathHelper.PiOver4, origin, scale * 0.4f, spriteEffects, 0);
|
||||
Main.EntitySpriteDraw(texture, drawPos, null, colorB, MathHelper.PiOver4 * 3f, origin, scale * 0.4f, spriteEffects, 0);
|
||||
|
||||
Main.EntitySpriteDraw(texture, drawPos, null, colorA, MathHelper.PiOver4 + Projectile.ai[1] * 0.75f, origin, scale * 0.6f, spriteEffects, 0);
|
||||
Main.EntitySpriteDraw(texture, drawPos, null, colorA, MathHelper.PiOver4 * 3f + Projectile.ai[1] * 0.75f, origin, scale * 0.6f, spriteEffects, 0);
|
||||
Main.EntitySpriteDraw(texture, drawPos, null, colorB, MathHelper.PiOver4 + Projectile.ai[1], origin, scale * 0.4f, spriteEffects, 0);
|
||||
Main.EntitySpriteDraw(texture, drawPos, null, colorB, MathHelper.PiOver4 * 3f + Projectile.ai[1], origin, scale * 0.4f, spriteEffects, 0);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void OnKill(int timeLeft)
|
||||
{
|
||||
if (Projectile.ai[0] == -1f || Projectile.ai[2] == 1f)
|
||||
return;
|
||||
|
||||
int dustAmt = 50;
|
||||
int random = 5;
|
||||
|
||||
for (int j = 0; j < 10; j++)
|
||||
// Draw a smaller, twlight colored star at the center if this isn't a fake rift.
|
||||
if (!FakeRift)
|
||||
{
|
||||
random += j * 2;
|
||||
int dustAmtSpawned = 0;
|
||||
int scale = random * 13;
|
||||
float dustPositionX = Projectile.Center.X - (scale / 2);
|
||||
float dustPositionY = Projectile.Center.Y - (scale / 2);
|
||||
while (dustAmtSpawned < dustAmt)
|
||||
{
|
||||
float dustVelocityX = Main.rand.Next(-random, random);
|
||||
float dustVelocityY = Main.rand.Next(-random, random);
|
||||
float dustVelocityScalar = random * 2f;
|
||||
float dustVelocity = (float)Math.Sqrt(dustVelocityX * dustVelocityX + dustVelocityY * dustVelocityY);
|
||||
dustVelocity = dustVelocityScalar / dustVelocity;
|
||||
dustVelocityX *= dustVelocity;
|
||||
dustVelocityY *= dustVelocity;
|
||||
int dust = Dust.NewDust(new Vector2(dustPositionX, dustPositionY), scale, scale, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 5f);
|
||||
Main.dust[dust].noGravity = true;
|
||||
Main.dust[dust].position.X = Projectile.Center.X;
|
||||
Main.dust[dust].position.Y = Projectile.Center.Y;
|
||||
Main.dust[dust].position.X += Main.rand.Next(-10, 11);
|
||||
Main.dust[dust].position.Y += Main.rand.Next(-10, 11);
|
||||
Main.dust[dust].velocity.X = dustVelocityX;
|
||||
Main.dust[dust].velocity.Y = dustVelocityY;
|
||||
dustAmtSpawned++;
|
||||
}
|
||||
Main.EntitySpriteDraw(starTexture, drawPosition, null, DoGSky.DoGTwlight * 0.9f * brightnessMultiplier * chargeInterpolant, 0f, starTexture.Size() * 0.5f, verticalStarPartScale * 0.8f, 0);
|
||||
Main.EntitySpriteDraw(starTexture, drawPosition, null, DoGSky.DoGTwlight * 0.9f * brightnessMultiplier * chargeInterpolant, MathHelper.PiOver2, starTexture.Size() * 0.5f, horizontalStarPartScale * 0.8f, 0);
|
||||
}
|
||||
|
||||
// Draw the crack.
|
||||
Effect crackShader = CalamityShaders.DoGRealityCrackShader;
|
||||
float crackOpcity = (AIState == 1f) ? Projectile.Opacity * 0.1f : 0.1f;
|
||||
Color darkerPixelColor = FakeRift ? Color.White : DoGSky.DoGTwlight;
|
||||
|
||||
crackShader.Parameters["opacityCutoffValue"].SetValue(CrackExposure);
|
||||
crackShader.Parameters["fadeoutPower"].SetValue(1f);
|
||||
crackShader.Parameters["overallOpacity"].SetValue(crackOpcity * brightnessMultiplier);
|
||||
crackShader.Parameters["minBrightnessValue"].SetValue(0.75f);
|
||||
crackShader.Parameters["darkerPixelColor"].SetValue(darkerPixelColor.ToVector3());
|
||||
crackShader.Parameters["brighterPixelColor"].SetValue(Color.White.ToVector3());
|
||||
Main.spriteBatch.SafeBegin(SpriteSortMode.Immediate, BatchSetting.Additive, crackShader, Main.GameViewMatrix.TransformationMatrix, () =>
|
||||
{
|
||||
int crackCount = FakeRift ? 1 : 3;
|
||||
for (int i = 0; i < crackCount; i++)
|
||||
{
|
||||
float crackRotation = i * MathHelper.TwoPi / crackCount;
|
||||
Main.EntitySpriteDraw(crackTexture, drawPosition + Vector2.UnitY * 8f, null, Color.White * Projectile.Opacity, crackRotation, crackTexture.Size() * 0.5f, CrackScale, 0);
|
||||
}
|
||||
});
|
||||
|
||||
if (AIState != 1f)
|
||||
{
|
||||
// Draw the bloom ring which closes inwards.
|
||||
float ringScale = MathHelper.Lerp(8f, 0f, chargeInterpolant);
|
||||
Color ringColor = FakeRift ? Color.White : Color.Lerp(Color.White, DoGSky.DoGTwlight, chargeInterpolant);
|
||||
Main.EntitySpriteDraw(bloomRingTexture, drawPosition, null, ringColor * brightnessMultiplier * chargeInterpolant * 0.6f, 0f, bloomRingTexture.Size() * 0.5f, ringScale, 0);
|
||||
}
|
||||
|
||||
Main.spriteBatch.SetBlendState(BlendState.AlphaBlend);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -279,6 +279,8 @@ namespace CalamityMod.Projectiles
|
||||
|
||||
public int BloodstoneOrbValue = 0;
|
||||
|
||||
public int HomingTarget = -1;
|
||||
|
||||
#region On Spawn
|
||||
public override void OnSpawn(Projectile projectile, IEntitySource source)
|
||||
{
|
||||
@@ -367,6 +369,8 @@ namespace CalamityMod.Projectiles
|
||||
{
|
||||
if (projectile.bobber && projectile.type != ModContent.ProjectileType<VictideBobber>() && RunFishingMinigames(projectile))
|
||||
return false;
|
||||
//Reset the Homing Target immediately before AI can re-set it on applicable projectiles
|
||||
HomingTarget = -1;
|
||||
#region Vanilla Summons AI Changes
|
||||
|
||||
//
|
||||
@@ -4732,6 +4736,13 @@ namespace CalamityMod.Projectiles
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool? CanHitNPC(Projectile projectile, NPC target)
|
||||
{
|
||||
if (target.Calamity().IsArmored() && HomingTarget > -1 && HomingTarget != target.whoAmI)
|
||||
return false;
|
||||
return null;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Drawing
|
||||
|
||||
@@ -274,8 +274,8 @@ namespace CalamityMod.Projectiles.Magic
|
||||
Vector2 jawOrigin = jawTexture.Size() * 0.5f;
|
||||
|
||||
// Segment drawing.
|
||||
Texture2D bodyTexture = ModContent.Request<Texture2D>("CalamityMod/NPCs/DevourerofGods/DevourerofGodsBodyS").Value;
|
||||
Texture2D tailTexture = ModContent.Request<Texture2D>("CalamityMod/NPCs/DevourerofGods/DevourerofGodsTailS").Value;
|
||||
Texture2D bodyTexture = ModContent.Request<Texture2D>("CalamityMod/NPCs/DevourerofGods/DevourerofGodsBody_P2").Value;
|
||||
Texture2D tailTexture = ModContent.Request<Texture2D>("CalamityMod/NPCs/DevourerofGods/DevourerofGodsTail_P2").Value;
|
||||
|
||||
// Not white to differentiate itself slightly from regular DoG when fighting Boss Rush.
|
||||
Color baseColor = Color.Lerp(Color.White, Color.Fuchsia, 0.15f);
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.Items.Weapons.Melee;
|
||||
using CalamityMod.Projectiles.BaseProjectiles;
|
||||
using CalamityMod.Projectiles.Boss;
|
||||
using CalamityMod.Sounds;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
@@ -71,11 +72,20 @@ namespace CalamityMod.Projectiles.Melee
|
||||
if (!inStartup && !inCooldown)
|
||||
foreach (var proj in Main.ActiveProjectiles)
|
||||
{
|
||||
if (proj.Hitbox.Intersects(Projectile.Hitbox) && proj.hostile && !reflectedProjectiles.Contains(proj.whoAmI))
|
||||
if (proj.type == ModContent.ProjectileType<DoGLaserWalls>() && proj.ModProjectile<DoGLaserWalls>().canDamage && !reflectedProjectiles.Contains(proj.whoAmI))
|
||||
{
|
||||
reflectedProjectiles.Add(proj.whoAmI);
|
||||
for (var i = 0; i < 3; i++)
|
||||
{
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), proj.Center, proj.velocity * -1, ModContent.ProjectileType<MirrorBlast>(), (int)(Projectile.damage * 0.5f), Projectile.knockBack, Projectile.owner);
|
||||
SoundEngine.PlaySound(SoundID.DD2_WitherBeastCrystalImpact, Projectile.Center);
|
||||
}
|
||||
}
|
||||
else if (proj.Hitbox.Intersects(Projectile.Hitbox) && proj.hostile && !reflectedProjectiles.Contains(proj.whoAmI))
|
||||
{
|
||||
reflectedProjectiles.Add(proj.whoAmI);
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), proj.Center, proj.velocity * -1, ModContent.ProjectileType<MirrorBlast>(), (int)(Projectile.damage * 0.5f), Projectile.knockBack, Projectile.owner);
|
||||
SoundEngine.PlaySound(SoundID.DD2_WitherBeastCrystalImpact,Projectile.Center);
|
||||
SoundEngine.PlaySound(SoundID.DD2_WitherBeastCrystalImpact, Projectile.Center);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -142,6 +142,12 @@ namespace CalamityMod.Projectiles.Melee
|
||||
else
|
||||
{
|
||||
float homingStrength = 0.025f; // Adjust this value for stronger or weaker homing
|
||||
if (Projectile.timeLeft < 1000)
|
||||
homingStrength *= 2f;
|
||||
if (Projectile.timeLeft < 800)
|
||||
homingStrength *= 2f;
|
||||
if (Projectile.timeLeft < 600)
|
||||
homingStrength *= 2f;
|
||||
NPC target = FindClosestNPC(3200f);
|
||||
if (target != null)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using CalamityMod.NPCs.DevourerofGods;
|
||||
using CalamityMod.NPCs;
|
||||
using CalamityMod.NPCs.DevourerofGods;
|
||||
using Terraria;
|
||||
using Terraria.Graphics.Effects;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Systems
|
||||
@@ -8,11 +10,21 @@ namespace CalamityMod.Systems
|
||||
{
|
||||
public override SceneEffectPriority Priority => SceneEffectPriority.BossHigh;
|
||||
|
||||
public override bool IsSceneEffectActive(Player player) => NPC.AnyNPCs(ModContent.NPCType<DevourerofGodsHead>());
|
||||
public override bool IsSceneEffectActive(Player player)
|
||||
{
|
||||
bool monolithIsActive = Main.LocalPlayer.Calamity().monolithDevourerBShader > 0 || Main.LocalPlayer.Calamity().monolithDevourerPShader > 0;
|
||||
bool dogIsAlive = NPC.AnyNPCs(ModContent.NPCType<DevourerofGodsHead>());
|
||||
|
||||
return dogIsAlive || monolithIsActive;
|
||||
}
|
||||
|
||||
public override void SpecialVisuals(Player player, bool isActive)
|
||||
{
|
||||
player.ManageSpecialBiomeVisuals("CalamityMod:DevourerofGodsHead", isActive);
|
||||
if (isActive)
|
||||
SkyManager.Instance.Activate("CalamityMod:DevourerofGodsHead");
|
||||
else
|
||||
SkyManager.Instance.Deactivate("CalamityMod:DevourerofGodsHead");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Systems
|
||||
{
|
||||
public class MonolithDistortionScene : ModSceneEffect
|
||||
{
|
||||
public override SceneEffectPriority Priority => SceneEffectPriority.Environment;
|
||||
|
||||
public override bool IsSceneEffectActive(Player player) => Main.LocalPlayer.Calamity().monolithDevourerBShader > 0 || Main.LocalPlayer.Calamity().monolithDevourerPShader > 0;
|
||||
|
||||
public override void SpecialVisuals(Player player, bool isActive)
|
||||
{
|
||||
player.ManageSpecialBiomeVisuals("CalamityMod:DevourerofGodsHead", isActive);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,11 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using CalamityMod.NPCs.DevourerofGods;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.Graphics.Effects;
|
||||
using Terraria.Graphics.Shaders;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.NPCs.DevourerofGods
|
||||
namespace CalamityMod.Skies
|
||||
{
|
||||
public class DoGScreenShaderData : ScreenShaderData
|
||||
{
|
||||
@@ -17,13 +18,13 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
|
||||
private void UpdateDoGIndex()
|
||||
{
|
||||
int DoGType = ModContent.NPCType<DevourerofGodsHead>();
|
||||
var DoGType = ModContent.NPCType<DevourerofGodsHead>();
|
||||
if (DoGIndex >= 0 && Main.npc[DoGIndex].active && Main.npc[DoGIndex].type == DoGType)
|
||||
{
|
||||
return;
|
||||
}
|
||||
DoGIndex = -1;
|
||||
foreach (NPC n in Main.ActiveNPCs)
|
||||
foreach (var n in Main.ActiveNPCs)
|
||||
{
|
||||
if (n.type == DoGType)
|
||||
{
|
||||
@@ -54,6 +55,8 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
{
|
||||
UseTargetPosition(Main.LocalPlayer.Center);
|
||||
}
|
||||
|
||||
UseColor(DoGSky.DoGSkyColor);
|
||||
base.Apply();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,501 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using CalamityMod.Dusts;
|
||||
using CalamityMod.Effects;
|
||||
using CalamityMod.Events;
|
||||
using CalamityMod.Graphics;
|
||||
using CalamityMod.Graphics.Primitives;
|
||||
using CalamityMod.Items.Placeables.FurnitureVoid;
|
||||
using CalamityMod.NPCs.DevourerofGods;
|
||||
using CalamityMod.Systems.Graphic;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Content;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.GameContent;
|
||||
using Terraria.Graphics.Effects;
|
||||
using Terraria.Graphics.Shaders;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Skies
|
||||
{
|
||||
public class DoGSky : CustomSky
|
||||
{
|
||||
public class RealityCrack
|
||||
{
|
||||
public Vector2 Position;
|
||||
|
||||
public float Depth;
|
||||
|
||||
public float Scale;
|
||||
|
||||
public float Rotation;
|
||||
}
|
||||
|
||||
public class DistortionRiftArm
|
||||
{
|
||||
public Vector2 ArmStartingPosition;
|
||||
|
||||
public List<Vector2> ArmPoints;
|
||||
|
||||
public float Depth;
|
||||
|
||||
public float MaxWidth;
|
||||
|
||||
public float MinDistanceBetweenPoints;
|
||||
|
||||
public float MaxDistanceBetweenPoints;
|
||||
|
||||
public float MinPointAngularVariance;
|
||||
|
||||
public float MaxPointAngularVariance;
|
||||
|
||||
public int TotalPoints;
|
||||
}
|
||||
|
||||
public static readonly Color DoGTwlight = new(147, 24, 204);
|
||||
|
||||
public static readonly Color DoGLightBlue = new(0, 221, 250);
|
||||
|
||||
public bool Initialized;
|
||||
|
||||
public int DoGIndex;
|
||||
|
||||
public List<DistortionRiftArm> MainRiftCracks;
|
||||
|
||||
public List<DistortionRiftArm> OuterRiftCracks;
|
||||
|
||||
public List<RealityCrack> RealityCracks;
|
||||
|
||||
public List<DistortionRiftArm> DistortionRiftArms;
|
||||
|
||||
public static bool CanSkyBeActive { get; private set; }
|
||||
|
||||
public static float SkyIntensity { get; private set; }
|
||||
|
||||
public static Color DoGSkyColor { get; private set; }
|
||||
|
||||
public override void Update(GameTime gameTime)
|
||||
{
|
||||
// Initialize the rift arms and background cracks.
|
||||
GenerateRift();
|
||||
|
||||
DoGIndex = NPC.FindFirstNPC(ModContent.NPCType<DevourerofGodsHead>());
|
||||
GetCorrectDoGColor();
|
||||
|
||||
if (CanSkyBeActive)
|
||||
SkyIntensity = MathHelper.Clamp(SkyIntensity + 0.05f, 0f, 1f);
|
||||
else
|
||||
SkyIntensity = MathHelper.Clamp(SkyIntensity - 0.05f, 0f, 1f);
|
||||
}
|
||||
|
||||
private void GenerateRift()
|
||||
{
|
||||
Vector2 riftSpawnLocation = Main.LocalPlayer.Center - Vector2.UnitY * 2000f + Main.rand.NextVector2Circular(2000f, 2000f);
|
||||
|
||||
if (!Initialized)
|
||||
{
|
||||
MainRiftCracks = [];
|
||||
OuterRiftCracks = [];
|
||||
RealityCracks = [];
|
||||
DistortionRiftArms = [];
|
||||
|
||||
int crackCount = 3;
|
||||
for (int i = 0; i < crackCount; i++)
|
||||
{
|
||||
RealityCrack realityCrack = new RealityCrack()
|
||||
{
|
||||
Position = riftSpawnLocation,
|
||||
Depth = 30f,
|
||||
Scale = 1.55f * Main.rand.NextFloat(0.9f, 1.1f),
|
||||
Rotation = i * MathHelper.TwoPi / crackCount
|
||||
};
|
||||
RealityCracks.Add(realityCrack);
|
||||
}
|
||||
|
||||
// Generate up to 30 arms for the rift.
|
||||
// The first 14 are larger cracks to form the main hole at the impact point.
|
||||
// The rest are longer, skinner cracks protruding outwards from it.
|
||||
for (int i = 0; i < 14; i++)
|
||||
{
|
||||
DistortionRiftArm distortionRiftArm = new DistortionRiftArm()
|
||||
{
|
||||
ArmStartingPosition = riftSpawnLocation,
|
||||
Depth = 30f,
|
||||
TotalPoints = 8,
|
||||
|
||||
MaxWidth = Main.rand.NextFloat(100f, 120f),
|
||||
MinDistanceBetweenPoints = 100f,
|
||||
MaxDistanceBetweenPoints = 140f,
|
||||
MinPointAngularVariance = -6,
|
||||
MaxPointAngularVariance = 6,
|
||||
|
||||
ArmPoints = [],
|
||||
};
|
||||
MainRiftCracks.Add(distortionRiftArm);
|
||||
}
|
||||
|
||||
int outerCracksAmount = Main.rand.Next(12, 17);
|
||||
for (int i = 0; i < outerCracksAmount; i++)
|
||||
{
|
||||
DistortionRiftArm distortionRiftArm = new DistortionRiftArm()
|
||||
{
|
||||
ArmStartingPosition = riftSpawnLocation,
|
||||
Depth = 30f,
|
||||
TotalPoints = Main.rand.Next(6, 10),
|
||||
|
||||
MaxWidth = Main.rand.NextFloat(6f, 9f),
|
||||
MinDistanceBetweenPoints = 400f,
|
||||
MaxDistanceBetweenPoints = 500f,
|
||||
MinPointAngularVariance = Main.rand.Next(-10, -5),
|
||||
MaxPointAngularVariance = Main.rand.Next(5, 10),
|
||||
|
||||
ArmPoints = [],
|
||||
};
|
||||
OuterRiftCracks.Add(distortionRiftArm);
|
||||
}
|
||||
|
||||
// Generate the points for each arm and add them all to the global arm list.
|
||||
// Main cracks.
|
||||
for (int i = 0; i < MainRiftCracks.Count; i++)
|
||||
{
|
||||
float minDistance = MainRiftCracks[i].MinDistanceBetweenPoints * MainRiftCracks[i].Depth * 0.1f;
|
||||
float maxDistance = MainRiftCracks[i].MaxDistanceBetweenPoints * MainRiftCracks[i].Depth * 0.1f;
|
||||
float minAngularVariance = MainRiftCracks[i].MinPointAngularVariance;
|
||||
float maxAngularVariance = MainRiftCracks[i].MaxPointAngularVariance;
|
||||
float placementAngle = i * MathHelper.TwoPi / MainRiftCracks.Count;
|
||||
|
||||
if (MainRiftCracks[i].ArmPoints.Count <= 0)
|
||||
MainRiftCracks[i].ArmPoints = GenerateDistortionRiftArmPoints(MainRiftCracks[i].ArmStartingPosition, MainRiftCracks[i].TotalPoints, minDistance, maxDistance, minAngularVariance, maxAngularVariance, placementAngle);
|
||||
DistortionRiftArms.Add(MainRiftCracks[i]);
|
||||
}
|
||||
|
||||
// Outer cracks.
|
||||
for (int i = 0; i < OuterRiftCracks.Count; i++)
|
||||
{
|
||||
float minDistance = OuterRiftCracks[i].MinDistanceBetweenPoints * OuterRiftCracks[i].Depth * 0.1f;
|
||||
float maxDistance = OuterRiftCracks[i].MaxDistanceBetweenPoints * OuterRiftCracks[i].Depth * 0.1f;
|
||||
float minAngularVariance = OuterRiftCracks[i].MinPointAngularVariance;
|
||||
float maxAngularVariance = OuterRiftCracks[i].MaxPointAngularVariance;
|
||||
float placementAngle = i * MathHelper.TwoPi / OuterRiftCracks.Count;
|
||||
|
||||
if (OuterRiftCracks[i].ArmPoints.Count <= 0)
|
||||
OuterRiftCracks[i].ArmPoints = GenerateDistortionRiftArmPoints(OuterRiftCracks[i].ArmStartingPosition, OuterRiftCracks[i].TotalPoints, minDistance, maxDistance, minAngularVariance, maxAngularVariance, placementAngle);
|
||||
DistortionRiftArms.Add(OuterRiftCracks[i]);
|
||||
}
|
||||
|
||||
Initialized = true;
|
||||
}
|
||||
}
|
||||
|
||||
private static List<Vector2> GenerateDistortionRiftArmPoints(Vector2 startingPosition, int totalPoints, float minDistanceBetweenPoints, float maxDistanceBetweenPoints, float minAngularVariance, float maxAngularVariance, float? optionalPointPlacementAngle = null)
|
||||
{
|
||||
// (Original code by Xyk; See TriactisHammerExplosion)
|
||||
// -fryzahh
|
||||
|
||||
List<Vector2> points = [];
|
||||
for (int j = 0; j < totalPoints; j++)
|
||||
{
|
||||
// First point should always be the starting position.
|
||||
if (j == 0)
|
||||
{
|
||||
points.Add(startingPosition);
|
||||
}
|
||||
// Next point should be a random location around the starting position.
|
||||
// If the placement angle has a value then rotate towards that with a very slight offset.
|
||||
else if (j == 1)
|
||||
{
|
||||
float distanceFromLastPoint = Main.rand.NextFloat(minDistanceBetweenPoints, maxDistanceBetweenPoints);
|
||||
Vector2 nextPointPosition = startingPosition + Main.rand.NextVector2Unit() * distanceFromLastPoint;
|
||||
if (optionalPointPlacementAngle != null)
|
||||
nextPointPosition = startingPosition + Vector2.UnitX.RotatedBy(optionalPointPlacementAngle.Value) * distanceFromLastPoint;
|
||||
points.Add(nextPointPosition);
|
||||
}
|
||||
// All other points follow after the last one with the same slight offset to resemble cracks.
|
||||
else
|
||||
{
|
||||
Vector2 previousPoint = points[j - 2];
|
||||
float distanceFromLastPoint = Main.rand.NextFloat(minDistanceBetweenPoints, maxDistanceBetweenPoints);
|
||||
if (j == totalPoints - 1)
|
||||
distanceFromLastPoint = Main.rand.NextFloat(minDistanceBetweenPoints, maxDistanceBetweenPoints) * 0.5f;
|
||||
|
||||
Vector2 newPoint = points[j - 1] + (previousPoint.DirectionTo(points[j - 1]) * distanceFromLastPoint).RotatedBy(MathHelper.ToRadians(Main.rand.NextFloat(minAngularVariance, maxAngularVariance) * j * 0.5f));
|
||||
points.Add(newPoint);
|
||||
}
|
||||
}
|
||||
|
||||
return points;
|
||||
}
|
||||
|
||||
public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth)
|
||||
{
|
||||
if (Main.gameMenu || !CalamityClientConfig.Instance.FancyBackgroundVisuals)
|
||||
return;
|
||||
|
||||
spriteBatch.End();
|
||||
spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointWrap, DepthStencilState.None, Main.Rasterizer, null, CalamityUtils.BackgroundMatrix);
|
||||
|
||||
// Draw the wind effect.
|
||||
if (minDepth >= float.MinValue && maxDepth <= 5f)
|
||||
DrawDistortionWinds(spriteBatch);
|
||||
|
||||
// Draw the rolling fog effect.
|
||||
if (minDepth >= 3f && maxDepth <= 10f)
|
||||
DrawRollingBackgroundFog(spriteBatch);
|
||||
|
||||
spriteBatch.End();
|
||||
spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, SamplerState.PointWrap, DepthStencilState.None, Main.Rasterizer, null, CalamityUtils.BackgroundMatrix);
|
||||
|
||||
// Draw the rift aura.
|
||||
if (minDepth >= 6f && maxDepth <= float.MaxValue)
|
||||
DrawRiftAura(spriteBatch);
|
||||
|
||||
// Draw the cracked glass textures.
|
||||
if (minDepth >= 6f && maxDepth <= float.MaxValue)
|
||||
DrawRealityCracks(spriteBatch);
|
||||
|
||||
spriteBatch.End();
|
||||
spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, CalamityUtils.BackgroundMatrix);
|
||||
|
||||
// Draw the rift to the Distortion over the cracked glass.
|
||||
if (minDepth >= 6f && maxDepth <= float.MaxValue)
|
||||
DrawDistortionRift(spriteBatch);
|
||||
|
||||
spriteBatch.End();
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, CalamityUtils.BackgroundMatrix);
|
||||
}
|
||||
|
||||
public void DrawRiftToRenderTarget()
|
||||
{
|
||||
if (DistortionRiftArms == null || DistortionRiftArms.Count == 0)
|
||||
return;
|
||||
|
||||
Vector2 screenSize = new(Main.screenWidth, Main.screenHeight);
|
||||
Vector2 screenCenter = Main.screenPosition + (screenSize * 0.5f);
|
||||
|
||||
for (int i = 0; i < DistortionRiftArms.Count; i++)
|
||||
{
|
||||
Vector2 depthFactor = new(1f / DistortionRiftArms[i].Depth, 0.9f / DistortionRiftArms[i].Depth);
|
||||
List<Vector2> parallaxedPoints = [];
|
||||
for (int j = 0; j < DistortionRiftArms[i].ArmPoints.Count; j++)
|
||||
parallaxedPoints.Add((DistortionRiftArms[i].ArmPoints[j] - screenCenter) * depthFactor + screenCenter);
|
||||
|
||||
PrimitiveRenderer.RenderTrail(parallaxedPoints, new((completion) => MathHelper.Lerp(0f, DistortionRiftArms[i].MaxWidth, 1f - completion) * SkyIntensity, (_) => Color.White * 1f, null, false, useUnscaledMatrices: true), DistortionRiftArms[i].TotalPoints + 16);
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawDistortionWinds(SpriteBatch spriteBatch)
|
||||
{
|
||||
Effect shader = CalamityShaders.DoGDistortionWindsShader;
|
||||
Texture2D windsTexture = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/GreyscaleGradients/Neurons2").Value;
|
||||
Texture2D highlightsTexture = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/GreyscaleGradients/SharpNoise").Value;
|
||||
Texture2D distortionTexture = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/GreyscaleGradients/MeltyNoise").Value;
|
||||
Texture2D erosionTexture = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/GreyscaleGradients/Pebbles").Value;
|
||||
|
||||
Vector2 screenSize = new(Main.screenWidth, Main.screenHeight);
|
||||
|
||||
shader.Parameters["time"].SetValue(Main.GlobalTimeWrappedHourly);
|
||||
shader.Parameters["overallOpacity"].SetValue(SkyIntensity);
|
||||
shader.Parameters["distortionStrength"].SetValue(0.3f);
|
||||
shader.Parameters["mainNoiseTextureScale"].SetValue(0.8f);
|
||||
shader.Parameters["distortionTextureScale"].SetValue(0.6f);
|
||||
shader.Parameters["erosionTextureScale"].SetValue(2f);
|
||||
shader.Parameters["erosionMin"].SetValue(0.38f * SkyIntensity);
|
||||
shader.Parameters["gradientPrecision"].SetValue(20f);
|
||||
|
||||
shader.Parameters["pixelationFactor"].SetValue(screenSize * 0.5f);
|
||||
shader.Parameters["worldOffset"].SetValue(Main.screenPosition / windsTexture.Size() * 0.025f);
|
||||
|
||||
shader.Parameters["darkerPixelColor"].SetValue(Color.Lerp(Color.DarkGray, Color.Black, 0.82f).ToVector3());
|
||||
shader.Parameters["brighterPixelColor"].SetValue(Color.Lerp(Color.Black, DoGSkyColor, 0.32f).ToVector3());
|
||||
shader.Parameters["highlightsColor"].SetValue(DoGSkyColor.ToVector3());
|
||||
|
||||
Main.instance.GraphicsDevice.Textures[1] = highlightsTexture;
|
||||
Main.instance.GraphicsDevice.SamplerStates[1] = SamplerState.PointWrap;
|
||||
|
||||
Main.instance.GraphicsDevice.Textures[2] = distortionTexture;
|
||||
Main.instance.GraphicsDevice.SamplerStates[2] = SamplerState.LinearWrap;
|
||||
|
||||
Main.instance.GraphicsDevice.Textures[3] = erosionTexture;
|
||||
Main.instance.GraphicsDevice.SamplerStates[3] = SamplerState.LinearWrap;
|
||||
|
||||
shader.CurrentTechnique.Passes[0].Apply();
|
||||
spriteBatch.Draw(windsTexture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Color.White);
|
||||
}
|
||||
|
||||
private void DrawRollingBackgroundFog(SpriteBatch spriteBatch)
|
||||
{
|
||||
Effect shader = CalamityShaders.DoGBackgroundFogShader;
|
||||
Texture2D cloudsTexture = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/GreyscaleGradients/RealisticClouds").Value;
|
||||
Texture2D erosionTexture = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/GreyscaleGradients/HarshNoise").Value;
|
||||
|
||||
Vector2 screenSize = new(Main.screenWidth, Main.screenHeight);
|
||||
|
||||
shader.Parameters["time"].SetValue(Main.GlobalTimeWrappedHourly * 3f);
|
||||
shader.Parameters["overallOpacity"].SetValue(SkyIntensity * 0.25f);
|
||||
shader.Parameters["distortionStrength"].SetValue(0.12f);
|
||||
shader.Parameters["mainNoiseTextureScale"].SetValue(0.6f);
|
||||
shader.Parameters["distortionTextureScale"].SetValue(0.8f);
|
||||
shader.Parameters["erosionTextureScale"].SetValue(0.26f);
|
||||
shader.Parameters["erosionMin"].SetValue(0.06f * SkyIntensity);
|
||||
shader.Parameters["gradientPrecision"].SetValue(20f);
|
||||
|
||||
shader.Parameters["pixelationFactor"].SetValue(screenSize * 0.5f);
|
||||
shader.Parameters["worldOffset"].SetValue(Main.screenPosition / cloudsTexture.Size() * 0.005f);
|
||||
|
||||
shader.Parameters["darkerPixelColor"].SetValue(Color.Lerp(Color.Black, Color.DarkGray, 0.75f).ToVector3());
|
||||
shader.Parameters["brighterPixelColor"].SetValue(Color.Lerp(Color.DarkGray, DoGSkyColor, 0.8f).ToVector3());
|
||||
|
||||
Main.instance.GraphicsDevice.Textures[1] = cloudsTexture;
|
||||
Main.instance.GraphicsDevice.SamplerStates[1] = SamplerState.LinearWrap;
|
||||
|
||||
Main.instance.GraphicsDevice.Textures[2] = erosionTexture;
|
||||
Main.instance.GraphicsDevice.SamplerStates[2] = SamplerState.LinearWrap;
|
||||
|
||||
shader.CurrentTechnique.Passes[0].Apply();
|
||||
spriteBatch.Draw(cloudsTexture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Color.White);
|
||||
}
|
||||
|
||||
private void DrawRiftAura(SpriteBatch spriteBatch)
|
||||
{
|
||||
if (RealityCracks == null || RealityCracks.Count == 0)
|
||||
return;
|
||||
|
||||
Effect shader = CalamityShaders.DoGRiftAuraShader;
|
||||
Texture2D riftAuraTexture = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/GreyscaleGradients/Smudges").Value;
|
||||
Texture2D distortionTexture = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/GreyscaleGradients/Swirls").Value;
|
||||
|
||||
Vector2 screenSize = new(Main.screenWidth, Main.screenHeight);
|
||||
Vector2 screenCenter = Main.screenPosition + (screenSize * 0.5f);
|
||||
|
||||
shader.Parameters["time"].SetValue(Main.GlobalTimeWrappedHourly);
|
||||
shader.Parameters["pixelSize"].SetValue(screenSize * 0.5f);
|
||||
shader.Parameters["distortionStrength"].SetValue(0.78f);
|
||||
|
||||
shader.Parameters["opacityCutoffValue"].SetValue(0.675f * SkyIntensity);
|
||||
shader.Parameters["fadeoutPower"].SetValue(1.25f);
|
||||
shader.Parameters["overallOpacity"].SetValue(0.6f);
|
||||
|
||||
shader.Parameters["minBrightnessValue"].SetValue(0f);
|
||||
shader.Parameters["brighterPixelColor"].SetValue(DoGSkyColor.ToVector3());
|
||||
shader.Parameters["gradientPrecision"].SetValue(8f);
|
||||
|
||||
Main.instance.GraphicsDevice.Textures[1] = distortionTexture;
|
||||
Main.instance.GraphicsDevice.SamplerStates[1] = SamplerState.PointWrap;
|
||||
|
||||
shader.CurrentTechnique.Passes[0].Apply();
|
||||
|
||||
Vector2 depthFactor = new(1f / RealityCracks[0].Depth, 0.9f / RealityCracks[0].Depth);
|
||||
Vector2 drawPosition = (RealityCracks[0].Position - screenCenter) * depthFactor + screenCenter - Main.screenPosition;
|
||||
spriteBatch.Draw(riftAuraTexture, drawPosition, null, Color.White, Main.GlobalTimeWrappedHourly * MathHelper.TwoPi / 270f, riftAuraTexture.Size() * 0.5f, 1f, 0, 0f);
|
||||
}
|
||||
|
||||
private void DrawRealityCracks(SpriteBatch spriteBatch)
|
||||
{
|
||||
if (RealityCracks == null || RealityCracks.Count == 0)
|
||||
return;
|
||||
|
||||
Effect shader = CalamityShaders.DoGRealityCrackShader;
|
||||
Texture2D cracksTexture = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/CrackedGlass_Glowing").Value;
|
||||
|
||||
Vector2 screenSize = new(Main.screenWidth, Main.screenHeight);
|
||||
Vector2 screenCenter = Main.screenPosition + (screenSize * 0.5f);
|
||||
|
||||
shader.Parameters["opacityCutoffValue"].SetValue(0.8f * SkyIntensity);
|
||||
shader.Parameters["fadeoutPower"].SetValue(1f);
|
||||
shader.Parameters["overallOpacity"].SetValue(0.1015f);
|
||||
|
||||
shader.Parameters["minBrightnessValue"].SetValue(0.6f);
|
||||
shader.Parameters["darkerPixelColor"].SetValue(DoGSkyColor.ToVector3());
|
||||
shader.Parameters["brighterPixelColor"].SetValue(Color.White.ToVector3());
|
||||
|
||||
shader.CurrentTechnique.Passes[0].Apply();
|
||||
|
||||
for (int i = 0; i < RealityCracks.Count; i++)
|
||||
{
|
||||
Vector2 depthFactor = new(1f / RealityCracks[i].Depth, 0.9f / RealityCracks[i].Depth);
|
||||
Vector2 drawPosition = (RealityCracks[i].Position - screenCenter) * depthFactor + screenCenter - Main.screenPosition;
|
||||
spriteBatch.Draw(cracksTexture, drawPosition, null, Color.White, RealityCracks[i].Rotation, cracksTexture.Size() * 0.5f, RealityCracks[i].Scale, 0, 0f);
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawDistortionRift(SpriteBatch spriteBatch)
|
||||
{
|
||||
// Impose the distortion rift contents onto the primitives via shader.
|
||||
var metaballShader = CalamityShaders.MetaballEdgeShader;
|
||||
Texture2D distortionRiftContents = DoGVisualsManager.DistortionRiftBackgroundContentsTarget;
|
||||
Texture2D distortionRift = DoGVisualsManager.DistortionRiftPrimitivesTarget;
|
||||
|
||||
Vector2 screenSize = new(Main.screenWidth, Main.screenHeight);
|
||||
|
||||
metaballShader.Parameters["layerSize"]?.SetValue(distortionRiftContents.Size());
|
||||
metaballShader.Parameters["screenSize"]?.SetValue(screenSize);
|
||||
metaballShader.Parameters["layerOffset"]?.SetValue(Vector2.Zero);
|
||||
metaballShader.Parameters["edgeColor"]?.SetValue(Color.Lerp(Color.Lerp(DoGSkyColor, Color.White, 0.6f), Color.Black, 0.15f).ToVector4());
|
||||
|
||||
Main.instance.GraphicsDevice.Textures[1] = distortionRiftContents;
|
||||
Main.instance.GraphicsDevice.SamplerStates[1] = SamplerState.LinearWrap;
|
||||
|
||||
metaballShader.CurrentTechnique.Passes[0].Apply();
|
||||
spriteBatch.Draw(distortionRift, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Color.White);
|
||||
}
|
||||
|
||||
private void GetCorrectDoGColor()
|
||||
{
|
||||
if (DoGIndex != -1)
|
||||
{
|
||||
var DoG = Main.npc[DoGIndex].ModNPC<DevourerofGodsHead>();
|
||||
Color goalSkyColor = Color.Black;
|
||||
if (DoG.isInAgressiveState)
|
||||
goalSkyColor = Color.Fuchsia;
|
||||
if (DoG.isInPassiveState)
|
||||
goalSkyColor = DoGLightBlue;
|
||||
if (DoG.isInLaserWallState || DoG.isInPostWallState || DoG.postTeleportTimer > 0 || DoG.teleportTimer > 0 || DoG.NPC.localAI[2] < 180 && DoG.NPC.localAI[2] > 60)
|
||||
goalSkyColor = DoGTwlight;
|
||||
|
||||
DoGSkyColor = Color.Lerp(DoGSkyColor, goalSkyColor, 0.1f);
|
||||
}
|
||||
else
|
||||
{
|
||||
var goalSkyColor = Color.Black;
|
||||
if (Main.LocalPlayer.Calamity().monolithDevourerPShader > 0)
|
||||
goalSkyColor = Color.Fuchsia;
|
||||
if (Main.LocalPlayer.Calamity().monolithDevourerBShader > 0)
|
||||
goalSkyColor = DoGLightBlue;
|
||||
|
||||
DoGSkyColor = Color.Lerp(DoGSkyColor, goalSkyColor, 0.1f);
|
||||
}
|
||||
}
|
||||
|
||||
public override Color OnTileColor(Color inColor) => Color.Lerp(inColor, DoGSkyColor, SkyIntensity);
|
||||
|
||||
public override float GetCloudAlpha() => 1f;
|
||||
|
||||
public override void Activate(Vector2 position, params object[] args) => CanSkyBeActive = true;
|
||||
|
||||
public override bool IsActive() => CanSkyBeActive || SkyIntensity > 0f;
|
||||
|
||||
public override void Deactivate(params object[] args)
|
||||
{
|
||||
CanSkyBeActive = false;
|
||||
if (SkyIntensity <= 0.1f)
|
||||
{
|
||||
Initialized = false;
|
||||
DistortionRiftArms?.Clear();
|
||||
RealityCracks?.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
CanSkyBeActive = false;
|
||||
Initialized = false;
|
||||
DistortionRiftArms?.Clear();
|
||||
RealityCracks?.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||