Manual resolution of merge conflicts with minor changes:
1 - Minorly adjusted tooltips. 2 - Reflects and dodges share one global cooldown.
This commit is contained in:
commit
0dcb1ef66f
39 files changed
+869
-765
No files matched your search
+80
-397
@@ -69,7 +69,7 @@ using Terraria.ModLoader.IO;
|
||||
|
||||
namespace CalamityMod.CalPlayer
|
||||
{
|
||||
public class CalamityPlayer : ModPlayer
|
||||
public partial class CalamityPlayer : ModPlayer
|
||||
{
|
||||
#region Variables
|
||||
|
||||
@@ -222,8 +222,14 @@ namespace CalamityMod.CalPlayer
|
||||
public int auralisAurora = 0;
|
||||
public int fungalSymbioteTimer = 0;
|
||||
public int aBulwarkRareTimer = 0;
|
||||
public int dodgeCooldownTimer = 0;
|
||||
public int reflectCooldownTimer = 0;
|
||||
|
||||
public const int BeltDodgeCooldown = 3600;
|
||||
public const int MirrorDodgeCooldown = 4500;
|
||||
public const int DaedalusReflectCooldown = 5400;
|
||||
public const int ArcanumReflectCooldown = 5400;
|
||||
public const int EvolutionReflectCooldown = 7200;
|
||||
public int dodgeCooldownTimer = 0;
|
||||
|
||||
public bool canFireAtaxiaRangedProjectile = false;
|
||||
public bool canFireAtaxiaRogueProjectile = false;
|
||||
public bool canFireGodSlayerRangedProjectile = false;
|
||||
@@ -1997,7 +2003,6 @@ namespace CalamityMod.CalPlayer
|
||||
{
|
||||
#region Debuffs
|
||||
dodgeCooldownTimer = 0;
|
||||
reflectCooldownTimer = 0;
|
||||
defenseDamage = 0;
|
||||
deathModeBlizzardTime = 0;
|
||||
deathModeUnderworldTime = 0;
|
||||
@@ -3829,21 +3834,24 @@ namespace CalamityMod.CalPlayer
|
||||
SpectralVeil();
|
||||
return true;
|
||||
}
|
||||
// Scarf cooldowns affect each other
|
||||
|
||||
// Neither scarf can be used if either is on cooldown
|
||||
bool playerDashing = player.pulley || player.grappling[0] == -1 && !player.tongued;
|
||||
if (playerDashing && dashMod == 1 && player.dashDelay < 0 && dodgeScarf && !scarfCooldown && !eScarfCooldown)
|
||||
{
|
||||
OnDodge();
|
||||
return true;
|
||||
}
|
||||
// Mirror cooldowns affect each other
|
||||
|
||||
// Neither mirror can be used if either is on cooldown
|
||||
bool isImmune = false;
|
||||
for (int j = 0; j < player.hurtCooldowns.Length; j++)
|
||||
{
|
||||
if (player.hurtCooldowns[j] > 0)
|
||||
isImmune = true;
|
||||
}
|
||||
if ((dodgeCooldownTimer + reflectCooldownTimer) == 0 && !isImmune && !eclipseMirrorCooldown && !abyssalMirrorCooldown)
|
||||
|
||||
if (dodgeCooldownTimer == 0 && !isImmune && !eclipseMirrorCooldown && !abyssalMirrorCooldown)
|
||||
{
|
||||
if (eclipseMirror)
|
||||
{
|
||||
@@ -3929,7 +3937,7 @@ namespace CalamityMod.CalPlayer
|
||||
{
|
||||
if (player.whoAmI == Main.myPlayer && abyssalMirror && !abyssalMirrorCooldown && !eclipseMirror)
|
||||
{
|
||||
dodgeCooldownTimer = 4500;
|
||||
dodgeCooldownTimer = MirrorDodgeCooldown;
|
||||
player.AddBuff(ModContent.BuffType<AbyssalMirrorCooldown>(), dodgeCooldownTimer);
|
||||
player.immune = true;
|
||||
player.immuneTime = player.longInvince ? 100 : 60;
|
||||
@@ -3950,10 +3958,15 @@ namespace CalamityMod.CalPlayer
|
||||
Main.projectile[lumenyl].frame = Main.rand.Next(0, 4);
|
||||
}
|
||||
|
||||
// TODO -- Calamity dodges should probably not send a vanilla dodge packet considering that causes Tabi dust
|
||||
if (player.whoAmI == Main.myPlayer)
|
||||
{
|
||||
NetMessage.SendData(MessageID.Dodge, -1, -1, null, player.whoAmI, 1f, 0f, 0f, 0, 0, 0);
|
||||
}
|
||||
|
||||
// Send a Calamity dodge cooldown packet.
|
||||
if (Main.netMode == NetmodeID.MultiplayerClient && player.whoAmI == Main.myPlayer)
|
||||
SyncDodgeCooldown(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3961,7 +3974,7 @@ namespace CalamityMod.CalPlayer
|
||||
{
|
||||
if (player.whoAmI == Main.myPlayer && eclipseMirror && !eclipseMirrorCooldown)
|
||||
{
|
||||
dodgeCooldownTimer = 4500;
|
||||
dodgeCooldownTimer = MirrorDodgeCooldown;
|
||||
player.AddBuff(ModContent.BuffType<EclipseMirrorCooldown>(), dodgeCooldownTimer);
|
||||
player.immune = true;
|
||||
player.immuneTime = player.longInvince ? 100 : 60;
|
||||
@@ -3976,10 +3989,15 @@ namespace CalamityMod.CalPlayer
|
||||
Main.PlaySound(SoundID.Item68, player.Center);
|
||||
Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType<EclipseMirrorBurst>(), (int)(2750 * player.RogueDamage()), 0, player.whoAmI);
|
||||
|
||||
// TODO -- Calamity dodges should probably not send a vanilla dodge packet considering that causes Tabi dust
|
||||
if (player.whoAmI == Main.myPlayer)
|
||||
{
|
||||
NetMessage.SendData(MessageID.Dodge, -1, -1, null, player.whoAmI, 1f, 0f, 0f, 0, 0, 0);
|
||||
}
|
||||
|
||||
// Send a Calamity dodge cooldown packet.
|
||||
if (Main.netMode == NetmodeID.MultiplayerClient && player.whoAmI == Main.myPlayer)
|
||||
SyncDodgeCooldown(false);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
@@ -4330,7 +4348,7 @@ namespace CalamityMod.CalPlayer
|
||||
deathCount++;
|
||||
if (player.whoAmI == Main.myPlayer && Main.netMode == NetmodeID.MultiplayerClient)
|
||||
{
|
||||
DeathPacket(false);
|
||||
SyncDeathCount(false);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -4677,7 +4695,10 @@ namespace CalamityMod.CalPlayer
|
||||
break;
|
||||
|
||||
case ItemID.AdamantiteSword:
|
||||
target.velocity *= 0.5f;
|
||||
float slowDownMult = 0.5f;
|
||||
if (CalamityLists.enemyImmunityList.Contains(target.type) || target.boss)
|
||||
slowDownMult = 0.95f;
|
||||
target.velocity *= slowDownMult;
|
||||
break;
|
||||
|
||||
case ItemID.CandyCaneSword:
|
||||
@@ -4775,7 +4796,10 @@ namespace CalamityMod.CalPlayer
|
||||
break;
|
||||
|
||||
case ProjectileID.AdamantiteGlaive:
|
||||
target.velocity *= 0.5f;
|
||||
float slowDownMult = 0.5f;
|
||||
if (CalamityLists.enemyImmunityList.Contains(target.type) || target.boss)
|
||||
slowDownMult = 0.95f;
|
||||
target.velocity *= slowDownMult;
|
||||
break;
|
||||
|
||||
case ProjectileID.FruitcakeChakram:
|
||||
@@ -5172,7 +5196,7 @@ namespace CalamityMod.CalPlayer
|
||||
shootFireworksLevelUpMelee = true;
|
||||
|
||||
if (Main.netMode == NetmodeID.MultiplayerClient)
|
||||
LevelPacket(false, (int)ClassType.Melee);
|
||||
SyncLevel(false, (int)ClassType.Melee);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5430,7 +5454,7 @@ namespace CalamityMod.CalPlayer
|
||||
shootFireworksLevelUpMelee = true;
|
||||
|
||||
if (Main.netMode == NetmodeID.MultiplayerClient)
|
||||
LevelPacket(false, (int)ClassType.Melee);
|
||||
SyncLevel(false, (int)ClassType.Melee);
|
||||
}
|
||||
else if (proj.ranged && rangedLevel <= 12500)
|
||||
{
|
||||
@@ -5451,7 +5475,7 @@ namespace CalamityMod.CalPlayer
|
||||
shootFireworksLevelUpRanged = true;
|
||||
|
||||
if (Main.netMode == NetmodeID.MultiplayerClient)
|
||||
LevelPacket(false, (int)ClassType.Ranged);
|
||||
SyncLevel(false, (int)ClassType.Ranged);
|
||||
}
|
||||
else if (proj.magic && magicLevel <= 12500)
|
||||
{
|
||||
@@ -5472,7 +5496,7 @@ namespace CalamityMod.CalPlayer
|
||||
shootFireworksLevelUpMagic = true;
|
||||
|
||||
if (Main.netMode == NetmodeID.MultiplayerClient)
|
||||
LevelPacket(false, (int)ClassType.Magic);
|
||||
SyncLevel(false, (int)ClassType.Magic);
|
||||
}
|
||||
else if (proj.IsSummon() && summonLevel <= 12500)
|
||||
{
|
||||
@@ -5493,7 +5517,7 @@ namespace CalamityMod.CalPlayer
|
||||
shootFireworksLevelUpSummon = true;
|
||||
|
||||
if (Main.netMode == NetmodeID.MultiplayerClient)
|
||||
LevelPacket(false, (int)ClassType.Summon);
|
||||
SyncLevel(false, (int)ClassType.Summon);
|
||||
}
|
||||
else if (proj.Calamity().rogue && rogueLevel <= 12500)
|
||||
{
|
||||
@@ -5514,7 +5538,7 @@ namespace CalamityMod.CalPlayer
|
||||
shootFireworksLevelUpRogue = true;
|
||||
|
||||
if (Main.netMode == NetmodeID.MultiplayerClient)
|
||||
LevelPacket(false, (int)ClassType.Rogue);
|
||||
SyncLevel(false, (int)ClassType.Rogue);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5806,9 +5830,10 @@ namespace CalamityMod.CalPlayer
|
||||
}
|
||||
}
|
||||
|
||||
if ((dodgeCooldownTimer + reflectCooldownTimer) == 0)
|
||||
if (dodgeCooldownTimer == 0)
|
||||
{
|
||||
if (projRefRare)
|
||||
// The Evolution
|
||||
if (projRefRare)
|
||||
{
|
||||
int damage2 = (int)(proj.damage * 10 * player.AverageDamage());
|
||||
proj.hostile = false;
|
||||
@@ -5834,9 +5859,15 @@ namespace CalamityMod.CalPlayer
|
||||
damage = 0;
|
||||
projRefRareLifeRegenCounter = 300;
|
||||
projTypeJustHitBy = proj.type;
|
||||
reflectCooldownTimer = 7200;
|
||||
return;
|
||||
|
||||
dodgeCooldownTimer = EvolutionReflectCooldown;
|
||||
// Send a Calamity dodge cooldown packet.
|
||||
if (Main.netMode == NetmodeID.MultiplayerClient && player.whoAmI == Main.myPlayer)
|
||||
SyncDodgeCooldown(false);
|
||||
return;
|
||||
}
|
||||
|
||||
// Arcanum of the Void
|
||||
else if (projRef)
|
||||
{
|
||||
int damage2 = (int)(proj.damage * 5 * player.AverageDamage());
|
||||
@@ -5861,9 +5892,15 @@ namespace CalamityMod.CalPlayer
|
||||
player.hurtCooldowns[j] = player.immuneTime;
|
||||
}
|
||||
damage = 0;
|
||||
reflectCooldownTimer = 5400;
|
||||
return;
|
||||
|
||||
dodgeCooldownTimer = ArcanumReflectCooldown;
|
||||
// Send a Calamity dodge cooldown packet.
|
||||
if (Main.netMode == NetmodeID.MultiplayerClient && player.whoAmI == Main.myPlayer)
|
||||
SyncDodgeCooldown(false);
|
||||
return;
|
||||
}
|
||||
|
||||
// Daedalus Melee set bonus
|
||||
else if (daedalusReflect)
|
||||
{
|
||||
int damage2 = (int)(proj.damage * player.AverageDamage());
|
||||
@@ -5887,8 +5924,14 @@ namespace CalamityMod.CalPlayer
|
||||
player.hurtCooldowns[j] = player.immuneTime;
|
||||
}
|
||||
damage /= 2;
|
||||
reflectCooldownTimer = 5400;
|
||||
}
|
||||
|
||||
dodgeCooldownTimer = DaedalusReflectCooldown;
|
||||
// Send a Calamity dodge cooldown packet.
|
||||
if (Main.netMode == NetmodeID.MultiplayerClient && player.whoAmI == Main.myPlayer)
|
||||
SyncDodgeCooldown(false);
|
||||
|
||||
// No return because the projectile hit isn't canceled -- it only does half damage.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7079,18 +7122,6 @@ namespace CalamityMod.CalPlayer
|
||||
if (HandleDodges())
|
||||
return false;
|
||||
|
||||
// New Black Belt and Master Ninja Gear code.
|
||||
if (dodgeCooldownTimer > 0)
|
||||
{
|
||||
player.blackBelt = false;
|
||||
}
|
||||
else if (player.blackBelt)
|
||||
{
|
||||
dodgeCooldownTimer = 3600;
|
||||
player.NinjaDodge();
|
||||
return false;
|
||||
}
|
||||
|
||||
// Lul makes the player completely invincible.
|
||||
if (lol)
|
||||
return false;
|
||||
@@ -7825,7 +7856,7 @@ namespace CalamityMod.CalPlayer
|
||||
deathCount++;
|
||||
if (player.whoAmI == Main.myPlayer && Main.netMode == NetmodeID.MultiplayerClient)
|
||||
{
|
||||
DeathPacket(false);
|
||||
SyncDeathCount(false);
|
||||
}
|
||||
player.lastDeathPostion = player.Center;
|
||||
player.lastDeathTime = DateTime.Now;
|
||||
@@ -8411,7 +8442,7 @@ namespace CalamityMod.CalPlayer
|
||||
}
|
||||
else if (dashMod == 3) //Elysian Aegis
|
||||
{
|
||||
if (DoADash(21.9f))
|
||||
if (DoADash(21.5f))
|
||||
{
|
||||
for (int d = 0; d < 40; d++)
|
||||
{
|
||||
@@ -8429,7 +8460,7 @@ namespace CalamityMod.CalPlayer
|
||||
}
|
||||
else if (dashMod == 4) //Asgardian Aegis
|
||||
{
|
||||
if (DoADash(22.7f))
|
||||
if (DoADash(23.3f))
|
||||
{
|
||||
for (int d = 0; d < 60; d++)
|
||||
{
|
||||
@@ -9095,361 +9126,6 @@ namespace CalamityMod.CalPlayer
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Packet Stuff
|
||||
private void ExactLevelPacket(bool server, int levelType)
|
||||
{
|
||||
ModPacket packet = mod.GetPacket(256);
|
||||
switch (levelType)
|
||||
{
|
||||
case 0:
|
||||
packet.Write((byte)CalamityModMessageType.ExactMeleeLevelSync);
|
||||
packet.Write(player.whoAmI);
|
||||
packet.Write(exactMeleeLevel);
|
||||
break;
|
||||
case 1:
|
||||
packet.Write((byte)CalamityModMessageType.ExactRangedLevelSync);
|
||||
packet.Write(player.whoAmI);
|
||||
packet.Write(exactRangedLevel);
|
||||
break;
|
||||
case 2:
|
||||
packet.Write((byte)CalamityModMessageType.ExactMagicLevelSync);
|
||||
packet.Write(player.whoAmI);
|
||||
packet.Write(exactMagicLevel);
|
||||
break;
|
||||
case 3:
|
||||
packet.Write((byte)CalamityModMessageType.ExactSummonLevelSync);
|
||||
packet.Write(player.whoAmI);
|
||||
packet.Write(exactSummonLevel);
|
||||
break;
|
||||
case 4:
|
||||
packet.Write((byte)CalamityModMessageType.ExactRogueLevelSync);
|
||||
packet.Write(player.whoAmI);
|
||||
packet.Write(exactRogueLevel);
|
||||
break;
|
||||
}
|
||||
|
||||
if (!server)
|
||||
packet.Send();
|
||||
else
|
||||
packet.Send(-1, player.whoAmI);
|
||||
}
|
||||
|
||||
private void LevelPacket(bool server, int levelType)
|
||||
{
|
||||
ModPacket packet = mod.GetPacket(256);
|
||||
switch (levelType)
|
||||
{
|
||||
case 0:
|
||||
packet.Write((byte)CalamityModMessageType.MeleeLevelSync);
|
||||
packet.Write(player.whoAmI);
|
||||
packet.Write(meleeLevel);
|
||||
break;
|
||||
case 1:
|
||||
packet.Write((byte)CalamityModMessageType.RangedLevelSync);
|
||||
packet.Write(player.whoAmI);
|
||||
packet.Write(rangedLevel);
|
||||
break;
|
||||
case 2:
|
||||
packet.Write((byte)CalamityModMessageType.MagicLevelSync);
|
||||
packet.Write(player.whoAmI);
|
||||
packet.Write(magicLevel);
|
||||
break;
|
||||
case 3:
|
||||
packet.Write((byte)CalamityModMessageType.SummonLevelSync);
|
||||
packet.Write(player.whoAmI);
|
||||
packet.Write(summonLevel);
|
||||
break;
|
||||
case 4:
|
||||
packet.Write((byte)CalamityModMessageType.RogueLevelSync);
|
||||
packet.Write(player.whoAmI);
|
||||
packet.Write(rogueLevel);
|
||||
break;
|
||||
}
|
||||
|
||||
if (!server)
|
||||
packet.Send();
|
||||
else
|
||||
packet.Send(-1, player.whoAmI);
|
||||
}
|
||||
|
||||
public void RagePacket(bool server)
|
||||
{
|
||||
ModPacket packet = mod.GetPacket(256);
|
||||
packet.Write((byte)CalamityModMessageType.RageSync);
|
||||
packet.Write(player.whoAmI);
|
||||
packet.Write(rage);
|
||||
|
||||
if (!server)
|
||||
packet.Send();
|
||||
else
|
||||
packet.Send(-1, player.whoAmI);
|
||||
}
|
||||
|
||||
public void AdrenalinePacket(bool server)
|
||||
{
|
||||
ModPacket packet = mod.GetPacket(256);
|
||||
packet.Write((byte)CalamityModMessageType.AdrenalineSync);
|
||||
packet.Write(player.whoAmI);
|
||||
packet.Write(adrenaline);
|
||||
|
||||
if (!server)
|
||||
packet.Send();
|
||||
else
|
||||
packet.Send(-1, player.whoAmI);
|
||||
}
|
||||
|
||||
private void DeathPacket(bool server)
|
||||
{
|
||||
ModPacket packet = mod.GetPacket(256);
|
||||
packet.Write((byte)CalamityModMessageType.DeathCountSync);
|
||||
packet.Write(player.whoAmI);
|
||||
packet.Write(deathCount);
|
||||
|
||||
if (!server)
|
||||
packet.Send();
|
||||
else
|
||||
packet.Send(-1, player.whoAmI);
|
||||
}
|
||||
|
||||
public void DeathModeUnderworldTimePacket(bool server)
|
||||
{
|
||||
ModPacket packet = mod.GetPacket(256);
|
||||
packet.Write((byte)CalamityModMessageType.DeathModeUnderworldTimeSync);
|
||||
packet.Write(player.whoAmI);
|
||||
packet.Write(deathModeUnderworldTime);
|
||||
|
||||
if (!server)
|
||||
packet.Send();
|
||||
else
|
||||
packet.Send(-1, player.whoAmI);
|
||||
}
|
||||
|
||||
public void DeathModeBlizzardTimePacket(bool server)
|
||||
{
|
||||
ModPacket packet = mod.GetPacket(256);
|
||||
packet.Write((byte)CalamityModMessageType.DeathModeBlizzardTimeSync);
|
||||
packet.Write(player.whoAmI);
|
||||
packet.Write(deathModeBlizzardTime);
|
||||
|
||||
if (!server)
|
||||
packet.Send();
|
||||
else
|
||||
packet.Send(-1, player.whoAmI);
|
||||
}
|
||||
|
||||
public void ItemTypeLastReforgedPacket(bool server)
|
||||
{
|
||||
ModPacket packet = mod.GetPacket(256);
|
||||
packet.Write((byte)CalamityModMessageType.ItemTypeLastReforgedSync);
|
||||
packet.Write(player.whoAmI);
|
||||
packet.Write(itemTypeLastReforged);
|
||||
|
||||
if (!server)
|
||||
packet.Send();
|
||||
else
|
||||
packet.Send(-1, player.whoAmI);
|
||||
}
|
||||
|
||||
public void ReforgeTierSafetyPacket(bool server)
|
||||
{
|
||||
ModPacket packet = mod.GetPacket(256);
|
||||
packet.Write((byte)CalamityModMessageType.ReforgeTierSafetySync);
|
||||
packet.Write(player.whoAmI);
|
||||
packet.Write(reforgeTierSafety);
|
||||
|
||||
if (!server)
|
||||
packet.Send();
|
||||
else
|
||||
packet.Send(-1, player.whoAmI);
|
||||
}
|
||||
|
||||
public void AquaticBoostPacket(bool server)
|
||||
{
|
||||
ModPacket packet = mod.GetPacket(256);
|
||||
packet.Write((byte)CalamityModMessageType.AquaticBoostSync);
|
||||
packet.Write(player.whoAmI);
|
||||
packet.Write(aquaticBoost);
|
||||
|
||||
if (!server)
|
||||
packet.Send();
|
||||
else
|
||||
packet.Send(-1, player.whoAmI);
|
||||
}
|
||||
|
||||
public void MoveSpeedStatPacket(bool server)
|
||||
{
|
||||
ModPacket packet = mod.GetPacket(256);
|
||||
packet.Write((byte)CalamityModMessageType.MoveSpeedStatSync);
|
||||
packet.Write(player.whoAmI);
|
||||
packet.Write(moveSpeedStat);
|
||||
|
||||
if (!server)
|
||||
packet.Send();
|
||||
else
|
||||
packet.Send(-1, player.whoAmI);
|
||||
}
|
||||
|
||||
public void DefenseDamagePacket(bool server)
|
||||
{
|
||||
ModPacket packet = mod.GetPacket(256);
|
||||
packet.Write((byte)CalamityModMessageType.DefenseDamageSync);
|
||||
packet.Write(player.whoAmI);
|
||||
packet.Write(defenseDamage);
|
||||
|
||||
if (!server)
|
||||
packet.Send();
|
||||
else
|
||||
packet.Send(-1, player.whoAmI);
|
||||
}
|
||||
|
||||
internal void HandleExactLevels(BinaryReader reader, int levelType)
|
||||
{
|
||||
switch (levelType)
|
||||
{
|
||||
case 0:
|
||||
exactMeleeLevel = reader.ReadInt32();
|
||||
break;
|
||||
case 1:
|
||||
exactRangedLevel = reader.ReadInt32();
|
||||
break;
|
||||
case 2:
|
||||
exactMagicLevel = reader.ReadInt32();
|
||||
break;
|
||||
case 3:
|
||||
exactSummonLevel = reader.ReadInt32();
|
||||
break;
|
||||
case 4:
|
||||
exactRogueLevel = reader.ReadInt32();
|
||||
break;
|
||||
}
|
||||
|
||||
if (Main.netMode == NetmodeID.Server)
|
||||
ExactLevelPacket(true, levelType);
|
||||
}
|
||||
|
||||
internal void HandleLevels(BinaryReader reader, int levelType)
|
||||
{
|
||||
switch (levelType)
|
||||
{
|
||||
case 0:
|
||||
meleeLevel = reader.ReadInt32();
|
||||
break;
|
||||
case 1:
|
||||
rangedLevel = reader.ReadInt32();
|
||||
break;
|
||||
case 2:
|
||||
magicLevel = reader.ReadInt32();
|
||||
break;
|
||||
case 3:
|
||||
summonLevel = reader.ReadInt32();
|
||||
break;
|
||||
case 4:
|
||||
rogueLevel = reader.ReadInt32();
|
||||
break;
|
||||
}
|
||||
|
||||
if (Main.netMode == NetmodeID.Server)
|
||||
LevelPacket(true, levelType);
|
||||
}
|
||||
|
||||
internal void HandleRage(BinaryReader reader)
|
||||
{
|
||||
rage = reader.ReadInt32();
|
||||
if (Main.netMode == NetmodeID.Server)
|
||||
RagePacket(true);
|
||||
}
|
||||
|
||||
internal void HandleAdrenaline(BinaryReader reader)
|
||||
{
|
||||
adrenaline = reader.ReadInt32();
|
||||
if (Main.netMode == NetmodeID.Server)
|
||||
AdrenalinePacket(true);
|
||||
}
|
||||
|
||||
internal void HandleDeathCount(BinaryReader reader)
|
||||
{
|
||||
deathCount = reader.ReadInt32();
|
||||
if (Main.netMode == NetmodeID.Server)
|
||||
DeathPacket(true);
|
||||
}
|
||||
|
||||
internal void HandleDeathModeUnderworldTime(BinaryReader reader)
|
||||
{
|
||||
deathModeUnderworldTime = reader.ReadInt32();
|
||||
if (Main.netMode == NetmodeID.Server)
|
||||
DeathModeUnderworldTimePacket(true);
|
||||
}
|
||||
|
||||
internal void HandleDeathModeBlizzardTime(BinaryReader reader)
|
||||
{
|
||||
deathModeBlizzardTime = reader.ReadInt32();
|
||||
if (Main.netMode == NetmodeID.Server)
|
||||
DeathModeBlizzardTimePacket(true);
|
||||
}
|
||||
|
||||
internal void HandleItemTypeLastReforged(BinaryReader reader)
|
||||
{
|
||||
itemTypeLastReforged = reader.ReadInt32();
|
||||
if (Main.netMode == NetmodeID.Server)
|
||||
ItemTypeLastReforgedPacket(true);
|
||||
}
|
||||
|
||||
internal void HandleReforgeTierSafety(BinaryReader reader)
|
||||
{
|
||||
reforgeTierSafety = reader.ReadInt32();
|
||||
if (Main.netMode == NetmodeID.Server)
|
||||
ReforgeTierSafetyPacket(true);
|
||||
}
|
||||
|
||||
internal void HandleAquaticBoost(BinaryReader reader)
|
||||
{
|
||||
aquaticBoost = reader.ReadSingle();
|
||||
if (Main.netMode == NetmodeID.Server)
|
||||
AquaticBoostPacket(true);
|
||||
}
|
||||
|
||||
internal void HandleMoveSpeedStat(BinaryReader reader)
|
||||
{
|
||||
moveSpeedStat = reader.ReadInt32();
|
||||
if (Main.netMode == NetmodeID.Server)
|
||||
MoveSpeedStatPacket(true);
|
||||
}
|
||||
|
||||
internal void HandleDefenseDamage(BinaryReader reader)
|
||||
{
|
||||
defenseDamage = reader.ReadInt32();
|
||||
if (Main.netMode == NetmodeID.Server)
|
||||
DefenseDamagePacket(true);
|
||||
}
|
||||
|
||||
public override void OnEnterWorld(Player player)
|
||||
{
|
||||
if (Main.netMode == NetmodeID.MultiplayerClient)
|
||||
{
|
||||
ExactLevelPacket(false, 0);
|
||||
ExactLevelPacket(false, 1);
|
||||
ExactLevelPacket(false, 2);
|
||||
ExactLevelPacket(false, 3);
|
||||
ExactLevelPacket(false, 4);
|
||||
LevelPacket(false, 0);
|
||||
LevelPacket(false, 1);
|
||||
LevelPacket(false, 2);
|
||||
LevelPacket(false, 3);
|
||||
LevelPacket(false, 4);
|
||||
RagePacket(false);
|
||||
AdrenalinePacket(false);
|
||||
DeathPacket(false);
|
||||
DeathModeUnderworldTimePacket(false);
|
||||
DeathModeBlizzardTimePacket(false);
|
||||
ItemTypeLastReforgedPacket(false);
|
||||
ReforgeTierSafetyPacket(false);
|
||||
AquaticBoostPacket(false);
|
||||
MoveSpeedStatPacket(false);
|
||||
DefenseDamagePacket(false);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Proficiency Stuff
|
||||
private bool ReduceCooldown(int classType)
|
||||
{
|
||||
@@ -9916,7 +9592,7 @@ namespace CalamityMod.CalPlayer
|
||||
}
|
||||
if (Main.netMode == NetmodeID.MultiplayerClient)
|
||||
{
|
||||
ExactLevelPacket(false, levelUpType);
|
||||
SyncExactLevel(false, levelUpType);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10479,6 +10155,13 @@ namespace CalamityMod.CalPlayer
|
||||
|
||||
#region Misc Stuff
|
||||
|
||||
// Triggers effects that must occur when the player enters the world. This sends a bunch of packets in multiplayer.
|
||||
public override void OnEnterWorld(Player player)
|
||||
{
|
||||
if (Main.netMode == NetmodeID.MultiplayerClient)
|
||||
EnterWorldSync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the range at which an abyss enemy can detect the player
|
||||
/// </summary>
|
||||
|
||||
@@ -109,6 +109,17 @@ namespace CalamityMod.CalPlayer
|
||||
|
||||
// Potions (Quick Buff && Potion Sickness)
|
||||
HandlePotions(player, modPlayer);
|
||||
|
||||
// Regularly sync player stats during multiplayer
|
||||
if (player.whoAmI == Main.myPlayer && Main.netMode == NetmodeID.MultiplayerClient)
|
||||
{
|
||||
modPlayer.packetTimer++;
|
||||
if (modPlayer.packetTimer == CalamityPlayer.GlobalSyncPacketTimer)
|
||||
{
|
||||
modPlayer.packetTimer = 0;
|
||||
modPlayer.StandardSync();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -253,24 +264,6 @@ namespace CalamityMod.CalPlayer
|
||||
modPlayer.rage = 0;
|
||||
modPlayer.adrenaline = 0;
|
||||
}
|
||||
|
||||
// Send info packets during multiplayer
|
||||
// TODO -- this should be moved to its own update step
|
||||
if (player.whoAmI == Main.myPlayer && Main.netMode == NetmodeID.MultiplayerClient)
|
||||
{
|
||||
modPlayer.packetTimer++;
|
||||
if (modPlayer.packetTimer == 60)
|
||||
{
|
||||
modPlayer.packetTimer = 0;
|
||||
modPlayer.RagePacket(false);
|
||||
modPlayer.AdrenalinePacket(false);
|
||||
modPlayer.DeathModeUnderworldTimePacket(false);
|
||||
modPlayer.DeathModeBlizzardTimePacket(false);
|
||||
modPlayer.AquaticBoostPacket(false);
|
||||
modPlayer.MoveSpeedStatPacket(false);
|
||||
modPlayer.DefenseDamagePacket(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void UpdateRippers(Mod mod, Player player, CalamityPlayer modPlayer)
|
||||
@@ -1077,8 +1070,6 @@ namespace CalamityMod.CalPlayer
|
||||
// Cooldowns and timers
|
||||
if (modPlayer.dodgeCooldownTimer > 0)
|
||||
modPlayer.dodgeCooldownTimer--;
|
||||
if (modPlayer.reflectCooldownTimer > 0)
|
||||
modPlayer.reflectCooldownTimer--;
|
||||
if (modPlayer.KameiBladeUseDelay > 0)
|
||||
modPlayer.KameiBladeUseDelay--;
|
||||
if (modPlayer.galileoCooldown > 0)
|
||||
|
||||
@@ -0,0 +1,322 @@
|
||||
using System.IO;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.CalPlayer
|
||||
{
|
||||
public partial class CalamityPlayer : ModPlayer
|
||||
{
|
||||
#region Standard Syncs
|
||||
internal const int GlobalSyncPacketTimer = 15;
|
||||
|
||||
internal void StandardSync()
|
||||
{
|
||||
SyncRage(false);
|
||||
SyncAdrenaline(false);
|
||||
SyncDeathModeUnderworldTime(false);
|
||||
SyncDeathModeBlizzardTime(false);
|
||||
SyncMoveSpeed(false);
|
||||
SyncDefenseDamage(false);
|
||||
SyncDodgeCooldown(false);
|
||||
}
|
||||
|
||||
private void EnterWorldSync()
|
||||
{
|
||||
StandardSync();
|
||||
SyncExactLevel(false, 0);
|
||||
SyncExactLevel(false, 1);
|
||||
SyncExactLevel(false, 2);
|
||||
SyncExactLevel(false, 3);
|
||||
SyncExactLevel(false, 4);
|
||||
SyncLevel(false, 0);
|
||||
SyncLevel(false, 1);
|
||||
SyncLevel(false, 2);
|
||||
SyncLevel(false, 3);
|
||||
SyncLevel(false, 4);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Creating and Sending Packets
|
||||
private void SyncExactLevel(bool server, int levelType)
|
||||
{
|
||||
ModPacket packet = mod.GetPacket();
|
||||
switch (levelType)
|
||||
{
|
||||
case 0:
|
||||
packet.Write((byte)CalamityModMessageType.ExactMeleeLevelSync);
|
||||
packet.Write(player.whoAmI);
|
||||
packet.Write(exactMeleeLevel);
|
||||
break;
|
||||
case 1:
|
||||
packet.Write((byte)CalamityModMessageType.ExactRangedLevelSync);
|
||||
packet.Write(player.whoAmI);
|
||||
packet.Write(exactRangedLevel);
|
||||
break;
|
||||
case 2:
|
||||
packet.Write((byte)CalamityModMessageType.ExactMagicLevelSync);
|
||||
packet.Write(player.whoAmI);
|
||||
packet.Write(exactMagicLevel);
|
||||
break;
|
||||
case 3:
|
||||
packet.Write((byte)CalamityModMessageType.ExactSummonLevelSync);
|
||||
packet.Write(player.whoAmI);
|
||||
packet.Write(exactSummonLevel);
|
||||
break;
|
||||
case 4:
|
||||
packet.Write((byte)CalamityModMessageType.ExactRogueLevelSync);
|
||||
packet.Write(player.whoAmI);
|
||||
packet.Write(exactRogueLevel);
|
||||
break;
|
||||
}
|
||||
player.SendPacket(packet, server);
|
||||
}
|
||||
|
||||
private void SyncLevel(bool server, int levelType)
|
||||
{
|
||||
ModPacket packet = mod.GetPacket(256);
|
||||
switch (levelType)
|
||||
{
|
||||
case 0:
|
||||
packet.Write((byte)CalamityModMessageType.MeleeLevelSync);
|
||||
packet.Write(player.whoAmI);
|
||||
packet.Write(meleeLevel);
|
||||
break;
|
||||
case 1:
|
||||
packet.Write((byte)CalamityModMessageType.RangedLevelSync);
|
||||
packet.Write(player.whoAmI);
|
||||
packet.Write(rangedLevel);
|
||||
break;
|
||||
case 2:
|
||||
packet.Write((byte)CalamityModMessageType.MagicLevelSync);
|
||||
packet.Write(player.whoAmI);
|
||||
packet.Write(magicLevel);
|
||||
break;
|
||||
case 3:
|
||||
packet.Write((byte)CalamityModMessageType.SummonLevelSync);
|
||||
packet.Write(player.whoAmI);
|
||||
packet.Write(summonLevel);
|
||||
break;
|
||||
case 4:
|
||||
packet.Write((byte)CalamityModMessageType.RogueLevelSync);
|
||||
packet.Write(player.whoAmI);
|
||||
packet.Write(rogueLevel);
|
||||
break;
|
||||
}
|
||||
player.SendPacket(packet, server);
|
||||
}
|
||||
|
||||
public void SyncMoveSpeed(bool server)
|
||||
{
|
||||
ModPacket packet = mod.GetPacket(256);
|
||||
packet.Write((byte)CalamityModMessageType.MoveSpeedStatSync);
|
||||
packet.Write(player.whoAmI);
|
||||
packet.Write(moveSpeedStat);
|
||||
player.SendPacket(packet, server);
|
||||
}
|
||||
|
||||
public void SyncDefenseDamage(bool server)
|
||||
{
|
||||
ModPacket packet = mod.GetPacket(256);
|
||||
packet.Write((byte)CalamityModMessageType.DefenseDamageSync);
|
||||
packet.Write(player.whoAmI);
|
||||
packet.Write(defenseDamage);
|
||||
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);
|
||||
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);
|
||||
}
|
||||
|
||||
internal void SyncDodgeCooldown(bool server)
|
||||
{
|
||||
ModPacket packet = mod.GetPacket();
|
||||
packet.Write((byte)CalamityModMessageType.DodgeCooldown);
|
||||
packet.Write(player.whoAmI);
|
||||
packet.Write(dodgeCooldownTimer);
|
||||
player.SendPacket(packet, server);
|
||||
}
|
||||
|
||||
private void SyncDeathCount(bool server)
|
||||
{
|
||||
ModPacket packet = mod.GetPacket(256);
|
||||
packet.Write((byte)CalamityModMessageType.DeathCountSync);
|
||||
packet.Write(player.whoAmI);
|
||||
packet.Write(deathCount);
|
||||
player.SendPacket(packet, server);
|
||||
}
|
||||
|
||||
public void SyncDeathModeUnderworldTime(bool server)
|
||||
{
|
||||
ModPacket packet = mod.GetPacket(256);
|
||||
packet.Write((byte)CalamityModMessageType.DeathModeUnderworldTimeSync);
|
||||
packet.Write(player.whoAmI);
|
||||
packet.Write(deathModeUnderworldTime);
|
||||
player.SendPacket(packet, server);
|
||||
}
|
||||
|
||||
public void SyncDeathModeBlizzardTime(bool server)
|
||||
{
|
||||
ModPacket packet = mod.GetPacket(256);
|
||||
packet.Write((byte)CalamityModMessageType.DeathModeBlizzardTimeSync);
|
||||
packet.Write(player.whoAmI);
|
||||
packet.Write(deathModeBlizzardTime);
|
||||
player.SendPacket(packet, server);
|
||||
}
|
||||
|
||||
public void SyncItemTypeLastReforged(bool server)
|
||||
{
|
||||
ModPacket packet = mod.GetPacket(256);
|
||||
packet.Write((byte)CalamityModMessageType.ItemTypeLastReforgedSync);
|
||||
packet.Write(player.whoAmI);
|
||||
packet.Write(itemTypeLastReforged);
|
||||
player.SendPacket(packet, server);
|
||||
}
|
||||
|
||||
public void SyncReforgeTierSafety(bool server)
|
||||
{
|
||||
ModPacket packet = mod.GetPacket(256);
|
||||
packet.Write((byte)CalamityModMessageType.ReforgeTierSafetySync);
|
||||
packet.Write(player.whoAmI);
|
||||
packet.Write(reforgeTierSafety);
|
||||
player.SendPacket(packet, server);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Reading and Handling Packets
|
||||
internal void HandleExactLevels(BinaryReader reader, int levelType)
|
||||
{
|
||||
switch (levelType)
|
||||
{
|
||||
case 0:
|
||||
exactMeleeLevel = reader.ReadInt32();
|
||||
break;
|
||||
case 1:
|
||||
exactRangedLevel = reader.ReadInt32();
|
||||
break;
|
||||
case 2:
|
||||
exactMagicLevel = reader.ReadInt32();
|
||||
break;
|
||||
case 3:
|
||||
exactSummonLevel = reader.ReadInt32();
|
||||
break;
|
||||
case 4:
|
||||
exactRogueLevel = reader.ReadInt32();
|
||||
break;
|
||||
}
|
||||
|
||||
if (Main.netMode == NetmodeID.Server)
|
||||
SyncExactLevel(true, levelType);
|
||||
}
|
||||
|
||||
internal void HandleLevels(BinaryReader reader, int levelType)
|
||||
{
|
||||
switch (levelType)
|
||||
{
|
||||
case 0:
|
||||
meleeLevel = reader.ReadInt32();
|
||||
break;
|
||||
case 1:
|
||||
rangedLevel = reader.ReadInt32();
|
||||
break;
|
||||
case 2:
|
||||
magicLevel = reader.ReadInt32();
|
||||
break;
|
||||
case 3:
|
||||
summonLevel = reader.ReadInt32();
|
||||
break;
|
||||
case 4:
|
||||
rogueLevel = reader.ReadInt32();
|
||||
break;
|
||||
}
|
||||
|
||||
if (Main.netMode == NetmodeID.Server)
|
||||
SyncLevel(true, levelType);
|
||||
}
|
||||
|
||||
internal void HandleRage(BinaryReader reader)
|
||||
{
|
||||
rage = reader.ReadInt32();
|
||||
if (Main.netMode == NetmodeID.Server)
|
||||
SyncRage(true);
|
||||
}
|
||||
|
||||
internal void HandleAdrenaline(BinaryReader reader)
|
||||
{
|
||||
adrenaline = reader.ReadInt32();
|
||||
if (Main.netMode == NetmodeID.Server)
|
||||
SyncAdrenaline(true);
|
||||
}
|
||||
|
||||
internal void HandleDeathCount(BinaryReader reader)
|
||||
{
|
||||
deathCount = reader.ReadInt32();
|
||||
if (Main.netMode == NetmodeID.Server)
|
||||
SyncDeathCount(true);
|
||||
}
|
||||
|
||||
internal void HandleDeathModeUnderworldTime(BinaryReader reader)
|
||||
{
|
||||
deathModeUnderworldTime = reader.ReadInt32();
|
||||
if (Main.netMode == NetmodeID.Server)
|
||||
SyncDeathModeUnderworldTime(true);
|
||||
}
|
||||
|
||||
internal void HandleDeathModeBlizzardTime(BinaryReader reader)
|
||||
{
|
||||
deathModeBlizzardTime = reader.ReadInt32();
|
||||
if (Main.netMode == NetmodeID.Server)
|
||||
SyncDeathModeBlizzardTime(true);
|
||||
}
|
||||
|
||||
internal void HandleItemTypeLastReforged(BinaryReader reader)
|
||||
{
|
||||
itemTypeLastReforged = reader.ReadInt32();
|
||||
if (Main.netMode == NetmodeID.Server)
|
||||
SyncItemTypeLastReforged(true);
|
||||
}
|
||||
|
||||
internal void HandleReforgeTierSafety(BinaryReader reader)
|
||||
{
|
||||
reforgeTierSafety = reader.ReadInt32();
|
||||
if (Main.netMode == NetmodeID.Server)
|
||||
SyncReforgeTierSafety(true);
|
||||
}
|
||||
|
||||
internal void HandleMoveSpeedStat(BinaryReader reader)
|
||||
{
|
||||
moveSpeedStat = reader.ReadInt32();
|
||||
if (Main.netMode == NetmodeID.Server)
|
||||
SyncMoveSpeed(true);
|
||||
}
|
||||
|
||||
internal void HandleDefenseDamage(BinaryReader reader)
|
||||
{
|
||||
defenseDamage = reader.ReadInt32();
|
||||
if (Main.netMode == NetmodeID.Server)
|
||||
SyncDefenseDamage(true);
|
||||
}
|
||||
|
||||
internal void HandleDodgeCooldown(BinaryReader reader)
|
||||
{
|
||||
dodgeCooldownTimer = reader.ReadInt32();
|
||||
if (Main.netMode == NetmodeID.Server)
|
||||
SyncDodgeCooldown(true);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
+3
-2
@@ -254,7 +254,7 @@ namespace CalamityMod
|
||||
"Vroomy Has -3,000 IQ",
|
||||
"The Goliath",
|
||||
"DaPyRo",
|
||||
"Termi",
|
||||
"Takeru",
|
||||
"Circuit-Jay",
|
||||
"Commmander Frostbite",
|
||||
"cytokat",
|
||||
@@ -548,7 +548,8 @@ namespace CalamityMod
|
||||
NPCType<SlimeGod>(),
|
||||
NPCType<SlimeGodRun>(),
|
||||
NPCType<SlimeGodSplit>(),
|
||||
NPCType<SlimeGodRunSplit>()
|
||||
NPCType<SlimeGodRunSplit>(),
|
||||
NPCType<BobbitWormHead>()
|
||||
};
|
||||
|
||||
confusionEnemyList = new List<int>()
|
||||
|
||||
+163
-166
@@ -1,7 +1,6 @@
|
||||
using CalamityMod.Events;
|
||||
using CalamityMod.NPCs;
|
||||
using CalamityMod.NPCs.NormalNPCs;
|
||||
using CalamityMod.NPCs.OldDuke;
|
||||
using CalamityMod.NPCs.Providence;
|
||||
using CalamityMod.TileEntities;
|
||||
using CalamityMod.World;
|
||||
@@ -22,6 +21,10 @@ namespace CalamityMod
|
||||
CalamityModMessageType msgType = (CalamityModMessageType)reader.ReadByte();
|
||||
switch (msgType)
|
||||
{
|
||||
//
|
||||
// Proficiency levels
|
||||
//
|
||||
|
||||
case CalamityModMessageType.MeleeLevelSync:
|
||||
Main.player[reader.ReadInt32()].Calamity().HandleLevels(reader, 0);
|
||||
break;
|
||||
@@ -52,116 +55,34 @@ namespace CalamityMod
|
||||
case CalamityModMessageType.ExactRogueLevelSync:
|
||||
Main.player[reader.ReadInt32()].Calamity().HandleExactLevels(reader, 4);
|
||||
break;
|
||||
|
||||
//
|
||||
// Core stat syncs
|
||||
//
|
||||
|
||||
case CalamityModMessageType.MoveSpeedStatSync:
|
||||
Main.player[reader.ReadInt32()].Calamity().HandleMoveSpeedStat(reader);
|
||||
break;
|
||||
case CalamityModMessageType.DefenseDamageSync:
|
||||
Main.player[reader.ReadInt32()].Calamity().HandleDefenseDamage(reader);
|
||||
break;
|
||||
case CalamityModMessageType.RageSync:
|
||||
Main.player[reader.ReadInt32()].Calamity().HandleRage(reader);
|
||||
break;
|
||||
case CalamityModMessageType.BossRushStage:
|
||||
int stage = reader.ReadInt32();
|
||||
BossRushEvent.BossRushStage = stage;
|
||||
break;
|
||||
case CalamityModMessageType.AdrenalineSync:
|
||||
Main.player[reader.ReadInt32()].Calamity().HandleAdrenaline(reader);
|
||||
break;
|
||||
case CalamityModMessageType.TeleportPlayer:
|
||||
Main.player[reader.ReadInt32()].Calamity().HandleTeleport(reader.ReadInt32(), true, whoAmI);
|
||||
break;
|
||||
case CalamityModMessageType.DoGCountdownSync:
|
||||
int countdown = reader.ReadInt32();
|
||||
CalamityWorld.DoGSecondStageCountdown = countdown;
|
||||
break;
|
||||
case CalamityModMessageType.BossSpawnCountdownSync:
|
||||
int countdown2 = reader.ReadInt32();
|
||||
CalamityWorld.bossSpawnCountdown = countdown2;
|
||||
break;
|
||||
case CalamityModMessageType.BRHostileProjKillSync:
|
||||
int countdown3 = reader.ReadInt32();
|
||||
CalamityWorld.bossRushHostileProjKillCounter = countdown3;
|
||||
break;
|
||||
case CalamityModMessageType.DeathBossSpawnCountdownSync:
|
||||
int countdown4 = reader.ReadInt32();
|
||||
CalamityWorld.deathBossSpawnCooldown = countdown4;
|
||||
break;
|
||||
case CalamityModMessageType.ArmoredDiggerCountdownSync:
|
||||
int countdown5 = reader.ReadInt32();
|
||||
CalamityWorld.ArmoredDiggerSpawnCooldown = countdown5;
|
||||
break;
|
||||
case CalamityModMessageType.BossTypeSync:
|
||||
int type = reader.ReadInt32();
|
||||
CalamityWorld.bossType = type;
|
||||
case CalamityModMessageType.DodgeCooldown:
|
||||
Main.player[reader.ReadInt32()].Calamity().HandleDodgeCooldown(reader);
|
||||
break;
|
||||
case CalamityModMessageType.DeathCountSync:
|
||||
Main.player[reader.ReadInt32()].Calamity().HandleDeathCount(reader);
|
||||
break;
|
||||
case CalamityModMessageType.DeathModeUnderworldTimeSync:
|
||||
Main.player[reader.ReadInt32()].Calamity().HandleDeathModeUnderworldTime(reader);
|
||||
break;
|
||||
case CalamityModMessageType.DeathModeBlizzardTimeSync:
|
||||
Main.player[reader.ReadInt32()].Calamity().HandleDeathModeBlizzardTime(reader);
|
||||
break;
|
||||
case CalamityModMessageType.ItemTypeLastReforgedSync:
|
||||
Main.player[reader.ReadInt32()].Calamity().HandleItemTypeLastReforged(reader);
|
||||
break;
|
||||
case CalamityModMessageType.ReforgeTierSafetySync:
|
||||
Main.player[reader.ReadInt32()].Calamity().HandleReforgeTierSafety(reader);
|
||||
break;
|
||||
/*case CalamityModMessageType.AquaticBoostSync:
|
||||
Main.player[reader.ReadInt32()].Calamity().HandleAquaticBoost(reader);
|
||||
break;*/
|
||||
case CalamityModMessageType.MoveSpeedStatSync:
|
||||
Main.player[reader.ReadInt32()].Calamity().HandleMoveSpeedStat(reader);
|
||||
break;
|
||||
case CalamityModMessageType.DefenseDamageSync:
|
||||
Main.player[reader.ReadInt32()].Calamity().HandleDefenseDamage(reader);
|
||||
break;
|
||||
case CalamityModMessageType.NPCRegenerationSync:
|
||||
byte npcIndex = reader.ReadByte();
|
||||
Main.npc[npcIndex].lifeRegen = reader.ReadInt32();
|
||||
break;
|
||||
case CalamityModMessageType.AcidRainSync:
|
||||
CalamityWorld.rainingAcid = reader.ReadBoolean();
|
||||
CalamityWorld.acidRainPoints = reader.ReadInt32();
|
||||
CalamityWorld.timeSinceAcidRainKill = reader.ReadInt32();
|
||||
break;
|
||||
case CalamityModMessageType.AcidRainUIDrawFadeSync:
|
||||
CalamityWorld.acidRainExtraDrawTime = reader.ReadInt32();
|
||||
break;
|
||||
case CalamityModMessageType.AcidRainOldDukeSummonSync:
|
||||
CalamityWorld.triedToSummonOldDuke = reader.ReadBoolean();
|
||||
break;
|
||||
case CalamityModMessageType.EncounteredOldDukeSync:
|
||||
CalamityWorld.encounteredOldDuke = reader.ReadBoolean();
|
||||
break;
|
||||
case CalamityModMessageType.GaelsGreatswordSwingSync:
|
||||
byte playerIndex = reader.ReadByte();
|
||||
Main.player[playerIndex].Calamity().gaelSwipes = reader.ReadInt32();
|
||||
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(x, y, ModContent.NPCType<SuperDummyNPC>());
|
||||
break;
|
||||
|
||||
|
||||
//
|
||||
// Ozzatron's packets
|
||||
// Syncs for specific bosses or entities
|
||||
//
|
||||
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;
|
||||
|
||||
// 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
|
||||
@@ -182,8 +103,25 @@ namespace CalamityMod
|
||||
cgn.newAI[2] = ai2;
|
||||
cgn.newAI[3] = ai3;
|
||||
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(x, y, ModContent.NPCType<SuperDummyNPC>());
|
||||
break;
|
||||
case CalamityModMessageType.ServersideSpawnOldDuke:
|
||||
byte playerIndex2 = reader.ReadByte();
|
||||
CalamityUtils.SpawnOldDuke(playerIndex2);
|
||||
break;
|
||||
case CalamityModMessageType.DoGCountdownSync:
|
||||
int countdown = reader.ReadInt32();
|
||||
CalamityWorld.DoGSecondStageCountdown = countdown;
|
||||
break;
|
||||
case CalamityModMessageType.ArmoredDiggerCountdownSync:
|
||||
int countdown5 = reader.ReadInt32();
|
||||
CalamityWorld.ArmoredDiggerSpawnCooldown = countdown5;
|
||||
break;
|
||||
case CalamityModMessageType.ProvidenceDyeConditionSync:
|
||||
byte npcIndex3 = reader.ReadByte();
|
||||
(Main.npc[npcIndex3].modNPC as Providence).hasTakenDaytimeDamage = reader.ReadBoolean();
|
||||
@@ -193,37 +131,99 @@ namespace CalamityMod
|
||||
(Main.npc[npcIndex4].modNPC as Providence).challenge = reader.ReadBoolean();
|
||||
break;
|
||||
|
||||
case CalamityModMessageType.ServersideSpawnOldDuke:
|
||||
byte playerIndex2 = reader.ReadByte();
|
||||
//
|
||||
// Tile Entities
|
||||
//
|
||||
|
||||
if (Main.netMode != NetmodeID.Server)
|
||||
break;
|
||||
|
||||
Player player = Main.player[playerIndex2];
|
||||
if (!player.active || player.dead)
|
||||
return;
|
||||
|
||||
Projectile projectile = null;
|
||||
for (int i = 0; i < Main.maxProjectiles; i++)
|
||||
{
|
||||
projectile = Main.projectile[i];
|
||||
if (Main.projectile[i].active && Main.projectile[i].bobber && Main.projectile[i].owner == playerIndex2)
|
||||
{
|
||||
projectile = Main.projectile[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (projectile is null)
|
||||
return;
|
||||
|
||||
int oldDuke = NPC.NewNPC((int)projectile.Center.X, (int)projectile.Center.Y + 100, ModContent.NPCType<OldDuke>());
|
||||
CalamityUtils.BossAwakenMessage(oldDuke);
|
||||
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;
|
||||
|
||||
//
|
||||
// Boss Rush
|
||||
//
|
||||
|
||||
case CalamityModMessageType.BossRushStage:
|
||||
int stage = reader.ReadInt32();
|
||||
BossRushEvent.BossRushStage = stage;
|
||||
break;
|
||||
case CalamityModMessageType.BossSpawnCountdownSync:
|
||||
int countdown2 = reader.ReadInt32();
|
||||
CalamityWorld.bossSpawnCountdown = countdown2;
|
||||
break;
|
||||
case CalamityModMessageType.BossTypeSync:
|
||||
int type = reader.ReadInt32();
|
||||
CalamityWorld.bossType = type;
|
||||
break;
|
||||
case CalamityModMessageType.BRHostileProjKillSync:
|
||||
int countdown3 = reader.ReadInt32();
|
||||
CalamityWorld.bossRushHostileProjKillCounter = countdown3;
|
||||
break;
|
||||
case CalamityModMessageType.TeleportPlayer:
|
||||
Main.player[reader.ReadInt32()].Calamity().HandleTeleport(reader.ReadInt32(), true, whoAmI);
|
||||
break;
|
||||
|
||||
//
|
||||
// Acid Rain
|
||||
//
|
||||
|
||||
case CalamityModMessageType.AcidRainSync:
|
||||
CalamityWorld.rainingAcid = reader.ReadBoolean();
|
||||
CalamityWorld.acidRainPoints = reader.ReadInt32();
|
||||
CalamityWorld.timeSinceAcidRainKill = reader.ReadInt32();
|
||||
break;
|
||||
case CalamityModMessageType.AcidRainOldDukeSummonSync:
|
||||
CalamityWorld.triedToSummonOldDuke = reader.ReadBoolean();
|
||||
break;
|
||||
case CalamityModMessageType.EncounteredOldDukeSync:
|
||||
CalamityWorld.encounteredOldDuke = reader.ReadBoolean();
|
||||
break;
|
||||
|
||||
//
|
||||
// Death Mode environmental syncs
|
||||
//
|
||||
|
||||
case CalamityModMessageType.DeathModeUnderworldTimeSync:
|
||||
Main.player[reader.ReadInt32()].Calamity().HandleDeathModeUnderworldTime(reader);
|
||||
break;
|
||||
case CalamityModMessageType.DeathModeBlizzardTimeSync:
|
||||
Main.player[reader.ReadInt32()].Calamity().HandleDeathModeBlizzardTime(reader);
|
||||
break;
|
||||
case CalamityModMessageType.DeathBossSpawnCountdownSync:
|
||||
int countdown4 = reader.ReadInt32();
|
||||
CalamityWorld.deathBossSpawnCooldown = countdown4;
|
||||
break;
|
||||
|
||||
//
|
||||
// Reforge syncs
|
||||
//
|
||||
|
||||
case CalamityModMessageType.ItemTypeLastReforgedSync:
|
||||
Main.player[reader.ReadInt32()].Calamity().HandleItemTypeLastReforged(reader);
|
||||
break;
|
||||
case CalamityModMessageType.ReforgeTierSafetySync:
|
||||
Main.player[reader.ReadInt32()].Calamity().HandleReforgeTierSafety(reader);
|
||||
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}.");
|
||||
break;
|
||||
throw new Exception("Failed to parse Calamity packet: Invalid Calamity packet ID.");
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
@@ -248,65 +248,62 @@ namespace CalamityMod
|
||||
|
||||
public enum CalamityModMessageType : byte
|
||||
{
|
||||
// Proficiency levels
|
||||
// TODO -- simplify proficiency netcode, there do not need to be this many separate packet types
|
||||
MeleeLevelSync,
|
||||
RangedLevelSync,
|
||||
MagicLevelSync,
|
||||
SummonLevelSync,
|
||||
RogueLevelSync,
|
||||
|
||||
ExactMeleeLevelSync,
|
||||
ExactRangedLevelSync,
|
||||
ExactMagicLevelSync,
|
||||
ExactSummonLevelSync,
|
||||
ExactRogueLevelSync,
|
||||
|
||||
MoveSpeedStatSync,
|
||||
// Core stat syncs
|
||||
MoveSpeedStatSync, // TODO -- this can't be synced every 60 frames, it needs to be synced every time the player is
|
||||
DefenseDamageSync, // TODO -- this can't be synced every 60 frames, it needs to be synced when the player gets hit, or every time it heals up
|
||||
RageSync, // TODO -- this can't be synced every 60 frames, it needs to be synced every time the player is
|
||||
AdrenalineSync, // TODO -- this can't be synced every 60 frames, it needs to be synced every time the player is
|
||||
DodgeCooldown,
|
||||
DeathCountSync, // TODO -- this is synced in numerous incorrect places, Armageddon deaths count twice, and it supposedly counts every time you log in
|
||||
|
||||
DefenseDamageSync,
|
||||
|
||||
RageSync,
|
||||
AdrenalineSync,
|
||||
|
||||
AquaticBoostSync,
|
||||
|
||||
TeleportPlayer,
|
||||
BossRushStage,
|
||||
DoGCountdownSync,
|
||||
BossSpawnCountdownSync,
|
||||
BRHostileProjKillSync,
|
||||
ArmoredDiggerCountdownSync,
|
||||
BossTypeSync,
|
||||
DeathCountSync,
|
||||
|
||||
NPCRegenerationSync,
|
||||
|
||||
DeathModeUnderworldTimeSync,
|
||||
DeathModeBlizzardTimeSync,
|
||||
DeathBossSpawnCountdownSync,
|
||||
|
||||
ItemTypeLastReforgedSync,
|
||||
ReforgeTierSafetySync,
|
||||
|
||||
AcidRainSync,
|
||||
AcidRainUIDrawFadeSync,
|
||||
AcidRainOldDukeSummonSync,
|
||||
EncounteredOldDukeSync,
|
||||
|
||||
GaelsGreatswordSwingSync,
|
||||
|
||||
SpawnSuperDummy,
|
||||
// Syncs for specific bosses or entities
|
||||
SyncCalamityNPCAIArray,
|
||||
SpawnSuperDummy, // TODO -- super dummies STILL don't work in multiplayer
|
||||
ServersideSpawnOldDuke,
|
||||
DoGCountdownSync, // TODO -- this gets written in about six thousand places which all need to be individually evaluated
|
||||
ArmoredDiggerCountdownSync, // TODO -- remove this mechanic entirely
|
||||
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
|
||||
|
||||
ProvidenceDyeConditionSync, // We shouldn't fucking need this. Die in a hole, Multiplayer.
|
||||
PSCChallengeSync, // See above
|
||||
|
||||
// These message types were written by Ozz. They are Ozz's working tile entity netcode. Do not touch them.
|
||||
// Tile Entities
|
||||
PowerCellFactory,
|
||||
ChargingStationStandard,
|
||||
ChargingStationItemChange,
|
||||
Turret,
|
||||
LabHologramProjector,
|
||||
|
||||
ServersideSpawnOldDuke
|
||||
// Boss Rush
|
||||
BossRushStage,
|
||||
BossSpawnCountdownSync,
|
||||
BossTypeSync,
|
||||
BRHostileProjKillSync, // TODO -- Simplify this. Only one packet needs be sent: "kill all hostile projectiles for N frames".
|
||||
TeleportPlayer, // also used by Astral Arcanum.
|
||||
|
||||
// Acid Rain
|
||||
AcidRainSync,
|
||||
AcidRainOldDukeSummonSync,
|
||||
EncounteredOldDukeSync,
|
||||
|
||||
// Death Mode environmental syncs
|
||||
DeathModeUnderworldTimeSync, // TODO -- Rename to heat time. This should be synced every 15 frames.
|
||||
DeathModeBlizzardTimeSync, // TODO -- Rename to cold time. This should be synced every 15 frames.
|
||||
DeathBossSpawnCountdownSync, // TODO -- This currently syncs every frame and shouldn't. It only needs to sync once, when the countdown starts.
|
||||
|
||||
// Reforge syncs
|
||||
ItemTypeLastReforgedSync, // TODO -- there has to be a better way to do this, but I don't know what it is
|
||||
ReforgeTierSafetySync,
|
||||
}
|
||||
}
|
||||
@@ -189,7 +189,6 @@ namespace CalamityMod.Events
|
||||
{
|
||||
CalamityWorld.rainingAcid = false;
|
||||
BroadcastEventText("Mods.CalamityMod.AcidRainEnd"); // The sulphuric skies begin to clear...
|
||||
CalamityWorld.acidRainExtraDrawTime = 40;
|
||||
|
||||
// Turn off the rain from the event
|
||||
Main.numCloudsTemp = Main.rand.Next(5, 20 + 1);
|
||||
@@ -221,13 +220,6 @@ namespace CalamityMod.Events
|
||||
netMessage.Send();
|
||||
}
|
||||
if (Main.netMode == NetmodeID.Server)
|
||||
{
|
||||
var netMessage = CalamityMod.Instance.GetPacket();
|
||||
netMessage.Write((byte)CalamityModMessageType.AcidRainUIDrawFadeSync);
|
||||
netMessage.Write(CalamityWorld.acidRainExtraDrawTime);
|
||||
netMessage.Send();
|
||||
}
|
||||
if (Main.netMode == NetmodeID.Server)
|
||||
{
|
||||
var netMessage = CalamityMod.Instance.GetPacket();
|
||||
netMessage.Write((byte)CalamityModMessageType.AcidRainOldDukeSummonSync);
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using CalamityMod.CalPlayer;
|
||||
using CalamityMod.Tiles.DraedonStructures;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
@@ -9,6 +10,7 @@ using System.Reflection;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.Utilities;
|
||||
using Terraria.World.Generation;
|
||||
|
||||
namespace CalamityMod.ILEditing
|
||||
@@ -50,6 +52,7 @@ namespace CalamityMod.ILEditing
|
||||
aLabDoorClosed = ModContent.TileType<AgedLaboratoryDoorClosed>();
|
||||
|
||||
ApplyLifeBytesChanges();
|
||||
RemoveRNGFromBlackBelt();
|
||||
ApplyBossZenDuringSlimeRain();
|
||||
PreventDungeonAbyssInteraction();
|
||||
BlockLivingTreesNearOcean();
|
||||
@@ -69,6 +72,47 @@ namespace CalamityMod.ILEditing
|
||||
#region IL Editing Routines
|
||||
private static void ApplyLifeBytesChanges() => On.Terraria.Main.InitLifeBytes += BossRushLifeBytes;
|
||||
|
||||
private static void RemoveRNGFromBlackBelt()
|
||||
{
|
||||
// Change the random chance of the Black Belt to 100%, but don't let it work if Calamity's cooldown is active.
|
||||
IL.Terraria.Player.Hurt += (il) =>
|
||||
{
|
||||
var cursor = new ILCursor(il);
|
||||
cursor.GotoNext(MoveType.Before, i => i.MatchLdcI4(10)); // 1 in 10 Main.rand call for Black Belt activation
|
||||
cursor.Remove();
|
||||
cursor.Emit(OpCodes.Ldc_I4_1); // Replace with Main.rand.Next(1), aka 100% chance
|
||||
|
||||
// Move forwards past the Main.rand.Next call now that it has been edited
|
||||
cursor.GotoNext(MoveType.After, i => i.MatchCallvirt<UnifiedRandom>("Next"));
|
||||
|
||||
// Load the player itself onto the stack so that it becomes an argument for the following delegate.
|
||||
cursor.Emit(OpCodes.Ldarg_0);
|
||||
|
||||
// Emit a delegate which places the player's Calamity dodge cooldown onto the stack.
|
||||
cursor.EmitDelegate<Func<Player, int>>((Player p) => p.Calamity().dodgeCooldownTimer);
|
||||
|
||||
// Bitwise OR the "RNG result" (always zero) with the dodge cooldown. This will only return zero if both values were zero.
|
||||
// The code path which calls NinjaDodge can ONLY occur if the result of this operation is zero,
|
||||
// because it is now the value checked by the immediately following branch-if-true.
|
||||
cursor.Emit(OpCodes.Or);
|
||||
|
||||
// Move forwards past the NinjaDodge call. We need to set the dodge cooldown here.
|
||||
cursor.GotoNext(MoveType.After, i => i.MatchCall<Player>("NinjaDodge"));
|
||||
|
||||
// Load the player itself onto the stack so that it becomes an argument for the following delegate.
|
||||
cursor.Emit(OpCodes.Ldarg_0);
|
||||
|
||||
// Emit a delegate which sets the player's Calamity dodge cooldown and sends a sync packet appropriately.
|
||||
cursor.EmitDelegate<Action<Player>>((Player p) =>
|
||||
{
|
||||
CalamityPlayer calPlayer = p.Calamity();
|
||||
calPlayer.dodgeCooldownTimer = CalamityPlayer.BeltDodgeCooldown;
|
||||
if (Main.netMode == NetmodeID.MultiplayerClient)
|
||||
calPlayer.SyncDodgeCooldown(false);
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
private static void ApplyBossZenDuringSlimeRain() => On.Terraria.NPC.SlimeRainSpawns += PreventBossSlimeRainSpawns;
|
||||
|
||||
private static void PreventDungeonAbyssInteraction()
|
||||
|
||||
@@ -15,8 +15,8 @@ namespace CalamityMod.Items.Accessories
|
||||
"Significantly reduces enemy aggression, even in the abyss\n" +
|
||||
"Stealth generates 30% faster when standing still and 20% faster while moving\n" +
|
||||
"Grants the ability to evade attacks, releasing a cloud of lumenyl fluid which damages and stuns nearby enemies\n" +
|
||||
"Evading an attack grants a lot of stealth\n" +
|
||||
"This evade has a 75 second cooldown and does not work while a reflection effect is on cooldown");
|
||||
"Evading an attack grants a lot of stealth but has a 75 second cooldown\n" +
|
||||
"This cooldown is shared with all other dodges and reflects");
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace CalamityMod.Items.Accessories
|
||||
DisplayName.SetDefault("Arcanum of the Void");
|
||||
Tooltip.SetDefault("You reflect projectiles when they hit you\n" +
|
||||
"Reflected projectiles deal 5 times damage to enemies and no damage to you\n" +
|
||||
"This effect has a 90 second cooldown and does not work while a non-dash dodge is on cooldown");
|
||||
"This reflect has a 90 second cooldown which is shared with all other dodges and reflects\n");
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
@@ -20,11 +20,11 @@ namespace CalamityMod.Items.Accessories
|
||||
item.width = 26;
|
||||
item.height = 26;
|
||||
item.accessory = true;
|
||||
item.value = CalamityGlobalItem.Rarity12BuyPrice;
|
||||
item.rare = ItemRarityID.Purple;
|
||||
item.Calamity().customRarity = CalamityRarity.Turquoise;
|
||||
item.expert = true;
|
||||
}
|
||||
item.value = CalamityGlobalItem.Rarity12BuyPrice;
|
||||
item.rare = ItemRarityID.Purple;
|
||||
item.Calamity().customRarity = CalamityRarity.Turquoise;
|
||||
item.expert = true;
|
||||
}
|
||||
|
||||
public override void UpdateAccessory(Player player, bool hideVisual)
|
||||
{
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace CalamityMod.Items.Accessories
|
||||
DisplayName.SetDefault("Asgardian Aegis");
|
||||
Tooltip.SetDefault("Grants immunity to fire blocks and knockback\n" +
|
||||
"Immune to most debuffs\n" +
|
||||
"+40 max life\n" +
|
||||
"+40 max life and increased life regeneration\n" +
|
||||
"Grants a supreme holy flame dash\n" +
|
||||
"Can be used to ram enemies\n" +
|
||||
"TOOLTIP LINE HERE\n" +
|
||||
@@ -54,6 +54,7 @@ namespace CalamityMod.Items.Accessories
|
||||
player.noKnockback = true;
|
||||
player.fireWalk = true;
|
||||
player.statLifeMax2 += 40;
|
||||
player.lifeRegen++;
|
||||
player.buffImmune[BuffID.Chilled] = true;
|
||||
player.buffImmune[BuffID.Frostburn] = true;
|
||||
player.buffImmune[BuffID.Weak] = true;
|
||||
|
||||
@@ -13,13 +13,13 @@ namespace CalamityMod.Items.Accessories
|
||||
{
|
||||
DisplayName.SetDefault("Astral Arcanum");
|
||||
Tooltip.SetDefault("Taking damage drops astral stars from the sky\n" +
|
||||
"Provides immunity to the astral infection debuff\n" +
|
||||
"You reflect projectiles when they hit you\n" +
|
||||
"Reflected projectiles deal 5 times damage to enemies and no damage to you\n" +
|
||||
"This reflection effect has a 90 second cooldown\n" +
|
||||
"Boosts life regen even while under the effects of a damaging debuff\n" +
|
||||
"While under the effects of a damaging debuff you will gain 20 defense\n" +
|
||||
"TOOLTIP LINE HERE");
|
||||
"Provides immunity to the astral infection debuff\n" +
|
||||
"You reflect projectiles when they hit you\n" +
|
||||
"Reflected projectiles deal 5 times damage to enemies and no damage to you\n" +
|
||||
"This reflect has a 90 second cooldown which is shared with all other dodges and reflects\n" +
|
||||
"Boosts life regen even while under the effects of a damaging debuff\n" +
|
||||
"While under the effects of a damaging debuff you will gain 20 defense\n" +
|
||||
"TOOLTIP LINE HERE");
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
|
||||
@@ -20,15 +20,15 @@ namespace CalamityMod.Items.Accessories
|
||||
"Stealth strikes have a 100% critical hit chance\n" +
|
||||
"Stealth strikes only expend 50% of your max stealth\n" +
|
||||
"Grants the ability to evade attacks in a blast of darksun light, which inflicts extreme damage in a wide area\n" +
|
||||
"Evading an attack grants full stealth\n" +
|
||||
"This evade has a 75 second cooldown and does not work while a reflection effect is on cooldown");
|
||||
"Evading an attack grants full stealth but has a 75 second cooldown\n" +
|
||||
"This cooldown is shared with all other dodges and reflects");
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
item.width = 38;
|
||||
item.height = 38;
|
||||
item.rare = ItemRarityID.Purple;
|
||||
item.rare = ItemRarityID.Purple;
|
||||
item.value = CalamityGlobalItem.Rarity14BuyPrice;
|
||||
item.Calamity().customRarity = CalamityRarity.DarkBlue;
|
||||
item.accessory = true;
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace CalamityMod.Items.Accessories
|
||||
DisplayName.SetDefault("Elysian Aegis");
|
||||
Tooltip.SetDefault("Blessed by the Profaned Flame\n" +
|
||||
"Grants immunity to fire blocks, knockback, and Holy Flames\n" +
|
||||
"+40 max life and increased life regen\n" +
|
||||
"+30 max life\n" +
|
||||
"Grants a supreme holy flame dash\n" +
|
||||
"Can be used to ram enemies\n" +
|
||||
"TOOLTIP LINE HERE\n" +
|
||||
@@ -53,8 +53,7 @@ namespace CalamityMod.Items.Accessories
|
||||
player.buffImmune[ModContent.BuffType<HolyFlames>()] = true;
|
||||
player.noKnockback = true;
|
||||
player.fireWalk = true;
|
||||
player.lifeRegen += 2;
|
||||
player.statLifeMax2 += 40;
|
||||
player.statLifeMax2 += 30;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,8 @@ namespace CalamityMod.Items.Accessories
|
||||
Tooltip.SetDefault("24% increased jump speed and allows constant jumping\n" +
|
||||
"Grants immunity to fall damage\n" +
|
||||
"Can climb walls, dash, and dodge attacks\n" +
|
||||
"The dodge has a 60 second cooldown and does not work while a reflection effect is on cooldown\n" +
|
||||
"The dodge has a 60 second cooldown\n" +
|
||||
"This cooldown is shared with all other dodges and reflects\n" +
|
||||
"Dashes leave homing scythes in your wake");
|
||||
Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(8, 3));
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
using CalamityMod.CalPlayer;
|
||||
using CalamityMod.Items.Materials;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
@@ -12,9 +11,10 @@ namespace CalamityMod.Items.Accessories
|
||||
{
|
||||
DisplayName.SetDefault("Statis' Ninja Belt");
|
||||
Tooltip.SetDefault("12% increased jump speed and allows constant jumping\n" +
|
||||
"Increased fall damage resistance by 35 blocks\n" +
|
||||
"Increased fall damage resistance by 35 blocks\n" +
|
||||
"Can climb walls, dash, and dodge attacks\n" +
|
||||
"The dodge has a 60 second cooldown and does not work while a reflection effect is on cooldown");
|
||||
"The dodge has a 60 second cooldown\n" +
|
||||
"This cooldown is shared with all other dodges and reflects");
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
@@ -28,12 +28,11 @@ namespace CalamityMod.Items.Accessories
|
||||
|
||||
public override void UpdateAccessory(Player player, bool hideVisual)
|
||||
{
|
||||
CalamityPlayer modPlayer = player.Calamity();
|
||||
player.autoJump = true;
|
||||
player.jumpSpeedBoost += 0.6f;
|
||||
player.extraFall += 35;
|
||||
player.blackBelt = true;
|
||||
player.dash = 1;
|
||||
player.dash = 1;
|
||||
player.spikedBoots = 2;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,9 +10,9 @@ namespace CalamityMod.Items.Accessories
|
||||
{
|
||||
DisplayName.SetDefault("The Evolution");
|
||||
Tooltip.SetDefault("You reflect projectiles when they hit you\n" +
|
||||
"Reflected projectiles deal 10 times damage to enemies and no damage to you\n" +
|
||||
"This reflection effect has a 120 second cooldown and does not work while a non-dash dodge is on cooldown\n" +
|
||||
"If this effect triggers you get a health regeneration boost for 5 seconds\n" +
|
||||
"Reflected projectiles deal 10 times damage to enemies and no damage to you\n" +
|
||||
"This reflect has a 120 second cooldown which is shared with all other dodges and reflects\n" +
|
||||
"If this effect triggers you get a health regeneration boost for 5 seconds\n" +
|
||||
"If the same enemy projectile type hits you again you will resist its damage by 15%");
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace CalamityMod.Items.Accessories
|
||||
{
|
||||
item.width = 26;
|
||||
item.height = 26;
|
||||
item.value = CalamityGlobalItem.Rarity12BuyPrice;
|
||||
item.value = CalamityGlobalItem.Rarity12BuyPrice;
|
||||
item.accessory = true;
|
||||
item.Calamity().customRarity = CalamityRarity.RareVariant;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using CalamityMod.Buffs.StatDebuffs;
|
||||
using CalamityMod.CalPlayer;
|
||||
using CalamityMod.Items.Accessories;
|
||||
using CalamityMod.Items.Materials;
|
||||
@@ -48,6 +49,7 @@ namespace CalamityMod.Items.Armor
|
||||
{
|
||||
CalamityPlayer modPlayer = player.Calamity();
|
||||
modPlayer.fBarrier = true;
|
||||
player.buffImmune[ModContent.BuffType<Irradiated>()] = true;
|
||||
player.statLifeMax2 += 100;
|
||||
player.allDamage += 0.08f;
|
||||
modPlayer.AllCritBoost(5);
|
||||
|
||||
@@ -41,8 +41,8 @@ namespace CalamityMod.Items.Armor
|
||||
player.setBonus = "5% increased melee damage\n" +
|
||||
"Enemies are more likely to target you\n" +
|
||||
"You reflect projectiles back at enemies\n" +
|
||||
"Reflected projectiles deal 50% less damage to you\n" +
|
||||
"This reflection has a 60 second cooldown and does not work while a non-dash dodge is on cooldown\n" +
|
||||
"Reflected projectiles deal 50% less damage to you\n" +
|
||||
"This reflect has a 60 second cooldown which is shared with all other dodges and reflects\n" +
|
||||
"If you reflect a projectile you are also healed for 1/5 of that projectile's damage";
|
||||
CalamityPlayer modPlayer = player.Calamity();
|
||||
modPlayer.daedalusReflect = true;
|
||||
@@ -62,9 +62,9 @@ namespace CalamityMod.Items.Armor
|
||||
{
|
||||
ModRecipe recipe = new ModRecipe(mod);
|
||||
recipe.AddIngredient(ModContent.ItemType<VerstaltiteBar>(), 8);
|
||||
recipe.AddIngredient(ItemID.CrystalShard, 6);
|
||||
recipe.AddIngredient(ModContent.ItemType<EssenceofEleum>());
|
||||
recipe.AddTile(TileID.MythrilAnvil);
|
||||
recipe.AddIngredient(ItemID.CrystalShard, 6);
|
||||
recipe.AddIngredient(ModContent.ItemType<EssenceofEleum>());
|
||||
recipe.AddTile(TileID.MythrilAnvil);
|
||||
recipe.SetResult(this);
|
||||
recipe.AddRecipe();
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using CalamityMod.Buffs.StatDebuffs;
|
||||
using CalamityMod.Items.Accessories;
|
||||
using CalamityMod.Items.Materials;
|
||||
using CalamityMod.Items.Placeables;
|
||||
@@ -14,7 +15,8 @@ namespace CalamityMod.Items.Armor
|
||||
{
|
||||
DisplayName.SetDefault("Silva Armor");
|
||||
Tooltip.SetDefault("+80 max life\n" +
|
||||
"12% increased damage and 8% increased critical strike chance");
|
||||
"12% increased damage and 8% increased critical strike chance\n" +
|
||||
"Grants immunity to the irradiated debuff");
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
@@ -32,6 +34,7 @@ namespace CalamityMod.Items.Armor
|
||||
player.statLifeMax2 += 80;
|
||||
player.allDamage += 0.12f;
|
||||
player.Calamity().AllCritBoost(8);
|
||||
player.buffImmune[ModContent.BuffType<Irradiated>()] = true;
|
||||
}
|
||||
|
||||
public override void AddRecipes()
|
||||
|
||||
@@ -1261,8 +1261,9 @@ namespace CalamityMod.Items
|
||||
{
|
||||
if (line2.mod == "Terraria" && line2.Name == "Tooltip0")
|
||||
line2.text = "Grants the ability to dodge attacks\n" +
|
||||
"This dodge has a 60 second cooldown and does not work while a reflection effect is on cooldown";
|
||||
}
|
||||
"The dodge has a 60 second cooldown which is shared with all other dodges and reflects";
|
||||
|
||||
}
|
||||
}
|
||||
if (item.type == ItemID.MasterNinjaGear)
|
||||
{
|
||||
@@ -1270,8 +1271,8 @@ namespace CalamityMod.Items
|
||||
{
|
||||
if (line2.mod == "Terraria" && line2.Name == "Tooltip1")
|
||||
line2.text = "Grants the ability to dodge attacks\n" +
|
||||
"This dodge has a 60 second cooldown and does not work while a reflection effect is on cooldown";
|
||||
}
|
||||
"The dodge has a 60 second cooldown which is shared with all other dodges and reflects";
|
||||
}
|
||||
}
|
||||
if (item.type == ItemID.CobaltSword || item.type == ItemID.CobaltNaginata)
|
||||
{
|
||||
|
||||
@@ -33,8 +33,8 @@ namespace CalamityMod.Items.TreasureBags
|
||||
{
|
||||
item.maxStack = 999;
|
||||
item.consumable = true;
|
||||
item.width = 24;
|
||||
item.height = 24;
|
||||
item.width = 36;
|
||||
item.height = 34;
|
||||
item.rare = ItemRarityID.Cyan;
|
||||
item.expert = true;
|
||||
}
|
||||
@@ -44,10 +44,7 @@ namespace CalamityMod.Items.TreasureBags
|
||||
item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/TreasureBags/DevourerofGodsBagGlow"));
|
||||
}
|
||||
|
||||
public override bool CanRightClick()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
public override bool CanRightClick() => true;
|
||||
|
||||
public override void PostUpdate() => CalamityUtils.ForceItemIntoWorld(item);
|
||||
|
||||
|
||||
@@ -31,8 +31,8 @@ namespace CalamityMod.Items.TreasureBags
|
||||
{
|
||||
item.maxStack = 999;
|
||||
item.consumable = true;
|
||||
item.width = 24;
|
||||
item.height = 24;
|
||||
item.width = 32;
|
||||
item.height = 34;
|
||||
item.rare = ItemRarityID.Cyan;
|
||||
item.expert = true;
|
||||
}
|
||||
|
||||
@@ -118,14 +118,6 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Main.netMode == NetmodeID.Server)
|
||||
{
|
||||
var netMessage = CalamityMod.Instance.GetPacket();
|
||||
netMessage.Write((byte)CalamityModMessageType.GaelsGreatswordSwingSync);
|
||||
netMessage.Write((byte)player.whoAmI);
|
||||
netMessage.Write(player.Calamity().gaelSwipes);
|
||||
netMessage.Send();
|
||||
}
|
||||
}
|
||||
}
|
||||
public override void OnHitNPC(Player player, NPC target, int damage, float knockBack, bool crit)
|
||||
|
||||
@@ -30,8 +30,8 @@ namespace CalamityMod.Items.Weapons.Rogue
|
||||
item.autoReuse = true;
|
||||
item.height = 36;
|
||||
item.maxStack = 1;
|
||||
item.value = CalamityGlobalItem.Rarity5BuyPrice;
|
||||
item.rare = ItemRarityID.Pink;
|
||||
item.value = Item.buyPrice(0, 4, 0, 0);
|
||||
item.shoot = ModContent.ProjectileType<EquanimityProj>();
|
||||
item.shootSpeed = 30f;
|
||||
item.Calamity().rogue = true;
|
||||
|
||||
@@ -30,8 +30,8 @@ namespace CalamityMod.Items.Weapons.Rogue
|
||||
item.autoReuse = true;
|
||||
item.height = 42;
|
||||
item.maxStack = 1;
|
||||
item.value = CalamityGlobalItem.Rarity5BuyPrice;
|
||||
item.rare = ItemRarityID.Pink;
|
||||
item.value = Item.buyPrice(0, 16, 0, 0);
|
||||
item.shoot = ModContent.ProjectileType<ExorcismProj>();
|
||||
item.shootSpeed = 10f;
|
||||
item.Calamity().rogue = true;
|
||||
|
||||
@@ -27,9 +27,8 @@ namespace CalamityMod.Items.Weapons.Rogue
|
||||
item.UseSound = SoundID.Item1;
|
||||
item.autoReuse = true;
|
||||
item.useStyle = ItemUseStyleID.SwingThrow;
|
||||
item.value = Item.buyPrice(0, 30, 0, 0);
|
||||
item.value = CalamityGlobalItem.Rarity5BuyPrice;
|
||||
item.rare = ItemRarityID.Pink;
|
||||
|
||||
item.useAnimation = 15;
|
||||
item.useTime = 15;
|
||||
item.damage = 50;
|
||||
|
||||
+12
-3
@@ -3218,10 +3218,13 @@ namespace CalamityMod.NPCs
|
||||
if (npc.type != ModContent.NPCType<AstrumDeusHeadSpectral>())
|
||||
{
|
||||
bool shouldDespawn = true;
|
||||
int headType = ModContent.NPCType<AstrumDeusHeadSpectral>();
|
||||
for (int i = 0; i < Main.maxNPCs; i++)
|
||||
{
|
||||
if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType<AstrumDeusHeadSpectral>())
|
||||
shouldDespawn = false;
|
||||
if (Main.npc[i].type != headType || !Main.npc[i].active)
|
||||
continue;
|
||||
shouldDespawn = false;
|
||||
break;
|
||||
}
|
||||
if (!shouldDespawn)
|
||||
{
|
||||
@@ -3376,12 +3379,18 @@ namespace CalamityMod.NPCs
|
||||
npc.velocity.Y -= velocity;
|
||||
}
|
||||
|
||||
int headType = ModContent.NPCType<AstrumDeusHeadSpectral>();
|
||||
int bodyType = ModContent.NPCType<AstrumDeusBodySpectral>();
|
||||
int tailType = ModContent.NPCType<AstrumDeusBodySpectral>();
|
||||
if ((double)npc.position.Y < Main.topWorld + 16f)
|
||||
{
|
||||
for (int num957 = 0; num957 < Main.maxNPCs; num957++)
|
||||
{
|
||||
if (Main.npc[num957].type == ModContent.NPCType<AstrumDeusHeadSpectral>() || Main.npc[num957].type == ModContent.NPCType<AstrumDeusBodySpectral>() || Main.npc[num957].type == ModContent.NPCType<AstrumDeusTailSpectral>())
|
||||
if (Main.npc[num957].type == headType || Main.npc[num957].type == bodyType || Main.npc[num957].type == tailType)
|
||||
{
|
||||
Main.npc[num957].active = false;
|
||||
Main.npc[num957].netUpdate = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1615,7 +1615,8 @@ namespace CalamityMod.NPCs
|
||||
(wCleave > 0 ? WarCleave.DefenseReduction : 0) -
|
||||
(gState > 0 ? GlacialState.DefenseReduction : 0) -
|
||||
(aCrunch > 0 ? ArmorCrunch.DefenseReduction : 0) -
|
||||
(marked > 0 && DR <= 0f ? MarkedforDeath.DefenseReduction : 0);
|
||||
(marked > 0 && DR <= 0f ? MarkedforDeath.DefenseReduction : 0) -
|
||||
Main.LocalPlayer.armorPenetration;
|
||||
|
||||
// Defense can never be negative and has a minimum value of zero.
|
||||
if (effectiveDefense < 0)
|
||||
|
||||
@@ -122,7 +122,8 @@ namespace CalamityMod.NPCs
|
||||
private static readonly string[] WitchDoctorNames =
|
||||
{
|
||||
"Sok'ar",
|
||||
"Toxin", // <@!348174404984766465> (Toxin#9598)
|
||||
"Toxin", // <@!348174404984766465> (Toxin#9598),
|
||||
"Mixcoatl", // <@!284775927294984203> (SharZz#7777)
|
||||
};
|
||||
private const int WizardVanillaNames = 22;
|
||||
private static readonly string[] WizardNames =
|
||||
|
||||
@@ -127,6 +127,8 @@ namespace CalamityMod.NPCs.Providence
|
||||
writer.Write(npc.chaseable);
|
||||
writer.Write(npc.canGhostHeal);
|
||||
writer.Write(npc.localAI[2]);
|
||||
for (int i = 0; i < 4; i++)
|
||||
writer.Write(npc.Calamity().newAI[i]);
|
||||
}
|
||||
|
||||
public override void ReceiveExtraAI(BinaryReader reader)
|
||||
@@ -143,7 +145,9 @@ namespace CalamityMod.NPCs.Providence
|
||||
npc.chaseable = reader.ReadBoolean();
|
||||
npc.canGhostHeal = reader.ReadBoolean();
|
||||
npc.localAI[2] = reader.ReadSingle();
|
||||
}
|
||||
for (int i = 0; i < 4; i++)
|
||||
npc.Calamity().newAI[i] = reader.ReadSingle();
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
@@ -199,6 +203,7 @@ namespace CalamityMod.NPCs.Providence
|
||||
calamityGlobalNPC.newAI[1] = 0f;
|
||||
calamityGlobalNPC.newAI[2] = 0f;
|
||||
calamityGlobalNPC.newAI[3] = 0f;
|
||||
npc.netUpdate = true;
|
||||
}
|
||||
|
||||
// Difficulty bools
|
||||
@@ -673,6 +678,7 @@ namespace CalamityMod.NPCs.Providence
|
||||
npc.ai[3] = 0f;
|
||||
calamityGlobalNPC.newAI[1] = 0f;
|
||||
calamityGlobalNPC.newAI[2] = 0f;
|
||||
npc.netUpdate = true;
|
||||
break;
|
||||
|
||||
case (int)Phase.HolyBlast:
|
||||
@@ -885,6 +891,7 @@ namespace CalamityMod.NPCs.Providence
|
||||
// Radial offset
|
||||
npc.ai[2] += 10f;
|
||||
}
|
||||
npc.netUpdate = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -6,9 +6,8 @@ using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.ID;
|
||||
using CalamityMod.Events;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Boss
|
||||
{
|
||||
@@ -27,36 +26,36 @@ namespace CalamityMod.Projectiles.Boss
|
||||
projectile.hostile = true;
|
||||
projectile.ignoreWater = true;
|
||||
projectile.tileCollide = false;
|
||||
projectile.alpha = 255;
|
||||
projectile.alpha = 255;
|
||||
projectile.penetrate = 1;
|
||||
projectile.timeLeft = 200;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
if (projectile.ai[0] < 240f)
|
||||
{
|
||||
projectile.ai[0] += 1f;
|
||||
if (projectile.ai[0] < 240f)
|
||||
{
|
||||
projectile.ai[0] += 1f;
|
||||
|
||||
if (projectile.timeLeft < 160)
|
||||
projectile.timeLeft = 160;
|
||||
}
|
||||
if (projectile.timeLeft < 160)
|
||||
projectile.timeLeft = 160;
|
||||
}
|
||||
|
||||
if (projectile.velocity.Length() < 16f)
|
||||
projectile.velocity *= 1.01f;
|
||||
if (projectile.velocity.Length() < 16f)
|
||||
projectile.velocity *= 1.01f;
|
||||
|
||||
int index = Player.FindClosest(projectile.Center, projectile.width, projectile.height);
|
||||
Player player = Main.player[index];
|
||||
if (player is null || player.Calamity().lol)
|
||||
return;
|
||||
int index = Player.FindClosest(projectile.Center, projectile.width, projectile.height);
|
||||
Player player = Main.player[index];
|
||||
if (player is null || player.Calamity().lol)
|
||||
return;
|
||||
|
||||
float playerDist = Vector2.Distance(player.Center, projectile.Center);
|
||||
float playerDist = Vector2.Distance(player.Center, projectile.Center);
|
||||
if (playerDist < 50f && !player.dead && projectile.position.X < player.position.X + player.width && projectile.position.X + projectile.width > player.position.X && projectile.position.Y < player.Bottom.Y && projectile.Bottom.Y > player.position.Y)
|
||||
{
|
||||
int dmgAmt = (int)projectile.ai[1];
|
||||
player.HealEffect(dmgAmt, false);
|
||||
player.statLife += dmgAmt;
|
||||
player.Calamity().adrenaline = player.Calamity().stressPills ? player.Calamity().adrenaline / 2 : 0;
|
||||
player.Calamity().adrenaline = player.Calamity().stressPills ? player.Calamity().adrenaline / 2 : 0;
|
||||
if (player.statLife > player.statLifeMax2)
|
||||
{
|
||||
player.statLife = player.statLifeMax2;
|
||||
@@ -70,45 +69,48 @@ namespace CalamityMod.Projectiles.Boss
|
||||
}
|
||||
}
|
||||
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
|
||||
{
|
||||
float lerpMult = Utils.InverseLerp(15f, 30f, projectile.timeLeft, clamped: true) * Utils.InverseLerp(240f, 200f, projectile.timeLeft, clamped: true) * (1f + 0.2f * (float)Math.Cos(Main.GlobalTime % 30f / 0.5f * (MathHelper.Pi * 2f) * 3f)) * 0.8f;
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
|
||||
{
|
||||
float lerpMult = Utils.InverseLerp(15f, 30f, projectile.timeLeft, clamped: true) * Utils.InverseLerp(240f, 200f, projectile.timeLeft, clamped: true) * (1f + 0.2f * (float)Math.Cos(Main.GlobalTime % 30f / 0.5f * (MathHelper.Pi * 2f) * 3f)) * 0.8f;
|
||||
|
||||
Texture2D texture = Main.projectileTexture[projectile.type];
|
||||
Vector2 drawPos = projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY);
|
||||
Color baseColor = Main.dayTime ? new Color(255, 200, 100, 255) : new Color(100, 200, 255, 255);
|
||||
baseColor *= 0.5f;
|
||||
baseColor.A = 0;
|
||||
Color colorA = baseColor;
|
||||
Color colorB = baseColor * 0.5f;
|
||||
colorA *= lerpMult;
|
||||
colorB *= lerpMult;
|
||||
Vector2 origin = texture.Size() / 2f;
|
||||
Vector2 scale = new Vector2(0.5f, 1.5f) * lerpMult;
|
||||
Texture2D texture = Main.projectileTexture[projectile.type];
|
||||
Vector2 drawPos = projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY);
|
||||
Color baseColor = Main.dayTime ? new Color(255, 200, 100, 255) : new Color(100, 200, 255, 255);
|
||||
baseColor *= 0.5f;
|
||||
baseColor.A = 0;
|
||||
Color colorA = baseColor;
|
||||
Color colorB = baseColor * 0.5f;
|
||||
colorA *= lerpMult;
|
||||
colorB *= lerpMult;
|
||||
Vector2 origin = texture.Size() / 2f;
|
||||
Vector2 scale = new Vector2(0.5f, 1.5f) * lerpMult;
|
||||
|
||||
SpriteEffects spriteEffects = SpriteEffects.None;
|
||||
if (projectile.spriteDirection == -1)
|
||||
spriteEffects = SpriteEffects.FlipHorizontally;
|
||||
SpriteEffects spriteEffects = SpriteEffects.None;
|
||||
if (projectile.spriteDirection == -1)
|
||||
spriteEffects = SpriteEffects.FlipHorizontally;
|
||||
|
||||
spriteBatch.Draw(texture, drawPos, null, colorA, MathHelper.PiOver2, origin, scale, spriteEffects, 0);
|
||||
spriteBatch.Draw(texture, drawPos, null, colorA, 0f, origin, scale, spriteEffects, 0);
|
||||
spriteBatch.Draw(texture, drawPos, null, colorB, MathHelper.PiOver2, origin, scale * 0.6f, spriteEffects, 0);
|
||||
spriteBatch.Draw(texture, drawPos, null, colorB, 0f, origin, scale * 0.6f, spriteEffects, 0);
|
||||
float upRight = MathHelper.PiOver4;
|
||||
float up = MathHelper.PiOver2;
|
||||
float upLeft = 3f * MathHelper.PiOver4;
|
||||
float left = MathHelper.Pi;
|
||||
spriteBatch.Draw(texture, drawPos, null, colorA, upLeft, origin, scale, spriteEffects, 0);
|
||||
spriteBatch.Draw(texture, drawPos, null, colorA, upRight, origin, scale, spriteEffects, 0);
|
||||
spriteBatch.Draw(texture, drawPos, null, colorB, upLeft, origin, scale * 0.6f, spriteEffects, 0);
|
||||
spriteBatch.Draw(texture, drawPos, null, colorB, upRight, origin, scale * 0.6f, spriteEffects, 0);
|
||||
spriteBatch.Draw(texture, drawPos, null, colorA, up, origin, scale * 0.6f, spriteEffects, 0);
|
||||
spriteBatch.Draw(texture, drawPos, null, colorA, left, origin, scale * 0.6f, spriteEffects, 0);
|
||||
spriteBatch.Draw(texture, drawPos, null, colorB, up, origin, scale * 0.36f, spriteEffects, 0);
|
||||
spriteBatch.Draw(texture, drawPos, null, colorB, left, origin, scale * 0.36f, spriteEffects, 0);
|
||||
|
||||
spriteBatch.Draw(texture, drawPos, null, colorA, MathHelper.PiOver4, origin, scale * 0.6f, spriteEffects, 0);
|
||||
spriteBatch.Draw(texture, drawPos, null, colorA, MathHelper.PiOver4 * 3f, origin, scale * 0.6f, spriteEffects, 0);
|
||||
spriteBatch.Draw(texture, drawPos, null, colorB, MathHelper.PiOver4, origin, scale * 0.36f, spriteEffects, 0);
|
||||
spriteBatch.Draw(texture, drawPos, null, colorB, MathHelper.PiOver4 * 3f, origin, scale * 0.36f, spriteEffects, 0);
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void Kill(int timeLeft)
|
||||
public override void Kill(int timeLeft)
|
||||
{
|
||||
Main.PlaySound(SoundID.Item14, projectile.Center);
|
||||
CalamityGlobalProjectile.ExpandHitboxBy(projectile, 50);
|
||||
int dustType = Main.dayTime ? (int)CalamityDusts.ProfanedFire : (int)CalamityDusts.Nightwither;
|
||||
for (int d = 0; d < 5; d++)
|
||||
CalamityGlobalProjectile.ExpandHitboxBy(projectile, 50);
|
||||
int dustType = Main.dayTime ? (int)CalamityDusts.ProfanedFire : (int)CalamityDusts.Nightwither;
|
||||
for (int d = 0; d < 5; d++)
|
||||
{
|
||||
int holy = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, 0f, 0f, 100, default, 2f);
|
||||
Main.dust[holy].velocity *= 3f;
|
||||
@@ -130,8 +132,8 @@ namespace CalamityMod.Projectiles.Boss
|
||||
|
||||
public override void OnHitPlayer(Player target, int damage, bool crit)
|
||||
{
|
||||
int buffType = Main.dayTime ? ModContent.BuffType<HolyFlames>() : ModContent.BuffType<Nightwither>();
|
||||
target.AddBuff(buffType, 60);
|
||||
}
|
||||
int buffType = Main.dayTime ? ModContent.BuffType<HolyFlames>() : ModContent.BuffType<Nightwither>();
|
||||
target.AddBuff(buffType, 60);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -66,9 +66,7 @@ namespace CalamityMod.Projectiles.Boss
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
|
||||
{
|
||||
Texture2D value = Main.projectileTexture[projectile.type];
|
||||
Color baseColor = new Color(100, 255, 100, 255);
|
||||
Color color33 = baseColor;
|
||||
color33.A = 0;
|
||||
Color color33 = new Color(54, 209, 54, 0);
|
||||
Vector2 vector28 = projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY);
|
||||
Color color34 = color33;
|
||||
Vector2 origin5 = value.Size() / 2f;
|
||||
|
||||
@@ -234,7 +234,7 @@ namespace CalamityMod.Projectiles.Magic
|
||||
}
|
||||
else {
|
||||
// Do we still have enough mana? If not, we kill the projectile because we cannot use it anymore
|
||||
if (Main.time % 10 < 1 && !player.CheckMana(player.ActiveItem().mana, true))
|
||||
if (Main.player[projectile.owner].miscCounter % 10 == 0 && !player.CheckMana(player.ActiveItem().mana, true))
|
||||
{
|
||||
projectile.Kill();
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
|
||||
private void OnHitEffect(Vector2 targetPos)
|
||||
{
|
||||
if (Main.myPlayer != projectile.owner)
|
||||
if (Main.myPlayer != projectile.owner || !projectile.Calamity().stealthStrike)
|
||||
return;
|
||||
|
||||
for (int i = 0; i < 2; i++)
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 585 B |
@@ -1109,51 +1109,61 @@ namespace CalamityMod
|
||||
|
||||
group = new RecipeGroup(() => "Any Wings", new int[]
|
||||
{
|
||||
ItemID.DemonWings,
|
||||
ItemID.AngelWings,
|
||||
ItemID.RedsWings,
|
||||
ItemID.ButterflyWings,
|
||||
ItemID.FairyWings,
|
||||
ItemID.HarpyWings,
|
||||
ItemID.BoneWings,
|
||||
ItemID.FlameWings,
|
||||
ItemID.FrozenWings,
|
||||
ItemID.GhostWings,
|
||||
ItemID.SteampunkWings,
|
||||
ItemID.LeafWings,
|
||||
ItemID.BatWings,
|
||||
ItemID.BeeWings,
|
||||
ItemID.DTownsWings,
|
||||
ItemID.WillsWings,
|
||||
ItemID.CrownosWings,
|
||||
ItemID.CenxsWings,
|
||||
ItemID.TatteredFairyWings,
|
||||
ItemID.SpookyWings,
|
||||
ItemID.Hoverboard,
|
||||
ItemID.FestiveWings,
|
||||
ItemID.BeetleWings,
|
||||
ItemID.FinWings,
|
||||
ItemID.FishronWings,
|
||||
ItemID.MothronWings,
|
||||
ItemID.WingsSolar,
|
||||
ItemID.WingsVortex,
|
||||
ItemID.WingsNebula,
|
||||
ItemID.WingsStardust,
|
||||
ItemID.Yoraiz0rWings,
|
||||
ItemID.JimsWings,
|
||||
ItemID.SkiphsWings,
|
||||
ItemID.LokisWings,
|
||||
ItemID.BetsyWings,
|
||||
ItemID.ArkhalisWings,
|
||||
ItemID.LeinforsWings,
|
||||
ModContent.ItemType<SkylineWings>(),
|
||||
ModContent.ItemType<StarlightWings>(),
|
||||
ModContent.ItemType<AureateWings>(),
|
||||
ModContent.ItemType<DiscordianWings>(),
|
||||
ModContent.ItemType<TarragonWings>(),
|
||||
ModContent.ItemType<XerocWings>(),
|
||||
ModContent.ItemType<HadarianWings>(),
|
||||
ModContent.ItemType<SilvaWings>()
|
||||
ItemID.DemonWings,
|
||||
ItemID.AngelWings,
|
||||
ItemID.RedsWings,
|
||||
ItemID.ButterflyWings,
|
||||
ItemID.FairyWings,
|
||||
ItemID.HarpyWings,
|
||||
ItemID.BoneWings,
|
||||
ItemID.FlameWings,
|
||||
ItemID.FrozenWings,
|
||||
ItemID.GhostWings,
|
||||
ItemID.SteampunkWings,
|
||||
ItemID.LeafWings,
|
||||
ItemID.BatWings,
|
||||
ItemID.BeeWings,
|
||||
ItemID.DTownsWings,
|
||||
ItemID.WillsWings,
|
||||
ItemID.CrownosWings,
|
||||
ItemID.CenxsWings,
|
||||
ItemID.TatteredFairyWings,
|
||||
ItemID.SpookyWings,
|
||||
ItemID.Hoverboard,
|
||||
ItemID.FestiveWings,
|
||||
ItemID.BeetleWings,
|
||||
ItemID.FinWings,
|
||||
ItemID.FishronWings,
|
||||
ItemID.MothronWings,
|
||||
ItemID.WingsSolar,
|
||||
ItemID.WingsVortex,
|
||||
ItemID.WingsNebula,
|
||||
ItemID.WingsStardust,
|
||||
ItemID.Yoraiz0rWings,
|
||||
ItemID.JimsWings,
|
||||
ItemID.SkiphsWings,
|
||||
ItemID.LokisWings,
|
||||
ItemID.BetsyWings,
|
||||
ItemID.ArkhalisWings,
|
||||
ItemID.LeinforsWings,
|
||||
ItemID.BejeweledValkyrieWing,
|
||||
/*
|
||||
ItemID.GhostarsWings,
|
||||
ItemID.GroxTheGreatWings,
|
||||
ItemID.FoodBarbarianWings,
|
||||
ItemID.SafemanWings,
|
||||
ItemID.CreativeWings,
|
||||
ItemID.RainbowWings,
|
||||
ItemID.LongRainbowTrailWings,
|
||||
*/
|
||||
ModContent.ItemType<SkylineWings>(),
|
||||
ModContent.ItemType<StarlightWings>(),
|
||||
ModContent.ItemType<AureateWings>(),
|
||||
ModContent.ItemType<DiscordianWings>(),
|
||||
ModContent.ItemType<TarragonWings>(),
|
||||
ModContent.ItemType<XerocWings>(),
|
||||
ModContent.ItemType<HadarianWings>(),
|
||||
ModContent.ItemType<SilvaWings>()
|
||||
});
|
||||
RecipeGroup.RegisterGroup("WingsGroup", group);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ using CalamityMod.Events;
|
||||
using CalamityMod.NPCs.HiveMind;
|
||||
using CalamityMod.NPCs.Leviathan;
|
||||
using CalamityMod.NPCs.NormalNPCs;
|
||||
using CalamityMod.NPCs.OldDuke;
|
||||
using CalamityMod.NPCs.Perforator;
|
||||
using CalamityMod.NPCs.Providence;
|
||||
using CalamityMod.NPCs.SlimeGod;
|
||||
@@ -13,6 +14,7 @@ using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.Localization;
|
||||
using Terraria.ModLoader;
|
||||
using static Terraria.ModLoader.ModContent;
|
||||
|
||||
namespace CalamityMod
|
||||
@@ -452,5 +454,37 @@ namespace CalamityMod
|
||||
target.AddBuff(BuffID.Frostburn, (int)(120 * multiplier));
|
||||
target.AddBuff(BuffID.OnFire, (int)(120 * multiplier));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Spawns Old Duke on a player. Only works server side, and only works if the player owns a fishing bobber.<br />
|
||||
/// Old Duke will spawn above the fishing bobber if one is found.
|
||||
/// </summary>
|
||||
/// <param name="playerIndex">The index of the player who will spawn Old Duke.</param>
|
||||
internal static void SpawnOldDuke(int playerIndex)
|
||||
{
|
||||
if (Main.netMode != NetmodeID.Server)
|
||||
return;
|
||||
|
||||
Player player = Main.player[playerIndex];
|
||||
if (!player.active || player.dead)
|
||||
return;
|
||||
|
||||
Projectile projectile = null;
|
||||
for (int i = 0; i < Main.maxProjectiles; i++)
|
||||
{
|
||||
projectile = Main.projectile[i];
|
||||
if (Main.projectile[i].active && Main.projectile[i].bobber && Main.projectile[i].owner == playerIndex)
|
||||
{
|
||||
projectile = Main.projectile[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (projectile is null)
|
||||
return;
|
||||
|
||||
int oldDuke = NPC.NewNPC((int)projectile.Center.X, (int)projectile.Center.Y + 100, NPCType<OldDuke>());
|
||||
BossAwakenMessage(oldDuke);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@ using CalamityMod.CalPlayer;
|
||||
using System.Linq;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
|
||||
using Terraria.ModLoader;
|
||||
using static Terraria.ModLoader.ModContent;
|
||||
|
||||
namespace CalamityMod
|
||||
@@ -152,5 +152,24 @@ namespace CalamityMod
|
||||
target.AddBuff(BuffID.OnFire, (int)(120 * multiplier));
|
||||
target.AddBuff(BuffID.Ichor, (int)(120 * multiplier));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Makes the given player send the given packet to all appropriate receivers.<br />
|
||||
/// If server is false, the packet is sent only to the multiplayer host.<br />
|
||||
/// If server is true, the packet is sent to all clients except the player it pertains to.
|
||||
/// </summary>
|
||||
/// <param name="player">The player to whom the packet's data pertains.</param>
|
||||
/// <param name="packet">The packet to send with certain parameters.</param>
|
||||
/// <param name="server">True if a dedicated server is broadcasting information to all players.</param>
|
||||
public static void SendPacket(this Player player, ModPacket packet, bool server)
|
||||
{
|
||||
// Client: Send the packet only to the host.
|
||||
if (!server)
|
||||
packet.Send();
|
||||
|
||||
// Server: Send the packet to every OTHER client.
|
||||
else
|
||||
packet.Send(-1, player.whoAmI);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -92,7 +92,6 @@ namespace CalamityMod.World
|
||||
public static int abyssChasmBottom = 0;
|
||||
public static bool rainingAcid;
|
||||
public static int acidRainPoints = 0;
|
||||
public static int acidRainExtraDrawTime = 0;
|
||||
public static bool triedToSummonOldDuke = false;
|
||||
public static bool startAcidicDownpour = false;
|
||||
public static bool forcedRainAlready = false;
|
||||
|
||||
Reference in new issue
Block a user