MERGE: DS Drop Reworks with Flamethrower Reworks
No files matched your search
|
Before Width: | Height: | Size: 694 B After Width: | Height: | Size: 674 B |
|
Before Width: | Height: | Size: 628 B After Width: | Height: | Size: 674 B |
|
Before Width: | Height: | Size: 634 B After Width: | Height: | Size: 680 B |
|
Before Width: | Height: | Size: 776 B After Width: | Height: | Size: 812 B |
|
Before Width: | Height: | Size: 665 B After Width: | Height: | Size: 686 B |
|
Before Width: | Height: | Size: 682 B After Width: | Height: | Size: 741 B |
|
Before Width: | Height: | Size: 683 B After Width: | Height: | Size: 723 B |
|
Before Width: | Height: | Size: 671 B After Width: | Height: | Size: 674 B |
@@ -46,11 +46,11 @@ namespace CalamityMod.Buffs.DamageOverTime
|
||||
|
||||
GeneralParticleHandler.SpawnParticle(new TechyHoloysquareParticle(player.Calamity().RandomDebuffVisualSpot, speed, Main.rand.NextFloat(1.2f, 1.8f), effectcolor, Main.rand.Next(8, 14)));
|
||||
|
||||
int dustType = Main.rand.NextBool() ? 91 : 247;
|
||||
int dustType = Main.rand.NextBool() ? 66 : 247;
|
||||
Dust dust = Dust.NewDustPerfect(player.Calamity().RandomDebuffVisualSpot, dustType);
|
||||
dust.scale = (dustType == 91 ? 1.4f : 1.2f);
|
||||
dust.velocity = (dustType == 247 ? Vector2.Zero : new Vector2(0, Main.rand.NextFloat(-1.5f, 4f)) - player.velocity / 2);
|
||||
dust.noGravity = Main.rand.NextBool(4) && dustType == 91 ? false : true;
|
||||
dust.scale = (dustType == 66 ? 1.4f : 1.2f);
|
||||
dust.velocity = Vector2.Zero + new Vector2(Main.rand.NextFloat(-1, 1), Main.rand.NextFloat(4f, 8f)) - player.velocity / 2;
|
||||
dust.noGravity = true;
|
||||
dust.alpha = Main.rand.Next(90, 150);
|
||||
dust.color = effectcolor;
|
||||
}
|
||||
@@ -71,12 +71,11 @@ namespace CalamityMod.Buffs.DamageOverTime
|
||||
|
||||
GeneralParticleHandler.SpawnParticle(new TechyHoloysquareParticle(npcSize, speed, Main.rand.NextFloat(1.2f, 3.1f), effectcolor, Main.rand.Next(8, 14)));
|
||||
|
||||
int dustType = Main.rand.NextBool() ? 91 : 247;
|
||||
int dustType = Main.rand.NextBool() ? 66 : 247;
|
||||
Dust dust = Dust.NewDustPerfect(npcSize, dustType);
|
||||
dust.scale = (dustType == 91 ? 1.4f : 1.2f);
|
||||
dust.velocity = (dustType == 247 ? Vector2.Zero : new Vector2(0, Main.rand.NextFloat(-1.5f, 4f)) - npc.velocity / 2);
|
||||
dust.noGravity = Main.rand.NextBool(4) && dustType == 91 ? false : true;
|
||||
dust.velocity = Vector2.Zero;
|
||||
dust.scale = (dustType == 66 ? 1.4f : 1.2f);
|
||||
dust.noGravity = true;
|
||||
dust.velocity = Vector2.Zero + new Vector2(Main.rand.NextFloat(-2, 2), Main.rand.NextFloat(2f, 4f)) - npc.velocity / 2;
|
||||
dust.alpha = Main.rand.Next(90, 150);
|
||||
dust.color = effectcolor;
|
||||
}
|
||||
@@ -90,11 +89,11 @@ namespace CalamityMod.Buffs.DamageOverTime
|
||||
_ => Color.Violet,
|
||||
};
|
||||
Vector2 npcSize = npc.Center + new Vector2(Main.rand.NextFloat(-npc.width / 2, npc.width / 2), Main.rand.NextFloat(-npc.height / 2, npc.height / 2));
|
||||
int dustType = Main.rand.NextBool() ? 91 : 247;
|
||||
int dustType = Main.rand.NextBool() ? 66 : 247;
|
||||
Dust dust = Dust.NewDustPerfect(npcSize, dustType);
|
||||
dust.scale = (dustType == 91 ? 0.9f : 1.4f);
|
||||
dust.scale = (dustType == 66 ? 0.9f : 1.4f);
|
||||
dust.noGravity = true;
|
||||
dust.velocity = Vector2.Zero;
|
||||
dust.velocity = Vector2.Zero + new Vector2(Main.rand.NextFloat(-2, 2), Main.rand.NextFloat(2f, 4f));
|
||||
dust.alpha = Main.rand.Next(35, 90);
|
||||
dust.color = effectcolor;
|
||||
}
|
||||
|
||||
@@ -36,37 +36,29 @@ namespace CalamityMod.Buffs.DamageOverTime
|
||||
|
||||
var sparkColor = Main.rand.Next(4) switch
|
||||
{
|
||||
0 => Color.DarkRed,
|
||||
0 => Color.Red,
|
||||
1 => Color.MediumTurquoise,
|
||||
2 => Color.Orange,
|
||||
_ => Color.LawnGreen,
|
||||
};
|
||||
DirectionalPulseRing pulse = new DirectionalPulseRing(Player.Calamity().RandomDebuffVisualSpot, Vector2.Zero, sparkColor, new Vector2(1, 1), 0, Main.rand.NextFloat(0.09f, 0.17f), 0f, 25);
|
||||
GeneralParticleHandler.SpawnParticle(pulse);
|
||||
|
||||
float numberOfDusts = 3f;
|
||||
float rotFactor = 360f / numberOfDusts;
|
||||
if (Player.miscCounter % 4 == 0)
|
||||
if (Main.rand.NextBool(2))
|
||||
{
|
||||
for (int i = 0; i < numberOfDusts; i++)
|
||||
{
|
||||
var DustType = Main.rand.Next(4) switch
|
||||
{
|
||||
0 => 219,
|
||||
1 => 220,
|
||||
2 => 226,
|
||||
_ => 222,
|
||||
};
|
||||
float rot = MathHelper.ToRadians(i * rotFactor);
|
||||
Vector2 offset = new Vector2(0.3f, 0).RotatedBy(rot * Main.rand.NextFloat(0.2f, 0.3f));
|
||||
Vector2 velOffset = CalamityUtils.RandomVelocity(100f, 70f, 150f, 0.04f);
|
||||
Dust dust = Dust.NewDustPerfect(Player.Calamity().RandomDebuffVisualSpot + offset, DustType, new Vector2(velOffset.X, velOffset.Y));
|
||||
dust.noGravity = true;
|
||||
dust.velocity = velOffset;
|
||||
velOffset *= 10;
|
||||
dust.position = Player.Center - velOffset;
|
||||
dust.scale = Main.rand.NextFloat(0.7f, 0.8f);
|
||||
}
|
||||
Dust dust = Dust.NewDustPerfect(Player.Calamity().RandomDebuffVisualSpot, 278, CalamityUtils.RandomVelocity(100f, 70f, 150f, 0.04f));
|
||||
dust.noGravity = true;
|
||||
dust.scale = Main.rand.NextFloat(0.7f, 0.85f);
|
||||
dust.color = sparkColor * 0.45f;
|
||||
}
|
||||
|
||||
float numberOfDusts = 1f;
|
||||
float rotFactor = 360f / numberOfDusts;
|
||||
for (int i = 0; i < numberOfDusts; i++)
|
||||
{
|
||||
float rot = MathHelper.ToRadians(i * rotFactor);
|
||||
Vector2 velOffset = CalamityUtils.RandomVelocity(100f, 70f, 150f, 0.04f);
|
||||
velOffset *= Main.rand.NextFloat(2, 13);
|
||||
SquishyLightParticle exoEnergy = new(Player.Center + Player.velocity * 3 + velOffset * 1.5f, -velOffset * 0.25f, 0.3f, sparkColor, 8);
|
||||
GeneralParticleHandler.SpawnParticle(exoEnergy);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,36 +67,31 @@ namespace CalamityMod.Buffs.DamageOverTime
|
||||
Vector2 npcSize = npc.Center + new Vector2(Main.rand.NextFloat(-npc.width / 2, npc.width / 2), Main.rand.NextFloat(-npc.height / 2, npc.height / 2));
|
||||
var sparkColor = Main.rand.Next(4) switch
|
||||
{
|
||||
0 => Color.DarkRed,
|
||||
0 => Color.Red,
|
||||
1 => Color.MediumTurquoise,
|
||||
2 => Color.Orange,
|
||||
_ => Color.LawnGreen,
|
||||
};
|
||||
DirectionalPulseRing pulse = new DirectionalPulseRing(npcSize, Vector2.Zero, sparkColor, new Vector2(1, 1), 0, 0.18f + (0.0000007f * npc.width * npc.height), 0f, 25);
|
||||
GeneralParticleHandler.SpawnParticle(pulse);
|
||||
|
||||
float numberOfDusts = 2f;
|
||||
float rotFactor = 360f / numberOfDusts;
|
||||
if (Main.rand.NextBool(3))
|
||||
{
|
||||
Dust dust = Dust.NewDustPerfect(npcSize, 278, CalamityUtils.RandomVelocity(100f, 70f, 150f, 0.04f));
|
||||
dust.noGravity = true;
|
||||
dust.scale = Main.rand.NextFloat(0.7f, 0.85f) + (0.0000007f * npc.width * npc.height);
|
||||
dust.color = sparkColor * 0.45f;
|
||||
}
|
||||
|
||||
float numberOfDusts = 1f;
|
||||
float rotFactor = 360f / numberOfDusts;
|
||||
if (Main.rand.NextBool())
|
||||
{
|
||||
for (int i = 0; i < numberOfDusts; i++)
|
||||
{
|
||||
var DustType = Main.rand.Next(4) switch
|
||||
{
|
||||
0 => 219,
|
||||
1 => 220,
|
||||
2 => 226,
|
||||
_ => 222,
|
||||
};
|
||||
float rot = MathHelper.ToRadians(i * rotFactor);
|
||||
Vector2 offset = new Vector2(0.3f, 0).RotatedBy(rot * Main.rand.NextFloat(0.2f, 0.3f));
|
||||
Vector2 velOffset = CalamityUtils.RandomVelocity(100f, 70f, 150f, 0.04f);
|
||||
Dust dust = Dust.NewDustPerfect(npc.Center + offset, DustType, new Vector2(velOffset.X, velOffset.Y));
|
||||
dust.noGravity = true;
|
||||
dust.velocity = velOffset;
|
||||
velOffset *= 10 + (0.0003f * npc.width * npc.height);
|
||||
dust.position = npc.Center - velOffset;
|
||||
dust.scale = Main.rand.NextFloat(0.7f, 0.8f);
|
||||
velOffset *= Main.rand.NextFloat(1, 9) + (0.0002f * npc.width * npc.height);
|
||||
SquishyLightParticle exoEnergy = new(npc.Center + npc.velocity * 3 + velOffset * 1.5f, -velOffset * 0.25f, 0.3f, sparkColor, 8);
|
||||
GeneralParticleHandler.SpawnParticle(exoEnergy);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 490 B After Width: | Height: | Size: 575 B |
|
Before Width: | Height: | Size: 570 B After Width: | Height: | Size: 562 B |
|
Before Width: | Height: | Size: 591 B After Width: | Height: | Size: 535 B |
|
Before Width: | Height: | Size: 550 B After Width: | Height: | Size: 587 B |
@@ -178,6 +178,12 @@ namespace CalamityMod.CalPlayer
|
||||
|
||||
#region Timer and Counter
|
||||
public int gaelSwipes = 0;
|
||||
public int dragoonDrizzlefishGelBoost = 1;
|
||||
public int deadSunCounter = 6;
|
||||
public int DragonsBreathAudioCooldown = 0;
|
||||
public int DragonsBreathAudioCooldown2 = 0;
|
||||
public int PhotoAudioCooldown = 0;
|
||||
public int PhotoTimer = 90;
|
||||
public bool brittleStarBuffMode = false;
|
||||
public bool sBlasterDashActivated = false;
|
||||
public int saharaSlicersBolts = 0;
|
||||
@@ -2779,22 +2785,22 @@ namespace CalamityMod.CalPlayer
|
||||
brimflameFrenzy = true;
|
||||
Player.AddBuff(ModContent.BuffType<BrimflameFrenzyBuff>(), 10 * 60, true);
|
||||
SoundEngine.PlaySound(BrimflameScowl.ActivationSound, Player.Center);
|
||||
for (int num502 = 0; num502 < 36; num502++)
|
||||
for (int i = 0; i < 36; i++)
|
||||
{
|
||||
int dust = Dust.NewDust(new Vector2(Player.position.X, Player.position.Y + 16f), Player.width, Player.height - 16, (int)CalamityDusts.Brimstone, 0f, 0f, 0, default, 1f);
|
||||
Main.dust[dust].velocity *= 3f;
|
||||
Main.dust[dust].scale *= 1.15f;
|
||||
int brimDust = Dust.NewDust(new Vector2(Player.position.X, Player.position.Y + 16f), Player.width, Player.height - 16, (int)CalamityDusts.Brimstone, 0f, 0f, 0, default, 1f);
|
||||
Main.dust[brimDust].velocity *= 3f;
|
||||
Main.dust[brimDust].scale *= 1.15f;
|
||||
}
|
||||
int num226 = 36;
|
||||
for (int num227 = 0; num227 < num226; num227++)
|
||||
int dustAmt = 36;
|
||||
for (int j = 0; j < dustAmt; j++)
|
||||
{
|
||||
Vector2 vector6 = Vector2.Normalize(Player.velocity) * new Vector2((float)Player.width / 2f, (float)Player.height) * 0.75f;
|
||||
vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * MathHelper.TwoPi / (float)num226), default) + Player.Center;
|
||||
Vector2 vector7 = vector6 - Player.Center;
|
||||
int num228 = Dust.NewDust(vector6 + vector7, 0, 0, (int)CalamityDusts.Brimstone, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default, 1.4f);
|
||||
Main.dust[num228].noGravity = true;
|
||||
Main.dust[num228].noLight = true;
|
||||
Main.dust[num228].velocity = vector7;
|
||||
Vector2 dustRotation = Vector2.Normalize(Player.velocity) * new Vector2((float)Player.width / 2f, (float)Player.height) * 0.75f;
|
||||
dustRotation = dustRotation.RotatedBy((double)((float)(j - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + Player.Center;
|
||||
Vector2 dustVelocity = dustRotation - Player.Center;
|
||||
int brimDust2 = Dust.NewDust(dustRotation + dustVelocity, 0, 0, (int)CalamityDusts.Brimstone, dustVelocity.X * 1.5f, dustVelocity.Y * 1.5f, 100, default, 1.4f);
|
||||
Main.dust[brimDust2].noGravity = true;
|
||||
Main.dust[brimDust2].noLight = true;
|
||||
Main.dust[brimDust2].velocity = dustVelocity;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2873,22 +2879,22 @@ namespace CalamityMod.CalPlayer
|
||||
if (dsSetBonus)
|
||||
{
|
||||
SoundEngine.PlaySound(DemonshadeHelm.ActivationSound, Player.Center);
|
||||
for (int num502 = 0; num502 < 36; num502++)
|
||||
for (int i = 0; i < 36; i++)
|
||||
{
|
||||
int dust = Dust.NewDust(new Vector2(Player.position.X, Player.position.Y + 16f), Player.width, Player.height - 16, (int)CalamityDusts.Brimstone, 0f, 0f, 0, default, 1f);
|
||||
Main.dust[dust].velocity *= 3f;
|
||||
Main.dust[dust].scale *= 1.15f;
|
||||
int brimDust = Dust.NewDust(new Vector2(Player.position.X, Player.position.Y + 16f), Player.width, Player.height - 16, (int)CalamityDusts.Brimstone, 0f, 0f, 0, default, 1f);
|
||||
Main.dust[brimDust].velocity *= 3f;
|
||||
Main.dust[brimDust].scale *= 1.15f;
|
||||
}
|
||||
int num226 = 36;
|
||||
for (int num227 = 0; num227 < num226; num227++)
|
||||
int dustAmt = 36;
|
||||
for (int j = 0; j < dustAmt; j++)
|
||||
{
|
||||
Vector2 vector6 = Vector2.Normalize(Player.velocity) * new Vector2((float)Player.width / 2f, (float)Player.height) * 0.75f;
|
||||
vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * MathHelper.TwoPi / (float)num226), default) + Player.Center;
|
||||
Vector2 vector7 = vector6 - Player.Center;
|
||||
int num228 = Dust.NewDust(vector6 + vector7, 0, 0, (int)CalamityDusts.Brimstone, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default, 1.4f);
|
||||
Main.dust[num228].noGravity = true;
|
||||
Main.dust[num228].noLight = true;
|
||||
Main.dust[num228].velocity = vector7;
|
||||
Vector2 dustRotation = Vector2.Normalize(Player.velocity) * new Vector2((float)Player.width / 2f, (float)Player.height) * 0.75f;
|
||||
dustRotation = dustRotation.RotatedBy((double)((float)(j - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + Player.Center;
|
||||
Vector2 dustVelocity = dustRotation - Player.Center;
|
||||
int brimDust2 = Dust.NewDust(dustRotation + dustVelocity, 0, 0, (int)CalamityDusts.Brimstone, dustVelocity.X * 1.5f, dustVelocity.Y * 1.5f, 100, default, 1.4f);
|
||||
Main.dust[brimDust2].noGravity = true;
|
||||
Main.dust[brimDust2].noLight = true;
|
||||
Main.dust[brimDust2].velocity = dustVelocity;
|
||||
}
|
||||
if (Player.whoAmI == Main.myPlayer)
|
||||
{
|
||||
@@ -3142,9 +3148,9 @@ namespace CalamityMod.CalPlayer
|
||||
public static Vector2? GetUnderworldPosition(Player player)
|
||||
{
|
||||
bool canSpawn = false;
|
||||
int num = Main.maxTilesX / 2;
|
||||
int num2 = 100;
|
||||
int num3 = num2 / 2;
|
||||
int halfWorldXTiles = Main.maxTilesX / 2;
|
||||
int largerCheckRadius = 100;
|
||||
int smallerCheckRadius = 50;
|
||||
int teleportStartY = Main.UnderworldLayer + 20;
|
||||
int teleportRangeY = 80;
|
||||
Player.RandomTeleportationAttemptSettings settings = new Player.RandomTeleportationAttemptSettings
|
||||
@@ -3158,12 +3164,12 @@ namespace CalamityMod.CalPlayer
|
||||
maximumFallDistanceFromOrignalPoint = 30
|
||||
};
|
||||
|
||||
Vector2 vector = player.CheckForGoodTeleportationSpot(ref canSpawn, num - num3, num2, teleportStartY, teleportRangeY, settings);
|
||||
Vector2 vector = player.CheckForGoodTeleportationSpot(ref canSpawn, halfWorldXTiles - smallerCheckRadius, largerCheckRadius, teleportStartY, teleportRangeY, settings);
|
||||
if (!canSpawn)
|
||||
vector = player.CheckForGoodTeleportationSpot(ref canSpawn, num - num2, num3, teleportStartY, teleportRangeY, settings);
|
||||
vector = player.CheckForGoodTeleportationSpot(ref canSpawn, halfWorldXTiles - largerCheckRadius, smallerCheckRadius, teleportStartY, teleportRangeY, settings);
|
||||
|
||||
if (!canSpawn)
|
||||
vector = player.CheckForGoodTeleportationSpot(ref canSpawn, num + num3, num3, teleportStartY, teleportRangeY, settings);
|
||||
vector = player.CheckForGoodTeleportationSpot(ref canSpawn, halfWorldXTiles + smallerCheckRadius, smallerCheckRadius, teleportStartY, teleportRangeY, settings);
|
||||
|
||||
if (canSpawn)
|
||||
{
|
||||
@@ -3901,46 +3907,46 @@ namespace CalamityMod.CalPlayer
|
||||
{
|
||||
if (!CalamityLists.VeneratedLocketBanlist.Contains(item.type))
|
||||
{
|
||||
float num72 = item.shootSpeed;
|
||||
Vector2 vector2 = Player.RotatedRelativePoint(Player.MountedCenter, true);
|
||||
float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X;
|
||||
float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y;
|
||||
float veneratedCloneSpeed = item.shootSpeed;
|
||||
Vector2 realPlayerPos = Player.RotatedRelativePoint(Player.MountedCenter, true);
|
||||
float veneratedCloneXPos = (float)Main.mouseX + Main.screenPosition.X - realPlayerPos.X;
|
||||
float veneratedCloneYPos = (float)Main.mouseY + Main.screenPosition.Y - realPlayerPos.Y;
|
||||
if (Player.gravDir == -1f)
|
||||
{
|
||||
num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y;
|
||||
veneratedCloneYPos = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - realPlayerPos.Y;
|
||||
}
|
||||
float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79));
|
||||
if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f))
|
||||
float veneratedCloneDistance = (float)Math.Sqrt((double)(veneratedCloneXPos * veneratedCloneXPos + veneratedCloneYPos * veneratedCloneYPos));
|
||||
if ((float.IsNaN(veneratedCloneXPos) && float.IsNaN(veneratedCloneYPos)) || (veneratedCloneXPos == 0f && veneratedCloneYPos == 0f))
|
||||
{
|
||||
num78 = (float)Player.direction;
|
||||
num79 = 0f;
|
||||
num80 = num72;
|
||||
veneratedCloneXPos = (float)Player.direction;
|
||||
veneratedCloneYPos = 0f;
|
||||
veneratedCloneDistance = veneratedCloneSpeed;
|
||||
}
|
||||
else
|
||||
{
|
||||
num80 = num72 / num80;
|
||||
veneratedCloneDistance = veneratedCloneSpeed / veneratedCloneDistance;
|
||||
}
|
||||
|
||||
vector2 = new Vector2(Player.position.X + (float)Player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)Player.direction) + ((float)Main.mouseX + Main.screenPosition.X - Player.position.X), Player.MountedCenter.Y - 600f);
|
||||
vector2.X = (vector2.X + Player.Center.X) / 2f + (float)Main.rand.Next(-200, 201);
|
||||
vector2.Y -= 100f;
|
||||
num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X;
|
||||
num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y;
|
||||
if (num79 < 0f)
|
||||
realPlayerPos = new Vector2(Player.position.X + (float)Player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)Player.direction) + ((float)Main.mouseX + Main.screenPosition.X - Player.position.X), Player.MountedCenter.Y - 600f);
|
||||
realPlayerPos.X = (realPlayerPos.X + Player.Center.X) / 2f + (float)Main.rand.Next(-200, 201);
|
||||
realPlayerPos.Y -= 100f;
|
||||
veneratedCloneXPos = (float)Main.mouseX + Main.screenPosition.X - realPlayerPos.X;
|
||||
veneratedCloneYPos = (float)Main.mouseY + Main.screenPosition.Y - realPlayerPos.Y;
|
||||
if (veneratedCloneYPos < 0f)
|
||||
{
|
||||
num79 *= -1f;
|
||||
veneratedCloneYPos *= -1f;
|
||||
}
|
||||
if (num79 < 20f)
|
||||
if (veneratedCloneYPos < 20f)
|
||||
{
|
||||
num79 = 20f;
|
||||
veneratedCloneYPos = 20f;
|
||||
}
|
||||
num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79));
|
||||
num80 = num72 / num80;
|
||||
num78 *= num80;
|
||||
num79 *= num80;
|
||||
float speedX4 = num78 + (float)Main.rand.Next(-30, 31) * 0.02f;
|
||||
float speedY5 = num79 + (float)Main.rand.Next(-30, 31) * 0.02f;
|
||||
int p = Projectile.NewProjectile(source, vector2.X, vector2.Y, speedX4, speedY5, type, (int)(damage * 0.07), knockBack * 0.5f, Player.whoAmI);
|
||||
veneratedCloneDistance = (float)Math.Sqrt((double)(veneratedCloneXPos * veneratedCloneXPos + veneratedCloneYPos * veneratedCloneYPos));
|
||||
veneratedCloneDistance = veneratedCloneSpeed / veneratedCloneDistance;
|
||||
veneratedCloneXPos *= veneratedCloneDistance;
|
||||
veneratedCloneYPos *= veneratedCloneDistance;
|
||||
float speedX4 = veneratedCloneXPos + (float)Main.rand.Next(-30, 31) * 0.02f;
|
||||
float speedY5 = veneratedCloneYPos + (float)Main.rand.Next(-30, 31) * 0.02f;
|
||||
int p = Projectile.NewProjectile(source, realPlayerPos.X, realPlayerPos.Y, speedX4, speedY5, type, (int)(damage * 0.07), knockBack * 0.5f, Player.whoAmI);
|
||||
|
||||
if (p.WithinBounds(Main.maxProjectiles))
|
||||
{
|
||||
|
||||
@@ -475,10 +475,8 @@ namespace CalamityMod.CalPlayer
|
||||
|
||||
SpriteEffects spriteEffects = Player.direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
|
||||
|
||||
float num25 = -4f;
|
||||
float num24 = -8f;
|
||||
DrawData howDoIDrawThings = new DrawData(thingToDraw,
|
||||
new Vector2((int)(drawPlayer.position.X - Main.screenPosition.X + (drawPlayer.width / 2) - (9 * drawPlayer.direction)) + num25 * drawPlayer.direction, (int)(drawPlayer.position.Y - Main.screenPosition.Y + (drawPlayer.height / 2) + 2f * drawPlayer.gravDir + num24 * drawPlayer.gravDir)),
|
||||
new Vector2((int)(drawPlayer.position.X - Main.screenPosition.X + (drawPlayer.width / 2) - (9 * drawPlayer.direction)) - 4f * drawPlayer.direction, (int)(drawPlayer.position.Y - Main.screenPosition.Y + (drawPlayer.height / 2) + 2f * drawPlayer.gravDir - 8f * drawPlayer.gravDir)),
|
||||
new Rectangle(0, 0, thingToDraw.Width, thingToDraw.Height),
|
||||
drawInfo.colorArmorBody,
|
||||
drawPlayer.bodyRotation,
|
||||
|
||||
@@ -119,8 +119,8 @@ namespace CalamityMod.CalPlayer
|
||||
|
||||
for (int j = 0; j < 100; j++)
|
||||
{
|
||||
int num = Dust.NewDust(Player.position, Player.width, Player.height, 235, 0f, 0f, 100, default, 2f);
|
||||
Dust dust = Main.dust[num];
|
||||
int scarfDodgeDust = Dust.NewDust(Player.position, Player.width, Player.height, 235, 0f, 0f, 100, default, 2f);
|
||||
Dust dust = Main.dust[scarfDodgeDust];
|
||||
dust.position.X += Main.rand.Next(-20, 21);
|
||||
dust.position.Y += Main.rand.Next(-20, 21);
|
||||
dust.velocity *= 0.4f;
|
||||
@@ -233,8 +233,8 @@ namespace CalamityMod.CalPlayer
|
||||
|
||||
for (int j = 0; j < 50; j++)
|
||||
{
|
||||
int num = Dust.NewDust(Player.position, Player.width, Player.height, 173, 0f, 0f, 100, default, 2f);
|
||||
Dust dust = Main.dust[num];
|
||||
int nebulousReviveDust = Dust.NewDust(Player.position, Player.width, Player.height, 173, 0f, 0f, 100, default, 2f);
|
||||
Dust dust = Main.dust[nebulousReviveDust];
|
||||
dust.position.X += Main.rand.Next(-20, 21);
|
||||
dust.position.Y += Main.rand.Next(-20, 21);
|
||||
dust.velocity *= 0.9f;
|
||||
@@ -2585,18 +2585,18 @@ namespace CalamityMod.CalPlayer
|
||||
{
|
||||
if (Player.inventory[i].stack > 0 && ((Player.inventory[i].type >= ItemID.LargeAmethyst && Player.inventory[i].type <= ItemID.LargeDiamond) || Player.inventory[i].type == ItemID.LargeAmber))
|
||||
{
|
||||
int num = Item.NewItem(source, (int)Player.position.X, (int)Player.position.Y, Player.width, Player.height, Player.inventory[i].type, 1, false, 0, false, false);
|
||||
Main.item[num].netDefaults(Player.inventory[i].netID);
|
||||
Main.item[num].Prefix((int)Player.inventory[i].prefix);
|
||||
Main.item[num].stack = Player.inventory[i].stack;
|
||||
Main.item[num].velocity.Y = (float)Main.rand.Next(-20, 1) * 0.2f;
|
||||
Main.item[num].velocity.X = (float)Main.rand.Next(-20, 21) * 0.2f;
|
||||
Main.item[num].noGrabDelay = 100;
|
||||
Main.item[num].favorited = false;
|
||||
Main.item[num].newAndShiny = false;
|
||||
int droppedLargeGem = Item.NewItem(source, (int)Player.position.X, (int)Player.position.Y, Player.width, Player.height, Player.inventory[i].type, 1, false, 0, false, false);
|
||||
Main.item[droppedLargeGem].netDefaults(Player.inventory[i].netID);
|
||||
Main.item[droppedLargeGem].Prefix((int)Player.inventory[i].prefix);
|
||||
Main.item[droppedLargeGem].stack = Player.inventory[i].stack;
|
||||
Main.item[droppedLargeGem].velocity.Y = (float)Main.rand.Next(-20, 1) * 0.2f;
|
||||
Main.item[droppedLargeGem].velocity.X = (float)Main.rand.Next(-20, 21) * 0.2f;
|
||||
Main.item[droppedLargeGem].noGrabDelay = 100;
|
||||
Main.item[droppedLargeGem].favorited = false;
|
||||
Main.item[droppedLargeGem].newAndShiny = false;
|
||||
if (Main.netMode == NetmodeID.MultiplayerClient)
|
||||
{
|
||||
NetMessage.SendData(MessageID.SyncItem, -1, -1, null, num, 0f, 0f, 0f, 0, 0, 0);
|
||||
NetMessage.SendData(MessageID.SyncItem, -1, -1, null, droppedLargeGem, 0f, 0f, 0f, 0, 0, 0);
|
||||
}
|
||||
Player.inventory[i].SetDefaults(0, false);
|
||||
}
|
||||
|
||||
@@ -232,12 +232,14 @@ namespace CalamityMod.CalPlayer
|
||||
|
||||
if (lAmbergris)
|
||||
{
|
||||
if (Player.miscCounter % 3 == 2 && Player.dashDelay > 0) // Reduced dash cooldown by 33%
|
||||
Player.dashDelay--;
|
||||
|
||||
if (Player.dashDelay == -1)// TODO: prevent working with special dashes, this was inconsitent with my old solution so I didn't keep it. not huge deal)
|
||||
{
|
||||
Player.endurance += 0.05f;
|
||||
if (!HasIncreasedDashFirstFrame)
|
||||
{
|
||||
Player.velocity.X *= 1.15f;
|
||||
Player.velocity.X *= 1.2f;
|
||||
Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center + Player.velocity * 1.5f, Vector2.Zero, ModContent.ProjectileType<LeviAmberDash>(), 75, 20f, Player.whoAmI);
|
||||
HasIncreasedDashFirstFrame = true;
|
||||
}
|
||||
@@ -258,10 +260,10 @@ namespace CalamityMod.CalPlayer
|
||||
{
|
||||
float sparkscale = (Player.velocity.X * Player.direction * 0.07f);
|
||||
Vector2 SparkVelocity1 = Player.velocity.RotatedBy(Player.direction * 2, default) * 0.1f - Player.velocity / 2f;
|
||||
SparkParticle spark = new SparkParticle(Player.Center + Player.velocity.RotatedBy(2f * Player.direction) * 1.5f, SparkVelocity1, false, Main.rand.Next(11, 13), sparkscale, Main.rand.NextBool() ? Color.DarkTurquoise : Color.DodgerBlue);
|
||||
LineParticle spark = new LineParticle(Player.Center + Player.velocity.RotatedBy(2f * Player.direction) * 1.5f, SparkVelocity1, false, Main.rand.Next(11, 13), sparkscale, Main.rand.NextBool() ? Color.DarkTurquoise : Color.DodgerBlue);
|
||||
GeneralParticleHandler.SpawnParticle(spark);
|
||||
Vector2 SparkVelocity2 = Player.velocity.RotatedBy(Player.direction * -2, default) * 0.1f - Player.velocity / 2f;
|
||||
SparkParticle spark2 = new SparkParticle(Player.Center + Player.velocity.RotatedBy(-2f * Player.direction) * 1.5f, SparkVelocity2, false, Main.rand.Next(11, 13), sparkscale, Main.rand.NextBool() ? Color.DarkTurquoise : Color.DodgerBlue);
|
||||
LineParticle spark2 = new LineParticle(Player.Center + Player.velocity.RotatedBy(-2f * Player.direction) * 1.5f, SparkVelocity2, false, Main.rand.Next(11, 13), sparkscale, Main.rand.NextBool() ? Color.DarkTurquoise : Color.DodgerBlue);
|
||||
GeneralParticleHandler.SpawnParticle(spark2);
|
||||
}
|
||||
if (Player.miscCounter % 4 == 0 && Player.velocity != Vector2.Zero) //every other frame spawn the hitbox
|
||||
@@ -275,7 +277,7 @@ namespace CalamityMod.CalPlayer
|
||||
{
|
||||
if (Player.dashDelay == -1)// TODO: prevent working with special dashes, this was inconsitent with my old solution so I didn't keep it. not huge deal)
|
||||
{
|
||||
Player.endurance += 0.05f;
|
||||
Player.endurance += 0.1f;
|
||||
if (!HasReducedDashFirstFrame) // Dash isn't reduced, this is used to determine the first frame of dashing
|
||||
{
|
||||
SoundEngine.PlaySound(SoundID.DD2_BetsyFireballImpact with { Volume = 0.4f , PitchVariance = 0.4f }, Player.Center);
|
||||
@@ -1183,7 +1185,7 @@ namespace CalamityMod.CalPlayer
|
||||
Vector2 dustLineEnd = Player.Center;
|
||||
Vector2 currentDustPos = default;
|
||||
Vector2 spinningpoint = new Vector2(0f, -3f).RotatedByRandom(MathHelper.Pi);
|
||||
Vector2 value5 = new Vector2(2.1f, 2f);
|
||||
Vector2 healerDustVel = new Vector2(2.1f, 2f);
|
||||
Color dustColor = Main.hslToRgb(Main.rgbToHsl(new Color(255, 200, Main.DiscoB)).X, 1f, 0.5f);
|
||||
dustColor.A = 255;
|
||||
for (int i = 0; i < maxHealDustIterations; i++)
|
||||
@@ -1191,18 +1193,18 @@ namespace CalamityMod.CalPlayer
|
||||
if (i % dustDivisor == 0)
|
||||
{
|
||||
currentDustPos = Vector2.Lerp(dustLineStart, dustLineEnd, i / (float)maxHealDustIterations);
|
||||
int dust = Dust.NewDust(currentDustPos, 0, 0, 267, 0f, 0f, 0, dustColor, 1f);
|
||||
Main.dust[dust].position = currentDustPos;
|
||||
Main.dust[dust].velocity = spinningpoint.RotatedBy(MathHelper.TwoPi * i / maxHealDustIterations) * value5 * (0.8f + Main.rand.NextFloat() * 0.4f) + Player.velocity;
|
||||
Main.dust[dust].noGravity = true;
|
||||
Main.dust[dust].scale = 1f;
|
||||
Main.dust[dust].fadeIn = Main.rand.NextFloat() * 2f;
|
||||
Dust dust2 = Dust.CloneDust(dust);
|
||||
Dust dust3 = dust2;
|
||||
dust3.scale /= 2f;
|
||||
dust3 = dust2;
|
||||
dust3.fadeIn /= 2f;
|
||||
dust2.color = new Color(255, 255, 255, 255);
|
||||
int holyDust = Dust.NewDust(currentDustPos, 0, 0, 267, 0f, 0f, 0, dustColor, 1f);
|
||||
Main.dust[holyDust].position = currentDustPos;
|
||||
Main.dust[holyDust].velocity = spinningpoint.RotatedBy(MathHelper.TwoPi * i / maxHealDustIterations) * healerDustVel * (0.8f + Main.rand.NextFloat() * 0.4f) + Player.velocity;
|
||||
Main.dust[holyDust].noGravity = true;
|
||||
Main.dust[holyDust].scale = 1f;
|
||||
Main.dust[holyDust].fadeIn = Main.rand.NextFloat() * 2f;
|
||||
Dust dustClone = Dust.CloneDust(holyDust);
|
||||
Dust extraDust = dustClone;
|
||||
extraDust.scale /= 2f;
|
||||
extraDust = dustClone;
|
||||
extraDust.fadeIn /= 2f;
|
||||
dustClone.color = new Color(255, 255, 255, 255);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1310,6 +1312,12 @@ namespace CalamityMod.CalPlayer
|
||||
if (expiredCooldowns.Count > 0)
|
||||
SyncCooldownRemoval(Main.netMode == NetmodeID.Server, expiredCooldowns);
|
||||
|
||||
if (DragonsBreathAudioCooldown > 0)
|
||||
DragonsBreathAudioCooldown--;
|
||||
if (DragonsBreathAudioCooldown2 > 0)
|
||||
DragonsBreathAudioCooldown2--;
|
||||
if (PhotoAudioCooldown > 0)
|
||||
PhotoAudioCooldown--;
|
||||
if (fullRageSoundCountdownTimer > 0)
|
||||
--fullRageSoundCountdownTimer;
|
||||
if (plagueTaintedSMGDroneCooldown > 0)
|
||||
|
||||
@@ -713,7 +713,8 @@ namespace CalamityMod
|
||||
"Spirit Shield",
|
||||
"Briny_Coffee",
|
||||
"_Skeggy_",
|
||||
"just akkolite"
|
||||
"just akkolite",
|
||||
"J.U.N.E.S",
|
||||
};
|
||||
|
||||
projectileDestroyExceptionList = new List<int>()
|
||||
|
||||
@@ -49,7 +49,6 @@ using CalamityMod.NPCs.StormWeaver;
|
||||
using CalamityMod.NPCs.SupremeCalamitas;
|
||||
using CalamityMod.NPCs.Yharon;
|
||||
using CalamityMod.Particles;
|
||||
using CalamityMod.Particles.Metaballs;
|
||||
using CalamityMod.Projectiles;
|
||||
using CalamityMod.Projectiles.BaseProjectiles;
|
||||
using CalamityMod.Schematics;
|
||||
@@ -345,7 +344,6 @@ namespace CalamityMod
|
||||
// However, render targets and certain other graphical objects can only be created on the main thread.
|
||||
Main.QueueMainThreadAction(() =>
|
||||
{
|
||||
FusableParticleManager.LoadParticleRenderSets();
|
||||
Main.OnPreDraw += PrepareRenderTargets;
|
||||
});
|
||||
|
||||
@@ -376,7 +374,7 @@ namespace CalamityMod
|
||||
GameShaders.Hair.BindShader(ModContent.ItemType<AdrenalineHairDye>(), new LegacyHairShaderData().UseLegacyMethod((Player player, Color newColor, ref bool lighting) => Color.Lerp(player.hairColor, new Color(0, 255, 171), ((float)player.Calamity().adrenaline / (float)player.Calamity().adrenalineMax))));
|
||||
GameShaders.Hair.BindShader(ModContent.ItemType<RageHairDye>(), new LegacyHairShaderData().UseLegacyMethod((Player player, Color newColor, ref bool lighting) => Color.Lerp(player.hairColor, new Color(255, 83, 48), ((float)player.Calamity().rage / (float)player.Calamity().rageMax))));
|
||||
GameShaders.Hair.BindShader(ModContent.ItemType<WingTimeHairDye>(), new LegacyHairShaderData().UseLegacyMethod((Player player, Color newColor, ref bool lighting) =>
|
||||
{
|
||||
{
|
||||
float flightTimeInterpolant = player.wingTime / player.wingTimeMax;
|
||||
if (player.mount.Active)
|
||||
flightTimeInterpolant = 1f;
|
||||
@@ -449,7 +447,6 @@ namespace CalamityMod
|
||||
|
||||
Main.QueueMainThreadAction(() =>
|
||||
{
|
||||
FusableParticleManager.UnloadParticleRenderSets();
|
||||
Main.OnPreDraw -= PrepareRenderTargets;
|
||||
});
|
||||
|
||||
@@ -499,7 +496,6 @@ namespace CalamityMod
|
||||
|
||||
public static void PrepareRenderTargets(GameTime gameTime)
|
||||
{
|
||||
FusableParticleManager.PrepareFusableParticleTargets();
|
||||
DeathAshParticle.PrepareRenderTargets();
|
||||
FluidFieldManager.Update();
|
||||
}
|
||||
@@ -517,7 +513,8 @@ namespace CalamityMod
|
||||
saveMethodInfo.Invoke(null, new object[] { cfg });
|
||||
else
|
||||
Instance.Logger.Error("TML ConfigManager.Save reflection failed. Method signature has changed. Notify Calamity Devs if you see this in your log.");
|
||||
} catch
|
||||
}
|
||||
catch
|
||||
{
|
||||
Instance.Logger.Error("An error occurred while manually saving Calamity mod configuration. This may be due to a complex mod conflict. It is safe to ignore this error.");
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using CalamityMod.Skies;
|
||||
using Iced.Intel;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Content;
|
||||
using Terraria;
|
||||
@@ -124,14 +123,14 @@ namespace CalamityMod.Effects
|
||||
// Used by Devourer of Gods. Renders the portal that he escapes through at the end of phase 1.
|
||||
internal static Effect DoGPortalShader;
|
||||
|
||||
// Fusable particles. See the FusableParticleManager for comments on how this system works.
|
||||
// These shaders are leveraged to render the results of the fusable particle simulation to the screen.
|
||||
// Metaballs. See the MetaballManager class for comments on how this system works.
|
||||
// These shaders are leveraged to render the results of the metaball simulation to the screen.
|
||||
// The "Base" shader draws the particles themselves.
|
||||
// The "Additive" shader actually FUSES the particles into their blobby mess.
|
||||
//
|
||||
// Backing textures vary. The primary use of this system is Gruesome Eminence.
|
||||
internal static Effect BaseFusableParticleEdgeShader;
|
||||
internal static Effect AdditiveFusableParticleEdgeShader;
|
||||
internal static Effect MetaballEdgeShader;
|
||||
internal static Effect AdditiveMetaballEdgeShader;
|
||||
|
||||
// Used to render the results of Navier-Stokes fluid simulations.
|
||||
internal static Effect FluidShaders;
|
||||
@@ -178,7 +177,7 @@ namespace CalamityMod.Effects
|
||||
internal static Effect CircularGradientWithEdge;
|
||||
internal static Effect WavyOpacity;
|
||||
#endregion
|
||||
|
||||
|
||||
//
|
||||
// All below shaders were added by Amber
|
||||
// Authorship goes to Toasty
|
||||
@@ -187,7 +186,7 @@ namespace CalamityMod.Effects
|
||||
#region Amber's Shaders
|
||||
internal static Effect PrimitiveClearShader;
|
||||
#endregion
|
||||
|
||||
|
||||
// Shorthand to register a loaded shader in Terraria's graphics engine
|
||||
// All shaders registered this way are accessible under GameShaders.Misc
|
||||
// They will use the prefix described above
|
||||
@@ -340,11 +339,11 @@ namespace CalamityMod.Effects
|
||||
RegisterMiscShader(DoGPortalShader, "ScreenPass", "DoGPortal");
|
||||
|
||||
// These two shaders are often (but not always) used together.
|
||||
BaseFusableParticleEdgeShader = LoadShader("ParticleFusion/BaseFusableParticleEdgeShader");
|
||||
RegisterMiscShader(BaseFusableParticleEdgeShader, "ParticlePass", "BaseFusableParticleEdge");
|
||||
MetaballEdgeShader = LoadShader("Metaballs/MetaballEdgeShader");
|
||||
RegisterMiscShader(MetaballEdgeShader, "ParticlePass", "MetaballEdge");
|
||||
|
||||
AdditiveFusableParticleEdgeShader = LoadShader("ParticleFusion/AdditiveFusableParticleEdgeShader");
|
||||
RegisterMiscShader(AdditiveFusableParticleEdgeShader, "ParticlePass", "AdditiveFusableParticleEdge");
|
||||
AdditiveMetaballEdgeShader = LoadShader("Metaballs/AdditiveMetaballEdgeShader");
|
||||
RegisterMiscShader(AdditiveMetaballEdgeShader, "ParticlePass", "AdditiveMetaballEdge");
|
||||
|
||||
// This shader is not registered with the game but is invoked directly to render the results of fluid simulation.
|
||||
FluidShaders = LoadShader("FluidShaders");
|
||||
|
||||
@@ -12,25 +12,16 @@ float uDirection;
|
||||
float3 uLightSource;
|
||||
float2 uImageSize0;
|
||||
float2 uImageSize1;
|
||||
float edgeBorderSize;
|
||||
bool borderShouldBeSolid;
|
||||
float3 edgeBorderColor;
|
||||
float2 screenArea;
|
||||
float2 renderTargetArea;
|
||||
float2 screenMoveOffset;
|
||||
float2 generalBackgroundOffset;
|
||||
bool invertedScreen;
|
||||
float2 upscaleFactor;
|
||||
float4 uShaderSpecificData;
|
||||
|
||||
float2 screenArea;
|
||||
float2 layerOffset;
|
||||
float2 singleFrameScreenOffset;
|
||||
|
||||
float4 PixelShaderFunction(float4 sampleColor : TEXCOORD, float2 coords : TEXCOORD0) : COLOR0
|
||||
{
|
||||
float2 originalCoords = coords;
|
||||
if (invertedScreen)
|
||||
coords.y = 1 - coords.y;
|
||||
|
||||
// Account for screen movements. Not doing this causes the scene to move based on that.
|
||||
coords += screenMoveOffset / renderTargetArea;
|
||||
coords += layerOffset + singleFrameScreenOffset;
|
||||
|
||||
float2 offset = 3 / screenArea;
|
||||
float4 color = tex2D(uImage0, coords);
|
||||
@@ -0,0 +1,59 @@
|
||||
sampler metaballContents : register(s0);
|
||||
sampler overlayTexture : register(s1);
|
||||
|
||||
float2 screenSize;
|
||||
float2 layerSize;
|
||||
float2 layerOffset;
|
||||
float4 edgeColor;
|
||||
float2 singleFrameScreenOffset;
|
||||
|
||||
// The usage of these two methods seemingly prevents imprecision problems for some reason.
|
||||
float2 convertToScreenCoords(float2 coords)
|
||||
{
|
||||
return coords * screenSize;
|
||||
}
|
||||
|
||||
float2 convertFromScreenCoords(float2 coords)
|
||||
{
|
||||
return coords / screenSize;
|
||||
}
|
||||
|
||||
float4 PixelShaderFunction(float4 sampleColor : COLOR0, float2 coords : TEXCOORD0) : COLOR0
|
||||
{
|
||||
// Calculate the base color. This is the calculated from the raw objects in the metaball render target.
|
||||
float4 baseColor = tex2D(metaballContents, coords);
|
||||
|
||||
// Used to negate the need for an inverted if (baseColor.a > 0) by ensuring all of the edge checks fail.
|
||||
float alphaOffset = (1 - any(baseColor.a));
|
||||
|
||||
// Check if there are any empty pixels nearby. If there are, that means this pixel is at an edge, and should be colored accordingly.
|
||||
float left = tex2D(metaballContents, convertFromScreenCoords(convertToScreenCoords(coords) + float2(-2, 0))).a + alphaOffset;
|
||||
float right = tex2D(metaballContents, convertFromScreenCoords(convertToScreenCoords(coords) + float2(2, 0))).a + alphaOffset;
|
||||
float top = tex2D(metaballContents, convertFromScreenCoords(convertToScreenCoords(coords) + float2(0, -2))).a + alphaOffset;
|
||||
float bottom = tex2D(metaballContents, convertFromScreenCoords(convertToScreenCoords(coords) + float2(0, 2))).a + alphaOffset;
|
||||
|
||||
// Use step instead of branching in order to determine whether neighboring pixels are invisible.
|
||||
float leftHasNoAlpha = step(left, 0);
|
||||
float rightHasNoAlpha = step(right, 0);
|
||||
float topHasNoAlpha = step(top, 0);
|
||||
float bottomHasNoAlpha = step(bottom, 0);
|
||||
|
||||
// Use addition instead of the OR boolean operator to get a 0-1 value for whether an edge is invisible.
|
||||
// The equivalent for AND would be multiplication.
|
||||
float conditionOpacityFactor = 1 - saturate(leftHasNoAlpha + rightHasNoAlpha + topHasNoAlpha + bottomHasNoAlpha);
|
||||
|
||||
// Calculate layer colors.
|
||||
float4 layerColor = tex2D(overlayTexture, (coords + layerOffset + singleFrameScreenOffset) * screenSize / layerSize);
|
||||
float4 defaultColor = layerColor * tex2D(metaballContents, coords) * sampleColor;
|
||||
|
||||
// Lastly, use the aforementioned condition to switch between the colors. If conditionOpacityFactor is 1, the default color is
|
||||
// zeroed out and the edge is toggled, and vice versa.
|
||||
return (defaultColor * conditionOpacityFactor) + (edgeColor * sampleColor * (1 - conditionOpacityFactor));
|
||||
}
|
||||
technique Technique1
|
||||
{
|
||||
pass ParticlePass
|
||||
{
|
||||
PixelShader = compile ps_2_0 PixelShaderFunction();
|
||||
}
|
||||
}
|
||||
@@ -1,78 +0,0 @@
|
||||
sampler uImage0 : register(s0);
|
||||
sampler uImage1 : register(s1);
|
||||
float3 uColor;
|
||||
float3 uSecondaryColor;
|
||||
float uOpacity;
|
||||
float uSaturation;
|
||||
float uRotation;
|
||||
float uTime;
|
||||
float4 uSourceRect;
|
||||
float2 uWorldPosition;
|
||||
float uDirection;
|
||||
float3 uLightSource;
|
||||
float2 uImageSize0;
|
||||
float2 uImageSize1;
|
||||
float edgeBorderSize;
|
||||
bool borderShouldBeSolid;
|
||||
float3 edgeBorderColor;
|
||||
float2 screenArea;
|
||||
float2 renderTargetArea;
|
||||
float2 screenMoveOffset;
|
||||
float2 generalBackgroundOffset;
|
||||
bool invertedScreen;
|
||||
float2 upscaleFactor;
|
||||
float4 uShaderSpecificData;
|
||||
|
||||
float4 PixelShaderFunction(float4 sampleColor : TEXCOORD, float2 coords : TEXCOORD0) : COLOR0
|
||||
{
|
||||
float2 originalCoords = coords;
|
||||
if (invertedScreen)
|
||||
coords.y = 1 - coords.y;
|
||||
|
||||
// Account for screen movements. Not doing this causes the scene to move based on that.
|
||||
coords += screenMoveOffset / renderTargetArea;
|
||||
|
||||
float4 color = tex2D(uImage0, coords);
|
||||
|
||||
// Determine how much downscaling is required to reasonably zoom in on things.
|
||||
float downscaleFactor = float2(5, 5) / upscaleFactor / max(renderTargetArea.x, renderTargetArea.y) / 2;
|
||||
float2 backgroundCoords = frac((renderTargetArea * (originalCoords + generalBackgroundOffset * upscaleFactor) + uWorldPosition) * downscaleFactor);
|
||||
float4 backgroundColor = tex2D(uImage1, backgroundCoords);
|
||||
|
||||
// Equivalent to edgeBorderSize pixels in both the X and Y direction.
|
||||
float2 edgeOffset = float2(edgeBorderSize, edgeBorderSize) / renderTargetArea;
|
||||
|
||||
// Check if the cardinal directions are not intersecting with any other active parts of the render target.
|
||||
// If one of them isn't, that means that a border should be rendered.
|
||||
float4 aboveColor = tex2D(uImage0, coords + float2(0, edgeOffset.y));
|
||||
float4 belowColor = tex2D(uImage0, coords - float2(0, edgeOffset.y));
|
||||
float4 leftColor = tex2D(uImage0, coords + float2(edgeOffset.x, 0));
|
||||
float4 rightColor = tex2D(uImage0, coords - float2(edgeOffset.x, 0));
|
||||
|
||||
// Invert color check thresholds based on whether the border should be solid when drawing.
|
||||
float checkThreshold = 0.02;
|
||||
if (!borderShouldBeSolid)
|
||||
checkThreshold = 0.95;
|
||||
|
||||
// If any cardinal color is sufficiently close to transparency choose an edge border color.
|
||||
// Opacity multipliers ensure that this does not affect completely invisible areas of the render target.
|
||||
if (aboveColor.r < checkThreshold || belowColor.r < checkThreshold || leftColor.r < checkThreshold || rightColor.r < checkThreshold)
|
||||
{
|
||||
float borderOpacity = color.a;
|
||||
|
||||
// Use binary opacity if the border should be solid when drawing.
|
||||
if (borderOpacity > 0 && borderShouldBeSolid)
|
||||
borderOpacity = 1;
|
||||
|
||||
return float4(edgeBorderColor, 1) * borderOpacity;
|
||||
}
|
||||
|
||||
return backgroundColor;
|
||||
}
|
||||
technique Technique1
|
||||
{
|
||||
pass ParticlePass
|
||||
{
|
||||
PixelShader = compile ps_2_0 PixelShaderFunction();
|
||||
}
|
||||
}
|
||||
@@ -442,13 +442,6 @@ namespace CalamityMod.Events
|
||||
{
|
||||
CalamityUtils.KillAllHostileProjectiles();
|
||||
HostileProjectileKillCounter = 3;
|
||||
|
||||
// Mark Boss Rush as complete
|
||||
DownedBossSystem.downedBossRush = true;
|
||||
CalamityNetcode.SyncWorld();
|
||||
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
Projectile.NewProjectile(Source, npc.Center, Vector2.Zero, ModContent.ProjectileType<BossRushEndEffectThing>(), 0, 0f, Main.myPlayer);
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -744,7 +737,19 @@ namespace CalamityMod.Events
|
||||
HostileProjectileKillCounter = 3;
|
||||
|
||||
if (BossDeathEffects.ContainsKey(npc.type))
|
||||
{
|
||||
BossDeathEffects[npc.type].Invoke(npc);
|
||||
}
|
||||
|
||||
if (npc.type == Bosses[Bosses.Count -1].EntityID)
|
||||
{
|
||||
// Mark Boss Rush as complete
|
||||
DownedBossSystem.downedBossRush = true;
|
||||
CalamityNetcode.SyncWorld();
|
||||
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
Projectile.NewProjectile(Source, npc.Center, Vector2.Zero, ModContent.ProjectileType<BossRushEndEffectThing>(), 0, 0f, Main.myPlayer);
|
||||
}
|
||||
}
|
||||
|
||||
// Sync the stage and progress of Boss Rush whenever a relevant boss dies.
|
||||
|
||||
|
After Width: | Height: | Size: 383 B |
|
Before Width: | Height: | Size: 300 B After Width: | Height: | Size: 300 B |
@@ -28,52 +28,52 @@ namespace CalamityMod.Gores
|
||||
{
|
||||
gore.alpha = 100;
|
||||
}
|
||||
int num = 4;
|
||||
int goreFrameDelay = 4;
|
||||
gore.frameCounter++;
|
||||
if (gore.frame <= 4)
|
||||
{
|
||||
int num2 = (int)(gore.position.X / 16f);
|
||||
int num3 = (int)(gore.position.Y / 16f) - 1;
|
||||
if (WorldGen.InWorld(num2, num3, 0) && !Main.tile[num2, num3].HasTile)
|
||||
int goreXPos = (int)(gore.position.X / 16f);
|
||||
int goreYPos = (int)(gore.position.Y / 16f) - 1;
|
||||
if (WorldGen.InWorld(goreXPos, goreYPos, 0) && !Main.tile[goreXPos, goreYPos].HasTile)
|
||||
{
|
||||
gore.active = false;
|
||||
}
|
||||
if (gore.frame == 0)
|
||||
{
|
||||
num = 24 + Main.rand.Next(256);
|
||||
goreFrameDelay = 24 + Main.rand.Next(256);
|
||||
}
|
||||
if (gore.frame == 1)
|
||||
{
|
||||
num = 24 + Main.rand.Next(256);
|
||||
goreFrameDelay = 24 + Main.rand.Next(256);
|
||||
}
|
||||
if (gore.frame == 2)
|
||||
{
|
||||
num = 24 + Main.rand.Next(256);
|
||||
goreFrameDelay = 24 + Main.rand.Next(256);
|
||||
}
|
||||
if (gore.frame == 3)
|
||||
{
|
||||
num = 24 + Main.rand.Next(96);
|
||||
goreFrameDelay = 24 + Main.rand.Next(96);
|
||||
}
|
||||
if (gore.frame == 5)
|
||||
{
|
||||
num = 16 + Main.rand.Next(64);
|
||||
goreFrameDelay = 16 + Main.rand.Next(64);
|
||||
}
|
||||
if ((int)gore.frameCounter >= num)
|
||||
if ((int)gore.frameCounter >= goreFrameDelay)
|
||||
{
|
||||
gore.frameCounter = 0;
|
||||
gore.frame += 1;
|
||||
if (gore.frame == 5 && Main.netMode != NetmodeID.Server)
|
||||
{
|
||||
int num4 = Gore.NewGore(new EntitySource_Misc("0"), gore.position, gore.velocity, gore.type, 1f);
|
||||
Main.gore[num4].frame = 9;
|
||||
Main.gore[num4].velocity *= 0f;
|
||||
int astralWater = Gore.NewGore(new EntitySource_Misc("0"), gore.position, gore.velocity, gore.type, 1f);
|
||||
Main.gore[astralWater].frame = 9;
|
||||
Main.gore[astralWater].velocity *= 0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (gore.frame <= 6)
|
||||
{
|
||||
num = 8;
|
||||
if ((int)gore.frameCounter >= num)
|
||||
goreFrameDelay = 8;
|
||||
if ((int)gore.frameCounter >= goreFrameDelay)
|
||||
{
|
||||
gore.frameCounter = 0;
|
||||
gore.frame += 1;
|
||||
@@ -85,7 +85,7 @@ namespace CalamityMod.Gores
|
||||
}
|
||||
else if (gore.frame <= 9)
|
||||
{
|
||||
num = 6;
|
||||
goreFrameDelay = 6;
|
||||
gore.velocity.Y += 0.2f;
|
||||
if ((double)gore.velocity.Y < 0.5)
|
||||
{
|
||||
@@ -95,7 +95,7 @@ namespace CalamityMod.Gores
|
||||
{
|
||||
gore.velocity.Y = 12f;
|
||||
}
|
||||
if ((int)gore.frameCounter >= num)
|
||||
if ((int)gore.frameCounter >= goreFrameDelay)
|
||||
{
|
||||
gore.frameCounter = 0;
|
||||
gore.frame += 1;
|
||||
@@ -108,7 +108,7 @@ namespace CalamityMod.Gores
|
||||
else
|
||||
{
|
||||
gore.velocity.Y += 0.1f;
|
||||
if ((int)gore.frameCounter >= num)
|
||||
if ((int)gore.frameCounter >= goreFrameDelay)
|
||||
{
|
||||
gore.frameCounter = 0;
|
||||
gore.frame += 1;
|
||||
@@ -120,9 +120,9 @@ namespace CalamityMod.Gores
|
||||
}
|
||||
}
|
||||
|
||||
Vector2 value3 = gore.velocity;
|
||||
Vector2 goreVelCheck = gore.velocity;
|
||||
gore.velocity = Collision.TileCollision(gore.position, gore.velocity, 16, 14, false, false, 1);
|
||||
if (gore.velocity != value3)
|
||||
if (gore.velocity != goreVelCheck)
|
||||
{
|
||||
if (gore.frame < 10)
|
||||
{
|
||||
@@ -146,12 +146,12 @@ namespace CalamityMod.Gores
|
||||
}
|
||||
((WaterShaderData)Filters.Scene["WaterDistortion"].GetShader()).QueueRipple(gore.position + new Vector2(8f, 8f), 1f, RippleShape.Square, 0f);
|
||||
}
|
||||
int num21 = (int)(gore.position.X + 8f) / 16;
|
||||
int num22 = (int)(gore.position.Y + 14f) / 16;
|
||||
if (Main.tile[num21, num22] != null && Main.tile[num21, num22].LiquidAmount > 0)
|
||||
int goreTileX = (int)(gore.position.X + 8f) / 16;
|
||||
int goreTileY = (int)(gore.position.Y + 14f) / 16;
|
||||
if (Main.tile[goreTileX, goreTileY] != null && Main.tile[goreTileX, goreTileY].LiquidAmount > 0)
|
||||
{
|
||||
gore.velocity *= 0f;
|
||||
gore.position.Y = (float)(num22 * 16 - (int)(Main.tile[num21, num22].LiquidAmount / 16));
|
||||
gore.position.Y = (float)(goreTileY * 16 - (int)(Main.tile[goreTileX, goreTileY].LiquidAmount / 16));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using CalamityMod.Effects;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Graphics.Metaballs
|
||||
{
|
||||
public class BloodBoilerMetaball : Metaball
|
||||
{
|
||||
public class BloodBoilerParticle
|
||||
{
|
||||
public Vector2 Center;
|
||||
public float Size;
|
||||
|
||||
public BloodBoilerParticle(Vector2 center, float size)
|
||||
{
|
||||
Center = center;
|
||||
Size = size;
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
// Always slowly shrink the particles.
|
||||
Size = MathHelper.Clamp(Size - 0.1f, 0f, 200f) * 0.91f;
|
||||
|
||||
// Once sufficiently small, the particles very rapidly shrink.
|
||||
if (Size < 20f)
|
||||
Size = Size * 0.8f - 1f;
|
||||
}
|
||||
}
|
||||
|
||||
public static List<BloodBoilerParticle> Particles
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
} = new();
|
||||
|
||||
public override bool AnythingToDraw => Particles.Any();
|
||||
|
||||
public override IEnumerable<Texture2D> Layers
|
||||
{
|
||||
get
|
||||
{
|
||||
yield return ModContent.Request<Texture2D>("CalamityMod/Projectiles/InvisibleProj").Value;
|
||||
}
|
||||
}
|
||||
|
||||
public override MetaballDrawLayer DrawContext => MetaballDrawLayer.AfterProjectiles;
|
||||
|
||||
public override Color EdgeColor => Color.DarkRed;
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
// Update all particle instances.
|
||||
// Once sufficiently small, they vanish.
|
||||
for (int i = 0; i < Particles.Count; i++)
|
||||
Particles[i].Update();
|
||||
Particles.RemoveAll(p => p.Size <= 2f);
|
||||
}
|
||||
|
||||
// Copied from Rancor Lava metaballs, since these need to be additive metaballs.
|
||||
public override void PrepareShaderForTarget(int layerIndex)
|
||||
{
|
||||
// Store the shader in an easy to use local variable.
|
||||
var metaballShader = CalamityShaders.AdditiveMetaballEdgeShader;
|
||||
|
||||
// Calculate the layer scroll offset. This is used to ensure that the texture contents of the given metaball have parallax, rather than being static over the screen
|
||||
// regardless of world position.
|
||||
Vector2 screenSize = new(Main.screenWidth, Main.screenHeight);
|
||||
|
||||
// Supply shader parameter values.
|
||||
metaballShader.Parameters["screenArea"]?.SetValue(screenSize);
|
||||
metaballShader.Parameters["layerOffset"]?.SetValue(Vector2.Zero);
|
||||
metaballShader.Parameters["singleFrameScreenOffset"]?.SetValue(Vector2.Zero);
|
||||
|
||||
// Apply the metaball shader.
|
||||
metaballShader.CurrentTechnique.Passes[0].Apply();
|
||||
}
|
||||
|
||||
public static void SpawnParticle(Vector2 position, float size) => Particles.Add(new(position, size));
|
||||
|
||||
public override void DrawInstances()
|
||||
{
|
||||
float pureRedIntensity = 0.15f;
|
||||
float opacity = 0.5f;
|
||||
Texture2D tex = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/SmallGreyscaleCircle").Value;
|
||||
|
||||
foreach (BloodBoilerParticle particle in Particles)
|
||||
{
|
||||
Vector2 drawPosition = particle.Center - Main.screenPosition;
|
||||
var origin = tex.Size() * 0.5f;
|
||||
Vector2 scale = Vector2.One * particle.Size / tex.Size();
|
||||
|
||||
float pureRedInterpolant = Utils.GetLerpValue(25f, 60f, particle.Size, true) * pureRedIntensity;
|
||||
Color drawColor = Color.Lerp(EdgeColor, Color.DarkRed, pureRedInterpolant).MultiplyRGBA(new Color(1f, 1f, 1f, opacity));
|
||||
|
||||
Main.spriteBatch.Draw(tex, drawPosition, null, drawColor, 0f, origin, scale, SpriteEffects.None, 0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using CalamityMod.Effects;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Graphics.Metaballs
|
||||
{
|
||||
public class BloodBoilerMetaball2 : Metaball
|
||||
{
|
||||
public class BloodBoilerParticle2
|
||||
{
|
||||
public Vector2 Center;
|
||||
public float Size;
|
||||
|
||||
public BloodBoilerParticle2(Vector2 center, float size)
|
||||
{
|
||||
Center = center;
|
||||
Size = size;
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
// Always slowly shrink the particles.
|
||||
Size = MathHelper.Clamp(Size - 0.1f, 0f, 200f) * 0.91f;
|
||||
|
||||
// Once sufficiently small, the particles very rapidly shrink.
|
||||
if (Size < 20f)
|
||||
Size = Size * 0.8f - 1f;
|
||||
}
|
||||
}
|
||||
|
||||
public static List<BloodBoilerParticle2> Particles
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
} = new();
|
||||
|
||||
public override bool AnythingToDraw => Particles.Any();
|
||||
|
||||
public override IEnumerable<Texture2D> Layers
|
||||
{
|
||||
get
|
||||
{
|
||||
yield return ModContent.Request<Texture2D>("CalamityMod/Projectiles/InvisibleProj").Value;
|
||||
}
|
||||
}
|
||||
|
||||
public override MetaballDrawLayer DrawContext => MetaballDrawLayer.AfterProjectiles;
|
||||
|
||||
public override Color EdgeColor => Color.DarkRed;
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
// Update all particle instances.
|
||||
// Once sufficiently small, they vanish.
|
||||
for (int i = 0; i < Particles.Count; i++)
|
||||
Particles[i].Update();
|
||||
Particles.RemoveAll(p => p.Size <= 2f);
|
||||
}
|
||||
|
||||
// Copied from Rancor Lava metaballs, since these need to be additive metaballs.
|
||||
public override void PrepareShaderForTarget(int layerIndex)
|
||||
{
|
||||
// Store the shader in an easy to use local variable.
|
||||
var metaballShader = CalamityShaders.AdditiveMetaballEdgeShader;
|
||||
|
||||
// Calculate the layer scroll offset. This is used to ensure that the texture contents of the given metaball have parallax, rather than being static over the screen
|
||||
// regardless of world position.
|
||||
Vector2 screenSize = new(Main.screenWidth, Main.screenHeight);
|
||||
|
||||
// Supply shader parameter values.
|
||||
metaballShader.Parameters["screenArea"]?.SetValue(screenSize);
|
||||
metaballShader.Parameters["layerOffset"]?.SetValue(Vector2.Zero);
|
||||
metaballShader.Parameters["singleFrameScreenOffset"]?.SetValue(Vector2.Zero);
|
||||
|
||||
// Apply the metaball shader.
|
||||
metaballShader.CurrentTechnique.Passes[0].Apply();
|
||||
}
|
||||
|
||||
public static void SpawnParticle(Vector2 position, float size) => Particles.Add(new(position, size));
|
||||
|
||||
public override void DrawInstances()
|
||||
{
|
||||
float pureRedIntensity = 0.15f;
|
||||
float opacity = 0.3f;
|
||||
Texture2D tex = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/SmallGreyscaleCircle").Value;
|
||||
|
||||
foreach (BloodBoilerParticle2 particle in Particles)
|
||||
{
|
||||
Vector2 drawPosition = particle.Center - Main.screenPosition;
|
||||
var origin = tex.Size() * 0.5f;
|
||||
Vector2 scale = Vector2.One * particle.Size / tex.Size();
|
||||
|
||||
float pureRedInterpolant = Utils.GetLerpValue(25f, 60f, particle.Size, true) * pureRedIntensity;
|
||||
Color drawColor = Color.Lerp(EdgeColor, Color.DarkRed, pureRedInterpolant).MultiplyRGBA(new Color(1f, 1f, 1f, opacity));
|
||||
|
||||
Main.spriteBatch.Draw(tex, drawPosition, null, drawColor, 0f, origin, scale, SpriteEffects.None, 0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using CalamityMod.Effects;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Graphics.Metaballs
|
||||
{
|
||||
public class DragonsBreathFlameMetaball : DragonsBreathMetaball
|
||||
{
|
||||
// OrangeRed is FF4500
|
||||
// new Color(0xFF, 0x3A, 0x0A);
|
||||
public override Color EdgeColor => Color.Orange;
|
||||
|
||||
// Flame metaballs never turn white
|
||||
public override void DrawInstances() => DrawInstancesInternal(0.03f, -1f);
|
||||
}
|
||||
public class DragonsBreathBeamMetaball : DragonsBreathMetaball
|
||||
{
|
||||
private static float whiteSizeThreshold = 72f;
|
||||
|
||||
public override Color EdgeColor => Color.Orange;
|
||||
|
||||
// Laser metaballs very suddenly turn white at a specific size
|
||||
public override void DrawInstances() => DrawInstancesInternal(0.4f, whiteSizeThreshold);
|
||||
}
|
||||
|
||||
public abstract class DragonsBreathMetaball : Metaball
|
||||
{
|
||||
// Identical behavior to Blood Boiler particles
|
||||
public class DragonsBreathParticle
|
||||
{
|
||||
public Vector2 Center;
|
||||
public float Size;
|
||||
|
||||
public DragonsBreathParticle(Vector2 center, float size)
|
||||
{
|
||||
Center = center;
|
||||
Size = size;
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
// Always slowly shrink the particles.
|
||||
Size = MathHelper.Clamp(Size - 0.1f, 0f, 200f) * 0.91f;
|
||||
|
||||
// Once sufficiently small, the particles very rapidly shrink.
|
||||
if (Size < 5f)
|
||||
Size = Size * 0.8f - 1f;
|
||||
}
|
||||
}
|
||||
|
||||
public List<DragonsBreathParticle> Particles
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
} = new();
|
||||
|
||||
public override bool AnythingToDraw => Particles.Any();
|
||||
|
||||
public override IEnumerable<Texture2D> Layers
|
||||
{
|
||||
get
|
||||
{
|
||||
yield return ModContent.Request<Texture2D>("CalamityMod/Projectiles/InvisibleProj").Value;
|
||||
}
|
||||
}
|
||||
|
||||
public override MetaballDrawLayer DrawContext => MetaballDrawLayer.AfterProjectiles;
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
// Update all particle instances.
|
||||
// Once sufficiently small, they vanish.
|
||||
for (int i = 0; i < Particles.Count; i++)
|
||||
Particles[i].Update();
|
||||
Particles.RemoveAll(p => p.Size <= 2f);
|
||||
}
|
||||
|
||||
// Copied from Rancor Lava metaballs, since these need to be additive metaballs.
|
||||
public override void PrepareShaderForTarget(int layerIndex)
|
||||
{
|
||||
// Store the shader in an easy to use local variable.
|
||||
var metaballShader = CalamityShaders.AdditiveMetaballEdgeShader;
|
||||
|
||||
// Calculate the layer scroll offset. This is used to ensure that the texture contents of the given metaball have parallax, rather than being static over the screen
|
||||
// regardless of world position.
|
||||
Vector2 screenSize = new(Main.screenWidth, Main.screenHeight);
|
||||
|
||||
// Supply shader parameter values.
|
||||
metaballShader.Parameters["screenArea"]?.SetValue(screenSize);
|
||||
metaballShader.Parameters["layerOffset"]?.SetValue(Vector2.Zero);
|
||||
metaballShader.Parameters["singleFrameScreenOffset"]?.SetValue(Vector2.Zero);
|
||||
|
||||
// Apply the metaball shader.
|
||||
metaballShader.CurrentTechnique.Passes[0].Apply();
|
||||
}
|
||||
|
||||
public void SpawnParticle(Vector2 position, float size) => Particles.Add(new(position, size));
|
||||
|
||||
internal void DrawInstancesInternal(float opacity, float whiteSizeThreshold)
|
||||
{
|
||||
float pureWhiteIntensity = 0.16f;
|
||||
Texture2D tex = ModContent.Request<Texture2D>("CalamityMod/Graphics/Metaballs/MetaballMessy").Value;
|
||||
|
||||
foreach (DragonsBreathParticle particle in Particles)
|
||||
{
|
||||
Vector2 drawPosition = particle.Center - Main.screenPosition;
|
||||
var origin = tex.Size() * 0.5f;
|
||||
Vector2 scale = Vector2.One * particle.Size / tex.Size();
|
||||
|
||||
Color drawColor;
|
||||
if (whiteSizeThreshold >= 0f)
|
||||
{
|
||||
float pureWhiteInterpolant = Utils.GetLerpValue(0.8f * whiteSizeThreshold, whiteSizeThreshold, particle.Size, true) * pureWhiteIntensity;
|
||||
drawColor = Color.Lerp(EdgeColor, Color.DarkOrange, pureWhiteInterpolant) * opacity;
|
||||
}
|
||||
else
|
||||
drawColor = Color.Lerp(EdgeColor, new Color(0xE0, 0x70, 0x10), Utils.GetLerpValue(60f, 100f, particle.Size, true) * 0.75f);
|
||||
|
||||
Main.spriteBatch.Draw(tex, drawPosition, null, drawColor, 0f, origin, scale, SpriteEffects.None, 0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using CalamityMod.Effects;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Graphics.Metaballs
|
||||
{
|
||||
public class DragonsBreathFlameMetaball2 : DragonsBreathMetaball
|
||||
{
|
||||
// OrangeRed is FF4500
|
||||
// new Color(0xFF, 0x3A, 0x0A);
|
||||
public override Color EdgeColor => Color.OrangeRed;
|
||||
|
||||
// Flame metaballs never turn white
|
||||
public override void DrawInstances() => DrawInstancesInternal(0.03f, -1f);
|
||||
}
|
||||
public class DragonsBreathBeamMetaball2 : DragonsBreathMetaball2
|
||||
{
|
||||
private static float whiteSizeThreshold = 72f;
|
||||
|
||||
public override Color EdgeColor => Color.OrangeRed * 1.2f;
|
||||
|
||||
// Laser metaballs very suddenly turn white at a specific size
|
||||
public override void DrawInstances() => DrawInstancesInternal(0.4f, whiteSizeThreshold);
|
||||
}
|
||||
|
||||
public abstract class DragonsBreathMetaball2 : Metaball
|
||||
{
|
||||
// Identical behavior to Blood Boiler particles
|
||||
public class DragonsBreathParticle2
|
||||
{
|
||||
public Vector2 Center;
|
||||
public float Size;
|
||||
|
||||
public DragonsBreathParticle2(Vector2 center, float size)
|
||||
{
|
||||
Center = center;
|
||||
Size = size;
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
// Always slowly shrink the particles.
|
||||
Size = MathHelper.Clamp(Size - 0.1f, 0f, 200f) * 0.91f;
|
||||
|
||||
// Once sufficiently small, the particles very rapidly shrink.
|
||||
if (Size < 20f)
|
||||
Size = Size * 0.8f - 1f;
|
||||
}
|
||||
}
|
||||
|
||||
public List<DragonsBreathParticle2> Particles
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
} = new();
|
||||
|
||||
public override bool AnythingToDraw => Particles.Any();
|
||||
|
||||
public override IEnumerable<Texture2D> Layers
|
||||
{
|
||||
get
|
||||
{
|
||||
yield return ModContent.Request<Texture2D>("CalamityMod/Projectiles/InvisibleProj").Value;
|
||||
}
|
||||
}
|
||||
|
||||
public override MetaballDrawLayer DrawContext => MetaballDrawLayer.AfterProjectiles;
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
// Update all particle instances.
|
||||
// Once sufficiently small, they vanish.
|
||||
for (int i = 0; i < Particles.Count; i++)
|
||||
Particles[i].Update();
|
||||
Particles.RemoveAll(p => p.Size <= 2f);
|
||||
}
|
||||
|
||||
// Copied from Rancor Lava metaballs, since these need to be additive metaballs.
|
||||
public override void PrepareShaderForTarget(int layerIndex)
|
||||
{
|
||||
// Store the shader in an easy to use local variable.
|
||||
var metaballShader = CalamityShaders.AdditiveMetaballEdgeShader;
|
||||
|
||||
// Calculate the layer scroll offset. This is used to ensure that the texture contents of the given metaball have parallax, rather than being static over the screen
|
||||
// regardless of world position.
|
||||
Vector2 screenSize = new(Main.screenWidth, Main.screenHeight);
|
||||
|
||||
// Supply shader parameter values.
|
||||
metaballShader.Parameters["screenArea"]?.SetValue(screenSize);
|
||||
metaballShader.Parameters["layerOffset"]?.SetValue(Vector2.Zero);
|
||||
metaballShader.Parameters["singleFrameScreenOffset"]?.SetValue(Vector2.Zero);
|
||||
|
||||
// Apply the metaball shader.
|
||||
metaballShader.CurrentTechnique.Passes[0].Apply();
|
||||
}
|
||||
|
||||
public void SpawnParticle(Vector2 position, float size) => Particles.Add(new(position, size));
|
||||
|
||||
internal void DrawInstancesInternal(float opacity, float whiteSizeThreshold)
|
||||
{
|
||||
float pureWhiteIntensity = 0.16f;
|
||||
Texture2D tex = ModContent.Request<Texture2D>("CalamityMod/Graphics/Metaballs/MetaballMessy").Value;
|
||||
|
||||
foreach (DragonsBreathParticle2 particle in Particles)
|
||||
{
|
||||
Vector2 drawPosition = particle.Center - Main.screenPosition;
|
||||
var origin = tex.Size() * 0.5f;
|
||||
Vector2 scale = Vector2.One * particle.Size / tex.Size();
|
||||
|
||||
Color drawColor;
|
||||
if (whiteSizeThreshold >= 0f)
|
||||
{
|
||||
float pureWhiteInterpolant = Utils.GetLerpValue(0.8f * whiteSizeThreshold, whiteSizeThreshold, particle.Size, true) * pureWhiteIntensity;
|
||||
drawColor = Color.Lerp(EdgeColor, Color.White, pureWhiteInterpolant) * opacity;
|
||||
}
|
||||
else
|
||||
drawColor = Color.Lerp(EdgeColor, Color.DarkOrange, Utils.GetLerpValue(60f, 100f, particle.Size, true) * 0.3f);
|
||||
|
||||
Main.spriteBatch.Draw(tex, drawPosition, null, drawColor, 0f, origin, scale, SpriteEffects.None, 0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 8.0 KiB After Width: | Height: | Size: 8.0 KiB |
|
Before Width: | Height: | Size: 7.1 KiB After Width: | Height: | Size: 7.1 KiB |
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
@@ -0,0 +1,143 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using CalamityMod.Projectiles.Magic;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Content;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Graphics.Metaballs
|
||||
{
|
||||
public class GruesomeMetaball : Metaball
|
||||
{
|
||||
public class GruesomeParticle
|
||||
{
|
||||
public float Size;
|
||||
|
||||
public Vector2 Velocity;
|
||||
|
||||
public Vector2 Center;
|
||||
|
||||
public GruesomeParticle(Vector2 center, Vector2 velocity, float size)
|
||||
{
|
||||
Center = center;
|
||||
Velocity = velocity;
|
||||
Size = size;
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
Size *= 0.94f;
|
||||
Center += Velocity;
|
||||
Velocity *= 0.96f;
|
||||
}
|
||||
}
|
||||
|
||||
private static List<Asset<Texture2D>> layerAssets;
|
||||
|
||||
public static List<GruesomeParticle> Particles
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
} = new();
|
||||
|
||||
// Check if there are any extraneous particles or if the Gruesome Eminence projectile is present when deciding if this particle should be drawn.
|
||||
public override bool AnythingToDraw => Particles.Any() || CalamityUtils.AnyProjectiles(ModContent.ProjectileType<SpiritCongregation>());
|
||||
|
||||
public override IEnumerable<Texture2D> Layers
|
||||
{
|
||||
get
|
||||
{
|
||||
for (int i = 0; i < layerAssets.Count; i++)
|
||||
yield return layerAssets[i].Value;
|
||||
}
|
||||
}
|
||||
|
||||
public override MetaballDrawLayer DrawContext => MetaballDrawLayer.AfterProjectiles;
|
||||
|
||||
public override Color EdgeColor => new(61, 6, 2);
|
||||
|
||||
public override void Load()
|
||||
{
|
||||
if (Main.netMode == NetmodeID.Server)
|
||||
return;
|
||||
|
||||
// Load layer assets.
|
||||
layerAssets = new();
|
||||
|
||||
for (int i = 1; i <= 5; i++)
|
||||
layerAssets.Add(ModContent.Request<Texture2D>($"CalamityMod/Graphics/Metaballs/GruesomeEminence_Ghost_Layer{i}", AssetRequestMode.ImmediateLoad));
|
||||
}
|
||||
|
||||
public override void ClearInstances() => Particles.Clear();
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
// Update all particle instances.
|
||||
// Once sufficiently small, they vanish.
|
||||
for (int i = 0; i < Particles.Count; i++)
|
||||
Particles[i].Update();
|
||||
Particles.RemoveAll(p => p.Size <= 2.5f);
|
||||
}
|
||||
|
||||
public static void SpawnParticle(Vector2 position, Vector2 velocity, float size) =>
|
||||
Particles.Add(new(position, velocity, size));
|
||||
|
||||
public override Vector2 CalculateManualOffsetForLayer(int layerIndex)
|
||||
{
|
||||
switch (layerIndex)
|
||||
{
|
||||
// Background.
|
||||
case 0:
|
||||
return Vector2.UnitX * Main.GlobalTimeWrappedHourly * 0.03f;
|
||||
|
||||
// Gaseous skulls.
|
||||
case 1:
|
||||
Vector2 offset = Vector2.One * (float)Math.Cos(Main.GlobalTimeWrappedHourly * 0.041f) * 2f;
|
||||
offset = offset.RotatedBy((float)Math.Cos(Main.GlobalTimeWrappedHourly * 0.08f) * 0.97f);
|
||||
return offset;
|
||||
|
||||
// Spooky faces 1.
|
||||
case 2:
|
||||
offset = (Main.GlobalTimeWrappedHourly * 2.02f).ToRotationVector2() * 0.036f;
|
||||
offset.Y += (float)Math.Cos(Main.GlobalTimeWrappedHourly * 0.161f) * 0.5f + 0.5f;
|
||||
return offset;
|
||||
|
||||
// Spooky faces 2.
|
||||
case 3:
|
||||
offset = Vector2.UnitX * Main.GlobalTimeWrappedHourly * -0.04f + (Main.GlobalTimeWrappedHourly * 1.89f).ToRotationVector2() * 0.03f;
|
||||
offset.Y += CalamityUtils.PerlinNoise2D(Main.GlobalTimeWrappedHourly * 0.187f, Main.GlobalTimeWrappedHourly * 0.193f, 2, 466920161) * 0.025f;
|
||||
return offset;
|
||||
|
||||
// Spooky faces 3.
|
||||
case 4:
|
||||
offset = Vector2.UnitX * Main.GlobalTimeWrappedHourly * 0.037f + (Main.GlobalTimeWrappedHourly * 1.77f).ToRotationVector2() * 0.04725f;
|
||||
offset.Y += CalamityUtils.PerlinNoise2D(Main.GlobalTimeWrappedHourly * 0.187f, Main.GlobalTimeWrappedHourly * 0.193f, 2, 577215664) * 0.05f;
|
||||
return offset;
|
||||
}
|
||||
|
||||
return Vector2.Zero;
|
||||
}
|
||||
|
||||
public override void DrawInstances()
|
||||
{
|
||||
Texture2D tex = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/BasicCircle").Value;
|
||||
|
||||
// Draw all particles.
|
||||
foreach (GruesomeParticle particle in Particles)
|
||||
{
|
||||
Vector2 drawPosition = particle.Center - Main.screenPosition;
|
||||
Vector2 origin = tex.Size() * 0.5f;
|
||||
Vector2 scale = Vector2.One * particle.Size / tex.Size();
|
||||
Main.spriteBatch.Draw(tex, drawPosition, null, Color.White, 0f, origin, scale, 0, 0f);
|
||||
}
|
||||
|
||||
// Draw gruesome eminence ghost heads.
|
||||
foreach (Projectile eminence in CalamityUtils.AllProjectilesByID(ModContent.ProjectileType<SpiritCongregation>()))
|
||||
eminence.ModProjectile<SpiritCongregation>().DrawHeadForMetaball();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,151 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using CalamityMod.Effects;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Graphics.Metaballs
|
||||
{
|
||||
public abstract class Metaball : ModType
|
||||
{
|
||||
internal List<ManagedRenderTarget> LayerTargets = new();
|
||||
|
||||
/// <summary>
|
||||
/// Required utility that is used to determine whether this metaball has anything to draw.<br></br>
|
||||
/// This exists for efficiency, ensuring that as few operations are executed as possible when not required.
|
||||
/// </summary>
|
||||
public abstract bool AnythingToDraw
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The collection of all textures to draw on top of the metaball contents.
|
||||
/// </summary>
|
||||
public abstract IEnumerable<Texture2D> Layers
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The draw layer in which metaballs should be drawn.
|
||||
/// </summary>
|
||||
public abstract MetaballDrawLayer DrawContext
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The color that metaballs should draw at the edge between air and particle contents.
|
||||
/// </summary>
|
||||
public abstract Color EdgeColor
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Whether the layer overlay contents from <see cref="Layers"/> should be fixed to the screen.<br></br>
|
||||
/// When true, the texture will be statically drawn to the screen with no respect for world position.
|
||||
/// </summary>
|
||||
public virtual bool FixedToScreen => false;
|
||||
|
||||
/// <summary>
|
||||
/// Optionally overridable method for clearing particle instances as necessary. This is used automatically in contexts such as world unloads.
|
||||
/// </summary>
|
||||
public virtual void ClearInstances() { }
|
||||
|
||||
/// <summary>
|
||||
/// Optionally overridable method that can be used to update the metaball set. This can be useful for over-time update effects or for keeping special data particle types all updated.
|
||||
/// </summary>
|
||||
public virtual void Update() { }
|
||||
|
||||
/// <summary>
|
||||
/// Optionally overridable method that can be used to make layers offset when drawn, to allow for layer-specific animations. Defaults to <see cref="Vector2.Zero"/>, aka no animation.
|
||||
/// </summary>
|
||||
public virtual Vector2 CalculateManualOffsetForLayer(int layerIndex) => Vector2.Zero;
|
||||
|
||||
/// <summary>
|
||||
/// Optionally overridable method that allows for <see cref="SpriteBatch"/> preparations prior to the drawing of the individual raw metaball instances <i>(Not the final result)</i>.<br></br>
|
||||
/// An example of this could be having the metaball particles drawn with <see cref="BlendState.Additive"/>.
|
||||
/// </summary>
|
||||
/// <param name="spriteBatch">Shorthand parameter for <see cref="Main.spriteBatch"/>.</param>
|
||||
public virtual void PrepareSpriteBatch(SpriteBatch spriteBatch) { }
|
||||
|
||||
/// <summary>
|
||||
/// Optionally overridable method that defines for preparations for the render target. Defaults to using the typical texture overlay behavior.
|
||||
/// </summary>
|
||||
/// <param name="layerIndex">The layer index that should be prepared for.</param>
|
||||
public virtual void PrepareShaderForTarget(int layerIndex)
|
||||
{
|
||||
// Store the graphics device and shader in easy to use local variables.
|
||||
var metaballShader = CalamityShaders.MetaballEdgeShader;
|
||||
var gd = Main.instance.GraphicsDevice;
|
||||
|
||||
// Fetch the layer texture. This is the texture that will be overlayed over the greyscale contents on the screen.
|
||||
Texture2D layerTexture = Layers.ElementAt(layerIndex);
|
||||
|
||||
// Calculate the layer scroll offset. This is used to ensure that the texture contents of the given metaball have parallax, rather than being static over the screen
|
||||
// regardless of world position.
|
||||
// This may be toggled off optionally by the metaball.
|
||||
Vector2 screenSize = new(Main.screenWidth, Main.screenHeight);
|
||||
Vector2 layerScrollOffset = Main.screenPosition / screenSize + CalculateManualOffsetForLayer(layerIndex);
|
||||
if (FixedToScreen)
|
||||
layerScrollOffset = Vector2.Zero;
|
||||
|
||||
// Supply shader parameter values.
|
||||
metaballShader.Parameters["layerSize"]?.SetValue(layerTexture.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);
|
||||
|
||||
// Supply the metaball's layer texture to the graphics device so that the shader can read it.
|
||||
gd.Textures[1] = layerTexture;
|
||||
gd.SamplerStates[1] = SamplerState.LinearWrap;
|
||||
|
||||
// Apply the metaball shader.
|
||||
metaballShader.CurrentTechnique.Passes[0].Apply();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Required overridable that is intended to draw all metaball instances.
|
||||
/// </summary>
|
||||
public abstract void DrawInstances();
|
||||
|
||||
protected sealed override void Register()
|
||||
{
|
||||
// Register this metaball mod TML's inbuilt ModType handlers.
|
||||
ModTypeLookup<Metaball>.Register(this);
|
||||
|
||||
// Store this metaball instance in the personalized manager so that it can be kept track of for rendering purposes.
|
||||
if (!MetaballManager.metaballs.Contains(this))
|
||||
MetaballManager.metaballs.Add(this);
|
||||
|
||||
// Disallow render target creation on servers.
|
||||
if (Main.netMode == NetmodeID.Server)
|
||||
return;
|
||||
|
||||
// Generate render targets.
|
||||
Main.QueueMainThreadAction(() =>
|
||||
{
|
||||
// Load render targets.
|
||||
int layerCount = Layers.Count();
|
||||
for (int i = 0; i < layerCount; i++)
|
||||
LayerTargets.Add(new(true, ManagedRenderTarget.CreateScreenSizedTarget));
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Disposes of all unmanaged GPU resources used up by the <see cref="LayerTargets"/>. This is called automatically on mod unload.<br></br>
|
||||
/// <i>It is your responsibility to recreate layer targets later if you call this method manually.</i>
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
for (int i = 0; i < LayerTargets.Count; i++)
|
||||
LayerTargets[i]?.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 74 KiB After Width: | Height: | Size: 74 KiB |
@@ -0,0 +1,9 @@
|
||||
namespace CalamityMod.Graphics.Metaballs
|
||||
{
|
||||
public enum MetaballDrawLayer
|
||||
{
|
||||
BeforeNPCs,
|
||||
BeforeProjectiles,
|
||||
AfterProjectiles,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Graphics.Metaballs
|
||||
{
|
||||
public class MetaballManager : ModSystem
|
||||
{
|
||||
internal static readonly List<Metaball> metaballs = new();
|
||||
|
||||
public override void OnModLoad()
|
||||
{
|
||||
// Prepare event subscribers.
|
||||
RenderTargetManager.RenderTargetUpdateLoopEvent += PrepareMetaballTargets;
|
||||
On_Main.DrawProjectiles += DrawMetaballsAfterProjectiles;
|
||||
On_Main.DrawNPCs += DrawMetaballsBeforeNPCs;
|
||||
}
|
||||
|
||||
public override void OnModUnload()
|
||||
{
|
||||
// Clear all unmanaged metaball target resources on the GPU on mod unload.
|
||||
Main.QueueMainThreadAction(() =>
|
||||
{
|
||||
foreach (Metaball metaball in metaballs)
|
||||
metaball?.Dispose();
|
||||
});
|
||||
}
|
||||
|
||||
public override void OnWorldUnload()
|
||||
{
|
||||
foreach (Metaball metaball in metaballs)
|
||||
metaball.ClearInstances();
|
||||
}
|
||||
|
||||
private void PrepareMetaballTargets()
|
||||
{
|
||||
// Get a list of all metaballs currently in use.
|
||||
var activeMetaballs = metaballs.Where(m => m.AnythingToDraw);
|
||||
|
||||
// Don't bother wasting resources if metaballs are not in use at the moment.
|
||||
if (!activeMetaballs.Any())
|
||||
return;
|
||||
|
||||
// Prepare the sprite batch for drawing. Metaballs may restart the sprite batch via PrepareSpriteBatch if their implementation requires it.
|
||||
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.Default, Main.Rasterizer, null, Matrix.Identity);
|
||||
|
||||
var gd = Main.instance.GraphicsDevice;
|
||||
foreach (Metaball metaball in activeMetaballs)
|
||||
{
|
||||
// Update the metaball collection.
|
||||
if (!Main.gamePaused)
|
||||
metaball.Update();
|
||||
|
||||
// Prepare the sprite batch in accordance to the needs of the metaball instance. By default this does nothing,
|
||||
metaball.PrepareSpriteBatch(Main.spriteBatch);
|
||||
|
||||
// Draw the raw contents of the metaball to each of its render targets.
|
||||
foreach (ManagedRenderTarget target in metaball.LayerTargets)
|
||||
{
|
||||
gd.SetRenderTarget(target);
|
||||
gd.Clear(Color.Transparent);
|
||||
metaball.DrawInstances();
|
||||
|
||||
// Flush metaball contents to its render target and reset the sprite batch for the next iteration.
|
||||
Main.spriteBatch.End();
|
||||
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.Default, Main.Rasterizer, null, Matrix.Identity);
|
||||
}
|
||||
}
|
||||
|
||||
// Return to the backbuffer and end the sprite batch.
|
||||
gd.SetRenderTarget(null);
|
||||
Main.spriteBatch.End();
|
||||
}
|
||||
|
||||
private void DrawMetaballsAfterProjectiles(On_Main.orig_DrawProjectiles orig, Main self)
|
||||
{
|
||||
if (AnyActiveMetaballsAtLayer(MetaballDrawLayer.BeforeProjectiles))
|
||||
{
|
||||
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointWrap, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
|
||||
DrawMetaballs(MetaballDrawLayer.BeforeProjectiles);
|
||||
Main.spriteBatch.End();
|
||||
}
|
||||
|
||||
orig(self);
|
||||
|
||||
if (AnyActiveMetaballsAtLayer(MetaballDrawLayer.AfterProjectiles))
|
||||
{
|
||||
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointWrap, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
|
||||
DrawMetaballs(MetaballDrawLayer.AfterProjectiles);
|
||||
Main.spriteBatch.End();
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawMetaballsBeforeNPCs(On_Main.orig_DrawNPCs orig, Main self, bool behindTiles)
|
||||
{
|
||||
if (!behindTiles && AnyActiveMetaballsAtLayer(MetaballDrawLayer.BeforeNPCs))
|
||||
{
|
||||
Main.spriteBatch.End();
|
||||
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointWrap, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
|
||||
DrawMetaballs(MetaballDrawLayer.BeforeNPCs);
|
||||
Main.spriteBatch.ExitShaderRegion();
|
||||
}
|
||||
orig(self, behindTiles);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks if a metaball of a given layering type is currently in use. This is used to minimize needless <see cref="SpriteBatch"/> restarts when there is nothing to draw.
|
||||
/// </summary>
|
||||
/// <param name="layerType">The metaball layer type to check against.</param>
|
||||
internal static bool AnyActiveMetaballsAtLayer(MetaballDrawLayer layerType) =>
|
||||
metaballs.Any(m => m.AnythingToDraw && m.DrawContext == layerType);
|
||||
|
||||
/// <summary>
|
||||
/// Draws all metaballs of a given <see cref="MetaballDrawLayer"/>. Used for layer ordering reasons.
|
||||
/// </summary>
|
||||
/// <param name="layerType">The layer type to draw with.</param>
|
||||
public static void DrawMetaballs(MetaballDrawLayer layerType)
|
||||
{
|
||||
foreach (Metaball metaball in metaballs.Where(m => m.DrawContext == layerType && m.AnythingToDraw))
|
||||
{
|
||||
for (int i = 0; i < metaball.LayerTargets.Count; i++)
|
||||
{
|
||||
// Prepare shaders for the given layer target.
|
||||
metaball.PrepareShaderForTarget(i);
|
||||
|
||||
// Draw the metaball's raw contents with the shader.
|
||||
Main.spriteBatch.Draw(metaball.LayerTargets[i], Main.screenLastPosition - Main.screenPosition, Color.White);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 113 KiB |
@@ -0,0 +1,132 @@
|
||||
using CalamityMod.Effects;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Graphics.Metaballs
|
||||
{
|
||||
public class CyanPaint : PaintMetaball
|
||||
{
|
||||
public override Color EdgeColor => Color.Cyan * 0.7f;
|
||||
}
|
||||
|
||||
public class BluePaint : PaintMetaball
|
||||
{
|
||||
public override Color EdgeColor => Color.Blue * 0.7f;
|
||||
}
|
||||
|
||||
public class MagentaPaint : PaintMetaball
|
||||
{
|
||||
public override Color EdgeColor => Color.Magenta * 0.7f;
|
||||
}
|
||||
|
||||
public class LimePaint : PaintMetaball
|
||||
{
|
||||
public override Color EdgeColor => Color.Lime * 0.7f;
|
||||
}
|
||||
|
||||
public class YellowPaint : PaintMetaball
|
||||
{
|
||||
public override Color EdgeColor => Color.Yellow * 0.7f;
|
||||
}
|
||||
|
||||
public abstract class PaintMetaball : Metaball
|
||||
{
|
||||
public class PaintParticle
|
||||
{
|
||||
public float Size;
|
||||
|
||||
public Vector2 Center;
|
||||
|
||||
public PaintParticle(Vector2 center, float size)
|
||||
{
|
||||
Center = center;
|
||||
Size = size;
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
Size = MathHelper.Clamp(Size - 0.1f, 0f, 200f) * 0.997f;
|
||||
if (Size < 20f)
|
||||
Size = Size * 0.8f - 1f;
|
||||
}
|
||||
}
|
||||
|
||||
// This list is personalized between the various subclasses.
|
||||
public List<PaintParticle> Particles
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
} = new();
|
||||
|
||||
public override bool AnythingToDraw => Particles.Any();
|
||||
|
||||
public override MetaballDrawLayer DrawContext => MetaballDrawLayer.AfterProjectiles;
|
||||
|
||||
public override IEnumerable<Texture2D> Layers
|
||||
{
|
||||
get
|
||||
{
|
||||
yield return ModContent.Request<Texture2D>("CalamityMod/Projectiles/InvisibleProj").Value;
|
||||
}
|
||||
}
|
||||
|
||||
public override void ClearInstances() => Particles.Clear();
|
||||
|
||||
public override void PrepareShaderForTarget(int layerIndex)
|
||||
{
|
||||
// Store the shader in an easy to use local variable.
|
||||
var metaballShader = CalamityShaders.AdditiveMetaballEdgeShader;
|
||||
|
||||
// Calculate the layer scroll offset. This is used to ensure that the texture contents of the given metaball have parallax, rather than being static over the screen
|
||||
// regardless of world position.
|
||||
Vector2 screenSize = new(Main.screenWidth, Main.screenHeight);
|
||||
|
||||
// Supply shader parameter values.
|
||||
metaballShader.Parameters["screenArea"]?.SetValue(screenSize);
|
||||
metaballShader.Parameters["layerOffset"]?.SetValue(Vector2.Zero);
|
||||
metaballShader.Parameters["singleFrameScreenOffset"]?.SetValue(Vector2.Zero);
|
||||
|
||||
// Apply the metaball shader.
|
||||
metaballShader.CurrentTechnique.Passes[0].Apply();
|
||||
}
|
||||
|
||||
public void SpawnParticle(Vector2 position, float size) =>
|
||||
Particles.Add(new(position, size));
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
// Update all particle instances.
|
||||
// Once sufficiently small, they vanish.
|
||||
for (int i = 0; i < Particles.Count; i++)
|
||||
Particles[i].Update();
|
||||
Particles.RemoveAll(p => p.Size <= 3f);
|
||||
}
|
||||
|
||||
public override void PrepareSpriteBatch(SpriteBatch spriteBatch)
|
||||
{
|
||||
// Draw with additive blending.
|
||||
Main.spriteBatch.End();
|
||||
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Additive, SamplerState.PointClamp, DepthStencilState.Default, Main.Rasterizer, null, Matrix.Identity);
|
||||
}
|
||||
|
||||
public override void DrawInstances()
|
||||
{
|
||||
Texture2D tex = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/SmallGreyscaleCircle").Value;
|
||||
|
||||
// Draw all particles.
|
||||
foreach (PaintParticle particle in Particles)
|
||||
{
|
||||
Vector2 drawPosition = particle.Center - Main.screenPosition;
|
||||
Vector2 origin = tex.Size() * 0.5f;
|
||||
Vector2 scale = Vector2.One * particle.Size / tex.Size();
|
||||
Color paintColor = Color.Lerp(EdgeColor, new Color(0f, 0f, 1f), Utils.GetLerpValue(50f, 100f, particle.Size, true) * 0.1f) * 1.2f;
|
||||
|
||||
Main.spriteBatch.Draw(tex, drawPosition, null, paintColor, 0f, origin, scale, 0, 0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using CalamityMod.Effects;
|
||||
using CalamityMod.Rarities;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Graphics.Metaballs
|
||||
{
|
||||
public class PhotoMetaball : Metaball
|
||||
{
|
||||
public class PhotoParticle
|
||||
{
|
||||
public Vector2 Center;
|
||||
public float Size;
|
||||
public int Time = 0;
|
||||
public float OrginSize;
|
||||
|
||||
public PhotoParticle(Vector2 center, float size)
|
||||
{
|
||||
Center = center;
|
||||
Size = size;
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
Time++;
|
||||
if (Time == 1)
|
||||
OrginSize = Size;
|
||||
// Always slowly shrink the particles.
|
||||
Size = MathHelper.Clamp(Size - 0.8f, 0f, 1000f) * 0.96f;
|
||||
|
||||
// Once sufficiently small, the particles very rapidly shrink.
|
||||
if (Size < OrginSize * 0.15f)
|
||||
Size = 2;
|
||||
}
|
||||
}
|
||||
|
||||
public static List<PhotoParticle> Particles
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
} = new();
|
||||
|
||||
public override bool AnythingToDraw => Particles.Any();
|
||||
|
||||
public override IEnumerable<Texture2D> Layers
|
||||
{
|
||||
get
|
||||
{
|
||||
yield return ModContent.Request<Texture2D>("CalamityMod/Projectiles/InvisibleProj").Value;
|
||||
}
|
||||
}
|
||||
|
||||
public override MetaballDrawLayer DrawContext => MetaballDrawLayer.AfterProjectiles;
|
||||
|
||||
public Color sparkColor;
|
||||
public int Time = 0;
|
||||
public override Color EdgeColor => sparkColor;
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
Time++;
|
||||
// Update all particle instances.
|
||||
// Once sufficiently small, they vanish.
|
||||
for (int i = 0; i < Particles.Count; i++)
|
||||
Particles[i].Update();
|
||||
Particles.RemoveAll(p => p.Size <= 2f);
|
||||
if (Time % 10 == 0)
|
||||
{
|
||||
sparkColor = Main.rand.Next(4) switch
|
||||
{
|
||||
0 => Color.Red,
|
||||
1 => Color.MediumTurquoise,
|
||||
2 => Color.Orange,
|
||||
_ => Color.LawnGreen,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// Copied from Rancor Lava metaballs, since these need to be additive metaballs.
|
||||
public override void PrepareShaderForTarget(int layerIndex)
|
||||
{
|
||||
// Store the shader in an easy to use local variable.
|
||||
var metaballShader = CalamityShaders.AdditiveMetaballEdgeShader;
|
||||
|
||||
// Calculate the layer scroll offset. This is used to ensure that the texture contents of the given metaball have parallax, rather than being static over the screen
|
||||
// regardless of world position.
|
||||
Vector2 screenSize = new(Main.screenWidth, Main.screenHeight);
|
||||
|
||||
// Supply shader parameter values.
|
||||
metaballShader.Parameters["screenArea"]?.SetValue(screenSize);
|
||||
metaballShader.Parameters["layerOffset"]?.SetValue(Vector2.Zero);
|
||||
metaballShader.Parameters["singleFrameScreenOffset"]?.SetValue(Vector2.Zero);
|
||||
|
||||
// Apply the metaball shader.
|
||||
metaballShader.CurrentTechnique.Passes[0].Apply();
|
||||
}
|
||||
|
||||
public static void SpawnParticle(Vector2 position, float size) => Particles.Add(new(position, size));
|
||||
|
||||
public override void DrawInstances()
|
||||
{
|
||||
float opacity = 1f;
|
||||
Texture2D tex = ModContent.Request<Texture2D>("CalamityMod/Graphics/Metaballs/MetaballMessy").Value;
|
||||
|
||||
foreach (PhotoParticle particle in Particles)
|
||||
{
|
||||
Vector2 drawPosition = particle.Center - Main.screenPosition;
|
||||
var origin = tex.Size() * 0.5f;
|
||||
Vector2 scale = Vector2.One * particle.Size / tex.Size();
|
||||
|
||||
float Interpolant = Utils.GetLerpValue(25f, 60f, particle.Size * 0.6f, true);
|
||||
Color drawColor = Color.Lerp(EdgeColor, Color.White * 0.9f, Interpolant).MultiplyRGBA(new Color(1f, 1f, 1f, opacity));
|
||||
|
||||
Main.spriteBatch.Draw(tex, drawPosition, null, drawColor, 0f, origin, scale, SpriteEffects.None, 0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using CalamityMod.Effects;
|
||||
using CalamityMod.Rarities;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Graphics.Metaballs
|
||||
{
|
||||
public class PhotoMetaball2 : Metaball
|
||||
{
|
||||
public class PhotoParticle2
|
||||
{
|
||||
public Vector2 Center;
|
||||
public float Size;
|
||||
public int Time = 0;
|
||||
public float OrginSize;
|
||||
|
||||
public PhotoParticle2(Vector2 center, float size)
|
||||
{
|
||||
Center = center;
|
||||
Size = size;
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
Time++;
|
||||
if (Time == 1)
|
||||
OrginSize = Size;
|
||||
// Always slowly shrink the particles.
|
||||
Size = MathHelper.Clamp(Size - 0.8f, 0f, 1000f) * 0.96f;
|
||||
|
||||
// Once sufficiently small, the particles very rapidly shrink.
|
||||
if (Size < OrginSize * 0.15f)
|
||||
Size = 2;
|
||||
}
|
||||
}
|
||||
|
||||
public static List<PhotoParticle2> Particles
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
} = new();
|
||||
|
||||
public override bool AnythingToDraw => Particles.Any();
|
||||
|
||||
public override IEnumerable<Texture2D> Layers
|
||||
{
|
||||
get
|
||||
{
|
||||
yield return ModContent.Request<Texture2D>("CalamityMod/Projectiles/InvisibleProj").Value;
|
||||
}
|
||||
}
|
||||
|
||||
public override MetaballDrawLayer DrawContext => MetaballDrawLayer.AfterProjectiles;
|
||||
|
||||
public Color sparkColor;
|
||||
public int Time;
|
||||
public override Color EdgeColor => sparkColor * 5;
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
Time++;
|
||||
// Update all particle instances.
|
||||
// Once sufficiently small, they vanish.
|
||||
for (int i = 0; i < Particles.Count; i++)
|
||||
Particles[i].Update();
|
||||
Particles.RemoveAll(p => p.Size <= 2f);
|
||||
if (Time % 8 == 0)
|
||||
{
|
||||
sparkColor = Main.rand.Next(4) switch
|
||||
{
|
||||
0 => Color.DarkRed,
|
||||
1 => Color.MediumTurquoise,
|
||||
2 => Color.Orange,
|
||||
_ => Color.LawnGreen,
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Copied from Rancor Lava metaballs, since these need to be additive metaballs.
|
||||
public override void PrepareShaderForTarget(int layerIndex)
|
||||
{
|
||||
// Store the shader in an easy to use local variable.
|
||||
var metaballShader = CalamityShaders.AdditiveMetaballEdgeShader;
|
||||
|
||||
// Calculate the layer scroll offset. This is used to ensure that the texture contents of the given metaball have parallax, rather than being static over the screen
|
||||
// regardless of world position.
|
||||
Vector2 screenSize = new(Main.screenWidth, Main.screenHeight);
|
||||
|
||||
// Supply shader parameter values.
|
||||
metaballShader.Parameters["screenArea"]?.SetValue(screenSize);
|
||||
metaballShader.Parameters["layerOffset"]?.SetValue(Vector2.Zero);
|
||||
metaballShader.Parameters["singleFrameScreenOffset"]?.SetValue(Vector2.Zero);
|
||||
|
||||
// Apply the metaball shader.
|
||||
metaballShader.CurrentTechnique.Passes[0].Apply();
|
||||
}
|
||||
|
||||
public static void SpawnParticle(Vector2 position, float size) => Particles.Add(new(position, size));
|
||||
|
||||
public override void DrawInstances()
|
||||
{
|
||||
float opacity = 1f;
|
||||
Texture2D tex = ModContent.Request<Texture2D>("CalamityMod/Graphics/Metaballs/MetaballMessy").Value;
|
||||
|
||||
foreach (PhotoParticle2 particle in Particles)
|
||||
{
|
||||
Vector2 drawPosition = particle.Center - Main.screenPosition;
|
||||
var origin = tex.Size() * 0.5f;
|
||||
Vector2 scale = Vector2.One * particle.Size / tex.Size();
|
||||
|
||||
float Interpolant = Utils.GetLerpValue(25f, 60f, particle.Size * 0.6f, true);
|
||||
Color drawColor = Color.Lerp(Color.White, EdgeColor, Interpolant).MultiplyRGBA(new Color(1f, 1f, 1f, opacity));
|
||||
|
||||
Main.spriteBatch.Draw(tex, drawPosition, null, drawColor, 0f, origin, scale, SpriteEffects.None, 0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using CalamityMod.Effects;
|
||||
using CalamityMod.Rarities;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Graphics.Metaballs
|
||||
{
|
||||
public class PhotoMetaball3 : Metaball
|
||||
{
|
||||
public class PhotoParticle3
|
||||
{
|
||||
public Vector2 Center;
|
||||
public float Size;
|
||||
public int Time = 0;
|
||||
|
||||
public PhotoParticle3(Vector2 center, float size)
|
||||
{
|
||||
Center = center;
|
||||
Size = size;
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
Time++;
|
||||
if (Time >= 6)
|
||||
Size = 2;
|
||||
}
|
||||
}
|
||||
|
||||
public static List<PhotoParticle3> Particles
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
} = new();
|
||||
|
||||
public override bool AnythingToDraw => Particles.Any();
|
||||
|
||||
public override IEnumerable<Texture2D> Layers
|
||||
{
|
||||
get
|
||||
{
|
||||
yield return ModContent.Request<Texture2D>("CalamityMod/Projectiles/InvisibleProj").Value;
|
||||
}
|
||||
}
|
||||
|
||||
public override MetaballDrawLayer DrawContext => MetaballDrawLayer.AfterProjectiles;
|
||||
|
||||
public Color sparkColor;
|
||||
public int Time = 0;
|
||||
public override Color EdgeColor => sparkColor;
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
Time++;
|
||||
// Update all particle instances.
|
||||
// Once sufficiently small, they vanish.
|
||||
for (int i = 0; i < Particles.Count; i++)
|
||||
Particles[i].Update();
|
||||
Particles.RemoveAll(p => p.Size <= 2f);
|
||||
|
||||
if (Time % 10 == 0)
|
||||
{
|
||||
sparkColor = Main.rand.Next(4) switch
|
||||
{
|
||||
0 => Color.Red,
|
||||
1 => Color.MediumTurquoise,
|
||||
2 => Color.Orange,
|
||||
_ => Color.LawnGreen,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// Copied from Rancor Lava metaballs, since these need to be additive metaballs.
|
||||
public override void PrepareShaderForTarget(int layerIndex)
|
||||
{
|
||||
// Store the shader in an easy to use local variable.
|
||||
var metaballShader = CalamityShaders.AdditiveMetaballEdgeShader;
|
||||
|
||||
// Calculate the layer scroll offset. This is used to ensure that the texture contents of the given metaball have parallax, rather than being static over the screen
|
||||
// regardless of world position.
|
||||
Vector2 screenSize = new(Main.screenWidth, Main.screenHeight);
|
||||
|
||||
// Supply shader parameter values.
|
||||
metaballShader.Parameters["screenArea"]?.SetValue(screenSize);
|
||||
metaballShader.Parameters["layerOffset"]?.SetValue(Vector2.Zero);
|
||||
metaballShader.Parameters["singleFrameScreenOffset"]?.SetValue(Vector2.Zero);
|
||||
|
||||
// Apply the metaball shader.
|
||||
metaballShader.CurrentTechnique.Passes[0].Apply();
|
||||
}
|
||||
|
||||
public static void SpawnParticle(Vector2 position, float size) => Particles.Add(new(position, size));
|
||||
|
||||
public override void DrawInstances()
|
||||
{
|
||||
float opacity = 1f;
|
||||
Texture2D tex = ModContent.Request<Texture2D>("CalamityMod/Graphics/Metaballs/MetaballMessy").Value;
|
||||
|
||||
foreach (PhotoParticle3 particle in Particles)
|
||||
{
|
||||
Vector2 drawPosition = particle.Center - Main.screenPosition;
|
||||
var origin = tex.Size() * 0.5f;
|
||||
Vector2 scale = Vector2.One * particle.Size / tex.Size();
|
||||
|
||||
float Interpolant = Utils.GetLerpValue(25f, 60f, particle.Size * 0.6f, true);
|
||||
Color drawColor = Color.Lerp(EdgeColor, Color.White * 0.9f, Interpolant).MultiplyRGBA(new Color(1f, 1f, 1f, opacity));
|
||||
|
||||
Main.spriteBatch.Draw(tex, drawPosition, null, drawColor, 0f, origin, scale, SpriteEffects.None, 0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using CalamityMod.Effects;
|
||||
using CalamityMod.Rarities;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Graphics.Metaballs
|
||||
{
|
||||
public class PhotoMetaball4 : Metaball
|
||||
{
|
||||
public class PhotoParticle4
|
||||
{
|
||||
public Vector2 Center;
|
||||
public float Size;
|
||||
public int Time = 0;
|
||||
|
||||
public PhotoParticle4(Vector2 center, float size)
|
||||
{
|
||||
Center = center;
|
||||
Size = size;
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
Time++;
|
||||
if (Time >= 6)
|
||||
Size = 2;
|
||||
}
|
||||
}
|
||||
|
||||
public static List<PhotoParticle4> Particles
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
} = new();
|
||||
|
||||
public override bool AnythingToDraw => Particles.Any();
|
||||
|
||||
public override IEnumerable<Texture2D> Layers
|
||||
{
|
||||
get
|
||||
{
|
||||
yield return ModContent.Request<Texture2D>("CalamityMod/Projectiles/InvisibleProj").Value;
|
||||
}
|
||||
}
|
||||
|
||||
public override MetaballDrawLayer DrawContext => MetaballDrawLayer.AfterProjectiles;
|
||||
|
||||
public Color sparkColor;
|
||||
public int Time;
|
||||
public override Color EdgeColor => sparkColor * 5;
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
Time++;
|
||||
// Update all particle instances.
|
||||
// Once sufficiently small, they vanish.
|
||||
for (int i = 0; i < Particles.Count; i++)
|
||||
Particles[i].Update();
|
||||
Particles.RemoveAll(p => p.Size <= 2f);
|
||||
|
||||
if (Time % 8 == 0)
|
||||
{
|
||||
sparkColor = Main.rand.Next(4) switch
|
||||
{
|
||||
0 => Color.Red,
|
||||
1 => Color.MediumTurquoise,
|
||||
2 => Color.Orange,
|
||||
_ => Color.LawnGreen,
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Copied from Rancor Lava metaballs, since these need to be additive metaballs.
|
||||
public override void PrepareShaderForTarget(int layerIndex)
|
||||
{
|
||||
// Store the shader in an easy to use local variable.
|
||||
var metaballShader = CalamityShaders.AdditiveMetaballEdgeShader;
|
||||
|
||||
// Calculate the layer scroll offset. This is used to ensure that the texture contents of the given metaball have parallax, rather than being static over the screen
|
||||
// regardless of world position.
|
||||
Vector2 screenSize = new(Main.screenWidth, Main.screenHeight);
|
||||
|
||||
// Supply shader parameter values.
|
||||
metaballShader.Parameters["screenArea"]?.SetValue(screenSize);
|
||||
metaballShader.Parameters["layerOffset"]?.SetValue(Vector2.Zero);
|
||||
metaballShader.Parameters["singleFrameScreenOffset"]?.SetValue(Vector2.Zero);
|
||||
|
||||
// Apply the metaball shader.
|
||||
metaballShader.CurrentTechnique.Passes[0].Apply();
|
||||
}
|
||||
|
||||
public static void SpawnParticle(Vector2 position, float size) => Particles.Add(new(position, size));
|
||||
|
||||
public override void DrawInstances()
|
||||
{
|
||||
float opacity = 1f;
|
||||
Texture2D tex = ModContent.Request<Texture2D>("CalamityMod/Graphics/Metaballs/MetaballMessy").Value;
|
||||
|
||||
foreach (PhotoParticle4 particle in Particles)
|
||||
{
|
||||
Vector2 drawPosition = particle.Center - Main.screenPosition;
|
||||
var origin = tex.Size() * 0.5f;
|
||||
Vector2 scale = Vector2.One * particle.Size / tex.Size();
|
||||
|
||||
float Interpolant = Utils.GetLerpValue(25f, 60f, particle.Size * 0.6f, true);
|
||||
Color drawColor = Color.Lerp(Color.White, EdgeColor, Interpolant).MultiplyRGBA(new Color(1f, 1f, 1f, opacity));
|
||||
|
||||
Main.spriteBatch.Draw(tex, drawPosition, null, drawColor, 0f, origin, scale, SpriteEffects.None, 0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using CalamityMod.Effects;
|
||||
using System;
|
||||
|
||||
namespace CalamityMod.Graphics.Metaballs
|
||||
{
|
||||
// CONSIDER -- Dominic 01NOV2023 This really should not be a metaball. Some sort of separately drawn fire effect would be far more suitable, and overall less awkward.
|
||||
// However, for consistency with the previous effect, I'll leave it as is.
|
||||
public class RancorLavaMetaball : Metaball
|
||||
{
|
||||
public class LavaParticle
|
||||
{
|
||||
public int Time;
|
||||
|
||||
public float Size;
|
||||
|
||||
public Vector2 Center;
|
||||
|
||||
public LavaParticle(Vector2 center, float size)
|
||||
{
|
||||
Center = center;
|
||||
Size = size;
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
Time++;
|
||||
Size = MathHelper.Clamp(Size - 0.24f, 0f, 200f) * 0.9956f;
|
||||
if (Size < 15f)
|
||||
Size = Size * 0.95f - 0.9f;
|
||||
}
|
||||
}
|
||||
|
||||
public static List<LavaParticle> Particles
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
} = new();
|
||||
|
||||
public override bool AnythingToDraw => Particles.Any();
|
||||
|
||||
public override MetaballDrawLayer DrawContext => MetaballDrawLayer.AfterProjectiles;
|
||||
|
||||
public override IEnumerable<Texture2D> Layers
|
||||
{
|
||||
get
|
||||
{
|
||||
yield return ModContent.Request<Texture2D>("CalamityMod/Projectiles/InvisibleProj").Value;
|
||||
}
|
||||
}
|
||||
|
||||
public override Color EdgeColor => new(255, 56, 3);
|
||||
|
||||
public override void ClearInstances() => Particles.Clear();
|
||||
|
||||
public override void PrepareShaderForTarget(int layerIndex)
|
||||
{
|
||||
// Store the shader in an easy to use local variable.
|
||||
var metaballShader = CalamityShaders.AdditiveMetaballEdgeShader;
|
||||
|
||||
// Calculate the layer scroll offset. This is used to ensure that the texture contents of the given metaball have parallax, rather than being static over the screen
|
||||
// regardless of world position.
|
||||
Vector2 screenSize = new(Main.screenWidth, Main.screenHeight);
|
||||
|
||||
// Supply shader parameter values.
|
||||
metaballShader.Parameters["screenArea"]?.SetValue(screenSize);
|
||||
metaballShader.Parameters["layerOffset"]?.SetValue(Vector2.Zero);
|
||||
metaballShader.Parameters["singleFrameScreenOffset"]?.SetValue(Vector2.Zero);
|
||||
|
||||
// Apply the metaball shader.
|
||||
metaballShader.CurrentTechnique.Passes[0].Apply();
|
||||
}
|
||||
|
||||
public static void SpawnParticle(Vector2 position, float size) =>
|
||||
Particles.Add(new(position, size));
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
// Update all particle instances.
|
||||
// Once sufficiently small, they vanish.
|
||||
for (int i = 0; i < Particles.Count; i++)
|
||||
Particles[i].Update();
|
||||
Particles.RemoveAll(p => p.Size <= 3f);
|
||||
}
|
||||
|
||||
public override void PrepareSpriteBatch(SpriteBatch spriteBatch)
|
||||
{
|
||||
// Draw with additive blending.
|
||||
Main.spriteBatch.End();
|
||||
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Additive, SamplerState.PointClamp, DepthStencilState.Default, Main.Rasterizer, null, Matrix.Identity);
|
||||
}
|
||||
|
||||
public override void DrawInstances()
|
||||
{
|
||||
Texture2D tex = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/SmallGreyscaleCircle").Value;
|
||||
|
||||
// Draw all particles.
|
||||
foreach (LavaParticle particle in Particles)
|
||||
{
|
||||
Vector2 drawPosition = particle.Center - Main.screenPosition;
|
||||
Vector2 origin = tex.Size() * 0.5f;
|
||||
Vector2 scale = Vector2.One * particle.Size / tex.Size();
|
||||
Color lavaColor = EdgeColor * 1.2f;
|
||||
|
||||
// Make the lava color vary slightly based on position, to make the effect less monotonous.
|
||||
lavaColor.B = (byte)(lavaColor.B + (int)(MathF.Cos(particle.Center.Y * 0.015f + Main.GlobalTimeWrappedHourly * 0.1f) * 3f));
|
||||
|
||||
// Make the lava color bright for the first few frames of its existence.
|
||||
float brightnessInterpolant = Utils.GetLerpValue(10f, 2f, particle.Time, true) * 0.67f;
|
||||
lavaColor = Color.Lerp(lavaColor, Color.Wheat, brightnessInterpolant);
|
||||
|
||||
Main.spriteBatch.Draw(tex, drawPosition, null, lavaColor, 0f, origin, scale, 0, 0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 3.1 KiB |
@@ -0,0 +1,103 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Content;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Graphics.Metaballs
|
||||
{
|
||||
public class StreamGougeMetaball : Metaball
|
||||
{
|
||||
public class CosmicParticle
|
||||
{
|
||||
public float Size;
|
||||
|
||||
public Vector2 Velocity;
|
||||
|
||||
public Vector2 Center;
|
||||
|
||||
public CosmicParticle(Vector2 center, Vector2 velocity, float size)
|
||||
{
|
||||
Center = center;
|
||||
Velocity = velocity;
|
||||
Size = size;
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
Center += Velocity;
|
||||
Velocity *= 0.96f;
|
||||
Size *= 0.91f;
|
||||
}
|
||||
}
|
||||
|
||||
public static Asset<Texture2D> LayerAsset
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public static List<CosmicParticle> Particles
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
} = new();
|
||||
|
||||
public override bool AnythingToDraw => Particles.Any();
|
||||
|
||||
public override IEnumerable<Texture2D> Layers
|
||||
{
|
||||
get
|
||||
{
|
||||
yield return LayerAsset.Value;
|
||||
}
|
||||
}
|
||||
|
||||
public override MetaballDrawLayer DrawContext => MetaballDrawLayer.AfterProjectiles;
|
||||
|
||||
public override Color EdgeColor => Color.Lerp(Color.DarkBlue, Color.Black, 0.75f);
|
||||
|
||||
public override void Load()
|
||||
{
|
||||
if (Main.netMode == NetmodeID.Server)
|
||||
return;
|
||||
|
||||
// Load the layer asset wrapper.
|
||||
LayerAsset = ModContent.Request<Texture2D>($"CalamityMod/Graphics/Metaballs/StreamGougeLayer", AssetRequestMode.ImmediateLoad);
|
||||
}
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
// Update all particle instances.
|
||||
// Once sufficiently small, they vanish.
|
||||
for (int i = 0; i < Particles.Count; i++)
|
||||
Particles[i].Update();
|
||||
Particles.RemoveAll(p => p.Size <= 2f);
|
||||
}
|
||||
|
||||
public static void SpawnParticle(Vector2 position, Vector2 velocity, float size) =>
|
||||
Particles.Add(new(position, velocity, size));
|
||||
|
||||
// Make the texture scroll.
|
||||
public override Vector2 CalculateManualOffsetForLayer(int layerIndex)
|
||||
{
|
||||
return Vector2.UnitX * Main.GlobalTimeWrappedHourly * 0.037f;
|
||||
}
|
||||
|
||||
public override void DrawInstances()
|
||||
{
|
||||
Texture2D tex = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/BasicCircle").Value;
|
||||
|
||||
foreach (CosmicParticle particle in Particles)
|
||||
{
|
||||
Vector2 drawPosition = particle.Center - Main.screenPosition;
|
||||
Vector2 origin = tex.Size() * 0.5f;
|
||||
Vector2 scale = Vector2.One * particle.Size / tex.Size();
|
||||
Main.spriteBatch.Draw(tex, drawPosition, null, Color.White, 0f, origin, scale, SpriteEffects.None, 0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
using static CalamityMod.Graphics.Metaballs.StreamGougeMetaball;
|
||||
|
||||
namespace CalamityMod.Graphics.Metaballs
|
||||
{
|
||||
public class VoidGeneratorMetaball : Metaball
|
||||
{
|
||||
public static List<CosmicParticle> Particles
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
} = new();
|
||||
|
||||
public override bool AnythingToDraw => Particles.Any();
|
||||
|
||||
public override IEnumerable<Texture2D> Layers
|
||||
{
|
||||
get
|
||||
{
|
||||
yield return LayerAsset.Value;
|
||||
}
|
||||
}
|
||||
|
||||
public override MetaballDrawLayer DrawContext => MetaballDrawLayer.BeforeProjectiles;
|
||||
|
||||
public override Color EdgeColor => Color.Lerp(Color.Purple, Color.Black, 0.75f);
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
// Update all particle instances.
|
||||
// Once sufficiently small, they vanish.
|
||||
for (int i = 0; i < Particles.Count; i++)
|
||||
Particles[i].Update();
|
||||
Particles.RemoveAll(p => p.Size <= 2f);
|
||||
}
|
||||
|
||||
public static CosmicParticle SpawnParticle(Vector2 position, Vector2 velocity, float size)
|
||||
{
|
||||
CosmicParticle particle = new(position, velocity, size);
|
||||
Particles.Add(particle);
|
||||
|
||||
return particle;
|
||||
}
|
||||
|
||||
// Make the texture scroll.
|
||||
public override Vector2 CalculateManualOffsetForLayer(int layerIndex)
|
||||
{
|
||||
return Vector2.UnitX * Main.GlobalTimeWrappedHourly * 0.037f;
|
||||
}
|
||||
|
||||
public override void DrawInstances()
|
||||
{
|
||||
Texture2D tex = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/BasicCircle").Value;
|
||||
|
||||
foreach (CosmicParticle particle in Particles)
|
||||
{
|
||||
Vector2 drawPosition = particle.Center - Main.screenPosition;
|
||||
Vector2 origin = tex.Size() * 0.5f;
|
||||
Vector2 scale = Vector2.One * particle.Size / tex.Size();
|
||||
Main.spriteBatch.Draw(tex, drawPosition, null, Color.White, 0f, origin, scale, SpriteEffects.None, 0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,6 @@ using CalamityMod.NPCs.AstrumAureus;
|
||||
using CalamityMod.NPCs.Crabulon;
|
||||
using CalamityMod.NPCs.Ravager;
|
||||
using CalamityMod.Particles;
|
||||
using CalamityMod.Particles.Metaballs;
|
||||
using CalamityMod.Projectiles;
|
||||
using CalamityMod.Projectiles.Typeless;
|
||||
using CalamityMod.Systems;
|
||||
@@ -261,7 +260,7 @@ namespace CalamityMod.ILEditing
|
||||
self.dashTime = 15;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
dashing = true;
|
||||
self.dashTime = 0;
|
||||
self.timeSinceLastDashStarted = 0;
|
||||
@@ -707,7 +706,6 @@ namespace CalamityMod.ILEditing
|
||||
private static void DrawFusableParticles(Terraria.On_Main.orig_SortDrawCacheWorms orig, Main self)
|
||||
{
|
||||
DeathAshParticle.DrawAll();
|
||||
FusableParticleManager.RenderAllFusableParticles();
|
||||
|
||||
if (Main.LocalPlayer.dye.Any(dyeItem => dyeItem.type == ModContent.ItemType<ProfanedMoonlightDye>()))
|
||||
Main.LocalPlayer.Calamity().ProfanedMoonlightAuroraDrawer?.Draw(Main.LocalPlayer.Center - Main.screenPosition, false, Main.GameViewMatrix.TransformationMatrix, Matrix.Identity);
|
||||
@@ -739,23 +737,23 @@ namespace CalamityMod.ILEditing
|
||||
Main.tileBatch.Draw(liquidTexture, position, liquidSize, colors, default(Vector2), 1f, SpriteEffects.None);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Texture2D slopeTexture = SelectLavaTexture(liquidType == 1 ? CustomLavaManagement.LavaSlopeTexture : TextureAssets.LiquidSlope[liquidType].Value, LiquidTileType.Slope);
|
||||
liquidSize.X += 18 * (slope - 1);
|
||||
switch (slope)
|
||||
{
|
||||
case 1:
|
||||
Main.tileBatch.Draw(slopeTexture, position, liquidSize, colors, Vector2.Zero, 1f, SpriteEffects.None);
|
||||
break;
|
||||
case 2:
|
||||
Main.tileBatch.Draw(slopeTexture, position, liquidSize, colors, Vector2.Zero, 1f, SpriteEffects.None);
|
||||
break;
|
||||
case 3:
|
||||
Main.tileBatch.Draw(slopeTexture, position, liquidSize, colors, Vector2.Zero, 1f, SpriteEffects.None);
|
||||
break;
|
||||
case 4:
|
||||
Main.tileBatch.Draw(slopeTexture, position, liquidSize, colors, Vector2.Zero, 1f, SpriteEffects.None);
|
||||
break;
|
||||
case 1:
|
||||
Main.tileBatch.Draw(slopeTexture, position, liquidSize, colors, Vector2.Zero, 1f, SpriteEffects.None);
|
||||
break;
|
||||
case 2:
|
||||
Main.tileBatch.Draw(slopeTexture, position, liquidSize, colors, Vector2.Zero, 1f, SpriteEffects.None);
|
||||
break;
|
||||
case 3:
|
||||
Main.tileBatch.Draw(slopeTexture, position, liquidSize, colors, Vector2.Zero, 1f, SpriteEffects.None);
|
||||
break;
|
||||
case 4:
|
||||
Main.tileBatch.Draw(slopeTexture, position, liquidSize, colors, Vector2.Zero, 1f, SpriteEffects.None);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -797,7 +795,7 @@ namespace CalamityMod.ILEditing
|
||||
{
|
||||
initialColor = SelectLavaQuadColor(initialTexture, ref initialColor, liquidType == 1);
|
||||
|
||||
if (liquidType == ModContent.Find<ModWaterStyle>("CalamityMod/SunkenSeaWater").Slot ||
|
||||
if (liquidType == ModContent.Find<ModWaterStyle>("CalamityMod/SunkenSeaWater").Slot ||
|
||||
liquidType == ModContent.Find<ModWaterStyle>("CalamityMod/SulphuricWater").Slot ||
|
||||
liquidType == ModContent.Find<ModWaterStyle>("CalamityMod/SulphuricDepthsWater").Slot ||
|
||||
liquidType == ModContent.Find<ModWaterStyle>("CalamityMod/UpperAbyssWater").Slot ||
|
||||
@@ -923,7 +921,7 @@ namespace CalamityMod.ILEditing
|
||||
return;
|
||||
|
||||
Tile above = CalamityUtils.ParanoidTileRetrieval(x, y - 1);
|
||||
if (!Main.gamePaused && !above.HasTile && above.LiquidAmount <= 0 && Main.rand.NextBool(9) &&
|
||||
if (!Main.gamePaused && !above.HasTile && above.LiquidAmount <= 0 && Main.rand.NextBool(9) &&
|
||||
Main.waterStyle == SulphuricWater.Type)
|
||||
{
|
||||
MediumMistParticle acidFoam = new(new(x * 16f + Main.rand.NextFloat(16f), y * 16f + 8f), -Vector2.UnitY.RotatedByRandom(0.67f) * Main.rand.NextFloat(1f, 2.4f), Color.LightSeaGreen, Color.White, 0.16f, 128f, 0.02f);
|
||||
|
||||
|
Before Width: | Height: | Size: 771 B After Width: | Height: | Size: 850 B |
|
Before Width: | Height: | Size: 801 B After Width: | Height: | Size: 892 B |
@@ -22,9 +22,9 @@ namespace CalamityMod.Items.Accessories
|
||||
|
||||
public override void Update(ref float gravity, ref float maxFallSpeed)
|
||||
{
|
||||
float num = Main.rand.Next(90, 111) * 0.01f;
|
||||
num *= Main.essScale;
|
||||
Lighting.AddLight((int)((Item.position.X + (float)(Item.width / 2)) / 16f), (int)((Item.position.Y + (float)(Item.height / 2)) / 16f), 0.35f * num, 0.05f * num, 0.35f * num);
|
||||
float projLighting = Main.rand.Next(90, 111) * 0.01f;
|
||||
projLighting *= Main.essScale;
|
||||
Lighting.AddLight((int)((Item.position.X + (float)(Item.width / 2)) / 16f), (int)((Item.position.Y + (float)(Item.height / 2)) / 16f), 0.35f * projLighting, 0.05f * projLighting, 0.35f * projLighting);
|
||||
}
|
||||
|
||||
public override void UpdateAccessory(Player player, bool hideVisual)
|
||||
@@ -36,61 +36,60 @@ namespace CalamityMod.Items.Accessories
|
||||
float knockBack = 3f;
|
||||
if (Main.rand.NextBool(15))
|
||||
{
|
||||
int num = 0;
|
||||
int numProj = 0;
|
||||
for (int i = 0; i < Main.maxProjectiles; i++)
|
||||
{
|
||||
if (Main.projectile[i].active && Main.projectile[i].owner == player.whoAmI && Main.projectile[i].type == ModContent.ProjectileType<NebulaStar>())
|
||||
{
|
||||
num++;
|
||||
numProj++;
|
||||
}
|
||||
}
|
||||
var source = player.GetSource_Accessory(Item);
|
||||
if (Main.rand.Next(15) >= num && num < 10)
|
||||
if (Main.rand.Next(15) >= numProj && numProj < 10)
|
||||
{
|
||||
int num2 = 50;
|
||||
int num3 = 24;
|
||||
int num4 = 90;
|
||||
for (int j = 0; j < num2; j++)
|
||||
int spawnRadius = 24;
|
||||
int backupSpawnRadius = 90;
|
||||
for (int j = 0; j < 50; j++)
|
||||
{
|
||||
int num5 = Main.rand.Next(200 - j * 2, 400 + j * 2);
|
||||
int randomProjOffset = Main.rand.Next(200 - j * 2, 400 + j * 2);
|
||||
Vector2 center = player.Center;
|
||||
center.X += (float)Main.rand.Next(-num5, num5 + 1);
|
||||
center.Y += (float)Main.rand.Next(-num5, num5 + 1);
|
||||
if (!Collision.SolidCollision(center, num3, num3) && !Collision.WetCollision(center, num3, num3))
|
||||
center.X += (float)Main.rand.Next(-randomProjOffset, randomProjOffset + 1);
|
||||
center.Y += (float)Main.rand.Next(-randomProjOffset, randomProjOffset + 1);
|
||||
if (!Collision.SolidCollision(center, spawnRadius, spawnRadius) && !Collision.WetCollision(center, spawnRadius, spawnRadius))
|
||||
{
|
||||
center.X += (float)(num3 / 2);
|
||||
center.Y += (float)(num3 / 2);
|
||||
center.X += (float)(spawnRadius / 2);
|
||||
center.Y += (float)(spawnRadius / 2);
|
||||
if (Collision.CanHit(new Vector2(player.Center.X, player.position.Y), 1, 1, center, 1, 1) || Collision.CanHit(new Vector2(player.Center.X, player.position.Y - 50f), 1, 1, center, 1, 1))
|
||||
{
|
||||
int num6 = (int)center.X / 16;
|
||||
int num7 = (int)center.Y / 16;
|
||||
bool flag = false;
|
||||
if (Main.rand.NextBool(3) && Main.tile[num6, num7] != null && Main.tile[num6, num7].WallType > 0)
|
||||
int projTileX = (int)center.X / 16;
|
||||
int projTileY = (int)center.Y / 16;
|
||||
bool canSpawnProj = false;
|
||||
if (Main.rand.NextBool(3) && Main.tile[projTileX, projTileY] != null && Main.tile[projTileX, projTileY].WallType > 0)
|
||||
{
|
||||
flag = true;
|
||||
canSpawnProj = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
center.X -= (float)(num4 / 2);
|
||||
center.Y -= (float)(num4 / 2);
|
||||
if (Collision.SolidCollision(center, num4, num4))
|
||||
center.X -= (float)(backupSpawnRadius / 2);
|
||||
center.Y -= (float)(backupSpawnRadius / 2);
|
||||
if (Collision.SolidCollision(center, backupSpawnRadius, backupSpawnRadius))
|
||||
{
|
||||
center.X += (float)(num4 / 2);
|
||||
center.Y += (float)(num4 / 2);
|
||||
flag = true;
|
||||
center.X += (float)(backupSpawnRadius / 2);
|
||||
center.Y += (float)(backupSpawnRadius / 2);
|
||||
canSpawnProj = true;
|
||||
}
|
||||
}
|
||||
if (flag)
|
||||
if (canSpawnProj)
|
||||
{
|
||||
for (int k = 0; k < Main.maxProjectiles; k++)
|
||||
{
|
||||
if (Main.projectile[k].active && Main.projectile[k].owner == player.whoAmI && Main.projectile[k].type == ModContent.ProjectileType<NebulaStar>() && (center - Main.projectile[k].Center).Length() < 48f)
|
||||
{
|
||||
flag = false;
|
||||
canSpawnProj = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (flag && Main.myPlayer == player.whoAmI)
|
||||
if (canSpawnProj && Main.myPlayer == player.whoAmI)
|
||||
{
|
||||
Projectile.NewProjectile(source, center.X, center.Y, 0f, 0f, ModContent.ProjectileType<NebulaStar>(), damage, knockBack, player.whoAmI);
|
||||
return;
|
||||
|
||||
@@ -43,9 +43,9 @@ namespace CalamityMod.Items.Accessories
|
||||
int myPlayer = Main.myPlayer;
|
||||
if (Main.player[myPlayer].team == player.team && player.team != 0)
|
||||
{
|
||||
float num = player.position.X - Main.player[myPlayer].position.X;
|
||||
float num2 = player.position.Y - Main.player[myPlayer].position.Y;
|
||||
if ((float)Math.Sqrt(num * num + num2 * num2) < 800f)
|
||||
float teamPlayerXDist = player.position.X - Main.player[myPlayer].position.X;
|
||||
float teamPlayerYDist = player.position.Y - Main.player[myPlayer].position.Y;
|
||||
if ((float)Math.Sqrt(teamPlayerXDist * teamPlayerXDist + teamPlayerYDist * teamPlayerYDist) < 800f)
|
||||
Main.player[myPlayer].AddBuff(BuffID.PaladinsShield, 20);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,9 +27,8 @@ namespace CalamityMod.Items.Accessories
|
||||
player.buffImmune[ModContent.BuffType<Plague>()] = true;
|
||||
int plagueCounter = 0;
|
||||
Lighting.AddLight((int)(player.Center.X / 16f), (int)(player.Center.Y / 16f), 0.05f, 1f, 0.1f);
|
||||
int num = ModContent.BuffType<Plague>();
|
||||
float num2 = 300f;
|
||||
bool flag = plagueCounter % 60 == 0;
|
||||
int plagueDebuff = ModContent.BuffType<Plague>();
|
||||
bool shouldInflictPlague = plagueCounter % 60 == 0;
|
||||
int auraDamage = (int)player.GetBestClassDamage().ApplyTo(50);
|
||||
int random = Main.rand.Next(10);
|
||||
var source = player.GetSource_Accessory(Item);
|
||||
@@ -40,13 +39,13 @@ namespace CalamityMod.Items.Accessories
|
||||
for (int l = 0; l < Main.maxNPCs; l++)
|
||||
{
|
||||
NPC nPC = Main.npc[l];
|
||||
if (nPC.IsAnEnemy() && !nPC.dontTakeDamage && !nPC.buffImmune[num] && Vector2.Distance(player.Center, nPC.Center) <= num2)
|
||||
if (nPC.IsAnEnemy() && !nPC.dontTakeDamage && !nPC.buffImmune[plagueDebuff] && Vector2.Distance(player.Center, nPC.Center) <= 300f)
|
||||
{
|
||||
if (nPC.FindBuffIndex(num) == -1)
|
||||
if (nPC.FindBuffIndex(plagueDebuff) == -1)
|
||||
{
|
||||
nPC.AddBuff(num, 120, false);
|
||||
nPC.AddBuff(plagueDebuff, 120, false);
|
||||
}
|
||||
if (flag)
|
||||
if (shouldInflictPlague)
|
||||
{
|
||||
if (player.whoAmI == Main.myPlayer)
|
||||
{
|
||||
|
||||
@@ -38,12 +38,12 @@ namespace CalamityMod.Items.Accessories.Wings
|
||||
SoundEngine.PlaySound(SoundID.Item13, player.Center);
|
||||
player.rocketDelay2 = 60;
|
||||
}
|
||||
int num66 = 2;
|
||||
int dustAmt = 2;
|
||||
if (player.controlUp)
|
||||
{
|
||||
num66 = 4;
|
||||
dustAmt = 4;
|
||||
}
|
||||
for (int num67 = 0; num67 < num66; num67++)
|
||||
for (int i = 0; i < dustAmt; i++)
|
||||
{
|
||||
int type = 6;
|
||||
float scale = 1.75f;
|
||||
@@ -53,27 +53,27 @@ namespace CalamityMod.Items.Accessories.Wings
|
||||
{
|
||||
x = player.position.X + (float)(player.width / 2) - 26f;
|
||||
}
|
||||
float num68 = player.position.Y + (float)player.height - 18f;
|
||||
if (num67 == 1 || num67 == 3)
|
||||
float dustYPos = player.position.Y + (float)player.height - 18f;
|
||||
if (i == 1 || i == 3)
|
||||
{
|
||||
x = player.position.X + (float)(player.width / 2) + 8f;
|
||||
if (player.direction > 0)
|
||||
{
|
||||
x = player.position.X + (float)(player.width / 2) - 20f;
|
||||
}
|
||||
num68 += 6f;
|
||||
dustYPos += 6f;
|
||||
}
|
||||
if (num67 > 1)
|
||||
if (i > 1)
|
||||
{
|
||||
num68 += player.velocity.Y;
|
||||
dustYPos += player.velocity.Y;
|
||||
}
|
||||
int num69 = Dust.NewDust(new Vector2(x, num68), 8, 8, type, 0f, 0f, alpha, default, scale);
|
||||
Dust dust = Main.dust[num69];
|
||||
int boosterDust = Dust.NewDust(new Vector2(x, dustYPos), 8, 8, type, 0f, 0f, alpha, default, scale);
|
||||
Dust dust = Main.dust[boosterDust];
|
||||
dust.velocity.X *= 0.1f;
|
||||
dust.velocity.Y = Main.dust[num69].velocity.Y * 1f + 2f * player.gravDir - player.velocity.Y * 0.3f;
|
||||
dust.velocity.Y = Main.dust[boosterDust].velocity.Y * 1f + 2f * player.gravDir - player.velocity.Y * 0.3f;
|
||||
dust.noGravity = true;
|
||||
dust.shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player);
|
||||
if (num66 == 4)
|
||||
if (dustAmt == 4)
|
||||
{
|
||||
dust.velocity.Y += 6f;
|
||||
}
|
||||
|
||||
@@ -31,19 +31,19 @@ namespace CalamityMod.Items.Accessories.Wings
|
||||
{
|
||||
if (player.controlJump && player.wingTime > 0f && player.jump == 0 && player.velocity.Y != 0f && !hideVisual)
|
||||
{
|
||||
int num59 = 4;
|
||||
int dustXOffset = 4;
|
||||
if (player.direction == 1)
|
||||
{
|
||||
num59 = -40;
|
||||
dustXOffset = -40;
|
||||
}
|
||||
int num60 = Dust.NewDust(new Vector2(player.position.X + (float)(player.width / 2) + (float)num59, player.position.Y + (float)(player.height / 2) - 15f), 30, 30, 91, 0f, 0f, 100, default, 2.4f);
|
||||
Main.dust[num60].noGravity = true;
|
||||
Main.dust[num60].velocity *= 0.3f;
|
||||
int flightDust = Dust.NewDust(new Vector2(player.position.X + (float)(player.width / 2) + (float)dustXOffset, player.position.Y + (float)(player.height / 2) - 15f), 30, 30, 91, 0f, 0f, 100, default, 2.4f);
|
||||
Main.dust[flightDust].noGravity = true;
|
||||
Main.dust[flightDust].velocity *= 0.3f;
|
||||
if (Main.rand.NextBool(10))
|
||||
{
|
||||
Main.dust[num60].fadeIn = 2f;
|
||||
Main.dust[flightDust].fadeIn = 2f;
|
||||
}
|
||||
Main.dust[num60].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player);
|
||||
Main.dust[flightDust].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player);
|
||||
}
|
||||
player.noFallDmg = true;
|
||||
}
|
||||
|
||||
@@ -40,19 +40,19 @@ namespace CalamityMod.Items.Accessories.Wings
|
||||
|
||||
if (player.controlJump && player.wingTime > 0f && player.jump == 0 && player.velocity.Y != 0f && !hideVisual)
|
||||
{
|
||||
int num59 = 4;
|
||||
int dustXOffset = 4;
|
||||
if (player.direction == 1)
|
||||
{
|
||||
num59 = -40;
|
||||
dustXOffset = -40;
|
||||
}
|
||||
int num60 = Dust.NewDust(new Vector2(player.position.X + (float)(player.width / 2) + (float)num59, player.position.Y + (float)(player.height / 2) - 15f), 30, 30, 6, 0f, 0f, 100, default, 2.4f);
|
||||
Main.dust[num60].noGravity = true;
|
||||
Main.dust[num60].velocity *= 0.3f;
|
||||
int flightDust = Dust.NewDust(new Vector2(player.position.X + (float)(player.width / 2) + (float)dustXOffset, player.position.Y + (float)(player.height / 2) - 15f), 30, 30, 6, 0f, 0f, 100, default, 2.4f);
|
||||
Main.dust[flightDust].noGravity = true;
|
||||
Main.dust[flightDust].velocity *= 0.3f;
|
||||
if (Main.rand.NextBool(10))
|
||||
{
|
||||
Main.dust[num60].fadeIn = 2f;
|
||||
Main.dust[flightDust].fadeIn = 2f;
|
||||
}
|
||||
Main.dust[num60].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player);
|
||||
Main.dust[flightDust].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player);
|
||||
}
|
||||
player.noFallDmg = true;
|
||||
}
|
||||
|
||||
@@ -69,10 +69,10 @@ namespace CalamityMod.Items.Accessories.Wings
|
||||
{
|
||||
yStart += player.velocity.Y;
|
||||
}
|
||||
int num69 = Dust.NewDust(new Vector2(xStart, yStart), 8, 8, type, 0f, 0f, alpha, default, scale);
|
||||
Dust dust = Main.dust[num69];
|
||||
int boosterDust = Dust.NewDust(new Vector2(xStart, yStart), 8, 8, type, 0f, 0f, alpha, default, scale);
|
||||
Dust dust = Main.dust[boosterDust];
|
||||
dust.velocity.X *= 0.1f;
|
||||
dust.velocity.Y = Main.dust[num69].velocity.Y * 1f + 2f * player.gravDir - player.velocity.Y * 0.3f;
|
||||
dust.velocity.Y = Main.dust[boosterDust].velocity.Y * 1f + 2f * player.gravDir - player.velocity.Y * 0.3f;
|
||||
dust.noGravity = true;
|
||||
dust.shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player);
|
||||
if (dustAmt == 4)
|
||||
|
||||
@@ -41,19 +41,19 @@ namespace CalamityMod.Items.Accessories.Wings
|
||||
|
||||
if (player.controlJump && player.wingTime > 0f && player.jump == 0 && player.velocity.Y != 0f && !hideVisual)
|
||||
{
|
||||
int num59 = 4;
|
||||
int dustXOffset = 4;
|
||||
if (player.direction == 1)
|
||||
{
|
||||
num59 = -40;
|
||||
dustXOffset = -40;
|
||||
}
|
||||
int num60 = Dust.NewDust(new Vector2(player.position.X + (float)(player.width / 2) + (float)num59, player.position.Y + (float)(player.height / 2) - 15f), 30, 30, 157, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f);
|
||||
Main.dust[num60].noGravity = true;
|
||||
Main.dust[num60].velocity *= 0.3f;
|
||||
int flightDust = Dust.NewDust(new Vector2(player.position.X + (float)(player.width / 2) + (float)dustXOffset, player.position.Y + (float)(player.height / 2) - 15f), 30, 30, 157, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f);
|
||||
Main.dust[flightDust].noGravity = true;
|
||||
Main.dust[flightDust].velocity *= 0.3f;
|
||||
if (Main.rand.NextBool(10))
|
||||
{
|
||||
Main.dust[num60].fadeIn = 2f;
|
||||
Main.dust[flightDust].fadeIn = 2f;
|
||||
}
|
||||
Main.dust[num60].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player);
|
||||
Main.dust[flightDust].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player);
|
||||
}
|
||||
player.noFallDmg = true;
|
||||
}
|
||||
|
||||
@@ -33,9 +33,9 @@ namespace CalamityMod.Items.Accessories.Wings
|
||||
|
||||
public override void Update(ref float gravity, ref float maxFallSpeed)
|
||||
{
|
||||
float num = (float)Main.rand.Next(90, 111) * 0.01f;
|
||||
num *= Main.essScale;
|
||||
Lighting.AddLight((int)((Item.position.X + (float)(Item.width / 2)) / 16f), (int)((Item.position.Y + (float)(Item.height / 2)) / 16f), 0f * num, 0.3f * num, 0.3f * num);
|
||||
float lightOffset = (float)Main.rand.Next(90, 111) * 0.01f;
|
||||
lightOffset *= Main.essScale;
|
||||
Lighting.AddLight((int)((Item.position.X + (float)(Item.width / 2)) / 16f), (int)((Item.position.Y + (float)(Item.height / 2)) / 16f), 0f * lightOffset, 0.3f * lightOffset, 0.3f * lightOffset);
|
||||
}
|
||||
|
||||
public override void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend)
|
||||
|
||||
@@ -40,19 +40,19 @@ namespace CalamityMod.Items.Accessories.Wings
|
||||
|
||||
if (player.controlJump && player.wingTime > 0f && player.jump == 0 && player.velocity.Y != 0f && !hideVisual)
|
||||
{
|
||||
int num59 = 4;
|
||||
int dustXOffset = 4;
|
||||
if (player.direction == 1)
|
||||
{
|
||||
num59 = -40;
|
||||
dustXOffset = -40;
|
||||
}
|
||||
int num60 = Dust.NewDust(new Vector2(player.position.X + (float)(player.width / 2) + (float)num59, player.position.Y + (float)(player.height / 2) - 15f), 30, 30, 173, 0f, 0f, 100, default, 2.4f);
|
||||
Main.dust[num60].noGravity = true;
|
||||
Main.dust[num60].velocity *= 0.3f;
|
||||
int flightDust = Dust.NewDust(new Vector2(player.position.X + (float)(player.width / 2) + (float)dustXOffset, player.position.Y + (float)(player.height / 2) - 15f), 30, 30, 173, 0f, 0f, 100, default, 2.4f);
|
||||
Main.dust[flightDust].noGravity = true;
|
||||
Main.dust[flightDust].velocity *= 0.3f;
|
||||
if (Main.rand.NextBool(10))
|
||||
{
|
||||
Main.dust[num60].fadeIn = 2f;
|
||||
Main.dust[flightDust].fadeIn = 2f;
|
||||
}
|
||||
Main.dust[num60].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player);
|
||||
Main.dust[flightDust].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player);
|
||||
}
|
||||
player.noFallDmg = true;
|
||||
}
|
||||
|
||||
@@ -43,19 +43,19 @@ namespace CalamityMod.Items.Accessories.Wings
|
||||
|
||||
if (player.controlJump && player.wingTime > 0f && player.jump == 0 && player.velocity.Y != 0f && !hideVisual)
|
||||
{
|
||||
int num59 = 4;
|
||||
int dustXOffset = 4;
|
||||
if (player.direction == 1)
|
||||
{
|
||||
num59 = -40;
|
||||
dustXOffset = -40;
|
||||
}
|
||||
int num60 = Dust.NewDust(new Vector2(player.position.X + (float)(player.width / 2) + (float)num59, player.position.Y + (float)(player.height / 2) - 15f), 30, 30, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 2.4f);
|
||||
Main.dust[num60].noGravity = true;
|
||||
Main.dust[num60].velocity *= 0.3f;
|
||||
int flightDust = Dust.NewDust(new Vector2(player.position.X + (float)(player.width / 2) + (float)dustXOffset, player.position.Y + (float)(player.height / 2) - 15f), 30, 30, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 2.4f);
|
||||
Main.dust[flightDust].noGravity = true;
|
||||
Main.dust[flightDust].velocity *= 0.3f;
|
||||
if (Main.rand.NextBool(10))
|
||||
{
|
||||
Main.dust[num60].fadeIn = 2f;
|
||||
Main.dust[flightDust].fadeIn = 2f;
|
||||
}
|
||||
Main.dust[num60].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player);
|
||||
Main.dust[flightDust].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player);
|
||||
}
|
||||
player.noFallDmg = true;
|
||||
}
|
||||
|
||||
@@ -34,19 +34,19 @@ namespace CalamityMod.Items.Accessories.Wings
|
||||
{
|
||||
if (player.controlJump && player.wingTime > 0f && player.jump == 0 && player.velocity.Y != 0f && !hideVisual)
|
||||
{
|
||||
int num59 = 4;
|
||||
int dustXOffset = 4;
|
||||
if (player.direction == 1)
|
||||
{
|
||||
num59 = -40;
|
||||
dustXOffset = -40;
|
||||
}
|
||||
int num60 = Dust.NewDust(new Vector2(player.position.X + (float)(player.width / 2) + (float)num59, player.position.Y + (float)(player.height / 2) - 15f), 30, 30, 107, 0f, 0f, 100, default, 2.4f);
|
||||
Main.dust[num60].noGravity = true;
|
||||
Main.dust[num60].velocity *= 0.3f;
|
||||
int flightDust = Dust.NewDust(new Vector2(player.position.X + (float)(player.width / 2) + (float)dustXOffset, player.position.Y + (float)(player.height / 2) - 15f), 30, 30, 107, 0f, 0f, 100, default, 2.4f);
|
||||
Main.dust[flightDust].noGravity = true;
|
||||
Main.dust[flightDust].velocity *= 0.3f;
|
||||
if (Main.rand.NextBool(10))
|
||||
{
|
||||
Main.dust[num60].fadeIn = 2f;
|
||||
Main.dust[flightDust].fadeIn = 2f;
|
||||
}
|
||||
Main.dust[num60].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player);
|
||||
Main.dust[flightDust].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player);
|
||||
}
|
||||
CalamityPlayer modPlayer = player.Calamity();
|
||||
player.accRunSpeed = 8f;
|
||||
|
||||
@@ -37,19 +37,19 @@ namespace CalamityMod.Items.Accessories.Wings
|
||||
{
|
||||
if (player.controlJump && player.wingTime > 0f && player.jump == 0 && player.velocity.Y != 0f && !hideVisual)
|
||||
{
|
||||
int num59 = 4;
|
||||
int dustXOffset = 4;
|
||||
if (player.direction == 1)
|
||||
{
|
||||
num59 = -40;
|
||||
dustXOffset = -40;
|
||||
}
|
||||
int num60 = Dust.NewDust(new Vector2(player.position.X + (float)(player.width / 2) + (float)num59, player.position.Y + (float)(player.height / 2) - 15f), 30, 30, Main.rand.NextBool() ? 206 : 173, 0f, 0f, 100, default, 2.4f);
|
||||
Main.dust[num60].noGravity = true;
|
||||
Main.dust[num60].velocity *= 0.3f;
|
||||
int flightDust = Dust.NewDust(new Vector2(player.position.X + (float)(player.width / 2) + (float)dustXOffset, player.position.Y + (float)(player.height / 2) - 15f), 30, 30, Main.rand.NextBool() ? 206 : 173, 0f, 0f, 100, default, 2.4f);
|
||||
Main.dust[flightDust].noGravity = true;
|
||||
Main.dust[flightDust].velocity *= 0.3f;
|
||||
if (Main.rand.NextBool(10))
|
||||
{
|
||||
Main.dust[num60].fadeIn = 2f;
|
||||
Main.dust[flightDust].fadeIn = 2f;
|
||||
}
|
||||
Main.dust[num60].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player);
|
||||
Main.dust[flightDust].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player);
|
||||
}
|
||||
CalamityPlayer modPlayer = player.Calamity();
|
||||
player.accRunSpeed = 8.5f;
|
||||
|
||||
@@ -37,19 +37,19 @@ namespace CalamityMod.Items.Accessories.Wings
|
||||
{
|
||||
if (player.controlJump && player.wingTime > 0f && player.jump == 0 && player.velocity.Y != 0f && !hideVisual)
|
||||
{
|
||||
int num59 = 4;
|
||||
int dustXOffset = 4;
|
||||
if (player.direction == 1)
|
||||
{
|
||||
num59 = -40;
|
||||
dustXOffset = -40;
|
||||
}
|
||||
int num60 = Dust.NewDust(new Vector2(player.position.X + (float)(player.width / 2) + (float)num59, player.position.Y + (float)(player.height / 2) - 15f), 30, 30, 91, 0f, 0f, 100, default, 2.4f);
|
||||
Main.dust[num60].noGravity = true;
|
||||
Main.dust[num60].velocity *= 0.3f;
|
||||
int flightDust = Dust.NewDust(new Vector2(player.position.X + (float)(player.width / 2) + (float)dustXOffset, player.position.Y + (float)(player.height / 2) - 15f), 30, 30, 91, 0f, 0f, 100, default, 2.4f);
|
||||
Main.dust[flightDust].noGravity = true;
|
||||
Main.dust[flightDust].velocity *= 0.3f;
|
||||
if (Main.rand.NextBool(10))
|
||||
{
|
||||
Main.dust[num60].fadeIn = 2f;
|
||||
Main.dust[flightDust].fadeIn = 2f;
|
||||
}
|
||||
Main.dust[num60].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player);
|
||||
Main.dust[flightDust].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player);
|
||||
}
|
||||
CalamityPlayer modPlayer = player.Calamity();
|
||||
player.accRunSpeed = 9f;
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace CalamityMod.Items.Armor.DesertProwler
|
||||
|
||||
private void ActivateSetBonus(Terraria.On_Player.orig_KeyDoubleTap orig, Player player, int keyDir)
|
||||
{
|
||||
if (keyDir == 0 && HasArmorSet(player) && !player.mount.Active)
|
||||
if (keyDir == (Main.ReversedUpDownArmorSetBonuses ? 1 : 0) && HasArmorSet(player) && !player.mount.Active)
|
||||
{
|
||||
// The set bonus can only be activated if the player does not have the cooldown.
|
||||
if (!player.Calamity().cooldowns.TryGetValue(SandsmokeBomb.ID, out CooldownInstance cd))
|
||||
@@ -166,7 +166,8 @@ namespace CalamityMod.Items.Armor.DesertProwler
|
||||
|
||||
if (setBonusIndex != -1)
|
||||
{
|
||||
TooltipLine setBonus1 = new TooltipLine(item.Mod, "CalamityMod:SetBonus1", CalamityUtils.GetTextValueFromModItem<DesertProwlerHat>("AbilityBrief"));
|
||||
string dir = Main.ReversedUpDownArmorSetBonuses ? "UP" : "DOWN";
|
||||
TooltipLine setBonus1 = new TooltipLine(item.Mod, "CalamityMod:SetBonus1", CalamityUtils.GetTextFromModItem<DesertProwlerHat>("AbilityBrief").Format(dir));
|
||||
setBonus1.OverrideColor = Color.Lerp(new Color(255, 229, 156), new Color(233, 225, 198), 0.5f + 0.5f * (float)Math.Sin(Main.GlobalTimeWrappedHourly * 3f));
|
||||
tooltips.Insert(setBonusIndex + 1, setBonus1);
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace CalamityMod.Items.Armor.Wulfrum
|
||||
|
||||
private void ActivateSetBonus(Terraria.On_Player.orig_KeyDoubleTap orig, Player player, int keyDir)
|
||||
{
|
||||
if (keyDir == 0 && HasArmorSet(player) && !player.mount.Active)
|
||||
if (keyDir == (Main.ReversedUpDownArmorSetBonuses ? 1 : 0) && HasArmorSet(player) && !player.mount.Active)
|
||||
{
|
||||
//Only activate if no cooldown & available scrap.
|
||||
if (player.Calamity().cooldowns.TryGetValue(WulfrumBastion.ID, out CooldownInstance cd))
|
||||
@@ -84,7 +84,7 @@ namespace CalamityMod.Items.Armor.Wulfrum
|
||||
else if (player.HasItem(ModContent.ItemType<WulfrumMetalScrap>()))
|
||||
{
|
||||
player.ConsumeItem(ModContent.ItemType<WulfrumMetalScrap>());
|
||||
//I Thiiiinnnk there's no need to add mp syncing packets sicne cooldowns get auto synced right.
|
||||
//I Thiiiinnnk there's no need to add mp syncing packets since cooldowns get auto synced right.
|
||||
player.AddCooldown(WulfrumBastion.ID, BastionCooldown + BastionTime);
|
||||
//Though do i need to sync that or is the player inventory auto synced?
|
||||
DummyCannon.SetDefaults(ItemType<WulfrumFusionCannon>());
|
||||
@@ -228,7 +228,8 @@ namespace CalamityMod.Items.Armor.Wulfrum
|
||||
|
||||
if (setBonusIndex != -1)
|
||||
{
|
||||
TooltipLine setBonus1 = new TooltipLine(item.Mod, "CalamityMod:SetBonus1", CalamityUtils.GetTextValueFromModItem<WulfrumHat>("AbilityBrief"));
|
||||
string dir = Main.ReversedUpDownArmorSetBonuses ? "UP" : "DOWN";
|
||||
TooltipLine setBonus1 = new TooltipLine(item.Mod, "CalamityMod:SetBonus1", CalamityUtils.GetTextFromModItem<WulfrumHat>("AbilityBrief").Format(dir));
|
||||
setBonus1.OverrideColor = Color.Lerp(new Color(194, 255, 67), new Color(112, 244, 244), 0.5f + 0.5f * (float)Math.Sin(Main.GlobalTimeWrappedHourly * 3f));
|
||||
tooltips.Insert(setBonusIndex + 1, setBonus1);
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ namespace CalamityMod.Items.BaseItems
|
||||
Terraria.UI.On_ItemSlot.LeftClick_ItemArray_int_int += LockMouseToSpecialItem;
|
||||
Terraria.UI.On_ItemSlot.Draw_SpriteBatch_ItemArray_int_int_Vector2_Color += DrawSpecial;
|
||||
}
|
||||
|
||||
private void DrawSpecial(Terraria.UI.On_ItemSlot.orig_Draw_SpriteBatch_ItemArray_int_int_Vector2_Color orig, SpriteBatch sb, Item[] inv, int context, int slot, Vector2 position, Color color)
|
||||
{
|
||||
if (inv[slot].ModItem is HeldOnlyItem && !(inv[slot].ModItem as HeldOnlyItem).VisibleInUI)
|
||||
|
||||
@@ -1597,7 +1597,7 @@ namespace CalamityMod.Items
|
||||
|
||||
public static bool HasEnoughAmmo(Player player, Item item, int ammoConsumed)
|
||||
{
|
||||
bool flag = false;
|
||||
bool hasEnoughAmmo = false;
|
||||
bool canShoot = false;
|
||||
|
||||
for (int i = 54; i < Main.InventorySlotsTotal; i++)
|
||||
@@ -1605,12 +1605,12 @@ namespace CalamityMod.Items
|
||||
if (player.inventory[i].ammo == item.useAmmo && (player.inventory[i].stack >= ammoConsumed || !player.inventory[i].consumable))
|
||||
{
|
||||
canShoot = true;
|
||||
flag = true;
|
||||
hasEnoughAmmo = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!flag)
|
||||
if (!hasEnoughAmmo)
|
||||
{
|
||||
for (int j = 0; j < 54; j++)
|
||||
{
|
||||
@@ -1627,7 +1627,7 @@ namespace CalamityMod.Items
|
||||
public static void ConsumeAdditionalAmmo(Player player, Item item, int ammoConsumed)
|
||||
{
|
||||
Item itemAmmo = new Item();
|
||||
bool flag = false;
|
||||
bool hasEnoughAmmo = false;
|
||||
bool dontConsumeAmmo = false;
|
||||
|
||||
for (int i = 54; i < Main.InventorySlotsTotal; i++)
|
||||
@@ -1635,12 +1635,12 @@ namespace CalamityMod.Items
|
||||
if (player.inventory[i].ammo == item.useAmmo && (player.inventory[i].stack >= ammoConsumed || !player.inventory[i].consumable))
|
||||
{
|
||||
itemAmmo = player.inventory[i];
|
||||
flag = true;
|
||||
hasEnoughAmmo = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!flag)
|
||||
if (!hasEnoughAmmo)
|
||||
{
|
||||
for (int j = 0; j < 54; j++)
|
||||
{
|
||||
|
||||
@@ -93,7 +93,7 @@ namespace CalamityMod.Items
|
||||
{ ItemID.DemonScythe, Do(AutoReuse, DamageExact(33)) },
|
||||
{ ItemID.DyeTradersScimitar, Do(AutoReuse, UseTurn, DamageExact(24)) }, // Exotic Scimitar
|
||||
{ ItemID.ElectrosphereLauncher, Do(DamageRatio(1.1f)) },
|
||||
{ ItemID.ElfMelter, Do(DamageExact(94), ShootSpeedDelta(+3f)) },
|
||||
{ ItemID.ElfMelter, Do(DamageExact(62), ShootSpeedDelta(+5f)) },
|
||||
{ ItemID.EmeraldStaff, Do(DamageExact(27)) },
|
||||
{ ItemID.EmpressBlade, Do(AutoReuse, DamageExact(60), UseExact(20)) }, // Terraprisma
|
||||
{ ItemID.EnchantedBoomerang, Do(DamageExact(24)) },
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
using CalamityMod.Projectiles.Ranged;
|
||||
using System.Collections.Generic;
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.NPCs.NormalNPCs;
|
||||
using CalamityMod.Projectiles.Ranged;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
@@ -10,6 +14,9 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches
|
||||
public class DragoonDrizzlefish : ModItem, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Items.Fishing";
|
||||
|
||||
public bool ballShot = true;
|
||||
public int shotCounter = 0;
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
Item.staff[Item.type] = true; //so it doesn't look weird af when holding it
|
||||
@@ -17,7 +24,7 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.damage = 20;
|
||||
Item.damage = 15;
|
||||
Item.DamageType = DamageClass.Ranged;
|
||||
Item.width = 42;
|
||||
Item.height = 38;
|
||||
@@ -25,31 +32,108 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches
|
||||
Item.useAnimation = 20;
|
||||
Item.useStyle = ItemUseStyleID.Shoot;
|
||||
Item.noMelee = true;
|
||||
Item.knockBack = 2f;
|
||||
Item.knockBack = 1.1f;
|
||||
Item.value = CalamityGlobalItem.Rarity3BuyPrice;
|
||||
Item.rare = ItemRarityID.Orange;
|
||||
Item.UseSound = SoundID.Item20;
|
||||
Item.autoReuse = true;
|
||||
Item.shoot = ModContent.ProjectileType<DrizzlefishFireball>();
|
||||
Item.shootSpeed = 11f;
|
||||
Item.useAmmo = AmmoID.Gel; // for GFB
|
||||
}
|
||||
public override void ModifyTooltips(List<TooltipLine> list) => list.FindAndReplace("[GFB]", this.GetLocalizedValue(Main.zenithWorld ? "TooltipGFB" : "TooltipNormal"));
|
||||
public override bool CanUseItem(Player player)
|
||||
{
|
||||
if (!Main.zenithWorld)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (player.altFunctionUse == 2)
|
||||
{
|
||||
if (Main.zenithWorld)
|
||||
{
|
||||
CalamityGlobalItem.HasEnoughAmmo(player, Item, 5);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
//so it looks normal when holding
|
||||
public override Vector2? HoldoutOrigin() => new Vector2(10, 10);
|
||||
public override Vector2? HoldoutOrigin() => new Vector2(7, 7);
|
||||
|
||||
public override bool AltFunctionUse(Player player) => Main.zenithWorld ? true : false;
|
||||
public override bool CanConsumeAmmo(Item ammo, Player player)
|
||||
{
|
||||
if (Main.zenithWorld && player.altFunctionUse == 2 && player.Calamity().dragoonDrizzlefishGelBoost < 6)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
|
||||
{
|
||||
velocity = velocity.RotatedByRandom(MathHelper.ToRadians(10f));
|
||||
int shotType = ModContent.ProjectileType<DrizzlefishFireball>();
|
||||
if (Main.rand.NextBool())
|
||||
if (Main.zenithWorld && player.altFunctionUse == 2)
|
||||
{
|
||||
shotType = ModContent.ProjectileType<DrizzlefishFire>();
|
||||
//GFB stuff
|
||||
if (player.Calamity().dragoonDrizzlefishGelBoost < 6)
|
||||
{
|
||||
player.Calamity().dragoonDrizzlefishGelBoost++;
|
||||
SoundStyle roar = Sunskater.DeathSound;
|
||||
SoundEngine.PlaySound(roar with { Pitch = 0.3f }, player.Center);
|
||||
SoundEngine.PlaySound(SoundID.Item2 with { Pitch = 0.3f }, player.Center);
|
||||
CombatText.NewText(player.Hitbox, Color.OrangeRed, ":)");
|
||||
for (int i = 0; i <= 11; i++)
|
||||
{
|
||||
Vector2 hVelocity = Main.rand.NextVector2Unit();
|
||||
hVelocity.X *= 0.66f;
|
||||
hVelocity *= Main.rand.NextFloat(1f, 2f);
|
||||
|
||||
int heart = Gore.NewGore(player.GetSource_FromThis(), player.Center + Main.rand.NextVector2Circular(14, 14), hVelocity, 331, Main.rand.NextFloat(0.2f, 1.3f));
|
||||
Main.gore[heart].sticky = false;
|
||||
Main.gore[heart].velocity *= 0.4f;
|
||||
Main.gore[heart].velocity.Y -= 0.7f;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
shotType = ModContent.ProjectileType<DrizzlefishFireball>();
|
||||
if (Main.zenithWorld)
|
||||
{
|
||||
if (Main.rand.NextBool(25) && player.Calamity().dragoonDrizzlefishGelBoost > 1)
|
||||
{
|
||||
SoundStyle roar = Sunskater.DeathSound;
|
||||
SoundEngine.PlaySound(roar, player.Center);
|
||||
player.Calamity().dragoonDrizzlefishGelBoost--;
|
||||
}
|
||||
if (player.Calamity().dragoonDrizzlefishGelBoost == 1 && Main.rand.NextBool(3))
|
||||
{
|
||||
bool MADFISH = Main.rand.NextBool(4) ? true : false;
|
||||
CombatText.NewText(player.Hitbox, Color.OrangeRed, MADFISH ? ">:(" : ":(");
|
||||
SoundStyle roar = Sunskater.DeathSound;
|
||||
SoundEngine.PlaySound(roar with { Pitch = -0.3f }, player.Center);
|
||||
if (MADFISH)
|
||||
player.AddBuff(ModContent.BuffType<Dragonfire>(), 240, true);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
velocity = velocity.RotatedByRandom(MathHelper.ToRadians(5.5f));
|
||||
int shotType = ModContent.ProjectileType<DrizzlefishFireball>();
|
||||
if (shotCounter < 3)
|
||||
{
|
||||
shotType = ModContent.ProjectileType<DrizzlefishFireball>();
|
||||
shotCounter++;
|
||||
}
|
||||
else
|
||||
{
|
||||
shotType = ModContent.ProjectileType<DrizzlefishFire>();
|
||||
shotCounter = 0;
|
||||
}
|
||||
Projectile.NewProjectile(source, position, velocity, shotType, damage, knockback, player.whoAmI, 0f, Main.rand.Next(2));
|
||||
}
|
||||
Projectile.NewProjectile(source, position, velocity, shotType, damage, knockback, player.whoAmI, 0f, Main.rand.Next(2));
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,9 +26,9 @@ namespace CalamityMod.Items.Materials
|
||||
}
|
||||
public override void Update(ref float gravity, ref float maxFallSpeed)
|
||||
{
|
||||
float num = (float)Main.rand.Next(90, 111) * 0.01f;
|
||||
num *= Main.essScale;
|
||||
Lighting.AddLight((int)((Item.position.X + (float)(Item.width / 2)) / 16f), (int)((Item.position.Y + (float)(Item.height / 2)) / 16f), 0.25f * num, 0.05f * num, 0.25f * num);
|
||||
float brightness = (float)Main.rand.Next(90, 111) * 0.01f;
|
||||
brightness *= Main.essScale;
|
||||
Lighting.AddLight((int)((Item.position.X + (float)(Item.width / 2)) / 16f), (int)((Item.position.Y + (float)(Item.height / 2)) / 16f), 0.25f * brightness, 0.05f * brightness, 0.25f * brightness);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using Terraria;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.ID;
|
||||
|
||||
@@ -10,12 +11,13 @@ namespace CalamityMod.Items.Materials
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
Item.ResearchUnlockCount = 100;
|
||||
Main.RegisterItemAnimation(Type, new DrawAnimationVertical(6, 4));
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.width = 18;
|
||||
Item.height = 18;
|
||||
Item.width = 16;
|
||||
Item.height = 28;
|
||||
Item.maxStack = 9999;
|
||||
Item.value = Item.sellPrice(silver: 1, copper: 20);
|
||||
Item.rare = ItemRarityID.Blue;
|
||||
@@ -23,9 +25,9 @@ namespace CalamityMod.Items.Materials
|
||||
|
||||
public override void Update(ref float gravity, ref float maxFallSpeed)
|
||||
{
|
||||
float num = Main.rand.Next(90, 111) * 0.01f;
|
||||
num *= Main.essScale;
|
||||
Lighting.AddLight((int)((Item.position.X + (Item.width / 2)) / 16f), (int)((Item.position.Y + (Item.height / 2)) / 16f), 0.75f * num, 0f, 0f);
|
||||
float brightness = Main.rand.Next(90, 111) * 0.01f;
|
||||
brightness *= Main.essScale;
|
||||
Lighting.AddLight((int)((Item.position.X + (Item.width / 2)) / 16f), (int)((Item.position.Y + (Item.height / 2)) / 16f), 0.75f * brightness, 0f, 0f);
|
||||
}
|
||||
|
||||
public override void AddRecipes()
|
||||
|
||||
|
Before Width: | Height: | Size: 297 B After Width: | Height: | Size: 588 B |
@@ -28,9 +28,9 @@ namespace CalamityMod.Items.Materials
|
||||
}
|
||||
public override void Update(ref float gravity, ref float maxFallSpeed)
|
||||
{
|
||||
float num = (float)Main.rand.Next(90, 111) * 0.01f;
|
||||
num *= Main.essScale;
|
||||
Lighting.AddLight((int)((Item.position.X + (float)(Item.width / 2)) / 16f), (int)((Item.position.Y + (float)(Item.height / 2)) / 16f), 0f * num, 0.45f * num, 0.7f * num);
|
||||
float brightness = (float)Main.rand.Next(90, 111) * 0.01f;
|
||||
brightness *= Main.essScale;
|
||||
Lighting.AddLight((int)((Item.position.X + (float)(Item.width / 2)) / 16f), (int)((Item.position.Y + (float)(Item.height / 2)) / 16f), 0f * brightness, 0.45f * brightness, 0.7f * brightness);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -24,9 +24,9 @@ namespace CalamityMod.Items.Materials
|
||||
}
|
||||
public override void Update(ref float gravity, ref float maxFallSpeed)
|
||||
{
|
||||
float num = (float)Main.rand.Next(90, 111) * 0.01f;
|
||||
num *= Main.essScale;
|
||||
Lighting.AddLight((int)((Item.position.X + (float)(Item.width / 2)) / 16f), (int)((Item.position.Y + (float)(Item.height / 2)) / 16f), 0.45f * num, 0.3f * num, 0f * num);
|
||||
float brightness = (float)Main.rand.Next(90, 111) * 0.01f;
|
||||
brightness *= Main.essScale;
|
||||
Lighting.AddLight((int)((Item.position.X + (float)(Item.width / 2)) / 16f), (int)((Item.position.Y + (float)(Item.height / 2)) / 16f), 0.45f * brightness, 0.3f * brightness, 0f * brightness);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -38,9 +38,9 @@ namespace CalamityMod.Items.Materials
|
||||
|
||||
public override void Update(ref float gravity, ref float maxFallSpeed)
|
||||
{
|
||||
float num = (float)Main.rand.Next(90, 111) * 0.01f;
|
||||
num *= Main.essScale;
|
||||
Lighting.AddLight((int)((Item.position.X + (float)(Item.width / 2)) / 16f), (int)((Item.position.Y + (float)(Item.height / 2)) / 16f), 1f * num, 0.3f * num, 0.3f * num);
|
||||
float brightness = (float)Main.rand.Next(90, 111) * 0.01f;
|
||||
brightness *= Main.essScale;
|
||||
Lighting.AddLight((int)((Item.position.X + (float)(Item.width / 2)) / 16f), (int)((Item.position.Y + (float)(Item.height / 2)) / 16f), 1f * brightness, 0.3f * brightness, 0.3f * brightness);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,15 +14,15 @@ namespace CalamityMod.Items.Materials
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
Item.ResearchUnlockCount = 25;
|
||||
Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(5, 5));
|
||||
Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(5, 6));
|
||||
ItemID.Sets.AnimatesAsSoul[Type] = true;
|
||||
ItemID.Sets.SortingPriorityMaterials[Type] = 110;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.width = 12;
|
||||
Item.height = 12;
|
||||
Item.width = 24;
|
||||
Item.height = 52;
|
||||
Item.maxStack = 9999;
|
||||
Item.value = Item.sellPrice(gold: 1);
|
||||
Item.rare = ItemRarityID.Purple;
|
||||
|
||||
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 1.4 KiB |
@@ -26,9 +26,9 @@ namespace CalamityMod.Items.Materials
|
||||
}
|
||||
public override void Update(ref float gravity, ref float maxFallSpeed)
|
||||
{
|
||||
float num = (float)Main.rand.Next(90, 111) * 0.01f;
|
||||
num *= Main.essScale;
|
||||
Lighting.AddLight((int)((Item.position.X + (float)(Item.width / 2)) / 16f), (int)((Item.position.Y + (float)(Item.height / 2)) / 16f), 0.5f * num, 0.1f * num, 0.7f * num);
|
||||
float brightness = (float)Main.rand.Next(90, 111) * 0.01f;
|
||||
brightness *= Main.essScale;
|
||||
Lighting.AddLight((int)((Item.position.X + (float)(Item.width / 2)) / 16f), (int)((Item.position.Y + (float)(Item.height / 2)) / 16f), 0.5f * brightness, 0.1f * brightness, 0.7f * brightness);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,8 +16,8 @@ namespace CalamityMod.Items.Materials
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.width = 15;
|
||||
Item.height = 12;
|
||||
Item.width = 26;
|
||||
Item.height = 46;
|
||||
Item.maxStack = 9999;
|
||||
Item.value = Item.sellPrice(silver: 80);
|
||||
Item.rare = ItemRarityID.Pink;
|
||||
|
||||
|
Before Width: | Height: | Size: 631 B After Width: | Height: | Size: 608 B |
@@ -27,9 +27,9 @@ namespace CalamityMod.Items.Materials
|
||||
}
|
||||
public override void Update(ref float gravity, ref float maxFallSpeed)
|
||||
{
|
||||
float num = (float)Main.rand.Next(90, 111) * 0.01f;
|
||||
num *= Main.essScale;
|
||||
Lighting.AddLight((int)((Item.position.X + (float)(Item.width / 2)) / 16f), (int)((Item.position.Y + (float)(Item.height / 2)) / 16f), 0.45f * num, 0.3f * num, 0f * num);
|
||||
float brightness = (float)Main.rand.Next(90, 111) * 0.01f;
|
||||
brightness *= Main.essScale;
|
||||
Lighting.AddLight((int)((Item.position.X + (float)(Item.width / 2)) / 16f), (int)((Item.position.Y + (float)(Item.height / 2)) / 16f), 0.45f * brightness, 0.3f * brightness, 0f * brightness);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -68,6 +68,7 @@ namespace CalamityMod.Items.Materials
|
||||
}
|
||||
|
||||
public override void Load() => Terraria.On_Item.CanFillEmptyAmmoSlot += AvoidDefaultingToAmmoSlot;
|
||||
|
||||
private bool AvoidDefaultingToAmmoSlot(Terraria.On_Item.orig_CanFillEmptyAmmoSlot orig, Item self)
|
||||
{
|
||||
if (self.type == Type)
|
||||
|
||||
@@ -18,9 +18,9 @@ namespace CalamityMod.Items.Materials
|
||||
|
||||
public override void Update(ref float gravity, ref float maxFallSpeed)
|
||||
{
|
||||
float num = (float)Main.rand.Next(90, 111) * 0.01f;
|
||||
num *= Main.essScale;
|
||||
Lighting.AddLight((int)((Item.position.X + (float)(Item.width / 2)) / 16f), (int)((Item.position.Y + (float)(Item.height / 2)) / 16f), 0.5f * num, 0.3f * num, 0.05f * num);
|
||||
float brightness = (float)Main.rand.Next(90, 111) * 0.01f;
|
||||
brightness *= Main.essScale;
|
||||
Lighting.AddLight((int)((Item.position.X + (float)(Item.width / 2)) / 16f), (int)((Item.position.Y + (float)(Item.height / 2)) / 16f), 0.5f * brightness, 0.3f * brightness, 0.05f * brightness);
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
|
||||
@@ -64,9 +64,9 @@ namespace CalamityMod.Items.Mounts
|
||||
public override bool UpdateFrame(Player mountedPlayer, int state, Vector2 velocity)
|
||||
{
|
||||
bool speed = Math.Abs(velocity.X) > mountedPlayer.mount.RunSpeed / 2f;
|
||||
float num10 = (float)Math.Sign(mountedPlayer.velocity.X);
|
||||
float num11 = 12f;
|
||||
float num12 = 40f;
|
||||
float direction = (float)Math.Sign(mountedPlayer.velocity.X);
|
||||
float dustYOffset = 12f;
|
||||
float dustXOffset = 40f;
|
||||
if (!speed)
|
||||
{
|
||||
mountedPlayer.basiliskCharge = 0f;
|
||||
@@ -92,19 +92,19 @@ namespace CalamityMod.Items.Mounts
|
||||
}
|
||||
if (mountedPlayer.cMount == 0)
|
||||
{
|
||||
mountedPlayer.position += new Vector2(num10 * 24f, 0f);
|
||||
mountedPlayer.position += new Vector2(direction * 24f, 0f);
|
||||
mountedPlayer.FloorVisuals(true);
|
||||
mountedPlayer.position -= new Vector2(num10 * 24f, 0f);
|
||||
mountedPlayer.position -= new Vector2(direction * 24f, 0f);
|
||||
}
|
||||
}
|
||||
if (num10 == (float)mountedPlayer.direction)
|
||||
if (direction == (float)mountedPlayer.direction)
|
||||
{
|
||||
for (int j = 0; j < (int)(3f * mountedPlayer.basiliskCharge); j++)
|
||||
{
|
||||
Dust dust = Main.dust[Dust.NewDust(mountedPlayer.BottomLeft, mountedPlayer.width, 6, 67, 0f, 0f, 0, default, 1f)];
|
||||
Vector2 value2 = mountedPlayer.Center + new Vector2(num10 * num12, num11);
|
||||
dust.position = mountedPlayer.Center + new Vector2(num10 * (num12 - 2f), num11 - 6f + Main.rand.NextFloat() * 12f);
|
||||
dust.velocity = (dust.position - value2).SafeNormalize(Vector2.Zero) * (3.5f + Main.rand.NextFloat() * 0.5f);
|
||||
Vector2 dustVel = mountedPlayer.Center + new Vector2(direction * dustXOffset, dustYOffset);
|
||||
dust.position = mountedPlayer.Center + new Vector2(direction * (dustXOffset - 2f), dustYOffset - 6f + Main.rand.NextFloat() * 12f);
|
||||
dust.velocity = (dust.position - dustVel).SafeNormalize(Vector2.Zero) * (3.5f + Main.rand.NextFloat() * 0.5f);
|
||||
if (dust.velocity.Y < 0f)
|
||||
{
|
||||
Dust expr_808_cp_0_cp_0 = dust;
|
||||
|
||||
@@ -10,8 +10,8 @@ namespace CalamityMod.Items.Placeables.Furniture
|
||||
public new string LocalizationCategory => "Items.Placeables";
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.width = 28;
|
||||
Item.height = 40;
|
||||
Item.width = 26;
|
||||
Item.height = 34;
|
||||
Item.maxStack = 9999;
|
||||
Item.useTurn = true;
|
||||
Item.autoReuse = true;
|
||||
|
||||
|
Before Width: | Height: | Size: 683 B After Width: | Height: | Size: 585 B |
@@ -10,8 +10,8 @@ namespace CalamityMod.Items.Placeables.Furniture
|
||||
public new string LocalizationCategory => "Items.Placeables";
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.width = 28;
|
||||
Item.height = 40;
|
||||
Item.width = 26;
|
||||
Item.height = 42;
|
||||
Item.maxStack = 9999;
|
||||
Item.useTurn = true;
|
||||
Item.autoReuse = true;
|
||||
|
||||
|
Before Width: | Height: | Size: 784 B After Width: | Height: | Size: 670 B |
@@ -10,8 +10,8 @@ namespace CalamityMod.Items.Placeables.Furniture
|
||||
public new string LocalizationCategory => "Items.Placeables";
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.width = 28;
|
||||
Item.height = 40;
|
||||
Item.width = 26;
|
||||
Item.height = 38;
|
||||
Item.maxStack = 9999;
|
||||
Item.useTurn = true;
|
||||
Item.autoReuse = true;
|
||||
|
||||
|
Before Width: | Height: | Size: 697 B After Width: | Height: | Size: 603 B |