Files
CalamityModPublic/CalPlayer/CalamityPlayerMiscEffects.cs
T
Andrew Marheine c7773b5f73 Death Mode blizzard shards fall slower.
Cryogen is now in the center of his ice shield.
SCal brimstone monsters spread apart slower.
SCal gigablasts always collide with tiles.
Yharon and SCal antibutcher protection reduced from 10% to 50%.
Death Mode lightning telegraph collides with platforms.
2020-05-09 23:12:11 -05:00

3611 lines
113 KiB
C#

using CalamityMod.Buffs.Cooldowns;
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Buffs.Potions;
using CalamityMod.Buffs.StatBuffs;
using CalamityMod.Buffs.StatDebuffs;
using CalamityMod.Buffs.Summon;
using CalamityMod.Dusts;
using CalamityMod.Items.Armor;
using CalamityMod.Items.Fishing.AstralCatches;
using CalamityMod.Items.Fishing.FishingRods;
using CalamityMod.Items.Weapons.Ranged;
using CalamityMod.NPCs;
using CalamityMod.NPCs.AcidRain;
using CalamityMod.NPCs.Astral;
using CalamityMod.NPCs.Crags;
using CalamityMod.NPCs.NormalNPCs;
using CalamityMod.NPCs.SupremeCalamitas;
using CalamityMod.Projectiles.Boss;
using CalamityMod.Projectiles.Enemy;
using CalamityMod.Projectiles.Environment;
using CalamityMod.Projectiles.Melee;
using CalamityMod.Projectiles.Rogue;
using CalamityMod.Projectiles.Summon;
using CalamityMod.Projectiles.Typeless;
using CalamityMod.UI;
using CalamityMod.World;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using Terraria;
using Terraria.GameContent.Events;
using Terraria.Graphics.Shaders;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.CalPlayer
{
public class CalamityPlayerMiscEffects
{
#region Post Update Misc Effects
public static void CalamityPostUpdateMiscEffects(Player player, Mod mod)
{
CalamityPlayer modPlayer = player.Calamity();
// No category
// Decrease the counter on Fearmonger set turbo regeneration
if (modPlayer.fearmongerRegenFrames > 0)
modPlayer.fearmongerRegenFrames--;
// Reduce the expert debuff time multiplier to the normal mode multiplier
if (CalamityMod.CalamityConfig.ExpertDebuffDurationReduction)
Main.expertDebuffTime = 1f;
// Bool for any existing bosses, true if any boss NPC is active
CalamityPlayer.areThereAnyDamnBosses = CalamityGlobalNPC.AnyBossNPCS();
// If any boss NPC is active, apply Zen to the player to reduce spawn rate
if (CalamityPlayer.areThereAnyDamnBosses)
{
if (player.whoAmI == Main.myPlayer)
player.AddBuff(ModContent.BuffType<BossZen>(), 2, false);
}
// Revengeance effects
RevengeanceModeMiscEffects(player, modPlayer, mod);
// Abyss effects
AbyssEffects(player, modPlayer);
// Misc effects, because I don't know what else to call it
MiscEffects(player, modPlayer, mod);
// Max life and mana effects
MaxLifeAndManaEffects(player, modPlayer, mod);
// Standing still effects
StandingStillEffects(player, modPlayer);
// Elysian Aegis effects
ElysianAegisEffects(player, modPlayer);
// Other buff effects
OtherBuffEffects(player, modPlayer);
// Limits
Limits(player, modPlayer);
// Endurance reductions
EnduranceReductions(player, modPlayer);
// Stat Meter
UpdateStatMeter(player, modPlayer);
// Rogue Mirrors
RogueMirrors(player, modPlayer);
}
#endregion
#region Revengeance Effects
private static void RevengeanceModeMiscEffects(Player player, CalamityPlayer modPlayer, Mod mod)
{
if (CalamityWorld.revenge)
{
// Signus headcrab effect
if (CalamityGlobalNPC.signus != -1)
{
if (Main.npc[CalamityGlobalNPC.signus].active)
{
if (Vector2.Distance(player.Center, Main.npc[CalamityGlobalNPC.signus].Center) <= 5200f)
{
float signusLifeRatio = 1f - (Main.npc[CalamityGlobalNPC.signus].life / Main.npc[CalamityGlobalNPC.signus].lifeMax);
// Reduce the power of Signus darkness based on your light level.
float multiplier = 1f;
switch (modPlayer.GetTotalLightStrength())
{
case 0:
break;
case 1:
case 2:
multiplier = 0.75f;
break;
case 3:
case 4:
multiplier = 0.5f;
break;
case 5:
case 6:
multiplier = 0.25f;
break;
default:
multiplier = 0f;
break;
}
// Increased darkness in Death Mode
if (CalamityWorld.death)
multiplier += (1f - multiplier) * 0.1f;
// Total darkness
float signusDarkness = signusLifeRatio * multiplier;
// Headcrab effect
if (!modPlayer.ZoneAbyss && !player.headcovered)
{
float screenObstructionAmt = MathHelper.Clamp(signusDarkness, 0f, 0.63f);
float targetValue = MathHelper.Clamp(screenObstructionAmt * 0.45f, 0.1f, 0.2f);
ScreenObstruction.screenObstruction = MathHelper.Lerp(ScreenObstruction.screenObstruction, screenObstructionAmt, targetValue);
}
}
}
}
// Life Steal nerf
if (player.lifeSteal > (CalamityWorld.death ? 50f : 60f))
player.lifeSteal = CalamityWorld.death ? 50f : 60f;
if (player.whoAmI == Main.myPlayer)
{
// Titanium Armor nerf
if (player.onHitDodge)
{
for (int l = 0; l < Player.MaxBuffs; l++)
{
int hasBuff = player.buffType[l];
if (player.buffTime[l] > 360 && hasBuff == BuffID.ShadowDodge)
player.buffTime[l] = 360;
}
}
// Immunity Frames nerf
if (player.immuneTime > 120)
player.immuneTime = 120;
// Adrenaline and Rage
if (CalamityMod.CalamityConfig.AdrenalineAndRage)
{
// This is how much Rage will be changed by this frame.
float rageDiff = 0;
// If Rage Mode is currently active, you smoothly lose all rage over the duration.
if (modPlayer.rageModeActive)
rageDiff = -modPlayer.rageMax / CalamityPlayer.RageDuration;
// Draedon's Heart gives 1 rage per frame. Heart of Darkness gives 0.5 rage per frame.
else if (modPlayer.draedonsHeart)
rageDiff += 1f;
else if (modPlayer.heartOfDarkness)
rageDiff += 0.5f;
// Apply the rage change and cap rage in both directions.
modPlayer.rage += rageDiff;
if (modPlayer.rage < 0)
modPlayer.rage = 0;
if (modPlayer.rage >= modPlayer.rageMax)
{
modPlayer.rage = modPlayer.rageMax;
// Play a sound when the Rage Meter is full
if (modPlayer.playFullRageSound)
{
modPlayer.playFullRageSound = false;
Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/FullRage"), (int)player.position.X, (int)player.position.Y);
}
}
else
modPlayer.playFullRageSound = true;
// Randomly-granted Absolute Rage buff when Rage is nearly full
if (modPlayer.rage / modPlayer.rageMax >= CalamityPlayer.AbsoluteRageThreshold && !modPlayer.absoluteRage)
{
int absoluteRageChance = (modPlayer.draedonsHeart || modPlayer.heartOfDarkness) ? 2000 : 10000;
if (Main.rand.NextBool(absoluteRageChance))
player.AddBuff(ModContent.BuffType<AbsoluteRage>(), 18000);
}
// This is how much Adrenaline will be changed by this frame.
float adrenalineDiff = 0;
bool SCalAlive = NPC.AnyNPCs(ModContent.NPCType<SupremeCalamitas>());
bool wofAndNotHell = Main.wof >= 0 && player.position.Y < (float)((Main.maxTilesY - 200) * 16);
// If Adrenaline Mode is currently active, you smoothly lose all adrenaline over the duration.
if (modPlayer.adrenalineModeActive)
adrenalineDiff = -modPlayer.adrenalineMax / CalamityPlayer.AdrenalineDuration;
else
{
// If any boss is alive (or you are between DoG phases), you gain adrenaline smoothly.
// EXCEPTION: Wall of Flesh is alive and you are not in hell. Then you don't get anything.
if ((CalamityPlayer.areThereAnyDamnBosses || CalamityWorld.DoGSecondStageCountdown > 0) && !wofAndNotHell)
{
int numAdrenBoosts =
(modPlayer.adrenalineBoostOne ? 1 : 0) +
(modPlayer.adrenalineBoostTwo ? 1 : 0) +
(modPlayer.adrenalineBoostThree ? 1 : 0);
int adrenFillSeconds = 3600;
switch (numAdrenBoosts)
{
default: adrenFillSeconds = 45; break; // Early game: 45 seconds
case 1: adrenFillSeconds = 35; break; // Slime God: 35 seconds
case 2: adrenFillSeconds = 25; break; // Astrum Deus: 25 sceonds
case 3: adrenFillSeconds = 20; break; // Polterghast: 20 seconds
}
adrenalineDiff += modPlayer.adrenalineMax / (60f * adrenFillSeconds);
}
// If you aren't actively in a boss fight, adrenaline rapidly fades away over 2 seconds.
else
adrenalineDiff = -modPlayer.adrenalineMax / 120f;
}
// All positive adrenaline gains are multiplied by 44.44444% during the SCal fight.
// This is likely to be changed so that SCal cancels the items directly.
if (SCalAlive && adrenalineDiff > 0f)
adrenalineDiff *= 4f / 9f;
// Apply the adrenaline change and cap adrenaline in both directions.
modPlayer.adrenaline += adrenalineDiff;
if (modPlayer.adrenaline < 0)
modPlayer.adrenaline = 0;
if (modPlayer.adrenaline >= modPlayer.adrenalineMax)
{
modPlayer.adrenaline = modPlayer.adrenalineMax;
// Play a sound when the Adrenaline Meter is full
if (modPlayer.playFullAdrenalineSound)
{
modPlayer.playFullAdrenalineSound = false;
Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/FullAdrenaline"), (int)player.position.X, (int)player.position.Y);
}
}
else
modPlayer.playFullAdrenalineSound = true;
}
}
}
// If Revengeance Mode is not active, then set rippers to zero
else if (player.whoAmI == Main.myPlayer)
{
modPlayer.rage = 0;
modPlayer.adrenaline = 0;
}
// Send Rage and Adrenaline info packets during multiplayer
if (player.whoAmI == Main.myPlayer && Main.netMode == NetmodeID.MultiplayerClient)
{
modPlayer.packetTimer++;
if (modPlayer.packetTimer == 60)
{
modPlayer.packetTimer = 0;
modPlayer.StressPacket(false);
modPlayer.AdrenalinePacket(false);
modPlayer.DeathModeUnderworldTimePacket(false);
modPlayer.DeathModeBlizzardTimePacket(false);
}
}
}
#endregion
#region Misc Effects
private static void MiscEffects(Player player, CalamityPlayer modPlayer, Mod mod)
{
if (modPlayer.stealthUIAlpha > 0f && (modPlayer.rogueStealth <= 0f || modPlayer.rogueStealthMax <= 0f))
{
modPlayer.stealthUIAlpha -= 0.035f;
modPlayer.stealthUIAlpha = MathHelper.Clamp(modPlayer.stealthUIAlpha, 0f, 1f);
}
else if (modPlayer.stealthUIAlpha < 1f)
{
modPlayer.stealthUIAlpha += 0.035f;
modPlayer.stealthUIAlpha = MathHelper.Clamp(modPlayer.stealthUIAlpha, 0f, 1f);
}
// Proficiency level ups
if (CalamityMod.CalamityConfig.ProficiencyEnabled)
modPlayer.GetExactLevelUp();
// Max mana bonuses
player.statManaMax2 +=
(modPlayer.permafrostsConcoction ? 50 : 0) +
(modPlayer.pHeart ? 50 : 0) +
(modPlayer.eCore ? 50 : 0) +
(modPlayer.cShard ? 50 : 0) +
(modPlayer.starBeamRye ? 50 : 0);
// Nebula Armor nerf
if (player.nebulaLevelMana > 0 && player.statMana < player.statManaMax2)
{
int num = 12;
modPlayer.nebulaManaNerfCounter += player.nebulaLevelMana;
if (modPlayer.nebulaManaNerfCounter >= num)
{
modPlayer.nebulaManaNerfCounter -= num;
player.statMana--;
if (player.statMana < 0)
player.statMana = 0;
}
}
else
modPlayer.nebulaManaNerfCounter = 0;
// Bool for drawing boss health bar small text or not
if (Main.myPlayer == player.whoAmI)
BossHealthBarManager.SHOULD_DRAW_SMALLTEXT_HEALTH = modPlayer.shouldDrawSmallText;
// Margarita halved debuff duration
if (modPlayer.margarita)
{
if (Main.myPlayer == player.whoAmI)
{
for (int l = 0; l < Player.MaxBuffs; l++)
{
int hasBuff = player.buffType[l];
if (player.buffTime[l] > 2 && CalamityMod.debuffList.Contains(hasBuff))
{
player.buffTime[l]--;
}
}
}
}
// Immunity to most debuffs
if (modPlayer.silvaSet || modPlayer.invincible)
{
foreach (int debuff in CalamityMod.debuffList)
player.buffImmune[debuff] = true;
}
// Transformer immunity to Electrified
if (modPlayer.aSparkRare)
player.buffImmune[BuffID.Electrified] = true;
// Reduce breath meter while in icy water instead of chilling
bool canBreath = ((modPlayer.sirenBoobs && NPC.downedBoss3) || (modPlayer.sirenBoobsAlt && NPC.downedBoss3) || player.gills || player.merman);
if (player.arcticDivingGear || canBreath)
{
player.buffImmune[ModContent.BuffType<FrozenLungs>()] = true;
}
if (CalamityMod.CalamityConfig.ExpertChilledWaterRemoval)
{
if (Main.expertMode && player.ZoneSnow && player.wet && !player.lavaWet && !player.honeyWet)
{
player.buffImmune[BuffID.Chilled] = true;
if (player.IsUnderwater())
{
if (Main.myPlayer == player.whoAmI)
{
player.AddBuff(ModContent.BuffType<FrozenLungs>(), 2, false);
}
}
}
if (modPlayer.iCantBreathe)
{
if (player.breath > 0)
player.breath--;
}
}
//extra DoT in the lava of the crags
if (modPlayer.ZoneCalamity && player.lavaWet)
{
player.AddBuff(ModContent.BuffType<CragsLava>(), 2, false);
}
// Acid rain droplets
if (player.whoAmI == Main.myPlayer)
{
if (CalamityWorld.rainingAcid && modPlayer.ZoneSulphur && !CalamityPlayer.areThereAnyDamnBosses && player.Center.Y < Main.worldSurface * 16f + 800f)
{
int acidRainDropRate = (int)(MathHelper.Clamp(Main.invasionSize * 0.4f, 13.5f, 50) * 2.25);
Vector2 spawnPoint = new Vector2(player.Center.X + Main.rand.Next(-1000, 1001), player.Center.Y - Main.rand.Next(700, 801));
if (player.miscCounter % acidRainDropRate == 0f)
{
if (CalamityWorld.downedAquaticScourge && !CalamityWorld.downedPolterghast && Main.rand.NextBool(12))
{
NPC.NewNPC((int)spawnPoint.X, (int)spawnPoint.Y, ModContent.NPCType<IrradiatedSlime>());
}
}
}
}
//Hydrothermal blue smoke effects but it doesn't work epicccccc
if (player.whoAmI == Main.myPlayer)
{
if (modPlayer.hydrothermalSmoke)
{
if ((double)player.velocity.X > 0 || (double)player.velocity.Y > 0 || (double)player.velocity.X < -0.1 || (double)player.velocity.Y < -0.1)
{
Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, ModContent.ProjectileType<HydrothermalSmoke>(), 0, 0f, player.whoAmI, 0f, 0f);
}
}
//trying to find a workaround because apparently putting the bool in ResetEffects prevents it from working
if (!player.armorEffectDrawOutlines)
{
modPlayer.hydrothermalSmoke = false;
}
}
// Death Mode effects
modPlayer.caveDarkness = 0f;
if (CalamityWorld.death)
{
if (player.whoAmI == Main.myPlayer)
{
// Calculate underground darkness here. The effect is applied in CalamityMod.ModifyLightingBrightness.
Point point = player.Center.ToTileCoordinates();
if (point.Y > Main.worldSurface && !modPlayer.ZoneAbyss && !player.ZoneUnderworldHeight)
{
// Darkness strength scales smoothly with how deep you are.
double totalUndergroundDepth = Main.maxTilesY - 200D - Main.worldSurface;
double playerUndergroundDepth = point.Y - Main.worldSurface;
double depthRatio = playerUndergroundDepth / totalUndergroundDepth;
int lightStrength = modPlayer.GetTotalLightStrength();
// In the last 50 blocks before hell, the darkness smoothly fades away.
float FadeAwayStart = (float)(1D - 50D / totalUndergroundDepth);
float darknessStrength = (float)(depthRatio / FadeAwayStart);
if (depthRatio > FadeAwayStart)
{
// Varies from 1.0 to 0.0 as depthRatio varies from FadeAwayStart to 1.0.
darknessStrength = (1f - (float)depthRatio) / (1f - FadeAwayStart);
}
// Reduce the power of cave darkness based on your light level. 5+ is enough to totally eliminate it.
switch (lightStrength)
{
case 0:
break;
case 1:
darknessStrength *= 0.75f;
break;
case 2:
darknessStrength *= 0.55f;
break;
case 3:
darknessStrength *= 0.35f;
break;
case 4:
darknessStrength *= 0.15f;
break;
default:
darknessStrength = 0f;
break;
}
modPlayer.caveDarkness = darknessStrength;
}
// Immunity bools
bool hasMoltenSet = player.head == ArmorIDs.Head.MoltenHelmet && player.body == ArmorIDs.Body.MoltenBreastplate && player.legs == ArmorIDs.Legs.MoltenGreaves;
bool immunityToHotAndCold = hasMoltenSet || player.magmaStone || player.frostArmor || modPlayer.fBulwark || modPlayer.fBarrier ||
modPlayer.frostFlare || modPlayer.rampartOfDeities || modPlayer.cryogenSoul || modPlayer.snowman || modPlayer.blazingCore || modPlayer.permafrostsConcoction || modPlayer.profanedCrystalBuffs || modPlayer.coldDivinity;
bool immunityToCold = player.HasBuff(BuffID.Campfire) || Main.campfire || player.resistCold || modPlayer.eskimoSet || player.buffImmune[BuffID.Frozen] || modPlayer.aAmpoule || player.HasBuff(BuffID.Inferno) || immunityToHotAndCold || modPlayer.externalColdImmunity;
bool immunityToHot = player.lavaImmune || player.lavaRose || player.lavaMax > 0 || immunityToHotAndCold || modPlayer.externalHeatImmunity;
// Thorn and spike effects
// 10 = crimson/corruption thorns, 17 = jungle thorns, 40 = dungeon spikes, 60 = temple spikes
Vector2 vector;
if (!player.mount.Active || !player.mount.Cart)
vector = Collision.HurtTiles(player.position, player.velocity, player.width, player.height, player.fireWalk);
else
vector = Collision.HurtTiles(player.position, player.velocity, player.width, player.height - 16, player.fireWalk);
switch ((int)vector.Y)
{
case 10:
player.AddBuff(BuffID.Weak, 300, false);
player.AddBuff(BuffID.Bleeding, 300, false);
break;
case 17:
player.AddBuff(BuffID.Poisoned, 300, false);
break;
case 40:
player.AddBuff(BuffID.Bleeding, 300, false);
break;
case 60:
player.AddBuff(BuffID.Venom, 300, false);
break;
default:
break;
}
// Astral effects
if (modPlayer.ZoneAstral)
{
player.gravity *= 0.75f;
}
// Space effects
if (player.InSpace())
{
if (Main.dayTime)
{
if (!immunityToHot)
player.AddBuff(BuffID.Burning, 2, false);
}
else
{
if (!immunityToCold)
player.AddBuff(BuffID.Frostburn, 2, false);
}
}
// Leech bleed
if (player.ZoneJungle && player.wet && !player.lavaWet && !player.honeyWet)
{
if (player.IsUnderwater())
player.AddBuff(BuffID.Bleeding, 300, false);
}
// Ice shards, lightning and sharknadoes
bool nearPillar = player.PillarZone();
if (player.ZoneOverworldHeight && !CalamityPlayer.areThereAnyDamnBosses && Main.invasionType == 0 && NPC.MoonLordCountdown == 0 && !player.InSpace() && !DD2Event.Ongoing && !nearPillar)
{
Vector2 sharknadoSpawnPoint = new Vector2(player.Center.X - (float)Main.rand.Next(300, 701), player.Center.Y - (float)Main.rand.Next(700, 801));
if (point.X > Main.maxTilesX / 2)
sharknadoSpawnPoint.X = player.Center.X + (float)Main.rand.Next(300, 701);
if (Main.raining)
{
float frequencyMult = 1f - Main.cloudAlpha; // 1 to 0.11
Vector2 spawnPoint = new Vector2(player.Center.X + (float)Main.rand.Next(-1000, 1001), player.Center.Y - (float)Main.rand.Next(700, 801));
Tile tileSafely = Framing.GetTileSafely((int)(spawnPoint.X / 16f), (int)(spawnPoint.Y / 16f));
if (player.ZoneSnow)
{
if (!tileSafely.active())
{
int divisor = (int)((Main.hardMode ? 50f : 60f) * frequencyMult);
float windVelocity = (float)Math.Sqrt((double)Math.Abs(Main.windSpeed)) * (float)Math.Sign(Main.windSpeed) * (Main.cloudAlpha + 0.5f) * 25f + Main.rand.NextFloat() * 0.2f - 0.1f;
Vector2 velocity = new Vector2(windVelocity * 0.2f, 3f * Main.rand.NextFloat());
if (player.miscCounter % divisor == 0 && Main.rand.NextBool(3))
Projectile.NewProjectile(spawnPoint.X, spawnPoint.Y, velocity.X, velocity.Y, ModContent.ProjectileType<IceRain>(), 20, 0f, player.whoAmI, 2f, 0f);
}
}
else
{
if (player.ZoneBeach && !modPlayer.ZoneSulphur)
{
int randomFrequency = (int)(50f * frequencyMult);
if (player.miscCounter == 280 && Main.rand.NextBool(randomFrequency) && player.ownedProjectileCounts[ProjectileID.Cthulunado] < 1)
{
Main.PlaySound(4, (int)sharknadoSpawnPoint.X, (int)sharknadoSpawnPoint.Y, 19, 1f, 0f);
int num331 = (int)(sharknadoSpawnPoint.Y / 16f);
int num332 = (int)(sharknadoSpawnPoint.X / 16f);
int num333 = 100;
if (num332 < 10)
num332 = 10;
if (num332 > Main.maxTilesX - 10)
num332 = Main.maxTilesX - 10;
if (num331 < 10)
num331 = 10;
if (num331 > Main.maxTilesY - num333 - 10)
num331 = Main.maxTilesY - num333 - 10;
int spawnAreaY = Main.maxTilesY - num331;
for (int num334 = num331; num334 < num331 + spawnAreaY; num334++)
{
Tile tile = Main.tile[num332, num334];
if ((tile.active() && Main.tileSolid[(int)tile.type]) || tile.liquid >= 200)
{
num331 = num334;
break;
}
}
int num336 = Projectile.NewProjectile((float)(num332 * 16 + 8), (float)(num331 * 16 - 24), 0f, 0f, ProjectileID.Cthulunado, 50, 4f, player.whoAmI, 16f, 24f);
Main.projectile[num336].netUpdate = true;
}
}
int randomFrequency2 = (int)(20f * frequencyMult);
if (CalamityWorld.rainingAcid && player.Calamity().ZoneSulphur)
randomFrequency2 = (int)(randomFrequency2 * 3.75);
if (player.miscCounter % (Main.hardMode ? 90 : 120) == 0 && Main.rand.NextBool(randomFrequency2))
{
if (!tileSafely.active())
{
float randomVelocity = Main.rand.NextFloat() - 0.5f;
Vector2 fireTo = new Vector2(spawnPoint.X + 100f * randomVelocity, spawnPoint.Y + 900f);
Vector2 ai0 = fireTo - spawnPoint;
Vector2 velocity = Vector2.Normalize(ai0) * 12f;
Projectile.NewProjectile(spawnPoint.X, spawnPoint.Y, 0f, velocity.Y, ModContent.ProjectileType<LightningMark>(), 0, 0f, player.whoAmI, 0f, 0f);
}
}
}
}
else
{
if (player.ZoneBeach && !modPlayer.ZoneSulphur)
{
if (player.miscCounter == 280 && Main.rand.NextBool(10) && player.ownedProjectileCounts[ProjectileID.Sharknado] < 1)
{
Main.PlaySound(4, (int)sharknadoSpawnPoint.X, (int)sharknadoSpawnPoint.Y, 19, 1f, 0f);
int num331 = (int)(sharknadoSpawnPoint.Y / 16f);
int num332 = (int)(sharknadoSpawnPoint.X / 16f);
int num333 = 100;
if (num332 < 10)
num332 = 10;
if (num332 > Main.maxTilesX - 10)
num332 = Main.maxTilesX - 10;
if (num331 < 10)
num331 = 10;
if (num331 > Main.maxTilesY - num333 - 10)
num331 = Main.maxTilesY - num333 - 10;
int spawnAreaY = Main.maxTilesY - num331;
for (int num334 = num331; num334 < num331 + spawnAreaY; num334++)
{
Tile tile = Main.tile[num332, num334];
if ((tile.active() && Main.tileSolid[(int)tile.type]) || tile.liquid >= 200)
{
num331 = num334;
break;
}
}
int num336 = Projectile.NewProjectile((float)(num332 * 16 + 8), (float)(num331 * 16 - 24), 0.01f, 0f, ProjectileID.Sharknado, 25, 4f, player.whoAmI, 16f, 15f);
Main.projectile[num336].netUpdate = true;
}
}
}
}
// Cold timer
if (!player.behindBackWall && Main.raining && player.ZoneSnow && !immunityToCold && player.ZoneOverworldHeight)
{
bool affectedByColdWater = player.wet && !player.lavaWet && !player.honeyWet && !player.arcticDivingGear;
player.AddBuff(ModContent.BuffType<DeathModeCold>(), 2, false);
modPlayer.deathModeBlizzardTime++;
if (affectedByColdWater)
modPlayer.deathModeBlizzardTime++;
if (modPlayer.deathModeUnderworldTime > 0)
{
modPlayer.deathModeUnderworldTime--;
if (affectedByColdWater)
modPlayer.deathModeUnderworldTime--;
if (modPlayer.deathModeUnderworldTime < 0)
modPlayer.deathModeUnderworldTime = 0;
}
}
else if (modPlayer.deathModeBlizzardTime > 0)
{
modPlayer.deathModeBlizzardTime--;
if (immunityToCold)
modPlayer.deathModeBlizzardTime--;
if (modPlayer.deathModeBlizzardTime < 0)
modPlayer.deathModeBlizzardTime = 0;
}
// Hot timer
if (player.ZoneUnderworldHeight && !immunityToHot)
{
bool affectedByHotLava = player.lavaWet;
player.AddBuff(ModContent.BuffType<DeathModeHot>(), 2, false);
modPlayer.deathModeUnderworldTime++;
if (affectedByHotLava)
modPlayer.deathModeUnderworldTime++;
if (modPlayer.deathModeBlizzardTime > 0)
{
modPlayer.deathModeBlizzardTime--;
if (affectedByHotLava)
modPlayer.deathModeBlizzardTime--;
if (modPlayer.deathModeBlizzardTime < 0)
modPlayer.deathModeBlizzardTime = 0;
}
}
else if (modPlayer.deathModeUnderworldTime > 0)
{
modPlayer.deathModeUnderworldTime--;
if (immunityToHot)
modPlayer.deathModeUnderworldTime--;
if (modPlayer.deathModeUnderworldTime < 0)
modPlayer.deathModeUnderworldTime = 0;
}
// Cold effects
if (modPlayer.deathModeBlizzardTime > 1800)
player.AddBuff(BuffID.Frozen, 2, false);
if (modPlayer.deathModeBlizzardTime > 1980)
modPlayer.KillPlayer();
// Hot effects
if (modPlayer.deathModeUnderworldTime > 360)
player.AddBuff(BuffID.Weak, 2, false);
if (modPlayer.deathModeUnderworldTime > 720)
player.AddBuff(BuffID.Slow, 2, false);
if (modPlayer.deathModeUnderworldTime > 1080)
player.AddBuff(BuffID.OnFire, 2, false);
if (modPlayer.deathModeUnderworldTime > 1440)
player.AddBuff(BuffID.Confused, 2, false);
if (modPlayer.deathModeUnderworldTime > 1800)
player.AddBuff(BuffID.Burning, 2, false);
}
}
// Increase fall speed
if (!player.mount.Active)
{
if (player.IsUnderwater() && modPlayer.ironBoots)
player.maxFallSpeed = 9f;
if (modPlayer.aeroSet && !player.wet)
player.maxFallSpeed = 15f;
if (modPlayer.gSabatonFall > 0 && !player.wet)
player.maxFallSpeed = 20f;
if (modPlayer.normalityRelocator)
player.maxFallSpeed *= 1.1f;
if (modPlayer.etherealExtorter && player.ZoneSkyHeight)
player.maxFallSpeed *= 1.25f;
}
// Normality Relocator bonus
if (modPlayer.normalityRelocator)
player.moveSpeed += 0.1f;
// Omega Blue Armor bonus
if (modPlayer.omegaBlueSet)
{
// Add tentacles
if (player.ownedProjectileCounts[ModContent.ProjectileType<OmegaBlueTentacle>()] < 6)
{
bool[] tentaclesPresent = new bool[6];
for (int i = 0; i < Main.maxProjectiles; i++)
{
Projectile projectile = Main.projectile[i];
if (projectile.active && projectile.type == ModContent.ProjectileType<OmegaBlueTentacle>() && projectile.owner == Main.myPlayer && projectile.ai[1] >= 0f && projectile.ai[1] < 6f)
tentaclesPresent[(int)projectile.ai[1]] = true;
}
for (int i = 0; i < 6; i++)
{
if (!tentaclesPresent[i])
{
int damage = (int)(666 * player.AverageDamage());
Vector2 vel = new Vector2(Main.rand.Next(-13, 14), Main.rand.Next(-13, 14)) * 0.25f;
Projectile.NewProjectile(player.Center, vel, ModContent.ProjectileType<OmegaBlueTentacle>(), damage, 8f, Main.myPlayer, Main.rand.Next(120), i);
}
}
}
float damageUp = 0.1f;
int critUp = 10;
if (modPlayer.omegaBlueHentai)
{
damageUp *= 2f;
critUp *= 2;
}
player.allDamage += damageUp;
modPlayer.AllCritBoost(critUp);
}
bool canProvideBuffs = player.Calamity().profanedCrystalBuffs || (!modPlayer.profanedCrystal && modPlayer.pArtifact) || (player.Calamity().profanedCrystal && CalamityWorld.downedSCal);
bool attack = player.ownedProjectileCounts[ModContent.ProjectileType<MiniGuardianAttack>()] > 0;
// Guardian bonuses if not burnt out
if (!modPlayer.bOut && canProvideBuffs)
{
bool healer = player.ownedProjectileCounts[ModContent.ProjectileType<MiniGuardianHealer>()] > 0;
bool defend = player.ownedProjectileCounts[ModContent.ProjectileType<MiniGuardianDefense>()] > 0;
if (healer)
{
if (modPlayer.healCounter > 0)
modPlayer.healCounter--;
if (modPlayer.healCounter <= 0)
{
bool enrage = player.statLife <= (int)((double)player.statLifeMax2 * 0.5);
modPlayer.healCounter = (!enrage && player.Calamity().profanedCrystalBuffs) ? 360 : 300;
if (player.whoAmI == Main.myPlayer)
{
int healAmount = 5 +
(defend ? 5 : 0) +
(attack ? 5 : 0);
player.statLife += healAmount;
player.HealEffect(healAmount);
}
}
}
if (defend)
{
player.moveSpeed += 0.1f +
(attack ? 0.1f : 0f);
player.endurance += 0.025f +
(attack ? 0.025f : 0f);
}
if (attack)
{
player.minionDamage += 0.1f +
(defend ? 0.05f : 0f);
}
}
// You always get the max minions, even during the effect of the burnout debuff
if (attack && canProvideBuffs)
player.maxMinions++;
// Cooldowns and timers
if (modPlayer.gainRageCooldown > 0)
modPlayer.gainRageCooldown--;
if (modPlayer.galileoCooldown > 0)
modPlayer.galileoCooldown--;
if (modPlayer.soundCooldown > 0)
modPlayer.soundCooldown--;
if (modPlayer.raiderCooldown > 0)
modPlayer.raiderCooldown--;
if (modPlayer.gSabatonCooldown > 0)
modPlayer.gSabatonCooldown--;
if (modPlayer.gSabatonFall > 0)
modPlayer.gSabatonFall--;
if (modPlayer.astralStarRainCooldown > 0)
modPlayer.astralStarRainCooldown--;
if (modPlayer.bloodflareMageCooldown > 0)
modPlayer.bloodflareMageCooldown--;
if (modPlayer.tarraMageHealCooldown > 0)
modPlayer.tarraMageHealCooldown--;
if (modPlayer.featherCrownCooldown > 0)
modPlayer.featherCrownCooldown--;
if (modPlayer.moonCrownCooldown > 0)
modPlayer.moonCrownCooldown--;
if (modPlayer.nanoFlareCooldown > 0)
modPlayer.nanoFlareCooldown--;
if (modPlayer.spectralVeilImmunity > 0)
modPlayer.spectralVeilImmunity--;
if (modPlayer.plaguedFuelPackCooldown > 0)
modPlayer.plaguedFuelPackCooldown--;
if (modPlayer.plaguedFuelPackDash > 0)
modPlayer.plaguedFuelPackDash--;
if (modPlayer.theBeeCooldown > 0)
modPlayer.theBeeCooldown--;
if (modPlayer.jellyDmg > 0f)
modPlayer.jellyDmg -= 1f;
if (modPlayer.ataxiaDmg > 0f)
modPlayer.ataxiaDmg -= 1.5f;
if (modPlayer.ataxiaDmg < 0f)
modPlayer.ataxiaDmg = 0f;
if (modPlayer.xerocDmg > 0f)
modPlayer.xerocDmg -= 2f;
if (modPlayer.xerocDmg < 0f)
modPlayer.xerocDmg = 0f;
if (modPlayer.godSlayerDmg > 0f)
modPlayer.godSlayerDmg -= 2.5f;
if (modPlayer.godSlayerDmg < 0f)
modPlayer.godSlayerDmg = 0f;
if (modPlayer.aBulwarkRareMeleeBoostTimer > 0)
modPlayer.aBulwarkRareMeleeBoostTimer--;
if (modPlayer.bossRushImmunityFrameCurseTimer > 0)
modPlayer.bossRushImmunityFrameCurseTimer--;
if (modPlayer.gaelRageCooldown > 0)
modPlayer.gaelRageCooldown--;
if (modPlayer.projRefRareLifeRegenCounter > 0)
modPlayer.projRefRareLifeRegenCounter--;
if (modPlayer.hurtSoundTimer > 0)
modPlayer.hurtSoundTimer--;
if (modPlayer.icicleCooldown > 0)
modPlayer.icicleCooldown--;
if (modPlayer.statisTimer > 0 && player.dashDelay >= 0)
modPlayer.statisTimer = 0;
if (modPlayer.hallowedRuneCooldown > 0)
modPlayer.hallowedRuneCooldown--;
if (modPlayer.sulphurBubbleCooldown > 0)
modPlayer.sulphurBubbleCooldown--;
if (modPlayer.forbiddenCooldown > 0)
modPlayer.forbiddenCooldown--;
if (modPlayer.tornadoCooldown > 0)
modPlayer.tornadoCooldown--;
if (modPlayer.ladHearts > 0)
modPlayer.ladHearts--;
if (modPlayer.titanBoost > 0)
modPlayer.titanBoost--;
// Silva invincibility effects
if (modPlayer.silvaCountdown > 0 && modPlayer.hasSilvaEffect && modPlayer.silvaSet)
{
player.buffImmune[ModContent.BuffType<VulnerabilityHex>()] = true;
modPlayer.silvaCountdown -= modPlayer.auricSet ? 2 : 1;
if (modPlayer.silvaCountdown <= 0)
Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SilvaDispel"), (int)player.position.X, (int)player.position.Y);
for (int j = 0; j < 2; j++)
{
int num = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 157, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 2f);
Main.dust[num].position.X += (float)Main.rand.Next(-20, 21);
Main.dust[num].position.Y += (float)Main.rand.Next(-20, 21);
Main.dust[num].velocity *= 0.9f;
Main.dust[num].noGravity = true;
Main.dust[num].scale *= 1f + (float)Main.rand.Next(40) * 0.01f;
Main.dust[num].shader = GameShaders.Armor.GetSecondaryShader(player.cWaist, player);
if (Main.rand.NextBool(2))
Main.dust[num].scale *= 1f + (float)Main.rand.Next(40) * 0.01f;
}
}
// Tarragon cloak effects
if (modPlayer.tarragonCloak)
{
modPlayer.tarraDefenseTime--;
if (modPlayer.tarraDefenseTime <= 0)
{
modPlayer.tarraDefenseTime = 600;
if (player.whoAmI == Main.myPlayer)
player.AddBuff(ModContent.BuffType<TarragonCloakCooldown>(), 1800, false);
}
for (int j = 0; j < 2; j++)
{
int num = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 157, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 2f);
Dust dust = Main.dust[num];
dust.position.X += (float)Main.rand.Next(-20, 21);
dust.position.Y += (float)Main.rand.Next(-20, 21);
dust.velocity *= 0.9f;
dust.noGravity = true;
dust.scale *= 1f + (float)Main.rand.Next(40) * 0.01f;
dust.shader = GameShaders.Armor.GetSecondaryShader(player.cWaist, player);
if (Main.rand.NextBool(2))
dust.scale *= 1f + (float)Main.rand.Next(40) * 0.01f;
}
}
// Tarragon immunity effects
if (modPlayer.tarraThrowing)
{
if (modPlayer.tarragonImmunity)
{
player.immune = true;
player.immuneTime = 2;
}
if (modPlayer.tarraThrowingCrits >= 25)
{
modPlayer.tarraThrowingCrits = 0;
if (player.whoAmI == Main.myPlayer)
player.AddBuff(ModContent.BuffType<TarragonImmunity>(), 300, false);
}
for (int l = 0; l < Player.MaxBuffs; l++)
{
int hasBuff = player.buffType[l];
if (player.buffTime[l] <= 2 && hasBuff == ModContent.BuffType<TarragonImmunity>())
{
if (player.whoAmI == Main.myPlayer)
player.AddBuff(ModContent.BuffType<TarragonImmunityCooldown>(), 1500, false);
}
bool shouldAffect = CalamityMod.debuffList.Contains(hasBuff);
if (shouldAffect)
modPlayer.throwingDamage += 0.1f;
}
}
// Bloodflare pickup spawn cooldowns
if (modPlayer.bloodflareSet)
{
if (modPlayer.bloodflareHeartTimer > 0)
modPlayer.bloodflareHeartTimer--;
if (modPlayer.bloodflareManaTimer > 0)
modPlayer.bloodflareManaTimer--;
}
// Bloodflare frenzy effects
if (modPlayer.bloodflareMelee)
{
if (modPlayer.bloodflareMeleeHits >= 15)
{
modPlayer.bloodflareMeleeHits = 0;
if (player.whoAmI == Main.myPlayer)
player.AddBuff(ModContent.BuffType<BloodflareBloodFrenzy>(), 302, false);
}
if (modPlayer.bloodflareFrenzy)
{
for (int l = 0; l < Player.MaxBuffs; l++)
{
int hasBuff = player.buffType[l];
if (player.buffTime[l] <= 2 && hasBuff == ModContent.BuffType<BloodflareBloodFrenzy>())
{
if (player.whoAmI == Main.myPlayer)
player.AddBuff(ModContent.BuffType<BloodflareBloodFrenzyCooldown>(), 1800, false);
}
}
player.meleeCrit += 25;
player.meleeDamage += 0.25f;
for (int j = 0; j < 2; j++)
{
int num = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 5, 0f, 0f, 100, default, 2f);
Dust dust = Main.dust[num];
dust.position.X += (float)Main.rand.Next(-20, 21);
dust.position.Y += (float)Main.rand.Next(-20, 21);
dust.velocity *= 0.9f;
dust.noGravity = true;
dust.scale *= 1f + (float)Main.rand.Next(40) * 0.01f;
dust.shader = GameShaders.Armor.GetSecondaryShader(player.cWaist, player);
if (Main.rand.NextBool(2))
dust.scale *= 1f + (float)Main.rand.Next(40) * 0.01f;
}
}
}
// Raider Talisman bonus
if (modPlayer.raiderTalisman)
{
float damageMult = modPlayer.nanotech ? 0.1f : 0.15f;
modPlayer.throwingDamage += (float)modPlayer.raiderStack / 150f * damageMult;
}
// Silva minion bonus
if (modPlayer.silvaCountdown <= 0 && modPlayer.hasSilvaEffect && modPlayer.silvaSummon)
player.maxMinions += 2;
// Spirit Glyph defense buff
if (modPlayer.sDefense)
{
player.statDefense += 5;
player.endurance += 0.05f;
}
// Hallowed Rune defense buff
if (modPlayer.hallowedDefense)
{
player.statDefense += 7;
player.endurance += 0.07f;
}
// Absorber bonus
if (modPlayer.absorber)
{
player.moveSpeed += 0.12f;
player.jumpSpeedBoost += 1.2f;
player.thorns = 0.5f;
player.endurance += 0.05f;
if ((double)Math.Abs(player.velocity.X) < 0.05 && (double)Math.Abs(player.velocity.Y) < 0.05 && player.itemAnimation == 0)
player.manaRegenBonus += 2;
}
// Sea Shell bonus
if (modPlayer.seaShell)
{
if (player.IsUnderwater())
{
player.statDefense += modPlayer.absorber ? 5 : 3;
player.endurance += 0.05f;
player.moveSpeed += modPlayer.absorber ? 0.2f : 0.15f;
player.ignoreWater = true;
}
}
// Laudanum bonus
if (modPlayer.laudanum)
{
if (Main.myPlayer == player.whoAmI)
{
for (int l = 0; l < Player.MaxBuffs; l++)
{
int hasBuff = player.buffType[l];
if (!modPlayer.doubledHorror && hasBuff == ModContent.BuffType<Horror>())
{
player.buffTime[l] *= 2;
modPlayer.doubledHorror = true;
}
}
}
if (modPlayer.horror)
{
player.statDefense += 15;
player.allDamage += 0.1f;
player.moveSpeed += 0.15f;
player.nightVision = true;
}
}
if (!modPlayer.horror)
modPlayer.doubledHorror = false;
// Draedon's Heart bonus
if (modPlayer.draedonsHeart)
{
player.allDamage += 0.05f;
if ((double)Math.Abs(player.velocity.X) < 0.05 && (double)Math.Abs(player.velocity.Y) < 0.05 && player.itemAnimation == 0)
player.statDefense += 25;
}
// Remove Absolute Rage buff if Rage isn't high enough
bool rageHighEnough = modPlayer.rage / modPlayer.rageMax >= CalamityPlayer.AbsoluteRageThreshold;
if (!rageHighEnough && player.FindBuffIndex(ModContent.BuffType<AbsoluteRage>()) > -1)
player.ClearBuff(ModContent.BuffType<AbsoluteRage>());
// Absolute Rage bonus
if (modPlayer.absoluteRage)
{
if (modPlayer.heartOfDarkness || modPlayer.draedonsHeart)
player.allDamage += 0.1f;
}
// Affliction bonus
if (modPlayer.affliction || modPlayer.afflicted)
{
player.endurance += 0.07f;
player.statDefense += 20;
player.allDamage += 0.12f;
}
// Ambrosial Ampoule bonus and other light-granting bonuses
float[] light = new float[3];
if (modPlayer.aAmpoule)
{
light[0] += 1f;
light[1] += 1f;
light[2] += 0.6f;
player.endurance += 0.05f;
player.pickSpeed -= 0.25f;
player.buffImmune[BuffID.Venom] = true;
player.buffImmune[BuffID.Frozen] = true;
player.buffImmune[BuffID.Chilled] = true;
player.buffImmune[BuffID.Frostburn] = true;
player.buffImmune[BuffID.Poisoned] = true;
}
if (modPlayer.cFreeze)
{
light[0] += 0.3f;
light[1] += (float)Main.DiscoG / 400f;
light[2] += 0.5f;
}
if (modPlayer.sirenIce)
{
light[0] += 0.35f;
light[1] += 1f;
light[2] += 1.25f;
}
if (modPlayer.sirenBoobs || modPlayer.sirenBoobsAlt)
{
light[0] += 1.5f;
light[1] += 1f;
light[2] += 0.1f;
}
if (modPlayer.tarraSummon)
{
light[0] += 0f;
light[1] += 3f;
light[2] += 0f;
}
if (modPlayer.dAmulet)
{
if (player.IsUnderwater())
{
light[0] += 1.35f;
light[1] += 0.3f;
light[2] += 0.9f;
}
}
if (modPlayer.forbiddenCirclet)
{
light[0] += 0.8f;
light[1] += 0.7f;
light[2] += 0.2f;
}
Lighting.AddLight((int)(player.Center.X / 16f), (int)(player.Center.Y / 16f), light[0], light[1], light[2]);
// Blazing Core bonus
if (modPlayer.blazingCore)
player.endurance += 0.1f;
//Permafrost's Concoction bonuses/debuffs
if (modPlayer.permafrostsConcoction)
player.manaCost *= 0.85f;
if (modPlayer.encased)
{
player.statDefense += 30;
player.frozen = true;
player.velocity.X = 0f;
player.velocity.Y = -0.4f; //should negate gravity
int d = Dust.NewDust(player.position, player.width, player.height, 88);
Main.dust[d].noGravity = true;
Main.dust[d].velocity *= 2f;
player.buffImmune[BuffID.Frozen] = true;
player.buffImmune[BuffID.Chilled] = true;
player.buffImmune[ModContent.BuffType<GlacialState>()] = true;
}
// Cosmic Discharge Cosmic Freeze buff, gives surrounding enemies the Glacial State debuff
if (modPlayer.cFreeze)
{
int num = ModContent.BuffType<GlacialState>();
float num2 = 200f;
int random = Main.rand.Next(5);
if (player.whoAmI == Main.myPlayer)
{
if (random == 0)
{
for (int l = 0; l < Main.maxNPCs; l++)
{
NPC nPC = Main.npc[l];
if (nPC.active && !nPC.friendly && nPC.damage > 0 && !nPC.dontTakeDamage && !nPC.buffImmune[num] && Vector2.Distance(player.Center, nPC.Center) <= num2)
{
if (nPC.FindBuffIndex(num) == -1)
nPC.AddBuff(num, 120, false);
}
}
}
}
}
// Remove Purified Jam and Lul accessory thorn damage exploits
if (modPlayer.invincible || modPlayer.lol)
{
player.thorns = 0f;
player.turtleThorns = false;
}
// Vortex Armor nerf
if (player.vortexStealthActive)
{
player.rangedDamage -= (1f - player.stealth) * 0.4f; // Change 80 to 40
player.rangedCrit -= (int)((1f - player.stealth) * 5f); // Change 20 to 15
}
// Polaris fish stuff
if (modPlayer.polarisBoost)
{
player.endurance += 0.01f;
player.statDefense += 2;
}
if (!modPlayer.polarisBoost || player.inventory[player.selectedItem].type != ModContent.ItemType<PolarisParrotfish>())
{
modPlayer.polarisBoost = false;
if (player.FindBuffIndex(ModContent.BuffType<PolarisBuff>()) > -1)
player.ClearBuff(ModContent.BuffType<PolarisBuff>());
modPlayer.polarisBoostCounter = 0;
modPlayer.polarisBoostTwo = false;
modPlayer.polarisBoostThree = false;
}
if (modPlayer.polarisBoostCounter >= 20)
{
modPlayer.polarisBoostTwo = false;
modPlayer.polarisBoostThree = true;
}
else if (modPlayer.polarisBoostCounter >= 10)
modPlayer.polarisBoostTwo = true;
// Lore bonuses
if (modPlayer.kingSlimeLore)
{
player.moveSpeed += 0.05f;
player.jumpSpeedBoost += player.autoJump ? 0f : 0.1f;
player.statDefense -= 3;
}
if (modPlayer.desertScourgeLore)
{
if (player.ZoneDesert || player.Calamity().ZoneSunkenSea)
{
player.statDefense += 5;
player.allDamage -= 0.025f;
}
}
if (modPlayer.crabulonLore)
{
if (player.ZoneGlowshroom || player.ZoneDirtLayerHeight || player.ZoneRockLayerHeight)
{
if (Main.myPlayer == player.whoAmI)
player.AddBuff(ModContent.BuffType<Mushy>(), 2);
player.moveSpeed -= 0.1f;
}
}
if (modPlayer.eaterOfWorldsLore)
{
int damage = (int)(15 * player.AverageDamage());
float knockBack = 1f;
if (Main.rand.NextBool(15))
{
int num = 0;
for (int i = 0; i < Main.maxProjectiles; i++)
{
if (Main.projectile[i].active && Main.projectile[i].owner == player.whoAmI && Main.projectile[i].type == ModContent.ProjectileType<TheDeadlyMicrobeProjectile>())
num++;
}
if (Main.rand.Next(15) >= num && num < 6)
{
int num2 = 50;
int num3 = 24;
int num4 = 90;
for (int j = 0; j < num2; j++)
{
int num5 = Main.rand.Next(200 - j * 2, 400 + j * 2);
Vector2 center = player.Center;
center.X += (float)Main.rand.Next(-num5, num5 + 1);
center.Y += (float)Main.rand.Next(-num5, num5 + 1);
if (!Collision.SolidCollision(center, num3, num3) && !Collision.WetCollision(center, num3, num3))
{
center.X += (float)(num3 / 2);
center.Y += (float)(num3 / 2);
if (Collision.CanHit(new Vector2(player.Center.X, player.position.Y), 1, 1, center, 1, 1) || Collision.CanHit(new Vector2(player.Center.X, player.position.Y - 50f), 1, 1, center, 1, 1))
{
int num6 = (int)center.X / 16;
int num7 = (int)center.Y / 16;
bool flag = false;
if (Main.rand.NextBool(3) && Main.tile[num6, num7] != null && Main.tile[num6, num7].wall > 0)
flag = true;
else
{
center.X -= (float)(num4 / 2);
center.Y -= (float)(num4 / 2);
if (Collision.SolidCollision(center, num4, num4))
{
center.X += (float)(num4 / 2);
center.Y += (float)(num4 / 2);
flag = true;
}
}
if (flag)
{
for (int k = 0; k < Main.maxProjectiles; k++)
{
if (Main.projectile[k].active && Main.projectile[k].owner == player.whoAmI && Main.projectile[k].type == ModContent.ProjectileType<TheDeadlyMicrobeProjectile>() && (center - Main.projectile[k].Center).Length() < 48f)
{
flag = false;
break;
}
}
if (flag && Main.myPlayer == player.whoAmI)
Projectile.NewProjectile(center.X, center.Y, 0f, 0f, ModContent.ProjectileType<TheDeadlyMicrobeProjectile>(), damage, knockBack, player.whoAmI, 0f, 0f);
}
}
}
}
}
}
}
if (modPlayer.skeletronLore)
{
player.allDamage += 0.1f;
modPlayer.AllCritBoost(5);
}
if (modPlayer.destroyerLore)
{
player.pickSpeed -= 0.05f;
}
if (modPlayer.aquaticScourgeLore)
{
if (player.wellFed)
{
player.statDefense += 1;
player.allDamage += 0.025f;
modPlayer.AllCritBoost(1);
player.minionKB += 0.25f;
player.moveSpeed += 0.1f;
}
else
{
player.statDefense -= 1;
player.allDamage -= 0.025f;
modPlayer.AllCritBoost(-1);
player.minionKB -= 0.25f;
player.moveSpeed -= 0.1f;
}
}
if (modPlayer.skeletronPrimeLore)
{
player.armorPenetration += 5;
}
if (modPlayer.leviathanAndSirenLore)
{
if (!player.IsUnderwater())
{
player.statDefense -= 8;
player.endurance -= 0.05f;
}
if (modPlayer.sirenPet)
{
player.spelunkerTimer += 1;
if (player.spelunkerTimer >= 10)
{
player.spelunkerTimer = 0;
int num65 = 30;
int num66 = (int)player.Center.X / 16;
int num67 = (int)player.Center.Y / 16;
for (int num68 = num66 - num65; num68 <= num66 + num65; num68++)
{
for (int num69 = num67 - num65; num69 <= num67 + num65; num69++)
{
if (Main.rand.NextBool(4))
{
Vector2 vector = new Vector2((float)(num66 - num68), (float)(num67 - num69));
if (vector.Length() < (float)num65 && num68 > 0 && num68 < Main.maxTilesX - 1 && num69 > 0 && num69 < Main.maxTilesY - 1 && Main.tile[num68, num69] != null && Main.tile[num68, num69].active())
{
bool flag7 = false;
if (Main.tile[num68, num69].type == 185 && Main.tile[num68, num69].frameY == 18)
{
if (Main.tile[num68, num69].frameX >= 576 && Main.tile[num68, num69].frameX <= 882)
flag7 = true;
}
else if (Main.tile[num68, num69].type == 186 && Main.tile[num68, num69].frameX >= 864 && Main.tile[num68, num69].frameX <= 1170)
flag7 = true;
if (flag7 || Main.tileSpelunker[(int)Main.tile[num68, num69].type] || (Main.tileAlch[(int)Main.tile[num68, num69].type] && Main.tile[num68, num69].type != 82))
{
int num70 = Dust.NewDust(new Vector2((float)(num68 * 16), (float)(num69 * 16)), 16, 16, 204, 0f, 0f, 150, default, 0.3f);
Main.dust[num70].fadeIn = 0.75f;
Main.dust[num70].velocity *= 0.1f;
Main.dust[num70].noLight = true;
}
}
}
}
}
}
}
}
if (player.ZoneSkyHeight)
{
if (modPlayer.astrumDeusLore)
player.moveSpeed += 0.2f;
if (modPlayer.astrumAureusLore)
player.jumpSpeedBoost += 0.5f;
}
if (modPlayer.golemLore)
{
if ((double)Math.Abs(player.velocity.X) < 0.05 && (double)Math.Abs(player.velocity.Y) < 0.05 && player.itemAnimation == 0)
player.statDefense += 10;
}
if (modPlayer.dukeFishronLore)
{
if (player.IsUnderwater())
{
player.allDamage += 0.05f;
modPlayer.AllCritBoost(5);
player.moveSpeed += 0.1f;
}
else
{
player.allDamage -= 0.02f;
modPlayer.AllCritBoost(-2);
player.moveSpeed -= 0.04f;
}
}
if (modPlayer.lunaticCultistLore)
{
player.blind = true;
player.endurance += 0.04f;
player.statDefense += 4;
player.allDamage += 0.04f;
modPlayer.AllCritBoost(4);
player.minionKB += 0.5f;
player.moveSpeed += 0.1f;
}
if (modPlayer.moonLordLore)
{
if (player.gravDir == -1f && player.gravControl2)
{
player.endurance += 0.05f;
player.statDefense += 10;
player.allDamage += 0.1f;
modPlayer.AllCritBoost(10);
player.minionKB += 1.5f;
player.moveSpeed += 0.15f;
}
else
player.slowFall = true;
}
// Calcium Potion buff
if (modPlayer.calcium)
player.noFallDmg = true;
// Ceaseless Hunger Potion buff
if (modPlayer.ceaselessHunger)
{
for (int j = 0; j < Main.maxItems; j++)
{
if (Main.item[j].active && Main.item[j].noGrabDelay == 0 && Main.item[j].owner == player.whoAmI)
{
Main.item[j].beingGrabbed = true;
if ((double)player.position.X + (double)player.width * 0.5 > (double)Main.item[j].position.X + (double)Main.item[j].width * 0.5)
{
if (Main.item[j].velocity.X < 90f + player.velocity.X)
{
Item item = Main.item[j];
item.velocity.X += 9f;
}
if (Main.item[j].velocity.X < 0f)
{
Item item = Main.item[j];
item.velocity.X += 9f * 0.75f;
}
}
else
{
if (Main.item[j].velocity.X > -90f + player.velocity.X)
{
Item item = Main.item[j];
item.velocity.X -= 9f;
}
if (Main.item[j].velocity.X > 0f)
{
Item item = Main.item[j];
item.velocity.X -= 9f * 0.75f;
}
}
if ((double)player.position.Y + (double)player.height * 0.5 > (double)Main.item[j].position.Y + (double)Main.item[j].height * 0.5)
{
if (Main.item[j].velocity.Y < 90f)
{
Item item = Main.item[j];
item.velocity.Y += 9f;
}
if (Main.item[j].velocity.Y < 0f)
{
Item item = Main.item[j];
item.velocity.Y += 9f * 0.75f;
}
}
else
{
if (Main.item[j].velocity.Y > -90f)
{
Item item = Main.item[j];
item.velocity.Y -= 9f;
}
if (Main.item[j].velocity.Y > 0f)
{
Item item = Main.item[j];
item.velocity.Y -= 9f * 0.75f;
}
}
}
}
}
// Spectral Veil effects
if (modPlayer.spectralVeil && modPlayer.spectralVeilImmunity > 0)
{
Rectangle sVeilRectangle = new Rectangle((int)((double)player.position.X + (double)player.velocity.X * 0.5 - 4.0), (int)((double)player.position.Y + (double)player.velocity.Y * 0.5 - 4.0), player.width + 8, player.height + 8);
for (int i = 0; i < Main.maxNPCs; i++)
{
if (Main.npc[i].active && !Main.npc[i].dontTakeDamage && !Main.npc[i].friendly && !Main.npc[i].townNPC && Main.npc[i].immune[player.whoAmI] <= 0 && Main.npc[i].damage > 0)
{
NPC nPC = Main.npc[i];
Rectangle rect = nPC.getRect();
if (sVeilRectangle.Intersects(rect) && (nPC.noTileCollide || player.CanHit(nPC)))
{
if (player.whoAmI == Main.myPlayer)
{
player.noKnockback = true;
modPlayer.rogueStealth = modPlayer.rogueStealthMax;
modPlayer.spectralVeilImmunity = 0;
for (int k = 0; k < player.hurtCooldowns.Length; k++)
player.hurtCooldowns[k] = player.immuneTime;
Vector2 sVeilDustDir = new Vector2(Main.rand.NextFloat(-1f, 1f), Main.rand.NextFloat(-1f, 1f));
sVeilDustDir.Normalize();
sVeilDustDir *= 0.5f;
for (int j = 0; j < 20; j++)
{
int sVeilDustIndex1 = Dust.NewDust(player.Center, 1, 1, 21, sVeilDustDir.X * j, sVeilDustDir.Y * j);
int sVeilDustIndex2 = Dust.NewDust(player.Center, 1, 1, 21, -sVeilDustDir.X * j, -sVeilDustDir.Y * j);
Main.dust[sVeilDustIndex1].noGravity = false;
Main.dust[sVeilDustIndex1].noLight = false;
Main.dust[sVeilDustIndex2].noGravity = false;
Main.dust[sVeilDustIndex2].noLight = false;
}
Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SilvaDispel"), (int)Main.player[Main.myPlayer].position.X, (int)Main.player[Main.myPlayer].position.Y);
}
break;
}
}
}
for (int i = 0; i < Main.maxProjectiles; i++)
{
if (Main.projectile[i].active && !Main.projectile[i].friendly && Main.projectile[i].hostile && Main.projectile[i].damage > 0)
{
Projectile proj = Main.projectile[i];
Rectangle rect = proj.getRect();
if (sVeilRectangle.Intersects(rect))
{
if (player.whoAmI == Main.myPlayer)
{
player.noKnockback = true;
modPlayer.rogueStealth = modPlayer.rogueStealthMax;
modPlayer.spectralVeilImmunity = 0;
for (int k = 0; k < player.hurtCooldowns.Length; k++)
player.hurtCooldowns[k] = player.immuneTime;
Vector2 sVeilDustDir = new Vector2(Main.rand.NextFloat(-1f, 1f), Main.rand.NextFloat(-1f, 1f));
sVeilDustDir.Normalize();
sVeilDustDir *= 0.5f;
for (int j = 0; j < 20; j++)
{
int sVeilDustIndex1 = Dust.NewDust(player.Center, 1, 1, 21, sVeilDustDir.X * j, sVeilDustDir.Y * j);
int sVeilDustIndex2 = Dust.NewDust(player.Center, 1, 1, 21, -sVeilDustDir.X * j, -sVeilDustDir.Y * j);
Main.dust[sVeilDustIndex1].noGravity = false;
Main.dust[sVeilDustIndex1].noLight = false;
Main.dust[sVeilDustIndex2].noGravity = false;
Main.dust[sVeilDustIndex2].noLight = false;
}
Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SilvaDispel"), (int)Main.player[Main.myPlayer].position.X, (int)Main.player[Main.myPlayer].position.Y);
}
break;
}
}
}
}
// Plagued Fuel Pack effects
if (modPlayer.plaguedFuelPackDash > 0)
{
int velocityMult = modPlayer.plaguedFuelPackDash > 1 ? 25 : 5;
player.velocity = new Vector2(modPlayer.plaguedFuelPackDirection, -1) * velocityMult;
int numClouds = Main.rand.Next(2, 10);
for (int i = 0; i < numClouds; i++)
{
Vector2 cloudVelocity = new Vector2(Main.rand.NextFloat(-1, 1), Main.rand.NextFloat(-1, 1));
cloudVelocity.Normalize();
cloudVelocity *= Main.rand.NextFloat(0f, 1f);
int projectile = Projectile.NewProjectile(player.Center, cloudVelocity, ModContent.ProjectileType<PlaguedFuelPackCloud>(), (int)(20 * player.RogueDamage()), 0, player.whoAmI, 0, 0);
Main.projectile[projectile].timeLeft = Main.rand.Next(180, 240);
}
for (int i = 0; i < 3; i++)
{
int dust = Dust.NewDust(player.Center, 1, 1, 89, player.velocity.X * -0.1f, player.velocity.Y * -0.1f, 100, default, 3.5f);
Main.dust[dust].noGravity = true;
Main.dust[dust].velocity *= 1.2f;
Main.dust[dust].velocity.Y -= 0.15f;
}
}
// Gravistar Sabaton effects
if (modPlayer.gSabaton)
{
if (modPlayer.gSabatonCooldown <= 0 && !player.mount.Active)
{
if (player.controlDown && player.releaseDown && player.position.Y != player.oldPosition.Y)
{
modPlayer.gSabatonFall = 300;
modPlayer.gSabatonCooldown = 480; //8 second cooldown
player.gravity *= 2f;
Projectile.NewProjectile(player.Center.X, player.Center.Y, player.velocity.X, player.velocity.Y, ModContent.ProjectileType<SabatonSlam>(), 0, 0, player.whoAmI);
}
}
if (modPlayer.gSabatonCooldown == 1) //dust when ready to use again
{
for (int i = 0; i < 66; i++)
{
int d = Dust.NewDust(player.position, player.width, player.height, Main.rand.NextBool(2) ? ModContent.DustType<AstralBlue>() : ModContent.DustType<AstralOrange>(), 0, 0, 100, default, 2.6f);
Main.dust[d].noGravity = true;
Main.dust[d].noLight = true;
Main.dust[d].fadeIn = 1f;
Main.dust[d].velocity *= 6.6f;
}
}
}
}
#endregion
#region Abyss Effects
private static void AbyssEffects(Player player, CalamityPlayer modPlayer)
{
int lightStrength = modPlayer.GetTotalLightStrength();
modPlayer.abyssLightLevelStat = lightStrength;
if (modPlayer.ZoneAbyss)
{
if (Main.myPlayer == player.whoAmI)
{
// Abyss depth variables
Point point = player.Center.ToTileCoordinates();
double abyssSurface = Main.rockLayer - (double)Main.maxTilesY * 0.05;
double totalAbyssDepth = Main.maxTilesY - 250D - abyssSurface;
double playerAbyssDepth = point.Y - abyssSurface;
double depthRatio = playerAbyssDepth / totalAbyssDepth;
// Darkness strength scales smoothly with how deep you are.
float darknessStrength = (float)depthRatio;
// Reduce the power of abyss darkness based on your light level.
float multiplier = 1f;
switch (lightStrength)
{
case 0:
break;
case 1:
multiplier = 0.85f;
break;
case 2:
multiplier = 0.7f;
break;
case 3:
multiplier = 0.55f;
break;
case 4:
multiplier = 0.4f;
break;
case 5:
multiplier = 0.25f;
break;
case 6:
multiplier = 0.15f;
break;
case 7:
multiplier = 0.1f;
break;
default:
multiplier = 0.05f;
break;
}
// Increased darkness in Death Mode
if (CalamityWorld.death)
multiplier += (1f - multiplier) * 0.1f;
// Modify darkness variable
modPlayer.caveDarkness = darknessStrength * multiplier;
// Nebula Headcrab darkness effect
if (!player.headcovered)
{
float screenObstructionAmt = MathHelper.Clamp(modPlayer.caveDarkness, 0f, 0.95f);
float targetValue = MathHelper.Clamp(screenObstructionAmt * 0.7f, 0.1f, 0.3f);
ScreenObstruction.screenObstruction = MathHelper.Lerp(ScreenObstruction.screenObstruction, screenObstructionAmt, targetValue);
}
// Breath lost while at zero breath
double breathLoss = 50D * depthRatio;
// Breath Loss Multiplier, depending on gear
double breathLossMult = 1D -
(player.gills ? 0.2 : 0D) - // 0.8
(player.accDivingHelm ? 0.25 : 0D) - // 0.75
(player.arcticDivingGear ? 0.25 : 0D) - // 0.75
(modPlayer.aquaticEmblem ? 0.25 : 0D) - // 0.75
(player.accMerman ? 0.3 : 0D) - // 0.7
(modPlayer.victideSet ? 0.2 : 0D) - // 0.85
(((modPlayer.sirenBoobs || modPlayer.sirenBoobsAlt) && NPC.downedBoss3) ? 0.3 : 0D) - // 0.7
(modPlayer.abyssalDivingSuit ? 0.3 : 0D); // 0.7
// Limit the multiplier to 5%
if (breathLossMult < 0.05)
breathLossMult = 0.05;
// Reduce breath lost while at zero breath, depending on gear
breathLoss *= breathLossMult;
// Stat Meter stat
modPlayer.abyssBreathLossStat = (int)breathLoss;
// Defense loss
int defenseLoss = (int)(120D * depthRatio);
// Anechoic Plating reduces defense loss by 66%
// Fathom Swarmer Breastplate reduces defense loss by 40%
// In tandem, reduces defense loss by 80%
if (modPlayer.anechoicPlating && modPlayer.fathomSwarmerBreastplate)
defenseLoss = (int)(defenseLoss * 0.2f);
else if (modPlayer.anechoicPlating)
defenseLoss /= 3;
else if (modPlayer.fathomSwarmerBreastplate)
defenseLoss = (int)(defenseLoss * 0.6f);
// Reduce defense
player.statDefense -= defenseLoss;
// Stat Meter stat
modPlayer.abyssDefenseLossStat = defenseLoss;
// Bleed effect based on abyss layer
if (modPlayer.ZoneAbyssLayer4)
{
player.bleed = true;
}
else if (modPlayer.ZoneAbyssLayer3)
{
if (!modPlayer.abyssalDivingSuit)
player.bleed = true;
}
else if (modPlayer.ZoneAbyssLayer2)
{
if (!modPlayer.depthCharm)
player.bleed = true;
}
// Ticks (frames) until breath is deducted from the breath meter
double tick = 12D * (1D - depthRatio);
// Prevent 0
if (tick < 1D)
tick = 1D;
// Tick (frame) multiplier, depending on gear
double tickMult = 1D +
(player.gills ? 4D : 0D) + // 5
(player.ignoreWater ? 5D : 0D) + // 10
(player.accDivingHelm ? 10D : 0D) + // 20
(player.arcticDivingGear ? 10D : 0D) + // 30
(modPlayer.aquaticEmblem ? 10D : 0D) + // 40
(player.accMerman ? 15D : 0D) + // 55
(modPlayer.victideSet ? 5D : 0D) + // 60
(((modPlayer.sirenBoobs || modPlayer.sirenBoobsAlt) && NPC.downedBoss3) ? 15D : 0D) + // 75
(modPlayer.abyssalDivingSuit ? 15D : 0D); // 90
// Limit the multiplier to 50
if (tickMult > 50D)
tickMult = 50D;
// Increase ticks (frames) until breath is deducted, depending on gear
tick *= tickMult;
// Stat Meter stat
modPlayer.abyssBreathLossRateStat = (int)tick;
// Reduce breath over ticks (frames)
modPlayer.abyssBreathCD++;
if (modPlayer.abyssBreathCD >= (int)tick)
{
// Reset modded breath variable
modPlayer.abyssBreathCD = 0;
// Reduce breath
if (player.breath > 0)
player.breath -= (int)(modPlayer.cDepth ? breathLoss + 1D : breathLoss);
}
// If breath is greater than 0 and player has gills or is merfolk, balance out the effects by reducing breath
if (player.breath > 0)
{
if (player.gills || player.merman)
player.breath -= 3;
}
// Life loss at zero breath
int lifeLossAtZeroBreath = (int)(12D * depthRatio);
// Resistance to life loss at zero breath
int lifeLossAtZeroBreathResist = 0 +
(modPlayer.depthCharm ? 3 : 0) +
(modPlayer.abyssalDivingSuit ? 6 : 0);
// Reduce life loss, depending on gear
lifeLossAtZeroBreath -= lifeLossAtZeroBreathResist;
// Prevent negatives
if (lifeLossAtZeroBreath < 0)
lifeLossAtZeroBreath = 0;
// Stat Meter stat
modPlayer.abyssLifeLostAtZeroBreathStat = lifeLossAtZeroBreath;
// Check breath value
if (player.breath <= 0)
{
// Reduce life
player.statLife -= lifeLossAtZeroBreath;
// Special kill code if the life loss kills the player
if (player.statLife <= 0)
{
modPlayer.abyssDeath = true;
modPlayer.KillPlayer();
}
}
}
}
else
{
modPlayer.abyssBreathCD = 0;
modPlayer.abyssDeath = false;
}
}
#endregion
#region Max Life And Mana Effects
private static void MaxLifeAndManaEffects(Player player, CalamityPlayer modPlayer, Mod mod)
{
// Silva invincibility effects
if (modPlayer.silvaHitCounter > 0)
{
player.statLifeMax2 -= modPlayer.silvaHitCounter * 100;
if (player.statLifeMax2 <= 400)
{
player.statLifeMax2 = 400;
if (modPlayer.silvaCountdown > 0)
{
if (player.FindBuffIndex(ModContent.BuffType<SilvaRevival>()) > -1)
player.ClearBuff(ModContent.BuffType<SilvaRevival>());
Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SilvaDispel"), (int)player.position.X, (int)player.position.Y);
}
modPlayer.silvaCountdown = 0;
}
}
// New textures
if (Main.netMode != NetmodeID.Server && player.whoAmI == Main.myPlayer)
{
Texture2D rain3 = ModContent.GetTexture("CalamityMod/ExtraTextures/Rain3");
Texture2D rainOriginal = ModContent.GetTexture("CalamityMod/ExtraTextures/RainOriginal");
Texture2D mana2 = ModContent.GetTexture("CalamityMod/ExtraTextures/Mana2");
Texture2D mana3 = ModContent.GetTexture("CalamityMod/ExtraTextures/Mana3");
Texture2D mana4 = ModContent.GetTexture("CalamityMod/ExtraTextures/Mana4");
Texture2D manaOriginal = ModContent.GetTexture("CalamityMod/ExtraTextures/ManaOriginal");
Texture2D carpetAuric = ModContent.GetTexture("CalamityMod/ExtraTextures/AuricCarpet");
Texture2D carpetOriginal = ModContent.GetTexture("CalamityMod/ExtraTextures/Carpet");
int totalManaBoost =
(modPlayer.pHeart ? 1 : 0) +
(modPlayer.eCore ? 1 : 0) +
(modPlayer.cShard ? 1 : 0);
switch (totalManaBoost)
{
default:
Main.manaTexture = manaOriginal;
break;
case 3:
Main.manaTexture = mana4;
break;
case 2:
Main.manaTexture = mana3;
break;
case 1:
Main.manaTexture = mana2;
break;
}
if (Main.bloodMoon)
Main.rainTexture = rainOriginal;
else if (Main.raining && modPlayer.ZoneSulphur)
Main.rainTexture = rain3;
else
Main.rainTexture = rainOriginal;
if (modPlayer.auricSet)
Main.flyingCarpetTexture = carpetAuric;
else
Main.flyingCarpetTexture = carpetOriginal;
}
}
#endregion
#region Standing Still Effects
private static void StandingStillEffects(Player player, CalamityPlayer modPlayer)
{
// Rogue Stealth
modPlayer.UpdateRogueStealth();
// Trinket of Chi bonus
if (modPlayer.trinketOfChi)
{
if (modPlayer.trinketOfChiBuff)
{
player.allDamage += 0.5f;
if (player.itemAnimation > 0)
modPlayer.chiBuffTimer = 0;
}
if ((double)Math.Abs(player.velocity.X) < 0.1 && (double)Math.Abs(player.velocity.Y) < 0.1 && !player.mount.Active)
{
if (modPlayer.chiBuffTimer < 120)
modPlayer.chiBuffTimer++;
else
player.AddBuff(ModContent.BuffType<ChiBuff>(), 6);
}
else
modPlayer.chiBuffTimer--;
}
else
modPlayer.chiBuffTimer = 0;
// Aquatic Emblem bonus
if (modPlayer.aquaticEmblem)
{
if (player.IsUnderwater() && player.wet && !player.lavaWet && !player.honeyWet &&
!player.mount.Active)
{
if (modPlayer.aquaticBoost > 0f)
{
modPlayer.aquaticBoost -= 0.0002f; // 0.015
if ((double)modPlayer.aquaticBoost <= 0.0)
{
modPlayer.aquaticBoost = 0f;
if (Main.netMode == NetmodeID.MultiplayerClient)
NetMessage.SendData(84, -1, -1, null, player.whoAmI, 0f, 0f, 0f, 0, 0, 0);
}
}
}
else
{
modPlayer.aquaticBoost += 0.0002f;
if (modPlayer.aquaticBoost > 1f)
modPlayer.aquaticBoost = 1f;
if (player.mount.Active)
modPlayer.aquaticBoost = 1f;
}
player.statDefense += (int)((1f - modPlayer.aquaticBoost) * 30f);
player.moveSpeed -= (1f - modPlayer.aquaticBoost) * 0.1f;
}
else
modPlayer.aquaticBoost = 1f;
// Auric bonus
if (modPlayer.auricBoost)
{
if (player.itemAnimation > 0)
modPlayer.modStealthTimer = 5;
if ((double)Math.Abs(player.velocity.X) < 0.1 && (double)Math.Abs(player.velocity.Y) < 0.1 && !player.mount.Active)
{
if (modPlayer.modStealthTimer == 0 && modPlayer.modStealth > 0f)
{
modPlayer.modStealth -= 0.015f;
if ((double)modPlayer.modStealth <= 0.0)
{
modPlayer.modStealth = 0f;
if (Main.netMode == NetmodeID.MultiplayerClient)
NetMessage.SendData(84, -1, -1, null, player.whoAmI, 0f, 0f, 0f, 0, 0, 0);
}
}
}
else
{
float num27 = Math.Abs(player.velocity.X) + Math.Abs(player.velocity.Y);
modPlayer.modStealth += num27 * 0.0075f;
if (modPlayer.modStealth > 1f)
modPlayer.modStealth = 1f;
if (player.mount.Active)
modPlayer.modStealth = 1f;
}
float damageBoost = (1f - modPlayer.modStealth) * 0.2f;
player.allDamage += damageBoost;
int critBoost = (int)((1f - modPlayer.modStealth) * 10f);
modPlayer.AllCritBoost(critBoost);
if (modPlayer.modStealthTimer > 0)
modPlayer.modStealthTimer--;
}
// Psychotic Amulet bonus
else if (modPlayer.pAmulet)
{
if (player.itemAnimation > 0)
modPlayer.modStealthTimer = 5;
if ((double)Math.Abs(player.velocity.X) < 0.1 && (double)Math.Abs(player.velocity.Y) < 0.1 && !player.mount.Active)
{
if (modPlayer.modStealthTimer == 0 && modPlayer.modStealth > 0f)
{
modPlayer.modStealth -= 0.015f;
if ((double)modPlayer.modStealth <= 0.0)
{
modPlayer.modStealth = 0f;
if (Main.netMode == NetmodeID.MultiplayerClient)
NetMessage.SendData(84, -1, -1, null, player.whoAmI, 0f, 0f, 0f, 0, 0, 0);
}
}
}
else
{
float num27 = Math.Abs(player.velocity.X) + Math.Abs(player.velocity.Y);
modPlayer.modStealth += num27 * 0.0075f;
if (modPlayer.modStealth > 1f)
modPlayer.modStealth = 1f;
if (player.mount.Active)
modPlayer.modStealth = 1f;
}
modPlayer.throwingDamage += (1f - modPlayer.modStealth) * 0.2f;
modPlayer.throwingCrit += (int)((1f - modPlayer.modStealth) * 10f);
player.aggro -= (int)((1f - modPlayer.modStealth) * 750f);
if (modPlayer.modStealthTimer > 0)
modPlayer.modStealthTimer--;
}
else
modPlayer.modStealth = 1f;
}
#endregion
#region Elysian Aegis Effects
private static void ElysianAegisEffects(Player player, CalamityPlayer modPlayer)
{
if (modPlayer.elysianAegis)
{
bool flag14 = false;
// Activate buff
if (modPlayer.elysianGuard)
{
if (player.whoAmI == Main.myPlayer)
player.AddBuff(ModContent.BuffType<ElysianGuard>(), 2, false);
float num29 = modPlayer.shieldInvinc;
modPlayer.shieldInvinc -= 0.08f;
if (modPlayer.shieldInvinc < 0f)
modPlayer.shieldInvinc = 0f;
else
flag14 = true;
if (modPlayer.shieldInvinc == 0f && num29 != modPlayer.shieldInvinc && Main.netMode == NetmodeID.MultiplayerClient)
NetMessage.SendData(84, -1, -1, null, player.whoAmI, 0f, 0f, 0f, 0, 0, 0);
float damageBoost = (5f - modPlayer.shieldInvinc) * 0.03f;
player.allDamage += damageBoost;
int critBoost = (int)((5f - modPlayer.shieldInvinc) * 2f);
modPlayer.AllCritBoost(critBoost);
player.aggro += (int)((5f - modPlayer.shieldInvinc) * 220f);
player.statDefense += (int)((5f - modPlayer.shieldInvinc) * 4f);
player.moveSpeed *= 0.85f;
if (player.mount.Active)
modPlayer.elysianGuard = false;
}
// Remove buff
else
{
float num30 = modPlayer.shieldInvinc;
modPlayer.shieldInvinc += 0.08f;
if (modPlayer.shieldInvinc > 5f)
modPlayer.shieldInvinc = 5f;
else
flag14 = true;
if (modPlayer.shieldInvinc == 5f && num30 != modPlayer.shieldInvinc && Main.netMode == NetmodeID.MultiplayerClient)
NetMessage.SendData(84, -1, -1, null, player.whoAmI, 0f, 0f, 0f, 0, 0, 0);
}
// Emit dust
if (flag14)
{
if (Main.rand.NextBool(2))
{
Vector2 vector = Vector2.UnitY.RotatedByRandom(6.2831854820251465);
Dust dust = Main.dust[Dust.NewDust(player.Center - vector * 30f, 0, 0, 244, 0f, 0f, 0, default, 1f)];
dust.noGravity = true;
dust.position = player.Center - vector * (float)Main.rand.Next(5, 11);
dust.velocity = vector.RotatedBy(1.5707963705062866, default) * 4f;
dust.scale = 0.5f + Main.rand.NextFloat();
dust.fadeIn = 0.5f;
}
if (Main.rand.NextBool(2))
{
Vector2 vector2 = Vector2.UnitY.RotatedByRandom(6.2831854820251465);
Dust dust2 = Main.dust[Dust.NewDust(player.Center - vector2 * 30f, 0, 0, 246, 0f, 0f, 0, default, 1f)];
dust2.noGravity = true;
dust2.position = player.Center - vector2 * 12f;
dust2.velocity = vector2.RotatedBy(-1.5707963705062866, default) * 2f;
dust2.scale = 0.5f + Main.rand.NextFloat();
dust2.fadeIn = 0.5f;
}
}
}
else
modPlayer.elysianGuard = false;
}
#endregion
#region Other Buff Effects
private static void OtherBuffEffects(Player player, CalamityPlayer modPlayer)
{
if (modPlayer.gravityNormalizer)
{
player.buffImmune[BuffID.VortexDebuff] = true;
if (player.InSpace())
{
player.gravity = Player.defaultGravity;
if (player.wet)
{
if (player.honeyWet)
player.gravity = 0.1f;
else if (player.merman)
player.gravity = 0.3f;
else
player.gravity = 0.2f;
}
}
}
// Effigy of Decay effects
if (modPlayer.decayEffigy)
{
player.buffImmune[ModContent.BuffType<SulphuricPoisoning>()] = true;
if (!modPlayer.ZoneAbyss)
{
player.gills = true;
}
}
if (modPlayer.astralInjection)
{
if (player.statMana < player.statManaMax2)
player.statMana += 3;
if (player.statMana > player.statManaMax2)
player.statMana = player.statManaMax2;
}
if (modPlayer.armorCrumbling)
{
modPlayer.throwingCrit += 5;
player.meleeCrit += 5;
}
if (modPlayer.armorShattering)
{
if (player.FindBuffIndex(ModContent.BuffType<ArmorCrumbling>()) > -1)
player.ClearBuff(ModContent.BuffType<ArmorCrumbling>());
modPlayer.throwingDamage += 0.08f;
player.meleeDamage += 0.08f;
modPlayer.throwingCrit += 8;
player.meleeCrit += 8;
}
if (modPlayer.holyWrath)
{
if (player.FindBuffIndex(BuffID.Wrath) > -1)
player.ClearBuff(BuffID.Wrath);
player.allDamage += 0.12f;
player.moveSpeed += 0.05f;
}
if (modPlayer.profanedRage)
{
if (player.FindBuffIndex(BuffID.Rage) > -1)
player.ClearBuff(BuffID.Rage);
modPlayer.AllCritBoost(12);
player.moveSpeed += 0.05f;
}
if (modPlayer.irradiated)
{
if (modPlayer.boomerDukeLore)
{
player.statDefense += 10;
}
else
{
player.statDefense -= 10;
}
player.allDamage += 0.05f;
player.minionKB += 0.5f;
player.moveSpeed += 0.05f;
}
if (modPlayer.rRage)
{
player.allDamage += 0.05f;
player.moveSpeed += 0.05f;
}
if (modPlayer.xRage)
modPlayer.throwingDamage += 0.1f;
if (modPlayer.xWrath)
modPlayer.throwingCrit += 5;
if (modPlayer.godSlayerCooldown)
player.allDamage += 0.1f;
if (modPlayer.graxDefense)
{
player.statDefense += 30;
player.endurance += 0.1f;
player.meleeDamage += 0.2f;
}
if (modPlayer.sMeleeBoost)
{
player.allDamage += 0.1f;
modPlayer.AllCritBoost(5);
}
if (modPlayer.tFury)
{
player.meleeDamage += 0.3f;
player.meleeCrit += 10;
}
if (modPlayer.yPower)
{
player.endurance += 0.05f;
player.statDefense += 5;
player.allDamage += 0.06f;
modPlayer.AllCritBoost(2);
player.minionKB += 1f;
player.moveSpeed += 0.15f;
}
if (modPlayer.tScale)
{
player.endurance += 0.05f;
player.statDefense += 5;
player.kbBuff = true;
if (modPlayer.titanBoost > 0)
{
player.statDefense += 25;
player.endurance += 0.1f;
}
}
else
modPlayer.titanBoost = 0;
if (modPlayer.darkSunRing)
{
player.maxMinions += 2;
player.allDamage += 0.12f;
player.minionKB += 1.2f;
player.pickSpeed -= 0.15f;
if (Main.eclipse || !Main.dayTime)
player.statDefense += 30;
}
if (modPlayer.eGauntlet)
{
player.longInvince = true;
player.kbGlove = true;
player.magmaStone = true;
player.meleeDamage += 0.15f;
player.meleeCrit += 5;
player.lavaMax += 240;
}
if (modPlayer.eQuiver)
{
player.magicQuiver = true;
}
if (modPlayer.fabsolVodka)
{
player.allDamage += 0.08f;
player.statDefense -= 20;
}
if (modPlayer.vodka)
{
player.statDefense -= 4;
player.allDamage += 0.06f;
modPlayer.AllCritBoost(2);
}
if (modPlayer.grapeBeer)
{
player.statDefense -= 2;
player.moveSpeed -= 0.05f;
}
if (modPlayer.moonshine)
{
player.statDefense += 10;
player.endurance += 0.05f;
}
if (modPlayer.rum)
{
player.moveSpeed += 0.1f;
player.statDefense -= 8;
}
if (modPlayer.whiskey)
{
player.statDefense -= 8;
player.allDamage += 0.04f;
modPlayer.AllCritBoost(2);
}
if (modPlayer.everclear)
{
player.statDefense -= 40;
player.allDamage += 0.25f;
}
if (modPlayer.bloodyMary)
{
if (Main.bloodMoon)
{
player.statDefense -= 6;
player.allDamage += 0.15f;
modPlayer.AllCritBoost(7);
player.moveSpeed += 0.15f;
}
}
if (modPlayer.tequila)
{
if (Main.dayTime)
{
player.statDefense += 5;
player.allDamage += 0.03f;
modPlayer.AllCritBoost(2);
player.endurance += 0.03f;
}
}
if (modPlayer.tequilaSunrise)
{
if (Main.dayTime)
{
player.statDefense += 15;
player.allDamage += 0.07f;
modPlayer.AllCritBoost(3);
player.endurance += 0.07f;
}
}
if (modPlayer.caribbeanRum)
{
player.moveSpeed += 0.2f;
player.statDefense -= 12;
}
if (modPlayer.cinnamonRoll)
{
player.statDefense -= 12;
player.manaRegenDelay--;
player.manaRegenBonus += 10;
}
if (modPlayer.margarita)
player.statDefense -= 6;
if (modPlayer.starBeamRye)
{
player.statDefense -= 6;
player.magicDamage += 0.08f;
player.manaCost *= 0.9f;
}
if (modPlayer.moscowMule)
{
player.allDamage += 0.09f;
modPlayer.AllCritBoost(3);
}
if (modPlayer.whiteWine)
{
player.statDefense -= 6;
player.magicDamage += 0.1f;
}
if (modPlayer.evergreenGin)
player.endurance += 0.05f;
if (modPlayer.giantPearl)
{
if (Main.netMode != NetmodeID.MultiplayerClient)
{
for (int m = 0; m < Main.maxNPCs; m++)
{
if (Main.npc[m].active && !Main.npc[m].friendly)
{
float distance = (Main.npc[m].Center - player.Center).Length();
if (distance < 120f)
Main.npc[m].AddBuff(ModContent.BuffType<PearlAura>(), 20, false);
}
}
}
}
if (CalamityMod.scopedWeaponList.Contains(player.inventory[player.selectedItem].type))
player.scope = true;
if (CalamityMod.highTestFishList.Contains(player.inventory[player.selectedItem].type))
player.accFishingLine = true;
if (CalamityMod.boomerangList.Contains(player.inventory[player.selectedItem].type) && player.invis)
modPlayer.throwingDamage += 0.1f;
if (CalamityMod.javelinList.Contains(player.inventory[player.selectedItem].type) && player.invis)
player.armorPenetration += 5;
if (CalamityMod.flaskBombList.Contains(player.inventory[player.selectedItem].type) && player.invis)
modPlayer.throwingVelocity += 0.1f;
if (CalamityMod.spikyBallList.Contains(player.inventory[player.selectedItem].type) && player.invis)
modPlayer.throwingCrit += 10;
if (modPlayer.planarSpeedBoost != 0)
{
if (player.inventory[player.selectedItem].type != ModContent.ItemType<PrideHuntersPlanarRipper>())
modPlayer.planarSpeedBoost = 0;
}
if (modPlayer.etherealExtorter)
{
bool ZoneForest = !modPlayer.ZoneAbyss && !modPlayer.ZoneSulphur && !modPlayer.ZoneAstral && !modPlayer.ZoneCalamity &&
!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.inventory[player.selectedItem].type))
player.endurance += 0.03f;
if ((player.ZoneDesert || player.ZoneUndergroundDesert) && CalamityMod.daggerList.Contains(player.inventory[player.selectedItem].type))
player.scope = true;
if (modPlayer.ZoneSunkenSea)
{
player.gills = true;
player.ignoreWater = true;
}
if (player.ZoneSnow && CalamityMod.iceWeaponList.Contains(player.inventory[player.selectedItem].type))
player.statDefense += 5;
if (modPlayer.ZoneAstral)
{
if (player.wingTimeMax > 0)
player.wingTimeMax = (int)((double)player.wingTimeMax * 1.05);
}
if (player.ZoneJungle && CalamityMod.natureWeaponList.Contains(player.inventory[player.selectedItem].type))
player.AddBuff(BuffID.DryadsWard, 5, true); // Dryad's Blessing
if (modPlayer.ZoneAbyss)
{
player.blind = true;
player.headcovered = true;
player.blackout = true;
if (player.FindBuffIndex(BuffID.Shine) > -1)
player.ClearBuff(BuffID.Shine);
if (player.FindBuffIndex(BuffID.NightOwl) > -1)
player.ClearBuff(BuffID.NightOwl);
player.nightVision = false;
modPlayer.shine = false;
player.allDamage += 0.2f;
modPlayer.AllCritBoost(5);
player.statDefense += 8;
player.endurance += 0.05f;
}
if (player.ZoneRockLayerHeight && ZoneForest && CalamityMod.flaskBombList.Contains(player.inventory[player.selectedItem].type))
player.blackBelt = true;
if (player.ZoneHoly)
{
player.maxMinions += 1;
player.manaCost *= 0.9f;
player.ammoCost75 = true; // 25% chance to not use ranged ammo
modPlayer.throwingAmmoCost75 = true; // 25% chance to not consume rogue consumables
}
if (player.ZoneBeach)
player.moveSpeed += 0.05f;
if (player.ZoneGlowshroom)
player.statDefense += 3;
if (player.ZoneMeteor)
{
modPlayer.gravityNormalizer = true;
player.slowFall = true;
}
if (Main.moonPhase == 0) // Full moon
player.fishingSkill += 30;
if (Main.moonPhase == 6) // First quarter
player.discount = true;
}
if (modPlayer.harpyRing)
{
if (player.wingTimeMax > 0)
player.wingTimeMax = (int)(player.wingTimeMax * 1.25);
player.moveSpeed += 0.2f;
}
if (modPlayer.blueCandle)
{
if (player.wingTimeMax > 0)
player.wingTimeMax = (int)(player.wingTimeMax * 1.1);
player.moveSpeed += 0.15f;
}
if (modPlayer.plaguebringerGoliathLore)
{
if (player.wingTimeMax > 0)
player.wingTimeMax = (int)(player.wingTimeMax * 1.25);
}
if (modPlayer.soaring)
{
if (player.wingTimeMax > 0)
player.wingTimeMax = (int)(player.wingTimeMax * 1.1);
}
if (modPlayer.plagueReaper)
{
if (player.wingTimeMax > 0)
player.wingTimeMax = (int)(player.wingTimeMax * 1.05);
}
if (modPlayer.draconicSurge)
{
if (player.wingTimeMax > 0)
player.wingTimeMax = (int)(player.wingTimeMax * 1.35);
}
if (modPlayer.draconicSurgeCooldown) //weird mod conflicts with like Luiafk
{
modPlayer.draconicSurge = false;
if (player.FindBuffIndex(ModContent.BuffType<DraconicSurgeBuff>()) > -1)
player.ClearBuff(ModContent.BuffType<DraconicSurgeBuff>());
}
if (modPlayer.bounding)
{
player.jumpSpeedBoost += 0.5f;
Player.jumpHeight += 10;
player.extraFall += 25;
}
if (modPlayer.mushy)
player.statDefense += 5;
if (modPlayer.omniscience)
{
player.detectCreature = true;
player.dangerSense = true;
player.findTreasure = true;
}
if (modPlayer.aWeapon)
player.moveSpeed += 0.15f;
if (modPlayer.molten)
player.resistCold = true;
if (modPlayer.shellBoost)
player.moveSpeed += 0.9f;
if (modPlayer.tarraSet)
{
player.calmed = modPlayer.tarraMelee ? false : true;
player.lifeMagnet = true;
}
if (modPlayer.aChicken)
{
player.statDefense += 5;
player.moveSpeed += 0.1f;
}
if (modPlayer.cadence)
{
if (player.FindBuffIndex(BuffID.Regeneration) > -1)
player.ClearBuff(BuffID.Regeneration);
if (player.FindBuffIndex(BuffID.Lifeforce) > -1)
player.ClearBuff(BuffID.Lifeforce);
player.discount = true;
player.lifeMagnet = true;
player.calmed = true;
}
if (modPlayer.community)
{
float floatTypeBoost = 0.01f +
(NPC.downedSlimeKing ? 0.01f : 0f) +
(NPC.downedBoss1 ? 0.01f : 0f) +
(NPC.downedBoss2 ? 0.01f : 0f) +
(NPC.downedQueenBee ? 0.01f : 0f) + //0.05
(NPC.downedBoss3 ? 0.01f : 0f) +
(Main.hardMode ? 0.01f : 0f) +
(NPC.downedMechBossAny ? 0.01f : 0f) +
(NPC.downedPlantBoss ? 0.01f : 0f) +
(NPC.downedGolemBoss ? 0.01f : 0f) + //0.1
(NPC.downedFishron ? 0.01f : 0f) +
(NPC.downedAncientCultist ? 0.01f : 0f) +
(NPC.downedMoonlord ? 0.01f : 0f) +
(CalamityWorld.downedProvidence ? 0.02f : 0f) + //0.15
(CalamityWorld.downedDoG ? 0.02f : 0f) + //0.17
(CalamityWorld.downedYharon ? 0.03f : 0f); //0.2
int integerTypeBoost = (int)(floatTypeBoost * 50f);
int critBoost = integerTypeBoost / 2;
float damageBoost = floatTypeBoost * 0.5f;
player.endurance += floatTypeBoost * 0.25f;
player.statDefense += integerTypeBoost;
player.allDamage += damageBoost;
modPlayer.AllCritBoost(critBoost);
player.minionKB += floatTypeBoost;
player.moveSpeed += floatTypeBoost;
if (player.wingTimeMax > 0)
player.wingTimeMax = (int)((double)player.wingTimeMax * 1.15);
}
if (modPlayer.ravagerLore)
{
if (player.wingTimeMax > 0)
player.wingTimeMax = (int)((double)player.wingTimeMax * 0.5);
player.allDamage += 0.1f;
}
if (modPlayer.wDeath)
{
player.statDefense -= WhisperingDeath.DefenseReduction;
player.allDamage -= 0.1f;
}
if (modPlayer.aFlames)
player.statDefense -= AbyssalFlames.DefenseReduction;
if (modPlayer.gsInferno)
{
player.blackout = true;
player.statDefense -= GodSlayerInferno.DefenseReduction;
}
if (modPlayer.astralInfection)
player.statDefense -= AstralInfectionDebuff.DefenseReduction;
if (modPlayer.pFlames)
{
player.blind = true;
player.statDefense -= Plague.DefenseReduction;
player.moveSpeed -= 0.15f;
}
if (modPlayer.bBlood)
{
player.blind = true;
player.statDefense -= 3;
player.moveSpeed += 0.2f;
player.meleeDamage += 0.05f;
player.rangedDamage -= 0.1f;
player.magicDamage -= 0.1f;
}
if (modPlayer.horror && !modPlayer.laudanum)
{
player.blind = true;
player.statDefense -= 15;
player.moveSpeed -= 0.15f;
}
if (modPlayer.aCrunch)
{
player.statDefense -= ArmorCrunch.DefenseReduction;
player.endurance *= 0.33f;
}
if (modPlayer.wCleave)
{
player.statDefense -= WarCleave.DefenseReduction;
player.endurance *= 0.75f;
}
if (modPlayer.vHex)
{
player.blind = true;
player.statDefense -= 30;
player.moveSpeed -= 0.1f;
if (player.wingTimeMax <= 0)
player.wingTimeMax = 0;
player.wingTimeMax /= 2;
}
if (modPlayer.gState)
{
player.statDefense -= GlacialState.DefenseReduction;
player.velocity.Y = 0f;
player.velocity.X = 0f;
}
if (modPlayer.eFreeze || modPlayer.silvaStun || modPlayer.eutrophication)
{
player.velocity.Y = 0f;
player.velocity.X = 0f;
}
if (modPlayer.vaporfied || modPlayer.teslaFreeze)
{
player.velocity.Y *= 0.98f;
player.velocity.X *= 0.98f;
}
if (modPlayer.eGravity)
{
if (player.wingTimeMax < 0)
player.wingTimeMax = 0;
if (player.wingTimeMax > 400)
player.wingTimeMax = 400;
player.wingTimeMax /= 4;
}
if (modPlayer.eGrav)
{
if (player.wingTimeMax < 0)
player.wingTimeMax = 0;
if (player.wingTimeMax > 400)
player.wingTimeMax = 400;
player.wingTimeMax /= 2;
}
if (modPlayer.molluskSet)
player.velocity.X *= 0.985f;
if ((modPlayer.warped || modPlayer.caribbeanRum) && !player.slowFall && !player.mount.Active)
player.velocity.Y *= 1.01f;
if (modPlayer.corrEffigy)
{
player.moveSpeed += 0.15f;
modPlayer.AllCritBoost(10);
}
if (modPlayer.crimEffigy)
{
player.allDamage += 0.15f;
player.statDefense += 10;
}
if (modPlayer.badgeOfBraveryRare)
player.meleeDamage += 0.2f;
if (modPlayer.calamitasLore)
player.maxMinions += 2;
// The player's true max life value with Calamity adjustments
modPlayer.actualMaxLife = player.statLifeMax2;
if (modPlayer.thirdSageH && !player.dead && modPlayer.healToFull)
player.statLife = player.statLifeMax2;
if (modPlayer.pinkCandle)
{
// Every frame, add up 1/60th of the healing value (0.4% max HP per second)
modPlayer.pinkCandleHealFraction += player.statLifeMax2 * 0.004 / 60;
if (modPlayer.pinkCandleHealFraction >= 1D)
{
modPlayer.pinkCandleHealFraction = 0D;
if (player.statLife < player.statLifeMax2)
player.statLife++;
}
}
else
modPlayer.pinkCandleHealFraction = 0D;
if (modPlayer.manaOverloader)
{
player.magicDamage += 0.06f;
}
if (modPlayer.twinsLore)
{
if (!Main.dayTime)
{
player.invis = true;
modPlayer.throwingCrit += 5;
modPlayer.throwingDamage += 0.05f;
}
if (player.statLife >= (int)(player.statLifeMax2 * 0.5))
player.statDefense -= 10;
}
if (modPlayer.rBrain)
{
if (player.statLife <= (int)(player.statLifeMax2 * 0.75))
player.allDamage += 0.1f;
if (player.statLife <= (int)(player.statLifeMax2 * 0.5))
player.moveSpeed -= 0.05f;
}
if (modPlayer.bloodyWormTooth)
{
if (player.statLife < (int)(player.statLifeMax2 * 0.5))
{
player.meleeDamage += 0.1f;
player.endurance += 0.1f;
}
else
{
player.meleeDamage += 0.05f;
player.endurance += 0.05f;
}
}
if (modPlayer.dAmulet)
{
player.panic = true;
player.pStone = true;
player.armorPenetration += 10;
}
if (modPlayer.rampartOfDeities)
{
player.armorPenetration += 10;
player.noKnockback = true;
if (player.statLife > (int)(player.statLifeMax2 * 0.25))
{
player.hasPaladinShield = true;
if (player.whoAmI != Main.myPlayer && player.miscCounter % 10 == 0)
{
int myPlayer = Main.myPlayer;
if (Main.player[myPlayer].team == player.team && player.team != 0)
{
float arg = player.position.X - Main.player[myPlayer].position.X;
float num3 = player.position.Y - Main.player[myPlayer].position.Y;
if ((float)Math.Sqrt((double)(arg * arg + num3 * num3)) < 800f)
Main.player[myPlayer].AddBuff(43, 20, true);
}
}
}
if (player.statLife <= (int)(player.statLifeMax2 * 0.5))
player.AddBuff(62, 5, true);
if (player.statLife <= (int)(player.statLifeMax2 * 0.15))
player.endurance += 0.05f;
}
else if (modPlayer.fBulwark)
{
player.noKnockback = true;
if (player.statLife > (int)(player.statLifeMax2 * 0.25))
{
player.hasPaladinShield = true;
if (player.whoAmI != Main.myPlayer && player.miscCounter % 10 == 0)
{
int myPlayer = Main.myPlayer;
if (Main.player[myPlayer].team == player.team && player.team != 0)
{
float arg = player.position.X - Main.player[myPlayer].position.X;
float num3 = player.position.Y - Main.player[myPlayer].position.Y;
if ((float)Math.Sqrt((double)(arg * arg + num3 * num3)) < 800f)
Main.player[myPlayer].AddBuff(43, 20, true);
}
}
}
if (player.statLife <= (int)(player.statLifeMax2 * 0.5))
player.AddBuff(62, 5, true);
if (player.statLife <= (int)(player.statLifeMax2 * 0.15))
player.endurance += 0.05f;
}
if (modPlayer.frostFlare)
{
player.resistCold = true;
player.buffImmune[BuffID.Frostburn] = true;
player.buffImmune[BuffID.Chilled] = true;
player.buffImmune[BuffID.Frozen] = true;
if (player.statLife > (int)(player.statLifeMax2 * 0.75))
player.allDamage += 0.1f;
if (player.statLife < (int)(player.statLifeMax2 * 0.25))
player.statDefense += 10;
}
if (modPlayer.vexation)
{
if (player.statLife < (int)(player.statLifeMax2 * 0.5))
player.allDamage += 0.2f;
}
if (modPlayer.ataxiaBlaze)
{
if (player.statLife <= (int)(player.statLifeMax2 * 0.5))
player.AddBuff(BuffID.Inferno, 2);
}
if (modPlayer.bloodflareThrowing)
{
if (player.statLife > (int)(player.statLifeMax2 * 0.8))
{
modPlayer.throwingCrit += 5;
player.statDefense += 30;
}
else
modPlayer.throwingDamage += 0.1f;
}
if (modPlayer.bloodflareSummon)
{
if (player.statLife >= (int)(player.statLifeMax2 * 0.9))
player.minionDamage += 0.1f;
else if (player.statLife <= (int)(player.statLifeMax2 * 0.5))
player.statDefense += 20;
if (modPlayer.bloodflareSummonTimer > 0)
modPlayer.bloodflareSummonTimer--;
if (player.whoAmI == Main.myPlayer && modPlayer.bloodflareSummonTimer <= 0)
{
modPlayer.bloodflareSummonTimer = 900;
for (int I = 0; I < 3; I++)
{
float ai1 = (float)(I * 120);
Projectile.NewProjectile(player.Center.X + (float)(Math.Sin(I * 120) * 550), player.Center.Y + (float)(Math.Cos(I * 120) * 550), 0f, 0f,
ModContent.ProjectileType<GhostlyMine>(), (int)((modPlayer.auricSet ? 15000f : 5000f) * player.MinionDamage()), 1f, player.whoAmI, ai1, 0f);
}
}
}
if (modPlayer.yInsignia)
{
player.longInvince = true;
player.kbGlove = true;
player.meleeDamage += 0.05f;
player.lavaMax += 240;
if (player.statLife <= (int)(player.statLifeMax2 * 0.5))
player.allDamage += 0.1f;
}
if (modPlayer.reaperToothNecklace)
{
player.allDamage += 0.25f;
player.statDefense /= 2;
}
if (modPlayer.deepDiver)
{
player.allDamage += 0.15f;
player.statDefense += (int)(player.statDefense * 0.15);
player.moveSpeed += 0.15f;
}
if (modPlayer.coreOfTheBloodGod)
{
player.endurance += 0.05f;
player.allDamage += 0.07f;
if (player.statDefense < 100)
player.allDamage += 0.15f;
}
else if (modPlayer.bloodflareCore)
{
if (player.statDefense < 100)
player.allDamage += 0.15f;
if (player.statLife <= (int)(player.statLifeMax2 * 0.15))
{
player.endurance += 0.1f;
player.allDamage += 0.2f;
}
else if (player.statLife <= (int)(player.statLifeMax2 * 0.5))
{
player.endurance += 0.05f;
player.allDamage += 0.1f;
}
}
if (modPlayer.godSlayerThrowing)
{
if (player.statLife >= player.statLifeMax2)
{
modPlayer.throwingCrit += 10;
modPlayer.throwingDamage += 0.1f;
modPlayer.throwingVelocity += 0.1f;
}
}
#region Damage Auras
// Tarragon Summon set bonus life aura
if (modPlayer.tarraSummon)
{
const int FramesPerHit = 80;
// Constantly increment the timer every frame.
modPlayer.tarraLifeAuraTimer = (modPlayer.tarraLifeAuraTimer + 1) % FramesPerHit;
// If the timer rolls over, it's time to deal damage. Only run this code for the client which is wearing the armor.
if (modPlayer.tarraLifeAuraTimer == 0 && player.whoAmI == Main.myPlayer)
{
const int BaseDamage = 150;
int damage = (int)(BaseDamage * player.MinionDamage());
float range = 300f;
for (int i = 0; i < Main.maxNPCs; ++i)
{
NPC nPC = Main.npc[i];
if (!nPC.active || nPC.friendly || nPC.damage <= 0 || nPC.dontTakeDamage)
continue;
if (Vector2.Distance(player.Center, nPC.Center) <= range)
Projectile.NewProjectileDirect(nPC.Center, Vector2.Zero, ModContent.ProjectileType<DirectStrike>(), damage, 0f, player.whoAmI, i);
}
}
}
// Navy Fishing Rod's electric aura when in-use
if (player.inventory[player.selectedItem].type == ModContent.ItemType<NavyFishingRod>() && player.ownedProjectileCounts[ModContent.ProjectileType<NavyBobber>()] != 0)
{
const int FramesPerHit = 120;
// Constantly increment the timer every frame.
modPlayer.navyRodAuraTimer = (modPlayer.navyRodAuraTimer + 1) % FramesPerHit;
// If the timer rolls over, it's time to deal damage. Only run this code for the client which is holding the fishing rod,
if (modPlayer.navyRodAuraTimer == 0 && player.whoAmI == Main.myPlayer)
{
const int BaseDamage = 10;
int damage = (int)(BaseDamage * player.AverageDamage());
float range = 200f;
for (int i = 0; i < Main.maxNPCs; ++i)
{
NPC nPC = Main.npc[i];
if (!nPC.active || nPC.friendly || nPC.damage <= 0 || nPC.dontTakeDamage)
continue;
if (Vector2.Distance(player.Center, nPC.Center) <= range)
Projectile.NewProjectileDirect(nPC.Center, Vector2.Zero, ModContent.ProjectileType<DirectStrike>(), damage, 0f, player.whoAmI, i);
// Occasionally spawn cute sparks so it looks like an electrical aura
if (Main.rand.NextBool(10))
{
Vector2 value15 = new Vector2((float)Main.rand.Next(-50, 51), (float)Main.rand.Next(-50, 51));
while (value15.X == 0f && value15.Y == 0f)
value15 = new Vector2((float)Main.rand.Next(-50, 51), (float)Main.rand.Next(-50, 51));
value15.Normalize();
value15 *= (float)Main.rand.Next(30, 61) * 0.1f;
int spark = Projectile.NewProjectile(nPC.Center.X, nPC.Center.Y, value15.X, value15.Y, ModContent.ProjectileType<EutrophicSpark>(), damage / 2, 0f, player.whoAmI, 0f, 0f);
Main.projectile[spark].Calamity().forceTypeless = true;
Main.projectile[spark].localNPCHitCooldown = -2;
Main.projectile[spark].penetrate = 5;
}
}
}
}
// Brimstone Elemental lore inferno potion boost
if (modPlayer.brimstoneElementalLore && player.inferno)
{
const int FramesPerHit = 30;
// Constantly increment the timer every frame.
modPlayer.brimLoreInfernoTimer = (modPlayer.brimLoreInfernoTimer + 1) % FramesPerHit;
// Only run this code for the client which is wearing the armor.
// Brimstone flames is applied every single frame, but direct damage is only dealt twice per second.
if (player.whoAmI == Main.myPlayer)
{
const int BaseDamage = 50;
int damage = (int)(BaseDamage * player.AverageDamage());
float range = 300f;
for (int i = 0; i < Main.maxNPCs; ++i)
{
NPC nPC = Main.npc[i];
if (!nPC.active || nPC.friendly || nPC.damage <= 0 || nPC.dontTakeDamage)
continue;
if (Vector2.Distance(player.Center, nPC.Center) <= range)
{
nPC.AddBuff(ModContent.BuffType<BrimstoneFlames>(), 120);
if (modPlayer.brimLoreInfernoTimer == 0)
Projectile.NewProjectileDirect(nPC.Center, Vector2.Zero, ModContent.ProjectileType<DirectStrike>(), damage, 0f, player.whoAmI, i);
}
}
}
}
#endregion
if (modPlayer.royalGel)
{
player.npcTypeNoAggro[ModContent.NPCType<AeroSlime>()] = true;
player.npcTypeNoAggro[ModContent.NPCType<BloomSlime>()] = true;
player.npcTypeNoAggro[ModContent.NPCType<CharredSlime>()] = true;
player.npcTypeNoAggro[ModContent.NPCType<CrimulanBlightSlime>()] = true;
player.npcTypeNoAggro[ModContent.NPCType<CryoSlime>()] = true;
player.npcTypeNoAggro[ModContent.NPCType<EbonianBlightSlime>()] = true;
player.npcTypeNoAggro[ModContent.NPCType<IrradiatedSlime>()] = true;
player.npcTypeNoAggro[ModContent.NPCType<PerennialSlime>()] = true;
player.npcTypeNoAggro[ModContent.NPCType<PlaguedJungleSlime>()] = true;
player.npcTypeNoAggro[ModContent.NPCType<AstralSlime>()] = true;
// LATER -- When Wulfrum Slimes start being definitely robots, remove this immunity.
player.npcTypeNoAggro[ModContent.NPCType<WulfrumSlime>()] = true;
}
if (modPlayer.dukeScales)
{
player.buffImmune[ModContent.BuffType<SulphuricPoisoning>()] = true;
player.buffImmune[BuffID.Poisoned] = true;
player.buffImmune[BuffID.Venom] = true;
if (player.statLife <= (int)((double)player.statLifeMax2 * 0.75))
{
player.allDamage += 0.06f;
modPlayer.AllCritBoost(3);
}
if (player.statLife <= (int)((double)player.statLifeMax2 * 0.5))
{
player.allDamage += 0.06f;
modPlayer.AllCritBoost(3);
}
if (player.statLife <= (int)((double)player.statLifeMax2 * 0.25))
{
player.allDamage += 0.06f;
modPlayer.AllCritBoost(3);
}
if (player.lifeRegen < 0)
{
player.allDamage += 0.1f;
modPlayer.AllCritBoost(5);
}
}
if (modPlayer.auricSet && modPlayer.silvaMelee)
{
double multiplier = (double)player.statLife / (double)player.statLifeMax2;
player.meleeDamage += (float)(multiplier * 0.2); //ranges from 1.2 times to 1 times
}
if (modPlayer.dArtifact)
player.allDamage += 0.25f;
if (modPlayer.trippy)
player.allDamage += 0.5f;
if (modPlayer.eArtifact)
{
player.manaCost *= 0.85f;
modPlayer.throwingDamage += 0.15f;
player.maxMinions += 2;
}
if (modPlayer.gArtifact)
{
player.maxMinions += 8;
if (player.whoAmI == Main.myPlayer)
{
if (player.FindBuffIndex(ModContent.BuffType<YharonKindleBuff>()) == -1)
player.AddBuff(ModContent.BuffType<YharonKindleBuff>(), 3600, true);
if (player.ownedProjectileCounts[ModContent.ProjectileType<SonOfYharon>()] < 2)
Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, ModContent.ProjectileType<SonOfYharon>(), (int)(232f * player.MinionDamage()), 2f, Main.myPlayer, 0f, 0f);
}
}
if (modPlayer.pArtifact)
{
if (player.whoAmI == Main.myPlayer)
{
if (player.FindBuffIndex(ModContent.BuffType<ProfanedBabs>()) == -1 && !player.Calamity().profanedCrystalBuffs)
player.AddBuff(ModContent.BuffType<ProfanedBabs>(), 3600, true);
bool crystal = modPlayer.profanedCrystal && !modPlayer.profanedCrystalForce;
if (player.ownedProjectileCounts[ModContent.ProjectileType<MiniGuardianHealer>()] < 1)
Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -6f, ModContent.ProjectileType<MiniGuardianHealer>(), 0, 0f, Main.myPlayer, 0f, 0f);
if (crystal || player.Calamity().minionSlotStat >= 10)
{
player.Calamity().gDefense = true;
if (player.ownedProjectileCounts[ModContent.ProjectileType<MiniGuardianDefense>()] < 1)
Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -3f, ModContent.ProjectileType<MiniGuardianDefense>(), 1, 1f, Main.myPlayer, 0f, 0f);
}
if (crystal || (modPlayer.tarraSummon || modPlayer.bloodflareSummon || modPlayer.godSlayerSummon || modPlayer.silvaSummon || modPlayer.dsSetBonus || modPlayer.omegaBlueSet || modPlayer.fearmongerSet))
{
player.Calamity().gOffense = true;
if (player.ownedProjectileCounts[ModContent.ProjectileType<MiniGuardianAttack>()] < 1)
Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType<MiniGuardianAttack>(), 1, 1f, Main.myPlayer, 0f, 0f);
}
}
}
if (modPlayer.profanedCrystalBuffs && modPlayer.gOffense && modPlayer.gDefense)
{
if (player.whoAmI == Main.myPlayer)
{
player.scope = false; //this is so it doesn't mess with the balance of ranged transform attacks over the others
player.lavaImmune = true;
player.lavaMax += 420;
player.lavaRose = true;
player.fireWalk = true;
player.buffImmune[ModContent.BuffType<HolyFlames>()] = true;
player.buffImmune[BuffID.OnFire] = true;
player.buffImmune[BuffID.Burning] = true;
player.buffImmune[BuffID.Daybreak] = true;
bool offenseBuffs = (Main.dayTime && !player.wet) || player.lavaWet;
if (offenseBuffs)
{
player.minionDamage += 0.15f;
player.minionKB += 0.15f;
player.moveSpeed += 0.25f;
player.statDefense -= 15;
if (!player.Calamity().yharonLore)
player.wingTimeMax = (int)((float)player.wingTimeMax * 1.1f);
player.ignoreWater = true;
}
else
{
player.moveSpeed -= 0.15f;
player.endurance += 0.05f;
player.statDefense += 15;
player.lifeRegen += 5;
}
bool enrage = player.statLife <= (int)((double)player.statLifeMax2 * 0.5);
bool notRetro = Lighting.NotRetro;
if (!modPlayer.ZoneAbyss) //No abyss memes.
Lighting.AddLight(player.Center, enrage ? 60 : offenseBuffs ? 50 : 10, enrage ? 12 : offenseBuffs ? 10 : 2, 0);
if (enrage)
{
bool special = player.name == "Amber" || player.name == "Nincity" || player.name == "IbanPlay" || player.name == "Chen"; //People who either helped create the item or test it.
for (int i = 0; i < 3; i++)
{
int num469 = Dust.NewDust(player.position, player.width, player.height, special ? 231 : 244, 0f, 0f, 100, special ? Color.DarkRed : default, 1f);
Main.dust[num469].scale = special ? 1.169f : 2f;
Main.dust[num469].noGravity = true;
Main.dust[num469].velocity *= special ? 10f : 6.9f;
}
}
}
}
if (player.ownedProjectileCounts[ModContent.ProjectileType<BrimstoneElementalMinion>()] > 1 || player.ownedProjectileCounts[ModContent.ProjectileType<WaterElementalMinion>()] > 1 ||
player.ownedProjectileCounts[ModContent.ProjectileType<SandElementalHealer>()] > 1 || player.ownedProjectileCounts[ModContent.ProjectileType<SandElementalMinion>()] > 1 ||
player.ownedProjectileCounts[ModContent.ProjectileType<CloudElementalMinion>()] > 1 || player.ownedProjectileCounts[ModContent.ProjectileType<FungalClumpMinion>()] > 1)
{
for (int projIndex = 0; projIndex < Main.maxProjectiles; projIndex++)
{
if (Main.projectile[projIndex].active && Main.projectile[projIndex].owner == player.whoAmI)
{
if (Main.projectile[projIndex].type == ModContent.ProjectileType<BrimstoneElementalMinion>() || Main.projectile[projIndex].type == ModContent.ProjectileType<WaterElementalMinion>() ||
Main.projectile[projIndex].type == ModContent.ProjectileType<SandElementalHealer>() || Main.projectile[projIndex].type == ModContent.ProjectileType<SandElementalMinion>() ||
Main.projectile[projIndex].type == ModContent.ProjectileType<CloudElementalMinion>() || Main.projectile[projIndex].type == ModContent.ProjectileType<FungalClumpMinion>())
{
Main.projectile[projIndex].Kill();
}
}
}
}
if (modPlayer.tesla)
{
if (player.whoAmI == Main.myPlayer)
{
if (player.ownedProjectileCounts[ModContent.ProjectileType<TeslaAura>()] < 1)
Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, ModContent.ProjectileType<TeslaAura>(), (int)(10 * player.AverageDamage()), 0f, Main.myPlayer, 0f, 0f);
}
}
else if (player.ownedProjectileCounts[ModContent.ProjectileType<TeslaAura>()] != 0)
{
if (player.whoAmI == Main.myPlayer)
{
for (int i = 0; i < Main.projectile.Length; i++)
{
if (Main.projectile[i].active && Main.projectile[i].type == ModContent.ProjectileType<TeslaAura>() && Main.projectile[i].owner == player.whoAmI)
{
Main.projectile[i].Kill();
break;
}
}
}
}
if (modPlayer.theBee)
{
if (player.statLife >= player.statLifeMax2)
{
float beeBoost = player.endurance / 2f;
player.allDamage += beeBoost;
}
}
if (modPlayer.badgeOfBravery)
{
if ((player.armor[0].type == ModContent.ItemType<TarragonHelmet>() || player.armor[0].type == ModContent.ItemType<TarragonHelm>() ||
player.armor[0].type == ModContent.ItemType<TarragonHornedHelm>() || player.armor[0].type == ModContent.ItemType<TarragonMask>() ||
player.armor[0].type == ModContent.ItemType<TarragonVisage>()) &&
player.armor[1].type == ModContent.ItemType<TarragonBreastplate>() && player.armor[2].type == ModContent.ItemType<TarragonLeggings>())
{
player.meleeDamage += 0.1f;
player.meleeCrit += 5;
}
}
if (CalamityMod.CalamityConfig.ProficiencyEnabled)
modPlayer.GetStatBonuses();
}
#endregion
#region Limits
private static void Limits(Player player, CalamityPlayer modPlayer)
{
//not sure where else this should go
if (modPlayer.forbiddenCirclet)
{
float rogueDmg = player.thrownDamage + modPlayer.throwingDamage - 1f;
float minionDmg = player.minionDamage;
if (minionDmg < rogueDmg)
{
player.minionDamage = rogueDmg;
}
if (rogueDmg < minionDmg)
{
modPlayer.throwingDamage = minionDmg - player.thrownDamage + 1f;
}
}
/*if (player.meleeSpeed < 0.5f)
player.meleeSpeed = 0.5f;*/
// 10% is converted to 9%, 25% is converted to 20%, 50% is converted to 33%, 75% is converted to 43%, 100% is converted to 50%
if (player.endurance > 0f)
player.endurance = 1f - (1f / (1f + player.endurance));
if (modPlayer.yharonLore && !CalamityWorld.defiled)
{
if (player.wingTimeMax < 50000)
player.wingTimeMax = 50000;
}
}
#endregion
#region Endurance Reductions
private static void EnduranceReductions(Player player, CalamityPlayer modPlayer)
{
if (modPlayer.vHex)
player.endurance -= 0.3f;
if (modPlayer.irradiated)
{
if (modPlayer.boomerDukeLore)
{
player.endurance += 0.05f;
}
else
{
player.endurance -= 0.1f;
}
}
if (modPlayer.corrEffigy)
player.endurance -= 0.2f;
if (modPlayer.marked || modPlayer.reaperToothNecklace)
{
if (player.endurance > 0f)
player.endurance *= 0.5f;
}
}
#endregion
#region Stat Meter
private static void UpdateStatMeter(Player player, CalamityPlayer modPlayer)
{
float allDamageStat = player.allDamage - 1f;
modPlayer.damageStats[0] = (int)((player.meleeDamage + allDamageStat - 1f) * 100f);
modPlayer.damageStats[1] = (int)((player.rangedDamage + allDamageStat - 1f) * 100f);
modPlayer.damageStats[2] = (int)((player.magicDamage + allDamageStat - 1f) * 100f);
modPlayer.damageStats[3] = (int)((player.minionDamage + allDamageStat - 1f) * 100f);
modPlayer.damageStats[4] = (int)((modPlayer.throwingDamage + allDamageStat - 1f) * 100f);
modPlayer.critStats[0] = player.meleeCrit;
modPlayer.critStats[1] = player.rangedCrit;
modPlayer.critStats[2] = player.magicCrit;
modPlayer.critStats[3] = modPlayer.throwingCrit;
modPlayer.ammoReductionRanged = (int)(100f *
(player.ammoBox ? 0.8f : 1f) *
(player.ammoPotion ? 0.8f : 1f) *
(player.ammoCost80 ? 0.8f : 1f) *
(player.ammoCost75 ? 0.75f : 1f));
modPlayer.ammoReductionRogue = (int)(100f *
(modPlayer.throwingAmmoCost75 ? 0.75f : 1f) *
(modPlayer.throwingAmmoCost66 ? 0.66f : 1f) *
(modPlayer.throwingAmmoCost50 ? 0.5f : 1f));
modPlayer.defenseStat = player.statDefense;
modPlayer.DRStat = (int)(player.endurance * 100f);
modPlayer.meleeSpeedStat = (int)((1f - player.meleeSpeed) * (100f / player.meleeSpeed));
modPlayer.manaCostStat = (int)(player.manaCost * 100f);
modPlayer.rogueVelocityStat = (int)((modPlayer.throwingVelocity - 1f) * 100f);
// Max stealth 1f is actually "100 stealth", so multiply by 100 to get visual stealth number.
modPlayer.stealthStat = (int)(modPlayer.rogueStealthMax * 100f);
// Then divide by 3, because it takes 3 seconds to regen full stealth.
// Divide by 3 again for moving, because it recharges at 1/3 speed (so divide by 9 overall).
// Then multiply by stealthGen variables, which start at 1f and increase proportionally to your boosts.
modPlayer.standingRegenStat = (modPlayer.rogueStealthMax * 100f / 3f) * modPlayer.stealthGenStandstill;
modPlayer.movingRegenStat = (modPlayer.rogueStealthMax * 100f / 9f) * modPlayer.stealthGenMoving * modPlayer.stealthAcceleration;
modPlayer.minionSlotStat = player.maxMinions;
modPlayer.manaRegenStat = player.manaRegen;
modPlayer.armorPenetrationStat = player.armorPenetration;
modPlayer.moveSpeedStat = (int)((player.moveSpeed - 1f) * 100f);
modPlayer.wingFlightTimeStat = player.wingTimeMax;
modPlayer.adrenalineChargeStat = 45 -
(modPlayer.adrenalineBoostOne ? 10 : 0) -
(modPlayer.adrenalineBoostTwo ? 10 : 0) -
(modPlayer.adrenalineBoostThree ? 5 : 0);
bool DHorHoD = modPlayer.draedonsHeart || modPlayer.heartOfDarkness;
int rageDamageBoost = 0 +
(modPlayer.rageBoostOne ? 15 : 0) +
(modPlayer.rageBoostTwo ? 15 : 0) +
(modPlayer.rageBoostThree ? 15 : 0);
modPlayer.rageDamageStat = (DHorHoD ? 65 : 50) + rageDamageBoost;
}
#endregion
#region Rogue Mirrors
private static void RogueMirrors(Player player, CalamityPlayer modPlayer)
{
Rectangle rectangle = new Rectangle((int)((double)player.position.X + (double)player.velocity.X * 0.5 - 4.0), (int)((double)player.position.Y + (double)player.velocity.Y * 0.5 - 4.0), player.width + 8, player.height + 8);
for (int i = 0; i < Main.maxNPCs; i++)
{
NPC npc = Main.npc[i];
if (npc.active && !npc.dontTakeDamage && !npc.friendly && !npc.townNPC && npc.immune[player.whoAmI] <= 0 && npc.damage > 0)
{
Rectangle rect = npc.getRect();
if (rectangle.Intersects(rect) && (npc.noTileCollide || player.CanHit(npc)))
{
if (Main.rand.NextBool(10) && player.immuneTime <= 0)
{
modPlayer.AbyssMirrorEvade();
modPlayer.EclipseMirrorEvade();
}
break;
}
}
}
for (int i = 0; i < Main.maxProjectiles; i++)
{
Projectile proj = Main.projectile[i];
if (proj.active && proj.hostile && proj.damage > 0)
{
Rectangle rect = proj.getRect();
if (rectangle.Intersects(rect))
{
if (Main.rand.NextBool(10))
{
modPlayer.AbyssMirrorEvade();
modPlayer.EclipseMirrorEvade();
}
break;
}
}
}
}
#endregion
}
}