Merge branch '1.4.4' of https://github.com/CalamityTeam/CalamityMod into Thunderstorm
No files matched your search
@@ -171,9 +171,6 @@ namespace CalamityMod.Balancing
|
||||
// 50% resist to Aftershock's rocks.
|
||||
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DestroyerIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType<AftershockRock>()))));
|
||||
|
||||
// 50% resist to Avalanche's Ice Bombs and shards.
|
||||
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DestroyerIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType<IceBombFriendly>(), ProjectileType<FrostShardFriendly>()))));
|
||||
|
||||
// 50% resist to Dormant Brimseeker.
|
||||
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DestroyerIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType<DormantBrimseekerBab>()))));
|
||||
|
||||
@@ -183,6 +180,9 @@ namespace CalamityMod.Balancing
|
||||
// 30% resist to Meowthrower.
|
||||
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DestroyerIDs, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType<MeowFire>()))));
|
||||
|
||||
// 25% resist to Avalanche's Ice Bombs and shards.
|
||||
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DestroyerIDs, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType<IceBombFriendly>(), ProjectileType<FrostShardFriendly>()))));
|
||||
|
||||
// 25% resist to SHPC.
|
||||
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DestroyerIDs, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType<SHPExplosion>()))));
|
||||
|
||||
@@ -276,6 +276,9 @@ namespace CalamityMod.Balancing
|
||||
// 50% resist to Aurora Blazer.
|
||||
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AstrumDeusIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType<AuroraFire>()))));
|
||||
|
||||
// 35% resist to Aerial Bane.
|
||||
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AstrumDeusIDs, Do(new ProjectileResistBalancingRule(0.65f, ProjectileID.DD2BetsyArrow))));
|
||||
|
||||
// 35% resist to Ballistic Poison Bomb's clouds.
|
||||
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AstrumDeusIDs, Do(new ProjectileResistBalancingRule(0.65f, ProjectileType<BallisticPoisonCloud>()))));
|
||||
|
||||
@@ -480,6 +483,9 @@ namespace CalamityMod.Balancing
|
||||
// 15% resist to The Final Dawn's AoE sweep flames.
|
||||
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.85f, ProjectileType<FinalDawnFlame>()))));
|
||||
|
||||
// 15% resist to Dragon's Breath Beam.
|
||||
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.85f, ProjectileType<DragonsBreathBurst>()))));
|
||||
|
||||
// 15% resist to God Slayer Slugs.
|
||||
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.85f, ProjectileType<GodSlayerSlugProj>()))));
|
||||
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
using CalamityMod.CalPlayer;
|
||||
using CalamityMod.Projectiles.Summon;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Buffs.Summon
|
||||
{
|
||||
public class FlarebatBuff : ModBuff
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
Main.buffNoTimeDisplay[Type] = true;
|
||||
Main.buffNoSave[Type] = true;
|
||||
}
|
||||
|
||||
public override void Update(Player player, ref int buffIndex)
|
||||
{
|
||||
CalamityPlayer modPlayer = player.Calamity();
|
||||
if (player.ownedProjectileCounts[ModContent.ProjectileType<FlarebatMinion>()] > 0)
|
||||
{
|
||||
modPlayer.FlarebatBool = true;
|
||||
}
|
||||
|
||||
if (!modPlayer.FlarebatBool)
|
||||
{
|
||||
player.DelBuff(buffIndex);
|
||||
buffIndex--;
|
||||
}
|
||||
else
|
||||
{
|
||||
player.buffTime[buffIndex] = 18000;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 544 B |
@@ -0,0 +1,35 @@
|
||||
using CalamityMod.CalPlayer;
|
||||
using CalamityMod.Projectiles.Summon;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Buffs.Summon
|
||||
{
|
||||
public class FrostbatBuff : ModBuff
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
Main.buffNoTimeDisplay[Type] = true;
|
||||
Main.buffNoSave[Type] = true;
|
||||
}
|
||||
|
||||
public override void Update(Player player, ref int buffIndex)
|
||||
{
|
||||
CalamityPlayer modPlayer = player.Calamity();
|
||||
if (player.ownedProjectileCounts[ModContent.ProjectileType<FrostbatMinion>()] > 0)
|
||||
{
|
||||
modPlayer.FrostbatBool = true;
|
||||
}
|
||||
|
||||
if (!modPlayer.FrostbatBool)
|
||||
{
|
||||
player.DelBuff(buffIndex);
|
||||
buffIndex--;
|
||||
}
|
||||
else
|
||||
{
|
||||
player.buffTime[buffIndex] = 18000;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 528 B |
@@ -823,6 +823,7 @@ namespace CalamityMod.CalPlayer
|
||||
public bool astralStarRain = false;
|
||||
public int astralStarRainCooldown = 0;
|
||||
public int AbaddonCooldown = 0;
|
||||
public int VoidCooldown = 0;
|
||||
public int ursaSergeantCooldown = 0;
|
||||
public int AlchFlaskCooldown = 0;
|
||||
public bool plagueReaper = false;
|
||||
@@ -1132,6 +1133,8 @@ namespace CalamityMod.CalPlayer
|
||||
public bool KalandraMirror = false;
|
||||
public bool StellarTorus = false;
|
||||
public bool LiliesOfFinalityBool = false;
|
||||
public bool FlarebatBool = false;
|
||||
public bool FrostbatBool = false;
|
||||
#endregion
|
||||
|
||||
#region Biome
|
||||
@@ -1608,7 +1611,6 @@ namespace CalamityMod.CalPlayer
|
||||
noLifeRegen = false;
|
||||
|
||||
// Shields. Has to intentionally be above resetting accessories and armor or the shields would clear instantly
|
||||
drawnAnyShieldThisFrame = false;
|
||||
if (!roverDrive)
|
||||
RoverDriveShieldDurability = 0;
|
||||
if (!lunicCorpsSet)
|
||||
@@ -2227,6 +2229,8 @@ namespace CalamityMod.CalPlayer
|
||||
KalandraMirror = false;
|
||||
StellarTorus = false;
|
||||
LiliesOfFinalityBool = false;
|
||||
FlarebatBool = false;
|
||||
FrostbatBool = false;
|
||||
|
||||
/* Spawn blockers from back when they used to work by being favorited and not a toggleable item
|
||||
noStupidNaturalARSpawns = false
|
||||
@@ -2391,6 +2395,7 @@ namespace CalamityMod.CalPlayer
|
||||
gSabatonTempJumpSpeed = 0;
|
||||
astralStarRainCooldown = 0;
|
||||
AbaddonCooldown = 0;
|
||||
VoidCooldown = 0;
|
||||
ursaSergeantCooldown = 0;
|
||||
AlchFlaskCooldown = 0;
|
||||
ascendantInsigniaCooldown = 0;
|
||||
|
||||
@@ -0,0 +1,189 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using CalamityMod.Items.Accessories;
|
||||
using CalamityMod.Items.Armor.LunicCorps;
|
||||
using CalamityMod.Packets;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.CalPlayer
|
||||
{
|
||||
// This should be a thing for reason:
|
||||
// - Draw call invoke faster than Player.Update on different thread
|
||||
// - Therefore draw call often gets default value for shield charge or such, results in flickering bug
|
||||
// So we calculate those value as same rate as Player.Update and does NOT reset between updates
|
||||
public struct CalamityPlayerDrawingParameters
|
||||
{
|
||||
// Profaned Shield (Profaned Soul Artifact / Profaned Soul Crystal)
|
||||
public float ProfanedShieldCharge;
|
||||
public Color ProfanedShieldColor;
|
||||
|
||||
// The Sponge Shield
|
||||
public float SpongeShieldCharge;
|
||||
|
||||
// RoverDrive Shield
|
||||
public float RoverShieldCharge;
|
||||
|
||||
// Lunic Corps
|
||||
public float LunicShieldCharge;
|
||||
|
||||
public static bool operator ==(CalamityPlayerDrawingParameters left, CalamityPlayerDrawingParameters right)
|
||||
{
|
||||
if (left.RoverShieldCharge != right.RoverShieldCharge) return false;
|
||||
if (left.LunicShieldCharge != right.LunicShieldCharge) return false;
|
||||
if (left.ProfanedShieldCharge != right.ProfanedShieldCharge) return false;
|
||||
if (left.ProfanedShieldColor != right.ProfanedShieldColor) return false;
|
||||
if (left.SpongeShieldCharge != right.SpongeShieldCharge) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool operator !=(CalamityPlayerDrawingParameters left, CalamityPlayerDrawingParameters right)
|
||||
{
|
||||
return !(left == right);
|
||||
}
|
||||
|
||||
public override readonly bool Equals(object obj) => base.Equals(obj);
|
||||
public override readonly int GetHashCode() => base.GetHashCode();
|
||||
}
|
||||
|
||||
public partial class CalamityPlayer : ModPlayer
|
||||
{
|
||||
public CalamityPlayerDrawingParameters drawingParameters;
|
||||
private CalamityPlayerDrawingParameters drawingParameters_LastNetSyncValue;
|
||||
private int drawingParameters_NetSyncCountdown = 0;
|
||||
|
||||
private void UpdateDrawingParameters()
|
||||
{
|
||||
// Non-Owner should receive update via network!
|
||||
if (Player.whoAmI == Main.myPlayer)
|
||||
{
|
||||
UpdateDrawParameter_RoverDriveShield();
|
||||
UpdateDrawParameter_LunicCorps();
|
||||
UpdateDrawParameter_ProfanedShield();
|
||||
UpdateDrawParameter_TheSponge();
|
||||
|
||||
if (Main.netMode == NetmodeID.MultiplayerClient)
|
||||
{
|
||||
if (drawingParameters_NetSyncCountdown > 0)
|
||||
{
|
||||
drawingParameters_NetSyncCountdown--;
|
||||
return;
|
||||
}
|
||||
|
||||
if (drawingParameters != drawingParameters_LastNetSyncValue)
|
||||
{
|
||||
drawingParameters_NetSyncCountdown = 8;
|
||||
drawingParameters_LastNetSyncValue = drawingParameters;
|
||||
SyncPlayerDrawParameterPacket.Send(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#region RoverDrive Shield
|
||||
private void UpdateDrawParameter_RoverDriveShield()
|
||||
{
|
||||
bool isVanityOnly = roverDriveShieldVisible && !roverDrive;
|
||||
bool shieldExists = isVanityOnly || RoverDriveShieldDurability > 0;
|
||||
if (roverDriveShieldVisible && shieldExists)
|
||||
{
|
||||
float visualShieldStrength = 1f;
|
||||
if (!isVanityOnly)
|
||||
{
|
||||
float shieldDurabilityRatio = RoverDriveShieldDurability / (float)RoverDrive.ShieldDurabilityMax;
|
||||
visualShieldStrength = MathF.Pow(shieldDurabilityRatio, 0.5f);
|
||||
}
|
||||
|
||||
drawingParameters.RoverShieldCharge = visualShieldStrength;
|
||||
}
|
||||
else
|
||||
{
|
||||
drawingParameters.RoverShieldCharge = -1.0f;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region LunicCorps Shield
|
||||
private void UpdateDrawParameter_LunicCorps()
|
||||
{
|
||||
if (LunicCorpsShieldDurability > 0)
|
||||
{
|
||||
float shieldDurabilityRatio = LunicCorpsShieldDurability / (float)LunicCorpsHelmet.ShieldDurabilityMax;
|
||||
float visualShieldStrength = MathF.Pow(shieldDurabilityRatio, 0.5f);
|
||||
|
||||
drawingParameters.LunicShieldCharge = visualShieldStrength;
|
||||
}
|
||||
else
|
||||
{
|
||||
drawingParameters.LunicShieldCharge = -1.0f;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Profaned Shield (Profaned Soul Artifact / Profaned Soul Crystal)
|
||||
private void UpdateDrawParameter_ProfanedShield()
|
||||
{
|
||||
bool isVanityOnly = pSoulShieldVisible && !pSoulArtifact;
|
||||
bool shouldNotDraw = andromedaState >= AndromedaPlayerState.LargeRobot; //I am not dealing with drawing that :taxevasion:
|
||||
bool shieldExists = isVanityOnly || pSoulShieldDurability > 0;
|
||||
if (pSoulShieldVisible && !shouldNotDraw && shieldExists)
|
||||
{
|
||||
ProfanedSoulCrystal.DetermineTransformationEligibility(Player);
|
||||
var psState = (int)ProfanedSoulCrystal.GetPscStateFor(Player, profanedCrystalAnim >= 0);
|
||||
var psc = profanedCrystalBuffs || (profanedCrystalAnim >= 0 && psState >= (int)ProfanedSoulCrystal.ProfanedSoulCrystalState.Buffs);
|
||||
|
||||
float visualShieldStrength = 1f;
|
||||
if (!isVanityOnly)
|
||||
{
|
||||
float max = psc ? ProfanedSoulCrystal.ShieldDurabilityMax : ProfanedSoulArtifact.ShieldDurabilityMax;
|
||||
float shieldDurabilityRatio = pSoulShieldDurability / max;
|
||||
visualShieldStrength = MathF.Pow(shieldDurabilityRatio, 0.5f);
|
||||
}
|
||||
|
||||
Color shieldColor = ProfanedSoulCrystal.GetColorForPsc(psState, Main.dayTime);
|
||||
if (psState >= (int)(ProfanedSoulCrystal.ProfanedSoulCrystalState.Buffs))
|
||||
{
|
||||
bool tester = ProfanedSoulCrystal.contributorNames.Any(name => name.Equals(Player.name));
|
||||
shieldColor = tester ? CalamityUtils.ColorSwap(new Color(255, 166, 0), new Color(25, 250, 25) * 0.8f, 6f) :
|
||||
ProfanedSoulCrystal.GetLerpedColorForPsc(this);
|
||||
}
|
||||
drawingParameters.ProfanedShieldColor = shieldColor;
|
||||
drawingParameters.ProfanedShieldCharge = visualShieldStrength;
|
||||
}
|
||||
else
|
||||
{
|
||||
drawingParameters.ProfanedShieldCharge = -1.0f;
|
||||
drawingParameters.ProfanedShieldColor = Color.White;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Sponge Shield
|
||||
private void UpdateDrawParameter_TheSponge()
|
||||
{
|
||||
bool isVanityOnly = spongeShieldVisible && !sponge;
|
||||
bool shieldExists = isVanityOnly || SpongeShieldDurability > 0;
|
||||
if (spongeShieldVisible && shieldExists)
|
||||
{
|
||||
float visualShieldStrength = 1f;
|
||||
if (!isVanityOnly)
|
||||
{
|
||||
float shieldDurabilityRatio = SpongeShieldDurability / (float)TheSponge.ShieldDurabilityMax;
|
||||
visualShieldStrength = MathF.Pow(shieldDurabilityRatio, 0.5f);
|
||||
}
|
||||
|
||||
drawingParameters.SpongeShieldCharge = visualShieldStrength;
|
||||
}
|
||||
else
|
||||
{
|
||||
drawingParameters.SpongeShieldCharge = -1.0f;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -45,6 +45,7 @@ using CalamityMod.NPCs.NormalNPCs;
|
||||
using CalamityMod.NPCs.Other;
|
||||
using CalamityMod.NPCs.PlagueEnemies;
|
||||
using CalamityMod.NPCs.TownNPCs;
|
||||
using CalamityMod.Packets;
|
||||
using CalamityMod.Particles;
|
||||
using CalamityMod.Projectiles.Boss;
|
||||
using CalamityMod.Projectiles.Magic;
|
||||
@@ -154,6 +155,9 @@ namespace CalamityMod.CalPlayer
|
||||
// Handle Androomba's Right Click function
|
||||
AndroombaRightClick();
|
||||
|
||||
// Drawing parameters
|
||||
UpdateDrawingParameters();
|
||||
|
||||
// Update all particle sets for items.
|
||||
// This must be done here instead of in the item logic because these sets are not properly instanced
|
||||
// in the global classes. Attempting to update them there will cause multiple updates to one set for multiple items.
|
||||
@@ -246,7 +250,7 @@ namespace CalamityMod.CalPlayer
|
||||
Player.velocity.X *= 1.2f;
|
||||
int damage = Player.ApplyArmorAccDamageBonusesTo(Player.GetBestClassDamage().ApplyTo(75));
|
||||
|
||||
Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center + Player.velocity * 1.5f, Vector2.Zero, ModContent.ProjectileType<LeviAmberDash>(), damage, 20f, Player.whoAmI);
|
||||
Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center + Player.velocity * 1.5f, Vector2.Zero, ModContent.ProjectileType<LeviAmberDash>(), damage, 0f, Player.whoAmI);
|
||||
HasIncreasedDashFirstFrame = true;
|
||||
}
|
||||
float numberOfDusts = 10f;
|
||||
@@ -1477,6 +1481,8 @@ namespace CalamityMod.CalPlayer
|
||||
astralStarRainCooldown--;
|
||||
if (AbaddonCooldown > 0)
|
||||
AbaddonCooldown--;
|
||||
if (VoidCooldown > 0)
|
||||
VoidCooldown--;
|
||||
if (ursaSergeantCooldown > 0)
|
||||
ursaSergeantCooldown--;
|
||||
if (AlchFlaskCooldown > 0)
|
||||
@@ -4452,11 +4458,7 @@ namespace CalamityMod.CalPlayer
|
||||
}
|
||||
else
|
||||
{
|
||||
var netMessage = Mod.GetPacket();
|
||||
netMessage.Write((byte)CalamityModMessageType.SyncAndroombaSolution);
|
||||
netMessage.Write(npc.whoAmI);
|
||||
netMessage.Write(soltype);
|
||||
netMessage.Send();
|
||||
SyncAndroombaSolutionPacket.Send(npc.ModNPC<AndroombaFriendly>(), soltype);
|
||||
}
|
||||
if (npc.ai[0] == 0f)
|
||||
{
|
||||
@@ -4466,11 +4468,7 @@ namespace CalamityMod.CalPlayer
|
||||
}
|
||||
else
|
||||
{
|
||||
var netMessage = Mod.GetPacket();
|
||||
netMessage.Write((byte)CalamityModMessageType.SyncAndroombaAI);
|
||||
netMessage.Write(npc.whoAmI);
|
||||
netMessage.Write(1);
|
||||
netMessage.Send();
|
||||
SyncAndroombaAIPacket.Send(npc.ModNPC<AndroombaFriendly>(), phase: 1);
|
||||
}
|
||||
}
|
||||
if (Main.netMode == NetmodeID.Server)
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using CalamityMod.Cooldowns;
|
||||
using CalamityMod.Packets;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
@@ -12,219 +14,50 @@ namespace CalamityMod.CalPlayer
|
||||
#region Standard Syncs
|
||||
internal const int GlobalSyncPacketTimer = 15;
|
||||
|
||||
internal void StandardSync()
|
||||
{
|
||||
SyncRage(false);
|
||||
SyncAdrenaline(false);
|
||||
SyncDefenseDamage(false);
|
||||
}
|
||||
|
||||
private void EnterWorldSync()
|
||||
{
|
||||
StandardSync();
|
||||
}
|
||||
|
||||
internal void StandardSync()
|
||||
{
|
||||
RageSyncPacket.Send(this);
|
||||
AdrenalineSyncPacket.Send(this);
|
||||
DefenseDamageSyncPacket.Send(this);
|
||||
}
|
||||
|
||||
internal void MouseControlsSync()
|
||||
{
|
||||
SyncRightClick(false);
|
||||
SyncMousePosition(false);
|
||||
RightClickSyncPacket.Send(this);
|
||||
MousePositionSyncPacket.Send(this);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Creating and Sending Packets
|
||||
public void SyncDefenseDamage(bool server)
|
||||
{
|
||||
ModPacket packet = Mod.GetPacket(256);
|
||||
packet.Write((byte)CalamityModMessageType.DefenseDamageSync);
|
||||
packet.Write(Player.whoAmI);
|
||||
packet.Write(totalDefenseDamage);
|
||||
packet.Write(defenseDamageRecoveryFrames);
|
||||
packet.Write(totalDefenseDamageRecoveryFrames);
|
||||
packet.Write(defenseDamageDelayFrames);
|
||||
Player.SendPacket(packet, server);
|
||||
}
|
||||
|
||||
public void SyncRage(bool server)
|
||||
{
|
||||
ModPacket packet = Mod.GetPacket(256);
|
||||
packet.Write((byte)CalamityModMessageType.RageSync);
|
||||
packet.Write(Player.whoAmI);
|
||||
packet.Write(rage);
|
||||
packet.Write(rageCombatFrames);
|
||||
Player.SendPacket(packet, server);
|
||||
}
|
||||
|
||||
public void SyncAdrenaline(bool server)
|
||||
{
|
||||
ModPacket packet = Mod.GetPacket(256);
|
||||
packet.Write((byte)CalamityModMessageType.AdrenalineSync);
|
||||
packet.Write(Player.whoAmI);
|
||||
packet.Write(adrenaline);
|
||||
Player.SendPacket(packet, server);
|
||||
}
|
||||
|
||||
public void SyncCooldownAddition(bool server, CooldownInstance cd)
|
||||
{
|
||||
if (Main.netMode == NetmodeID.SinglePlayer)
|
||||
return;
|
||||
ModPacket packet = Mod.GetPacket(256);
|
||||
packet.Write((byte)CalamityModMessageType.CooldownAddition);
|
||||
packet.Write(Player.whoAmI);
|
||||
cd.Write(packet);
|
||||
Player.SendPacket(packet, server);
|
||||
|
||||
CooldownAdditionPacket.Send(this, cd);
|
||||
}
|
||||
|
||||
public void SyncCooldownRemoval(bool server, IList<string> cooldownIDs)
|
||||
{
|
||||
if (Main.netMode == NetmodeID.SinglePlayer)
|
||||
return;
|
||||
ModPacket packet = Mod.GetPacket(256);
|
||||
packet.Write((byte)CalamityModMessageType.CooldownRemoval);
|
||||
packet.Write(Player.whoAmI);
|
||||
packet.Write(cooldownIDs.Count);
|
||||
foreach (string id in cooldownIDs)
|
||||
packet.Write(CooldownRegistry.Get(id).netID);
|
||||
Player.SendPacket(packet, server);
|
||||
|
||||
CooldownRemovalPacket.Send(this, cooldownIDs.Select(id => CooldownRegistry.Get(id).netID).ToArray());
|
||||
}
|
||||
|
||||
public void SyncCooldownDictionary(bool server)
|
||||
{
|
||||
if (Main.netMode == NetmodeID.SinglePlayer)
|
||||
return;
|
||||
ModPacket packet = Mod.GetPacket(1024);
|
||||
packet.Write((byte)CalamityModMessageType.SyncCooldownDictionary);
|
||||
packet.Write(Player.whoAmI);
|
||||
packet.Write(cooldowns.Count);
|
||||
foreach (CooldownInstance cd in cooldowns.Values)
|
||||
cd.Write(packet);
|
||||
Player.SendPacket(packet, server);
|
||||
|
||||
SyncCooldownDictionaryPacket.Send(this);
|
||||
}
|
||||
|
||||
public void SyncRightClick(bool server)
|
||||
{
|
||||
ModPacket packet = Mod.GetPacket(256);
|
||||
packet.Write((byte)CalamityModMessageType.RightClickSync);
|
||||
packet.Write(Player.whoAmI);
|
||||
packet.Write(mouseRight);
|
||||
Player.SendPacket(packet, server);
|
||||
}
|
||||
public void SyncMousePosition(bool server)
|
||||
{
|
||||
ModPacket packet = Mod.GetPacket(256);
|
||||
packet.Write((byte)CalamityModMessageType.MousePositionSync);
|
||||
packet.Write(Player.whoAmI);
|
||||
packet.WriteVector2(mouseWorld);
|
||||
Player.SendPacket(packet, server);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Reading and Handling Packets
|
||||
internal void HandleRage(BinaryReader reader)
|
||||
{
|
||||
rage = reader.ReadSingle();
|
||||
rageCombatFrames = reader.ReadInt32();
|
||||
if (Main.netMode == NetmodeID.Server)
|
||||
SyncRage(true);
|
||||
}
|
||||
|
||||
internal void HandleAdrenaline(BinaryReader reader)
|
||||
{
|
||||
adrenaline = reader.ReadSingle();
|
||||
if (Main.netMode == NetmodeID.Server)
|
||||
SyncAdrenaline(true);
|
||||
}
|
||||
|
||||
internal void HandleCooldownAddition(BinaryReader reader)
|
||||
{
|
||||
// The player ID and message ID are already read. The only remaining data is the serialization of the cooldown instance.
|
||||
CooldownInstance instance = new CooldownInstance(reader);
|
||||
|
||||
// Actually assign this freshly synced cooldown to the appropriate player.
|
||||
string id = CooldownRegistry.registry[instance.netID].ID;
|
||||
cooldowns[id] = instance;
|
||||
}
|
||||
|
||||
internal void HandleCooldownRemoval(BinaryReader reader)
|
||||
{
|
||||
int count = reader.ReadInt32();
|
||||
for (int i = 0; i < count; ++i)
|
||||
{
|
||||
ushort netID = reader.ReadUInt16();
|
||||
cooldowns.Remove(CooldownRegistry.registry[netID].ID);
|
||||
}
|
||||
}
|
||||
|
||||
internal void HandleCooldownDictionary(BinaryReader reader)
|
||||
{
|
||||
int count = reader.ReadInt32();
|
||||
if (count <= 0)
|
||||
return;
|
||||
|
||||
// Cooldown dictionary packets are just a span of serialized cooldown instances. So each one can be read exactly as with a single cooldown.
|
||||
Dictionary<ushort, CooldownInstance> syncedCooldowns = new Dictionary<ushort, CooldownInstance>(count);
|
||||
for (int i = 0; i < count; ++i)
|
||||
{
|
||||
CooldownInstance instance = new CooldownInstance(reader);
|
||||
syncedCooldowns[instance.netID] = instance;
|
||||
}
|
||||
|
||||
HashSet<ushort> localIDs = new HashSet<ushort>();
|
||||
foreach (CooldownInstance localInstance in cooldowns.Values)
|
||||
localIDs.Add(localInstance.netID);
|
||||
|
||||
HashSet<ushort> syncedIDs = new HashSet<ushort>();
|
||||
foreach (ushort syncedID in syncedCooldowns.Keys)
|
||||
syncedIDs.Add(syncedID);
|
||||
|
||||
HashSet<ushort> combinedIDSet = new HashSet<ushort>();
|
||||
combinedIDSet.UnionWith(localIDs);
|
||||
combinedIDSet.UnionWith(syncedIDs);
|
||||
|
||||
foreach (ushort netID in combinedIDSet)
|
||||
{
|
||||
bool existsLocally = localIDs.Contains(netID);
|
||||
bool existsRemotely = syncedIDs.Contains(netID);
|
||||
string id = CooldownRegistry.registry[netID].ID;
|
||||
|
||||
// Exists locally but not remotely = cull -- destroy the local copy.
|
||||
if (existsLocally && !existsRemotely)
|
||||
cooldowns.Remove(id);
|
||||
// Exists remotely but not locally = add -- insert into the dictionary.
|
||||
else if (existsRemotely && !existsLocally)
|
||||
cooldowns[id] = syncedCooldowns[netID];
|
||||
// Exists in both places = update -- update timing fields but don't replace the instance.
|
||||
else if (existsLocally && existsRemotely)
|
||||
{
|
||||
CooldownInstance localInstance = cooldowns[id];
|
||||
localInstance.duration = syncedCooldowns[netID].duration;
|
||||
localInstance.timeLeft = syncedCooldowns[netID].timeLeft;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal void HandleDefenseDamage(BinaryReader reader)
|
||||
{
|
||||
totalDefenseDamage = reader.ReadInt32();
|
||||
defenseDamageRecoveryFrames = reader.ReadInt32();
|
||||
totalDefenseDamageRecoveryFrames = reader.ReadInt32();
|
||||
defenseDamageDelayFrames = reader.ReadInt32();
|
||||
if (Main.netMode == NetmodeID.Server)
|
||||
SyncDefenseDamage(true);
|
||||
}
|
||||
|
||||
internal void HandleRightClick(BinaryReader reader)
|
||||
{
|
||||
mouseRight = reader.ReadBoolean();
|
||||
if (Main.netMode == NetmodeID.Server)
|
||||
SyncRightClick(true);
|
||||
}
|
||||
internal void HandleMousePosition(BinaryReader reader)
|
||||
{
|
||||
mouseWorld = reader.ReadVector2();
|
||||
if (Main.netMode == NetmodeID.Server)
|
||||
SyncMousePosition(true);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -673,18 +673,25 @@ namespace CalamityMod.CalPlayer
|
||||
}
|
||||
}
|
||||
|
||||
if (abaddon && crit && AbaddonCooldown <= 0)
|
||||
if (abaddon && crit && AbaddonCooldown <= 0 && !voidOfExtinction)
|
||||
{
|
||||
AbaddonCooldown = 15;
|
||||
int AbaddonExploDamage = CalamityUtils.DamageSoftCap(proj.damage * 0.03f, 25);
|
||||
int AbaddonExploDamage = CalamityUtils.DamageSoftCap(proj.damage * 0.3f, 50);
|
||||
Projectile.NewProjectile(source, position, Vector2.Zero, ProjectileType<AbaddonCrit>(), AbaddonExploDamage, 0f, Player.whoAmI);
|
||||
}
|
||||
|
||||
if (voidOfExtinction && crit && VoidCooldown <= 0)
|
||||
{
|
||||
VoidCooldown = 15;
|
||||
int VoidExploDamage = CalamityUtils.DamageSoftCap(proj.damage * 0.3f, 70);
|
||||
Projectile.NewProjectile(source, position, Vector2.Zero, ProjectileType<VoidofExtinctionCrit>(), VoidExploDamage, 0f, Player.whoAmI);
|
||||
}
|
||||
|
||||
if (ursaSergeant && ursaSergeantCooldown <= 0)
|
||||
{
|
||||
ursaSergeantCooldown = 300;
|
||||
|
||||
int ursaSlashdamage = (int)Player.GetBestClassDamage().ApplyTo(333);
|
||||
int ursaSlashdamage = (int)Player.GetBestClassDamage().ApplyTo(200);
|
||||
ursaSlashdamage = Player.ApplyArmorAccDamageBonusesTo(ursaSlashdamage);
|
||||
|
||||
Projectile.NewProjectile(source, position, Vector2.Zero, ProjectileType<UrsaSlash>(), ursaSlashdamage, 0f, Player.whoAmI);
|
||||
|
||||
@@ -25,6 +25,18 @@ namespace CalamityMod
|
||||
ParticleLimit = (int)Utils.Clamp(ParticleLimit, MinParticleLimit, MaxParticleLimit);
|
||||
}
|
||||
|
||||
#region Multi-Threading Settings
|
||||
[Header("Multithreading")]
|
||||
|
||||
[BackgroundColor(192, 54, 64, 192)]
|
||||
[SliderColor(224, 165, 56, 128)]
|
||||
[Range(0f, 2f)]
|
||||
[DefaultValue(0f)]
|
||||
[Increment(1f)]
|
||||
[DrawTicks]
|
||||
public float SunkenSeaMultiThreading { get; set; }
|
||||
#endregion
|
||||
|
||||
#region Graphics Changes
|
||||
[Header("Graphics")]
|
||||
|
||||
@@ -54,6 +66,13 @@ namespace CalamityMod
|
||||
[BackgroundColor(192, 54, 64, 192)]
|
||||
[DefaultValue(true)]
|
||||
public bool StealthInvisibility { get; set; }
|
||||
|
||||
[BackgroundColor(192, 54, 64, 192)]
|
||||
[SliderColor(224, 165, 56, 128)]
|
||||
[DefaultValue(1.0f)]
|
||||
[Range(0.0f, 1.0f)]
|
||||
public float EnergyShieldOpacity { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region UI Changes
|
||||
|
||||
@@ -1508,7 +1508,7 @@ namespace CalamityMod
|
||||
ItemType<Leviatitan>(),
|
||||
ItemType<Atlantis>(),
|
||||
ItemType<AnahitasArpeggio>(),
|
||||
ItemType<BrackishFlask>(),
|
||||
ItemType<Whitewater>(),
|
||||
ItemType<LeviathanTeeth>(),
|
||||
ItemType<GastricBelcherStaff>(),
|
||||
ItemType<PearlofEnthrallment>(),
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices.JavaScript;
|
||||
using CalamityMod.Events;
|
||||
using CalamityMod.Items;
|
||||
using CalamityMod.Items.Potions.Alcohol;
|
||||
@@ -7,6 +12,7 @@ using CalamityMod.NPCs;
|
||||
using CalamityMod.NPCs.NormalNPCs;
|
||||
using CalamityMod.NPCs.Providence;
|
||||
using CalamityMod.NPCs.TownNPCs;
|
||||
using CalamityMod.Packets;
|
||||
using CalamityMod.Systems;
|
||||
using CalamityMod.TileEntities;
|
||||
using CalamityMod.World;
|
||||
@@ -15,387 +21,108 @@ using Terraria;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.ModLoader.Core;
|
||||
|
||||
namespace CalamityMod
|
||||
{
|
||||
public class CalamityNetcode
|
||||
public class CalamityNetcode : ModSystem
|
||||
{
|
||||
private static CalamityPacket[] _PacketRegistry;
|
||||
|
||||
public override void OnModLoad()
|
||||
{
|
||||
_PacketRegistry = new CalamityPacket[256]; // This should allow to use 0-255 range (full byte range)
|
||||
|
||||
var types = ModLoader.Mods.SelectMany(mod => AssemblyManager.GetLoadableTypes(mod.Code));
|
||||
foreach (var type in types)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (type.IsAbstract || !type.IsSubclassOf(typeof(CalamityPacket)))
|
||||
continue;
|
||||
|
||||
if (Activator.CreateInstance(type) is not CalamityPacket packetHandler)
|
||||
continue;
|
||||
|
||||
var msgType = packetHandler.MessageType;
|
||||
var existingHandler = _PacketRegistry[msgType];
|
||||
if (existingHandler != null)
|
||||
{
|
||||
CalamityMod.Instance.Logger.Error($"Packet instance has already registered by other type!" +
|
||||
$" [Failed On: '{type.FullName}'" +
|
||||
$" Current Owner: '{existingHandler.GetType().FullName}'," +
|
||||
$" msgTypeToRegister: '{msgType}']");
|
||||
continue;
|
||||
}
|
||||
|
||||
_PacketRegistry[packetHandler.MessageType] = packetHandler;
|
||||
|
||||
var instanceProperty = type.GetProperty("Instance", BindingFlags.Public | BindingFlags.Static | BindingFlags.NonPublic);
|
||||
if (instanceProperty is not null)
|
||||
{
|
||||
if (instanceProperty.PropertyType.IsAssignableFrom(type))
|
||||
{
|
||||
instanceProperty.SetValue(null, packetHandler);
|
||||
packetHandler._Prop_Static_Instance = instanceProperty; // We saving this for Unload Steps
|
||||
}
|
||||
else
|
||||
{
|
||||
CalamityMod.Instance.Logger.Error($"Packet instance's 'Instance' property is not asssignable with given type!" +
|
||||
$" [Failed On: '{type.FullName}']");
|
||||
}
|
||||
}
|
||||
|
||||
// We should not print error message if "Instance" property is missing
|
||||
// Addons still can assign them with OnLoaded overload, and it's up to their implementation
|
||||
// Still, Calamity's Standard is having "Instance" property for every packet types
|
||||
|
||||
packetHandler.OnLoaded();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
CalamityMod.Instance.Logger.Error($"Exception was thrown while loading for Packets! {e}");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnModUnload()
|
||||
{
|
||||
if (_PacketRegistry is not null)
|
||||
{
|
||||
foreach (var packetHandler in _PacketRegistry)
|
||||
{
|
||||
if (packetHandler is null)
|
||||
continue;
|
||||
|
||||
packetHandler.OnUnloaded();
|
||||
packetHandler._Prop_Static_Instance?.SetValue(null, null);
|
||||
packetHandler._Prop_Static_Instance = null;
|
||||
}
|
||||
|
||||
_PacketRegistry = null;
|
||||
}
|
||||
}
|
||||
|
||||
public static void HandlePacket(Mod mod, BinaryReader reader, int whoAmI)
|
||||
{
|
||||
try
|
||||
{
|
||||
CalamityModMessageType msgType = (CalamityModMessageType)reader.ReadByte();
|
||||
switch (msgType)
|
||||
var packetHandler = _PacketRegistry[(byte)msgType];
|
||||
if (packetHandler is not null)
|
||||
{
|
||||
packetHandler.HandlePacket(in reader, whoAmI);
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
// Player mechanic syncs
|
||||
//
|
||||
|
||||
case CalamityModMessageType.DefenseDamageSync:
|
||||
Main.player[reader.ReadInt32()].Calamity().HandleDefenseDamage(reader);
|
||||
break;
|
||||
case CalamityModMessageType.RageSync:
|
||||
Main.player[reader.ReadInt32()].Calamity().HandleRage(reader);
|
||||
break;
|
||||
case CalamityModMessageType.AdrenalineSync:
|
||||
Main.player[reader.ReadInt32()].Calamity().HandleAdrenaline(reader);
|
||||
break;
|
||||
case CalamityModMessageType.CooldownAddition:
|
||||
Main.player[reader.ReadInt32()].Calamity().HandleCooldownAddition(reader);
|
||||
break;
|
||||
case CalamityModMessageType.CooldownRemoval:
|
||||
Main.player[reader.ReadInt32()].Calamity().HandleCooldownRemoval(reader);
|
||||
break;
|
||||
case CalamityModMessageType.SyncCooldownDictionary:
|
||||
Main.player[reader.ReadInt32()].Calamity().HandleCooldownDictionary(reader);
|
||||
break;
|
||||
|
||||
//
|
||||
// Syncs for specific bosses or entities
|
||||
//
|
||||
|
||||
case CalamityModMessageType.SyncDestroyerLaserColor:
|
||||
byte npcIdx3 = reader.ReadByte();
|
||||
int laserColor = reader.ReadInt32();
|
||||
|
||||
// If the NPC in question isn't valid, don't do anything.
|
||||
NPC npc3 = Main.npc[npcIdx3];
|
||||
if (!npc3.active)
|
||||
break;
|
||||
|
||||
CalamityGlobalNPC cgn3 = npc3.Calamity();
|
||||
cgn3.destroyerLaserColor = laserColor;
|
||||
break;
|
||||
|
||||
// This code has been edited to fail gracefully when trying to provide data for an invalid NPC.
|
||||
case CalamityModMessageType.SyncCalamityNPCAIArray:
|
||||
// Read the entire packet regardless of anything
|
||||
byte npcIdx = reader.ReadByte();
|
||||
float ai0 = reader.ReadSingle();
|
||||
float ai1 = reader.ReadSingle();
|
||||
float ai2 = reader.ReadSingle();
|
||||
float ai3 = reader.ReadSingle();
|
||||
|
||||
// If the NPC in question isn't valid, don't do anything.
|
||||
NPC npc = Main.npc[npcIdx];
|
||||
if (!npc.active)
|
||||
break;
|
||||
|
||||
CalamityGlobalNPC cgn = npc.Calamity();
|
||||
cgn.newAI[0] = ai0;
|
||||
cgn.newAI[1] = ai1;
|
||||
cgn.newAI[2] = ai2;
|
||||
cgn.newAI[3] = ai3;
|
||||
break;
|
||||
|
||||
case CalamityModMessageType.SyncVanillaNPCLocalAIArray:
|
||||
// Read the entire packet regardless of anything
|
||||
byte npcIdx2 = reader.ReadByte();
|
||||
float localAI0 = reader.ReadSingle();
|
||||
float localAI1 = reader.ReadSingle();
|
||||
float localAI2 = reader.ReadSingle();
|
||||
float localAI3 = reader.ReadSingle();
|
||||
|
||||
// If the NPC in question isn't valid, don't do anything.
|
||||
NPC npc2 = Main.npc[npcIdx2];
|
||||
if (!npc2.active)
|
||||
break;
|
||||
|
||||
npc2.localAI[0] = localAI0;
|
||||
npc2.localAI[1] = localAI1;
|
||||
npc2.localAI[2] = localAI2;
|
||||
npc2.localAI[3] = localAI3;
|
||||
break;
|
||||
|
||||
case CalamityModMessageType.SpawnSuperDummy:
|
||||
int x = reader.ReadInt32();
|
||||
int y = reader.ReadInt32();
|
||||
// Not strictly necessary, but helps prevent unnecessary packetstorm in MP
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
NPC.NewNPC(new EntitySource_WorldEvent(), x, y, ModContent.NPCType<SuperDummyNPC>());
|
||||
break;
|
||||
|
||||
case CalamityModMessageType.DeleteAllSuperDummies:
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
SuperDummy.DeleteDummies();
|
||||
break;
|
||||
|
||||
case CalamityModMessageType.SyncAndroombaSolution:
|
||||
int index = reader.ReadInt32();
|
||||
int solType = reader.ReadInt32();
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
AndroombaFriendly.SwapSolution(index, solType);
|
||||
break;
|
||||
|
||||
case CalamityModMessageType.SyncAndroombaAI:
|
||||
{
|
||||
int idx = reader.ReadInt32();
|
||||
int phase = reader.ReadInt32();
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
AndroombaFriendly.ChangeAI(idx, phase);
|
||||
}
|
||||
break;
|
||||
|
||||
case CalamityModMessageType.SyncSlabCrabAI:
|
||||
{
|
||||
int idx = reader.ReadInt32();
|
||||
int phase = reader.ReadInt32();
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
AndroombaFriendly.ChangeAI(idx, phase);
|
||||
}
|
||||
break;
|
||||
|
||||
case CalamityModMessageType.PlaceAltCritter:
|
||||
{
|
||||
int placerplayer = reader.ReadInt32();
|
||||
int posX = reader.ReadInt32();
|
||||
int posY = reader.ReadInt32();
|
||||
int type = reader.ReadInt32();
|
||||
int itemType = reader.ReadInt32();
|
||||
float color = reader.ReadInt32();
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
int n = NPC.NewNPC(Main.player[placerplayer].GetSource_ReleaseEntity(), posX, posY, type, ai1: color);
|
||||
Main.npc[n].catchItem = itemType;
|
||||
Main.npc[n].releaseOwner = (short)placerplayer;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case CalamityModMessageType.ServersideSpawnOldDuke:
|
||||
byte playerIndex2 = reader.ReadByte();
|
||||
CalamityUtils.SpawnOldDuke(playerIndex2);
|
||||
break;
|
||||
|
||||
case CalamityModMessageType.ProvidenceDyeConditionSync:
|
||||
byte npcIndex3 = reader.ReadByte();
|
||||
(Main.npc[npcIndex3].ModNPC as Providence).hasTakenDaytimeDamage = reader.ReadBoolean();
|
||||
break;
|
||||
|
||||
case CalamityModMessageType.PSCChallengeSync:
|
||||
byte npcIndex4 = reader.ReadByte();
|
||||
(Main.npc[npcIndex4].ModNPC as Providence).challenge = reader.ReadBoolean();
|
||||
break;
|
||||
|
||||
//
|
||||
// General syncs for entities
|
||||
//
|
||||
|
||||
case CalamityModMessageType.SpawnNPCOnPlayer:
|
||||
x = reader.ReadInt32();
|
||||
y = reader.ReadInt32();
|
||||
int npcType = reader.ReadInt32();
|
||||
int player = reader.ReadInt32();
|
||||
Vector2 spawnPosition = reader.ReadVector2();
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
int spawnedNPC = NPC.NewNPC(new EntitySource_WorldEvent(), x, y, npcType, Target: player);
|
||||
NetMessage.SendData(MessageID.SyncNPC, -1, player, null, spawnedNPC);
|
||||
}
|
||||
break;
|
||||
|
||||
case CalamityModMessageType.SyncNPCMotionDataToServer:
|
||||
int npcIndex = reader.ReadInt32();
|
||||
Vector2 center = reader.ReadVector2();
|
||||
Vector2 velocity = reader.ReadVector2();
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
Main.npc[npcIndex].Center = center;
|
||||
Main.npc[npcIndex].velocity = velocity;
|
||||
NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npcIndex);
|
||||
}
|
||||
break;
|
||||
|
||||
case CalamityModMessageType.SyncNPCPosAndRotOnly:
|
||||
npcIndex = reader.ReadByte();
|
||||
Vector2 position = reader.ReadVector2();
|
||||
float rotation = (float)reader.ReadHalf(); //rotation unit is radian (-π/2 ≤ rotation ≤ π/2) so Half precision should works
|
||||
|
||||
if (npcIndex >= Main.maxNPCs)
|
||||
break;
|
||||
|
||||
npc = Main.npc[npcIndex];
|
||||
npc.position = position;
|
||||
npc.rotation = rotation;
|
||||
|
||||
if (Main.dedServ)
|
||||
{
|
||||
ModPacket packet = CalamityMod.Instance.GetPacket();
|
||||
packet.Write((byte)CalamityModMessageType.SyncNPCPosAndRotOnly);
|
||||
packet.Write((byte)npcIndex);
|
||||
packet.WriteVector2(position);
|
||||
packet.Write((Half)rotation);
|
||||
packet.Send(ignoreClient: whoAmI);
|
||||
}
|
||||
break;
|
||||
|
||||
//
|
||||
// Tile Entities
|
||||
//
|
||||
|
||||
case CalamityModMessageType.UnlockAbyssChests:
|
||||
Abyss.UnlockAllAbyssChests();
|
||||
break;
|
||||
case CalamityModMessageType.PowerCellFactory:
|
||||
TEPowerCellFactory.ReadSyncPacket(mod, reader);
|
||||
break;
|
||||
case CalamityModMessageType.ChargingStationStandard:
|
||||
TEChargingStation.ReadSyncPacket(mod, reader);
|
||||
break;
|
||||
case CalamityModMessageType.ChargingStationItemChange:
|
||||
TEChargingStation.ReadItemSyncPacket(mod, reader);
|
||||
break;
|
||||
case CalamityModMessageType.Turret:
|
||||
TEBaseTurret.ReadSyncPacket(mod, reader);
|
||||
break;
|
||||
case CalamityModMessageType.LabHologramProjector:
|
||||
TELabHologramProjector.ReadSyncPacket(mod, reader);
|
||||
break;
|
||||
case CalamityModMessageType.UpdateCodebreakerConstituents:
|
||||
TECodebreaker.ReadConstituentsUpdateSync(mod, reader);
|
||||
break;
|
||||
case CalamityModMessageType.UpdateCodebreakerContainedStuff:
|
||||
TECodebreaker.ReadContainmentSync(mod, reader);
|
||||
break;
|
||||
case CalamityModMessageType.UpdateCodebreakerDecryptCountdown:
|
||||
TECodebreaker.ReadDecryptCountdownSync(mod, reader);
|
||||
break;
|
||||
|
||||
//
|
||||
// Boss Rush
|
||||
//
|
||||
|
||||
case CalamityModMessageType.BossRushStage:
|
||||
int stage = reader.ReadInt32();
|
||||
BossRushEvent.BossRushStage = stage;
|
||||
break;
|
||||
case CalamityModMessageType.BossRushStartTimer:
|
||||
BossRushEvent.StartTimer = reader.ReadInt32();
|
||||
break;
|
||||
case CalamityModMessageType.BossRushEndTimer:
|
||||
BossRushEvent.EndTimer = reader.ReadInt32();
|
||||
break;
|
||||
case CalamityModMessageType.EndBossRush:
|
||||
BossRushEvent.EndEffects();
|
||||
break;
|
||||
case CalamityModMessageType.BRHostileProjKillSync:
|
||||
int countdown3 = reader.ReadInt32();
|
||||
BossRushEvent.HostileProjectileKillCounter = countdown3;
|
||||
break;
|
||||
|
||||
//
|
||||
// Acid Rain
|
||||
//
|
||||
|
||||
case CalamityModMessageType.AcidRainSync:
|
||||
AcidRainEvent.AcidRainEventIsOngoing = reader.ReadBoolean();
|
||||
AcidRainEvent.AccumulatedKillPoints = reader.ReadInt32();
|
||||
AcidRainEvent.TimeSinceLastAcidRainKill = reader.ReadInt32();
|
||||
break;
|
||||
case CalamityModMessageType.AcidRainOldDukeSummonSync:
|
||||
AcidRainEvent.HasTriedToSummonOldDuke = reader.ReadBoolean();
|
||||
break;
|
||||
case CalamityModMessageType.EncounteredOldDukeSync:
|
||||
AcidRainEvent.OldDukeHasBeenEncountered = reader.ReadBoolean();
|
||||
break;
|
||||
|
||||
//
|
||||
// Draedon Summoner stuff
|
||||
//
|
||||
case CalamityModMessageType.CodebreakerSummonStuff:
|
||||
CalamityWorld.DraedonSummonCountdown = reader.ReadInt32();
|
||||
CalamityWorld.DraedonSummonPosition = reader.ReadVector2();
|
||||
CalamityWorld.DraedonMechdusa = reader.ReadBoolean();
|
||||
break;
|
||||
case CalamityModMessageType.ExoMechSelection:
|
||||
CalamityWorld.DraedonMechToSummon = (ExoMech)reader.ReadInt32();
|
||||
break;
|
||||
|
||||
//
|
||||
// Mouse control syncs
|
||||
//
|
||||
|
||||
case CalamityModMessageType.RightClickSync:
|
||||
Main.player[reader.ReadInt32()].Calamity().HandleRightClick(reader);
|
||||
break;
|
||||
case CalamityModMessageType.MousePositionSync:
|
||||
Main.player[reader.ReadInt32()].Calamity().HandleMousePosition(reader);
|
||||
break;
|
||||
|
||||
|
||||
//
|
||||
// Difficulty syncs
|
||||
//
|
||||
|
||||
case CalamityModMessageType.SyncDifficulties:
|
||||
int sender = reader.ReadInt32();
|
||||
CalamityWorld.revenge = reader.ReadBoolean();
|
||||
CalamityWorld.death = reader.ReadBoolean();
|
||||
//TODO - Something so that other mods that hijack the difficulty ui can also use the remainder of the reader to have their own shit
|
||||
|
||||
if (Main.netMode == NetmodeID.Server)
|
||||
SyncCalamityWorldDifficulties(sender);
|
||||
break;
|
||||
|
||||
//
|
||||
// Music event syncs
|
||||
//
|
||||
case CalamityModMessageType.MusicEventSyncRequest:
|
||||
MusicEventSystem.FulfillSyncRequest(whoAmI);
|
||||
break;
|
||||
|
||||
case CalamityModMessageType.MusicEventSyncResponse:
|
||||
MusicEventSystem.ReceiveSyncResponse(reader);
|
||||
break;
|
||||
|
||||
//
|
||||
// Bandit refund syncs
|
||||
//
|
||||
case CalamityModMessageType.SomeoneGotScammedByTinkerer:
|
||||
int scammedOne = reader.ReadByte();
|
||||
int stolen = reader.Read7BitEncodedInt();
|
||||
|
||||
CalamityWorld.MoneyStolenByBandit += stolen;
|
||||
CalamityWorld.Reforges++;
|
||||
|
||||
// Broadcast back for tragic event
|
||||
// WorldSync DO sync the MoneyStolenByBandit and Refores variable, But spamming SyncWorld is not a ideal action
|
||||
if (Main.dedServ)
|
||||
{
|
||||
ModPacket packet = CalamityMod.Instance.GetPacket();
|
||||
packet.Write((byte)CalamityModMessageType.SomeoneGotScammedByTinkerer);
|
||||
packet.Write((byte)scammedOne);
|
||||
packet.Write7BitEncodedInt(stolen);
|
||||
packet.Send(ignoreClient: scammedOne);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case CalamityModMessageType.WantToRefundReforges:
|
||||
int requester = reader.ReadByte();
|
||||
|
||||
// Only Server should handle this action!
|
||||
if (!Main.dedServ)
|
||||
break;
|
||||
|
||||
int banditIdx = NPC.FindFirstNPC(ModContent.NPCType<THIEF>());
|
||||
if (banditIdx == -1)
|
||||
break;
|
||||
|
||||
NPC bandit = Main.npc[banditIdx];
|
||||
if (bandit == null || !bandit.active)
|
||||
break;
|
||||
|
||||
THIEF.DoRefund(bandit);
|
||||
break;
|
||||
|
||||
//
|
||||
// Default case: with no idea how long the packet is, we can't safely read data.
|
||||
// Throw an exception now instead of allowing the network stream to corrupt.
|
||||
//
|
||||
default:
|
||||
CalamityMod.Instance.Logger.Error($"Failed to parse Calamity packet: No Calamity packet exists with ID {msgType}.");
|
||||
throw new Exception("Failed to parse Calamity packet: Invalid Calamity packet ID.");
|
||||
|
||||
CalamityMod.Instance.Logger.Error($"Failed to parse Calamity packet: No Calamity packet exists with ID {msgType}.");
|
||||
throw new Exception("Failed to parse Calamity packet: Invalid Calamity packet ID.");
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
@@ -417,19 +144,56 @@ namespace CalamityMod
|
||||
NetMessage.SendData(MessageID.WorldData);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Shorthand Method for SyncNPC
|
||||
/// <code>
|
||||
/// This Equals to:
|
||||
///
|
||||
/// if (Main.dedServ and npc != null)
|
||||
/// NetMessage.SendData(MessageID.SyncNPC, ...)
|
||||
/// </code>
|
||||
/// </summary>
|
||||
public static void SyncNPC(NPC npcToSync, int toClient = -1, int ignoreClient = -1)
|
||||
{
|
||||
if (!Main.dedServ)
|
||||
return;
|
||||
|
||||
if (npcToSync is null)
|
||||
return;
|
||||
|
||||
var npcWhoAmI = npcToSync.whoAmI;
|
||||
if (npcWhoAmI < 0 || npcWhoAmI >= Main.maxNPCs)
|
||||
return;
|
||||
|
||||
NetMessage.SendData(MessageID.SyncNPC, toClient, ignoreClient, null, npcWhoAmI);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Shorthand Method for SyncNPC
|
||||
/// <code>
|
||||
/// This Equals to:
|
||||
///
|
||||
/// if (Main.dedServ and npcWhoAmI in valid range)
|
||||
/// NetMessage.SendData(MessageID.SyncNPC, ...)
|
||||
/// </code>
|
||||
/// </summary>
|
||||
public static void SyncNPC(int npcWhoAmI, int toClient = -1, int ignoreClient = -1)
|
||||
{
|
||||
if (!Main.dedServ)
|
||||
return;
|
||||
|
||||
if (npcWhoAmI < 0 || npcWhoAmI >= Main.maxNPCs)
|
||||
return;
|
||||
|
||||
NetMessage.SendData(MessageID.SyncNPC, toClient, ignoreClient, null, npcWhoAmI);
|
||||
}
|
||||
|
||||
public static void SyncCalamityWorldDifficulties(int sender)
|
||||
{
|
||||
if (Main.netMode == NetmodeID.SinglePlayer)
|
||||
return;
|
||||
|
||||
var netMessage = CalamityMod.Instance.GetPacket();
|
||||
netMessage.Write((byte)CalamityModMessageType.SyncDifficulties);
|
||||
netMessage.Write(sender);
|
||||
netMessage.Write(CalamityWorld.revenge);
|
||||
netMessage.Write(CalamityWorld.death);
|
||||
|
||||
//TODO - Let other mods also add their own bits in that sync. Ideally would be done through the difficultystem itself
|
||||
netMessage.Send(-1, sender);
|
||||
SyncDifficultiesPacket.Send();
|
||||
}
|
||||
|
||||
public static void NewNPC_ClientSide(Vector2 spawnPosition, int npcType, Player player)
|
||||
@@ -439,14 +203,10 @@ namespace CalamityMod
|
||||
NPC.NewNPC(new EntitySource_WorldEvent(), (int)spawnPosition.X, (int)spawnPosition.Y, npcType, Target: player.whoAmI);
|
||||
return;
|
||||
}
|
||||
|
||||
var netMessage = CalamityMod.Instance.GetPacket();
|
||||
netMessage.Write((byte)CalamityModMessageType.SpawnNPCOnPlayer);
|
||||
netMessage.Write((int)spawnPosition.X);
|
||||
netMessage.Write((int)spawnPosition.Y);
|
||||
netMessage.Write(npcType);
|
||||
netMessage.Write(player.whoAmI);
|
||||
netMessage.Send();
|
||||
else if (Main.netMode == NetmodeID.MultiplayerClient)
|
||||
{
|
||||
SpawnNPCOnPlayerPacket.Send(player, (int)spawnPosition.X, (int)spawnPosition.Y, npcType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -470,12 +230,12 @@ namespace CalamityMod
|
||||
SyncAndroombaAI,
|
||||
SyncSlabCrabAI,
|
||||
PlaceAltCritter,
|
||||
ServersideSpawnOldDuke,
|
||||
ProvidenceDyeConditionSync, // TODO -- this packetstorms if you hit Provi with spam weapons. It should ONLY send a packet if the status changes.
|
||||
PSCChallengeSync, // TODO -- once you've failed the PSC challenge this packetstorms
|
||||
|
||||
// General things for entities
|
||||
SpawnNPCOnPlayer,
|
||||
SpawnBossOnPosition,
|
||||
SyncNPCMotionDataToServer,
|
||||
SyncNPCPosAndRotOnly,
|
||||
|
||||
@@ -518,7 +278,12 @@ namespace CalamityMod
|
||||
MusicEventSyncResponse,
|
||||
|
||||
// Bandit Reforge Refund
|
||||
SomeoneGotScammedByTinkerer,
|
||||
WantToRefundReforges
|
||||
BanditStolenMoneySync,
|
||||
WantToRefundReforges,
|
||||
|
||||
// Player Draw Effect Parameters
|
||||
SyncPlayerDrawParameter,
|
||||
|
||||
Reserved = 150
|
||||
}
|
||||
}
|
||||
@@ -60,6 +60,17 @@ namespace CalamityMod.Cooldowns
|
||||
AssignHandler(cd);
|
||||
}
|
||||
|
||||
internal CooldownInstance(Player player, ushort netID, int duration, int timeLeft)
|
||||
{
|
||||
this.netID = netID;
|
||||
this.player = player;
|
||||
this.duration = duration;
|
||||
this.timeLeft = timeLeft;
|
||||
|
||||
string id = CooldownRegistry.registry[netID].ID;
|
||||
AssignHandler(CooldownRegistry.Get(id));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a cooldown instance from serialized binary data, used in netcode.
|
||||
/// </summary>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
|
||||
namespace CalamityMod.DataStructures
|
||||
{
|
||||
@@ -14,6 +15,11 @@ namespace CalamityMod.DataStructures
|
||||
public const float SpongeShieldDepth = 4f;
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Owner of this Renderer Item
|
||||
/// </summary>
|
||||
public Player OwnerPlayer { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The draw depth of the renderer. This is used to draw them in descending order; higher values are drawn first.
|
||||
/// </summary>
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Dusts
|
||||
{
|
||||
public class LightDust : ModDust
|
||||
{
|
||||
public override void OnSpawn(Dust dust)
|
||||
{
|
||||
dust.scale *= Main.rand.NextFloat(0.8f, 1f);
|
||||
}
|
||||
|
||||
public override bool Update(Dust dust)
|
||||
{
|
||||
dust.rotation += MathF.Sign(dust.velocity.X);
|
||||
dust.velocity *= 0.98f;
|
||||
dust.scale += 0.02f;
|
||||
|
||||
float light = MathHelper.Clamp(dust.scale * 0.8f, 0f, 1f);
|
||||
if (!dust.noLightEmittence)
|
||||
Lighting.AddLight(dust.position, dust.color.ToVector3() * light);
|
||||
|
||||
return true;
|
||||
}
|
||||
public override bool PreDraw(Dust dust)
|
||||
{
|
||||
Vector2 dustCenter = dust.position + new Vector2(0.25f, 0.25f);
|
||||
Texture2D rechargeTexture2 = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/BasicCircle").Value;
|
||||
if (!dust.noLight)
|
||||
{
|
||||
Texture2D rechargeTexture = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomCircle").Value;
|
||||
// Glow Orb
|
||||
Main.EntitySpriteDraw(rechargeTexture, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, rechargeTexture.Size() * 0.5f, dust.scale * 0.1f, SpriteEffects.None, 0);
|
||||
if (dust.alpha < 1)
|
||||
Main.EntitySpriteDraw(rechargeTexture, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, rechargeTexture.Size() * 0.5f, dust.scale * 0.04f, SpriteEffects.None, 0);
|
||||
}
|
||||
Main.EntitySpriteDraw(rechargeTexture2, dustCenter - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.3f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, rechargeTexture2.Size() * 0.5f, dust.scale * 0.075f, SpriteEffects.None, 0);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 2.8 KiB |
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using CalamityMod.NPCs.AcidRain;
|
||||
using CalamityMod.NPCs.OldDuke;
|
||||
using CalamityMod.Packets;
|
||||
using CalamityMod.Projectiles.Boss;
|
||||
using CalamityMod.UI;
|
||||
using CalamityMod.World;
|
||||
@@ -334,32 +335,13 @@ namespace CalamityMod.Events
|
||||
}
|
||||
CalamityNetcode.SyncWorld();
|
||||
|
||||
// You will be tempted to turn this into a single if conditional.
|
||||
// Don't do this. Doing so has caused so much misery, with various things being read instead
|
||||
// of the correct thing, like booleans being mixed up in the sending and receiving process.
|
||||
// In short, leave this alone.
|
||||
// Flow: 2024/09/06
|
||||
// Salute for the one who wrote 3 if conditional block after experiencing immeasurable torment with packet generations
|
||||
if (Main.netMode == NetmodeID.Server)
|
||||
{
|
||||
var netMessage = CalamityMod.Instance.GetPacket();
|
||||
netMessage.Write((byte)CalamityModMessageType.AcidRainSync);
|
||||
netMessage.Write(AcidRainEventIsOngoing);
|
||||
netMessage.Write(AccumulatedKillPoints);
|
||||
netMessage.Write(TimeSinceLastAcidRainKill);
|
||||
netMessage.Send();
|
||||
}
|
||||
if (Main.netMode == NetmodeID.Server)
|
||||
{
|
||||
var netMessage = CalamityMod.Instance.GetPacket();
|
||||
netMessage.Write((byte)CalamityModMessageType.AcidRainOldDukeSummonSync);
|
||||
netMessage.Write(HasTriedToSummonOldDuke);
|
||||
netMessage.Send();
|
||||
}
|
||||
if (Main.netMode == NetmodeID.Server)
|
||||
{
|
||||
var netMessage = CalamityMod.Instance.GetPacket();
|
||||
netMessage.Write((byte)CalamityModMessageType.EncounteredOldDukeSync);
|
||||
netMessage.Write(OldDukeHasBeenEncountered);
|
||||
netMessage.Send();
|
||||
AcidRainSyncPacket.Send();
|
||||
AcidRainOldDukeSummonSyncPacket.Send();
|
||||
EncounteredOldDukeSyncPacket.Send();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ using CalamityMod.NPCs.SlimeGod;
|
||||
using CalamityMod.NPCs.StormWeaver;
|
||||
using CalamityMod.NPCs.SupremeCalamitas;
|
||||
using CalamityMod.NPCs.Yharon;
|
||||
using CalamityMod.Packets;
|
||||
using CalamityMod.Projectiles.Typeless;
|
||||
using CalamityMod.Skies;
|
||||
using CalamityMod.Systems;
|
||||
@@ -542,10 +543,7 @@ namespace CalamityMod.Events
|
||||
|
||||
if (Main.netMode == NetmodeID.Server)
|
||||
{
|
||||
var netMessage = CalamityMod.Instance.GetPacket();
|
||||
netMessage.Write((byte)CalamityModMessageType.BRHostileProjKillSync);
|
||||
netMessage.Write(HostileProjectileKillCounter);
|
||||
netMessage.Send();
|
||||
BRHostileProjKillSyncPacket.Send();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -561,10 +559,7 @@ namespace CalamityMod.Events
|
||||
BossRushStage = 0;
|
||||
if (Main.netMode == NetmodeID.Server)
|
||||
{
|
||||
var netMessage = CalamityMod.Instance.GetPacket();
|
||||
netMessage.Write((byte)CalamityModMessageType.BossRushStage);
|
||||
netMessage.Write(BossRushStage);
|
||||
netMessage.Send();
|
||||
BossRushStagePacket.Send();
|
||||
}
|
||||
}
|
||||
return;
|
||||
@@ -633,9 +628,7 @@ namespace CalamityMod.Events
|
||||
}
|
||||
else
|
||||
{
|
||||
var netMessage = CalamityMod.Instance.GetPacket();
|
||||
netMessage.Write((byte)CalamityModMessageType.EndBossRush);
|
||||
netMessage.Send();
|
||||
EndBossRushPacket.Send();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -665,18 +658,9 @@ namespace CalamityMod.Events
|
||||
CalamityNetcode.SyncWorld();
|
||||
if (Main.netMode == NetmodeID.Server)
|
||||
{
|
||||
var netMessage = CalamityMod.Instance.GetPacket();
|
||||
netMessage.Write((byte)CalamityModMessageType.BossRushStage);
|
||||
netMessage.Write(BossRushStage);
|
||||
netMessage.Send();
|
||||
var netMessage2 = CalamityMod.Instance.GetPacket();
|
||||
netMessage2.Write((byte)CalamityModMessageType.BossRushStartTimer);
|
||||
netMessage2.Write(StartTimer);
|
||||
netMessage2.Send();
|
||||
var netMessage3 = CalamityMod.Instance.GetPacket();
|
||||
netMessage3.Write((byte)CalamityModMessageType.BossRushEndTimer);
|
||||
netMessage3.Write(EndTimer);
|
||||
netMessage3.Send();
|
||||
BossRushStagePacket.Send();
|
||||
BossRushStartTimerPacket.Send();
|
||||
BossRushEndTimerPacket.Send();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -763,14 +747,8 @@ namespace CalamityMod.Events
|
||||
// Sync the stage and progress of Boss Rush whenever a relevant boss dies.
|
||||
if (Main.netMode == NetmodeID.Server)
|
||||
{
|
||||
var netMessage = mod.GetPacket();
|
||||
netMessage.Write((byte)CalamityModMessageType.BossRushStage);
|
||||
netMessage.Write(BossRushStage);
|
||||
netMessage.Send();
|
||||
var netMessage2 = mod.GetPacket();
|
||||
netMessage2.Write((byte)CalamityModMessageType.BRHostileProjKillSync);
|
||||
netMessage2.Write(HostileProjectileKillCounter);
|
||||
netMessage2.Send();
|
||||
BossRushStagePacket.Send();
|
||||
BRHostileProjKillSyncPacket.Send();
|
||||
}
|
||||
|
||||
BossRushSky.CurrentInterest = 0.85f;
|
||||
@@ -801,10 +779,7 @@ namespace CalamityMod.Events
|
||||
if (Main.netMode != NetmodeID.Server)
|
||||
return;
|
||||
|
||||
var netMessage = CalamityMod.Instance.GetPacket();
|
||||
netMessage.Write((byte)CalamityModMessageType.BossRushStartTimer);
|
||||
netMessage.Write(StartTimer);
|
||||
netMessage.Send();
|
||||
BossRushStartTimerPacket.Send();
|
||||
}
|
||||
|
||||
public static void SyncEndTimer(int time)
|
||||
@@ -813,10 +788,7 @@ namespace CalamityMod.Events
|
||||
if (Main.netMode != NetmodeID.Server)
|
||||
return;
|
||||
|
||||
var netMessage = CalamityMod.Instance.GetPacket();
|
||||
netMessage.Write((byte)CalamityModMessageType.BossRushEndTimer);
|
||||
netMessage.Write(EndTimer);
|
||||
netMessage.Send();
|
||||
BossRushEndTimerPacket.Send();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
|
After Width: | Height: | Size: 442 B |
|
After Width: | Height: | Size: 338 B |
@@ -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 GalaxyMetaball : 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.BeforeNPCs;
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -44,8 +44,13 @@ namespace CalamityMod.Graphics.Renderers.CalamityRenderers
|
||||
|
||||
public override void Unload()
|
||||
{
|
||||
Targets?.Clear();
|
||||
Targets = null;
|
||||
|
||||
Dyes?.Clear();
|
||||
Dyes = null;
|
||||
|
||||
RenderersToDrawThisFrame?.Clear();
|
||||
RenderersToDrawThisFrame = null;
|
||||
}
|
||||
#endregion
|
||||
@@ -61,7 +66,8 @@ namespace CalamityMod.Graphics.Renderers.CalamityRenderers
|
||||
if (armorItem.ModItem is not IDyeableShaderRenderer drawer)
|
||||
return;
|
||||
|
||||
// Store the dye in the slot.
|
||||
// Store the dye and player in the slot.
|
||||
drawer.OwnerPlayer = self;
|
||||
Dyes[drawer] = GameShaders.Armor.GetShaderFromItemId(dyeItem.type);
|
||||
}
|
||||
|
||||
@@ -149,7 +155,10 @@ namespace CalamityMod.Graphics.Renderers.CalamityRenderers
|
||||
|
||||
#region Updates/Drawing
|
||||
// Clear the list at the beginning of each update, to ensure its only populated by correct ones.
|
||||
public override void PreUpdate() => RenderersToDrawThisFrame?.Clear();
|
||||
public override void PreUpdate()
|
||||
{
|
||||
RenderersToDrawThisFrame?.Clear();
|
||||
}
|
||||
|
||||
public override void DrawToTarget(SpriteBatch spriteBatch)
|
||||
{
|
||||
@@ -157,7 +166,7 @@ namespace CalamityMod.Graphics.Renderers.CalamityRenderers
|
||||
return;
|
||||
|
||||
// Leave if nothing to draw.
|
||||
if (!RenderersToDrawThisFrame.Any())
|
||||
if (RenderersToDrawThisFrame.Count <= 0)
|
||||
return;
|
||||
|
||||
// Sort the list by draw order.
|
||||
@@ -180,7 +189,7 @@ namespace CalamityMod.Graphics.Renderers.CalamityRenderers
|
||||
return;
|
||||
|
||||
// Leave if nothing to draw.
|
||||
if (!RenderersToDrawThisFrame.Any())
|
||||
if (RenderersToDrawThisFrame.Count <= 0)
|
||||
return;
|
||||
|
||||
foreach (var renderer in RenderersToDrawThisFrame)
|
||||
|
||||
@@ -86,29 +86,22 @@ namespace CalamityMod.Graphics.Renderers
|
||||
if (Main.gameMenu || Main.dedServ)
|
||||
return;
|
||||
|
||||
// Reset drawn frame check
|
||||
foreach (var player in Main.ActivePlayers)
|
||||
{
|
||||
player.Calamity().drawnAnyShieldThisFrame = false;
|
||||
}
|
||||
|
||||
foreach (var renderer in Renderers)
|
||||
{
|
||||
if (!renderer.ShouldDraw)
|
||||
continue;
|
||||
|
||||
try
|
||||
Main.spriteBatch.SafeAction(() =>
|
||||
{
|
||||
renderer.MainTarget.SwapTo(Color.Transparent);
|
||||
Main.spriteBatch.TryBegin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
|
||||
renderer.DrawToTarget(Main.spriteBatch);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Main.QueueMainThreadAction(() =>
|
||||
{
|
||||
CalamityMod.Instance.Logger.Error($"Exception Found on RenderDetour: {e}");
|
||||
});
|
||||
}
|
||||
finally
|
||||
{
|
||||
// Always end the Batch!
|
||||
Main.spriteBatch.TryEnd();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Main.instance.GraphicsDevice.SetRenderTarget(null);
|
||||
|
||||
@@ -193,6 +193,7 @@ namespace CalamityMod.ILEditing
|
||||
IL_Main.UpdateTime_StartNight += BloodMoonsRequire200MaxLife;
|
||||
IL_WorldGen.AttemptFossilShattering += PreventFossilShattering;
|
||||
On_Player.GetPickaxeDamage += RemoveHellforgePickaxeRequirement;
|
||||
IL_Player.Update += PreventUFODismountInWater;
|
||||
On_Player.GetAnglerReward += ImproveAnglerRewards;
|
||||
|
||||
On_Player.ItemCheck_CheckCanUse += RemoveCelestialSigilUseLock;
|
||||
|
||||
@@ -0,0 +1,122 @@
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using Terraria;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.ID;
|
||||
using Terraria.Localization;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.ILEditing
|
||||
{
|
||||
// These IL edits are contained in their own ModSystem instead of the main ILChanges system for the following reasons:
|
||||
// - Easily filter out only the NetProtectionILChanges from the call stack, and not other IL edits
|
||||
// - No interference with the existing ILChanges system, which contains gameplay changes and is already packed
|
||||
//
|
||||
// Original comment by Flowaria:
|
||||
//
|
||||
// We want to set this as Separate ILChages type for reasons:
|
||||
// - To easily filter ILChanges callstack from StackTrace
|
||||
// - To make no impact on ILChanges type which is already clustered
|
||||
public sealed class NetProtectionILChanges : ModSystem
|
||||
{
|
||||
private static string[] _ModNames;
|
||||
|
||||
public override void OnModLoad()
|
||||
{
|
||||
_ModNames = ModLoader.Mods.Select(mod => mod.Name).ToArray();
|
||||
|
||||
On_NPC.NewNPC += NewNPCRule;
|
||||
On_NetMessage.SendData += SendDataRule;
|
||||
}
|
||||
|
||||
public override void OnModUnload()
|
||||
{
|
||||
_ModNames = null;
|
||||
}
|
||||
|
||||
private int NewNPCRule(On_NPC.orig_NewNPC orig, IEntitySource source, int X, int Y, int Type, int Start, float ai0, float ai1, float ai2, float ai3, int Target)
|
||||
{
|
||||
if (Main.netMode == NetmodeID.MultiplayerClient)
|
||||
{
|
||||
CalamityMod.Instance.Logger.Error($"NETCODE SAFETY VIOLATION DETECTED: {nameof(NPC.NewNPC)} was called from a Multiplayer Client");
|
||||
CalamityMod.Instance.Logger.Error(GetSimplifiedStackTrace());
|
||||
return Main.maxNPCs;
|
||||
}
|
||||
|
||||
return orig(source, X, Y, Type, Start, ai0, ai1, ai2, ai3, Target);
|
||||
}
|
||||
|
||||
private static void SendDataRule(On_NetMessage.orig_SendData orig, int msgType, int remoteClient, int ignoreClient, NetworkText text, int number, float number2, float number3, float number4, int number5, int number6, int number7)
|
||||
{
|
||||
// Sending SyncNPC as Client will cause Server to not read their bytes
|
||||
// So we simply stop that from happening
|
||||
if (msgType == MessageID.SyncNPC && Main.netMode == NetmodeID.MultiplayerClient)
|
||||
{
|
||||
CalamityMod.Instance.Logger.Error($"NETCODE SAFETY VIOLATION DETECTED: {nameof(NetMessage.SendData)} ({nameof(MessageID.SyncNPC)}) was called from a Multiplayer Client");
|
||||
CalamityMod.Instance.Logger.Error(GetSimplifiedStackTrace());
|
||||
return;
|
||||
}
|
||||
|
||||
orig(msgType, remoteClient, ignoreClient, text, number, number2, number3, number4, number5, number6, number7);
|
||||
}
|
||||
|
||||
#region Simplified StackTrace Util Method
|
||||
|
||||
private static bool ContainsAnyModName(string str)
|
||||
{
|
||||
return _ModNames?.Any(str.Contains) ?? false;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.NoInlining)] // Force No Inlining to easily filter current stack (skipFrames: 1)
|
||||
private static string GetSimplifiedStackTrace()
|
||||
{
|
||||
var stringBuilder = new StringBuilder();
|
||||
try
|
||||
{
|
||||
stringBuilder.AppendLine("STACKTRACE:");
|
||||
|
||||
var stacktrace = new StackTrace(skipFrames: 1);
|
||||
var frames = stacktrace.GetFrames();
|
||||
var didPrintSomethingUselessLastTime = false;
|
||||
var didEverPrintSomethingUseful = false;
|
||||
foreach (var frame in frames)
|
||||
{
|
||||
var method = frame.GetMethod();
|
||||
var methodName = method?.ToString() ?? "UNKNOWN_METHOD";
|
||||
var typeName = method?.DeclaringType?.FullName ?? "UNKNOWN_TYPE";
|
||||
|
||||
// Logging Rule:
|
||||
// - It should contains ANY ModName in their FullName
|
||||
// - It should NOT contains NetProtectionILChanges in their FullName (Calamity Codebase Exclusive)
|
||||
if (ContainsAnyModName(typeName) && !typeName.Contains(nameof(NetProtectionILChanges)))
|
||||
{
|
||||
didPrintSomethingUselessLastTime = false;
|
||||
didEverPrintSomethingUseful = true;
|
||||
stringBuilder.AppendFormat(" at {0}::{1}", typeName, methodName);
|
||||
stringBuilder.AppendLine();
|
||||
}
|
||||
else if (!didPrintSomethingUselessLastTime && didEverPrintSomethingUseful)
|
||||
{
|
||||
stringBuilder.AppendLine(" ...");
|
||||
didPrintSomethingUselessLastTime = true;
|
||||
}
|
||||
}
|
||||
|
||||
stringBuilder.AppendLine("END OF STACKTRACE");
|
||||
return stringBuilder.ToString();
|
||||
}
|
||||
catch
|
||||
{
|
||||
return "";
|
||||
}
|
||||
finally
|
||||
{
|
||||
stringBuilder?.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -276,6 +276,37 @@ namespace CalamityMod.ILEditing
|
||||
// TODO -- Finish this
|
||||
#endregion Fix Chlorophyte Crystal Attacking Where it Shouldn't
|
||||
|
||||
#region Prevent UFO Mount from Dismounting in Water
|
||||
private static void PreventUFODismountInWater(ILContext il)
|
||||
{
|
||||
// Prevent the Cosmic Car Key's UFO mount from dismounting when the player is in water.
|
||||
var cursor = new ILCursor(il);
|
||||
|
||||
// Unfortunately, the code responsible for this is 4000 lines into Player.Update, meaning that reaching it is far from simple.
|
||||
// The following method was the easiest way I could find to reach it:
|
||||
// Move to the third call of Mount.Dismount.
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchCallvirt<Mount>("Dismount")))
|
||||
{
|
||||
LogFailure("Prevent UFO Dismounting in Water", "Could not reach the Dismount instruction.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Move the cursor backwards to place it right after the instruction which loads Main.myPlayer onto the stack.
|
||||
if (!cursor.TryGotoPrev(MoveType.After, i => i.MatchLdsfld<Main>("myPlayer")))
|
||||
{
|
||||
LogFailure("Prevent UFO Dismounting in Water", "Could not locate the myPlayer check.");
|
||||
return;
|
||||
}
|
||||
|
||||
// Remove the instruction and replace it with the integer limit. The next instruction checks if this value is equal to Player.whoAmI.
|
||||
// Player.whoAmI will never be the integer limit, so the check will always fail and the UFO will not dismount.
|
||||
cursor.EmitPop();
|
||||
cursor.Emit(OpCodes.Ldc_I4, int.MaxValue);
|
||||
}
|
||||
#endregion Prevent UFO Mount from Dismounting in Water
|
||||
|
||||
#region Color Blighted Gel
|
||||
private static void ColorBlightedGel(Terraria.GameContent.ItemDropRules.On_CommonCode.orig_ModifyItemDropFromNPC orig, NPC npc, int itemIndex)
|
||||
{
|
||||
|
||||
@@ -31,28 +31,28 @@ namespace CalamityMod.Items.Accessories
|
||||
public static int ShieldDurabilityMax = 25;
|
||||
|
||||
// Interface stuff.
|
||||
public Player OwnerPlayer { get; set; }
|
||||
public float RenderDepth => IDyeableShaderRenderer.ProfanedSoulShieldDepth;
|
||||
|
||||
public bool ShouldDrawDyeableShader
|
||||
{
|
||||
get
|
||||
{
|
||||
bool result = false;
|
||||
foreach (Player player in Main.ActivePlayers)
|
||||
{
|
||||
if (player.outOfRange || player.dead)
|
||||
continue;
|
||||
if (CalamityClientConfig.Instance.EnergyShieldOpacity <= 0.0f)
|
||||
return false;
|
||||
|
||||
CalamityPlayer modPlayer = player.Calamity();
|
||||
var player = OwnerPlayer;
|
||||
if (player is null)
|
||||
return false;
|
||||
|
||||
// Do not render the shield if its visibility is off (or it does not exist)
|
||||
bool isVanityOnly = modPlayer.pSoulShieldVisible && !modPlayer.pSoulArtifact;
|
||||
bool shouldNotDraw = modPlayer.andromedaState >= AndromedaPlayerState.LargeRobot; //I am not dealing with drawing that :taxevasion:
|
||||
bool shieldExists = isVanityOnly || modPlayer.pSoulShieldDurability > 0;
|
||||
bool shouldntDraw = !modPlayer.pSoulShieldVisible || modPlayer.drawnAnyShieldThisFrame || shouldNotDraw || !shieldExists;
|
||||
result |= !shouldntDraw;
|
||||
}
|
||||
return result;
|
||||
if (player.outOfRange || player.dead)
|
||||
return false;
|
||||
|
||||
CalamityPlayer modPlayer = player.Calamity();
|
||||
if (modPlayer.drawingParameters.ProfanedShieldCharge <= 0.0f)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace CalamityMod.Items.Accessories
|
||||
ItemID.Sets.AnimatesAsSoul[Type] = true;
|
||||
}
|
||||
|
||||
public void DrawDyeableShader(SpriteBatch spriteBatch) => DrawProfanedSoulShields();
|
||||
public void DrawDyeableShader(SpriteBatch spriteBatch) => DrawProfanedSoulShields(OwnerPlayer);
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
@@ -109,121 +109,82 @@ namespace CalamityMod.Items.Accessories
|
||||
|
||||
// Complex drawcode which draws Profaned Soul shields on ALL players who have it available. Supposedly.
|
||||
// This is applied as IL (On hook) which draws right before Inferno Ring.
|
||||
internal static void DrawProfanedSoulShields()
|
||||
internal static void DrawProfanedSoulShields(Player player)
|
||||
{
|
||||
// TODO -- Control flow analysis indicates that this hook is not stable (as it was copied from Rover Drive).
|
||||
// Profaned Soul shields will be drawn for each player with the Profaned Soul artifact/crystal, yes.
|
||||
// But there is no guarantee that the shields will be in the right condition for each player.
|
||||
// Visibility is not net synced, for example.
|
||||
bool alreadyDrawnShieldForPlayer = false;
|
||||
if (player is null)
|
||||
return;
|
||||
|
||||
foreach (Player player in Main.ActivePlayers)
|
||||
if (player.outOfRange || player.dead)
|
||||
return;
|
||||
|
||||
CalamityPlayer modPlayer = player.Calamity();
|
||||
|
||||
if (modPlayer.drawnAnyShieldThisFrame)
|
||||
return;
|
||||
|
||||
if (modPlayer.drawingParameters.ProfanedShieldCharge <= 0.0f)
|
||||
return;
|
||||
|
||||
// Scale the shield is drawn at.
|
||||
// The "i" parameter is to make different player's shields not be perfectly synced.
|
||||
int i = player.whoAmI;
|
||||
float scale = 0.15f + 0.03f * (0.5f + 0.5f * MathF.Sin(Main.GlobalTimeWrappedHourly * 0.5f + i * 0.2f));
|
||||
float visualShieldStrength = modPlayer.drawingParameters.ProfanedShieldCharge;
|
||||
Color shieldColor = modPlayer.drawingParameters.ProfanedShieldColor;
|
||||
|
||||
// The scale used for the noise overlay polygons also grows and shrinks
|
||||
// This is intentionally out of sync with the shield, and intentionally desynced per player
|
||||
// Don't put this anywhere less than 0.25f or higher than 1f. The higher it is, the denser / more zoomed out the noise overlay is.
|
||||
float noiseScale = MathHelper.Lerp(0.4f, 0.8f, MathF.Sin(Main.GlobalTimeWrappedHourly * 0.3f) * 0.5f + 0.5f);
|
||||
|
||||
// Define shader parameters
|
||||
Effect shieldEffect = Filters.Scene["CalamityMod:RoverDriveShield"].GetShader().Shader;
|
||||
shieldEffect.Parameters["time"].SetValue(Main.GlobalTimeWrappedHourly * 0.058f); // Scrolling speed of polygonal overlay
|
||||
shieldEffect.Parameters["blowUpPower"].SetValue(2.8f);
|
||||
shieldEffect.Parameters["blowUpSize"].SetValue(0.4f);
|
||||
shieldEffect.Parameters["noiseScale"].SetValue(noiseScale);
|
||||
|
||||
// Shield opacity multiplier slightly changes, this is independent of current shield strength
|
||||
float baseShieldOpacity = 0.9f + 0.1f * MathF.Sin(Main.GlobalTimeWrappedHourly * 1.95f);
|
||||
float minShieldStrengthOpacityMultiplier = 0.5f;
|
||||
float finalShieldOpacity = baseShieldOpacity * MathHelper.Lerp(minShieldStrengthOpacityMultiplier, 1f, visualShieldStrength);
|
||||
finalShieldOpacity *= CalamityClientConfig.Instance.EnergyShieldOpacity;
|
||||
|
||||
shieldEffect.Parameters["shieldOpacity"].SetValue(finalShieldOpacity);
|
||||
shieldEffect.Parameters["shieldEdgeBlendStrenght"].SetValue(4f);
|
||||
|
||||
Color primaryEdgeColor = new Color(230, 199, 102) * 0.8f;
|
||||
Color secondaryEdgeColor = new Color(249, 231, 217) * 0.8f;
|
||||
Color edgeColor = CalamityUtils.MulticolorLerp(Main.GlobalTimeWrappedHourly * 0.2f, primaryEdgeColor, secondaryEdgeColor);
|
||||
|
||||
// Define shader parameters for shield color
|
||||
shieldEffect.Parameters["shieldColor"].SetValue(shieldColor.ToVector3());
|
||||
shieldEffect.Parameters["shieldEdgeColor"].SetValue(edgeColor.ToVector3());
|
||||
|
||||
var matrix = Main.GameViewMatrix.TransformationMatrix;
|
||||
Main.spriteBatch.SafeBegin(SpriteSortMode.Immediate, BatchSetting.Additive, shieldEffect, matrix, () =>
|
||||
{
|
||||
if (player.outOfRange || player.dead)
|
||||
continue;
|
||||
// Fetch shield heat overlay texture (this is the neutrons fed to the shader)
|
||||
HeatTex ??= ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/GreyscaleGradients/Neurons2");
|
||||
Vector2 pos = player.MountedCenter + player.gfxOffY * Vector2.UnitY - Main.screenPosition;
|
||||
Texture2D tex = HeatTex.Value;
|
||||
Main.spriteBatch.Draw(tex, pos, null, Color.White, 0, tex.Size() / 2f, scale, 0, 0);
|
||||
|
||||
CalamityPlayer modPlayer = player.Calamity();
|
||||
|
||||
// Do not render the shield if its visibility is off (or it does not exist)
|
||||
bool isVanityOnly = modPlayer.pSoulShieldVisible && !modPlayer.pSoulArtifact;
|
||||
bool shouldNotDraw = modPlayer.andromedaState >= AndromedaPlayerState.LargeRobot; //I am not dealing with drawing that :taxevasion:
|
||||
bool shieldExists = isVanityOnly || modPlayer.pSoulShieldDurability > 0;
|
||||
if (!modPlayer.pSoulShieldVisible || modPlayer.drawnAnyShieldThisFrame || shouldNotDraw || !shieldExists)
|
||||
continue;
|
||||
|
||||
// Scale the shield is drawn at.
|
||||
// The "i" parameter is to make different player's shields not be perfectly synced.
|
||||
int i = player.whoAmI;
|
||||
float scale = 0.15f + 0.03f * (0.5f + 0.5f * (float)Math.Sin(Main.GlobalTimeWrappedHourly * 0.5f + i * 0.2f));
|
||||
|
||||
if (!alreadyDrawnShieldForPlayer)
|
||||
{
|
||||
CalamityPlayer localModPlayer = Main.LocalPlayer.Calamity();
|
||||
DetermineTransformationEligibility(localModPlayer.Player);
|
||||
var psState = (int)GetPscStateFor(localModPlayer.Player, localModPlayer.profanedCrystalAnim >= 0);
|
||||
var psc = localModPlayer.profanedCrystalBuffs || (localModPlayer.profanedCrystalAnim >= 0 && psState >= (int)ProfanedSoulCrystalState.Buffs);
|
||||
|
||||
scale += ((ProfanedSoulCrystalState)psState) == ProfanedSoulCrystalState.Empowered ? 0.05f : psc ? 0.025f : 0f;
|
||||
if (localModPlayer.profanedCrystalAnim >= 0)
|
||||
scale = MathHelper.Lerp(0f, scale, ((float)maxPscAnimTime - (float)localModPlayer.profanedCrystalAnim) / (float)maxPscAnimTime); //i don't like casting this many times, i'm not a fucking wizard
|
||||
|
||||
float visualShieldStrength = 1f;
|
||||
if (!isVanityOnly)
|
||||
{
|
||||
float max = psc ? ProfanedSoulCrystal.ShieldDurabilityMax : ShieldDurabilityMax;
|
||||
float shieldDurabilityRatio = localModPlayer.pSoulShieldDurability / max;
|
||||
visualShieldStrength = MathF.Pow(shieldDurabilityRatio, 0.5f);
|
||||
}
|
||||
|
||||
// The scale used for the noise overlay polygons also grows and shrinks
|
||||
// This is intentionally out of sync with the shield, and intentionally desynced per player
|
||||
// Don't put this anywhere less than 0.25f or higher than 1f. The higher it is, the denser / more zoomed out the noise overlay is.
|
||||
float noiseScale = MathHelper.Lerp(0.4f, 0.8f, (float)Math.Sin(Main.GlobalTimeWrappedHourly * 0.3f) * 0.5f + 0.5f);
|
||||
|
||||
// Define shader parameters
|
||||
Effect shieldEffect = Filters.Scene["CalamityMod:RoverDriveShield"].GetShader().Shader;
|
||||
shieldEffect.Parameters["time"].SetValue(Main.GlobalTimeWrappedHourly * 0.058f); // Scrolling speed of polygonal overlay
|
||||
shieldEffect.Parameters["blowUpPower"].SetValue(2.8f);
|
||||
shieldEffect.Parameters["blowUpSize"].SetValue(0.4f);
|
||||
shieldEffect.Parameters["noiseScale"].SetValue(noiseScale);
|
||||
|
||||
// Shield opacity multiplier slightly changes, this is independent of current shield strength
|
||||
float baseShieldOpacity = 0.9f + 0.1f * MathF.Sin(Main.GlobalTimeWrappedHourly * 1.95f);
|
||||
float minShieldStrengthOpacityMultiplier = 0.5f;
|
||||
float finalShieldOpacity = baseShieldOpacity * MathHelper.Lerp(minShieldStrengthOpacityMultiplier, 1f, visualShieldStrength);
|
||||
shieldEffect.Parameters["shieldOpacity"].SetValue(finalShieldOpacity);
|
||||
shieldEffect.Parameters["shieldEdgeBlendStrenght"].SetValue(4f);
|
||||
|
||||
// Profaned Soul shields are not team specific
|
||||
Color shieldColor = GetColorForPsc(psState, Main.dayTime);
|
||||
if (psState >= (int)(ProfanedSoulCrystalState.Buffs))
|
||||
{
|
||||
bool tester = contributorNames.Any(name => name.Equals(localModPlayer.Player.name));
|
||||
shieldColor = tester ? CalamityUtils.ColorSwap(new Color(255, 166, 0), new Color(25, 250, 25) * 0.8f, 6f) :
|
||||
GetLerpedColorForPsc(modPlayer);
|
||||
}
|
||||
|
||||
Color primaryEdgeColor = new Color(230, 199, 102) * 0.8f;
|
||||
Color secondaryEdgeColor = new Color(249, 231, 217) * 0.8f;
|
||||
Color edgeColor = CalamityUtils.MulticolorLerp(Main.GlobalTimeWrappedHourly * 0.2f, primaryEdgeColor, secondaryEdgeColor);
|
||||
|
||||
// Define shader parameters for shield color
|
||||
shieldEffect.Parameters["shieldColor"].SetValue(shieldColor.ToVector3());
|
||||
shieldEffect.Parameters["shieldEdgeColor"].SetValue(edgeColor.ToVector3());
|
||||
|
||||
// GOD I LOVE END BEGIN CAN THIS GAME PLEASE BE SWALLOWED BY THE FIRES OF HELL THANKS
|
||||
// yes I copy pasted that comment, I hate end begin that much
|
||||
// I also copy pasted that comment, this time for consistency :hdfailure:
|
||||
Main.spriteBatch.End();
|
||||
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, shieldEffect, Main.GameViewMatrix.TransformationMatrix);
|
||||
// Fetch shield heat overlay texture (this is the neutrons fed to the shader)
|
||||
HeatTex ??= ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/GreyscaleGradients/Neurons2");
|
||||
Vector2 pos = player.MountedCenter + player.gfxOffY * Vector2.UnitY - Main.screenPosition;
|
||||
Texture2D tex = HeatTex.Value;
|
||||
Main.spriteBatch.Draw(tex, pos, null, Color.White, 0, tex.Size() / 2f, scale, 0, 0);
|
||||
|
||||
//The border circle MUST be drawn after otherwise it becomes visually fucked.
|
||||
float shieldScale = scale * 1.75f;
|
||||
Texture2D shieldTexture = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/GreyscaleOpenCircle").Value;
|
||||
Rectangle shieldFrame = shieldTexture.Frame();
|
||||
Vector2 origin = shieldFrame.Size() * 0.5f;
|
||||
Main.spriteBatch.End();
|
||||
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
|
||||
Main.spriteBatch.Draw(shieldTexture, pos, shieldFrame, shieldColor * 0.5f, player.fullRotation, origin, shieldScale, SpriteEffects.None, 0f);
|
||||
Main.spriteBatch.Draw(shieldTexture, pos, shieldFrame, secondaryEdgeColor * 0.5f, player.fullRotation, origin, shieldScale * 0.95f, SpriteEffects.None, 0f);
|
||||
Main.spriteBatch.Draw(shieldTexture, pos, shieldFrame, shieldColor * 0.5f, player.fullRotation, origin, shieldScale, SpriteEffects.None, 0f);
|
||||
Main.spriteBatch.Draw(shieldTexture, pos, shieldFrame, secondaryEdgeColor * 0.5f, player.fullRotation, origin, shieldScale * 0.95f, SpriteEffects.None, 0f);
|
||||
}
|
||||
|
||||
alreadyDrawnShieldForPlayer = true;
|
||||
modPlayer.drawnAnyShieldThisFrame = true;
|
||||
}
|
||||
|
||||
if (alreadyDrawnShieldForPlayer)
|
||||
{
|
||||
//The border circle MUST be drawn after otherwise it becomes visually fucked.
|
||||
float shieldScale = scale * 1.75f;
|
||||
Texture2D shieldTexture = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/GreyscaleOpenCircle").Value;
|
||||
Rectangle shieldFrame = shieldTexture.Frame();
|
||||
Vector2 origin = shieldFrame.Size() * 0.5f;
|
||||
Main.spriteBatch.End();
|
||||
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.Transform);
|
||||
}
|
||||
|
||||
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
|
||||
Main.spriteBatch.Draw(shieldTexture, pos, shieldFrame, shieldColor * 0.5f, player.fullRotation, origin, shieldScale, SpriteEffects.None, 0f);
|
||||
Main.spriteBatch.Draw(shieldTexture, pos, shieldFrame, secondaryEdgeColor * 0.5f, player.fullRotation, origin, shieldScale * 0.95f, SpriteEffects.None, 0f);
|
||||
Main.spriteBatch.Draw(shieldTexture, pos, shieldFrame, shieldColor * 0.5f, player.fullRotation, origin, shieldScale, SpriteEffects.None, 0f);
|
||||
Main.spriteBatch.Draw(shieldTexture, pos, shieldFrame, secondaryEdgeColor * 0.5f, player.fullRotation, origin, shieldScale * 0.95f, SpriteEffects.None, 0f);
|
||||
Main.spriteBatch.End();
|
||||
});
|
||||
modPlayer.drawnAnyShieldThisFrame = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -33,30 +33,29 @@ namespace CalamityMod.Items.Accessories
|
||||
public const int maxPscAnimTime = 120;
|
||||
|
||||
// Interface stuff.
|
||||
public Player OwnerPlayer { get; set; }
|
||||
public float RenderDepth => IDyeableShaderRenderer.ProfanedSoulShieldDepth;
|
||||
|
||||
public bool ShaderIsDyeable => false;
|
||||
|
||||
public bool ShouldDrawDyeableShader
|
||||
{
|
||||
get
|
||||
{
|
||||
bool result = false;
|
||||
foreach (Player player in Main.ActivePlayers)
|
||||
{
|
||||
if (player.outOfRange || player.dead)
|
||||
continue;
|
||||
if (CalamityClientConfig.Instance.EnergyShieldOpacity <= 0.0f)
|
||||
return false;
|
||||
|
||||
CalamityPlayer modPlayer = player.Calamity();
|
||||
var player = OwnerPlayer;
|
||||
if (player is null)
|
||||
return false;
|
||||
|
||||
// Do not render the shield if its visibility is off (or it does not exist)
|
||||
bool isVanityOnly = modPlayer.pSoulShieldVisible && !modPlayer.pSoulArtifact;
|
||||
bool shouldNotDraw = modPlayer.andromedaState >= AndromedaPlayerState.LargeRobot; //I am not dealing with drawing that :taxevasion:
|
||||
bool shieldExists = isVanityOnly || modPlayer.pSoulShieldDurability > 0;
|
||||
bool shouldntDraw = !modPlayer.pSoulShieldVisible || modPlayer.drawnAnyShieldThisFrame || shouldNotDraw || !shieldExists;
|
||||
result |= !shouldntDraw;
|
||||
}
|
||||
return result;
|
||||
if (player.outOfRange || player.dead)
|
||||
return false;
|
||||
|
||||
CalamityPlayer modPlayer = player.Calamity();
|
||||
if (modPlayer.drawingParameters.ProfanedShieldCharge <= 0.0f)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,7 +67,7 @@ namespace CalamityMod.Items.Accessories
|
||||
Empowered //psc but no other minions, healer guardian functionality, inherits all other functionality (except vanity) and goes even further beyond, any remaining attack changes are here
|
||||
}
|
||||
|
||||
public void DrawDyeableShader(SpriteBatch spriteBatch) => ProfanedSoulArtifact.DrawProfanedSoulShields();
|
||||
public void DrawDyeableShader(SpriteBatch spriteBatch) => ProfanedSoulArtifact.DrawProfanedSoulShields(OwnerPlayer);
|
||||
|
||||
internal static ProfanedSoulCrystalState GetPscStateFor(Player player, bool ignoreNoBuffs = false)
|
||||
{
|
||||
|
||||
@@ -31,27 +31,28 @@ namespace CalamityMod.Items.Accessories
|
||||
public static int ShieldDefenseBoost = 10;
|
||||
|
||||
// Interface stuff.
|
||||
public Player OwnerPlayer { get; set; }
|
||||
public float RenderDepth => IDyeableShaderRenderer.RoverDriveDepth;
|
||||
|
||||
public bool ShouldDrawDyeableShader
|
||||
{
|
||||
get
|
||||
{
|
||||
bool result = false;
|
||||
foreach (Player player in Main.ActivePlayers)
|
||||
{
|
||||
if (player.outOfRange || player.dead)
|
||||
continue;
|
||||
if (CalamityClientConfig.Instance.EnergyShieldOpacity <= 0.0f)
|
||||
return false;
|
||||
|
||||
CalamityPlayer modPlayer = player.Calamity();
|
||||
var player = OwnerPlayer;
|
||||
if (player is null)
|
||||
return false;
|
||||
|
||||
// Do not render the shield if its visibility is off (or it does not exist)
|
||||
bool isVanityOnly = modPlayer.roverDriveShieldVisible && !modPlayer.roverDrive;
|
||||
bool shieldExists = isVanityOnly || modPlayer.RoverDriveShieldDurability > 0;
|
||||
bool shouldntDraw = (!modPlayer.roverDriveShieldVisible || modPlayer.drawnAnyShieldThisFrame || !shieldExists);
|
||||
result |= !shouldntDraw;
|
||||
}
|
||||
return result;
|
||||
if (player.outOfRange || player.dead)
|
||||
return false;
|
||||
|
||||
CalamityPlayer modPlayer = player.Calamity();
|
||||
if (modPlayer.drawingParameters.RoverShieldCharge <= 0.0f)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,88 +106,66 @@ namespace CalamityMod.Items.Accessories
|
||||
// This is applied as IL (On hook) which draws right before Inferno Ring.
|
||||
public void DrawDyeableShader(SpriteBatch spriteBatch)
|
||||
{
|
||||
// TODO -- Control flow analysis indicates that this hook is not stable.
|
||||
// Rover Drive shields will be drawn for each player with Rover Drive, yes.
|
||||
// But there is no guarantee that the shields will be in the right condition for each player.
|
||||
// Visibility is not net synced, for example.
|
||||
bool alreadyDrawnShieldForPlayer = false;
|
||||
var player = OwnerPlayer;
|
||||
if (player is null)
|
||||
return;
|
||||
|
||||
foreach (Player player in Main.ActivePlayers)
|
||||
if (player.outOfRange || player.dead)
|
||||
return;
|
||||
|
||||
CalamityPlayer modPlayer = player.Calamity();
|
||||
if (modPlayer.drawnAnyShieldThisFrame)
|
||||
return;
|
||||
|
||||
if (modPlayer.drawingParameters.RoverShieldCharge <= 0.0f)
|
||||
return;
|
||||
|
||||
// The shield very gently grows and shrinks
|
||||
float scale = 0.15f + 0.03f * (0.5f + 0.5f * (float)Math.Sin(Main.GlobalTimeWrappedHourly * 0.5f + player.whoAmI * 0.2f));
|
||||
// If in vanity, the shield is always projected as if it's at full strength.
|
||||
float shieldStrength = modPlayer.drawingParameters.RoverShieldCharge;
|
||||
|
||||
// Noise scale also grows and shrinks, although out of sync with the shield
|
||||
float noiseScale = MathHelper.Lerp(0.4f, 0.8f, (float)Math.Sin(Main.GlobalTimeWrappedHourly * 0.3f) * 0.5f + 0.5f);
|
||||
|
||||
// Define shader parameters
|
||||
Effect shieldEffect = Filters.Scene["CalamityMod:RoverDriveShield"].GetShader().Shader;
|
||||
shieldEffect.Parameters["time"].SetValue(Main.GlobalTimeWrappedHourly * 0.24f);
|
||||
shieldEffect.Parameters["blowUpPower"].SetValue(2.5f);
|
||||
shieldEffect.Parameters["blowUpSize"].SetValue(0.5f);
|
||||
shieldEffect.Parameters["noiseScale"].SetValue(noiseScale);
|
||||
|
||||
// Shield opacity multiplier slightly changes, this is independent of current shield strength
|
||||
float baseShieldOpacity = 0.9f + 0.1f * (float)Math.Sin(Main.GlobalTimeWrappedHourly * 2f);
|
||||
float finalShieldOpacity = baseShieldOpacity * (0.5f + 0.5f * shieldStrength);
|
||||
finalShieldOpacity *= CalamityClientConfig.Instance.EnergyShieldOpacity;
|
||||
|
||||
shieldEffect.Parameters["shieldOpacity"].SetValue(finalShieldOpacity);
|
||||
shieldEffect.Parameters["shieldEdgeBlendStrenght"].SetValue(4f);
|
||||
|
||||
// Get the shield color.
|
||||
Color blueTint = new Color(51, 102, 255);
|
||||
Color cyanTint = new Color(71, 202, 255);
|
||||
Color wulfGreen = new Color(194, 255, 67) * 0.8f;
|
||||
Color edgeColor = CalamityUtils.MulticolorLerp(Main.GlobalTimeWrappedHourly * 0.2f, blueTint, cyanTint, wulfGreen);
|
||||
Color shieldColor = blueTint;
|
||||
|
||||
|
||||
// Define shader parameters for shield color
|
||||
shieldEffect.Parameters["shieldColor"].SetValue(shieldColor.ToVector3());
|
||||
shieldEffect.Parameters["shieldEdgeColor"].SetValue(edgeColor.ToVector3());
|
||||
|
||||
var matrix = Main.GameViewMatrix.TransformationMatrix;
|
||||
Main.spriteBatch.SafeBegin(SpriteSortMode.Immediate, BatchSetting.Additive, shieldEffect, matrix, () =>
|
||||
{
|
||||
if (player.outOfRange || player.dead)
|
||||
continue;
|
||||
|
||||
CalamityPlayer modPlayer = player.Calamity();
|
||||
|
||||
// Do not render the shield if its visibility is off (or it does not exist)
|
||||
bool isVanityOnly = modPlayer.roverDriveShieldVisible && !modPlayer.roverDrive;
|
||||
bool shieldExists = isVanityOnly || modPlayer.RoverDriveShieldDurability > 0;
|
||||
if (!modPlayer.roverDriveShieldVisible || modPlayer.drawnAnyShieldThisFrame || !shieldExists)
|
||||
continue;
|
||||
|
||||
// The shield very gently grows and shrinks
|
||||
float scale = 0.15f + 0.03f * (0.5f + 0.5f * (float)Math.Sin(Main.GlobalTimeWrappedHourly * 0.5f + player.whoAmI * 0.2f));
|
||||
|
||||
if (!alreadyDrawnShieldForPlayer)
|
||||
{
|
||||
// If in vanity, the shield is always projected as if it's at full strength.
|
||||
float shieldStrength = 1f;
|
||||
if (!isVanityOnly)
|
||||
{
|
||||
// Again, I believe there is no way this looks correct when two players have Rover Drive equipped.
|
||||
CalamityPlayer localModPlayer = Main.LocalPlayer.Calamity();
|
||||
float shieldDurabilityRatio = localModPlayer.RoverDriveShieldDurability / (float)ShieldDurabilityMax;
|
||||
shieldStrength = MathF.Pow(shieldDurabilityRatio, 0.5f);
|
||||
}
|
||||
|
||||
// Noise scale also grows and shrinks, although out of sync with the shield
|
||||
float noiseScale = MathHelper.Lerp(0.4f, 0.8f, (float)Math.Sin(Main.GlobalTimeWrappedHourly * 0.3f) * 0.5f + 0.5f);
|
||||
|
||||
// Define shader parameters
|
||||
Effect shieldEffect = Filters.Scene["CalamityMod:RoverDriveShield"].GetShader().Shader;
|
||||
shieldEffect.Parameters["time"].SetValue(Main.GlobalTimeWrappedHourly * 0.24f);
|
||||
shieldEffect.Parameters["blowUpPower"].SetValue(2.5f);
|
||||
shieldEffect.Parameters["blowUpSize"].SetValue(0.5f);
|
||||
shieldEffect.Parameters["noiseScale"].SetValue(noiseScale);
|
||||
|
||||
// Shield opacity multiplier slightly changes, this is independent of current shield strength
|
||||
float baseShieldOpacity = 0.9f + 0.1f * (float)Math.Sin(Main.GlobalTimeWrappedHourly * 2f);
|
||||
shieldEffect.Parameters["shieldOpacity"].SetValue(baseShieldOpacity * (0.5f + 0.5f * shieldStrength));
|
||||
shieldEffect.Parameters["shieldEdgeBlendStrenght"].SetValue(4f);
|
||||
|
||||
// Get the shield color.
|
||||
Color blueTint = new Color(51, 102, 255);
|
||||
Color cyanTint = new Color(71, 202, 255);
|
||||
Color wulfGreen = new Color(194, 255, 67) * 0.8f;
|
||||
Color edgeColor = CalamityUtils.MulticolorLerp(Main.GlobalTimeWrappedHourly * 0.2f, blueTint, cyanTint, wulfGreen);
|
||||
Color shieldColor = blueTint;
|
||||
|
||||
|
||||
// Define shader parameters for shield color
|
||||
shieldEffect.Parameters["shieldColor"].SetValue(shieldColor.ToVector3());
|
||||
shieldEffect.Parameters["shieldEdgeColor"].SetValue(edgeColor.ToVector3());
|
||||
|
||||
// GOD I LOVE END BEGIN CAN THIS GAME PLEASE BE SWALLOWED BY THE FIRES OF HELL THANKS
|
||||
spriteBatch.End();
|
||||
spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, shieldEffect, Main.GameViewMatrix.TransformationMatrix);
|
||||
|
||||
}
|
||||
|
||||
alreadyDrawnShieldForPlayer = true;
|
||||
modPlayer.drawnAnyShieldThisFrame = true;
|
||||
|
||||
// Fetch shield noise overlay texture (this is the techy overlay fed to the shader)
|
||||
NoiseTex ??= ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/GreyscaleGradients/TechyNoise");
|
||||
Vector2 pos = player.MountedCenter + player.gfxOffY * Vector2.UnitY - Main.screenPosition;
|
||||
Texture2D tex = NoiseTex.Value;
|
||||
spriteBatch.Draw(tex, pos, null, Color.White, 0, tex.Size() / 2f, scale, 0, 0);
|
||||
}
|
||||
});
|
||||
|
||||
if (alreadyDrawnShieldForPlayer)
|
||||
{
|
||||
spriteBatch.End();
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.Transform);
|
||||
}
|
||||
modPlayer.drawnAnyShieldThisFrame = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -40,27 +40,28 @@ namespace CalamityMod.Items.Accessories
|
||||
public static int ShieldActiveDefense = 30;
|
||||
public static float ShieldActiveDamageReduction = 0.1f;
|
||||
|
||||
public Player OwnerPlayer { get; set; }
|
||||
public float RenderDepth => IDyeableShaderRenderer.SpongeShieldDepth;
|
||||
|
||||
public bool ShouldDrawDyeableShader
|
||||
{
|
||||
get
|
||||
{
|
||||
bool result = false;
|
||||
foreach (Player player in Main.ActivePlayers)
|
||||
{
|
||||
if (player.outOfRange || player.dead)
|
||||
continue;
|
||||
if (CalamityClientConfig.Instance.EnergyShieldOpacity <= 0.0f)
|
||||
return false;
|
||||
|
||||
CalamityPlayer modPlayer = player.Calamity();
|
||||
var player = OwnerPlayer;
|
||||
if (player is null)
|
||||
return false;
|
||||
|
||||
// Do not render the shield if its visibility is off (or it does not exist)
|
||||
bool isVanityOnly = modPlayer.spongeShieldVisible && !modPlayer.sponge;
|
||||
bool shieldExists = isVanityOnly || modPlayer.SpongeShieldDurability > 0;
|
||||
bool shouldntDraw = !modPlayer.spongeShieldVisible || modPlayer.drawnAnyShieldThisFrame || !shieldExists;
|
||||
result |= !shouldntDraw;
|
||||
}
|
||||
return result;
|
||||
if (player.outOfRange || player.dead)
|
||||
return false;
|
||||
|
||||
CalamityPlayer modPlayer = player.Calamity();
|
||||
if (modPlayer.drawingParameters.SpongeShieldCharge <= 0.0f)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -171,97 +172,73 @@ namespace CalamityMod.Items.Accessories
|
||||
// This is applied as IL (On hook) which draws right before Inferno Ring.
|
||||
public void DrawDyeableShader(SpriteBatch spriteBatch)
|
||||
{
|
||||
// TODO -- Control flow analysis indicates that this hook is not stable (as it was copied from Rover Drive).
|
||||
// Sponge shields will be drawn for each player with the Sponge equipped, yes.
|
||||
// But there is no guarantee that the shields will be in the right condition for each player.
|
||||
// Visibility is not net synced, for example.
|
||||
bool alreadyDrawnShieldForPlayer = false;
|
||||
var player = OwnerPlayer;
|
||||
if (player is null)
|
||||
return;
|
||||
|
||||
foreach (Player player in Main.ActivePlayers)
|
||||
if (player.outOfRange || player.dead)
|
||||
return;
|
||||
|
||||
CalamityPlayer modPlayer = player.Calamity();
|
||||
if (modPlayer.drawnAnyShieldThisFrame)
|
||||
return;
|
||||
|
||||
if (modPlayer.drawingParameters.SpongeShieldCharge <= 0.0f)
|
||||
return;
|
||||
|
||||
// Scale the shield is drawn at. The Sponge shield gently grows and shrinks; it should be largely imperceptible.
|
||||
// The "i" parameter is to make different player's shields not be perfectly synced.
|
||||
int i = player.whoAmI;
|
||||
float baseScale = 0.155f;
|
||||
float maxExtraScale = 0.025f;
|
||||
float extraScalePulseInterpolant = MathF.Pow(4f, MathF.Sin(Main.GlobalTimeWrappedHourly * 0.791f + i) - 1);
|
||||
float scale = baseScale + maxExtraScale * extraScalePulseInterpolant;
|
||||
float visualShieldStrength = modPlayer.drawingParameters.SpongeShieldCharge;
|
||||
|
||||
// The scale used for the noise overlay also grows and shrinks
|
||||
// This is intentionally out of sync with the shield, and intentionally desynced per player
|
||||
// Don't put this anywhere less than 0.15f or higher than 0.75f. The higher it is, the denser / more zoomed out the noise overlay is.
|
||||
// Changing this too quickly and/or too much makes the noise grow and shrink visibly, so be careful with that.
|
||||
float noiseScale = MathHelper.Lerp(0.28f, 0.38f, 0.5f + 0.5f * MathF.Sin(Main.GlobalTimeWrappedHourly * 0.347f + i));
|
||||
|
||||
// Define shader parameters
|
||||
Effect shieldEffect = Filters.Scene["CalamityMod:RoverDriveShield"].GetShader().Shader;
|
||||
shieldEffect.Parameters["time"].SetValue(Main.GlobalTimeWrappedHourly * 0.0813f); // Scrolling speed of polygonal overlay
|
||||
shieldEffect.Parameters["blowUpPower"].SetValue(3f);
|
||||
shieldEffect.Parameters["blowUpSize"].SetValue(0.56f);
|
||||
shieldEffect.Parameters["noiseScale"].SetValue(noiseScale);
|
||||
|
||||
// Shield opacity multiplier slightly changes, this is independent of current shield strength
|
||||
float baseShieldOpacity = 0.9f + 0.1f * MathF.Sin(Main.GlobalTimeWrappedHourly * 1.95f);
|
||||
float minShieldStrengthOpacityMultiplier = 0.25f;
|
||||
float finalShieldOpacity = baseShieldOpacity * MathHelper.Lerp(minShieldStrengthOpacityMultiplier, 1f, visualShieldStrength);
|
||||
finalShieldOpacity *= CalamityClientConfig.Instance.EnergyShieldOpacity;
|
||||
|
||||
shieldEffect.Parameters["shieldOpacity"].SetValue(finalShieldOpacity);
|
||||
shieldEffect.Parameters["shieldEdgeBlendStrenght"].SetValue(4f);
|
||||
|
||||
Color shieldColor = new Color(24, 156, 204); // #189CCC
|
||||
Color primaryEdgeColor = shieldColor;
|
||||
Color secondaryEdgeColor = new Color(34, 224, 227); // #22E0E3
|
||||
|
||||
// Final shield edge color, which lerps about
|
||||
Color edgeColor = CalamityUtils.MulticolorLerp(Main.GlobalTimeWrappedHourly * 0.2f, primaryEdgeColor, secondaryEdgeColor);
|
||||
|
||||
// Define shader parameters for shield color
|
||||
shieldEffect.Parameters["shieldColor"].SetValue(shieldColor.ToVector3());
|
||||
shieldEffect.Parameters["shieldEdgeColor"].SetValue(edgeColor.ToVector3());
|
||||
|
||||
var matrix = Main.GameViewMatrix.TransformationMatrix;
|
||||
Main.spriteBatch.SafeBegin(SpriteSortMode.Immediate, BatchSetting.Additive, shieldEffect, matrix, () =>
|
||||
{
|
||||
if (player.outOfRange || player.dead)
|
||||
continue;
|
||||
|
||||
CalamityPlayer modPlayer = player.Calamity();
|
||||
|
||||
// Do not render the shield if its visibility is off (or it does not exist)
|
||||
bool isVanityOnly = modPlayer.spongeShieldVisible && !modPlayer.sponge;
|
||||
bool shieldExists = isVanityOnly || modPlayer.SpongeShieldDurability > 0;
|
||||
if (!modPlayer.spongeShieldVisible || modPlayer.drawnAnyShieldThisFrame || !shieldExists)
|
||||
continue;
|
||||
|
||||
// Scale the shield is drawn at. The Sponge shield gently grows and shrinks; it should be largely imperceptible.
|
||||
// The "i" parameter is to make different player's shields not be perfectly synced.
|
||||
int i = player.whoAmI;
|
||||
float baseScale = 0.155f;
|
||||
float maxExtraScale = 0.025f;
|
||||
float extraScalePulseInterpolant = MathF.Pow(4f, MathF.Sin(Main.GlobalTimeWrappedHourly * 0.791f + i) - 1);
|
||||
float scale = baseScale + maxExtraScale * extraScalePulseInterpolant;
|
||||
|
||||
if (!alreadyDrawnShieldForPlayer)
|
||||
{
|
||||
// If in vanity, the shield is always projected as if it's at full strength.
|
||||
float visualShieldStrength = 1f;
|
||||
if (!isVanityOnly)
|
||||
{
|
||||
// Again, I believe there is no way this looks correct when two players have The Sponge equipped.
|
||||
CalamityPlayer localModPlayer = Main.LocalPlayer.Calamity();
|
||||
float shieldDurabilityRatio = localModPlayer.SpongeShieldDurability / (float)ShieldDurabilityMax;
|
||||
visualShieldStrength = MathF.Pow(shieldDurabilityRatio, 0.5f);
|
||||
}
|
||||
|
||||
// The scale used for the noise overlay also grows and shrinks
|
||||
// This is intentionally out of sync with the shield, and intentionally desynced per player
|
||||
// Don't put this anywhere less than 0.15f or higher than 0.75f. The higher it is, the denser / more zoomed out the noise overlay is.
|
||||
// Changing this too quickly and/or too much makes the noise grow and shrink visibly, so be careful with that.
|
||||
float noiseScale = MathHelper.Lerp(0.28f, 0.38f, 0.5f + 0.5f * MathF.Sin(Main.GlobalTimeWrappedHourly * 0.347f + i));
|
||||
|
||||
// Define shader parameters
|
||||
Effect shieldEffect = Filters.Scene["CalamityMod:RoverDriveShield"].GetShader().Shader;
|
||||
shieldEffect.Parameters["time"].SetValue(Main.GlobalTimeWrappedHourly * 0.0813f); // Scrolling speed of polygonal overlay
|
||||
shieldEffect.Parameters["blowUpPower"].SetValue(3f);
|
||||
shieldEffect.Parameters["blowUpSize"].SetValue(0.56f);
|
||||
shieldEffect.Parameters["noiseScale"].SetValue(noiseScale);
|
||||
|
||||
// Shield opacity multiplier slightly changes, this is independent of current shield strength
|
||||
float baseShieldOpacity = 0.9f + 0.1f * MathF.Sin(Main.GlobalTimeWrappedHourly * 1.95f);
|
||||
float minShieldStrengthOpacityMultiplier = 0.25f;
|
||||
float finalShieldOpacity = baseShieldOpacity * MathHelper.Lerp(minShieldStrengthOpacityMultiplier, 1f, visualShieldStrength);
|
||||
shieldEffect.Parameters["shieldOpacity"].SetValue(finalShieldOpacity);
|
||||
shieldEffect.Parameters["shieldEdgeBlendStrenght"].SetValue(4f);
|
||||
|
||||
Color shieldColor = new Color(24, 156, 204); // #189CCC
|
||||
Color primaryEdgeColor = shieldColor;
|
||||
Color secondaryEdgeColor = new Color(34, 224, 227); // #22E0E3
|
||||
|
||||
// Final shield edge color, which lerps about
|
||||
Color edgeColor = CalamityUtils.MulticolorLerp(Main.GlobalTimeWrappedHourly * 0.2f, primaryEdgeColor, secondaryEdgeColor);
|
||||
|
||||
// Define shader parameters for shield color
|
||||
shieldEffect.Parameters["shieldColor"].SetValue(shieldColor.ToVector3());
|
||||
shieldEffect.Parameters["shieldEdgeColor"].SetValue(edgeColor.ToVector3());
|
||||
|
||||
// GOD I LOVE END BEGIN CAN THIS GAME PLEASE BE SWALLOWED BY THE FIRES OF HELL THANKS
|
||||
// yes I copy pasted that comment, I hate end begin that much
|
||||
Main.spriteBatch.End();
|
||||
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, shieldEffect, Main.GameViewMatrix.TransformationMatrix);
|
||||
}
|
||||
|
||||
alreadyDrawnShieldForPlayer = true;
|
||||
modPlayer.drawnAnyShieldThisFrame = true;
|
||||
|
||||
// Fetch shield noise overlay texture (this is the polygons fed to the shader)
|
||||
NoiseTex ??= ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/GreyscaleGradients/Neurons");
|
||||
Vector2 pos = player.MountedCenter + player.gfxOffY * Vector2.UnitY - Main.screenPosition;
|
||||
Texture2D tex = NoiseTex.Value;
|
||||
Main.spriteBatch.Draw(tex, pos, null, Color.White, 0, tex.Size() / 2f, scale, 0, 0);
|
||||
}
|
||||
});
|
||||
|
||||
if (alreadyDrawnShieldForPlayer)
|
||||
{
|
||||
Main.spriteBatch.End();
|
||||
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.Transform);
|
||||
}
|
||||
modPlayer.drawnAnyShieldThisFrame = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -33,27 +33,29 @@ namespace CalamityMod.Items.Armor.LunicCorps
|
||||
public static int TotalShieldRechargeTime = CalamityUtils.SecondsToFrames(2);
|
||||
|
||||
// Interface stuff.
|
||||
public Player OwnerPlayer { get; set; }
|
||||
public float RenderDepth => IDyeableShaderRenderer.HaloShieldDepth;
|
||||
|
||||
public bool ShaderIsDyeable => false;
|
||||
|
||||
public bool ShouldDrawDyeableShader
|
||||
{
|
||||
get
|
||||
{
|
||||
bool result = false;
|
||||
foreach (Player player in Main.ActivePlayers)
|
||||
{
|
||||
if (player.outOfRange || player.dead)
|
||||
continue;
|
||||
if (CalamityClientConfig.Instance.EnergyShieldOpacity <= 0.0f)
|
||||
return false;
|
||||
|
||||
CalamityPlayer modPlayer = player.Calamity();
|
||||
var player = OwnerPlayer;
|
||||
if (player is null)
|
||||
return false;
|
||||
|
||||
// Do not render shield if it does not exist
|
||||
bool shouldntDraw = modPlayer.LunicCorpsShieldDurability <= 0 || modPlayer.drawnAnyShieldThisFrame;
|
||||
result |= !shouldntDraw;
|
||||
}
|
||||
return result;
|
||||
if (player.outOfRange || player.dead)
|
||||
return false;
|
||||
|
||||
CalamityPlayer modPlayer = player.Calamity();
|
||||
if (modPlayer.drawingParameters.LunicShieldCharge <= 0.0f)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,88 +111,71 @@ namespace CalamityMod.Items.Armor.LunicCorps
|
||||
// This is applied as IL (On hook) which draws right before Inferno Ring.
|
||||
public void DrawDyeableShader(SpriteBatch spriteBatch)
|
||||
{
|
||||
// TODO -- Control flow analysis indicates that this hook is not stable (as it was copied from Rover Drive).
|
||||
// Lunic Corps shields will be drawn for each player with the Lunic Corps armor, yes.
|
||||
// But there is no guarantee that the shields will be in the right condition for each player.
|
||||
// Visibility is not net synced, for example.
|
||||
bool alreadyDrawnShieldForPlayer = false;
|
||||
var player = OwnerPlayer;
|
||||
if (player is null)
|
||||
return;
|
||||
|
||||
foreach (Player player in Main.ActivePlayers)
|
||||
if (player.outOfRange || player.dead)
|
||||
return;
|
||||
|
||||
CalamityPlayer modPlayer = player.Calamity();
|
||||
if (modPlayer.drawnAnyShieldThisFrame)
|
||||
return;
|
||||
|
||||
if (modPlayer.drawingParameters.LunicShieldCharge <= 0.0f)
|
||||
return;
|
||||
|
||||
// Scale the shield is drawn at. The Lunic Corps shield sticks very close to the body to mimic Halo and occasionally pulses.
|
||||
// The "i" parameter is to make different player's shields not be perfectly synced.
|
||||
int i = player.whoAmI;
|
||||
float baseScale = 0.11f;
|
||||
float maxExtraScale = 0.013f;
|
||||
float extraScalePulseInterpolant = MathF.Pow(12f, MathF.Sin(Main.GlobalTimeWrappedHourly * 1.6f + i) - 1);
|
||||
float scale = baseScale + maxExtraScale * extraScalePulseInterpolant;
|
||||
float visualShieldStrength = modPlayer.drawingParameters.LunicShieldCharge;
|
||||
|
||||
// The scale used for the noise overlay polygons also grows and shrinks
|
||||
// This is intentionally out of sync with the shield, and intentionally desynced per player
|
||||
// Don't put this anywhere less than 0.25f or higher than 1f. The higher it is, the denser / more zoomed out the noise overlay is.
|
||||
float noiseScale = MathHelper.Lerp(0.65f, 0.75f, 0.5f + 0.5f * MathF.Sin(Main.GlobalTimeWrappedHourly * 0.87f + i));
|
||||
|
||||
// Define shader parameters
|
||||
Effect shieldEffect = Filters.Scene["CalamityMod:RoverDriveShield"].GetShader().Shader;
|
||||
shieldEffect.Parameters["time"].SetValue(Main.GlobalTimeWrappedHourly * 0.058f); // Scrolling speed of polygonal overlay
|
||||
shieldEffect.Parameters["blowUpPower"].SetValue(2.8f);
|
||||
shieldEffect.Parameters["blowUpSize"].SetValue(0.4f);
|
||||
shieldEffect.Parameters["noiseScale"].SetValue(noiseScale);
|
||||
|
||||
// Shield opacity multiplier slightly changes, this is independent of current shield strength
|
||||
float baseShieldOpacity = 0.9f + 0.1f * MathF.Sin(Main.GlobalTimeWrappedHourly * 1.95f);
|
||||
float minShieldStrengthOpacityMultiplier = 0.5f;
|
||||
float finalShieldOpacity = baseShieldOpacity * MathHelper.Lerp(minShieldStrengthOpacityMultiplier, 1f, visualShieldStrength);
|
||||
finalShieldOpacity *= CalamityClientConfig.Instance.EnergyShieldOpacity;
|
||||
|
||||
shieldEffect.Parameters["shieldOpacity"].SetValue(finalShieldOpacity);
|
||||
shieldEffect.Parameters["shieldEdgeBlendStrenght"].SetValue(4f);
|
||||
|
||||
// Lunic Corps shields are not team specific
|
||||
Color shieldColor = new Color(201, 180, 129);
|
||||
Color primaryEdgeColor = new Color(232, 212, 175);
|
||||
Color secondaryEdgeColor = new Color(237, 205, 145);
|
||||
Color edgeColor = CalamityUtils.MulticolorLerp(Main.GlobalTimeWrappedHourly * 0.2f, primaryEdgeColor, secondaryEdgeColor);
|
||||
|
||||
// Define shader parameters for shield color
|
||||
shieldEffect.Parameters["shieldColor"].SetValue(shieldColor.ToVector3());
|
||||
shieldEffect.Parameters["shieldEdgeColor"].SetValue(edgeColor.ToVector3());
|
||||
|
||||
var matrix = Main.GameViewMatrix.TransformationMatrix;
|
||||
Main.spriteBatch.SafeBegin(SpriteSortMode.Immediate, BatchSetting.Additive, shieldEffect, matrix, () =>
|
||||
{
|
||||
if (player.outOfRange || player.dead)
|
||||
continue;
|
||||
|
||||
CalamityPlayer modPlayer = player.Calamity();
|
||||
|
||||
// Do not render shield if it does not exist
|
||||
if (modPlayer.LunicCorpsShieldDurability <= 0 || modPlayer.drawnAnyShieldThisFrame)
|
||||
continue;
|
||||
|
||||
// Scale the shield is drawn at. The Lunic Corps shield sticks very close to the body to mimic Halo and occasionally pulses.
|
||||
// The "i" parameter is to make different player's shields not be perfectly synced.
|
||||
int i = player.whoAmI;
|
||||
float baseScale = 0.11f;
|
||||
float maxExtraScale = 0.013f;
|
||||
float extraScalePulseInterpolant = MathF.Pow(12f, MathF.Sin(Main.GlobalTimeWrappedHourly * 1.6f + i) - 1);
|
||||
float scale = baseScale + maxExtraScale * extraScalePulseInterpolant;
|
||||
|
||||
if (!alreadyDrawnShieldForPlayer)
|
||||
{
|
||||
// Again, I believe there is no way this looks correct when two players have Lunic Corps armor equipped.
|
||||
CalamityPlayer localModPlayer = Main.LocalPlayer.Calamity();
|
||||
float shieldDurabilityRatio = localModPlayer.LunicCorpsShieldDurability / (float)ShieldDurabilityMax;
|
||||
float visualShieldStrength = MathF.Pow(shieldDurabilityRatio, 0.5f);
|
||||
|
||||
// The scale used for the noise overlay polygons also grows and shrinks
|
||||
// This is intentionally out of sync with the shield, and intentionally desynced per player
|
||||
// Don't put this anywhere less than 0.25f or higher than 1f. The higher it is, the denser / more zoomed out the noise overlay is.
|
||||
float noiseScale = MathHelper.Lerp(0.65f, 0.75f, 0.5f + 0.5f * MathF.Sin(Main.GlobalTimeWrappedHourly * 0.87f + i));
|
||||
|
||||
// Define shader parameters
|
||||
Effect shieldEffect = Filters.Scene["CalamityMod:RoverDriveShield"].GetShader().Shader;
|
||||
shieldEffect.Parameters["time"].SetValue(Main.GlobalTimeWrappedHourly * 0.058f); // Scrolling speed of polygonal overlay
|
||||
shieldEffect.Parameters["blowUpPower"].SetValue(2.8f);
|
||||
shieldEffect.Parameters["blowUpSize"].SetValue(0.4f);
|
||||
shieldEffect.Parameters["noiseScale"].SetValue(noiseScale);
|
||||
|
||||
// Shield opacity multiplier slightly changes, this is independent of current shield strength
|
||||
float baseShieldOpacity = 0.9f + 0.1f * MathF.Sin(Main.GlobalTimeWrappedHourly * 1.95f);
|
||||
float minShieldStrengthOpacityMultiplier = 0.5f;
|
||||
float finalShieldOpacity = baseShieldOpacity * MathHelper.Lerp(minShieldStrengthOpacityMultiplier, 1f, visualShieldStrength);
|
||||
shieldEffect.Parameters["shieldOpacity"].SetValue(finalShieldOpacity);
|
||||
shieldEffect.Parameters["shieldEdgeBlendStrenght"].SetValue(4f);
|
||||
|
||||
// Lunic Corps shields are not team specific
|
||||
Color shieldColor = new Color(201, 180, 129);
|
||||
Color primaryEdgeColor = new Color(232, 212, 175);
|
||||
Color secondaryEdgeColor = new Color(237, 205, 145);
|
||||
Color edgeColor = CalamityUtils.MulticolorLerp(Main.GlobalTimeWrappedHourly * 0.2f, primaryEdgeColor, secondaryEdgeColor);
|
||||
|
||||
// Define shader parameters for shield color
|
||||
shieldEffect.Parameters["shieldColor"].SetValue(shieldColor.ToVector3());
|
||||
shieldEffect.Parameters["shieldEdgeColor"].SetValue(edgeColor.ToVector3());
|
||||
|
||||
// GOD I LOVE END BEGIN CAN THIS GAME PLEASE BE SWALLOWED BY THE FIRES OF HELL THANKS
|
||||
// yes I copy pasted that comment, I hate end begin that much
|
||||
spriteBatch.End();
|
||||
spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, shieldEffect, Main.GameViewMatrix.TransformationMatrix);
|
||||
}
|
||||
|
||||
alreadyDrawnShieldForPlayer = true;
|
||||
modPlayer.drawnAnyShieldThisFrame = true;
|
||||
|
||||
// Fetch shield noise overlay texture (this is the polygons fed to the shader)
|
||||
NoiseTex ??= ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/GreyscaleGradients/VoronoiShapes2");
|
||||
Vector2 pos = player.MountedCenter + player.gfxOffY * Vector2.UnitY - Main.screenPosition;
|
||||
Texture2D tex = NoiseTex.Value;
|
||||
spriteBatch.Draw(tex, pos, null, Color.White, 0, tex.Size() / 2f, scale, 0, 0);
|
||||
}
|
||||
});
|
||||
|
||||
if (alreadyDrawnShieldForPlayer)
|
||||
{
|
||||
spriteBatch.End();
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.Transform);
|
||||
}
|
||||
modPlayer.drawnAnyShieldThisFrame = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,7 @@ using CalamityMod.Items.Weapons.Melee;
|
||||
using CalamityMod.Items.Weapons.Summon;
|
||||
using CalamityMod.NPCs.Other;
|
||||
using CalamityMod.NPCs.TownNPCs;
|
||||
using CalamityMod.Packets;
|
||||
using CalamityMod.Particles;
|
||||
using CalamityMod.Projectiles.Magic;
|
||||
using CalamityMod.Projectiles.Melee;
|
||||
@@ -1111,7 +1112,6 @@ namespace CalamityMod.Items
|
||||
break;
|
||||
case ItemID.SquirePlating:
|
||||
player.GetDamage<SummonDamageClass>() -= 0.05f;
|
||||
player.GetDamage<MeleeDamageClass>() -= 0.05f;
|
||||
break;
|
||||
case ItemID.SquireGreaves:
|
||||
player.GetDamage<SummonDamageClass>() -= 0.1f;
|
||||
@@ -1830,11 +1830,7 @@ namespace CalamityMod.Items
|
||||
|
||||
if (Main.netMode == NetmodeID.MultiplayerClient)
|
||||
{
|
||||
ModPacket packet = CalamityMod.Instance.GetPacket();
|
||||
packet.Write((byte)CalamityModMessageType.SomeoneGotScammedByTinkerer);
|
||||
packet.Write((byte)p.whoAmI);
|
||||
packet.Write7BitEncodedInt(stolen);
|
||||
packet.Send();
|
||||
BanditStolenMoneySyncPacket.Send(stolen);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -274,6 +274,7 @@ namespace CalamityMod.Items
|
||||
case ItemID.WoodenCrate:
|
||||
case ItemID.WoodenCrateHard:
|
||||
loot.Add(ModContent.ItemType<WulfrumMetalScrap>(), 4, 3, 5); // 25% 3-5 Wulfrum Scrap
|
||||
loot.Add(ModContent.ItemType<Kylie>(), 20);
|
||||
break;
|
||||
|
||||
case ItemID.IronCrate:
|
||||
|
||||
@@ -1147,7 +1147,7 @@ namespace CalamityMod.Items
|
||||
if (item.type == ItemID.SquireGreatHelm)
|
||||
EditTooltipByNum(0, (line) => line.Text = "Increases your max number of sentries by 1 and grants +2 HP/s life regen");
|
||||
if (item.type == ItemID.SquirePlating)
|
||||
EditTooltipByNum(0, (line) => line.Text = "10% increased minion and melee damage");
|
||||
EditTooltipByNum(0, (line) => line.Text = "10% increased minion damage and 15% increased melee damage");
|
||||
if (item.type == ItemID.SquireGreaves)
|
||||
EditTooltipByNum(0, (line) => line.Text = "5% increased minion damage and melee critical strike chance\n" +
|
||||
"15% increased movement speed");
|
||||
|
||||
@@ -78,7 +78,7 @@ namespace CalamityMod.Items
|
||||
{ ItemID.Code2, Do(AutoReuse, DamageExact(43)) },
|
||||
{ ItemID.CorruptYoyo, Do(AutoReuse, DamageExact(20)) }, // Malaise
|
||||
{ ItemID.CrimsonYoyo, Do(AutoReuse, DamageExact(20)) }, // Artery
|
||||
{ ItemID.CrystalBullet, Do(DamageExact(8)) },
|
||||
{ ItemID.CrystalBullet, Do(DamageExact(6)) },
|
||||
{ ItemID.CrystalDart, Do(DamageExact(20)) },
|
||||
{ ItemID.CrystalSerpent, Do(DamageExact(45)) },
|
||||
{ ItemID.CrystalStorm, Do(DamageExact(40)) },
|
||||
@@ -263,7 +263,7 @@ namespace CalamityMod.Items
|
||||
{ ItemID.Trimarang, Do(DamageExact(24)) },
|
||||
{ ItemID.TrueExcalibur, Do(TrueMelee, DamageExact(107)) },
|
||||
{ ItemID.TrueNightsEdge, Do(DamageExact(105)) },
|
||||
{ ItemID.Tsunami, Do(PointBlank, DamageExact(49)) },
|
||||
{ ItemID.Tsunami, Do(PointBlank, DamageExact(45)) },
|
||||
{ ItemID.TungstenBullet, Do(DamageExact(8)) },
|
||||
{ ItemID.TungstenShortsword, Do(AutoReuse, TrueMelee, DamageExact(15)) },
|
||||
{ ItemID.UnholyArrow, Do(DamageExact(11)) },
|
||||
@@ -323,7 +323,7 @@ namespace CalamityMod.Items
|
||||
{ ItemID.BloodLustCluster, Do(AxePower(100), UseTimeExact(13), TileBoostExact(+0)) },
|
||||
{ ItemID.BonePickaxe, Do(PickPower(55), UseTimeExact(6)) },
|
||||
{ ItemID.BorealWoodHammer, Do(HammerPower(25), UseTimeExact(11), TileBoostExact(+0)) },
|
||||
{ ItemID.ButchersChainsaw, Do(TrueMeleeNoSpeed, AxePower(150), UseTimeExact(3), TileBoostExact(+0), DamageExact(177)) },
|
||||
{ ItemID.ButchersChainsaw, Do(TrueMeleeNoSpeed, AxePower(150), UseTimeExact(3), TileBoostExact(+0), DamageExact(126)) },
|
||||
{ ItemID.CactusPickaxe, Do(PickPower(34), UseTimeExact(9)) },
|
||||
{ ItemID.CnadyCanePickaxe, Do(PickPower(55), UseTimeExact(9), TileBoostExact(+1)) }, // Candy Cane Pickaxe
|
||||
{ ItemID.ChlorophyteChainsaw, Do(TrueMeleeNoSpeed, AxePower(120), UseTimeExact(3), TileBoostExact(+0), DamageExact(112)) },
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using CalamityMod.NPCs.SunkenSea;
|
||||
using CalamityMod.Packets;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
@@ -71,15 +72,7 @@ namespace CalamityMod.Items.Critters
|
||||
}
|
||||
else
|
||||
{
|
||||
var netMessage = CalamityMod.Instance.GetPacket();
|
||||
netMessage.Write((byte)CalamityModMessageType.PlaceAltCritter);
|
||||
netMessage.Write(player.whoAmI);
|
||||
netMessage.Write(mouseX);
|
||||
netMessage.Write(mouseY);
|
||||
netMessage.Write(item.makeNPC);
|
||||
netMessage.Write(item.type);
|
||||
netMessage.Write(colorType);
|
||||
netMessage.Send();
|
||||
PlaceAltCritterPacket.Send(player, mouseX, mouseY, item, colorType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using CalamityMod.NPCs.SunkenSea;
|
||||
using CalamityMod.Packets;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
@@ -74,15 +75,7 @@ namespace CalamityMod.Items.Critters
|
||||
}
|
||||
else
|
||||
{
|
||||
var netMessage = item.ModItem.Mod.GetPacket();
|
||||
netMessage.Write((byte)CalamityModMessageType.PlaceAltCritter);
|
||||
netMessage.Write(player.whoAmI);
|
||||
netMessage.Write(mouseX);
|
||||
netMessage.Write(mouseY);
|
||||
netMessage.Write(item.makeNPC);
|
||||
netMessage.Write(item.type);
|
||||
netMessage.Write(colorType);
|
||||
netMessage.Send();
|
||||
PlaceAltCritterPacket.Send(player, mouseX, mouseY, item, colorType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ using CalamityMod.Items.Placeables.FurnitureBotanic;
|
||||
using CalamityMod.Items.Placeables.FurnitureCosmilite;
|
||||
using CalamityMod.Items.Placeables.FurnitureEutrophic;
|
||||
using CalamityMod.Items.Placeables.FurnitureExo;
|
||||
using CalamityMod.Items.Placeables.FurnitureMarnite;
|
||||
using CalamityMod.Items.Placeables.FurnitureMonolith;
|
||||
using CalamityMod.Items.Placeables.FurnitureOtherworldly;
|
||||
using CalamityMod.Items.Placeables.FurniturePlagued;
|
||||
@@ -55,6 +56,7 @@ namespace CalamityMod.Items.Placeables.Furniture
|
||||
AddIngredient<CosmiliteChair>().
|
||||
AddIngredient<EutrophicChair>().
|
||||
AddIngredient<ExoChair>().
|
||||
AddIngredient<MarniteChair>().
|
||||
AddIngredient<MonolithChair>().
|
||||
AddIngredient<SacrilegiousChair>().
|
||||
AddIngredient<OtherworldlyChair>().
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using CalamityMod.NPCs.NormalNPCs;
|
||||
using CalamityMod.Packets;
|
||||
using Terraria;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.ID;
|
||||
@@ -59,9 +60,7 @@ namespace CalamityMod.Items
|
||||
// dummies are gone, and cause them to reappear, making the deletion moot.
|
||||
else
|
||||
{
|
||||
var netMessage = Mod.GetPacket();
|
||||
netMessage.Write((byte)CalamityModMessageType.DeleteAllSuperDummies);
|
||||
netMessage.Send();
|
||||
DeleteAllSuperDummiesPacket.Send();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -77,11 +76,7 @@ namespace CalamityMod.Items
|
||||
// Otherwise, send a message to the server indicating that a Super Dummy should be spawned at this position.
|
||||
else
|
||||
{
|
||||
var netMessage = Mod.GetPacket();
|
||||
netMessage.Write((byte)CalamityModMessageType.SpawnSuperDummy);
|
||||
netMessage.Write(x);
|
||||
netMessage.Write(y);
|
||||
netMessage.Send();
|
||||
SpawnSuperDummyPacket.Send(x, y);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@@ -98,9 +93,7 @@ namespace CalamityMod.Items
|
||||
}
|
||||
else
|
||||
{
|
||||
var netMessage = Mod.GetPacket();
|
||||
netMessage.Write((byte)CalamityModMessageType.DeleteAllSuperDummies);
|
||||
netMessage.Send();
|
||||
DeleteAllSuperDummiesPacket.Send();
|
||||
}
|
||||
|
||||
Item.RestoreConsumedItemByRightClick();
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace CalamityMod.Items.TreasureBags
|
||||
ModContent.ItemType<AnahitasArpeggio>(),
|
||||
ModContent.ItemType<Atlantis>(),
|
||||
ModContent.ItemType<GastricBelcherStaff>(),
|
||||
ModContent.ItemType<BrackishFlask>(),
|
||||
ModContent.ItemType<Whitewater>(),
|
||||
ModContent.ItemType<LeviathanTeeth>(),
|
||||
}));
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
using CalamityMod.Projectiles.Magic;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using CalamityMod.Particles;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
@@ -30,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Magic
|
||||
Item.knockBack = 5f;
|
||||
Item.value = CalamityGlobalItem.RarityLimeBuyPrice;
|
||||
Item.rare = ItemRarityID.Lime;
|
||||
Item.UseSound = SoundID.Item34;
|
||||
Item.UseSound = new SoundStyle("CalamityMod/Sounds/Item/VividClarityBeamAppear") with { Volume = 0.5f, Pitch = 0.2f };
|
||||
Item.autoReuse = true;
|
||||
Item.shoot = ModContent.ProjectileType<AtlantisSpear>();
|
||||
Item.shootSpeed = 40f;
|
||||
@@ -46,6 +48,32 @@ namespace CalamityMod.Items.Weapons.Magic
|
||||
}
|
||||
}
|
||||
public override float UseSpeedMultiplier(Player player) => (DownedBossSystem.downedDoG && Main.zenithWorld) ? 2.5f : 1f;
|
||||
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
|
||||
{
|
||||
int points = 6;
|
||||
float radians = MathHelper.TwoPi / points;
|
||||
Vector2 spinningPoint = Vector2.Normalize(velocity);
|
||||
for (int k = 0; k < points; k++)
|
||||
{
|
||||
Vector2 velocity2 = spinningPoint.RotatedBy(radians * k);
|
||||
Particle spark = new GlowSparkParticle((position + velocity2 * 7.5f) + velocity * 2.5f, velocity2 * 0.5f, false, 11, 0.01f, Color.LightBlue * 0.9f, new Vector2(3.5f, 1), true, false);
|
||||
GeneralParticleHandler.SpawnParticle(spark);
|
||||
for (int b = 0; b < 3; b++)
|
||||
{
|
||||
Dust dust = Dust.NewDustPerfect(position + velocity * 2.5f, 278, (velocity2 * 10).RotatedByRandom(0.5) * Main.rand.NextFloat(0.5f, 0.9f));
|
||||
dust.scale = Main.rand.NextFloat(0.3f, 0.5f);
|
||||
dust.color = Main.rand.NextBool() ? Color.Cyan : Color.LightBlue;
|
||||
dust.noGravity = true;
|
||||
}
|
||||
}
|
||||
Particle blastRing = new CustomPulse(position + velocity * 2.5f, Vector2.Zero, Color.CornflowerBlue, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 1.25f, 0f, 11, true);
|
||||
GeneralParticleHandler.SpawnParticle(blastRing);
|
||||
Particle blastRing2 = new CustomPulse(position + velocity * 2.5f, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0.6f, 0.1f, 14, true);
|
||||
GeneralParticleHandler.SpawnParticle(blastRing2);
|
||||
|
||||
Projectile.NewProjectile(source, position + velocity * 2, velocity, type, damage, knockback, player.whoAmI, 0f, 0f, 5f);
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void ModifyTooltips(List<TooltipLine> list)
|
||||
{
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace CalamityMod.Items.Weapons.Magic
|
||||
CreateRecipe().
|
||||
AddIngredient(ItemID.ShadowbeamStaff).
|
||||
AddIngredient<RuinousSoul>(2).
|
||||
AddIngredient<ArmoredShell>(3).
|
||||
AddIngredient<ArmoredShell>().
|
||||
AddTile(TileID.LunarCraftingStation).
|
||||
Register();
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
{
|
||||
Item.width = 64;
|
||||
Item.height = 64;
|
||||
Item.damage = 100;
|
||||
Item.damage = 75;
|
||||
Item.DamageType = DamageClass.Melee;
|
||||
Item.useAnimation = 35;
|
||||
Item.useTime = 35;
|
||||
@@ -29,39 +29,16 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
|
||||
public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone)
|
||||
{
|
||||
var source = player.GetSource_ItemUse(Item);
|
||||
int totalProjectiles = 4;
|
||||
float radians = MathHelper.TwoPi / totalProjectiles;
|
||||
int type = ModContent.ProjectileType<IceBombFriendly>();
|
||||
int bombDamage = player.CalcIntDamage<MeleeDamageClass>(Item.damage);
|
||||
float velocity = 4f;
|
||||
double angleA = radians * 0.5;
|
||||
double angleB = MathHelper.ToRadians(90f) - angleA;
|
||||
float velocityX = (float)(velocity * Math.Sin(angleA) / Math.Sin(angleB));
|
||||
Vector2 spinningPoint = Main.rand.NextBool() ? new Vector2(0f, -velocity) : new Vector2(-velocityX, -velocity);
|
||||
for (int k = 0; k < totalProjectiles; k++)
|
||||
if (CalamityUtils.CountProjectiles(type) < 16)
|
||||
{
|
||||
Vector2 projRotation = spinningPoint.RotatedBy(radians * k);
|
||||
Projectile.NewProjectile(source, target.Center, projRotation, type, bombDamage, hit.Knockback * 0.5f, Main.myPlayer);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo)
|
||||
{
|
||||
var source = player.GetSource_ItemUse(Item);
|
||||
int totalProjectiles = 4;
|
||||
float radians = MathHelper.TwoPi / totalProjectiles;
|
||||
int type = ModContent.ProjectileType<IceBombFriendly>();
|
||||
int bombDamage = player.CalcIntDamage<MeleeDamageClass>(Item.damage);
|
||||
float velocity = 4f;
|
||||
double angleA = radians * 0.5;
|
||||
double angleB = MathHelper.ToRadians(90f) - angleA;
|
||||
float velocityX = (float)(velocity * Math.Sin(angleA) / Math.Sin(angleB));
|
||||
Vector2 spinningPoint = Main.rand.NextBool() ? new Vector2(0f, -velocity) : new Vector2(-velocityX, -velocity);
|
||||
for (int k = 0; k < totalProjectiles; k++)
|
||||
{
|
||||
Vector2 projRotation = spinningPoint.RotatedBy(radians * k);
|
||||
Projectile.NewProjectile(source, target.Center, projRotation, type, bombDamage, 0f, Main.myPlayer);
|
||||
var source = player.GetSource_ItemUse(Item);
|
||||
int bombDamage = player.CalcIntDamage<MeleeDamageClass>(Item.damage);
|
||||
for (int k = 0; k < 4; k++)
|
||||
{
|
||||
// ai0: projectile timer. ai1: target index. ai2: rotation offset based on ice bomb number.
|
||||
Projectile.NewProjectile(source, target.Center, Vector2.Zero, type, bombDamage, hit.Knockback * 0.5f, Main.myPlayer, 0f, target.whoAmI, k);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
{
|
||||
Item.width = 18;
|
||||
Item.height = 20;
|
||||
Item.damage = 230;
|
||||
Item.damage = 130;
|
||||
Item.DamageType = DamageClass.MeleeNoSpeed;
|
||||
Item.noMelee = true;
|
||||
Item.noUseGraphic = true;
|
||||
@@ -97,9 +97,8 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
CreateRecipe().
|
||||
AddIngredient(ItemID.VampireKnives).
|
||||
AddIngredient<MonstrousKnives>().
|
||||
AddIngredient<CosmiliteBar>(8).
|
||||
AddIngredient<DarksunFragment>(8).
|
||||
AddTile<CosmicAnvil>().
|
||||
AddIngredient<TwistingNether>(3).
|
||||
AddTile(TileID.LunarCraftingStation).
|
||||
Register();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
public class FallenPaladinsHammer : ModItem, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Items.Weapons.Melee";
|
||||
public static float Speed = 28.8f;
|
||||
public static float Speed = 27f;
|
||||
public override void SetDefaults()
|
||||
|
||||
{
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.width = Item.height = 60;
|
||||
Item.damage = 35;
|
||||
Item.damage = 41;
|
||||
Item.DamageType = DamageClass.MeleeNoSpeed;
|
||||
Item.noUseGraphic = true;
|
||||
Item.noMelee = true;
|
||||
|
||||
@@ -14,18 +14,17 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
public class GalaxySmasher : ModItem, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Items.Weapons.Melee";
|
||||
public static int BaseDamage = 1300;
|
||||
public static float Speed = 30f;
|
||||
public static float Speed = 35f;
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.width = 86;
|
||||
Item.height = 72;
|
||||
Item.DamageType = DamageClass.MeleeNoSpeed;
|
||||
Item.damage = BaseDamage;
|
||||
Item.damage = 1300;
|
||||
Item.knockBack = 14f;
|
||||
Item.useAnimation = 40;
|
||||
Item.useTime = 40;
|
||||
Item.useAnimation = 48;
|
||||
Item.useTime = 48;
|
||||
Item.autoReuse = true;
|
||||
Item.noMelee = true;
|
||||
Item.noUseGraphic = true;
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
using System;
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.Projectiles.Melee;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
@@ -27,25 +30,47 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
Item.height = 62;
|
||||
Item.damage = 87; // IS THAT THE BITE OF '87
|
||||
Item.DamageType = DamageClass.Melee;
|
||||
Item.useTime = 31;
|
||||
Item.useAnimation = 31;
|
||||
Item.useTime = 27;
|
||||
Item.useAnimation = 27;
|
||||
Item.useTurn = true;
|
||||
Item.useStyle = ItemUseStyleID.Swing;
|
||||
Item.knockBack = 7f;
|
||||
Item.value = CalamityGlobalItem.RarityLimeBuyPrice;
|
||||
Item.rare = ItemRarityID.Lime;
|
||||
Item.UseSound = SoundID.Item1;
|
||||
Item.shoot = ModContent.ProjectileType<GreenWater>();
|
||||
Item.autoReuse = true;
|
||||
Item.shootSpeed = ShootSpeed;
|
||||
Item.shootSpeed = 10;
|
||||
}
|
||||
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
|
||||
{
|
||||
for (int i = 0; i < 2; ++i)
|
||||
{
|
||||
Projectile tooth = Projectile.NewProjectileDirect(source, position, velocity.RotatedBy(-0.1f * (i + 1)).RotatedByRandom(0.06f) * (1 - i * 0.3f), type, (int)(damage * 0.7f), knockback / 3, player.whoAmI, 1f, 0f);
|
||||
tooth.penetrate = 2;
|
||||
}
|
||||
for (int i = 0; i < 2; ++i)
|
||||
{
|
||||
Projectile tooth = Projectile.NewProjectileDirect(source, position, velocity.RotatedBy(0.1f * (i + 1)).RotatedByRandom(0.06f) * (1 - i * 0.3f), type, (int)(damage * 0.7), knockback / 3, player.whoAmI, 1f, 0f);
|
||||
tooth.penetrate = 2;
|
||||
}
|
||||
Projectile strongTooth = Projectile.NewProjectileDirect(source, position, velocity * 1.2f, type, (int)(damage), knockback, player.whoAmI, 2f, 0f);
|
||||
strongTooth.penetrate = -1;
|
||||
strongTooth.timeLeft = 150;
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone)
|
||||
{
|
||||
NPC target2 = player.Calamity().mouseWorld.ClosestNPCAt(300);
|
||||
if (target2 == null)
|
||||
target2 = target;
|
||||
|
||||
Vector2 destination = target.Center;
|
||||
|
||||
Vector2 position = destination - (Vector2.UnitY * (destination.Y - Main.screenPosition.Y + 80f));
|
||||
Vector2 position = new Vector2(target2.Center.X, target2.Center.Y - 350);
|
||||
Vector2 cachedPosition = position;
|
||||
Vector2 secondPosition = cachedPosition + (Vector2.UnitY * (Main.screenHeight + 160f));
|
||||
Vector2 secondPosition = new Vector2(target2.Center.X, target2.Center.Y + 350);
|
||||
Vector2 secondCachedPosition = secondPosition;
|
||||
|
||||
Vector2 velocity = (destination - position).SafeNormalize(Vector2.UnitY) * ShootSpeed;
|
||||
@@ -53,7 +78,7 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
Vector2 secondVelocity = (destination - secondPosition).SafeNormalize(Vector2.UnitY) * ShootSpeed;
|
||||
Vector2 secondCachedVelocity = secondVelocity;
|
||||
|
||||
int teethDamage = player.CalcIntDamage<MeleeDamageClass>((int)(Item.damage * 0.5));
|
||||
int teethDamage = player.CalcIntDamage<MeleeDamageClass>((int)(Item.damage * 0.2));
|
||||
float teethKnockback = Item.knockBack * 0.2f;
|
||||
bool evenNumberOfProjectiles = TotalTeeth % 2 == 0;
|
||||
float amountToAdd = evenNumberOfProjectiles ? 0.5f : 0f;
|
||||
@@ -71,19 +96,19 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
velocityAdjustment = ((j == centralProjectile || j == otherCentralProjectile) && evenNumberOfProjectiles) ? minVelocityAdjustment : MathHelper.Lerp(minVelocityAdjustment, maxVelocityAdjustment, Math.Abs((j + amountToAdd) - centralProjectile) / (float)centralProjectile);
|
||||
if (topTeeth)
|
||||
{
|
||||
position.X += MathHelper.Lerp(-HalvedTeethSpread, HalvedTeethSpread, j / (float)(TotalTeeth - 1));
|
||||
velocity = CalamityUtils.CalculatePredictiveAimToTargetMaxUpdates(position, target, ShootSpeed, 1) * velocityAdjustment;
|
||||
position.X += MathHelper.Lerp(-HalvedTeethSpread * 0.3f, HalvedTeethSpread * 0.3f, j / (float)(TotalTeeth - 1));
|
||||
velocity = CalamityUtils.CalculatePredictiveAimToTargetMaxUpdates(position, target2, ShootSpeed, 1) * velocityAdjustment;
|
||||
velocity.X *= teethXVelocityReduction;
|
||||
Projectile.NewProjectile(player.GetSource_ItemUse(Item), position, velocity, ModContent.ProjectileType<GreenWater>(), teethDamage, teethKnockback, player.whoAmI, 0f, i, target.Center.Y);
|
||||
Projectile.NewProjectile(player.GetSource_ItemUse(Item), position, velocity * 0.25f, ModContent.ProjectileType<GreenWater>(), teethDamage, teethKnockback, player.whoAmI, 0f, i, target2.Center.Y);
|
||||
position = cachedPosition;
|
||||
velocity = cachedVelocity;
|
||||
}
|
||||
else
|
||||
{
|
||||
secondPosition.X += MathHelper.Lerp(-HalvedTeethSpread, HalvedTeethSpread, j / (float)(TotalTeeth - 1));
|
||||
secondVelocity = CalamityUtils.CalculatePredictiveAimToTargetMaxUpdates(secondPosition, target, ShootSpeed, 1) * velocityAdjustment;
|
||||
secondPosition.X += MathHelper.Lerp(-HalvedTeethSpread * 0.3f, HalvedTeethSpread * 0.3f, j / (float)(TotalTeeth - 1));
|
||||
secondVelocity = CalamityUtils.CalculatePredictiveAimToTargetMaxUpdates(secondPosition, target2, ShootSpeed, 1) * velocityAdjustment;
|
||||
secondVelocity.X *= teethXVelocityReduction;
|
||||
Projectile.NewProjectile(player.GetSource_ItemUse(Item), secondPosition, secondVelocity, ModContent.ProjectileType<GreenWater>(), teethDamage, teethKnockback, player.whoAmI, 0f, i, target.Center.Y);
|
||||
Projectile.NewProjectile(player.GetSource_ItemUse(Item), secondPosition, secondVelocity * 0.25f, ModContent.ProjectileType<GreenWater>(), teethDamage, teethKnockback, player.whoAmI, 0f, i, target2.Center.Y);
|
||||
secondPosition = secondCachedPosition;
|
||||
secondVelocity = secondCachedVelocity;
|
||||
}
|
||||
@@ -145,8 +170,9 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
|
||||
public override void MeleeEffects(Player player, Rectangle hitbox)
|
||||
{
|
||||
if (Main.rand.NextBool(4))
|
||||
Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, Main.rand.NextBool() ? 33 : 89);
|
||||
Vector2 dustVel = Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(0.9f, 1.5f);
|
||||
if (Main.rand.NextBool(3))
|
||||
Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 102, dustVel.X, dustVel.Y);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
Item.value = CalamityGlobalItem.RarityLightPurpleBuyPrice;
|
||||
Item.rare = ItemRarityID.LightPurple;
|
||||
Item.shoot = ModContent.ProjectileType<PwnagehammerProj>();
|
||||
Item.shootSpeed = 29.4f;
|
||||
Item.shootSpeed = 22f;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
public class StellarContempt : ModItem, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Items.Weapons.Melee";
|
||||
public static float Speed = 25f;
|
||||
public static float Speed = 30f;
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Ranged
|
||||
public static readonly SoundStyle ShootAndReloadSound = new("CalamityMod/Sounds/Item/WulfrumBlunderbussFireAndReload") { PitchVariance = 0.25f };
|
||||
// Very cool sound and it would be a shame for it to not be used elsewhere, would be even better if a new sound is made in the future, but for now this is good enough
|
||||
|
||||
public float SniperDmgMult = 8f;
|
||||
public float SniperDmgMult = 9f;
|
||||
public float SniperCritMult = Main.zenithWorld ? 7f : 1.35f;
|
||||
public float SniperVelocityMult = 2f;
|
||||
public new string LocalizationCategory => "Items.Weapons.Ranged";
|
||||
@@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Ranged
|
||||
{
|
||||
Item.width = 70;
|
||||
Item.height = 18;
|
||||
Item.damage = 45;
|
||||
Item.damage = 46;
|
||||
Item.DamageType = DamageClass.Ranged;
|
||||
Item.width = 70;
|
||||
Item.height = 18;
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Ranged
|
||||
Item.width = 56;
|
||||
Item.height = 30;
|
||||
Item.scale = 0.85f;
|
||||
Item.damage = 65;
|
||||
Item.damage = 95;
|
||||
Item.DamageType = DamageClass.Ranged;
|
||||
Item.useTime = 13;
|
||||
Item.useAnimation = 13;
|
||||
|
||||
@@ -74,13 +74,12 @@ namespace CalamityMod.Items.Weapons.Ranged
|
||||
mouseDistance = arrowSpeed / mouseDistance;
|
||||
mouseXDist *= mouseDistance;
|
||||
mouseYDist *= mouseDistance;
|
||||
float speedX4 = mouseXDist;
|
||||
float speedY5 = mouseYDist;
|
||||
int shotArrow = Projectile.NewProjectile(source, realPlayerPos.X, realPlayerPos.Y, speedX4, speedY5, type, damage, knockback, player.whoAmI);
|
||||
Main.projectile[shotArrow].noDropItem = true;
|
||||
Main.projectile[shotArrow].tileCollide = false;
|
||||
CalamityGlobalProjectile cgp = Main.projectile[shotArrow].Calamity();
|
||||
cgp.allProjectilesHome = true;
|
||||
Vector2 arrowVel = new Vector2(mouseXDist, mouseYDist);
|
||||
|
||||
Projectile shotArrow = Projectile.NewProjectileDirect(source, realPlayerPos, arrowVel, type, damage, knockback, player.whoAmI);
|
||||
shotArrow.noDropItem = true;
|
||||
shotArrow.tileCollide = false;
|
||||
shotArrow.Calamity().conditionalHomingRange = 300f;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Ranged
|
||||
{
|
||||
Item.width = 76;
|
||||
Item.height = 42;
|
||||
Item.damage = 50;
|
||||
Item.damage = 56;
|
||||
Item.useTime = 30;
|
||||
Item.useAnimation = 30;
|
||||
Item.useStyle = ItemUseStyleID.Shoot;
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace CalamityMod.Items.Weapons.Ranged
|
||||
{
|
||||
Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/Ranged/DeathwindGlow").Value);
|
||||
}
|
||||
|
||||
|
||||
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
|
||||
{
|
||||
for (int index = 0; index < 4; ++index)
|
||||
@@ -46,11 +46,11 @@ namespace CalamityMod.Items.Weapons.Ranged
|
||||
float SpeedY = velocity.Y + Main.rand.Next(-20, 21) * 0.05f;
|
||||
if (CalamityUtils.CheckWoodenAmmo(type, player))
|
||||
{
|
||||
Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType<DWArrow>(), (int)(damage * 1.75), knockback, player.whoAmI);
|
||||
Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType<DWArrow>(), (int)(damage * 2), knockback, player.whoAmI);
|
||||
}
|
||||
else
|
||||
{
|
||||
int baseArrow = Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, (int)(damage * 0.75), knockback, player.whoAmI);
|
||||
int baseArrow = Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI);
|
||||
Main.projectile[baseArrow].noDropItem = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Ranged
|
||||
{
|
||||
Item.width = 62;
|
||||
Item.height = 34;
|
||||
Item.damage = 475;
|
||||
Item.damage = 320;
|
||||
Item.DamageType = DamageClass.Ranged;
|
||||
Item.useAnimation = Item.useTime = 30;
|
||||
Item.useStyle = ItemUseStyleID.Shoot;
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Ranged
|
||||
{
|
||||
Item.width = 32;
|
||||
Item.height = 62;
|
||||
Item.damage = 25;
|
||||
Item.damage = 27;
|
||||
Item.DamageType = DamageClass.Ranged;
|
||||
Item.useTime = 22;
|
||||
Item.useAnimation = 22;
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Ranged
|
||||
{
|
||||
Item.width = 72;
|
||||
Item.height = 32;
|
||||
Item.damage = 37;
|
||||
Item.damage = 41;
|
||||
Item.DamageType = DamageClass.Ranged;
|
||||
Item.useTime = 6;
|
||||
Item.useAnimation = 6;
|
||||
@@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Ranged
|
||||
Item.rare = ItemRarityID.Lime;
|
||||
Item.UseSound = SoundID.Item11;
|
||||
Item.autoReuse = true;
|
||||
Item.shoot = ModContent.ProjectileType<ArcherfishShot>();
|
||||
Item.shoot = ModContent.ProjectileType<MegalodonShot>();
|
||||
Item.shootSpeed = 16f;
|
||||
Item.useAmmo = AmmoID.Bullet;
|
||||
Item.Calamity().canFirePointBlankShots = true;
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Ranged
|
||||
{
|
||||
Item.width = 140;
|
||||
Item.height = 42;
|
||||
Item.damage = 7077;
|
||||
Item.damage = 8000;
|
||||
Item.knockBack = 15f;
|
||||
Item.shootSpeed = 30f;
|
||||
Item.useStyle = ItemUseStyleID.Shoot;
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Ranged
|
||||
{
|
||||
Item.width = 60;
|
||||
Item.height = 28;
|
||||
Item.damage = 5;
|
||||
Item.damage = 10;
|
||||
Item.DamageType = DamageClass.Ranged;
|
||||
Item.useAnimation = Item.useTime = 2;
|
||||
Item.useStyle = ItemUseStyleID.Shoot;
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Ranged
|
||||
{
|
||||
Item.width = 38;
|
||||
Item.height = 34;
|
||||
Item.damage = 41;
|
||||
Item.damage = 46;
|
||||
Item.DamageType = DamageClass.Ranged;
|
||||
|
||||
Item.useTime = SetUseTime;
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace CalamityMod.Items.Weapons.Ranged
|
||||
{
|
||||
Item.width = 84;
|
||||
Item.height = 46;
|
||||
Item.damage = 76;
|
||||
Item.damage = 88;
|
||||
Item.DamageType = DamageClass.Ranged;
|
||||
Item.useTime = 30;
|
||||
Item.useAnimation = 30;
|
||||
|
||||
|
Before Width: | Height: | Size: 664 B |
@@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Rogue
|
||||
{
|
||||
Item.width = 34;
|
||||
Item.height = 50;
|
||||
Item.damage = 63;
|
||||
Item.damage = 15;
|
||||
Item.knockBack = 12;
|
||||
Item.DamageType = RogueDamageClass.Instance;
|
||||
Item.value = CalamityGlobalItem.RarityOrangeBuyPrice;
|
||||
@@ -33,22 +33,17 @@ namespace CalamityMod.Items.Weapons.Rogue
|
||||
// Terraria seems to really dislike high crit values in SetDefaults
|
||||
public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 16;
|
||||
|
||||
public override float StealthDamageMultiplier => 0.3333f;
|
||||
|
||||
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
|
||||
{
|
||||
CalamityPlayer p = Main.player[Main.myPlayer].Calamity();
|
||||
//If stealth is full, shoot a spread of 3 boomerangs with reduced range
|
||||
if (p.StealthStrikeAvailable())
|
||||
{
|
||||
int spread = 10;
|
||||
for (int i = 0; i < 3; i++)
|
||||
int proj = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI);
|
||||
if (proj.WithinBounds(Main.maxProjectiles))
|
||||
{
|
||||
Vector2 perturbedspeed = velocity.RotatedBy(MathHelper.ToRadians(spread));
|
||||
int proj = Projectile.NewProjectile(source, position, perturbedspeed, type, damage, knockback, player.whoAmI, 0f, 1f);
|
||||
if (proj.WithinBounds(Main.maxProjectiles))
|
||||
Main.projectile[proj].Calamity().stealthStrike = true;
|
||||
spread -= 10;
|
||||
Main.projectile[proj].Calamity().stealthStrike = true;
|
||||
Main.projectile[proj].penetrate = 7;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -13,10 +13,10 @@ namespace CalamityMod.Items.Weapons.Rogue
|
||||
{
|
||||
Item.width = 36;
|
||||
Item.height = 38;
|
||||
Item.damage = 64;
|
||||
Item.damage = 44;
|
||||
Item.noMelee = true;
|
||||
Item.noUseGraphic = true;
|
||||
Item.useAnimation = Item.useTime = 15;
|
||||
Item.useAnimation = Item.useTime = 9;
|
||||
Item.useStyle = ItemUseStyleID.Swing;
|
||||
Item.knockBack = 1f;
|
||||
Item.UseSound = SoundID.Item1;
|
||||
@@ -25,43 +25,30 @@ namespace CalamityMod.Items.Weapons.Rogue
|
||||
Item.value = CalamityGlobalItem.RarityLimeBuyPrice;
|
||||
Item.rare = ItemRarityID.Lime;
|
||||
Item.shoot = ModContent.ProjectileType<LeviathanTooth>();
|
||||
Item.shootSpeed = 12f;
|
||||
Item.shootSpeed = 5.5f;
|
||||
Item.DamageType = RogueDamageClass.Instance;
|
||||
}
|
||||
|
||||
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
|
||||
{
|
||||
bool stealthStrike = false;
|
||||
int teethCount;
|
||||
|
||||
if (player.Calamity().StealthStrikeAvailable())
|
||||
{
|
||||
teethCount = 6;
|
||||
stealthStrike = true;
|
||||
}
|
||||
else
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
teethCount = Main.rand.Next(2, 3 + 1);
|
||||
}
|
||||
|
||||
for (int i = 0; i < teethCount; i++)
|
||||
{
|
||||
float offsetSpeedX = velocity.X + Main.rand.NextFloat(-2f, 2f);
|
||||
float offsetSpeedY = velocity.Y + Main.rand.NextFloat(-2f, 2f);
|
||||
|
||||
if (stealthStrike)
|
||||
{
|
||||
int tooth = Projectile.NewProjectile(source, position.X, position.Y, offsetSpeedX * 1.5f, offsetSpeedY * 1.5f, type, damage, knockback * 10f, player.whoAmI);
|
||||
if (tooth.WithinBounds(Main.maxProjectiles))
|
||||
{
|
||||
Main.projectile[tooth].Calamity().stealthStrike = true;
|
||||
Main.projectile[tooth].Calamity().lineColor = Main.rand.Next(3);
|
||||
}
|
||||
Projectile tooth = Projectile.NewProjectileDirect(source, position, velocity * 1.5f, type, damage, knockback * 12, player.whoAmI);
|
||||
tooth.Calamity().stealthStrike = true;
|
||||
tooth.timeLeft = 140;
|
||||
tooth.ai[1] = 4;
|
||||
return false; // This makes it not fire 2 with the for loop, thanks Angel lol
|
||||
}
|
||||
else
|
||||
{
|
||||
int tooth = Projectile.NewProjectile(source, position.X, position.Y, offsetSpeedX, offsetSpeedY, type, damage, knockback, player.whoAmI);
|
||||
if (tooth.WithinBounds(Main.maxProjectiles))
|
||||
Main.projectile[tooth].Calamity().lineColor = Main.rand.Next(3);
|
||||
Projectile tooth = Projectile.NewProjectileDirect(source, position, velocity.RotatedByRandom(0.05f + i * 0.15f) * Main.rand.NextFloat(0.7f, 1f), type, damage, knockback, player.whoAmI);
|
||||
tooth.ai[1] = Main.rand.Next(1, 3 + 1);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using CalamityMod.Projectiles.Rogue;
|
||||
using CalamityMod.CalPlayer;
|
||||
using CalamityMod.Projectiles.Rogue;
|
||||
using CalamityMod.Rarities;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
@@ -13,9 +14,9 @@ namespace CalamityMod.Items.Weapons.Rogue
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.width = Item.height = 120;
|
||||
Item.damage = 616;
|
||||
Item.damage = 332;
|
||||
Item.knockBack = 8.5f;
|
||||
Item.useAnimation = Item.useTime = 18;
|
||||
Item.useAnimation = Item.useTime = 55;
|
||||
Item.DamageType = RogueDamageClass.Instance;
|
||||
Item.autoReuse = true;
|
||||
Item.shootSpeed = 18f;
|
||||
@@ -29,14 +30,26 @@ namespace CalamityMod.Items.Weapons.Rogue
|
||||
Item.rare = ModContent.RarityType<Violet>();
|
||||
}
|
||||
|
||||
public override float StealthDamageMultiplier => 0.75f;
|
||||
public override float StealthDamageMultiplier => 0.25f;
|
||||
|
||||
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
|
||||
{
|
||||
int shuriken = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI);
|
||||
if (player.Calamity().StealthStrikeAvailable() && Main.projectile.IndexInRange(shuriken))
|
||||
Main.projectile[shuriken].Calamity().stealthStrike = true;
|
||||
return false;
|
||||
CalamityPlayer p = Main.player[Main.myPlayer].Calamity();
|
||||
//If stealth is full, shoot a spread of 3 shurikens
|
||||
if (p.StealthStrikeAvailable())
|
||||
{
|
||||
int spread = 30;
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
Vector2 perturbedspeed = velocity.RotatedBy(MathHelper.ToRadians(spread));
|
||||
int proj = Projectile.NewProjectile(source, position, perturbedspeed, type, damage, knockback, player.whoAmI, 0f, 1f);
|
||||
if (proj.WithinBounds(Main.maxProjectiles))
|
||||
Main.projectile[proj].Calamity().stealthStrike = true;
|
||||
spread -= 30;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,25 +7,27 @@ using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Items.Weapons.Rogue
|
||||
{
|
||||
public class BrackishFlask : RogueWeapon
|
||||
[LegacyName("BrackishFlask")]
|
||||
public class Whitewater : RogueWeapon
|
||||
{
|
||||
public bool splitDirection = false;
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.width = 28;
|
||||
Item.height = 30;
|
||||
Item.damage = 60;
|
||||
Item.width = 36;
|
||||
Item.height = 40;
|
||||
Item.damage = 97;
|
||||
Item.noMelee = true;
|
||||
Item.noUseGraphic = true;
|
||||
Item.useAnimation = 35;
|
||||
Item.useAnimation = 42;
|
||||
Item.useStyle = ItemUseStyleID.Swing;
|
||||
Item.useTime = 35;
|
||||
Item.useTime = 42;
|
||||
Item.knockBack = 6.5f;
|
||||
Item.UseSound = SoundID.Item106;
|
||||
Item.UseSound = SoundID.Item106 with { Volume = 0.7f };
|
||||
Item.autoReuse = true;
|
||||
Item.value = CalamityGlobalItem.RarityLimeBuyPrice;
|
||||
Item.rare = ItemRarityID.Lime;
|
||||
Item.shoot = ModContent.ProjectileType<BrackishFlaskProj>();
|
||||
Item.shootSpeed = 12f;
|
||||
Item.shoot = ModContent.ProjectileType<WhitewaterProj>();
|
||||
Item.shootSpeed = 6f;
|
||||
Item.DamageType = RogueDamageClass.Instance;
|
||||
}
|
||||
|
||||
@@ -37,10 +39,17 @@ namespace CalamityMod.Items.Weapons.Rogue
|
||||
{
|
||||
int stealth = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI);
|
||||
if (stealth.WithinBounds(Main.maxProjectiles))
|
||||
{
|
||||
Main.projectile[stealth].Calamity().stealthStrike = true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
else
|
||||
{
|
||||
int proj = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI);
|
||||
Main.projectile[proj].ai[1] = splitDirection ? 1 : -1;
|
||||
splitDirection = !splitDirection;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 869 B |
@@ -0,0 +1,53 @@
|
||||
using CalamityMod.Projectiles.Summon;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Items.Weapons.Summon
|
||||
{
|
||||
public class FlarebatStaff : ModItem, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Items.Weapons.Summon";
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.damage = 18;
|
||||
Item.DamageType = DamageClass.Summon;
|
||||
Item.shoot = ModContent.ProjectileType<FlarebatMinion>();
|
||||
Item.knockBack = 1f;
|
||||
|
||||
Item.useTime = Item.useAnimation = 15;
|
||||
(Item.width, Item.height) = (50, 50);
|
||||
Item.mana = 10;
|
||||
Item.noMelee = true;
|
||||
Item.autoReuse = true;
|
||||
Item.useStyle = ItemUseStyleID.Swing;
|
||||
Item.UseSound = SoundID.Item20;
|
||||
Item.value = CalamityGlobalItem.RarityGreenBuyPrice;
|
||||
Item.rare = ItemRarityID.Green;
|
||||
}
|
||||
|
||||
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
|
||||
{
|
||||
Projectile flarebatMinion = Projectile.NewProjectileDirect(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI);
|
||||
|
||||
int minionIndex = 0;
|
||||
foreach (var proj in Main.ActiveProjectiles)
|
||||
{
|
||||
if ((proj.type != flarebatMinion.type && proj.type != ModContent.ProjectileType<FrostbatMinion>()) || proj.owner != flarebatMinion.owner)
|
||||
continue;
|
||||
|
||||
if (proj.type == flarebatMinion.type)
|
||||
proj.ModProjectile<FlarebatMinion>().MinionIndex = minionIndex;
|
||||
else
|
||||
proj.ModProjectile<FrostbatMinion>().MinionIndex = minionIndex;
|
||||
|
||||
minionIndex++;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
@@ -0,0 +1,53 @@
|
||||
using CalamityMod.Projectiles.Summon;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Items.Weapons.Summon
|
||||
{
|
||||
public class FrostbatStaff : ModItem, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Items.Weapons.Summon";
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.damage = 22;
|
||||
Item.DamageType = DamageClass.Summon;
|
||||
Item.shoot = ModContent.ProjectileType<FrostbatMinion>();
|
||||
Item.knockBack = 1f;
|
||||
|
||||
Item.useTime = Item.useAnimation = 15;
|
||||
(Item.width, Item.height) = (50, 50);
|
||||
Item.mana = 10;
|
||||
Item.noMelee = true;
|
||||
Item.autoReuse = true;
|
||||
Item.useStyle = ItemUseStyleID.Swing;
|
||||
Item.UseSound = SoundID.Item28;
|
||||
Item.value = CalamityGlobalItem.RarityGreenBuyPrice;
|
||||
Item.rare = ItemRarityID.Green;
|
||||
}
|
||||
|
||||
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
|
||||
{
|
||||
Projectile frostbatMinion = Projectile.NewProjectileDirect(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI);
|
||||
|
||||
int minionIndex = 0;
|
||||
foreach (var proj in Main.ActiveProjectiles)
|
||||
{
|
||||
if ((proj.type != frostbatMinion.type && proj.type != ModContent.ProjectileType<FlarebatMinion>()) || proj.owner != frostbatMinion.owner)
|
||||
continue;
|
||||
|
||||
if (proj.type == frostbatMinion.type)
|
||||
proj.ModProjectile<FrostbatMinion>().MinionIndex = minionIndex;
|
||||
else
|
||||
proj.ModProjectile<FlarebatMinion>().MinionIndex = minionIndex;
|
||||
|
||||
minionIndex++;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 1.0 KiB |
@@ -70,7 +70,6 @@ ArmoredDigger: Despite being relatively primitive compared to Draedon's current
|
||||
AuroraSpirit: Thought to be no more than an old wives' tale, sightings of aurora spirits have become commonplace since the defeat of the wall of flesh. Upon closer inspection, it appears these "spirits" are rather wisp-like entities clad in a cryonic shell, a sure sign that these were created by Archmage Permafrost.
|
||||
BloomSlime: Imbued with profaned energy, this slime wishes to see the world reduced to ashes to ensure the suffering it brings is no more. However, the simplicity of their form makes it difficult for the slain goddess to fully impose her will onto them.
|
||||
Bohldohr: Bohldohrs were made to serve the lihzahrds, being crafted from ancient stone and brought to life with magical power in the twilight of the great Lihzahrd Dynasty. But the sun sets on every civilization, and once their deity abandoned them, they were left to fend for themselves.
|
||||
Cnidrion: Once trained to be the steeds of honored Ilmerian warriors, cnidrions survived the Incineration due to their sheer might. They continue to defend what was once the heart of the sea kingdom from intruders, maintaining a fierce loyalty to their masters even after they have passed on.
|
||||
GemCrawler: Relatives to the Ilmeran Sea's prismbacks. The aquatic lizards ended up in the wild after being taken in as pets, though without the proper nutrients to grow prisms on their back, many grew the next best thing– precious gems.
|
||||
BlightSlime: Slimes that have absorbed some of the blighted godly essence. Riddled with impurity, they are now more putrid flesh than gelatin and, having taken in such an amount that they seem ready to burst. Yet unlike most slimes which have relatively basic minds, these seem to be collecting mass with a purpose.
|
||||
Cryon: Archmage Permafrost went through great pains to not take part in combat himself, instead molding cryons to act as his personal guardians. Noticing the spread of godly essence just as many other creatures have, they have come out of stasis to combat any signs of it so that they may defend their master.
|
||||
@@ -92,7 +91,6 @@ Rotdog: Fast and furious, these hounds prowl the night, hunting prey with their
|
||||
ScornEater: For one to be weak of will does not inherently mean they are weak of body. Within these powerful individuals does a powerful fire burn, and She is all too willing to fan the flames. All one need give in return for Her gracious blessing is their free will, and they shall be gifted Her enlightenment.
|
||||
SeaUrchin: Massive urchins that roll and hop their way across the sea floor, catching both fish hiding in the sand thanks to their spikes that allow them to comb the sea floor and those far above with their incredible leaps. Their surprising size is due to this species' carnivorous diet, rather than consuming plants like most types of urchins.
|
||||
ShockstormShuttle: Mining devices and scouts for a civilization from a long lost world. They now seek whatever resources are left on other nearby planets, and perhaps even this world as a potential replacement for their ruined home.
|
||||
Stormlion: Some survivors of Ilmeris' downfall claim that enough magical lightning surged through the sea during its final days that there existed not a single drop of water without levin coursing through it. Even now, electricity from the battle remains buried in the sands, with several antlions having learned to both channel and harness the former kingdom's power.
|
||||
Sunskater: To the civilization that lived far above clouds, sunskaters were seen as a good omen. These creatures inspired hope in those who saw them, that their society might live on for as long as the sun's light bathes the world.
|
||||
ThiccWaifu: Part of a solitary elemental that rarely appears aside from when her domain is at its strongest. Many attempts were made by what remained of Yharim's forces to hunt down the elementals after Azafure fell. Only now that the war has passed do the weaker elementals dare return.
|
||||
WildBumblefuck: Though but an adolescent dragonfolly, it poses a great threat to all around it regardless of its age. Their species survived the draconic purges by reproducing rapidly and becoming highly reclusive, alongside developing a hyper-aggressive nature.
|
||||
@@ -117,16 +115,26 @@ Sulflounder: A relative to certain hadopelagic creatures living in the depths, t
|
||||
Toxicatfish: Though these fish once threatened none other than their prey, the radiation from nuclear waste generated from Draedon's old experiments has rotted both their bodies and minds. Attacking anything that comes near, this once flourishing species is now on the verge of extinction.
|
||||
Trasher: Despite being equipped with a mouth large enough to swallow a child whole, these crocodiles simply act as scavengers, devouring scraps and bones left over from predators' meals. Needing to conserve energy due to eating relatively little, they rarely move at their full speed unless they feel threatened.
|
||||
//Sunken Sea Enemies
|
||||
BabyGhostBell: Ghost Bells were bred in large numbers during the Ilmeran war, due to the Ilmerian army needing a staggering amount of electricity to keep Yharim and his forces at bay. Alas, their efforts were for naught, and the kingdom collapsed after the Great Incineration.
|
||||
BabyGhostBell: Despite their decidedly lower size and development, infant Ghost Bells can deliver just as many volts to unsuspecting creatures. The Ilmerian army bred thousands of Ghost Bells to maintain the lethal electric field around the sea kingdom, but all their efforts were consumed by ash in a single burning moment.
|
||||
BlindedAngler: Lacking most normal senses, these predators use a form of biological sonar to 'see' their surroundings. The glowing crystals on their backs draw in prey that use the sea's shimmering prisms as their guiding light, like a moth to the flame.
|
||||
Clam: Clams once lived in the upper portion of the Ilmeran Sea before the Incineration, being forced to relocate after the battle. Though it was thanks in part to their adaptability and hardiness that their species survived, luck was also certainly on their side.
|
||||
EutrophicRay: Eutrophic Rays have formed a commensalistic relationship with Ghost Bells. The rays can store energy given by the Ghost Bells for electrical muscle stimulation, allowing for great bursts of speed.
|
||||
GhostBell: These high-voltage jellyfish can incapacitate most with a single touch, and were a major factor in the Ilmerian army's strength. The sea kingdom used the electricity produced by Ghost Bells to drive back Yharim's forces, electrifying the waters so that none could cross their borders.
|
||||
GiantClam: Clams slowly crystalise ambient magic around themselves into pearls, and as they grow larger, so too do their pearls. Upon growing to their full size, they are classified as Giant Clams, and gain the ability to use the magic stored in their pearls to some degree.
|
||||
PrismBack: Due to the beautiful prisms and calm behavior, these animals have been taken in as pets by many over the course of centuries, even outside of Ilmeris. Though far too slow and bulky to hunt normally, the sea prisms on their back act as a lure for small fish.
|
||||
SeaFloaty: Flatworms can be found in many seas and oceans across the world, and are exceptional at fitting through cracks or crevices due to their thin bodies. These particular flatworms only ever inhabited the lower sea, and were left entirely unthreatened by the carnage that annihilated most species' homes.
|
||||
SeaMinnow: Schools of sea minnows were one of the most beautiful things one could witness during the days when Ilmeris was unshattered. Those permitted into the kingdom would gather to see these fish swimming in the open sea… yet, this is but a distant past now, even for the minnows themselves.
|
||||
SeaSerpent: Despite being one of the few carnivorous creatures to have ever existed in the Ilmeran Sea, even these serpents are unusually passive towards those they do not consider prey by the standards of elsewhere. The sea has only ever known one truly aggressive predator, and it abandoned a life of calming solitude years ago.
|
||||
Clam: Despite having the same filter feeder appetite of the common clam, the Ilmeran species adopted defensive mechanisms against macrofauna due to their forced relocation by the Incineration. Almost all of the remaining Clams have congregated in a small den at the bottom of the sea; what makes this place unique is unknown, as few divers can withstand the ferocity of the clams in their natural abode.
|
||||
Cnidrion: Once trained to be the steeds of honored Ilmerian warriors, Cnidrions fought valiantly alongside their masters during the Incineration. Though many perished unceremoniously with the warriors that commanded them, one managed to escape a fiery demise, continuing to defend what was once the heart of the sea kingdom with a fierce loyalty.
|
||||
EutrophicRay: Living life as a filter feeder, the tranquil Eutrophic Ray is quick to flee from any dangers. They are aided by their commensalistic relationship with Ghost Bells, storing the latent voltage in a sac on their underbelly for electrical muscle stimulation, allowing for great bursts of speed.
|
||||
GhostBell: Commonly encountered as large walls of electric power, these high-voltage jellyfish can incapacitate most with a single touch. Even when not delivering shocks to prey, they passively release a current into the surrounding water, which the old sea kingdom exploited to drive back Yharim's crusade for decades.
|
||||
GiantClam: Pearls are formed from ambient mana combining with natural limestone deposits, and are claimed to be capable of storing thoughts and memories. Although most clams die and break down before their shells can act as sufficient conduits, the largest and strongest clams can gather enough mana in their pearls for direct use in feeding and defense.
|
||||
HauntedChum: During the Witch's razing of Ilmeris' seas, many of the largest fish that had never known fear in their lives were foolish enough to fight back. Even in death they remain consumed by rage, attacking those who draw near, despite being as ruined as the sea itself.
|
||||
Jellyghoul: The spirits of some Ilmerians were so consumed by grief and despair that, over time, their identity and memories faded away. These souls are now confined in the blank form of phantom jellyfishes, doomed to forever haunt the Timeless Shores.
|
||||
KelpieSeadragon: Kelpie Seadragons enjoy hiding in the scarlet kelp fronds of the Polyp Forest, where they can observe their surroundings without being noticed. Don’t underestimate them, as their silly-looking faces can shoot highly poisonous pellets!
|
||||
LostShoal: Shoals of spectral fish swim through the damp air of the Sunken shoreline, fully ignorant of their ominous demeanor and the horrible fate that befell them.
|
||||
Pearlpod: Residing in the utmost depths of the Sunken Sea, these docile crustaceans consume Lantern Kelp and organic remains to survive. When curled up, their nacreous hide makes them almost identical to pearls and impervious to attacks.
|
||||
PolypPanasea: The vibrant Panaseas developed a natural coating which counters the toxins of polyps, and now frequently take shelter in their tentacles. Anything that chases the fish into their home swiftly learns about the other side of this partnership.
|
||||
PrismBack: Far too slow and bulky to hunt normally, these turtles subsist on a diet of purely kelp. As a result of their slow and infrequent movement, large prisms are able to accumulate on their backs, providing natural protection against threats that would not risk swallowing a razor-sharp crystal.
|
||||
Probesnout: One of just a few known seahorse species who miraculously survived the Incineration. Its efficient snout allows it to streamline nutrients from the abundant sponge in the reefs that it lives in.
|
||||
SandProwler: These colorful sea serpents prowl through the sand, looking for the gleam of an unsuspecting Guppy to snack on. Due to this creature’s habit of mistakenly capturing dropped coins, Ilmerians fond of avarice began to share the namesake.
|
||||
SeaFloaty: Flatworms can be found in many seas and oceans across the world, and are exceptional at fitting through cracks or crevices to find kelp due to their thin bodies. These particular flatworms are incredibly skittish, and thus fled with plenty of time to be spared from the infernal carnage.
|
||||
SeaMinnow: Large schools of Sea Minnows were one of the most beautiful things one could witness during the days when Ilmeris was unsundered. Though the kingdom's grandeur has been lost like ashes in the wind, the tranquil fish continue to swim at peace, a breathtaking reminder that not all was lost.
|
||||
Sharkoon: The bulbous Sharkoon wanders the reefs on the outskirts of the Sunken Sea. It retaliates against threats through the unusual method of exploding a sac on its body that stores highly reactive chemicals, fleeing in the confusion caused by its shockwave.
|
||||
Stormlion: Some Ilmerian survivors claim that enough magical lightning surged through the sea during its final days that there existed not a single drop of water without levin coursing through it. Even now, electricity remains buried in the sands, with several antlion species having learned to channel the former kingdom's power.
|
||||
//Town NPCs
|
||||
AndroombaFriendly: Reverse-engineered Androombas that have been retrofitted to spread the Steampunker's solutions rather than clean dust and debris off of floors. They can be used to purify the world– or ruin it further, if one so desires.
|
||||
DILF: One of the world's foremost experts on magical theory, he is renowned for his skill with the arcane arts. In his days when he traveled with Yharim's entourage, he acted as the Godseeker's advisor, due to both his status and his distaste for actively participating in battle.
|
||||
|
||||
@@ -1562,3 +1562,13 @@ Voidfrost: {
|
||||
DisplayName: Voidfrost
|
||||
Description: The emptiness of space devours all warmth and life
|
||||
}
|
||||
|
||||
FlarebatBuff: {
|
||||
DisplayName: Flarebat
|
||||
Description: The construct of fire will protect you
|
||||
}
|
||||
|
||||
FrostbatBuff: {
|
||||
DisplayName: Frostbat
|
||||
Description: The construct of ice will protect you
|
||||
}
|
||||
@@ -7,6 +7,7 @@ CalamityClientConfig: {
|
||||
UI: UI Changes
|
||||
MeterPositions: Meter Positions
|
||||
MusicEvents: In-Game Music Events
|
||||
Multithreading: Multi-Threading
|
||||
}
|
||||
|
||||
AdrenalineMeterPosX: {
|
||||
@@ -91,6 +92,15 @@ CalamityClientConfig: {
|
||||
Tooltip: Plays Calamity Mod OST - "Scourge of the Universe (Eulogy for the Ego)", after the Devourer of Gods has been defeated.
|
||||
}
|
||||
|
||||
EnergyShieldOpacity: {
|
||||
Label: "[i:CalamityMod/TheSponge] Energy Shield Opacity"
|
||||
Tooltip:
|
||||
'''
|
||||
Set the opacity of energy shields rendered over the player.
|
||||
Setting this to 0 disables energy shield visuals entirely.
|
||||
'''
|
||||
}
|
||||
|
||||
FasterFallHotkey: {
|
||||
Label: "[i:CalamityMod/BallAndChain] Enable Fast Falling"
|
||||
Tooltip:
|
||||
@@ -316,6 +326,16 @@ CalamityClientConfig: {
|
||||
Label: "[i:Book] Wiki Status Message"
|
||||
Tooltip: Enable or disable the status message promoting the Official Calamity Wiki that plays on world entry.
|
||||
}
|
||||
|
||||
MultiThreadingType: {
|
||||
Label: Sunken Sea Multi-Threading Option
|
||||
Tooltip:
|
||||
'''
|
||||
Option 0 will disable worldgen multi-threading.
|
||||
Option 1 will enable ReLogic's multi-threading.
|
||||
Option 2 will enable custom multi-threading.
|
||||
'''
|
||||
}
|
||||
}
|
||||
|
||||
CalamityServerConfig: {
|
||||
|
||||
@@ -1200,7 +1200,7 @@ OldDukeScales: {
|
||||
HoldShiftTooltip:
|
||||
'''
|
||||
[c/c3dfff: Using any dash will consume 20% of your stamina]
|
||||
[c/c3dfff: Stamina will gradually restore after not dashing for 1 second]
|
||||
[c/c3dfff: Stamina will gradually restore after not dashing for 1.5 seconds]
|
||||
[c/c3dfff: Stamina recovers faster when you are stationary]
|
||||
[c/c3dfff: If your stamina reaches 0%, you become exhausted]
|
||||
[c/e3545c: While exhausted, this item's damage reduction and movement bonuses are negated]
|
||||
|
||||
@@ -144,7 +144,11 @@ Ataraxia: {
|
||||
|
||||
Avalanche: {
|
||||
DisplayName: Avalanche
|
||||
Tooltip: Spawns ice bombs that explode after 3 seconds into ice shards on hit
|
||||
Tooltip:
|
||||
'''
|
||||
Hitting enemies spawns orbiting ice bombs
|
||||
After 2 seconds, ice bombs explode into gravity-affected ice shards
|
||||
'''
|
||||
}
|
||||
|
||||
Azathoth: {
|
||||
@@ -334,7 +338,8 @@ DeathsAscension: {
|
||||
Tooltip:
|
||||
'''
|
||||
Press <right> to launch a barrage of homing scythes
|
||||
You can feel the hands of Death himself onto yours
|
||||
'It feels just right in your grip...
|
||||
[c/660066:But the hands that wield it are not yours']
|
||||
'''
|
||||
}
|
||||
|
||||
@@ -499,7 +504,7 @@ FallenPaladinsHammer: {
|
||||
DisplayName: Fallen Paladin's Hammer
|
||||
Tooltip:
|
||||
'''
|
||||
Throws a heavy, gravity-affected hammer that will return to you after striking an enemy
|
||||
Throws a heavy, gravity-affected hammer that will explode and return to you after striking an enemy
|
||||
After returning three times, a homing spectral hammer is summoned with devastating impact
|
||||
'''
|
||||
}
|
||||
@@ -599,7 +604,7 @@ GalaxySmasher: {
|
||||
Tooltip:
|
||||
'''
|
||||
Throws a heavy, gravity-affected hammer that will return to you after striking an enemy
|
||||
Consecutive hits summon more and more cosmic hammers
|
||||
Consecutive hits summon more and more cosmic shards
|
||||
After hitting eight times, the hammer supercharges itself with galactic energies,
|
||||
delivering an apocalyptic strike that reverberates through space and time
|
||||
'''
|
||||
@@ -668,7 +673,11 @@ GreatswordofJudgement: {
|
||||
|
||||
Greentide: {
|
||||
DisplayName: Greentide
|
||||
Tooltip: Summons teeth to chomp your foes on hit
|
||||
Tooltip:
|
||||
'''
|
||||
Launches a spread of four teeth with one stronger piercing tooth in the center
|
||||
Hitting with the blade creates two jaws of teeth to chomp on the enemy closest to your cursor
|
||||
'''
|
||||
}
|
||||
|
||||
HellfireFlamberge: {
|
||||
|
||||
@@ -100,15 +100,6 @@ BouncySpikyBall: {
|
||||
'''
|
||||
}
|
||||
|
||||
BrackishFlask: {
|
||||
DisplayName: Brackish Flask
|
||||
Tooltip:
|
||||
'''
|
||||
Throws a flask that explodes into poisonous seawater blasts
|
||||
Stealth strikes summon a brackish spear spike
|
||||
'''
|
||||
}
|
||||
|
||||
Brimblade: {
|
||||
DisplayName: Brimblade
|
||||
Tooltip:
|
||||
@@ -646,7 +637,7 @@ Kylie: {
|
||||
DisplayName: Kylie
|
||||
Tooltip:
|
||||
'''
|
||||
Stealth strikes throws three shorter ranged kylies instead of a single long range one
|
||||
Stealth strikes throw a kylie that weakly seeks out your cursor
|
||||
'Also known as Dowak'
|
||||
'''
|
||||
}
|
||||
@@ -674,9 +665,9 @@ LeviathanTeeth: {
|
||||
DisplayName: Leviathan Teeth
|
||||
Tooltip:
|
||||
'''
|
||||
Rapidly throws a spread of venomous teeth that stick to enemies
|
||||
This venom can stack when more teeth are stuck in an enemy
|
||||
Stealth strikes cause 6 very fast teeth to be thrown, ignoring gravity and spawning water blasts on hit
|
||||
Rapidly throws a spread of teeth that stick into enemies
|
||||
After sticking to an enemy, the teeth will gouge through them and shoot out the other side
|
||||
Stealth strikes throw a single piercing tooth that creates a jawline of teeth to maul your foes
|
||||
'''
|
||||
}
|
||||
|
||||
@@ -914,9 +905,9 @@ RefractionRotor: {
|
||||
DisplayName: Refraction Rotor
|
||||
Tooltip:
|
||||
'''
|
||||
Fires a huge prismatic disk shuriken
|
||||
The shuriken shatters moments after impact into homing rockets
|
||||
Stealth strikes shatter into many more rockets
|
||||
Throws a huge prismatic shuriken
|
||||
The shuriken shatters moments after impact into homing blades
|
||||
Stealth strikes throw 3 shurikens that rapidly home on enemies
|
||||
'''
|
||||
}
|
||||
|
||||
@@ -1396,6 +1387,18 @@ WebBall: {
|
||||
'''
|
||||
}
|
||||
|
||||
Whitewater: {
|
||||
DisplayName: Whitewater
|
||||
Tooltip:
|
||||
'''
|
||||
Throws a flask of magic whitewater that tracks your cursor
|
||||
After a second, the flask will glow brightly
|
||||
Flasks that hit enemies while glowing create a temporary burst of returning water spears
|
||||
After exploding or after being thrown for a while, the flask will return to you
|
||||
Stealth strikes create more water spears and will make a swirling vortex of whitewater that heals any player it touches and knocks back enemies
|
||||
'''
|
||||
}
|
||||
|
||||
Wrathwing: {
|
||||
DisplayName: Wrathwing
|
||||
Tooltip:
|
||||
|
||||
@@ -884,3 +884,21 @@ YharonsKindleStaff: {
|
||||
Requires 5 minion slots to use
|
||||
'''
|
||||
}
|
||||
|
||||
FlarebatStaff: {
|
||||
DisplayName: Flarebat Staff
|
||||
Tooltip:
|
||||
'''
|
||||
Summons a bat construct of pure fire to fight for you
|
||||
Swoops towards foes with great haste
|
||||
'''
|
||||
}
|
||||
|
||||
FrostbatStaff: {
|
||||
DisplayName: Frostbat Staff
|
||||
Tooltip:
|
||||
'''
|
||||
Summons a bat construct of pure ice to fight for you
|
||||
Swoops towards foes with slow and precise maneuvers
|
||||
'''
|
||||
}
|
||||
@@ -130,7 +130,7 @@ GalaxyBlastType3.DisplayName: Galaxy Blast
|
||||
GalaxySmasherBlast.DisplayName: Galactic Blast
|
||||
GalaxySmasherEcho.DisplayName: Galaxy Smasher Echo
|
||||
GalaxySmasherHammer.DisplayName: Galaxy Smasher
|
||||
GalaxySmasherMini.DisplayName: Galaxy Smasher
|
||||
GalaxySmasherMini.DisplayName: Cosmic Shard
|
||||
GalileosMoon.DisplayName: Crescent Moon
|
||||
GalileosPlanet.DisplayName: Planet
|
||||
GayBeam.DisplayName: Iridescent Beam
|
||||
@@ -298,3 +298,4 @@ WulfrumScrew.DisplayName: Wulfrum Screw
|
||||
WulfrumScrewdriverProj.DisplayName: Wulfrum Screwdriver
|
||||
YinYoDark.DisplayName: Dark Shard
|
||||
YinYoLight.DisplayName: Light Shard
|
||||
FallenExplosionSmall.DisplayName: Fallen Hammer Blast
|
||||
@@ -247,3 +247,4 @@ WulfrumScrapBullet.DisplayName: High Speed Scrap
|
||||
HellbornProj.DisplayName: Hell-born Gunblast
|
||||
HellbornShell.DisplayName: Hell's Shell
|
||||
RubicoPrimeMag.DisplayName: Rubico Prime Mag
|
||||
MegalodonShot.DisplayName: Megalodon Shot
|
||||
@@ -23,10 +23,6 @@ BlunderBoosterLightning.DisplayName: Blunder Bolt
|
||||
BouncingEyeballProjectile.DisplayName: Bouncy Eyeball
|
||||
BouncingEyeballProjectileStealthStrike.DisplayName: Bouncy Eyeball
|
||||
BouncyBol.DisplayName: Bouncy Ball
|
||||
BrackishFlaskProj.DisplayName: Brackish Flask
|
||||
BrackishSpear.DisplayName: Not Atlantis Spear
|
||||
BrackishWater.DisplayName: Brackish Water
|
||||
BrackishWaterBlast.DisplayName: Brackish Water
|
||||
Brick.DisplayName: Brick
|
||||
BrickFragment.DisplayName: Brick Fragment
|
||||
Brimblade2.DisplayName: Brimblade
|
||||
@@ -322,9 +318,14 @@ ValedictionBoomerang.DisplayName: Valediction
|
||||
VeneratedKnife.DisplayName: Venerated Knife
|
||||
WaveSkipperProjectile.DisplayName: Wave Skipper
|
||||
WebBallBol.DisplayName: Web Ball
|
||||
WhitewaterAura.DisplayName: Whitewater Aura
|
||||
WhitewaterProj.DisplayName: Whitewater Flask
|
||||
WhitewaterSpear.DisplayName: Whitewater Spear
|
||||
WrathwingCinder.DisplayName: Wrathwing Eruption
|
||||
WrathwingFireball.DisplayName: Wrathwing Fireball
|
||||
WrathwingSpear.DisplayName: Wrathwing
|
||||
WulfrumKnifeProj.DisplayName: Wulfrum Knife
|
||||
RadiationBurst.DisplayName: Radiation Burst
|
||||
RadiationRain.DisplayName: Radiation Rain
|
||||
RefractionRotorSlashCreator.DisplayName: Refraction Rotor Slash Creator
|
||||
RefractionSlash.DisplayName: Refraction Slash
|
||||
@@ -330,3 +330,5 @@ WulfrumDroid.DisplayName: Wulfrum Droid
|
||||
WulfrumEnergyBurst.DisplayName: Wulfrum Bolt
|
||||
WulfrumFusionBolt.DisplayName: Fusion Bolt
|
||||
YharonMinionFireball.DisplayName: Dragon Fireball
|
||||
FlarebatMinion.DisplayName: Flarebat
|
||||
FrostbatMinion.DisplayName: Frostbat
|
||||
@@ -133,3 +133,4 @@ WulfrumHook.DisplayName: Wulfrum Slingshot
|
||||
WulfrumLureSignal.DisplayName: Signal
|
||||
YanmeisKnifeSlash.DisplayName: Yanmei's Knife
|
||||
YellowLabSeeker.DisplayName: Seeking Mechanism
|
||||
VoidofExtinctionCrit.DisplayName: Void of Extinction Crit
|
||||
@@ -4,6 +4,7 @@ using CalamityMod.BiomeManagers;
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.Items.Placeables;
|
||||
using CalamityMod.Items.Placeables.Banners;
|
||||
using CalamityMod.Packets;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Content;
|
||||
@@ -290,11 +291,7 @@ namespace CalamityMod.NPCs.Abyss
|
||||
}
|
||||
else
|
||||
{
|
||||
var netMessage = Mod.GetPacket();
|
||||
netMessage.Write((byte)CalamityModMessageType.SyncSlabCrabAI);
|
||||
netMessage.Write(NPC.whoAmI);
|
||||
netMessage.Write((int)phase);
|
||||
netMessage.Send();
|
||||
SyncSlabCrabAIPacket.Send(this, phase: (int)phase);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ using CalamityMod.NPCs.NormalNPCs;
|
||||
using CalamityMod.NPCs.OldDuke;
|
||||
using CalamityMod.NPCs.SulphurousSea;
|
||||
using CalamityMod.NPCs.SunkenSea;
|
||||
using CalamityMod.Packets;
|
||||
using CalamityMod.Projectiles.Boss;
|
||||
using CalamityMod.Projectiles.Enemy;
|
||||
using CalamityMod.Sounds;
|
||||
@@ -220,14 +221,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs
|
||||
// On server, immediately send the correct extra AI of this head to clients.
|
||||
if (Main.netMode == NetmodeID.Server)
|
||||
{
|
||||
var netMessage = mod.GetPacket();
|
||||
netMessage.Write((byte)CalamityModMessageType.SyncCalamityNPCAIArray);
|
||||
netMessage.Write((byte)headOneID);
|
||||
netMessage.Write(Main.npc[headOneID].Calamity().newAI[0]);
|
||||
netMessage.Write(Main.npc[headOneID].Calamity().newAI[1]);
|
||||
netMessage.Write(Main.npc[headOneID].Calamity().newAI[2]);
|
||||
netMessage.Write(Main.npc[headOneID].Calamity().newAI[3]);
|
||||
netMessage.Send();
|
||||
SyncCalamityNPCAIArrayPacket.Send(Main.npc[headOneID]);
|
||||
}
|
||||
|
||||
// Make sure the second split worm is also contiguous.
|
||||
@@ -243,14 +237,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs
|
||||
// On server, immediately send the correct extra AI of this head to clients.
|
||||
if (Main.netMode == NetmodeID.Server)
|
||||
{
|
||||
var netMessage = mod.GetPacket();
|
||||
netMessage.Write((byte)CalamityModMessageType.SyncCalamityNPCAIArray);
|
||||
netMessage.Write((byte)headTwoID);
|
||||
netMessage.Write(Main.npc[headTwoID].Calamity().newAI[0]);
|
||||
netMessage.Write(Main.npc[headTwoID].Calamity().newAI[1]);
|
||||
netMessage.Write(Main.npc[headTwoID].Calamity().newAI[2]);
|
||||
netMessage.Write(Main.npc[headTwoID].Calamity().newAI[3]);
|
||||
netMessage.Send();
|
||||
SyncCalamityNPCAIArrayPacket.Send(Main.npc[headTwoID]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -382,14 +369,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs
|
||||
|
||||
if (Main.netMode == NetmodeID.Server)
|
||||
{
|
||||
var netMessage = mod.GetPacket();
|
||||
netMessage.Write((byte)CalamityModMessageType.SyncCalamityNPCAIArray);
|
||||
netMessage.Write((byte)lol);
|
||||
netMessage.Write(Main.npc[lol].Calamity().newAI[0]);
|
||||
netMessage.Write(Main.npc[lol].Calamity().newAI[1]);
|
||||
netMessage.Write(Main.npc[lol].Calamity().newAI[2]);
|
||||
netMessage.Write(Main.npc[lol].Calamity().newAI[3]);
|
||||
netMessage.Send();
|
||||
SyncCalamityNPCAIArrayPacket.Send(Main.npc[lol]);
|
||||
}
|
||||
|
||||
Main.npc[lol].ai[2] = npc.whoAmI;
|
||||
|
||||
@@ -82,6 +82,7 @@ using Terraria.UI.Chat;
|
||||
using Terraria.Utilities;
|
||||
using static Terraria.ModLoader.ModContent;
|
||||
using CalamityMod.NPCs.SunkenSea;
|
||||
using CalamityMod.Packets;
|
||||
|
||||
namespace CalamityMod.NPCs
|
||||
{
|
||||
@@ -8326,33 +8327,32 @@ namespace CalamityMod.NPCs
|
||||
// has an owner, hence the MyPlayer check.
|
||||
if (Main.myPlayer == projectile.owner)
|
||||
{
|
||||
if (!player.active || player.dead)
|
||||
return;
|
||||
|
||||
Projectile proj = null;
|
||||
foreach (Projectile p in Main.ActiveProjectiles)
|
||||
{
|
||||
proj = p;
|
||||
if (p.bobber && p.owner == player.whoAmI)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (proj is null)
|
||||
return;
|
||||
|
||||
var spawnPosX = (int)proj.Center.X;
|
||||
var spawnPosY = (int)proj.Center.Y + 100;
|
||||
if (Main.netMode == NetmodeID.SinglePlayer)
|
||||
{
|
||||
if (!player.active || player.dead)
|
||||
return;
|
||||
|
||||
Projectile proj = null;
|
||||
foreach (Projectile p in Main.ActiveProjectiles)
|
||||
{
|
||||
proj = p;
|
||||
if (p.bobber && p.owner == player.whoAmI)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (proj is null)
|
||||
return;
|
||||
|
||||
int oldDuke = NPC.NewNPC(NPC.GetBossSpawnSource(player.whoAmI), (int)proj.Center.X, (int)proj.Center.Y + 100, NPCType<OldDuke.OldDuke>());
|
||||
int oldDuke = NPC.NewNPC(NPC.GetBossSpawnSource(player.whoAmI), spawnPosX, spawnPosY, NPCType<OldDuke.OldDuke>());
|
||||
CalamityUtils.BossAwakenMessage(oldDuke);
|
||||
}
|
||||
else
|
||||
else if (Main.netMode == NetmodeID.MultiplayerClient)
|
||||
{
|
||||
var netMessage = CalamityMod.Instance.GetPacket();
|
||||
netMessage.Write((byte)CalamityModMessageType.ServersideSpawnOldDuke);
|
||||
netMessage.Write((byte)player.whoAmI);
|
||||
netMessage.Send();
|
||||
SpawnBossOnPositionPacket.Send(spawnPosX, spawnPosY, NPCType<OldDuke.OldDuke>(), player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -195,6 +195,13 @@ namespace CalamityMod.NPCs
|
||||
#endregion
|
||||
|
||||
#region Ice
|
||||
|
||||
// Ice Bat.
|
||||
// Frostbat Staff @ 6.67%
|
||||
case NPCID.IceBat:
|
||||
npcLoot.Add(ModContent.ItemType<FrostbatStaff>(), 15);
|
||||
break;
|
||||
|
||||
// Icy Merman, Icy Tortoise, Ice Elemental, Wolf
|
||||
// Essence of Eleum @ 100%
|
||||
case NPCID.IcyMerman:
|
||||
@@ -408,6 +415,13 @@ namespace CalamityMod.NPCs
|
||||
#endregion
|
||||
|
||||
#region Hell
|
||||
|
||||
// Hellbat.
|
||||
// Flarebat Staff @ 4%
|
||||
case NPCID.Hellbat:
|
||||
npcLoot.Add(ModContent.ItemType<FlarebatStaff>(), 25);
|
||||
break;
|
||||
|
||||
// Fire Imp
|
||||
// Ashen Stalactite @ 10% Normal, 16.67% Expert+
|
||||
case NPCID.FireImp:
|
||||
|
||||
@@ -4,6 +4,7 @@ using CalamityMod.Events;
|
||||
using CalamityMod.Items.Weapons.DraedonsArsenal;
|
||||
using CalamityMod.NPCs.ExoMechs.Ares;
|
||||
using CalamityMod.NPCs.ExoMechs.Thanatos;
|
||||
using CalamityMod.Packets;
|
||||
using CalamityMod.Sounds;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
@@ -222,12 +223,7 @@ namespace CalamityMod.NPCs.ExoMechs
|
||||
CalamityWorld.DraedonMechdusa = false;
|
||||
if (Main.netMode != NetmodeID.SinglePlayer)
|
||||
{
|
||||
var netMessage = CalamityMod.Instance.GetPacket();
|
||||
netMessage.Write((byte)CalamityModMessageType.CodebreakerSummonStuff);
|
||||
netMessage.Write(CalamityWorld.DraedonSummonCountdown);
|
||||
netMessage.WriteVector2(CalamityWorld.DraedonSummonPosition);
|
||||
netMessage.Write(CalamityWorld.DraedonMechdusa);
|
||||
netMessage.Send();
|
||||
CodebreakerSummonStuffPacket.Send();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -336,10 +332,7 @@ namespace CalamityMod.NPCs.ExoMechs
|
||||
|
||||
if (Main.netMode != NetmodeID.SinglePlayer)
|
||||
{
|
||||
var netMessage = CalamityMod.Instance.GetPacket();
|
||||
netMessage.Write((byte)CalamityModMessageType.ExoMechSelection);
|
||||
netMessage.Write((int)CalamityWorld.DraedonMechToSummon);
|
||||
netMessage.Send();
|
||||
ExoMechSelectionPacket.Send();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -870,7 +870,7 @@ namespace CalamityMod.NPCs.Leviathan
|
||||
ModContent.ItemType<AnahitasArpeggio>(),
|
||||
ModContent.ItemType<Atlantis>(),
|
||||
ModContent.ItemType<GastricBelcherStaff>(),
|
||||
ModContent.ItemType<BrackishFlask>(),
|
||||
ModContent.ItemType<Whitewater>(),
|
||||
ModContent.ItemType<LeviathanTeeth>()
|
||||
};
|
||||
normalOnly.Add(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, items));
|
||||
|
||||
@@ -24,6 +24,7 @@ using CalamityMod.Items.Weapons.Melee;
|
||||
using CalamityMod.Items.Weapons.Ranged;
|
||||
using CalamityMod.Items.Weapons.Rogue;
|
||||
using CalamityMod.Items.Weapons.Summon;
|
||||
using CalamityMod.Packets;
|
||||
using CalamityMod.Particles;
|
||||
using CalamityMod.Projectiles.Boss;
|
||||
using CalamityMod.Projectiles.Summon;
|
||||
@@ -2584,11 +2585,7 @@ namespace CalamityMod.NPCs.Providence
|
||||
|
||||
if (Main.netMode != NetmodeID.SinglePlayer)
|
||||
{
|
||||
var netMessage = Mod.GetPacket();
|
||||
netMessage.Write((byte)CalamityModMessageType.ProvidenceDyeConditionSync);
|
||||
netMessage.Write((byte)NPC.whoAmI);
|
||||
netMessage.Write(hasTakenDaytimeDamage);
|
||||
netMessage.Send();
|
||||
ProvidenceDyeConditionSyncPacket.Send(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2624,11 +2621,7 @@ namespace CalamityMod.NPCs.Providence
|
||||
|
||||
if (Main.netMode != NetmodeID.SinglePlayer)
|
||||
{
|
||||
var netMessage = Mod.GetPacket();
|
||||
netMessage.Write((byte)CalamityModMessageType.PSCChallengeSync);
|
||||
netMessage.Write((byte)NPC.whoAmI);
|
||||
netMessage.Write(challenge);
|
||||
netMessage.Send();
|
||||
PSCChallengeSyncPacket.Send(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2644,11 +2637,7 @@ namespace CalamityMod.NPCs.Providence
|
||||
|
||||
if (Main.netMode != NetmodeID.SinglePlayer)
|
||||
{
|
||||
var netMessage = Mod.GetPacket();
|
||||
netMessage.Write((byte)CalamityModMessageType.ProvidenceDyeConditionSync);
|
||||
netMessage.Write((byte)NPC.whoAmI);
|
||||
netMessage.Write(hasTakenDaytimeDamage);
|
||||
netMessage.Send();
|
||||
ProvidenceDyeConditionSyncPacket.Send(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2659,11 +2648,7 @@ namespace CalamityMod.NPCs.Providence
|
||||
|
||||
if (Main.netMode != NetmodeID.SinglePlayer)
|
||||
{
|
||||
var netMessage = Mod.GetPacket();
|
||||
netMessage.Write((byte)CalamityModMessageType.PSCChallengeSync);
|
||||
netMessage.Write((byte)NPC.whoAmI);
|
||||
netMessage.Write(challenge);
|
||||
netMessage.Send();
|
||||
PSCChallengeSyncPacket.Send(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ namespace CalamityMod.NPCs.SunkenSea
|
||||
{
|
||||
bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[]
|
||||
{
|
||||
new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.SeaSerpent")
|
||||
new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.SandProwler")
|
||||
});
|
||||
}
|
||||
public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position)
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using CalamityMod.BiomeManagers;
|
||||
using CalamityMod.Items.Critters;
|
||||
using CalamityMod.Packets;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
@@ -166,11 +167,7 @@ namespace CalamityMod.NPCs.TownNPCs
|
||||
}
|
||||
else
|
||||
{
|
||||
var netMessage = Mod.GetPacket();
|
||||
netMessage.Write((byte)CalamityModMessageType.SyncAndroombaAI);
|
||||
netMessage.Write(NPC.whoAmI);
|
||||
netMessage.Write(phase);
|
||||
netMessage.Send();
|
||||
SyncAndroombaAIPacket.Send(this, phase: phase);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ using CalamityMod.Items;
|
||||
using CalamityMod.Items.Accessories;
|
||||
using CalamityMod.Items.Pets;
|
||||
using CalamityMod.Items.Weapons.Rogue;
|
||||
using CalamityMod.Packets;
|
||||
using CalamityMod.Projectiles.Rogue;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
@@ -231,10 +232,7 @@ namespace CalamityMod.NPCs.TownNPCs
|
||||
//
|
||||
// Other way possible is to having bandit stolen inventory per player
|
||||
// But I didn't wanted to change system too much
|
||||
ModPacket packet = CalamityMod.Instance.GetPacket();
|
||||
packet.Write((byte)CalamityModMessageType.WantToRefundReforges);
|
||||
packet.Write((byte)Main.myPlayer);
|
||||
packet.Send();
|
||||
WantToRefundReforgesPacket.Send();
|
||||
}
|
||||
|
||||
SoundEngine.PlaySound(SoundID.Coins); // Money dink sound
|
||||
@@ -309,12 +307,11 @@ namespace CalamityMod.NPCs.TownNPCs
|
||||
NPCShop shop = new(Type);
|
||||
shop.AddWithCustomValue(ModContent.ItemType<Cinquedea>(), Item.buyPrice(gold: 9))
|
||||
.AddWithCustomValue(ModContent.ItemType<Glaive>(), Item.buyPrice(gold: 9))
|
||||
.AddWithCustomValue(ModContent.ItemType<Kylie>(), Item.buyPrice(gold: 9))
|
||||
.AddWithCustomValue(ModContent.ItemType<SlickCane>(), Item.buyPrice(gold: 25))
|
||||
.AddWithCustomValue(ModContent.ItemType<OldDie>(), Item.buyPrice(gold: 40))
|
||||
.Add(ItemID.TigerClimbingGear)
|
||||
.AddWithCustomValue(ItemID.InvisibilityPotion, Item.buyPrice(silver: 25), potionSells, Condition.HappyEnough)
|
||||
.AddWithCustomValue(ItemID.NightOwlPotion, Item.buyPrice(silver: 25), potionSells, Condition.HappyEnough)
|
||||
.AddWithCustomValue(ModContent.ItemType<SlickCane>(), Item.buyPrice(gold: 25))
|
||||
.Add(ModContent.ItemType<ThiefsDime>(), Condition.DownedPirates)
|
||||
.AddWithCustomValue(ModContent.ItemType<MomentumCapacitor>(), Item.buyPrice(gold: 60), Condition.DownedMechBossAll)
|
||||
.Add(ModContent.ItemType<DeepWounder>(), downedCalclone)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using CalamityMod.Events;
|
||||
using CalamityMod.Packets;
|
||||
using CalamityMod.Projectiles.Boss;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
@@ -761,14 +762,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
|
||||
// Manually sync newAI because there is no GlobalNPC.SendExtraAI
|
||||
if (npc.active && npc.netUpdate && Main.netMode == NetmodeID.Server)
|
||||
{
|
||||
ModPacket packet = mod.GetPacket();
|
||||
packet.Write((byte)CalamityModMessageType.SyncCalamityNPCAIArray);
|
||||
packet.Write((byte)npc.whoAmI);
|
||||
packet.Write(calamityGlobalNPC.newAI[0]);
|
||||
packet.Write(calamityGlobalNPC.newAI[1]);
|
||||
packet.Write(calamityGlobalNPC.newAI[2]);
|
||||
packet.Write(calamityGlobalNPC.newAI[3]);
|
||||
packet.Send(-1, -1);
|
||||
SyncCalamityNPCAIArrayPacket.Send(npc);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Packets
|
||||
{
|
||||
public abstract class CalamityPacket
|
||||
{
|
||||
public abstract byte MessageType { get; }
|
||||
public abstract void HandlePacket(in BinaryReader packet, int sender);
|
||||
|
||||
public virtual void OnLoaded() { }
|
||||
public virtual void OnUnloaded() { }
|
||||
|
||||
internal PropertyInfo _Prop_Static_Instance;
|
||||
|
||||
public void CloneAndBroadcast(in BinaryReader packet, long startIndex, int length, int ignoreClient = -1)
|
||||
{
|
||||
if (!Main.dedServ)
|
||||
return;
|
||||
|
||||
if (startIndex < 0)
|
||||
return;
|
||||
|
||||
packet.BaseStream.Position = startIndex;
|
||||
|
||||
// Limit stackalloc size to 256 bytes
|
||||
Span<byte> buffer = length <= 256 ? stackalloc byte[length] : new byte[length];
|
||||
packet.BaseStream.Read(buffer);
|
||||
|
||||
var newPacket = CreateBasePacket();
|
||||
newPacket.Write(buffer);
|
||||
newPacket.Send(ignoreClient);
|
||||
}
|
||||
|
||||
public ModPacket CreateBasePacket()
|
||||
{
|
||||
var packet = CalamityMod.Instance.GetPacket();
|
||||
packet.Write(MessageType);
|
||||
return packet;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using CalamityMod.World;
|
||||
using Terraria;
|
||||
|
||||
namespace CalamityMod.Packets
|
||||
{
|
||||
public sealed class CodebreakerSummonStuffPacket : CalamityPacket
|
||||
{
|
||||
public static CodebreakerSummonStuffPacket Instance { get; private set; }
|
||||
|
||||
public override byte MessageType => (byte)CalamityModMessageType.CodebreakerSummonStuff;
|
||||
|
||||
public static void Send(int toClient = -1, int ignoreClient = -1)
|
||||
{
|
||||
var packet = Instance.CreateBasePacket();
|
||||
packet.Write(CalamityWorld.DraedonSummonCountdown);
|
||||
packet.WriteVector2(CalamityWorld.DraedonSummonPosition);
|
||||
packet.Write(CalamityWorld.DraedonMechdusa);
|
||||
packet.Send(toClient, ignoreClient);
|
||||
}
|
||||
|
||||
public override void HandlePacket(in BinaryReader packet, int sender)
|
||||
{
|
||||
CalamityWorld.DraedonSummonCountdown = packet.ReadInt32();
|
||||
CalamityWorld.DraedonSummonPosition = packet.ReadVector2();
|
||||
CalamityWorld.DraedonMechdusa = packet.ReadBoolean();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using CalamityMod.World;
|
||||
|
||||
namespace CalamityMod.Packets
|
||||
{
|
||||
public sealed class ExoMechSelectionPacket : CalamityPacket
|
||||
{
|
||||
public static ExoMechSelectionPacket Instance { get; private set; }
|
||||
|
||||
public override byte MessageType => (byte)CalamityModMessageType.ExoMechSelection;
|
||||
|
||||
public static void Send(int toClient = -1, int ignoreClient = -1)
|
||||
{
|
||||
var packet = Instance.CreateBasePacket();
|
||||
packet.Write((int)CalamityWorld.DraedonMechToSummon);
|
||||
packet.Send(toClient, ignoreClient);
|
||||
}
|
||||
|
||||
public override void HandlePacket(in BinaryReader packet, int sender)
|
||||
{
|
||||
CalamityWorld.DraedonMechToSummon = (ExoMech)packet.ReadInt32();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using CalamityMod.NPCs.DraedonLabThings;
|
||||
using CalamityMod.NPCs.TownNPCs;
|
||||
using Microsoft.Build.Execution;
|
||||
using Terraria;
|
||||
|
||||
namespace CalamityMod.Packets
|
||||
{
|
||||
public sealed class SyncAndroombaAIPacket : CalamityPacket
|
||||
{
|
||||
public static SyncAndroombaAIPacket Instance { get; private set; }
|
||||
|
||||
public override byte MessageType => (byte)CalamityModMessageType.SyncAndroombaAI;
|
||||
|
||||
public static void Send(AndroombaFriendly roomba, int phase = -1, int toClient = -1, int ignoreClient = -1)
|
||||
{
|
||||
if (roomba is null)
|
||||
return;
|
||||
|
||||
var packet = Instance.CreateBasePacket();
|
||||
packet.WriteWhoAmI(roomba);
|
||||
packet.Write(phase != -1 ? phase : (int)roomba.NPC.ai[0]); // Phase
|
||||
packet.Send(toClient, ignoreClient);
|
||||
}
|
||||
|
||||
public override void HandlePacket(in BinaryReader packet, int sender)
|
||||
{
|
||||
var roomba = packet.ReadModNPC<AndroombaFriendly>();
|
||||
var phase = packet.ReadInt32();
|
||||
|
||||
if (roomba is null)
|
||||
return;
|
||||
|
||||
if (Main.dedServ)
|
||||
AndroombaFriendly.ChangeAI(roomba.NPC.whoAmI, phase);
|
||||
}
|
||||
}
|
||||
}
|
||||