Moved netcode and lists, and renamed UpdateServerBoolean

This commit is contained in:
DominicKarma42 committed 2020-08-13 14:18:48 -05:00
1 parent 8964b5eeac
commit 113a723bb9
72 files changed
+3073 -2932

No files matched your search

+25 -25
View File
@@ -2372,7 +2372,7 @@ namespace CalamityMod.CalPlayer
{
BossRushEvent.BossRushActive = false;
BossRushEvent.BossRushStage = 0;
CalamityMod.UpdateServerBoolean();
CalamityNetcode.SyncWorld();
if (Main.netMode == NetmodeID.Server)
{
var netMessage = mod.GetPacket();
@@ -4288,23 +4288,23 @@ namespace CalamityMod.CalPlayer
{
add += GaelsGreatsword.BaseDamage / (float)GaelsGreatsword.BaseDamage - 1f;
}
if (flamethrowerBoost && item.ranged && (item.useAmmo == 23 || CalamityMod.flamethrowerList.Contains(item.type)))
if (flamethrowerBoost && item.ranged && (item.useAmmo == 23 || CalamityLists.flamethrowerList.Contains(item.type)))
{
add += hoverboardBoost ? 0.35f : 0.25f;
}
if (cinnamonRoll && CalamityMod.fireWeaponList.Contains(item.type))
if (cinnamonRoll && CalamityLists.fireWeaponList.Contains(item.type))
{
add += 0.15f;
}
if (evergreenGin && CalamityMod.natureWeaponList.Contains(item.type))
if (evergreenGin && CalamityLists.natureWeaponList.Contains(item.type))
{
add += 0.15f;
}
if (fireball && CalamityMod.fireWeaponList.Contains(item.type))
if (fireball && CalamityLists.fireWeaponList.Contains(item.type))
{
add += 0.1f;
}
if (eskimoSet && CalamityMod.iceWeaponList.Contains(item.type))
if (eskimoSet && CalamityLists.iceWeaponList.Contains(item.type))
{
add += 0.1f;
}
@@ -4758,7 +4758,7 @@ namespace CalamityMod.CalPlayer
{
CalamityUtils.Inflict246DebuffsNPC(target, ModContent.BuffType<DemonFlames>());
}
if ((plaguebringerCarapace || uberBees) && CalamityMod.friendlyBeeList.Contains(proj.type))
if ((plaguebringerCarapace || uberBees) && CalamityLists.friendlyBeeList.Contains(proj.type))
{
target.AddBuff(ModContent.BuffType<Plague>(), 360);
}
@@ -4866,7 +4866,7 @@ namespace CalamityMod.CalPlayer
{
target.AddBuff(BuffID.Midas, 120, false);
}
if (ZoneCalamity && CalamityMod.fireWeaponList.Contains(player.ActiveItem().type))
if (ZoneCalamity && CalamityLists.fireWeaponList.Contains(player.ActiveItem().type))
{
target.AddBuff(ModContent.BuffType<AbyssalFlames>(), 240, false);
}
@@ -5099,7 +5099,7 @@ namespace CalamityMod.CalPlayer
{
CalamityUtils.Inflict246DebuffsPvp(target, ModContent.BuffType<CrushDepth>());
}
if ((plaguebringerCarapace || uberBees) && CalamityMod.friendlyBeeList.Contains(proj.type))
if ((plaguebringerCarapace || uberBees) && CalamityLists.friendlyBeeList.Contains(proj.type))
{
target.AddBuff(ModContent.BuffType<Plague>(), 360);
}
@@ -5207,7 +5207,7 @@ namespace CalamityMod.CalPlayer
{
target.AddBuff(BuffID.Midas, 120, false);
}*/
if (ZoneCalamity && CalamityMod.fireWeaponList.Contains(player.ActiveItem().type))
if (ZoneCalamity && CalamityLists.fireWeaponList.Contains(player.ActiveItem().type))
{
target.AddBuff(ModContent.BuffType<AbyssalFlames>(), 240, false);
}
@@ -5628,7 +5628,7 @@ namespace CalamityMod.CalPlayer
int defenseAdd = (int)(target.defense * 0.05 * (proj.damage / 50D) * acidRoundMultiplier); //100 defense * 0.05 = 5
damage += defenseAdd;
}
if (uberBees && CalamityMod.friendlyBeeList.Contains(proj.type))
if (uberBees && CalamityLists.friendlyBeeList.Contains(proj.type))
{
damage += Main.rand.Next(20, 31);
}
@@ -5662,7 +5662,7 @@ namespace CalamityMod.CalPlayer
}
if (proj.Calamity().rogue && etherealExtorter)
{
if (CalamityMod.boomerangProjList.Contains(proj.type) && player.ZoneCorrupt)
if (CalamityLists.boomerangProjList.Contains(proj.type) && player.ZoneCorrupt)
{
penetrateAmt += 6;
}
@@ -6059,7 +6059,7 @@ namespace CalamityMod.CalPlayer
if (beeResist)
{
if (CalamityMod.beeEnemyList.Contains(npc.type))
if (CalamityLists.beeEnemyList.Contains(npc.type))
contactDamageReduction += 0.25;
}
@@ -6202,7 +6202,7 @@ namespace CalamityMod.CalPlayer
#region Modify Hit By Proj
public override void ModifyHitByProjectile(Projectile proj, ref int damage, ref bool crit)
{
if (CalamityMod.projectileDestroyExceptionList.TrueForAll(x => proj.type != x))
if (CalamityLists.projectileDestroyExceptionList.TrueForAll(x => proj.type != x))
{
if (player.ActiveItem().type == ModContent.ItemType<GaelsGreatsword>()
&& proj.active && proj.hostile && player.altFunctionUse == 2 && Main.rand.NextBool(2))
@@ -6250,23 +6250,23 @@ namespace CalamityMod.CalPlayer
if (CalamityWorld.revenge)
{
double damageMultiplier = 1D;
if (CalamityMod.revengeanceProjectileBuffList25Percent.Contains(proj.type))
if (CalamityLists.revengeanceProjectileBuffList25Percent.Contains(proj.type))
{
damageMultiplier += 0.25;
}
else if (CalamityMod.revengeanceProjectileBuffList20Percent.Contains(proj.type))
else if (CalamityLists.revengeanceProjectileBuffList20Percent.Contains(proj.type))
{
damageMultiplier += 0.2;
}
else if (CalamityMod.revengeanceProjectileBuffList15Percent.Contains(proj.type))
else if (CalamityLists.revengeanceProjectileBuffList15Percent.Contains(proj.type))
{
damageMultiplier += 0.15;
}
else if (CalamityMod.revengeanceProjectileBuffList10Percent.Contains(proj.type))
else if (CalamityLists.revengeanceProjectileBuffList10Percent.Contains(proj.type))
{
damageMultiplier += 0.1;
}
else if (CalamityMod.revengeanceProjectileBuffList5Percent.Contains(proj.type))
else if (CalamityLists.revengeanceProjectileBuffList5Percent.Contains(proj.type))
{
damageMultiplier += 0.05;
}
@@ -6344,13 +6344,13 @@ namespace CalamityMod.CalPlayer
if (beeResist)
{
if (CalamityMod.beeProjectileList.Contains(proj.type))
if (CalamityLists.beeProjectileList.Contains(proj.type))
projectileDamageReduction += 0.25;
}
if (Main.hardMode && Main.expertMode && !CalamityWorld.spawnedHardBoss && proj.active && !proj.friendly && proj.hostile && damage > 0)
{
if (CalamityMod.hardModeNerfList.Contains(proj.type))
if (CalamityLists.hardModeNerfList.Contains(proj.type))
projectileDamageReduction += 0.25;
}
@@ -6446,7 +6446,7 @@ namespace CalamityMod.CalPlayer
if (player.whoAmI == Main.myPlayer && gainRageCooldown <= 0)
{
if (CalamityWorld.revenge && CalamityConfig.Instance.Rippers && !CalamityMod.trapProjectileList.Contains(proj.type))
if (CalamityWorld.revenge && CalamityConfig.Instance.Rippers && !CalamityLists.trapProjectileList.Contains(proj.type))
{
gainRageCooldown = 60;
int stressGain = damage * (profanedRage ? 3 : 2);
@@ -6615,7 +6615,7 @@ namespace CalamityMod.CalPlayer
switch (proj.type)
{
case ProjectileID.Stinger:
if (CalamityMod.hornetList.Contains(bannerNPCType) || CalamityMod.mossHornetList.Contains(bannerNPCType))
if (CalamityLists.hornetList.Contains(bannerNPCType) || CalamityLists.mossHornetList.Contains(bannerNPCType))
{
reduceDamage = !NPC.AnyNPCs(NPCID.QueenBee);
}
@@ -7086,7 +7086,7 @@ namespace CalamityMod.CalPlayer
player.AddBuff(ModContent.BuffType<Horror>(), 180);
}
}
if (CalamityMod.projectileDestroyExceptionList.TrueForAll(x => proj.type != x))
if (CalamityLists.projectileDestroyExceptionList.TrueForAll(x => proj.type != x))
{
if (projRef && proj.active && !proj.friendly && proj.hostile && damage > 0 && Main.rand.NextBool(20))
{
@@ -9648,7 +9648,7 @@ namespace CalamityMod.CalPlayer
stealthGenMoving += 0.15f;
}
if (CalamityMod.daggerList.Contains(player.ActiveItem().type) && player.invis)
if (CalamityLists.daggerList.Contains(player.ActiveItem().type) && player.invis)
{
stealthGenStandstill += 0.08f;
stealthGenMoving += 0.08f;
+1 -1
View File
@@ -625,7 +625,7 @@ namespace CalamityMod.CalPlayer
list.Add(MiscEffects);
// Remove shoe drawing effects if special legs are meant to be drawn.
if (CalamityMod.legOverrideList.Contains(player.legs))
if (CalamityLists.legOverrideList.Contains(player.legs))
list[list.IndexOf(PlayerLayer.ShoeAcc)].visible = false;
if (player.Calamity().fab || player.Calamity().crysthamyr || player.Calamity().onyxExcavator)
+3 -3
View File
@@ -403,7 +403,7 @@ namespace CalamityMod.CalPlayer
for (int l = 0; l < Player.MaxBuffs; l++)
{
int hasBuff = player.buffType[l];
lesserEffect = CalamityMod.alcoholList.Contains(hasBuff);
lesserEffect = CalamityLists.alcoholList.Contains(hasBuff);
}
if (lesserEffect)
@@ -431,7 +431,7 @@ namespace CalamityMod.CalPlayer
for (int l = 0; l < Player.MaxBuffs; l++)
{
int hasBuff = player.buffType[l];
lesserEffect = CalamityMod.alcoholList.Contains(hasBuff);
lesserEffect = CalamityLists.alcoholList.Contains(hasBuff);
}
if (lesserEffect)
@@ -665,7 +665,7 @@ namespace CalamityMod.CalPlayer
for (int l = 0; l < Player.MaxBuffs; l++)
{
int hasBuff = player.buffType[l];
bool shouldAffect = CalamityMod.alcoholList.Contains(hasBuff);
bool shouldAffect = CalamityLists.alcoholList.Contains(hasBuff);
if (shouldAffect)
lesserEffect = true;
}
+15 -15
View File
@@ -411,7 +411,7 @@ namespace CalamityMod.CalPlayer
for (int l = 0; l < Player.MaxBuffs; l++)
{
int hasBuff = player.buffType[l];
if (player.buffTime[l] > 2 && CalamityMod.debuffList.Contains(hasBuff))
if (player.buffTime[l] > 2 && CalamityLists.debuffList.Contains(hasBuff))
{
player.buffTime[l]--;
}
@@ -422,7 +422,7 @@ namespace CalamityMod.CalPlayer
// Immunity to most debuffs
if (modPlayer.invincible)
{
foreach (int debuff in CalamityMod.debuffList)
foreach (int debuff in CalamityLists.debuffList)
player.buffImmune[debuff] = true;
}
@@ -1003,7 +1003,7 @@ namespace CalamityMod.CalPlayer
// Silva invincibility effects
if (modPlayer.silvaCountdown > 0 && modPlayer.hasSilvaEffect && modPlayer.silvaSet)
{
foreach (int debuff in CalamityMod.debuffList)
foreach (int debuff in CalamityLists.debuffList)
player.buffImmune[debuff] = true;
player.buffImmune[ModContent.BuffType<VulnerabilityHex>()] = true;
@@ -1076,7 +1076,7 @@ namespace CalamityMod.CalPlayer
player.AddBuff(ModContent.BuffType<TarragonImmunityCooldown>(), 1500, false);
}
bool shouldAffect = CalamityMod.debuffList.Contains(hasBuff);
bool shouldAffect = CalamityLists.debuffList.Contains(hasBuff);
if (shouldAffect)
modPlayer.throwingDamage += 0.1f;
}
@@ -2672,22 +2672,22 @@ namespace CalamityMod.CalPlayer
}
}
if (CalamityMod.scopedWeaponList.Contains(player.ActiveItem().type))
if (CalamityLists.scopedWeaponList.Contains(player.ActiveItem().type))
player.scope = true;
if (CalamityMod.highTestFishList.Contains(player.ActiveItem().type))
if (CalamityLists.highTestFishList.Contains(player.ActiveItem().type))
player.accFishingLine = true;
if (CalamityMod.boomerangList.Contains(player.ActiveItem().type) && player.invis)
if (CalamityLists.boomerangList.Contains(player.ActiveItem().type) && player.invis)
modPlayer.throwingDamage += 0.1f;
if (CalamityMod.javelinList.Contains(player.ActiveItem().type) && player.invis)
if (CalamityLists.javelinList.Contains(player.ActiveItem().type) && player.invis)
player.armorPenetration += 5;
if (CalamityMod.flaskBombList.Contains(player.ActiveItem().type) && player.invis)
if (CalamityLists.flaskBombList.Contains(player.ActiveItem().type) && player.invis)
modPlayer.throwingVelocity += 0.1f;
if (CalamityMod.spikyBallList.Contains(player.ActiveItem().type) && player.invis)
if (CalamityLists.spikyBallList.Contains(player.ActiveItem().type) && player.invis)
modPlayer.throwingCrit += 10;
if (modPlayer.planarSpeedBoost != 0)
@@ -2713,10 +2713,10 @@ namespace CalamityMod.CalPlayer
!modPlayer.ZoneSunkenSea && !player.ZoneSnow && !player.ZoneCorrupt && !player.ZoneCrimson && !player.ZoneHoly &&
!player.ZoneDesert && !player.ZoneUndergroundDesert && !player.ZoneGlowshroom && !player.ZoneDungeon && !player.ZoneBeach && !player.ZoneMeteor;
if (player.ZoneUnderworldHeight && !modPlayer.ZoneCalamity && CalamityMod.fireWeaponList.Contains(player.ActiveItem().type))
if (player.ZoneUnderworldHeight && !modPlayer.ZoneCalamity && CalamityLists.fireWeaponList.Contains(player.ActiveItem().type))
player.endurance += 0.03f;
if ((player.ZoneDesert || player.ZoneUndergroundDesert) && CalamityMod.daggerList.Contains(player.ActiveItem().type))
if ((player.ZoneDesert || player.ZoneUndergroundDesert) && CalamityLists.daggerList.Contains(player.ActiveItem().type))
player.scope = true;
if (modPlayer.ZoneSunkenSea)
@@ -2725,7 +2725,7 @@ namespace CalamityMod.CalPlayer
player.ignoreWater = true;
}
if (player.ZoneSnow && CalamityMod.iceWeaponList.Contains(player.ActiveItem().type))
if (player.ZoneSnow && CalamityLists.iceWeaponList.Contains(player.ActiveItem().type))
player.statDefense += 5;
if (modPlayer.ZoneAstral)
@@ -2734,7 +2734,7 @@ namespace CalamityMod.CalPlayer
player.wingTimeMax = (int)(player.wingTimeMax * 1.05);
}
if (player.ZoneJungle && CalamityMod.natureWeaponList.Contains(player.ActiveItem().type))
if (player.ZoneJungle && CalamityLists.natureWeaponList.Contains(player.ActiveItem().type))
player.AddBuff(BuffID.DryadsWard, 5, true); // Dryad's Blessing
if (modPlayer.ZoneAbyss)
@@ -2754,7 +2754,7 @@ namespace CalamityMod.CalPlayer
player.endurance += 0.05f;
}
if (player.ZoneRockLayerHeight && ZoneForest && CalamityMod.flaskBombList.Contains(player.ActiveItem().type))
if (player.ZoneRockLayerHeight && ZoneForest && CalamityLists.flaskBombList.Contains(player.ActiveItem().type))
player.blackBelt = true;
if (player.ZoneHoly)
+2575
View File
File diff suppressed because it is too large. Load diff
+4 -2744
View File
File diff suppressed because it is too large. Load diff
+259
View File
@@ -0,0 +1,259 @@
using CalamityMod.Events;
using CalamityMod.NPCs.NormalNPCs;
using CalamityMod.NPCs.Providence;
using CalamityMod.TileEntities;
using CalamityMod.World;
using System;
using System.IO;
using Terraria;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod
{
public class CalamityNetcode
{
public static void HandlePacket(BinaryReader reader, int whoAmI)
{
try
{
CalamityModMessageType msgType = (CalamityModMessageType)reader.ReadByte();
switch (msgType)
{
case CalamityModMessageType.MeleeLevelSync:
Main.player[reader.ReadInt32()].Calamity().HandleLevels(reader, 0);
break;
case CalamityModMessageType.RangedLevelSync:
Main.player[reader.ReadInt32()].Calamity().HandleLevels(reader, 1);
break;
case CalamityModMessageType.MagicLevelSync:
Main.player[reader.ReadInt32()].Calamity().HandleLevels(reader, 2);
break;
case CalamityModMessageType.SummonLevelSync:
Main.player[reader.ReadInt32()].Calamity().HandleLevels(reader, 3);
break;
case CalamityModMessageType.RogueLevelSync:
Main.player[reader.ReadInt32()].Calamity().HandleLevels(reader, 4);
break;
case CalamityModMessageType.ExactMeleeLevelSync:
Main.player[reader.ReadInt32()].Calamity().HandleExactLevels(reader, 0);
break;
case CalamityModMessageType.ExactRangedLevelSync:
Main.player[reader.ReadInt32()].Calamity().HandleExactLevels(reader, 1);
break;
case CalamityModMessageType.ExactMagicLevelSync:
Main.player[reader.ReadInt32()].Calamity().HandleExactLevels(reader, 2);
break;
case CalamityModMessageType.ExactSummonLevelSync:
Main.player[reader.ReadInt32()].Calamity().HandleExactLevels(reader, 3);
break;
case CalamityModMessageType.ExactRogueLevelSync:
Main.player[reader.ReadInt32()].Calamity().HandleExactLevels(reader, 4);
break;
case CalamityModMessageType.StressSync:
Main.player[reader.ReadInt32()].Calamity().HandleStress(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;
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.RevengeanceBoolSync:
bool revActive = reader.ReadBoolean();
CalamityWorld.revenge = revActive;
break;
case CalamityModMessageType.DeathBoolSync:
bool deathActive = reader.ReadBoolean();
CalamityWorld.death = deathActive;
break;
case CalamityModMessageType.DefiledBoolSync:
bool defiledActive = reader.ReadBoolean();
CalamityWorld.defiled = defiledActive;
break;
case CalamityModMessageType.IronHeartBoolSync:
bool ironHeartActive = reader.ReadBoolean();
CalamityWorld.ironHeart = ironHeartActive;
break;
case CalamityModMessageType.ArmageddonBoolSync:
bool armaActive = reader.ReadBoolean();
CalamityWorld.armageddon = armaActive;
break;
case CalamityModMessageType.DemonTrophyBoolSync:
bool demonModeBoost = reader.ReadBoolean();
CalamityWorld.demonMode = demonModeBoost;
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.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;
case CalamityModMessageType.DraedonGeneratorStackSync:
(TileEntity.ByID[reader.ReadInt32()] as TEDraedonFuelFactory).HeldItem.stack = reader.ReadInt32();
break;
case CalamityModMessageType.DraedonChargerSync:
int entityID = reader.ReadInt32();
(TileEntity.ByID[entityID] as TEDraedonItemCharger).FuelItem.type = reader.ReadInt32();
(TileEntity.ByID[entityID] as TEDraedonItemCharger).FuelItem.stack = reader.ReadInt32();
(TileEntity.ByID[entityID] as TEDraedonItemCharger).FuelItem.position = reader.ReadVector2();
(TileEntity.ByID[entityID] as TEDraedonItemCharger).ItemBeingCharged.type = reader.ReadInt32();
(TileEntity.ByID[entityID] as TEDraedonItemCharger).ItemBeingCharged.stack = reader.ReadInt32();
(TileEntity.ByID[entityID] as TEDraedonItemCharger).ItemBeingCharged.prefix = reader.ReadByte();
(TileEntity.ByID[entityID] as TEDraedonItemCharger).ItemBeingCharged.position = reader.ReadVector2();
int currentCharge = reader.ReadInt32();
if (currentCharge != -1)
{
(TileEntity.ByID[entityID] as TEDraedonItemCharger).ItemBeingCharged.Calamity().CurrentCharge = currentCharge;
}
(TileEntity.ByID[entityID] as TEDraedonItemCharger).ActiveTimer = reader.ReadInt32();
(TileEntity.ByID[entityID] as TEDraedonItemCharger).DepositWithdrawCooldown = reader.ReadInt32();
break;
case CalamityModMessageType.DraedonFieldGeneratorSync:
int entityID2 = reader.ReadInt32();
(TileEntity.ByID[entityID2] as TEDraedonFieldGenerator).Time = reader.ReadInt32();
(TileEntity.ByID[entityID2] as TEDraedonFieldGenerator).ActiveTimer = reader.ReadInt32();
break;
case CalamityModMessageType.SyncCalamityNPCAIArray:
byte npcIndex2 = reader.ReadByte();
Main.npc[npcIndex2].Calamity().newAI[0] = reader.ReadSingle();
Main.npc[npcIndex2].Calamity().newAI[1] = reader.ReadSingle();
Main.npc[npcIndex2].Calamity().newAI[2] = reader.ReadSingle();
Main.npc[npcIndex2].Calamity().newAI[3] = reader.ReadSingle();
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;
default:
CalamityMod.Instance.Logger.Error($"Failed to parse Calamity packet: No Calamity packet exists with ID {msgType}.");
break;
}
}
catch (Exception e)
{
if (e is EndOfStreamException eose)
CalamityMod.Instance.Logger.Error("Failed to parse Calamity packet: Packet was too short, missing data, or otherwise corrupt.", eose);
else if (e is ObjectDisposedException ode)
CalamityMod.Instance.Logger.Error("Failed to parse Calamity packet: Packet reader disposed or destroyed.", ode);
else if (e is IOException ioe)
CalamityMod.Instance.Logger.Error("Failed to parse Calamity packet: An unknown I/O error occurred.", ioe);
else
throw e; // this either will crash the game or be caught by TML's packet policing
}
}
public static void SyncWorld()
{
if (Main.netMode == NetmodeID.Server)
NetMessage.SendData(MessageID.WorldData);
}
}
public enum CalamityModMessageType : byte
{
MeleeLevelSync,
RangedLevelSync,
MagicLevelSync,
SummonLevelSync,
RogueLevelSync,
ExactMeleeLevelSync,
ExactRangedLevelSync,
ExactMagicLevelSync,
ExactSummonLevelSync,
ExactRogueLevelSync,
StressSync,
AdrenalineSync,
TeleportPlayer,
BossRushStage,
DoGCountdownSync,
BossSpawnCountdownSync,
BRHostileProjKillSync,
ArmoredDiggerCountdownSync,
BossTypeSync,
DeathCountSync,
RevengeanceBoolSync,
DeathBoolSync,
DefiledBoolSync,
IronHeartBoolSync,
ArmageddonBoolSync,
DemonTrophyBoolSync,
NPCRegenerationSync,
DeathModeUnderworldTimeSync,
DeathModeBlizzardTimeSync,
DeathBossSpawnCountdownSync,
AcidRainSync,
AcidRainUIDrawFadeSync,
AcidRainOldDukeSummonSync,
GaelsGreatswordSwingSync,
SpawnSuperDummy,
SyncCalamityNPCAIArray,
ProvidenceDyeConditionSync, // We shouldn't fucking need this. Die in a hole, Multiplayer.
PSCChallengeSync, // See above
DraedonGeneratorStackSync,
DraedonChargerSync,
DraedonFieldGeneratorSync
}
}
+2 -2
View File
@@ -176,7 +176,7 @@ namespace CalamityMod.Events
Main.rainTime = Main.weatherCounter;
Main.maxRaining = 0.89f;
CalamityWorld.forcedDownpourWithTear = true;
CalamityMod.UpdateServerBoolean();
CalamityNetcode.SyncWorld();
}
CalamityWorld.triedToSummonOldDuke = false;
CalamityWorld.timeSinceAcidRainKill = 0; // Reset the kill cooldown, just in case.
@@ -214,7 +214,7 @@ namespace CalamityMod.Events
CalamityWorld.triedToSummonOldDuke = false;
CalamityMod.StopRain();
}
CalamityMod.UpdateServerBoolean();
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
+1 -1
View File
@@ -269,7 +269,7 @@ namespace CalamityMod.Events
CalamityWorld.bossRushHostileProjKillCounter = 3;
BossRushActive = false;
CalamityMod.UpdateServerBoolean();
CalamityNetcode.SyncWorld();
if (Main.netMode == NetmodeID.Server)
{
var netMessage = CalamityMod.Instance.GetPacket();
+13 -13
View File
@@ -113,32 +113,32 @@ namespace CalamityMod.Items
if (item.type >= ItemID.GreenSolution && item.type <= ItemID.RedSolution)
item.value = Item.buyPrice(0, 0, 5, 0);
if (CalamityMod.weaponAutoreuseList?.Contains(item.type) ?? false)
if (CalamityLists.weaponAutoreuseList?.Contains(item.type) ?? false)
item.autoReuse = true;
if (item.type == ItemID.PsychoKnife || item.type == ItemID.TaxCollectorsStickOfDoom)
item.damage *= 4;
else if (item.type == ItemID.SpectreStaff)
item.damage *= 3;
else if (CalamityMod.doubleDamageBuffList?.Contains(item.type) ?? false)
else if (CalamityLists.doubleDamageBuffList?.Contains(item.type) ?? false)
item.damage *= 2;
else if (item.type == ItemID.RainbowRod)
item.damage = (int)(item.damage * 1.75);
else if (CalamityMod.sixtySixDamageBuffList?.Contains(item.type) ?? false)
else if (CalamityLists.sixtySixDamageBuffList?.Contains(item.type) ?? false)
item.damage = (int)(item.damage * 1.66);
else if (CalamityMod.fiftyDamageBuffList?.Contains(item.type) ?? false)
else if (CalamityLists.fiftyDamageBuffList?.Contains(item.type) ?? false)
item.damage = (int)(item.damage * 1.5);
else if (CalamityMod.thirtyThreeDamageBuffList?.Contains(item.type) ?? false)
else if (CalamityLists.thirtyThreeDamageBuffList?.Contains(item.type) ?? false)
item.damage = (int)(item.damage * 1.33);
else if (CalamityMod.twentyFiveDamageBuffList?.Contains(item.type) ?? false)
else if (CalamityLists.twentyFiveDamageBuffList?.Contains(item.type) ?? false)
item.damage = (int)(item.damage * 1.25);
else if (CalamityMod.twentyDamageBuffList?.Contains(item.type) ?? false)
else if (CalamityLists.twentyDamageBuffList?.Contains(item.type) ?? false)
item.damage = (int)(item.damage * 1.2);
else if (CalamityMod.tenDamageBuffList?.Contains(item.type) ?? false)
else if (CalamityLists.tenDamageBuffList?.Contains(item.type) ?? false)
item.damage = (int)(item.damage * 1.1);
else if (CalamityMod.tenDamageNerfList?.Contains(item.type) ?? false)
else if (CalamityLists.tenDamageNerfList?.Contains(item.type) ?? false)
item.damage = (int)(item.damage * 0.9);
else if (CalamityMod.quarterDamageNerfList?.Contains(item.type) ?? false)
else if (CalamityLists.quarterDamageNerfList?.Contains(item.type) ?? false)
item.damage = (int)(item.damage * 0.75);
else if (item.type == ItemID.BlizzardStaff)
item.damage = (int)(item.damage * 0.7);
@@ -174,9 +174,9 @@ namespace CalamityMod.Items
else if (item.type == ItemID.HallowedGreaves)
item.defense = 13; //2 more defense
if (CalamityMod.noGravityList.Contains(item.type))
if (CalamityLists.noGravityList.Contains(item.type))
ItemID.Sets.ItemNoGravity[item.type] = true;
if (CalamityMod.lavaFishList.Contains(item.type))
if (CalamityLists.lavaFishList.Contains(item.type))
ItemID.Sets.CanFishInLava[item.type] = true;
// not expert because ML drops it in normal so that it can be used with the lore item
@@ -3607,7 +3607,7 @@ Grants immunity to fire blocks, and temporary immunity to lava";
#region PostUpdate
public override void PostUpdate(Item item)
{
if (CalamityMod.forceItemList?.Contains(item.type) ?? false)
if (CalamityLists.forceItemList?.Contains(item.type) ?? false)
{
CalamityUtils.ForceItemIntoWorld(item);
}
+1 -1
View File
@@ -74,7 +74,7 @@ namespace CalamityMod.Items.DifficultyItems
NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor);
}
CalamityMod.UpdateServerBoolean();
CalamityNetcode.SyncWorld();
if (Main.netMode == NetmodeID.Server)
{
+1 -1
View File
@@ -92,7 +92,7 @@ namespace CalamityMod.Items.DifficultyItems
}
CalamityWorld.DoGSecondStageCountdown = 0;
CalamityMod.UpdateServerBoolean();
CalamityNetcode.SyncWorld();
if (Main.netMode == NetmodeID.Server)
{
+1 -1
View File
@@ -84,7 +84,7 @@ namespace CalamityMod.Items.DifficultyItems
}
CalamityWorld.DoGSecondStageCountdown = 0;
CalamityMod.UpdateServerBoolean();
CalamityNetcode.SyncWorld();
if (Main.netMode == NetmodeID.Server)
{
+1 -1
View File
@@ -75,7 +75,7 @@ namespace CalamityMod.Items.DifficultyItems
}
CalamityWorld.DoGSecondStageCountdown = 0;
CalamityMod.UpdateServerBoolean();
CalamityNetcode.SyncWorld();
if (Main.netMode == NetmodeID.Server)
{
+1 -1
View File
@@ -35,7 +35,7 @@ namespace CalamityMod.Items.DifficultyItems
public override bool UseItem(Player player)
{
CalamityWorld.demonMode = true;
CalamityMod.UpdateServerBoolean();
CalamityNetcode.SyncWorld();
if (Main.netMode == NetmodeID.Server)
{
var netMessage = mod.GetPacket();
+2 -2
View File
@@ -89,7 +89,7 @@ namespace CalamityMod.Items.DifficultyItems
NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor);
}
CalamityMod.UpdateServerBoolean();
CalamityNetcode.SyncWorld();
}
else
{
@@ -135,7 +135,7 @@ namespace CalamityMod.Items.DifficultyItems
}
CalamityWorld.DoGSecondStageCountdown = 0;
CalamityMod.UpdateServerBoolean();
CalamityNetcode.SyncWorld();
if (Main.netMode == NetmodeID.Server)
{
var netMessage = mod.GetPacket();
+1 -1
View File
@@ -62,7 +62,7 @@ namespace CalamityMod.Items.SummonItems
BossRushEvent.BossRushActive = false;
}
CalamityMod.UpdateServerBoolean();
CalamityNetcode.SyncWorld();
if (Main.netMode == NetmodeID.Server)
{
var netMessage = mod.GetPacket();
+1 -1
View File
@@ -33,7 +33,7 @@ namespace CalamityMod.Items.SummonItems
public override bool UseItem(Player player)
{
CalamityGlobalNPC.DraedonMayhem = true;
CalamityMod.UpdateServerBoolean();
CalamityNetcode.SyncWorld();
Main.PlaySound(SoundID.Roar, player.position, 0);
if (Main.netMode != NetmodeID.MultiplayerClient)
{
+1 -1
View File
@@ -34,7 +34,7 @@ namespace CalamityMod.Items.SummonItems.Invasion
public override bool UseItem(Player player)
{
CalamityMod.UpdateServerBoolean();
CalamityNetcode.SyncWorld();
AcidRainEvent.TryStartEvent(true);
return true;
}
+1 -1
View File
@@ -34,7 +34,7 @@ namespace CalamityMod.Items.Tools.ClimateChange
public override bool UseItem(Player player)
{
Main.bloodMoon = true;
CalamityMod.UpdateServerBoolean();
CalamityNetcode.SyncWorld();
return true;
}
+1 -1
View File
@@ -43,7 +43,7 @@ namespace CalamityMod.Items.Tools.ClimateChange
Main.moonPhase = 0;
}
}
CalamityMod.UpdateServerBoolean();
CalamityNetcode.SyncWorld();
}
return true;
}
+1 -1
View File
@@ -35,7 +35,7 @@ namespace CalamityMod.Items.Tools.ClimateChange
if (Main.netMode != NetmodeID.MultiplayerClient)
{
Main.dayTime = true;
CalamityMod.UpdateServerBoolean();
CalamityNetcode.SyncWorld();
}
return true;
}
+1 -1
View File
@@ -36,7 +36,7 @@ namespace CalamityMod.Items.Tools.ClimateChange
if (Main.netMode != NetmodeID.MultiplayerClient)
{
Main.dayTime = false;
CalamityMod.UpdateServerBoolean();
CalamityNetcode.SyncWorld();
}
return true;
}
+1 -1
View File
@@ -54,7 +54,7 @@ namespace CalamityMod.Items.Tools.ClimateChange
Main.raining = false;
}
CalamityMod.UpdateServerBoolean();
CalamityNetcode.SyncWorld();
return true;
}
+1 -1
View File
@@ -211,7 +211,7 @@ namespace CalamityMod.NPCs.AquaticScourge
// Mark Aquatic Scourge as dead
CalamityWorld.downedAquaticScourge = true;
CalamityMod.UpdateServerBoolean();
CalamityNetcode.SyncWorld();
}
public override void ScaleExpertStats(int numPlayers, float bossLifeScale)
+1 -1
View File
@@ -397,7 +397,7 @@ namespace CalamityMod.NPCs.AstrumAureus
// Mark Astrum Aureus as dead
CalamityWorld.downedAstrageldon = true;
CalamityMod.UpdateServerBoolean();
CalamityNetcode.SyncWorld();
}
public override void HitEffect(int hitDirection, double damage)
+1 -1
View File
@@ -262,7 +262,7 @@ namespace CalamityMod.NPCs.AstrumDeus
// Mark Astrum Deus as dead
CalamityWorld.downedStarGod = true;
CalamityMod.UpdateServerBoolean();
CalamityNetcode.SyncWorld();
}
public override void OnHitPlayer(Player player, int damage, bool crit)
@@ -217,7 +217,7 @@ namespace CalamityMod.NPCs.BrimstoneElemental
// mark brimmy as dead
CalamityWorld.downedBrimstoneElemental = true;
CalamityMod.UpdateServerBoolean();
CalamityNetcode.SyncWorld();
}
public override void ScaleExpertStats(int numPlayers, float bossLifeScale)
+1 -1
View File
@@ -441,7 +441,7 @@ namespace CalamityMod.NPCs.Bumblebirb
// Mark The Dragonfolly as dead
CalamityWorld.downedBumble = true;
CalamityMod.UpdateServerBoolean();
CalamityNetcode.SyncWorld();
}
public override void ScaleExpertStats(int numPlayers, float bossLifeScale)
+1 -1
View File
@@ -222,7 +222,7 @@ namespace CalamityMod.NPCs.Calamitas
// Mark Calamitas as dead
CalamityWorld.downedCalamitas = true;
CalamityMod.UpdateServerBoolean();
CalamityNetcode.SyncWorld();
}
public override void BossLoot(ref string name, ref int potionType)
+2 -2
View File
@@ -1294,7 +1294,7 @@ namespace CalamityMod.NPCs
// Reduce acceleration if target is holding a true melee weapon
Item targetSelectedItem = player.inventory[player.selectedItem];
if (targetSelectedItem.melee && (targetSelectedItem.shoot == 0 || CalamityMod.trueMeleeProjectileList.Contains(targetSelectedItem.shoot)))
if (targetSelectedItem.melee && (targetSelectedItem.shoot == 0 || CalamityLists.trueMeleeProjectileList.Contains(targetSelectedItem.shoot)))
{
num824 *= 0.5f;
}
@@ -1437,7 +1437,7 @@ namespace CalamityMod.NPCs
// Reduce acceleration if target is holding a true melee weapon
Item targetSelectedItem = player.inventory[player.selectedItem];
if (targetSelectedItem.melee && (targetSelectedItem.shoot == 0 || CalamityMod.trueMeleeProjectileList.Contains(targetSelectedItem.shoot)))
if (targetSelectedItem.melee && (targetSelectedItem.shoot == 0 || CalamityLists.trueMeleeProjectileList.Contains(targetSelectedItem.shoot)))
{
num833 *= 0.5f;
}
+7 -7
View File
@@ -3039,14 +3039,14 @@ namespace CalamityMod.NPCs
Main.PlaySound(SoundID.NPCHit1, (int)npc.position.X, (int)npc.position.Y);
if (Main.netMode != NetmodeID.MultiplayerClient)
{
int hornetAmt = CalamityMod.hornetList.Count;
int hornetAmt = CalamityLists.hornetList.Count;
int spawnType = Main.rand.Next(210, 212);
if (npc.life < npc.lifeMax * 0.66 || death)
spawnType = 210;
int random = death ? 5 : 6;
if (Main.rand.Next(random) == 0)
spawnType = CalamityMod.hornetList[Main.rand.Next(hornetAmt)];
spawnType = CalamityLists.hornetList[Main.rand.Next(hornetAmt)];
int spawn = NPC.NewNPC((int)vector76.X, (int)vector76.Y, spawnType, 0, 0f, 0f, 0f, 0f, 255);
@@ -3054,7 +3054,7 @@ namespace CalamityMod.NPCs
Main.npc[spawn].velocity.Normalize();
Main.npc[spawn].velocity *= 5f;
if (!CalamityMod.hornetList.Contains(spawnType))
if (!CalamityLists.hornetList.Contains(spawnType))
Main.npc[spawn].localAI[0] = 60f;
Main.npc[spawn].netUpdate = true;
@@ -5096,7 +5096,7 @@ namespace CalamityMod.NPCs
num422 = 0.175f;
}
// Reduce acceleration if target is holding a true melee weapon
if (targetSelectedItem.melee && (targetSelectedItem.shoot == 0 || CalamityMod.trueMeleeProjectileList.Contains(targetSelectedItem.shoot)))
if (targetSelectedItem.melee && (targetSelectedItem.shoot == 0 || CalamityLists.trueMeleeProjectileList.Contains(targetSelectedItem.shoot)))
{
num422 *= 0.5f;
}
@@ -5206,7 +5206,7 @@ namespace CalamityMod.NPCs
num431 = 0.25f;
}
// Reduce acceleration if target is holding a true melee weapon
if (targetSelectedItem.melee && (targetSelectedItem.shoot == 0 || CalamityMod.trueMeleeProjectileList.Contains(targetSelectedItem.shoot)))
if (targetSelectedItem.melee && (targetSelectedItem.shoot == 0 || CalamityLists.trueMeleeProjectileList.Contains(targetSelectedItem.shoot)))
{
num431 *= 0.5f;
}
@@ -5628,7 +5628,7 @@ namespace CalamityMod.NPCs
// Reduce acceleration if target is holding a true melee weapon
Item targetSelectedItem = Main.player[npc.target].inventory[Main.player[npc.target].selectedItem];
if (targetSelectedItem.melee && (targetSelectedItem.shoot == 0 || CalamityMod.trueMeleeProjectileList.Contains(targetSelectedItem.shoot)))
if (targetSelectedItem.melee && (targetSelectedItem.shoot == 0 || CalamityLists.trueMeleeProjectileList.Contains(targetSelectedItem.shoot)))
{
num400 *= 0.5f;
}
@@ -5742,7 +5742,7 @@ namespace CalamityMod.NPCs
// Reduce acceleration if target is holding a true melee weapon
Item targetSelectedItem = Main.player[npc.target].inventory[Main.player[npc.target].selectedItem];
if (targetSelectedItem.melee && (targetSelectedItem.shoot == 0 || CalamityMod.trueMeleeProjectileList.Contains(targetSelectedItem.shoot)))
if (targetSelectedItem.melee && (targetSelectedItem.shoot == 0 || CalamityLists.trueMeleeProjectileList.Contains(targetSelectedItem.shoot)))
{
num410 *= 0.5f;
}
+18 -18
View File
@@ -713,7 +713,7 @@ namespace CalamityMod.NPCs
}
// Exo Freeze, Glacial State and Temporal Sadness don't work on bosses or other specific enemies.
if (!npc.boss && !CalamityMod.movementImpairImmuneList.Contains(npc.type))
if (!npc.boss && !CalamityLists.movementImpairImmuneList.Contains(npc.type))
{
if (eFreeze > 0 && !BossRushEvent.BossRushActive)
{
@@ -857,7 +857,7 @@ namespace CalamityMod.NPCs
#region Debuff Immunities
private void DebuffImmunities(NPC npc)
{
if (CalamityMod.enemyImmunityList.Contains(npc.type) || npc.boss)
if (CalamityLists.enemyImmunityList.Contains(npc.type) || npc.boss)
{
npc.buffImmune[BuffType<GlacialState>()] = true;
npc.buffImmune[BuffType<TemporalSadness>()] = true;
@@ -1114,7 +1114,7 @@ namespace CalamityMod.NPCs
}
}
if (CalamityMod.revengeanceLifeStealExceptionList.Contains(npc.type))
if (CalamityLists.revengeanceLifeStealExceptionList.Contains(npc.type))
{
npc.canGhostHeal = false;
}
@@ -1163,14 +1163,14 @@ namespace CalamityMod.NPCs
if (CalamityWorld.downedDoG)
{
if (CalamityMod.pumpkinMoonBuffList.Contains(npc.type))
if (CalamityLists.pumpkinMoonBuffList.Contains(npc.type))
{
npc.lifeMax = (int)(npc.lifeMax * 7.5);
npc.damage += 160;
npc.life = npc.lifeMax;
npc.defDamage = npc.damage;
}
else if (CalamityMod.frostMoonBuffList.Contains(npc.type))
else if (CalamityLists.frostMoonBuffList.Contains(npc.type))
{
npc.lifeMax = (int)(npc.lifeMax * 6.0);
npc.damage += 160;
@@ -1179,7 +1179,7 @@ namespace CalamityMod.NPCs
}
}
if (CalamityMod.eclipseBuffList.Contains(npc.type) && CalamityWorld.buffedEclipse)
if (CalamityLists.eclipseBuffList.Contains(npc.type) && CalamityWorld.buffedEclipse)
{
npc.lifeMax = (int)(npc.lifeMax * 32.5);
npc.damage += 210;
@@ -1189,7 +1189,7 @@ namespace CalamityMod.NPCs
if (NPC.downedMoonlord)
{
if (CalamityMod.dungeonEnemyBuffList.Contains(npc.type))
if (CalamityLists.dungeonEnemyBuffList.Contains(npc.type))
{
npc.lifeMax = (int)(npc.lifeMax * 2.5);
npc.damage += 150;
@@ -1201,23 +1201,23 @@ namespace CalamityMod.NPCs
if (CalamityWorld.revenge)
{
double damageMultiplier = 1D;
if (CalamityMod.revengeanceEnemyBuffList25Percent.Contains(npc.type))
if (CalamityLists.revengeanceEnemyBuffList25Percent.Contains(npc.type))
{
damageMultiplier += 0.25;
}
else if (CalamityMod.revengeanceEnemyBuffList20Percent.Contains(npc.type))
else if (CalamityLists.revengeanceEnemyBuffList20Percent.Contains(npc.type))
{
damageMultiplier += 0.2;
}
else if (CalamityMod.revengeanceEnemyBuffList15Percent.Contains(npc.type))
else if (CalamityLists.revengeanceEnemyBuffList15Percent.Contains(npc.type))
{
damageMultiplier += 0.15;
}
else if (CalamityMod.revengeanceEnemyBuffList10Percent.Contains(npc.type))
else if (CalamityLists.revengeanceEnemyBuffList10Percent.Contains(npc.type))
{
damageMultiplier += 0.1;
}
else if (CalamityMod.revengeanceEnemyBuffList5Percent.Contains(npc.type))
else if (CalamityLists.revengeanceEnemyBuffList5Percent.Contains(npc.type))
{
damageMultiplier += 0.05;
}
@@ -1229,7 +1229,7 @@ namespace CalamityMod.NPCs
npc.defDamage = npc.damage;
}
if ((npc.boss && npc.type != NPCID.MartianSaucerCore && npc.type < NPCID.Count) || CalamityMod.bossHPScaleList.Contains(npc.type))
if ((npc.boss && npc.type != NPCID.MartianSaucerCore && npc.type < NPCID.Count) || CalamityLists.bossHPScaleList.Contains(npc.type))
{
double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01;
npc.lifeMax += (int)(npc.lifeMax * HPBoost);
@@ -1316,7 +1316,7 @@ namespace CalamityMod.NPCs
return;
}
if (((npc.boss || CalamityMod.bossScaleList.Contains(npc.type)) && npc.type < NPCID.Count) ||
if (((npc.boss || CalamityLists.bossScaleList.Contains(npc.type)) && npc.type < NPCID.Count) ||
(npc.modNPC != null && npc.modNPC.mod.Name.Equals("CalamityMod")))
{
double scalar;
@@ -3170,7 +3170,7 @@ namespace CalamityMod.NPCs
npc.type == NPCType<RavagerBody>() || npc.type == NPCID.DukeFishron || npc.type == NPCID.CultistBoss || npc.type == NPCID.Golem)
{
CalamityWorld.spawnedHardBoss = true;
CalamityMod.UpdateServerBoolean();
CalamityNetcode.SyncWorld();
}
}
@@ -3273,7 +3273,7 @@ namespace CalamityMod.NPCs
ladHearts--;
// Bosses and any specific other NPCs are completely immune to having their movement impaired.
if (npc.boss || CalamityMod.movementImpairImmuneList.Contains(npc.type))
if (npc.boss || CalamityLists.movementImpairImmuneList.Contains(npc.type))
return;
if (kamiFlu > 0)
@@ -4665,7 +4665,7 @@ namespace CalamityMod.NPCs
{
if (npc.type != NPCID.BrainofCthulhu && (npc.type != NPCID.DukeFishron || npc.ai[0] <= 9f))
{
if (CalamityConfig.Instance.DebuffDisplay && (npc.boss || BossHealthBarManager.MinibossHPBarList.Contains(npc.type) || BossHealthBarManager.OneToMany.ContainsKey(npc.type) || CalamityMod.needsDebuffIconDisplayList.Contains(npc.type)))
if (CalamityConfig.Instance.DebuffDisplay && (npc.boss || BossHealthBarManager.MinibossHPBarList.Contains(npc.type) || BossHealthBarManager.OneToMany.ContainsKey(npc.type) || CalamityLists.needsDebuffIconDisplayList.Contains(npc.type)))
{
List<Texture2D> buffTextureList = new List<Texture2D>();
@@ -6261,7 +6261,7 @@ namespace CalamityMod.NPCs
if (target.damage > 0 && !target.boss && !target.friendly && !target.dontTakeDamage &&
target.type != NPCID.MourningWood && target.type != NPCID.Everscream && target.type != NPCID.SantaNK1 &&
target.type != NPCType<Reaper>() && target.type != NPCType<Mauler>() && target.type != NPCType<EidolonWyrmHead>() &&
target.type != NPCType<EidolonWyrmHeadHuge>() && target.type != NPCType<ColossalSquid>() && target.type != NPCID.DD2Betsy && !CalamityMod.enemyImmunityList.Contains(target.type) && !AcidRainEvent.AllMinibosses.Contains(target.type))
target.type != NPCType<EidolonWyrmHeadHuge>() && target.type != NPCType<ColossalSquid>() && target.type != NPCID.DD2Betsy && !CalamityLists.enemyImmunityList.Contains(target.type) && !AcidRainEvent.AllMinibosses.Contains(target.type))
{
return true;
}
+13 -13
View File
@@ -300,7 +300,7 @@ namespace CalamityMod.NPCs
// Mark Betsy as dead (Vanilla does not keep track of her)
CalamityWorld.downedBetsy = true;
CalamityMod.UpdateServerBoolean();
CalamityNetcode.SyncWorld();
}
else if (npc.type == NPCID.DukeFishron)
{
@@ -539,7 +539,7 @@ namespace CalamityMod.NPCs
if (!CalamityPlayer.areThereAnyDamnBosses)
{
CalamityGlobalNPC.DraedonMayhem = false;
CalamityMod.UpdateServerBoolean();
CalamityNetcode.SyncWorld();
}
}
@@ -824,31 +824,31 @@ namespace CalamityMod.NPCs
}
// Every type of demon eye counts for Black Lenses
if (CalamityMod.demonEyeList.Contains(npc.type))
if (CalamityLists.demonEyeList.Contains(npc.type))
{
DropHelper.DropItemChance(npc, ItemID.BlackLens, DropHelper.DefiledDropRateInt);
}
// Every type of Skeleton counts for the Bone Sword
if (CalamityMod.skeletonList.Contains(npc.type) && npc.type != NPCID.ArmoredSkeleton && npc.type != NPCID.HeavySkeleton && npc.type != NPCID.SkeletonArcher && npc.type != NPCID.GreekSkeleton)
if (CalamityLists.skeletonList.Contains(npc.type) && npc.type != NPCID.ArmoredSkeleton && npc.type != NPCID.HeavySkeleton && npc.type != NPCID.SkeletonArcher && npc.type != NPCID.GreekSkeleton)
{
DropHelper.DropItemChance(npc, ItemID.BoneSword, DropHelper.DefiledDropRateInt);
}
// Every type of Angry Bones counts for the Clothier Voodoo Doll
if (CalamityMod.angryBonesList.Contains(npc.type))
if (CalamityLists.angryBonesList.Contains(npc.type))
{
DropHelper.DropItemChance(npc, ItemID.ClothierVoodooDoll, DropHelper.DefiledDropRateInt);
}
// Every type of hornet AND moss hornet can drop Bezoar
if (CalamityMod.hornetList.Contains(npc.type) || CalamityMod.mossHornetList.Contains(npc.type))
if (CalamityLists.hornetList.Contains(npc.type) || CalamityLists.mossHornetList.Contains(npc.type))
{
DropHelper.DropItemChance(npc, ItemID.Bezoar, DropHelper.DefiledDropRateInt);
}
// Every type of moss hornet can drop Tattered Bee Wings
if (CalamityMod.mossHornetList.Contains(npc.type))
if (CalamityLists.mossHornetList.Contains(npc.type))
{
DropHelper.DropItemChance(npc, ItemID.TatteredBeeWing, DropHelper.DefiledDropRateInt);
}
@@ -1265,14 +1265,14 @@ namespace CalamityMod.NPCs
}
// Every type of Moss Hornet counts for the Needler
if (CalamityMod.mossHornetList.Contains(npc.type))
if (CalamityLists.mossHornetList.Contains(npc.type))
{
int needlerDropRate = Main.expertMode ? 20 : 25;
DropHelper.DropItemChance(npc, ModContent.ItemType<Needler>(), needlerDropRate);
}
// Every type of Skeleton counts for the Waraxe and Ancient Bone Dust
if (CalamityMod.skeletonList.Contains(npc.type))
if (CalamityLists.skeletonList.Contains(npc.type))
{
DropHelper.DropItemCondition(npc, ModContent.ItemType<Waraxe>(), !Main.hardMode, Main.expertMode ? 15 : 20, 1, 1);
DropHelper.DropItemChance(npc, ModContent.ItemType<AncientBoneDust>(), Main.expertMode ? 4 : 5);
@@ -1530,13 +1530,13 @@ namespace CalamityMod.NPCs
}
// All hardmode dungeon enemies drop Ectoblood
if (CalamityMod.dungeonEnemyBuffList.Contains(npc.type))
if (CalamityLists.dungeonEnemyBuffList.Contains(npc.type))
{
DropHelper.DropItemChance(npc, ModContent.ItemType<Ectoblood>(), 2, 1, Main.expertMode ? 3 : 1);
}
// Every type of moss hornet can drop stingers
if (CalamityMod.mossHornetList.Contains(npc.type))
if (CalamityLists.mossHornetList.Contains(npc.type))
{
DropHelper.DropItemChance(npc, ItemID.Stinger, Main.expertMode ? 1f : 0.6666f);
}
@@ -1578,7 +1578,7 @@ namespace CalamityMod.NPCs
if (npc.boss && !CalamityWorld.downedBossAny)
{
CalamityWorld.downedBossAny = true;
CalamityMod.UpdateServerBoolean();
CalamityNetcode.SyncWorld();
}
// Nightmare Fuel, Endothermic Energy and Darksun Fragments
@@ -1647,7 +1647,7 @@ namespace CalamityMod.NPCs
// Mark a buffed Mothron as killed (allowing access to Yharon P2)
CalamityWorld.downedBuffedMothron = true;
CalamityMod.UpdateServerBoolean();
CalamityNetcode.SyncWorld();
}
}
#endregion
+1 -1
View File
@@ -175,7 +175,7 @@ namespace CalamityMod.NPCs.CeaselessVoid
if (CalamityWorld.DoGSecondStageCountdown <= 0)
{
CalamityWorld.downedSentinel1 = true;
CalamityMod.UpdateServerBoolean();
CalamityNetcode.SyncWorld();
}
}
+1 -1
View File
@@ -665,7 +665,7 @@ namespace CalamityMod.NPCs.Crabulon
// Mark Crabulon as dead
CalamityWorld.downedCrabulon = true;
CalamityMod.UpdateServerBoolean();
CalamityNetcode.SyncWorld();
}
public override void ScaleExpertStats(int numPlayers, float bossLifeScale)
+1 -1
View File
@@ -1099,7 +1099,7 @@ namespace CalamityMod.NPCs.Cryogen
// Mark Cryogen as dead
CalamityWorld.downedCryogen = true;
CalamityMod.UpdateServerBoolean();
CalamityNetcode.SyncWorld();
}
public override void OnHitPlayer(Player player, int damage, bool crit)
+1 -1
View File
@@ -531,7 +531,7 @@ namespace CalamityMod.NPCs.DesertScourge
// Mark Desert Scourge as dead
CalamityWorld.downedDesertScourge = true;
CalamityMod.UpdateServerBoolean();
CalamityNetcode.SyncWorld();
}
#endregion
+1 -1
View File
@@ -1062,7 +1062,7 @@ namespace CalamityMod.NPCs.DevourerofGods
// Mark DoG as dead
CalamityWorld.downedDoG = true;
CalamityMod.UpdateServerBoolean();
CalamityNetcode.SyncWorld();
}
// Can only hit the target if within certain distance
+2 -2
View File
@@ -104,7 +104,7 @@ namespace CalamityMod.NPCs.GreatSandShark
if (!Terraria.GameContent.Events.Sandstorm.Happening)
{
CalamityUtils.StartSandstorm();
CalamityMod.UpdateServerBoolean();
CalamityNetcode.SyncWorld();
}
if (npc.soundDelay <= 0)
{
@@ -662,7 +662,7 @@ namespace CalamityMod.NPCs.GreatSandShark
// Mark Great Sand Shark as dead
CalamityWorld.downedGSS = true;
CalamityMod.UpdateServerBoolean();
CalamityNetcode.SyncWorld();
}
public override void ScaleExpertStats(int numPlayers, float bossLifeScale)
+1 -1
View File
@@ -778,7 +778,7 @@ namespace CalamityMod.NPCs.HiveMind
// Mark The Hive Mind as dead
CalamityWorld.downedHiveMind = true;
CalamityMod.UpdateServerBoolean();
CalamityNetcode.SyncWorld();
}
public override void OnHitPlayer(Player player, int damage, bool crit)
+1 -1
View File
@@ -687,7 +687,7 @@ namespace CalamityMod.NPCs.Leviathan
// Mark Siren & Levi as dead
CalamityWorld.downedLeviathan = true;
CalamityMod.UpdateServerBoolean();
CalamityNetcode.SyncWorld();
}
public override void OnHitPlayer(Player target, int damage, bool crit)
+1 -1
View File
@@ -82,7 +82,7 @@ namespace CalamityMod.NPCs.Leviathan
public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection)
{
if (CalamityMod.projectileDestroyExceptionList.TrueForAll(x => projectile.type != x))
if (CalamityLists.projectileDestroyExceptionList.TrueForAll(x => projectile.type != x))
{
if (projectile.penetrate == -1 && !projectile.minion)
{
+1 -1
View File
@@ -397,7 +397,7 @@ namespace CalamityMod.NPCs.OldDuke
// Mark Old Duke as dead
CalamityWorld.downedBoomerDuke = true;
CalamityMod.UpdateServerBoolean();
CalamityNetcode.SyncWorld();
}
public override bool CanHitPlayer(Player target, ref int cooldownSlot)
+1 -1
View File
@@ -420,7 +420,7 @@ namespace CalamityMod.NPCs.Perforator
// Mark The Perforator Hive as dead
CalamityWorld.downedPerforator = true;
CalamityMod.UpdateServerBoolean();
CalamityNetcode.SyncWorld();
}
public override void HitEffect(int hitDirection, double damage)
@@ -1178,7 +1178,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath
// Mark PBG as dead
CalamityWorld.downedPlaguebringer = true;
CalamityMod.UpdateServerBoolean();
CalamityNetcode.SyncWorld();
}
public override void ScaleExpertStats(int numPlayers, float bossLifeScale)
+1 -1
View File
@@ -883,7 +883,7 @@ namespace CalamityMod.NPCs.Polterghast
// Mark Polterghast as dead
CalamityWorld.downedPolterghast = true;
CalamityMod.UpdateServerBoolean();
CalamityNetcode.SyncWorld();
}
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
@@ -441,7 +441,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians
// Mark the Profaned Guardians as dead
CalamityWorld.downedGuardians = true;
CalamityMod.UpdateServerBoolean();
CalamityNetcode.SyncWorld();
}
public override void OnHitPlayer(Player player, int damage, bool crit)
+1 -1
View File
@@ -1335,7 +1335,7 @@ namespace CalamityMod.NPCs.Providence
// Mark Providence as dead
CalamityWorld.downedProvidence = true;
CalamityMod.UpdateServerBoolean();
CalamityNetcode.SyncWorld();
}
private void SpawnLootBox()
+1 -1
View File
@@ -828,7 +828,7 @@ namespace CalamityMod.NPCs.Ravager
// Mark Ravager as dead
CalamityWorld.downedScavenger = true;
CalamityMod.UpdateServerBoolean();
CalamityNetcode.SyncWorld();
}
}
}
+2 -2
View File
@@ -787,14 +787,14 @@ namespace CalamityMod.NPCs.Signus
// Mark DoG fight sentinels as dead
CalamityWorld.downedSecondSentinels = true;
CalamityMod.UpdateServerBoolean();
CalamityNetcode.SyncWorld();
}
// Mark Signus as dead
if (CalamityWorld.DoGSecondStageCountdown <= 0)
{
CalamityWorld.downedSentinel3 = true;
CalamityMod.UpdateServerBoolean();
CalamityNetcode.SyncWorld();
}
}
+1 -1
View File
@@ -700,7 +700,7 @@ namespace CalamityMod.NPCs.SlimeGod
// Mark the Slime God as dead
CalamityWorld.downedSlimeGod = true;
CalamityMod.UpdateServerBoolean();
CalamityNetcode.SyncWorld();
}
public override void HitEffect(int hitDirection, double damage)
+1 -1
View File
@@ -185,7 +185,7 @@ namespace CalamityMod.NPCs.StormWeaver
public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection)
{
if (CalamityMod.projectileDestroyExceptionList.TrueForAll(x => projectile.type != x))
if (CalamityLists.projectileDestroyExceptionList.TrueForAll(x => projectile.type != x))
{
if (projectile.penetrate == -1 && !projectile.minion)
{
+1 -1
View File
@@ -668,7 +668,7 @@ namespace CalamityMod.NPCs.StormWeaver
if (CalamityWorld.DoGSecondStageCountdown <= 0)
{
CalamityWorld.downedSentinel2 = true;
CalamityMod.UpdateServerBoolean();
CalamityNetcode.SyncWorld();
}
}
+1 -1
View File
@@ -428,7 +428,7 @@ namespace CalamityMod.NPCs.SunkenSea
// Mark Giant Clam as dead
CalamityWorld.downedCLAM = true;
CalamityWorld.downedCLAMHardMode = Main.hardMode || CalamityWorld.downedCLAMHardMode;
CalamityMod.UpdateServerBoolean();
CalamityNetcode.SyncWorld();
}
}
}
+1 -1
View File
@@ -163,7 +163,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas
public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection)
{
if (CalamityMod.projectileDestroyExceptionList.TrueForAll(x => projectile.type != x))
if (CalamityLists.projectileDestroyExceptionList.TrueForAll(x => projectile.type != x))
{
if (projectile.penetrate == -1 && !projectile.minion)
{
+1 -1
View File
@@ -174,7 +174,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas
public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection)
{
if (CalamityMod.projectileDestroyExceptionList.TrueForAll(x => projectile.type != x))
if (CalamityLists.projectileDestroyExceptionList.TrueForAll(x => projectile.type != x))
{
if (projectile.penetrate == -1 && !projectile.minion)
{
+1 -1
View File
@@ -318,7 +318,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas
public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection)
{
if (CalamityMod.projectileDestroyExceptionList.TrueForAll(x => projectile.type != x))
if (CalamityLists.projectileDestroyExceptionList.TrueForAll(x => projectile.type != x))
{
if (projectile.penetrate == -1 && !projectile.minion)
{
+1 -1
View File
@@ -182,7 +182,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas
public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection)
{
if (CalamityMod.projectileDestroyExceptionList.TrueForAll(x => projectile.type != x))
if (CalamityLists.projectileDestroyExceptionList.TrueForAll(x => projectile.type != x))
{
if (projectile.penetrate == -1 && !projectile.minion)
{
+8 -8
View File
@@ -223,7 +223,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas
if (Main.slimeRain)
{
Main.StopSlimeRain(true);
CalamityMod.UpdateServerBoolean();
CalamityNetcode.SyncWorld();
}
CalamityMod.StopRain();
@@ -1259,7 +1259,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas
// Reduce acceleration if target is holding a true melee weapon
Item targetSelectedItem = player.inventory[player.selectedItem];
if (targetSelectedItem.melee && (targetSelectedItem.shoot == 0 || CalamityMod.trueMeleeProjectileList.Contains(targetSelectedItem.shoot)))
if (targetSelectedItem.melee && (targetSelectedItem.shoot == 0 || CalamityLists.trueMeleeProjectileList.Contains(targetSelectedItem.shoot)))
{
num824 *= 0.5f;
}
@@ -1446,7 +1446,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas
// Reduce acceleration if target is holding a true melee weapon
Item targetSelectedItem = player.inventory[player.selectedItem];
if (targetSelectedItem.melee && (targetSelectedItem.shoot == 0 || CalamityMod.trueMeleeProjectileList.Contains(targetSelectedItem.shoot)))
if (targetSelectedItem.melee && (targetSelectedItem.shoot == 0 || CalamityLists.trueMeleeProjectileList.Contains(targetSelectedItem.shoot)))
{
num413 *= 0.5f;
}
@@ -1539,7 +1539,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas
// Reduce acceleration if target is holding a true melee weapon
Item targetSelectedItem = player.inventory[player.selectedItem];
if (targetSelectedItem.melee && (targetSelectedItem.shoot == 0 || CalamityMod.trueMeleeProjectileList.Contains(targetSelectedItem.shoot)))
if (targetSelectedItem.melee && (targetSelectedItem.shoot == 0 || CalamityLists.trueMeleeProjectileList.Contains(targetSelectedItem.shoot)))
{
num833 *= 0.5f;
}
@@ -1803,7 +1803,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas
// Reduce acceleration if target is holding a true melee weapon
Item targetSelectedItem = player.inventory[player.selectedItem];
if (targetSelectedItem.melee && (targetSelectedItem.shoot == 0 || CalamityMod.trueMeleeProjectileList.Contains(targetSelectedItem.shoot)))
if (targetSelectedItem.melee && (targetSelectedItem.shoot == 0 || CalamityLists.trueMeleeProjectileList.Contains(targetSelectedItem.shoot)))
{
num824 *= 0.5f;
}
@@ -1987,7 +1987,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas
// Reduce acceleration if target is holding a true melee weapon
Item targetSelectedItem = player.inventory[player.selectedItem];
if (targetSelectedItem.melee && (targetSelectedItem.shoot == 0 || CalamityMod.trueMeleeProjectileList.Contains(targetSelectedItem.shoot)))
if (targetSelectedItem.melee && (targetSelectedItem.shoot == 0 || CalamityLists.trueMeleeProjectileList.Contains(targetSelectedItem.shoot)))
{
num413 *= 0.5f;
}
@@ -2080,7 +2080,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas
// Reduce acceleration if target is holding a true melee weapon
Item targetSelectedItem = player.inventory[player.selectedItem];
if (targetSelectedItem.melee && (targetSelectedItem.shoot == 0 || CalamityMod.trueMeleeProjectileList.Contains(targetSelectedItem.shoot)))
if (targetSelectedItem.melee && (targetSelectedItem.shoot == 0 || CalamityLists.trueMeleeProjectileList.Contains(targetSelectedItem.shoot)))
{
num833 *= 0.5f;
}
@@ -2237,7 +2237,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas
// Mark Supreme Calamitas as dead
CalamityWorld.downedSCal = true;
CalamityMod.UpdateServerBoolean();
CalamityNetcode.SyncWorld();
}
#endregion
+1 -1
View File
@@ -85,7 +85,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas
// Reduce acceleration if target is holding a true melee weapon
Item targetSelectedItem = Main.player[npc.target].inventory[Main.player[npc.target].selectedItem];
if (targetSelectedItem.melee && (targetSelectedItem.shoot == 0 || CalamityMod.trueMeleeProjectileList.Contains(targetSelectedItem.shoot)))
if (targetSelectedItem.melee && (targetSelectedItem.shoot == 0 || CalamityLists.trueMeleeProjectileList.Contains(targetSelectedItem.shoot)))
{
num677 *= 0.5f;
}
+1 -1
View File
@@ -85,7 +85,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas
// Reduce acceleration if target is holding a true melee weapon
Item targetSelectedItem = Main.player[npc.target].inventory[Main.player[npc.target].selectedItem];
if (targetSelectedItem.melee && (targetSelectedItem.shoot == 0 || CalamityMod.trueMeleeProjectileList.Contains(targetSelectedItem.shoot)))
if (targetSelectedItem.melee && (targetSelectedItem.shoot == 0 || CalamityLists.trueMeleeProjectileList.Contains(targetSelectedItem.shoot)))
{
num677 *= 0.5f;
}
+1 -1
View File
@@ -197,7 +197,7 @@ namespace CalamityMod.NPCs.TownNPCs
dialogue.Add("If I was a magical horse, I'd be out in space swirling cocktails, as I watch space worms battle for my enjoyment.");
}
IList<string> donorList = new List<string>(CalamityMod.donatorList);
IList<string> donorList = new List<string>(CalamityLists.donatorList);
string[] donors = new string[12];
for (int i = 0; i < 12; i++)
{
+1 -1
View File
@@ -207,7 +207,7 @@ namespace CalamityMod.NPCs.TownNPCs
case 1:
return "Hey, if government officials can get tax, why can't I? The heck do you mean that these two things are nothing alike?";
}
CalamityMod.UpdateServerBoolean();
CalamityNetcode.SyncWorld();
}
return "Sorry, I got nothing. Perhaps you could reforge something and come back later...";
}
+2 -2
View File
@@ -2791,7 +2791,7 @@ namespace CalamityMod.NPCs.Yharon
if (!startSecondAI && !CalamityWorld.buffedEclipse)
{
CalamityWorld.buffedEclipse = true;
CalamityMod.UpdateServerBoolean();
CalamityNetcode.SyncWorld();
string key = "Mods.CalamityMod.DargonBossText";
Color messageColor = Color.Orange;
@@ -2861,7 +2861,7 @@ namespace CalamityMod.NPCs.Yharon
// Mark Yharon as dead
CalamityWorld.downedYharon = true;
CalamityMod.UpdateServerBoolean();
CalamityNetcode.SyncWorld();
}
}
+13 -13
View File
@@ -83,7 +83,7 @@ namespace CalamityMod.Projectiles
#region SetDefaults
public override void SetDefaults(Projectile projectile)
{
if (CalamityMod.trueMeleeProjectileList.Contains(projectile.type))
if (CalamityLists.trueMeleeProjectileList.Contains(projectile.type))
trueMelee = true;
switch (projectile.type)
@@ -686,7 +686,7 @@ namespace CalamityMod.Projectiles
if (NPC.downedMoonlord)
{
if (CalamityMod.dungeonProjectileBuffList.Contains(projectile.type))
if (CalamityLists.dungeonProjectileBuffList.Contains(projectile.type))
{
//Prevents them being buffed in Skeletron, Skeletron Prime, or Golem fights
if (((projectile.type == ProjectileID.RocketSkeleton || projectile.type == ProjectileID.Shadowflames) && projectile.ai[1] == 1f) ||
@@ -701,12 +701,12 @@ namespace CalamityMod.Projectiles
if (CalamityWorld.downedDoG && (Main.pumpkinMoon || Main.snowMoon))
{
if (CalamityMod.eventProjectileBuffList.Contains(projectile.type))
if (CalamityLists.eventProjectileBuffList.Contains(projectile.type))
projectile.damage = defDamage + 70;
}
else if (CalamityWorld.buffedEclipse && Main.eclipse)
{
if (CalamityMod.eventProjectileBuffList.Contains(projectile.type))
if (CalamityLists.eventProjectileBuffList.Contains(projectile.type))
projectile.damage = defDamage + 100;
}
@@ -833,12 +833,12 @@ namespace CalamityMod.Projectiles
if (modPlayer.etherealExtorter)
{
if (CalamityMod.spikyBallProjList.Contains(projectile.type) && !extorterBoost && Main.moonPhase == 2) //third quarter
if (CalamityLists.spikyBallProjList.Contains(projectile.type) && !extorterBoost && Main.moonPhase == 2) //third quarter
{
projectile.timeLeft += 300;
extorterBoost = true;
}
if (CalamityMod.javelinProjList.Contains(projectile.type) && !extorterBoost && player.ZoneCrimson)
if (CalamityLists.javelinProjList.Contains(projectile.type) && !extorterBoost && player.ZoneCrimson)
{
projectile.knockBack *= 2;
extorterBoost = true;
@@ -880,7 +880,7 @@ namespace CalamityMod.Projectiles
if (!projectile.npcProj && !projectile.trap && projectile.friendly && projectile.damage > 0)
{
if (modPlayer.eQuiver && projectile.ranged && CalamityMod.rangedProjectileExceptionList.TrueForAll(x => projectile.type != x))
if (modPlayer.eQuiver && projectile.ranged && CalamityLists.rangedProjectileExceptionList.TrueForAll(x => projectile.type != x))
{
if (Main.rand.Next(200) > 198)
{
@@ -1745,14 +1745,14 @@ namespace CalamityMod.Projectiles
if (modPlayer.shadow && modPlayer.shadowPotCooldown <= 0)
{
if (CalamityMod.javelinProjList.Contains(projectile.type))
if (CalamityLists.javelinProjList.Contains(projectile.type))
{
int randrot = Main.rand.Next(-30, 391);
Vector2 SoulSpeed = new Vector2(13f, 13f).RotatedBy(MathHelper.ToRadians(randrot));
Projectile.NewProjectile(projectile.Center, SoulSpeed, ModContent.ProjectileType<PenumbraSoul>(), CalamityUtils.DamageSoftCap(projectile.damage * 0.1, 60), 3f, projectile.owner, 0f, 0f);
modPlayer.shadowPotCooldown = 30;
}
if (CalamityMod.spikyBallProjList.Contains(projectile.type))
if (CalamityLists.spikyBallProjList.Contains(projectile.type))
{
int scythe = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType<CosmicScythe>(), CalamityUtils.DamageSoftCap(projectile.damage * 0.05, 60), 3f, projectile.owner, 0f, 0f);
Main.projectile[scythe].usesLocalNPCImmunity = true;
@@ -1760,7 +1760,7 @@ namespace CalamityMod.Projectiles
Main.projectile[scythe].penetrate = 2;
modPlayer.shadowPotCooldown = 30;
}
if (CalamityMod.daggerProjList.Contains(projectile.type))
if (CalamityLists.daggerProjList.Contains(projectile.type))
{
Vector2 shardVelocity = new Vector2(Main.rand.NextFloat(-1f, 1f), Main.rand.NextFloat(-1f, 1f));
shardVelocity.Normalize();
@@ -1769,7 +1769,7 @@ namespace CalamityMod.Projectiles
Main.projectile[shard].timeLeft = 150;
modPlayer.shadowPotCooldown = 30;
}
if (CalamityMod.boomerangProjList.Contains(projectile.type))
if (CalamityLists.boomerangProjList.Contains(projectile.type))
{
int spiritDamage = CalamityUtils.DamageSoftCap(projectile.damage * 0.2, 60);
Projectile ghost = SpawnOrb(projectile, spiritDamage, ProjectileID.SpectreWrath, 800f, 4f);
@@ -1777,7 +1777,7 @@ namespace CalamityMod.Projectiles
ghost.penetrate = 1;
modPlayer.shadowPotCooldown = 30;
}
if (CalamityMod.flaskBombProjList.Contains(projectile.type))
if (CalamityLists.flaskBombProjList.Contains(projectile.type))
{
int blackhole = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType<ShadowBlackhole>(), CalamityUtils.DamageSoftCap(projectile.damage * 0.05, 60), 3f, projectile.owner, 0f, 0f);
Main.projectile[blackhole].Center = projectile.Center;
@@ -2084,7 +2084,7 @@ namespace CalamityMod.Projectiles
Main.projectile[soul].tileCollide = false;
}
}
if (modPlayer.scuttlersJewel && CalamityMod.javelinProjList.Contains(projectile.type) && Main.rand.NextBool(3))
if (modPlayer.scuttlersJewel && CalamityLists.javelinProjList.Contains(projectile.type) && Main.rand.NextBool(3))
{
float dmgMult = 1f;
if (projectile.type == ProjectileType<SpearofDestinyProjectile>())
+1 -1
View File
@@ -11,7 +11,7 @@ namespace CalamityMod.Projectiles.Typeless
public class YanmeisKnifeSlash : ModProjectile
{
// This is a rather weird thing, but it's what the patron asked for.
public static readonly Func<NPC, bool> CanRecieveCoolEffectsFrom = (npc) => npc.boss || CalamityMod.bossMinionList.Contains(npc.type);
public static readonly Func<NPC, bool> CanRecieveCoolEffectsFrom = (npc) => npc.boss || CalamityLists.bossMinionList.Contains(npc.type);
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Yanmei's Knife");
@@ -69,7 +69,7 @@ namespace CalamityMod.Tiles.LivingFire
for (int k = 0; k < around.Count; ++k)
{
Tile tile = Main.tile[around[k][0], around[k][1]];
if (tile.active() && (Main.tileSolid[tile.type] || CalamityMod.livingFireBlockList.Contains(tile.type)))
if (tile.active() && (Main.tileSolid[tile.type] || CalamityLists.livingFireBlockList.Contains(tile.type)))
{
return true;
}
@@ -68,7 +68,7 @@ namespace CalamityMod.Tiles.LivingFire
for (int k = 0; k < around.Count; ++k)
{
Tile tile = Main.tile[around[k][0], around[k][1]];
if (tile.active() && (Main.tileSolid[tile.type] || CalamityMod.livingFireBlockList.Contains(tile.type)))
if (tile.active() && (Main.tileSolid[tile.type] || CalamityLists.livingFireBlockList.Contains(tile.type)))
{
return true;
}
+1 -1
View File
@@ -68,7 +68,7 @@ namespace CalamityMod.Tiles.LivingFire
for (int k = 0; k < around.Count; ++k)
{
Tile tile = Main.tile[around[k][0], around[k][1]];
if (tile.active() && (Main.tileSolid[tile.type] || CalamityMod.livingFireBlockList.Contains(tile.type)))
if (tile.active() && (Main.tileSolid[tile.type] || CalamityLists.livingFireBlockList.Contains(tile.type)))
{
return true;
}
+49 -2
View File
@@ -57,6 +57,7 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using Terraria;
using Terraria.DataStructures;
@@ -806,7 +807,7 @@ namespace CalamityMod
public static int CountHookProj() => Main.projectile.Count(proj => Main.projHook[proj.type] && proj.ai[0] == 2f && proj.active && proj.owner == Main.myPlayer);
public static bool IsSummon(this Projectile proj) => proj.minion || proj.sentry || CalamityMod.projectileMinionList.Contains(proj.type) || ProjectileID.Sets.MinionShot[proj.type] || ProjectileID.Sets.SentryShot[proj.type];
public static bool IsSummon(this Projectile proj) => proj.minion || proj.sentry || CalamityLists.projectileMinionList.Contains(proj.type) || ProjectileID.Sets.MinionShot[proj.type] || ProjectileID.Sets.SentryShot[proj.type];
public static void KillAllHostileProjectiles()
{
@@ -3647,7 +3648,7 @@ namespace CalamityMod
Main.raining = true;
if (torrentialTear)
TorrentialTear.AdjustRainSeverity(false);
CalamityMod.UpdateServerBoolean();
CalamityNetcode.SyncWorld();
}
public static void StartSandstorm()
@@ -3793,13 +3794,59 @@ namespace CalamityMod
int num4 = Math.Max(0, Math.Min(tileRectangle.Bottom, Main.maxTilesY));
return new Rectangle(num, num2, num3 - num, num4 - num2);
}
#endregion
#region Saving, Loading, and Sending Utilities
/// <summary>
/// Binary serializes an object and returns the resultant byte array buffer.
/// </summary>
/// <param name="toSerialize">The object that is to be serialized.</param>
/// <returns>The buffer.</returns>
public static byte[] SerializeObject(object toSerialize)
{
byte[] buffer;
using (var stream = new MemoryStream())
{
new BinaryFormatter().Serialize(stream, toSerialize);
buffer = stream.ToArray();
}
return buffer;
}
/// <summary>
/// Deserializes a binary serialized buffer and returns the original object.
/// </summary>
/// <param name="buffer">The buffer.</param>
/// <returns>The object that was serialized.</returns>
public static object DeserializeObject(byte[] buffer)
{
object deserializedData;
using (var stream = new MemoryStream(buffer))
{
deserializedData = new BinaryFormatter().Deserialize(stream);
}
return deserializedData;
}
/// <summary>
/// Saves a mod item and appends the data to a <see cref="TagCompound"/>.
/// </summary>
/// <param name="tag">The tag to append to.</param>
/// <param name="itemToSave">The item to save.</param>
/// <param name="itemIndex">A number used for discerning the item out of multiple items.</param>
public static void SaveModItem(TagCompound tag, Item itemToSave, int itemIndex = 0)
{
tag.Add($"mod{itemIndex}", itemToSave.modItem?.mod?.Name ?? string.Empty);
tag.Add($"name{itemIndex}", itemToSave.modItem?.Name ?? string.Empty);
}
/// <summary>
/// Loads a mod item from a <see cref="TagCompound"/>.
/// </summary>
/// <param name="tag">The tag that contains the original item.</param>
/// <param name="itemIndex">The number used to discern the item out of potentially multiple.</param>
/// <returns>The original item.</returns>
public static Item LoadModItem(TagCompound tag, int itemIndex = 0)
{
string modName = tag.GetString($"mod{itemIndex}");
+7 -7
View File
@@ -1106,7 +1106,7 @@ namespace CalamityMod.World
{
BossRushEvent.DeactivateStupidFuckingBullshit = true;
BossRushEvent.BossRushActive = false;
CalamityMod.UpdateServerBoolean();
CalamityNetcode.SyncWorld();
}
// Attempt to start the acid rain at the 4:29AM
@@ -1114,7 +1114,7 @@ namespace CalamityMod.World
if (Main.time == 32399 && !Main.dayTime && Main.rand.NextBool(moreRain ? 3 : 300) && !Main.LocalPlayer.Calamity().noStupidNaturalARSpawns)
{
AcidRainEvent.TryStartEvent();
CalamityMod.UpdateServerBoolean();
CalamityNetcode.SyncWorld();
}
if (NPC.downedBoss1 && !downedEoCAcidRain && !forcedRainAlready)
{
@@ -1126,7 +1126,7 @@ namespace CalamityMod.World
{
forcedRainAlready = true;
AcidRainEvent.TryStartEvent();
CalamityMod.UpdateServerBoolean();
CalamityNetcode.SyncWorld();
}
}
}
@@ -1134,7 +1134,7 @@ namespace CalamityMod.World
if (forceRainTimer == 1)
{
AcidRainEvent.TryStartEvent();
CalamityMod.UpdateServerBoolean();
CalamityNetcode.SyncWorld();
}
if (forceRainTimer > 0)
forceRainTimer--;
@@ -1172,7 +1172,7 @@ namespace CalamityMod.World
// Makes rain pour at its maximum intensity (but only after an idiot meanders into the Sulphurous Sea)
// You'll never catch me, Fabs, Not when I shift into MAXIMUM OVERDRIVE!!
startAcidicDownpour = true;
CalamityMod.UpdateServerBoolean();
CalamityNetcode.SyncWorld();
break;
}
}
@@ -1183,7 +1183,7 @@ namespace CalamityMod.World
if (Main.raining && NPC.AnyNPCs(ModContent.NPCType<OldDuke>()))
{
Main.raining = false;
CalamityMod.UpdateServerBoolean();
CalamityNetcode.SyncWorld();
}
// If the rain stops for whatever reason, end the invasion.
@@ -1986,7 +1986,7 @@ namespace CalamityMod.World
{
Main.time = 0.0;
Main.dayTime = day;
CalamityMod.UpdateServerBoolean();
CalamityNetcode.SyncWorld();
}
#endregion