Update public GitHub for 2.0.3.007 release of Calamity

This commit is contained in:
Ozzatron committed 2023-12-01 13:37:44 -05:00
commit 172fa96b59
1908 files changed
+44575 -40291

No files matched your search

+52 -50
View File
@@ -21,6 +21,7 @@ using Terraria.ID;
using Terraria.ModLoader;
using static Terraria.ModLoader.ModContent;
using CalamityMod.NPCs.ProfanedGuardians;
using CalamityMod.NPCs.Yharon;
namespace CalamityMod.Balancing
{
@@ -63,8 +64,8 @@ namespace CalamityMod.Balancing
// Nerf Luminite Arrow trails by 50%.
Do(new ProjectileResistBalancingRule(0.5f, ProjectileID.MoonlordArrowTrail)),
// Nerf Seedler seeds by 66.6%.
Do(new ProjectileResistBalancingRule(1f / 3f, ProjectileID.SeedlerNut, ProjectileID.SeedlerThorn)),
// Nerf Seedler seeds by 25%.
Do(new ProjectileResistBalancingRule(0.75f, ProjectileID.SeedlerNut, ProjectileID.SeedlerThorn)),
// Nerf Cursed Dart flames by 50%.
Do(new ProjectileResistBalancingRule(0.5f, ProjectileID.CursedDartFlame)),
@@ -136,12 +137,15 @@ namespace CalamityMod.Balancing
// 40% resist to Cryophobia.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DestroyerIDs, Do(new ProjectileResistBalancingRule(0.6f, ProjectileType<CryoBlast>()))));
// 20% resist to Mineral Mortar's Projectile.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DestroyerIDs, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType<MineralMortarProjectile>()))));
// 15% resist to Snowstorm Staff.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DestroyerIDs, Do(new ProjectileResistBalancingRule(0.85f, ProjectileType<Snowflake>()))));
#endregion
#region Astrum Aureus
//35% resist to The Ballista's greatarrows.
// 35% resist to The Ballista's greatarrows.
NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType<AstrumAureus>(), Do(new ProjectileResistBalancingRule(0.65f, ProjectileType<BallistaGreatArrow>()))));
#endregion
@@ -160,8 +164,8 @@ namespace CalamityMod.Balancing
#endregion
#region Empress of Light
// 30% resist to Plague Tainted SMG's drones.
NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCID.HallowBoss, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType<PlagueTaintedDrone>()))));
// 20% resist to Plague Tainted SMG's drones.
NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCID.HallowBoss, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType<PlagueTaintedDrone>()))));
#endregion
#region Lunatic Cultist
@@ -184,11 +188,17 @@ namespace CalamityMod.Balancing
// 25% resist to Resurrection Butterfly.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AstrumDeusIDs, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType<SakuraBullet>(), ProjectileType<PurpleButterfly>()))));
// 70% resist to the Stardust Dragon.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AstrumDeusIDs, Do(new ProjectileResistBalancingRule(0.3f, ProjectileID.StardustDragon1, ProjectileID.StardustDragon2, ProjectileID.StardustDragon3, ProjectileID.StardustDragon4))));
#endregion
#region Moon Lord
// 90% resist to Mercurial Tides (True Biome Blade).
NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCID.MoonLordCore, Do(new ProjectileResistBalancingRule(0.1f, ProjectileType<MercurialTides>(), ProjectileType<MercurialTidesMonolith>(), ProjectileType<MercurialTidesBlast>()))));
// 15% resist to Pestilent Defiler.
NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCID.MoonLordCore, Do(new ProjectileResistBalancingRule(0.85f, ProjectileType<SicknessRound>(), ProjectileType<Sickness>()))));
#endregion
#region Profaned Guardians
@@ -236,17 +246,19 @@ namespace CalamityMod.Balancing
#endregion
#region The Devourer of Gods
// 50% resist to Eidolic Wail.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DevourerOfGodsIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType<EidolicWailSoundwave>()))));
// 35% resist to Venusian Trident's explosions.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DevourerOfGodsIDs, Do(new ProjectileResistBalancingRule(0.65f, ProjectileType<VenusianBolt>(), ProjectileType<VenusianExplosion>()))));
// 15% vulnerability to Time Bolt stealth strikes.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DevourerOfGodsIDs, Do(new StealthStrikeBalancingRule(1.15f, ProjectileType<TimeBoltKnife>()))));
#endregion The Devourer of Gods
#region Yharon
// 15% resist to Time Bolt.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AresIDs, Do(new ProjectileResistBalancingRule(0.85f, ProjectileType<TimeBoltKnife>()))));
// 10% resist to Old Reaper.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AresIDs, Do(new ProjectileResistBalancingRule(0.9f, ProjectileType<ReaperProjectile>()))));
NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType<Yharon>(), Do(new ProjectileResistBalancingRule(0.85f, ProjectileType<TimeBoltKnife>()))));
#endregion
#region Exo Mechs: Ares
@@ -256,14 +268,11 @@ namespace CalamityMod.Balancing
// 30% resist to Dynamic Pursuer.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AresIDs, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType<DynamicPursuerProjectile>(), ProjectileType<DynamicPursuerLaser>(), ProjectileType<DynamicPursuerElectricity>()))));
// 30% resist to the Spin Throw part of the Ark of the Cosmos' combo.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AresIDs, Do(new ProjectileSpecificRequirementBalancingRule(0.7f, AotCThrowCombo))));
// 25% resist to Aetherflux Cannon.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AresIDs, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType<PhasedGodRay>()))));
// 25% resist to Murasama.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AresIDs, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType<MurasamaSlash>()))));
// 20% resist to the Spin Throw part of the Ark of the Cosmos' combo.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AresIDs, Do(new ProjectileSpecificRequirementBalancingRule(0.8f, AotCThrowCombo))));
// 20% resist to Dragon Rage projectiles.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AresIDs, Do(new ProjectileSpecificRequirementBalancingRule(0.8f, DragonRageFilter))));
@@ -279,6 +288,9 @@ namespace CalamityMod.Balancing
// 15% resist to Enforcer projectiles.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AresIDs, Do(new ProjectileResistBalancingRule(0.85f, ProjectileType<EssenceFlame2>()))));
// 15% resist to Murasama.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AresIDs, Do(new ProjectileResistBalancingRule(0.85f, ProjectileType<MurasamaSlash>()))));
#endregion
#region Exo Mechs: Artemis and Apollo
@@ -286,14 +298,8 @@ namespace CalamityMod.Balancing
// TODO -- NPC sets (mostly worm bosses) should probably be their own holding class.
int[] exoTwins = new int[] { NPCType<Artemis>(), NPCType<Apollo>() };
// 20% resist to Dynamic Pursuer.
NPCSpecificBalancingChanges.AddRange(Bundle(exoTwins, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType<DynamicPursuerProjectile>(), ProjectileType<DynamicPursuerLaser>(), ProjectileType<DynamicPursuerElectricity>()))));
// 10% resist to Eclipse's Fall stealth strike.
NPCSpecificBalancingChanges.AddRange(Bundle(exoTwins, Do(new ProjectileResistBalancingRule(0.9f, ProjectileType<EclipsesSmol>()))));
// 10% resist to Seared Pan.
NPCSpecificBalancingChanges.AddRange(Bundle(exoTwins, Do(new ProjectileResistBalancingRule(0.9f, ProjectileType<SearedPanProjectile>(), ProjectileType<PanSpark>(), ProjectileType<NiceCock>()))));
#endregion
#region Exo Mechs: Thanatos
@@ -303,12 +309,12 @@ namespace CalamityMod.Balancing
// 65% resist to Enforcer projectiles.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.35f, ProjectileType<EssenceFlame2>()))));
// 65% resist to Dynamic Pursuer. (Do 40% if lightning pierce is removed)
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.35f, ProjectileType<DynamicPursuerProjectile>(), ProjectileType<DynamicPursuerLaser>(), ProjectileType<DynamicPursuerElectricity>()))));
// 65% resist to Final Dawn lunge.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.35f, ProjectileType<FinalDawnThrow2>()))));
// 60% resist to Dynamic Pursuer.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.4f, ProjectileType<DynamicPursuerProjectile>(), ProjectileType<DynamicPursuerLaser>(), ProjectileType<DynamicPursuerElectricity>()))));
// 50% resist to Chicken Cannon.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType<ChickenExplosion>()))));
@@ -318,24 +324,24 @@ namespace CalamityMod.Balancing
// 50% resist to Vehemence skulls.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType<VehemenceSkull>(), ProjectileType<PrismaticBeam>()))));
// 50% resist to Wrathwing stealth strike.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType<WrathwingCinder>()))));
// 50% resist to Yharim's Crystal.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType<YharimsCrystalBeam>()))));
// 45% resist to Wrathwing stealth strike's fireballs.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.55f, ProjectileType<WrathwingCinder>()))));
// 40% resist to Rancor.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.6f, ProjectileType<RancorLaserbeam>()))));
// 35% resist to Anomaly's Nanogun bomb explosions.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.65f, ProjectileType<AnomalysNanogunMPFBBoom>()))));
// 30% resist to the Spin Throw part of the Ark of the Cosmos' combo.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileSpecificRequirementBalancingRule(0.7f, AotCThrowCombo))));
// 30% resist to Eclipse Fall.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType<EclipsesFallMain>()))));
// 30% resist to Prismatic Breaker's laser beam.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType<PrismaticBeam>()))));
// 30% resist to Pulse Rifle.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType<PulseRifleShot>()))));
@@ -345,8 +351,8 @@ namespace CalamityMod.Balancing
// 30% resist to Dragon Scales and The Wand's tornadoes
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType<InfernadoFriendly>(), ProjectileType<DragonScalesInfernado>()))));
// 30% resist to Prismatic Breaker's laser beam.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType<PrismaticBeam>()))));
// 25% resist to the Spin Throw part of the Ark of the Cosmos' combo.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileSpecificRequirementBalancingRule(0.75f, AotCThrowCombo))));
// 25% resist to Dragon Rage projectiles.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileSpecificRequirementBalancingRule(0.75f, DragonRageFilter))));
@@ -354,12 +360,6 @@ namespace CalamityMod.Balancing
// 25% resist to Gael's Greatsword's big skulls.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileSpecificRequirementBalancingRule(0.75f, BigGaelsSkullFilter))));
// 25% resist to Godslayer Slugs.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType<GodSlayerSlugProj>()))));
// 25% resist to Luminite Bullets.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.75f, ProjectileID.MoonlordBullet))));
// 25% resist to Zenith.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.75f, ProjectileID.FinalFractal))));
@@ -369,18 +369,23 @@ namespace CalamityMod.Balancing
// 20% resist to Eradicator beams.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType<NebulaShot>()))));
// 20% resist to Plasma Grenade and Dynamic Pursuer's explosions
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType<PlasmaGrenadeProjectile>(),ProjectileType<PlasmaGrenadeSmallExplosion>(), ProjectileType<MassivePlasmaExplosion>()))));
// 20% resist to Voltaic Climax / Void Vortex hitscan beams.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType<ClimaxBeam>()))));
// 20% resist to Plasma grenades and Dynamic Pursuer's explosions
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType<PlasmaGrenadeProjectile>(),ProjectileType<PlasmaGrenadeSmallExplosion>(), ProjectileType<MassivePlasmaExplosion>()))));
// 15% resist to Final Dawn AoE sweep flames.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.85f, ProjectileType<FinalDawnFlame>()))));
// 15% resist to Godslayer Slugs.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.85f, ProjectileType<GodSlayerSlugProj>()))));
// 15% resist to Gruesome Eminence.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.85f, ProjectileType<SpiritCongregation>()))));
// 15% resist to Luminite Bullets.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.85f, ProjectileID.MoonlordBullet))));
#endregion
#region Supreme Calamitas: Brimstone Hearts
@@ -398,23 +403,20 @@ namespace CalamityMod.Balancing
// 50% resist to Subsuming Vortex.
NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType<SoulSeekerSupreme>(), new ProjectileResistBalancingRule(0.5f, ProjectileType<ExoVortex>(), ProjectileType<ExoVortex2>(), ProjectileType<EnormousConsumingVortex>())));
// 30% resist to Murasama.
NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType<SoulSeekerSupreme>(), new ProjectileResistBalancingRule(0.7f, ProjectileType<MurasamaSlash>())));
// 30% resist to Zenith.
NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType<SoulSeekerSupreme>(), new ProjectileResistBalancingRule(0.7f, ProjectileID.FinalFractal)));
// 25% resist to Yharim's Crystal.
NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType<SoulSeekerSupreme>(), new ProjectileResistBalancingRule(0.75f, ProjectileType<YharimsCrystalBeam>())));
// 10% resist to Surge Driver's alt click comets.
NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType<SoulSeekerSupreme>(), new ProjectileResistBalancingRule(0.9f, ProjectileType<PrismComet>())));
// 10% resist to Celestus.
NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType<SoulSeekerSupreme>(), new ProjectileResistBalancingRule(0.9f, ProjectileType<CelestusProj>(), ProjectileType<CelestusMiniScythe>())));
// 10% resist to Executioner's Blade stealth strikes.
NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType<SoulSeekerSupreme>(), new ProjectileResistBalancingRule(0.9f, ProjectileType<ExecutionersBladeStealthProj>())));
// 10% resist to Celestus.
NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType<SoulSeekerSupreme>(), new ProjectileResistBalancingRule(0.9f, ProjectileType<CelestusProj>(), ProjectileType<CelestusMiniScythe>())));
// 10% resist to Surge Driver's alt click comets.
NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType<SoulSeekerSupreme>(), new ProjectileResistBalancingRule(0.9f, ProjectileType<PrismComet>())));
// 15% vulnerability to The Atom Splitter. (Yes, this is kinda weird, but it's what Piky asked for).
NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType<SoulSeekerSupreme>(), new ProjectileResistBalancingRule(1.15f, ProjectileType<TheAtomSplitterProjectile>(), ProjectileType<TheAtomSplitterDuplicate>())));
+25 -1
View File
@@ -59,7 +59,11 @@
// Rogue stealth
// If stealth is too weak, increase this number. If stealth is too strong, decrease this number.
// This value is intentionally not readonly.
public static double UniversalStealthStrikeDamageFactor = 0.5;
public static double UniversalStealthStrikeDamageFactor = 0.42;
// Shade 23/10/2023: So stealth apparently was indeed way too strong after the bugfix with nearly every weapon being way stronger than before
// due to Flawless now working properly and thus the stealth factor was changed back to 0.42 from 0.5.
// This nerf takes feedback from various players as well as my own personal experience with testing rogue stuff today; it feels too strong and
// something needed to be done about it.
internal static readonly float BaseStealthGenTime = 4f; // 4 seconds
internal static readonly float MovingStealthGenRatio = 0.5f;
@@ -93,6 +97,26 @@
internal static readonly float MinimumAllowedAttackSpeed = 0.25f;
internal static readonly float MaximumAllowedAttackSpeed = 10f;
// Defense Damage
internal const double DefaultDefenseDamageRatio = 0.3333;
// Defense damage floor: PHM | HM | PML
//
// Normal/Expert: 3 | 8 | 16
// Revengeance: 4 | 10 | 20
// Death Mode: 5 | 12 | 24
// Boss Rush: 25
internal static readonly int DefenseDamageFloor_NormalPHM = 3;
internal static readonly int DefenseDamageFloor_NormalHM = 8;
internal static readonly int DefenseDamageFloor_NormalPML = 16;
internal static readonly int DefenseDamageFloor_RevPHM = 4;
internal static readonly int DefenseDamageFloor_RevHM = 10;
internal static readonly int DefenseDamageFloor_RevPML = 20;
internal static readonly int DefenseDamageFloor_DeathPHM = 5;
internal static readonly int DefenseDamageFloor_DeathHM = 12;
internal static readonly int DefenseDamageFloor_DeathPML = 24;
internal static readonly int DefenseDamageFloor_BossRush = 25;
// TODO -- Add all balance related constants here that don't belong in other files.
// Review all constants and static readonlys in the entire mod to find things to add.
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 607 B

After

Width:  |  Height:  |  Size: 674 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 584 B

After

Width:  |  Height:  |  Size: 674 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 627 B

After

Width:  |  Height:  |  Size: 680 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 776 B

After

Width:  |  Height:  |  Size: 812 B

+22
View File
@@ -0,0 +1,22 @@
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Buffs.Alcohol
{
public class OldFashionedBuff : ModBuff
{
public override void SetStaticDefaults()
{
Main.debuff[Type] = true;
Main.pvpBuff[Type] = true;
Main.buffNoSave[Type] = false;
BuffID.Sets.NurseCannotRemoveDebuff[Type] = true;
}
public override void Update(Player player, ref int buffIndex)
{
player.Calamity().oldFashioned = true;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 691 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 622 B

After

Width:  |  Height:  |  Size: 687 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 639 B

After

Width:  |  Height:  |  Size: 686 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 557 B

After

Width:  |  Height:  |  Size: 741 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 683 B

After

Width:  |  Height:  |  Size: 723 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 585 B

After

Width:  |  Height:  |  Size: 674 B

+102
View File
@@ -0,0 +1,102 @@
using CalamityMod.Dusts;
using CalamityMod.Particles;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Buffs.DamageOverTime
{
public class ElementalMix : ModBuff
{
public override void SetStaticDefaults()
{
Main.debuff[Type] = true;
Main.pvpBuff[Type] = true;
Main.buffNoSave[Type] = true;
BuffID.Sets.LongerExpertDebuff[Type] = true;
}
public override void Update(Player player, ref int buffIndex)
{
player.Calamity().elementalMix = true;
}
public override void Update(NPC npc, ref int buffIndex)
{
if (npc.Calamity().elementalMix < npc.buffTime[buffIndex])
npc.Calamity().elementalMix = npc.buffTime[buffIndex];
npc.DelBuff(buffIndex);
buffIndex--;
}
internal static void DrawEffects(PlayerDrawSet drawInfo)
{
Player player = drawInfo.drawPlayer;
var modPlayer = player.Calamity();
var effectcolor = Main.rand.Next(4) switch
{
0 => Color.DeepSkyBlue,
1 => Color.MediumSpringGreen,
2 => Color.DarkOrange,
_ => Color.Violet,
};
Vector2 speed = new Vector2(Main.rand.NextFloat(-3f, 3f), Main.rand.NextFloat(-2.5f, -8.3f));
GeneralParticleHandler.SpawnParticle(new TechyHoloysquareParticle(player.Calamity().RandomDebuffVisualSpot, speed, Main.rand.NextFloat(1.2f, 1.8f), effectcolor, Main.rand.Next(8, 14)));
int dustType = Main.rand.NextBool() ? 66 : 247;
Dust dust = Dust.NewDustPerfect(player.Calamity().RandomDebuffVisualSpot, dustType);
dust.scale = (dustType == 66 ? 1.4f : 1.2f);
dust.velocity = Vector2.Zero + new Vector2(Main.rand.NextFloat(-1, 1), Main.rand.NextFloat(4f, 8f)) - player.velocity / 2;
dust.noGravity = true;
dust.alpha = Main.rand.Next(90, 150);
dust.color = effectcolor;
}
internal static void DrawEffects(NPC npc, ref Color drawColor)
{
if (Main.rand.NextBool())
{
var effectcolor = Main.rand.Next(4) switch
{
0 => Color.DeepSkyBlue,
1 => Color.MediumSpringGreen,
2 => Color.DarkOrange,
_ => Color.Violet,
};
Vector2 npcSize = npc.Center + new Vector2(Main.rand.NextFloat(-npc.width / 2, npc.width / 2), Main.rand.NextFloat(-npc.height / 2, npc.height / 2));
Vector2 speed = new Vector2(Main.rand.NextFloat(-3f, 3f), Main.rand.NextFloat(-2.5f, -8.3f));
GeneralParticleHandler.SpawnParticle(new TechyHoloysquareParticle(npcSize, speed, Main.rand.NextFloat(1.2f, 3.1f), effectcolor, Main.rand.Next(8, 14)));
int dustType = Main.rand.NextBool() ? 66 : 247;
Dust dust = Dust.NewDustPerfect(npcSize, dustType);
dust.scale = (dustType == 66 ? 1.4f : 1.2f);
dust.noGravity = true;
dust.velocity = Vector2.Zero + new Vector2(Main.rand.NextFloat(-2, 2), Main.rand.NextFloat(2f, 4f)) - npc.velocity / 2;
dust.alpha = Main.rand.Next(90, 150);
dust.color = effectcolor;
}
if (Main.rand.NextBool(5))
{
var effectcolor = Main.rand.Next(4) switch
{
0 => Color.DeepSkyBlue,
1 => Color.MediumSpringGreen,
2 => Color.DarkOrange,
_ => Color.Violet,
};
Vector2 npcSize = npc.Center + new Vector2(Main.rand.NextFloat(-npc.width / 2, npc.width / 2), Main.rand.NextFloat(-npc.height / 2, npc.height / 2));
int dustType = Main.rand.NextBool() ? 66 : 247;
Dust dust = Dust.NewDustPerfect(npcSize, dustType);
dust.scale = (dustType == 66 ? 0.9f : 1.4f);
dust.noGravity = true;
dust.velocity = Vector2.Zero + new Vector2(Main.rand.NextFloat(-2, 2), Main.rand.NextFloat(2f, 4f));
dust.alpha = Main.rand.Next(35, 90);
dust.color = effectcolor;
}
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 630 B

+31 -44
View File
@@ -36,37 +36,29 @@ namespace CalamityMod.Buffs.DamageOverTime
var sparkColor = Main.rand.Next(4) switch
{
0 => Color.DarkRed,
0 => Color.Red,
1 => Color.MediumTurquoise,
2 => Color.Orange,
_ => Color.LawnGreen,
};
DirectionalPulseRing pulse = new DirectionalPulseRing(Player.Calamity().RandomDebuffVisualSpot, Vector2.Zero, sparkColor, new Vector2(1, 1), 0, Main.rand.NextFloat(0.09f, 0.17f), 0f, 25);
GeneralParticleHandler.SpawnParticle(pulse);
float numberOfDusts = 3f;
float rotFactor = 360f / numberOfDusts;
if (Player.miscCounter % 4 == 0)
if (Main.rand.NextBool(2))
{
for (int i = 0; i < numberOfDusts; i++)
{
var DustType = Main.rand.Next(4) switch
{
0 => 219,
1 => 220,
2 => 226,
_ => 222,
};
float rot = MathHelper.ToRadians(i * rotFactor);
Vector2 offset = new Vector2(0.3f, 0).RotatedBy(rot * Main.rand.NextFloat(0.2f, 0.3f));
Vector2 velOffset = CalamityUtils.RandomVelocity(100f, 70f, 150f, 0.04f);
Dust dust = Dust.NewDustPerfect(Player.Calamity().RandomDebuffVisualSpot + offset, DustType, new Vector2(velOffset.X, velOffset.Y));
dust.noGravity = true;
dust.velocity = velOffset;
velOffset *= 10;
dust.position = Player.Center - velOffset;
dust.scale = Main.rand.NextFloat(0.7f, 0.8f);
}
Dust dust = Dust.NewDustPerfect(Player.Calamity().RandomDebuffVisualSpot, 278, CalamityUtils.RandomVelocity(100f, 70f, 150f, 0.04f));
dust.noGravity = true;
dust.scale = Main.rand.NextFloat(0.7f, 0.85f);
dust.color = sparkColor * 0.45f;
}
float numberOfDusts = 1f;
float rotFactor = 360f / numberOfDusts;
for (int i = 0; i < numberOfDusts; i++)
{
float rot = MathHelper.ToRadians(i * rotFactor);
Vector2 velOffset = CalamityUtils.RandomVelocity(100f, 70f, 150f, 0.04f);
velOffset *= Main.rand.NextFloat(2, 13);
SquishyLightParticle exoEnergy = new(Player.Center + Player.velocity * 3 + velOffset * 1.5f, -velOffset * 0.25f, 0.3f, sparkColor, 8);
GeneralParticleHandler.SpawnParticle(exoEnergy);
}
}
@@ -75,36 +67,31 @@ namespace CalamityMod.Buffs.DamageOverTime
Vector2 npcSize = npc.Center + new Vector2(Main.rand.NextFloat(-npc.width / 2, npc.width / 2), Main.rand.NextFloat(-npc.height / 2, npc.height / 2));
var sparkColor = Main.rand.Next(4) switch
{
0 => Color.DarkRed,
0 => Color.Red,
1 => Color.MediumTurquoise,
2 => Color.Orange,
_ => Color.LawnGreen,
};
DirectionalPulseRing pulse = new DirectionalPulseRing(npcSize, Vector2.Zero, sparkColor, new Vector2(1, 1), 0, 0.18f + (0.0000007f * npc.width * npc.height), 0f, 25);
GeneralParticleHandler.SpawnParticle(pulse);
float numberOfDusts = 2f;
float rotFactor = 360f / numberOfDusts;
if (Main.rand.NextBool(3))
{
Dust dust = Dust.NewDustPerfect(npcSize, 278, CalamityUtils.RandomVelocity(100f, 70f, 150f, 0.04f));
dust.noGravity = true;
dust.scale = Main.rand.NextFloat(0.7f, 0.85f) + (0.0000007f * npc.width * npc.height);
dust.color = sparkColor * 0.45f;
}
float numberOfDusts = 1f;
float rotFactor = 360f / numberOfDusts;
if (Main.rand.NextBool())
{
for (int i = 0; i < numberOfDusts; i++)
{
var DustType = Main.rand.Next(4) switch
{
0 => 219,
1 => 220,
2 => 226,
_ => 222,
};
float rot = MathHelper.ToRadians(i * rotFactor);
Vector2 offset = new Vector2(0.3f, 0).RotatedBy(rot * Main.rand.NextFloat(0.2f, 0.3f));
Vector2 velOffset = CalamityUtils.RandomVelocity(100f, 70f, 150f, 0.04f);
Dust dust = Dust.NewDustPerfect(npc.Center + offset, DustType, new Vector2(velOffset.X, velOffset.Y));
dust.noGravity = true;
dust.velocity = velOffset;
velOffset *= 10 + (0.0003f * npc.width * npc.height);
dust.position = npc.Center - velOffset;
dust.scale = Main.rand.NextFloat(0.7f, 0.8f);
velOffset *= Main.rand.NextFloat(1, 9) + (0.0002f * npc.width * npc.height);
SquishyLightParticle exoEnergy = new(npc.Center + npc.velocity * 3 + velOffset * 1.5f, -velOffset * 0.25f, 0.3f, sparkColor, 8);
GeneralParticleHandler.SpawnParticle(exoEnergy);
}
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 490 B

After

Width:  |  Height:  |  Size: 575 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 570 B

After

Width:  |  Height:  |  Size: 562 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 591 B

After

Width:  |  Height:  |  Size: 535 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 550 B

After

Width:  |  Height:  |  Size: 587 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 435 B

After

Width:  |  Height:  |  Size: 541 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 607 B

@@ -3,7 +3,7 @@ using Terraria.ModLoader;
namespace CalamityMod.Buffs.StatBuffs
{
public class BloodyBoost : ModBuff
public class BrutalCarnage : ModBuff
{
public override void SetStaticDefaults()
{
@@ -14,7 +14,7 @@ namespace CalamityMod.Buffs.StatBuffs
public override void Update(Player player, ref int buffIndex)
{
player.Calamity().bloodPactBoost = true;
player.Calamity().brutalCarnage = true;
}
}
}
File renamed without changes.

Before

Width:  |  Height:  |  Size: 625 B

After

Width:  |  Height:  |  Size: 625 B

-20
View File
@@ -1,20 +0,0 @@
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Buffs.StatBuffs
{
public class ShellBoost : ModBuff
{
public override void SetStaticDefaults()
{
Main.debuff[Type] = false;
Main.pvpBuff[Type] = true;
Main.buffNoSave[Type] = true;
}
public override void Update(Player player, ref int buffIndex)
{
player.Calamity().shellBoost = true;
}
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 478 B

-20
View File
@@ -1,20 +0,0 @@
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Buffs.StatBuffs
{
public class TyrantsFury : ModBuff
{
public override void SetStaticDefaults()
{
Main.debuff[Type] = false;
Main.pvpBuff[Type] = true;
Main.buffNoSave[Type] = true;
}
public override void Update(Player player, ref int buffIndex)
{
player.Calamity().tFury = true;
}
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 522 B

After

Width:  |  Height:  |  Size: 3.2 KiB

+2 -2
View File
@@ -19,9 +19,9 @@ namespace CalamityMod.Buffs.Summon
CalamityPlayer modPlayer = player.Calamity();
if (player.ownedProjectileCounts[ModContent.ProjectileType<IceClasperMinion>()] > 0)
{
modPlayer.iClasper = true;
modPlayer.IceClasperBool = true;
}
if (!modPlayer.iClasper)
if (!modPlayer.IceClasperBool)
{
player.DelBuff(buffIndex);
buffIndex--;
+201 -117
View File
@@ -26,6 +26,7 @@ using CalamityMod.Items.Dyes;
using CalamityMod.Items.Mounts;
using CalamityMod.Items.Mounts.Minecarts;
using CalamityMod.Items.PermanentBoosters;
using CalamityMod.Items.Potions.Alcohol;
using CalamityMod.Items.TreasureBags.MiscGrabBags;
using CalamityMod.Items.VanillaArmorChanges;
using CalamityMod.Items.Weapons.DraedonsArsenal;
@@ -97,7 +98,7 @@ namespace CalamityMod.CalPlayer
public bool reducedHolyFlamesDamage = false;
public bool reducedNightwitherDamage = false;
public float rangedAmmoCost = 1f;
public float healingPotBonus = 1f;
public float healingPotionMultiplier = 1f;
public bool heldGaelsLastFrame = false;
internal bool hadNanomachinesLastFrame = false;
public bool disableVoodooSpawns = false;
@@ -178,12 +179,20 @@ namespace CalamityMod.CalPlayer
#region Timer and Counter
public int gaelSwipes = 0;
public int dragoonDrizzlefishGelBoost = 1;
public int deadSunCounter = 6;
public int DragonsBreathAudioCooldown = 0;
public int DragonsBreathAudioCooldown2 = 0;
public int PhotoAudioCooldown = 0;
public int PhotoTimer = 90;
public bool brittleStarBuffMode = false;
public bool sBlasterDashActivated = false;
public int saharaSlicersBolts = 0;
public int oceanCrestTimer = 0;
public int Holyhammer = 0;
public int PHAThammer = 0;
public int StellarHammer = 0;
public int GalaxyHammer = 0;
public int gaelRageAttackCooldown = 0;
public int hideOfDeusMeleeBoostTimer = 0;
public int nebulaManaNerfCounter = 0;
public int alcoholPoisonLevel = 0;
@@ -216,12 +225,14 @@ namespace CalamityMod.CalPlayer
public int auralisAurora = 0;
public int necroReviveCounter = -1;
public int hideOfDeusTimer = 0;
public int murasamaHitCooldown = 0;
public int giantShellPostHit = 0;
public int tortShellPostHit = 0;
public int spiritOriginBullseyeShootCountdown = 0;
public int spiritOriginConvertedCrit = 0;
public int RustyMedallionCooldown = 0;
public float SulphWaterPoisoningLevel;
public float holyInfernoFadeIntensity;
public NPC unstableSelectedTarget;
public int zapActivity = 0;
public bool ragePulse = false;
@@ -355,27 +366,55 @@ namespace CalamityMod.CalPlayer
#endregion
#region Defense Damage
// Ratio at which incoming damage (after mitigation) is converted into defense damage.
// Used to be 5% normal, 10% expert, 12% rev, 15% death, 20% boss rush
// It is now 10% on all difficulties because you already take less damage on lower difficulties.
public const double DefenseDamageRatio = 0.1;
// Ratio at which mitigated damage is converted into defense damage.
// This is a significant rework, so the ratio is much higher than the previous 0.1 / 10%.
// The net difference between incoming damage and final taken damage is what is multiplied by this ratio.
//
// Example: You have 200 defense and 25% DR and get hit for 576, on Expert.
//
// Incoming damage = 576
// Defense reduction = 0.75 * 200 = 150
// Damage after defense = 426
// DR reduction = 0.25 * 426 = 106.5
// Damage after DR = 319.5 (rounds down to 319)
//
// Net Difference = 576 - 319 = 257
// Defense Damage = 257 * 0.3333 = 85.6581 (rounds up to 86)
//
// The player then loses 86 defense.
// DR is lost according to the ratio of defense lost versus total defense.
// In this case, that ratio is 86 / 200 = 0.43.
// The player loses 0.43 * 0.25 = 10.75% DR.
public double defenseDamageRatio = BalancingConstants.DefaultDefenseDamageRatio;
// Current effect of defense damage, calculated as total defense damage lerped to zero over the recovery time.
public int CurrentDefenseDamage => (int)(totalDefenseDamage * ((float)defenseDamageRecoveryFrames / totalDefenseDamageRecoveryFrames));
// Total defense damage inflicted. This number keeps increasing if the player is repeatedly hit during the recovery period.
internal int totalDefenseDamage = 0;
// Defense damage from a single hit recovers in 50 frames, no matter how big the hit was.
// If you get hit AGAIN before you have fully recovered, 50 more frames are added to your recovery timer!
// Defense damage from a single hit recovers in 60 frames, no matter how big the hit was.
// If you get hit AGAIN before you have fully recovered, 60 more frames are added to your recovery timer!
internal const int DefenseDamageBaseRecoveryTime = 60;
// The maximum possible recovery time is 15 seconds. This is to prevent annoyance where godmode defense damage never goes away.
internal const int DefenseDamageMaxRecoveryTime = 900;
// How many frames the player will continue to be recovering from defense damage.
internal int defenseDamageRecoveryFrames = 0;
// The total timer of defense damage recovery that the player is currently suffering from.
internal int totalDefenseDamageRecoveryFrames = DefenseDamageBaseRecoveryTime;
// Defense damage does not start recovering for a certain number of frames after iframes end.
internal const int DefenseDamageRecoveryDelay = 10;
// The current timer for how long the player must wait before defense damage begins recovering.
internal int defenseDamageDelayFrames = 0;
public bool justHitByDefenseDamage = false;
public int defenseDamageToTake = 0;
// Temporary bool for whether the current instance of incoming damage to the player is one that inflicts defense damage.
// Bloodflare Core ignores this and makes every single instance of incoming damage apply defense damage.
public bool nextHitDealsDefenseDamage = false;
#endregion
#region Energy Shields
@@ -466,8 +505,12 @@ namespace CalamityMod.CalPlayer
public bool badgeOfBravery = false;
public bool warbannerOfTheSun = false;
public bool cryogenSoul = false;
public bool yInsignia = false;
public bool ascendantInsignia = false;
public int ascendantInsigniaBuffTime = 0;
public int ascendantInsigniaCooldown = 0;
public bool ascendantTrail = false;
public bool eGauntlet = false;
public int gloveLevel = 0; // Used to prevent glove stacking
public bool eTalisman = false;
public int statisTimer = 0;
public bool nucleogenesis = false;
@@ -534,8 +577,10 @@ namespace CalamityMod.CalPlayer
public bool bloodPact = false;
public bool bloodPactBoost = false;
public bool bloodflareCore = false;
public int bloodflareCoreLostDefense = 0;
public bool coreOfTheBloodGod = false;
public int bloodflareCoreRemainingHealOverTime = 0;
public bool chaliceOfTheBloodGod = false;
public double chaliceBleedoutBuffer = 0D;
public double chaliceDamagePointPartialProgress = 0D;
public bool elementalHeart = false;
public bool crownJewel = false;
public bool infectedJewel = false;
@@ -553,6 +598,7 @@ namespace CalamityMod.CalPlayer
public bool hellfireTreads = false;
public bool abyssalAmulet = false;
public bool lumenousAmulet = false;
public bool oceanCrest = false;
public bool aquaticEmblem = false;
public bool spiritOrigin = false;
public bool spiritOriginVanity = false;
@@ -745,8 +791,6 @@ namespace CalamityMod.CalPlayer
public bool plagueReaper = false;
public bool plaguebringerPatronSet = false;
public bool plaguebringerCarapace = false;
public bool plaguebringerPistons = false;
public int pistonsCounter = 0;
public float ataxiaDmg;
public bool ataxiaMage = false;
public bool ataxiaGeyser = false;
@@ -828,6 +872,7 @@ namespace CalamityMod.CalPlayer
public bool gState = false;
public bool bBlood = false;
public bool brainRot = false;
public bool elementalMix = false;
public bool icarusFolly = false;
public bool weakPetrification = false;
public bool vHex = false;
@@ -865,7 +910,7 @@ namespace CalamityMod.CalPlayer
public bool xWrath = false;
public bool graxDefense = false;
public bool encased = false;
public bool tFury = false;
public bool brutalCarnage = false;
public bool omniscience = false;
public bool zerg = false;
public bool zen = false;
@@ -876,7 +921,6 @@ namespace CalamityMod.CalPlayer
public bool PinkJellyRegen = false;
public bool GreenJellyRegen = false;
public bool AbsorberRegen = false;
public bool shellBoost = false;
public bool cFreeze = false;
public bool shine = false;
public bool anechoicCoating = false;
@@ -910,6 +954,7 @@ namespace CalamityMod.CalPlayer
public bool cinnamonRoll = false;
public bool tequilaSunrise = false;
public bool margarita = false;
public bool oldFashioned = false;
public bool starBeamRye = false;
public bool screwdriver = false;
public bool moscowMule = false;
@@ -940,7 +985,7 @@ namespace CalamityMod.CalPlayer
public bool wDroid = false;
public bool resButterfly = false;
public bool mWorm = false;
public bool iClasper = false;
public bool IceClasperBool = false;
public bool magicHat = false;
public bool herring = false;
public bool blackhawk = false;
@@ -1417,8 +1462,11 @@ namespace CalamityMod.CalPlayer
KeyValuePair<string, object> kv = tagIterator.Current;
string id = kv.Key;
TagCompound singleCDTag = cooldownsTag.GetCompound(id);
// If the cooldown has no registered handler, don't add it. Doing so will cause crashes.
CooldownInstance instance = new CooldownInstance(Player, id, singleCDTag);
cooldowns.Add(id, instance);
if (instance.handler is not null)
cooldowns.Add(id, instance);
}
}
#endregion
@@ -1432,10 +1480,13 @@ namespace CalamityMod.CalPlayer
int percentMaxLifeIncrease = 0;
if (ZoneAbyss && abyssalAmulet)
percentMaxLifeIncrease += lumenousAmulet ? 25 : 10;
if (coreOfTheBloodGod)
percentMaxLifeIncrease += 15;
// Blood Pact and Chalice of the Blood God stack their HP bonuses if you want to equip both
if (bloodPact)
percentMaxLifeIncrease += 100;
percentMaxLifeIncrease += 25;
if (chaliceOfTheBloodGod)
percentMaxLifeIncrease += 25;
if (affliction || afflicted)
percentMaxLifeIncrease += 10;
@@ -1457,6 +1508,7 @@ namespace CalamityMod.CalPlayer
// Reset adrenaline duration to default. If Draedon's Heart is equipped, it'll change itself every frame.
AdrenalineDuration = CalamityUtils.SecondsToFrames(5);
defenseDamageRatio = BalancingConstants.DefaultDefenseDamageRatio;
contactDamageReduction = 0D;
projectileDamageReduction = 0D;
rogueVelocity = 1f;
@@ -1622,8 +1674,10 @@ namespace CalamityMod.CalPlayer
nanotech = false;
deadshotBrooch = false;
cryogenSoul = false;
yInsignia = false;
ascendantInsignia = false;
ascendantTrail = false;
eGauntlet = false;
gloveLevel = 0;
eTalisman = false;
nucleogenesis = false;
nuclearFuelRod = false;
@@ -1644,7 +1698,7 @@ namespace CalamityMod.CalPlayer
fleshTotem = false;
bloodPact = false;
bloodflareCore = false;
coreOfTheBloodGod = false;
chaliceOfTheBloodGod = false;
elementalHeart = false;
crownJewel = false;
infectedJewel = false;
@@ -1724,7 +1778,7 @@ namespace CalamityMod.CalPlayer
lunicCorpsLegs = false;
rangedAmmoCost = 1f;
healingPotBonus = 1f;
healingPotionMultiplier = 1f;
avertorBonus = false;
@@ -1741,6 +1795,7 @@ namespace CalamityMod.CalPlayer
hellfireTreads = false;
abyssalAmulet = false;
lumenousAmulet = false;
oceanCrest = false;
aquaticEmblem = false;
spiritOrigin = false;
spiritOriginVanity = false;
@@ -1782,7 +1837,6 @@ namespace CalamityMod.CalPlayer
plagueReaper = false;
plaguebringerPatronSet = false;
plaguebringerCarapace = false;
plaguebringerPistons = false;
fathomSwarmer = false;
fathomSwarmerVisage = false;
fathomSwarmerBreastplate = false;
@@ -1853,6 +1907,7 @@ namespace CalamityMod.CalPlayer
gState = false;
bBlood = false;
brainRot = false;
elementalMix = false;
icarusFolly = false;
vHex = false;
DoGExtremeGravity = false;
@@ -1883,7 +1938,7 @@ namespace CalamityMod.CalPlayer
xWrath = false;
graxDefense = false;
encased = false;
tFury = false;
brutalCarnage = false;
omniscience = false;
zerg = false;
zen = false;
@@ -1913,14 +1968,12 @@ namespace CalamityMod.CalPlayer
PinkJellyRegen = false;
GreenJellyRegen = false;
AbsorberRegen = false;
shellBoost = false;
cFreeze = false;
tRegen = false;
polarisBoost = false;
polarisBoostTwo = false;
polarisBoostThree = false;
bloodfinBoost = false;
bloodPactBoost = false;
divineBless = false;
killSpikyBalls = false;
@@ -1939,6 +1992,7 @@ namespace CalamityMod.CalPlayer
cinnamonRoll = false;
tequilaSunrise = false;
margarita = false;
oldFashioned = false;
starBeamRye = false;
screwdriver = false;
moscowMule = false;
@@ -1954,7 +2008,7 @@ namespace CalamityMod.CalPlayer
wDroid = false;
resButterfly = false;
mWorm = false;
iClasper = false;
IceClasperBool = false;
magicHat = false;
herring = false;
blackhawk = false;
@@ -2190,15 +2244,17 @@ namespace CalamityMod.CalPlayer
}
}
#region Debuffs
#region Defense Damage
totalDefenseDamage = 0;
defenseDamageRecoveryFrames = 0;
totalDefenseDamageRecoveryFrames = DefenseDamageBaseRecoveryTime;
defenseDamageDelayFrames = 0;
justHitByDefenseDamage = false;
defenseDamageToTake = 0;
nextHitDealsDefenseDamage = false;
bloodflareCoreRemainingHealOverTime = 0;
#endregion
#region Debuffs
heldGaelsLastFrame = false;
gaelRageAttackCooldown = 0;
gaelSwipes = 0;
andromedaState = AndromedaPlayerState.Inactive;
planarSpeedBoost = 0;
@@ -2212,8 +2268,10 @@ namespace CalamityMod.CalPlayer
auralisAurora = 0;
necroReviveCounter = -1;
hideOfDeusTimer = 0;
murasamaHitCooldown = 0;
RustyMedallionCooldown = 0;
SulphWaterPoisoningLevel = 0f;
holyInfernoFadeIntensity = 0f;
spiritOriginConvertedCrit = 0;
rage = 0f;
adrenaline = 0f;
@@ -2272,6 +2330,7 @@ namespace CalamityMod.CalPlayer
gState = false;
bBlood = false;
brainRot = false;
elementalMix = false;
icarusFolly = false;
vHex = false;
DoGExtremeGravity = false;
@@ -2338,7 +2397,7 @@ namespace CalamityMod.CalPlayer
kamiBoost = false;
graxDefense = false;
encased = false;
tFury = false;
brutalCarnage = false;
omniscience = false;
zerg = false;
zen = false;
@@ -2368,12 +2427,10 @@ namespace CalamityMod.CalPlayer
GreenJellyRegen = false;
AbsorberRegen = false;
enraged = false;
shellBoost = false;
cFreeze = false;
tRegen = false;
rageModeActive = false;
adrenalineModeActive = false;
AdrenalineTrail = false;
vodka = false;
redWine = false;
grapeBeer = false;
@@ -2388,6 +2445,7 @@ namespace CalamityMod.CalPlayer
cinnamonRoll = false;
tequilaSunrise = false;
margarita = false;
oldFashioned = false;
starBeamRye = false;
screwdriver = false;
moscowMule = false;
@@ -2408,9 +2466,8 @@ namespace CalamityMod.CalPlayer
bloodfinTimer = 0;
healCounter = 300;
danceOfLightCharge = 0;
bloodPactBoost = false;
rangedAmmoCost = 1f;
healingPotBonus = 1f;
healingPotionMultiplier = 1f;
avertorBonus = false;
divineBless = false;
#endregion
@@ -2480,8 +2537,6 @@ namespace CalamityMod.CalPlayer
plagueReaper = false;
plaguebringerPatronSet = false;
plaguebringerCarapace = false;
plaguebringerPistons = false;
pistonsCounter = 0;
ataxiaMage = false;
ataxiaBolt = false;
ataxiaGeyser = false;
@@ -2551,17 +2606,21 @@ namespace CalamityMod.CalPlayer
KameiBladeUseDelay = 0;
brimlashBusterBoost = false;
AdrenalineTrail = false;
ascendantTrail = false;
evilSmasherBoost = 0;
hellbornBoost = 0;
searedPanCounter = 0;
searedPanTimer = 0;
potionTimer = 0;
bloodflareCoreLostDefense = 0;
persecutedEnchantSummonTimer = 0;
momentumCapacitorTime = 0;
momentumCapacitorBoost = 0f;
LungingDown = false;
chaliceBleedoutBuffer = 0D;
chaliceDamagePointPartialProgress = 0D;
if (BossRushEvent.BossRushActive)
{
// https://github.com/tModLoader/tModLoader/wiki/IEntitySource#detailed-list
@@ -2571,13 +2630,11 @@ namespace CalamityMod.CalPlayer
Projectile.NewProjectile(source, Player.Center, Vector2.Zero, ModContent.ProjectileType<BossRushFailureEffectThing>(), 0, 0f);
}
// Respawn the player faster if no bosses are alive
if (!areThereAnyDamnBosses)
{
int respawnTimerSet = areThereAnyDamnEvents ? 360 : 180;
if (Player.respawnTimer > respawnTimerSet)
Player.respawnTimer = respawnTimerSet;
}
// Respawn the player faster
// 3 seconds normally, 5 seconds while an event is happening and 15 seconds while a boss is alive
int respawnTimerSet = areThereAnyDamnBosses ? 900 : areThereAnyDamnEvents ? 300 : 180;
if (Player.respawnTimer > respawnTimerSet)
Player.respawnTimer = respawnTimerSet;
}
#endregion
@@ -2680,7 +2737,11 @@ namespace CalamityMod.CalPlayer
{
Projectile proj = Main.projectile[projIndex];
float start = 360f / angelAmt;
Projectile.NewProjectile(source, new Vector2((int)(Player.Center.X + (Math.Sin(projIndex * start) * 300)), (int)(Player.Center.Y + (Math.Cos(projIndex * start) * 300))), Vector2.Zero, ModContent.ProjectileType<AngelicAllianceArchangel>(), proj.damage / 10, proj.knockBack / 10f, Player.whoAmI, Main.rand.Next(180), projIndex * start);
int damage = proj.damage / 10;
if (oldFashioned)
damage = CalamityUtils.CalcOldFashionedDamage(damage);
Projectile.NewProjectile(source, new Vector2((int)(Player.Center.X + (Math.Sin(projIndex * start) * 300)), (int)(Player.Center.Y + (Math.Cos(projIndex * start) * 300))), Vector2.Zero, ModContent.ProjectileType<AngelicAllianceArchangel>(), damage, proj.knockBack / 10f, Player.whoAmI, Main.rand.Next(180), projIndex * start);
Player.statLife += 2;
Player.HealEffect(2);
}
@@ -2692,7 +2753,11 @@ namespace CalamityMod.CalPlayer
var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType<Items.Accessories.SandCloak>()));
rogueStealth -= rogueStealthMax * 0.1f;
int veil = Projectile.NewProjectile(source, Player.Center, Vector2.Zero, ModContent.ProjectileType<SandCloakVeil>(), 7, 8, Player.whoAmI);
int damage = 7;
if (oldFashioned)
damage = CalamityUtils.CalcOldFashionedDamage(damage);
int veil = Projectile.NewProjectile(source, Player.Center, Vector2.Zero, ModContent.ProjectileType<SandCloakVeil>(), damage, 8, Player.whoAmI);
Main.projectile[veil].Center = Player.Center;
SoundEngine.PlaySound(SoundID.Item45, Player.Center);
}
@@ -2770,22 +2835,22 @@ namespace CalamityMod.CalPlayer
brimflameFrenzy = true;
Player.AddBuff(ModContent.BuffType<BrimflameFrenzyBuff>(), 10 * 60, true);
SoundEngine.PlaySound(BrimflameScowl.ActivationSound, Player.Center);
for (int num502 = 0; num502 < 36; num502++)
for (int i = 0; i < 36; i++)
{
int dust = Dust.NewDust(new Vector2(Player.position.X, Player.position.Y + 16f), Player.width, Player.height - 16, (int)CalamityDusts.Brimstone, 0f, 0f, 0, default, 1f);
Main.dust[dust].velocity *= 3f;
Main.dust[dust].scale *= 1.15f;
int brimDust = Dust.NewDust(new Vector2(Player.position.X, Player.position.Y + 16f), Player.width, Player.height - 16, (int)CalamityDusts.Brimstone, 0f, 0f, 0, default, 1f);
Main.dust[brimDust].velocity *= 3f;
Main.dust[brimDust].scale *= 1.15f;
}
int num226 = 36;
for (int num227 = 0; num227 < num226; num227++)
int dustAmt = 36;
for (int j = 0; j < dustAmt; j++)
{
Vector2 vector6 = Vector2.Normalize(Player.velocity) * new Vector2((float)Player.width / 2f, (float)Player.height) * 0.75f;
vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * MathHelper.TwoPi / (float)num226), default) + Player.Center;
Vector2 vector7 = vector6 - Player.Center;
int num228 = Dust.NewDust(vector6 + vector7, 0, 0, (int)CalamityDusts.Brimstone, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default, 1.4f);
Main.dust[num228].noGravity = true;
Main.dust[num228].noLight = true;
Main.dust[num228].velocity = vector7;
Vector2 dustRotation = Vector2.Normalize(Player.velocity) * new Vector2((float)Player.width / 2f, (float)Player.height) * 0.75f;
dustRotation = dustRotation.RotatedBy((double)((float)(j - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + Player.Center;
Vector2 dustVelocity = dustRotation - Player.Center;
int brimDust2 = Dust.NewDust(dustRotation + dustVelocity, 0, 0, (int)CalamityDusts.Brimstone, dustVelocity.X * 1.5f, dustVelocity.Y * 1.5f, 100, default, 1.4f);
Main.dust[brimDust2].noGravity = true;
Main.dust[brimDust2].noLight = true;
Main.dust[brimDust2].velocity = dustVelocity;
}
}
}
@@ -2826,6 +2891,9 @@ namespace CalamityMod.CalPlayer
double offsetAngle;
int damage = (int)(Player.GetTotalDamage<RangedDamageClass>().ApplyTo(300f));
if (oldFashioned)
damage = CalamityUtils.CalcOldFashionedDamage(damage);
if (Player.whoAmI == Main.myPlayer)
{
var source = Player.GetSource_Misc("1");
@@ -2864,22 +2932,22 @@ namespace CalamityMod.CalPlayer
if (dsSetBonus)
{
SoundEngine.PlaySound(DemonshadeHelm.ActivationSound, Player.Center);
for (int num502 = 0; num502 < 36; num502++)
for (int i = 0; i < 36; i++)
{
int dust = Dust.NewDust(new Vector2(Player.position.X, Player.position.Y + 16f), Player.width, Player.height - 16, (int)CalamityDusts.Brimstone, 0f, 0f, 0, default, 1f);
Main.dust[dust].velocity *= 3f;
Main.dust[dust].scale *= 1.15f;
int brimDust = Dust.NewDust(new Vector2(Player.position.X, Player.position.Y + 16f), Player.width, Player.height - 16, (int)CalamityDusts.Brimstone, 0f, 0f, 0, default, 1f);
Main.dust[brimDust].velocity *= 3f;
Main.dust[brimDust].scale *= 1.15f;
}
int num226 = 36;
for (int num227 = 0; num227 < num226; num227++)
int dustAmt = 36;
for (int j = 0; j < dustAmt; j++)
{
Vector2 vector6 = Vector2.Normalize(Player.velocity) * new Vector2((float)Player.width / 2f, (float)Player.height) * 0.75f;
vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * MathHelper.TwoPi / (float)num226), default) + Player.Center;
Vector2 vector7 = vector6 - Player.Center;
int num228 = Dust.NewDust(vector6 + vector7, 0, 0, (int)CalamityDusts.Brimstone, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default, 1.4f);
Main.dust[num228].noGravity = true;
Main.dust[num228].noLight = true;
Main.dust[num228].velocity = vector7;
Vector2 dustRotation = Vector2.Normalize(Player.velocity) * new Vector2((float)Player.width / 2f, (float)Player.height) * 0.75f;
dustRotation = dustRotation.RotatedBy((double)((float)(j - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + Player.Center;
Vector2 dustVelocity = dustRotation - Player.Center;
int brimDust2 = Dust.NewDust(dustRotation + dustVelocity, 0, 0, (int)CalamityDusts.Brimstone, dustVelocity.X * 1.5f, dustVelocity.Y * 1.5f, 100, default, 1.4f);
Main.dust[brimDust2].noGravity = true;
Main.dust[brimDust2].noLight = true;
Main.dust[brimDust2].velocity = dustVelocity;
}
if (Player.whoAmI == Main.myPlayer)
{
@@ -2920,6 +2988,9 @@ namespace CalamityMod.CalPlayer
// To compute Forbidden Circlet tornado damage, create a fake stat modifier on the spot which combines both classes.
StatModifier forbidden = Player.GetTotalDamage<SummonDamageClass>().CombineWith(Player.GetDamage<RogueDamageClass>());
int damage = (int)forbidden.ApplyTo(ForbiddenCirclet.tornadoBaseDmg);
if (oldFashioned)
damage = CalamityUtils.CalcOldFashionedDamage(damage);
float kBack = Player.GetTotalKnockback<SummonDamageClass>().ApplyTo(ForbiddenCirclet.tornadoBaseKB);
if (Player.whoAmI == Main.myPlayer)
@@ -2961,7 +3032,6 @@ namespace CalamityMod.CalPlayer
SoundEngine.PlaySound(ProfanedGuardianDefender.RockShieldSpawnSound, Player.Center);
flameLickedShellParry = FlameLickedShell.flameLickedParry;
}
}
}
@@ -2993,7 +3063,7 @@ namespace CalamityMod.CalPlayer
if (CalamityKeybinds.RageHotKey.JustPressed)
{
// Gael's Greatsword replaces Rage Mode with an uber skull attack
if (gaelRageAttackCooldown == 0 && Player.ActiveItem().type == ModContent.ItemType<GaelsGreatsword>() && rage > 0f)
if (!(Player.HasCooldown(Cooldowns.GaelsRage.ID)) && Player.ActiveItem().type == ModContent.ItemType<GaelsGreatsword>() && rage > 0f)
{
SoundEngine.PlaySound(SilvaHeadSummon.DispelSound, Player.Center);
@@ -3032,7 +3102,7 @@ namespace CalamityMod.CalPlayer
// Remove all rage when the special attack is used, and apply the cooldown.
rage = 0f;
gaelRageAttackCooldown = CalamityUtils.SecondsToFrames(GaelsGreatsword.SkullsplosionCooldownSeconds);
Player.AddCooldown(Cooldowns.GaelsRage.ID, 1800);
}
// Activating Rage Mode
@@ -3133,9 +3203,9 @@ namespace CalamityMod.CalPlayer
public static Vector2? GetUnderworldPosition(Player player)
{
bool canSpawn = false;
int num = Main.maxTilesX / 2;
int num2 = 100;
int num3 = num2 / 2;
int halfWorldXTiles = Main.maxTilesX / 2;
int largerCheckRadius = 100;
int smallerCheckRadius = 50;
int teleportStartY = Main.UnderworldLayer + 20;
int teleportRangeY = 80;
Player.RandomTeleportationAttemptSettings settings = new Player.RandomTeleportationAttemptSettings
@@ -3149,12 +3219,12 @@ namespace CalamityMod.CalPlayer
maximumFallDistanceFromOrignalPoint = 30
};
Vector2 vector = player.CheckForGoodTeleportationSpot(ref canSpawn, num - num3, num2, teleportStartY, teleportRangeY, settings);
Vector2 vector = player.CheckForGoodTeleportationSpot(ref canSpawn, halfWorldXTiles - smallerCheckRadius, largerCheckRadius, teleportStartY, teleportRangeY, settings);
if (!canSpawn)
vector = player.CheckForGoodTeleportationSpot(ref canSpawn, num - num2, num3, teleportStartY, teleportRangeY, settings);
vector = player.CheckForGoodTeleportationSpot(ref canSpawn, halfWorldXTiles - largerCheckRadius, smallerCheckRadius, teleportStartY, teleportRangeY, settings);
if (!canSpawn)
vector = player.CheckForGoodTeleportationSpot(ref canSpawn, num + num3, num3, teleportStartY, teleportRangeY, settings);
vector = player.CheckForGoodTeleportationSpot(ref canSpawn, halfWorldXTiles + smallerCheckRadius, smallerCheckRadius, teleportStartY, teleportRangeY, settings);
if (canSpawn)
{
@@ -3349,7 +3419,11 @@ namespace CalamityMod.CalPlayer
{
var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType<GravistarSabaton>()));
//Spawn explosion. ai[0] is used for transferring the recorded falling time
Projectile.NewProjectile(source, Player.Center, Vector2.Zero, ModContent.ProjectileType<SabatonSlam>(), 300, 4f, Player.whoAmI, gSabatonFall);
int damage = 300;
if (oldFashioned)
damage = CalamityUtils.CalcOldFashionedDamage(damage);
Projectile.NewProjectile(source, Player.Center, Vector2.Zero, ModContent.ProjectileType<SabatonSlam>(), damage, 4f, Player.whoAmI, gSabatonFall);
gSabatonFall = 0;
gSabatonFalling = false;
//Temporary jump speed is granted for 40 frames
@@ -3449,12 +3523,12 @@ namespace CalamityMod.CalPlayer
if (Player.controlLeft)
{
Player.velocity.X = -speed;
Player.direction = -1;
Player.ChangeDir(-1);
}
else if (Player.controlRight)
{
Player.velocity.X = speed;
Player.direction = 1;
Player.ChangeDir(1);
}
else
Player.velocity.X = 0f;
@@ -3663,7 +3737,7 @@ namespace CalamityMod.CalPlayer
#region Get Heal Life
public override void GetHealLife(Item item, bool quickHeal, ref int healValue)
{
healValue = (int)(healValue * healingPotBonus);
healValue = (int)(healValue * healingPotionMultiplier);
}
#endregion
@@ -3892,46 +3966,50 @@ namespace CalamityMod.CalPlayer
{
if (!CalamityLists.VeneratedLocketBanlist.Contains(item.type))
{
float num72 = item.shootSpeed;
Vector2 vector2 = Player.RotatedRelativePoint(Player.MountedCenter, true);
float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X;
float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y;
float veneratedCloneSpeed = item.shootSpeed;
Vector2 realPlayerPos = Player.RotatedRelativePoint(Player.MountedCenter, true);
float veneratedCloneXPos = (float)Main.mouseX + Main.screenPosition.X - realPlayerPos.X;
float veneratedCloneYPos = (float)Main.mouseY + Main.screenPosition.Y - realPlayerPos.Y;
if (Player.gravDir == -1f)
{
num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y;
veneratedCloneYPos = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - realPlayerPos.Y;
}
float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79));
if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f))
float veneratedCloneDistance = (float)Math.Sqrt((double)(veneratedCloneXPos * veneratedCloneXPos + veneratedCloneYPos * veneratedCloneYPos));
if ((float.IsNaN(veneratedCloneXPos) && float.IsNaN(veneratedCloneYPos)) || (veneratedCloneXPos == 0f && veneratedCloneYPos == 0f))
{
num78 = (float)Player.direction;
num79 = 0f;
num80 = num72;
veneratedCloneXPos = (float)Player.direction;
veneratedCloneYPos = 0f;
veneratedCloneDistance = veneratedCloneSpeed;
}
else
{
num80 = num72 / num80;
veneratedCloneDistance = veneratedCloneSpeed / veneratedCloneDistance;
}
vector2 = new Vector2(Player.position.X + (float)Player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)Player.direction) + ((float)Main.mouseX + Main.screenPosition.X - Player.position.X), Player.MountedCenter.Y - 600f);
vector2.X = (vector2.X + Player.Center.X) / 2f + (float)Main.rand.Next(-200, 201);
vector2.Y -= 100f;
num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X;
num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y;
if (num79 < 0f)
realPlayerPos = new Vector2(Player.position.X + (float)Player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)Player.direction) + ((float)Main.mouseX + Main.screenPosition.X - Player.position.X), Player.MountedCenter.Y - 600f);
realPlayerPos.X = (realPlayerPos.X + Player.Center.X) / 2f + (float)Main.rand.Next(-200, 201);
realPlayerPos.Y -= 100f;
veneratedCloneXPos = (float)Main.mouseX + Main.screenPosition.X - realPlayerPos.X;
veneratedCloneYPos = (float)Main.mouseY + Main.screenPosition.Y - realPlayerPos.Y;
if (veneratedCloneYPos < 0f)
{
num79 *= -1f;
veneratedCloneYPos *= -1f;
}
if (num79 < 20f)
if (veneratedCloneYPos < 20f)
{
num79 = 20f;
veneratedCloneYPos = 20f;
}
num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79));
num80 = num72 / num80;
num78 *= num80;
num79 *= num80;
float speedX4 = num78 + (float)Main.rand.Next(-30, 31) * 0.02f;
float speedY5 = num79 + (float)Main.rand.Next(-30, 31) * 0.02f;
int p = Projectile.NewProjectile(source, vector2.X, vector2.Y, speedX4, speedY5, type, (int)(damage * 0.07), knockBack * 0.5f, Player.whoAmI);
veneratedCloneDistance = (float)Math.Sqrt((double)(veneratedCloneXPos * veneratedCloneXPos + veneratedCloneYPos * veneratedCloneYPos));
veneratedCloneDistance = veneratedCloneSpeed / veneratedCloneDistance;
veneratedCloneXPos *= veneratedCloneDistance;
veneratedCloneYPos *= veneratedCloneDistance;
float speedX4 = veneratedCloneXPos + (float)Main.rand.Next(-30, 31) * 0.02f;
float speedY5 = veneratedCloneYPos + (float)Main.rand.Next(-30, 31) * 0.02f;
int locketDamage = (int)(damage * 0.07f);
if (oldFashioned)
locketDamage = CalamityUtils.CalcOldFashionedDamage(locketDamage);
int p = Projectile.NewProjectile(source, realPlayerPos.X, realPlayerPos.Y, speedX4, speedY5, type, locketDamage, knockBack * 0.5f, Player.whoAmI);
if (p.WithinBounds(Main.maxProjectiles))
{
@@ -3950,6 +4028,9 @@ namespace CalamityMod.CalPlayer
{
int knifeCount = 12;
int knifeDamage = (int)Player.GetTotalDamage<RogueDamageClass>().ApplyTo(55);
if (oldFashioned)
knifeDamage = CalamityUtils.CalcOldFashionedDamage(knifeDamage);
float angleStep = MathHelper.TwoPi / knifeCount;
float speed = 14f;
@@ -3972,6 +4053,9 @@ namespace CalamityMod.CalPlayer
if (item.CountsAsClass<RangedDamageClass>())
{
int d = (int)Player.GetTotalDamage<RangedDamageClass>().ApplyTo(Items.Accessories.RustyMedallion.AcidDropBaseDamage);
if (oldFashioned)
d = CalamityUtils.CalcOldFashionedDamage(d);
Vector2 startingPosition = Main.MouseWorld - Vector2.UnitY.RotatedByRandom(0.4f) * 1250f;
Vector2 directionToMouse = (Main.MouseWorld - startingPosition).SafeNormalize(Vector2.UnitY).RotatedByRandom(0.1f);
int drop = Projectile.NewProjectile(source, startingPosition, directionToMouse * 15f, ModContent.ProjectileType<ToxicannonDrop>(), d, 0f, Player.whoAmI);
+1 -1
View File
@@ -160,7 +160,7 @@ namespace CalamityMod.CalPlayer
// Decide the player's facing direction.
if (Player.velocity.X != 0f)
Player.direction = Math.Sign(Player.velocity.X);
Player.ChangeDir(Math.Sign(Player.velocity.X));
// Handle mid-dash movement.
if (UsedDash.IsOmnidirectional)
+4 -3
View File
@@ -233,6 +233,9 @@ namespace CalamityMod.CalPlayer
if (calamityPlayer.dragonFire && drawInfo.shadow == 0f)
Dragonfire.DrawEffects(drawInfo);
if (calamityPlayer.elementalMix && drawInfo.shadow == 0f)
ElementalMix.DrawEffects(drawInfo);
if (calamityPlayer.eutrophication && drawInfo.shadow == 0f)
Eutrophication.DrawEffects(drawInfo);
@@ -472,10 +475,8 @@ namespace CalamityMod.CalPlayer
SpriteEffects spriteEffects = Player.direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
float num25 = -4f;
float num24 = -8f;
DrawData howDoIDrawThings = new DrawData(thingToDraw,
new Vector2((int)(drawPlayer.position.X - Main.screenPosition.X + (drawPlayer.width / 2) - (9 * drawPlayer.direction)) + num25 * drawPlayer.direction, (int)(drawPlayer.position.Y - Main.screenPosition.Y + (drawPlayer.height / 2) + 2f * drawPlayer.gravDir + num24 * drawPlayer.gravDir)),
new Vector2((int)(drawPlayer.position.X - Main.screenPosition.X + (drawPlayer.width / 2) - (9 * drawPlayer.direction)) - 4f * drawPlayer.direction, (int)(drawPlayer.position.Y - Main.screenPosition.Y + (drawPlayer.height / 2) + 2f * drawPlayer.gravDir - 8f * drawPlayer.gravDir)),
new Rectangle(0, 0, thingToDraw.Width, thingToDraw.Height),
drawInfo.colorArmorBody,
drawPlayer.bodyRotation,
+195 -95
View File
@@ -18,6 +18,7 @@ using CalamityMod.Items.Armor.LunicCorps;
using CalamityMod.Items.Armor.Silva;
using CalamityMod.Items.Armor.Wulfrum;
using CalamityMod.Items.Mounts;
using CalamityMod.Items.Potions.Alcohol;
using CalamityMod.Items.VanillaArmorChanges;
using CalamityMod.Items.Weapons.Melee;
using CalamityMod.NPCs;
@@ -119,8 +120,8 @@ namespace CalamityMod.CalPlayer
for (int j = 0; j < 100; j++)
{
int num = Dust.NewDust(Player.position, Player.width, Player.height, 235, 0f, 0f, 100, default, 2f);
Dust dust = Main.dust[num];
int scarfDodgeDust = Dust.NewDust(Player.position, Player.width, Player.height, 235, 0f, 0f, 100, default, 2f);
Dust dust = Main.dust[scarfDodgeDust];
dust.position.X += Main.rand.Next(-20, 21);
dust.position.Y += Main.rand.Next(-20, 21);
dust.velocity *= 0.4f;
@@ -153,6 +154,9 @@ namespace CalamityMod.CalPlayer
for (int i = 0; i < 10; i++)
{
int damage = (int)Player.GetTotalDamage<RogueDamageClass>().ApplyTo(55);
if (oldFashioned)
damage = CalamityUtils.CalcOldFashionedDamage(damage);
int lumenyl = Projectile.NewProjectile(source, Player.Center.X, Player.Center.Y, Main.rand.NextFloat(-2f, 2f), Main.rand.NextFloat(-2f, 2f), ModContent.ProjectileType<AbyssalMirrorProjectile>(), damage, 0, Player.whoAmI);
Main.projectile[lumenyl].rotation = Main.rand.NextFloat(0, 360);
Main.projectile[lumenyl].frame = Main.rand.Next(0, 4);
@@ -183,6 +187,9 @@ namespace CalamityMod.CalPlayer
var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType<EclipseMirror>()));
int damage = (int)Player.GetTotalDamage<RogueDamageClass>().ApplyTo(2750);
if (oldFashioned)
damage = CalamityUtils.CalcOldFashionedDamage(damage);
int eclipse = Projectile.NewProjectile(source, Player.Center, Vector2.Zero, ModContent.ProjectileType<EclipseMirrorBurst>(), damage, 0, Player.whoAmI);
if (eclipse.WithinBounds(Main.maxProjectiles))
Main.projectile[eclipse].DamageType = DamageClass.Generic;
@@ -233,8 +240,8 @@ namespace CalamityMod.CalPlayer
for (int j = 0; j < 50; j++)
{
int num = Dust.NewDust(Player.position, Player.width, Player.height, 173, 0f, 0f, 100, default, 2f);
Dust dust = Main.dust[num];
int nebulousReviveDust = Dust.NewDust(Player.position, Player.width, Player.height, 173, 0f, 0f, 100, default, 2f);
Dust dust = Main.dust[nebulousReviveDust];
dust.position.X += Main.rand.Next(-20, 21);
dust.position.Y += Main.rand.Next(-20, 21);
dust.velocity *= 0.9f;
@@ -245,6 +252,13 @@ namespace CalamityMod.CalPlayer
dust.scale *= 1f + Main.rand.Next(40) * 0.01f;
}
// Nebulous Core clears Chalice of the Blood God's bleedout buffer
if (chaliceOfTheBloodGod)
{
chaliceBleedoutBuffer = 0D;
chaliceDamagePointPartialProgress = 0D;
}
Player.statLife += 100;
Player.HealEffect(100);
@@ -286,6 +300,14 @@ namespace CalamityMod.CalPlayer
if (Player.statLife < 1)
Player.statLife = 1;
// Silva revive clears Chalice of the Blood God's bleedout buffer every frame while active
// Can we please remove this from the game
if (chaliceOfTheBloodGod)
{
chaliceBleedoutBuffer = 0D;
chaliceDamagePointPartialProgress = 0D;
}
return false;
}
@@ -391,6 +413,10 @@ namespace CalamityMod.CalPlayer
{
damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.BrainRot" + Main.rand.Next(1, 3 + 1)).Format(Player.name));
}
if (elementalMix)
{
damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.ElementalMix" + Main.rand.Next(1, 2 + 1)).Format(Player.name));
}
if (cDepth)
{
damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.CrushDepth" + Main.rand.Next(1, 3 + 1)).Format(Player.name));
@@ -776,7 +802,7 @@ namespace CalamityMod.CalPlayer
}
if (trinketOfChiBuff)
contactDamageReduction += 0.1;
contactDamageReduction += 0.04;
// Fearmonger set provides 15% multiplicative DR that ignores caps during the Holiday Moons.
// To prevent abuse, this effect does not work if there are any bosses alive.
@@ -1027,7 +1053,7 @@ namespace CalamityMod.CalPlayer
}
if (trinketOfChiBuff)
projectileDamageReduction += 0.1;
projectileDamageReduction += 0.04;
// Fearmonger set provides 15% multiplicative DR that ignores caps during the Holiday Moons.
// To prevent abuse, this effect does not work if there are any bosses alive.
@@ -1141,15 +1167,12 @@ namespace CalamityMod.CalPlayer
// If this NPC deals defense damage with contact damage, then mark the player to take defense damage.
// Defense damage is not applied if the player has iframes, or is in Journey god mode.
if (!hasIFrames && !Player.creativeGodMode)
{
justHitByDefenseDamage |= npc.Calamity().canBreakPlayerDefense;
defenseDamageToTake = npc.Calamity().canBreakPlayerDefense ? hurtInfo.Damage : 0;
}
nextHitDealsDefenseDamage |= npc.Calamity().canBreakPlayerDefense;
// ModifyHit (Flesh Totem effect happens here) -> Hurt (includes dodges) -> OnHit
// As such, to avoid cooldowns proccing from dodge hits, do it here
if (fleshTotem && !Player.HasCooldown(Cooldowns.FleshTotem.ID) && hurtInfo.Damage > 0)
Player.AddCooldown(Cooldowns.FleshTotem.ID, CalamityUtils.SecondsToFrames(20), true, coreOfTheBloodGod ? "bloodgod" : "default");
Player.AddCooldown(Cooldowns.FleshTotem.ID, CalamityUtils.SecondsToFrames(20), true, "default");
if (NPC.AnyNPCs(ModContent.NPCType<THELORDE>()))
Player.AddBuff(ModContent.BuffType<NOU>(), 15, true);
@@ -1211,10 +1234,7 @@ namespace CalamityMod.CalPlayer
// If this projectile is capable of dealing defense damage, then mark the player to take defense damage.
// Defense damage is not applied if the player has iframes, or is in Journey god mode.
if (!hasIFrames && !Player.creativeGodMode)
{
justHitByDefenseDamage = proj.Calamity().DealsDefenseDamage;
defenseDamageToTake = proj.Calamity().DealsDefenseDamage ? hurtInfo.Damage : 0;
}
nextHitDealsDefenseDamage |= proj.Calamity().DealsDefenseDamage;
if (sulfurSet && !proj.friendly && hurtInfo.Damage > 0)
{
@@ -1429,7 +1449,11 @@ namespace CalamityMod.CalPlayer
Rectangle npcHitbox = n.getRect();
if ((Player.getRect()).Intersects(npcHitbox) && (n.noTileCollide || Collision.CanHit(Player.position, Player.width, Player.height, n.position, n.width, n.height)))
{
Projectile.NewProjectile(Player.GetSource_FromThis(), n.Center, Vector2.Zero, ModContent.ProjectileType<DirectStrike>(), 150, 0, Main.myPlayer);
int damage = 150;
if (oldFashioned)
damage = CalamityUtils.CalcOldFashionedDamage(damage);
Projectile.NewProjectile(Player.GetSource_FromThis(), n.Center, Vector2.Zero, ModContent.ProjectileType<DirectStrike>(), damage, 0, Main.myPlayer);
n.Calamity().dashImmunityTime[Player.whoAmI] = 4;
Player.GiveIFrames(5, false);
@@ -1587,14 +1611,6 @@ namespace CalamityMod.CalPlayer
if (Player.beetleDefense && Player.beetleOrbs > 0)
damageMult += 0.05 * Player.beetleOrbs;
// Blood Pact gives you a 1/4 chance to be crit, increasing the incoming damage by 25%.
if (bloodPact && Main.rand.NextBool(4))
{
Player.AddBuff(ModContent.BuffType<BloodyBoost>(), 600);
SoundEngine.PlaySound(BloodCritSound, Player.Center);
damageMult += 1.25;
}
modifiers.SourceDamage *= (float)damageMult;
#endregion
@@ -1890,10 +1906,27 @@ namespace CalamityMod.CalPlayer
freeDodgeFromShieldAbsorption = true;
// Cancel defense damage, if it was going to occur this frame.
justHitByDefenseDamage = false;
defenseDamageToTake = 0;
nextHitDealsDefenseDamage = false;
}
}
// Chalice of the Blood God is implemented as a dirty modifier.
//
// Chalice of the Blood God does nothing to a hit that was just fully blocked by shields.
// Otherwise, it reduces the damage of any hit to 5, which allows for full iframes.
// It then applies the full hit (minus that 5 damage) to its own bleedout buffer.
// Hits for less than 5 damage are ignored entirely and allowed to strike the player as normal.
if (chaliceOfTheBloodGod && !freeDodgeFromShieldAbsorption && info.Damage > ChaliceOfTheBloodGod.MinAllowedDamage)
{
int bleedoutToApply = info.Damage - ChaliceOfTheBloodGod.MinAllowedDamage;
chaliceBleedoutBuffer += bleedoutToApply;
info.Damage = ChaliceOfTheBloodGod.MinAllowedDamage;
// Display text indicating that damage was transferred to bleedout.
string text = $"({-bleedoutToApply})";
Rectangle location = new Rectangle((int)Player.position.X + 4, (int)Player.position.Y - 3, Player.width - 4, Player.height - 4);
CombatText.NewText(location, ChaliceOfTheBloodGod.BleedoutBufferDamageTextColor, Language.GetTextValue(text), dot: true);
}
}
#endregion
@@ -1912,13 +1945,46 @@ namespace CalamityMod.CalPlayer
hasIFrames = true;
// If the player was just hit by something capable of dealing defense damage, then apply defense damage.
// Bloodflare Core makes every hit deal defense damage (to enable its function).
// Defense damage is not applied if the player has iframes.
if (justHitByDefenseDamage && !hasIFrames && !Player.creativeGodMode)
bool hitCanApplyDefenseDamage = nextHitDealsDefenseDamage || bloodflareCore;
if (hitCanApplyDefenseDamage && !hasIFrames && !Player.creativeGodMode)
{
DealDefenseDamage(defenseDamageToTake, hurtInfo.Damage);
double halfDefense = Player.statDefense / 2.0;
int netMitigation = hurtInfo.SourceDamage - hurtInfo.Damage;
double standardDefenseDamage = netMitigation * defenseDamageRatio;
// If Bloodflare Core is equipped and standard defense damage would be less than half the player's total defense,
// then instead forcibly deal half of the player's total defense as defense damage.
if (bloodflareCore && standardDefenseDamage < halfDefense)
{
DealDefenseDamage(hurtInfo, (int)halfDefense, true);
// Set up Bloodflare Core's heal over time. Any in-progress heals are overwritten if they would have a shorter duration.
if (bloodflareCoreRemainingHealOverTime < halfDefense)
bloodflareCoreRemainingHealOverTime = (int)halfDefense;
// Play a sound and make dust to signify that defense has been shattered
SoundEngine.PlaySound(SoundID.DD2_MonkStaffGroundImpact, Player.Center);
for (int i = 0; i < 36; ++i)
{
float speed = Main.rand.NextFloat(1.8f, 8f);
Vector2 dustVel = new Vector2(speed, speed);
Dust d = Dust.NewDustDirect(Player.position, Player.width, Player.height, 90);
d.velocity = dustVel;
d.noGravity = true;
d.scale *= Main.rand.NextFloat(1.1f, 1.4f);
Dust.CloneDust(d).velocity = dustVel.RotatedBy(MathHelper.PiOver2);
Dust.CloneDust(d).velocity = dustVel.RotatedBy(MathHelper.Pi);
Dust.CloneDust(d).velocity = dustVel.RotatedBy(MathHelper.Pi * 1.5f);
}
}
else
DealDefenseDamage(hurtInfo);
}
justHitByDefenseDamage = false;
defenseDamageToTake = 0;
nextHitDealsDefenseDamage = false;
#endregion
#region Shattered Community Rage Gain
@@ -2291,39 +2357,6 @@ namespace CalamityMod.CalPlayer
if (silverMedkit && hurtInfo.Damage >= SilverArmorSetChange.SetBonusMinimumDamageToHeal)
silverMedkitTimer = SilverArmorSetChange.SetBonusHealTime;
// Bloodflare Core defense shattering
if (bloodflareCore)
{
// Shattered defense has a hard cap equal to half of total defense.
// It also has a soft cap determined by a formula so it isn't too powerful at excessively high defense.
int shatterDefenseCap = (int)(1.5D * Math.Pow(Player.statDefense, 0.91D) - 0.5D * Player.statDefense);
if (shatterDefenseCap > Player.statDefense / 2)
shatterDefenseCap = Player.statDefense / 2;
// Every hit adds its damage as shattered defense.
int newLostDefense = Math.Min(bloodflareCoreLostDefense + (int)hurtInfo.Damage, shatterDefenseCap);
// Suddenly reducing your base defense stat does not let you suddenly reduce your shattered defense cap.
// In other words, you can't ever reduce your lost defense by taking another hit.
if (bloodflareCoreLostDefense < newLostDefense)
bloodflareCoreLostDefense = newLostDefense;
// Play a sound and make dust to signify that defense has been shattered
SoundEngine.PlaySound(SoundID.DD2_MonkStaffGroundImpact, Player.Center);
for (int i = 0; i < 36; ++i)
{
float speed = Main.rand.NextFloat(1.8f, 8f);
Vector2 dustVel = new Vector2(speed, speed);
Dust d = Dust.NewDustDirect(Player.position, Player.width, Player.height, 90);
d.velocity = dustVel;
d.noGravity = true;
d.scale *= Main.rand.NextFloat(1.1f, 1.4f);
Dust.CloneDust(d).velocity = dustVel.RotatedBy(MathHelper.PiOver2);
Dust.CloneDust(d).velocity = dustVel.RotatedBy(MathHelper.Pi);
Dust.CloneDust(d).velocity = dustVel.RotatedBy(MathHelper.Pi * 1.5f);
}
}
// Handle hit effects from the gem tech armor set.
Player.Calamity().GemTechState.PlayerOnHitEffects((int)hurtInfo.Damage);
@@ -2365,7 +2398,10 @@ namespace CalamityMod.CalPlayer
var source = Player.GetSource_OnHurt(hurtInfo.DamageSource, AerospecBreastplate.FeatherEntitySourceContext);
for (int n = 0; n < 4; n++)
{
int featherDamage = (int)Player.GetBestClassDamage().ApplyTo(20);
int featherDamage = (int)Player.GetBestClassDamage().ApplyTo(80);
if (oldFashioned)
featherDamage = CalamityUtils.CalcOldFashionedDamage(featherDamage);
CalamityUtils.ProjectileRain(source, Player.Center, 400f, 100f, 500f, 800f, 20f, ModContent.ProjectileType<StickyFeatherAero>(), featherDamage, 1f, Player.whoAmI);
}
}
@@ -2375,6 +2411,12 @@ namespace CalamityMod.CalPlayer
SoundEngine.PlaySound(SoundID.Item74, Player.Center);
int blazeDamage = (int)Player.GetBestClassDamage().ApplyTo(25);
int astralStarDamage = (int)Player.GetBestClassDamage().ApplyTo(320);
if (oldFashioned)
{
blazeDamage = CalamityUtils.CalcOldFashionedDamage(blazeDamage);
astralStarDamage = CalamityUtils.CalcOldFashionedDamage(astralStarDamage);
}
Projectile.NewProjectile(source, Player.Center.X, Player.Center.Y, 0f, 0f, ModContent.ProjectileType<GodSlayerBlaze>(), blazeDamage, 5f, Player.whoAmI, 0f, 1f);
for (int n = 0; n < 12; n++)
{
@@ -2387,6 +2429,9 @@ namespace CalamityMod.CalPlayer
for (int n = 0; n < 3; n++)
{
int deificStarDamage = (int)Player.GetBestClassDamage().ApplyTo(130);
if (oldFashioned)
deificStarDamage = CalamityUtils.CalcOldFashionedDamage(deificStarDamage);
Projectile star = CalamityUtils.ProjectileRain(source, Player.Center, 400f, 100f, 500f, 800f, 29f, ProjectileID.StarVeilStar, deificStarDamage, 4f, Player.whoAmI);
if (star.whoAmI.WithinBounds(Main.maxProjectiles))
{
@@ -2412,6 +2457,9 @@ namespace CalamityMod.CalPlayer
if (transformer)
sDamage += 42;
sDamage = (int)Player.GetBestClassDamage().ApplyTo(sDamage);
if (oldFashioned)
sDamage = CalamityUtils.CalcOldFashionedDamage(sDamage);
if (Player.whoAmI == Main.myPlayer)
{
for (int i = 0; i < 4; i++)
@@ -2455,7 +2503,10 @@ namespace CalamityMod.CalPlayer
if (hurtInfo.Damage > 0)
{
SoundEngine.PlaySound(SoundID.Item74, Player.Center);
int eDamage = (int)Player.GetBestClassDamage().ApplyTo(100);
int eDamage = (int)Player.GetBestClassDamage().ApplyTo(300);
if (oldFashioned)
eDamage = CalamityUtils.CalcOldFashionedDamage(eDamage);
if (Player.whoAmI == Main.myPlayer)
Projectile.NewProjectile(fuckYouBitch, Player.Center, Vector2.Zero, ModContent.ProjectileType<DeepseaBlaze>(), eDamage, 1f, Player.whoAmI, 0f, 0f);
}
@@ -2470,7 +2521,10 @@ namespace CalamityMod.CalPlayer
double startAngle = Math.Atan2(Player.velocity.X, Player.velocity.Y) - spread / 2;
double deltaAngle = spread / 8f;
double offsetAngle;
int sDamage = (int)Player.GetTotalDamage<RangedDamageClass>().ApplyTo(27);
int sDamage = (int)Player.GetTotalDamage<RangedDamageClass>().ApplyTo(90);
if (oldFashioned)
sDamage = CalamityUtils.CalcOldFashionedDamage(sDamage);
if (Player.whoAmI == Main.myPlayer)
{
for (int i = 0; i < 8; i++)
@@ -2493,7 +2547,10 @@ namespace CalamityMod.CalPlayer
var source = Player.GetSource_Misc("23");
if (hurtInfo.Damage > 0)
{
int rDamage = (int)Player.GetBestClassDamage().ApplyTo(80);
int rDamage = (int)Player.GetBestClassDamage().ApplyTo(240);
if (oldFashioned)
rDamage = CalamityUtils.CalcOldFashionedDamage(rDamage);
if (Player.whoAmI == Main.myPlayer)
Projectile.NewProjectile(source, Player.Center.X, Player.position.Y + 36f, 0f, -18f, ModContent.ProjectileType<ReaverThornBase>(), rDamage, 0f, Player.whoAmI, 0f, 0f);
}
@@ -2509,6 +2566,9 @@ namespace CalamityMod.CalPlayer
double deltaAngle = spread / 8f;
double offsetAngle;
int baseDamage = 675;
if (oldFashioned)
baseDamage = CalamityUtils.CalcOldFashionedDamage(baseDamage);
int shrapnelFinalDamage = (int)Player.GetTotalDamage<MeleeDamageClass>().ApplyTo(baseDamage);
if (Player.whoAmI == Main.myPlayer)
{
@@ -2530,6 +2590,9 @@ namespace CalamityMod.CalPlayer
for (int l = 0; l < 2; l++)
{
int shadowbeamDamage = (int)Player.GetBestClassDamage().ApplyTo(3000);
if (oldFashioned)
shadowbeamDamage = CalamityUtils.CalcOldFashionedDamage(shadowbeamDamage);
Projectile beam = CalamityUtils.ProjectileRain(source, Player.Center, 400f, 100f, 500f, 800f, 22f, ProjectileID.ShadowBeamFriendly, shadowbeamDamage, 7f, Player.whoAmI);
if (beam.whoAmI.WithinBounds(Main.maxProjectiles))
{
@@ -2541,6 +2604,9 @@ namespace CalamityMod.CalPlayer
for (int l = 0; l < 5; l++)
{
int scytheDamage = (int)Player.GetBestClassDamage().ApplyTo(5000);
if (oldFashioned)
scytheDamage = CalamityUtils.CalcOldFashionedDamage(scytheDamage);
Projectile scythe = CalamityUtils.ProjectileRain(source, Player.Center, 400f, 100f, 500f, 800f, 22f, ProjectileID.DemonScythe, scytheDamage, 7f, Player.whoAmI);
if (scythe.whoAmI.WithinBounds(Main.maxProjectiles))
{
@@ -2581,18 +2647,18 @@ namespace CalamityMod.CalPlayer
{
if (Player.inventory[i].stack > 0 && ((Player.inventory[i].type >= ItemID.LargeAmethyst && Player.inventory[i].type <= ItemID.LargeDiamond) || Player.inventory[i].type == ItemID.LargeAmber))
{
int num = Item.NewItem(source, (int)Player.position.X, (int)Player.position.Y, Player.width, Player.height, Player.inventory[i].type, 1, false, 0, false, false);
Main.item[num].netDefaults(Player.inventory[i].netID);
Main.item[num].Prefix((int)Player.inventory[i].prefix);
Main.item[num].stack = Player.inventory[i].stack;
Main.item[num].velocity.Y = (float)Main.rand.Next(-20, 1) * 0.2f;
Main.item[num].velocity.X = (float)Main.rand.Next(-20, 21) * 0.2f;
Main.item[num].noGrabDelay = 100;
Main.item[num].favorited = false;
Main.item[num].newAndShiny = false;
int droppedLargeGem = Item.NewItem(source, (int)Player.position.X, (int)Player.position.Y, Player.width, Player.height, Player.inventory[i].type, 1, false, 0, false, false);
Main.item[droppedLargeGem].netDefaults(Player.inventory[i].netID);
Main.item[droppedLargeGem].Prefix((int)Player.inventory[i].prefix);
Main.item[droppedLargeGem].stack = Player.inventory[i].stack;
Main.item[droppedLargeGem].velocity.Y = (float)Main.rand.Next(-20, 1) * 0.2f;
Main.item[droppedLargeGem].velocity.X = (float)Main.rand.Next(-20, 21) * 0.2f;
Main.item[droppedLargeGem].noGrabDelay = 100;
Main.item[droppedLargeGem].favorited = false;
Main.item[droppedLargeGem].newAndShiny = false;
if (Main.netMode == NetmodeID.MultiplayerClient)
{
NetMessage.SendData(MessageID.SyncItem, -1, -1, null, num, 0f, 0f, 0f, 0, 0, 0);
NetMessage.SendData(MessageID.SyncItem, -1, -1, null, droppedLargeGem, 0f, 0f, 0f, 0, 0, 0);
}
Player.inventory[i].SetDefaults(0, false);
}
@@ -2682,37 +2748,70 @@ namespace CalamityMod.CalPlayer
#endregion
#region Defense Damage Function
private void DealDefenseDamage(int damage, double realDamage)
/// <summary>
/// Deals Calamity defense damage to a player.
/// </summary>
/// <param name="hurtInfo">HurtInfo of the incoming strike to the player.</param>
/// <param name="customIncomingDamage">If set to zero or a positive number, ignores the HurtInfo and uses this value as the incoming damage.</param>
/// <param name="absolute">If true, deals exactly the custom amount defense damage, ignoring the standard ratios and Draedon's Heart.<br />
/// This also bypasses the
/// This does nothing unless customIncomingDefenseDamage is specified.</param>
public void DealDefenseDamage(Player.HurtInfo hurtInfo, int customIncomingDamage = -1, bool absolute = false)
{
if (realDamage <= 0)
// Legacy safeguard: Skip defense damage if the player is somehow "hit for zero" (this should never happen).
if (hurtInfo.Damage <= 0 || hurtInfo.SourceDamage <= 0)
return;
double ratioToUse = DefenseDamageRatio;
if (draedonsHeart)
ratioToUse *= DraedonsHeart.DefenseDamageMultiplier;
double ratioToUse = defenseDamageRatio;
// Calculate the defense damage taken from this hit.
int defenseDamageTaken = (int)(damage * ratioToUse);
// If custom incoming defense damage is specified, then ignore the incoming hurt info and use the custom value.
int incomingDamageToUse;
if (customIncomingDamage >= 0)
{
incomingDamageToUse = customIncomingDamage;
// If absolute is specified, then ignore the ratio and always inflict EXACTLY THAT MUCH defense damage. This means it bypasses Draedon's Heart!
if (absolute)
ratioToUse = 1D;
}
// Standard hits. Defense damage scales with "net mitigation", aka how much damage the player DIDN'T take.
// Thematically, this means it scales with how much damage the player's defense took instead of them.
else
{
int netMitigation = hurtInfo.SourceDamage - hurtInfo.Damage;
// If the player somehow took amplified damage (their mitigation was negative) then they take no base defense damage.
// The defense damage floor will still apply to them.
incomingDamageToUse = netMitigation <= 0 ? 0 : netMitigation;
}
int defenseDamageTaken = (int)Math.Round(incomingDamageToUse * ratioToUse);
// There is a floor on defense damage based on difficulty; i.e. there is a minimum amount of defense damage from any hit that can deal defense damage.
// This floor is only applied if bosses are alive
if (areThereAnyDamnBosses)
// This floor is only applied if bosses are alive, but is bypassed by the absolute flag.
// Details on the floor can be seen in the BalancingConstants file.
bool useDefenseDamageFloor = areThereAnyDamnBosses && !absolute;
if (useDefenseDamageFloor)
{
int defenseDamageFloor = (BossRushEvent.BossRushActive ? 5 : CalamityWorld.death ? 4 : CalamityWorld.revenge ? 3 : Main.expertMode ? 2 : 1) * (NPC.downedMoonlord ? 3 : Main.hardMode ? 2 : 1);
int defenseDamageFloor = CalamityUtils.GetDefenseDamageFloor();
// Apply floor
if (defenseDamageTaken < defenseDamageFloor)
defenseDamageTaken = defenseDamageFloor;
}
// There is also a cap on defense damage: 25% of the player's original defense.
int cap = Player.statDefense / 4;
if (defenseDamageTaken > cap)
defenseDamageTaken = cap;
// Apply defense damage to the adamantite armor set boost.
//
// The amount of defense damage taken is now final.
//
// Apply incoming defense damage to the Adamantite armor set bonus.
if (AdamantiteSetDefenseBoost > 0)
{
int defenseDamageToAdamantite = Math.Min(AdamantiteSetDefenseBoost, defenseDamageTaken);
AdamantiteSetDefenseBoost -= defenseDamageToAdamantite;
// Reduce remaining defense damage by whatever was applied to Adamantite armor.
defenseDamageTaken -= defenseDamageToAdamantite;
// If Adamantite Armor's set bonus entirely absorbed the defense damage, then display the number and play the sound,
@@ -2724,7 +2823,7 @@ namespace CalamityMod.CalPlayer
}
}
// Apply that defense damage on top of whatever defense damage the player currently has.
// Apply incoming defense damage on top of whatever defense damage the player currently has.
int previousDefenseDamage = CurrentDefenseDamage;
totalDefenseDamage = previousDefenseDamage + defenseDamageTaken;
@@ -2732,15 +2831,16 @@ namespace CalamityMod.CalPlayer
if (defenseDamageRecoveryFrames < 0)
defenseDamageRecoveryFrames = 0;
// DIRECTLY ADD the base defense damage recovery time to whatever recovery time the player already has.
// Directly add the base defense damage recovery time to whatever recovery time the player already has.
totalDefenseDamageRecoveryFrames = defenseDamageRecoveryFrames + DefenseDamageBaseRecoveryTime;
if (totalDefenseDamageRecoveryFrames > DefenseDamageMaxRecoveryTime)
totalDefenseDamageRecoveryFrames = DefenseDamageMaxRecoveryTime;
// Reset any recovery progress they may have already made.
// They start the new recovery timer from the beginning.
defenseDamageRecoveryFrames = totalDefenseDamageRecoveryFrames;
// Reset the delay between iframes and being able to recover from defense damage.
// Reset the delay between iframes ending and defense damage recovery starting.
defenseDamageDelayFrames = DefenseDamageRecoveryDelay;
// Audiovisual effects
+9 -5
View File
@@ -11,7 +11,6 @@ using CalamityMod.World;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.DataStructures;
using Terraria.GameContent.ItemDropRules;
using Terraria.ID;
using Terraria.ModLoader;
@@ -99,6 +98,7 @@ namespace CalamityMod.CalPlayer
ApplyDoTDebuff(weakBrimstoneFlames, 7);
ApplyDoTDebuff(bBlood, 8, purity);
ApplyDoTDebuff(brainRot, 8, purity);
ApplyDoTDebuff(elementalMix, 50, purity);
ApplyDoTDebuff(vaporfied, 8, purity);
ApplyDoTDebuff(bFlames, abaddon ? 10 : 30, purity);
ApplyDoTDebuff(nightwither, reducedNightwitherDamage ? 20 : 40, purity);
@@ -228,6 +228,10 @@ namespace CalamityMod.CalPlayer
{
alcoholPoisonLevel++;
}
if (oldFashioned)
{
alcoholPoisonLevel++;
}
if (margarita)
{
alcoholPoisonLevel++;
@@ -586,6 +590,10 @@ namespace CalamityMod.CalPlayer
Player.mount.Dismount(Player);
}
#endregion
// Chalice of the Blood God bleedout
// The bleedout is applied by directly reducing the player's health. It is not canceled by anything.
ChaliceOfTheBloodGod.HandleBleedout(Player);
}
#endregion
@@ -714,10 +722,6 @@ namespace CalamityMod.CalPlayer
{
Player.lifeRegen += 2;
}
if (bloodPactBoost)
{
Player.lifeRegen += 2;
}
if (avertorBonus)
{
Player.lifeRegen += 4;
+196 -130
View File
@@ -44,7 +44,6 @@ using CalamityMod.NPCs.Other;
using CalamityMod.NPCs.PlagueEnemies;
using CalamityMod.NPCs.TownNPCs;
using CalamityMod.Particles;
using CalamityMod.Projectiles.Healing;
using CalamityMod.Projectiles.Magic;
using CalamityMod.Projectiles.Melee;
using CalamityMod.Projectiles.Rogue;
@@ -126,7 +125,7 @@ namespace CalamityMod.CalPlayer
// Update energy shields
EnergyShields();
// Defense manipulation (Mostly defense damage, but also Bloodflare Core and others)
// Defense manipulation (Mostly defense damage, but also other defense changes)
DefenseEffects();
// Limits
@@ -188,6 +187,9 @@ namespace CalamityMod.CalPlayer
if (Player.ActiveItem().type == ModContent.ItemType<GaelsGreatsword>())
heldGaelsLastFrame = true;
if (Player.ActiveItem().type != ModContent.ItemType<SaharaSlicers>())
saharaSlicersBolts = 0;
// De-equipping Gael's Greatsword deletes all rage.
else if (heldGaelsLastFrame)
{
@@ -227,13 +229,19 @@ namespace CalamityMod.CalPlayer
if (lAmbergris)
{
if (Player.miscCounter % 3 == 2 && Player.dashDelay > 0) // Reduced dash cooldown by 33%
Player.dashDelay--;
if (Player.dashDelay == -1)// TODO: prevent working with special dashes, this was inconsitent with my old solution so I didn't keep it. not huge deal)
{
Player.endurance += 0.05f;
if (!HasIncreasedDashFirstFrame)
{
Player.velocity.X *= 1.15f;
Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center + Player.velocity * 1.5f, Vector2.Zero, ModContent.ProjectileType<LeviAmberDash>(), 75, 20f, Player.whoAmI);
Player.velocity.X *= 1.2f;
int damage = 75;
if (oldFashioned)
damage = CalamityUtils.CalcOldFashionedDamage(damage);
Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center + Player.velocity * 1.5f, Vector2.Zero, ModContent.ProjectileType<LeviAmberDash>(), damage, 20f, Player.whoAmI);
HasIncreasedDashFirstFrame = true;
}
float numberOfDusts = 10f;
@@ -253,14 +261,20 @@ namespace CalamityMod.CalPlayer
{
float sparkscale = (Player.velocity.X * Player.direction * 0.07f);
Vector2 SparkVelocity1 = Player.velocity.RotatedBy(Player.direction * 2, default) * 0.1f - Player.velocity / 2f;
SparkParticle spark = new SparkParticle(Player.Center + Player.velocity.RotatedBy(2f * Player.direction) * 1.5f, SparkVelocity1, false, Main.rand.Next(11, 13), sparkscale, Main.rand.NextBool() ? Color.DarkTurquoise : Color.DodgerBlue);
LineParticle spark = new LineParticle(Player.Center + Player.velocity.RotatedBy(2f * Player.direction) * 1.5f, SparkVelocity1, false, Main.rand.Next(11, 13), sparkscale, Main.rand.NextBool() ? Color.DarkTurquoise : Color.DodgerBlue);
GeneralParticleHandler.SpawnParticle(spark);
Vector2 SparkVelocity2 = Player.velocity.RotatedBy(Player.direction * -2, default) * 0.1f - Player.velocity / 2f;
SparkParticle spark2 = new SparkParticle(Player.Center + Player.velocity.RotatedBy(-2f * Player.direction) * 1.5f, SparkVelocity2, false, Main.rand.Next(11, 13), sparkscale, Main.rand.NextBool() ? Color.DarkTurquoise : Color.DodgerBlue);
LineParticle spark2 = new LineParticle(Player.Center + Player.velocity.RotatedBy(-2f * Player.direction) * 1.5f, SparkVelocity2, false, Main.rand.Next(11, 13), sparkscale, Main.rand.NextBool() ? Color.DarkTurquoise : Color.DodgerBlue);
GeneralParticleHandler.SpawnParticle(spark2);
}
if (Player.miscCounter % 4 == 0 && Player.velocity != Vector2.Zero) //every other frame spawn the hitbox
Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center + Player.velocity * 1.5f, Vector2.Zero, ModContent.ProjectileType<LeviAmberDash>(), 90, 0f, Player.whoAmI);
{
int damage = 90;
if (oldFashioned)
damage = CalamityUtils.CalcOldFashionedDamage(damage);
Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center + Player.velocity * 1.5f, Vector2.Zero, ModContent.ProjectileType<LeviAmberDash>(), damage, 0f, Player.whoAmI);
}
}
else
HasIncreasedDashFirstFrame = false;
@@ -270,11 +284,15 @@ namespace CalamityMod.CalPlayer
{
if (Player.dashDelay == -1)// TODO: prevent working with special dashes, this was inconsitent with my old solution so I didn't keep it. not huge deal)
{
Player.endurance += 0.05f;
Player.endurance += 0.1f;
if (!HasReducedDashFirstFrame) // Dash isn't reduced, this is used to determine the first frame of dashing
{
SoundEngine.PlaySound(SoundID.DD2_BetsyFireballImpact with { Volume = 0.4f , PitchVariance = 0.4f }, Player.Center);
Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center + Player.velocity * 1.5f, Vector2.Zero, ModContent.ProjectileType<PauldronDash>(), 67, 16f, Player.whoAmI);
int damage = 67;
if (oldFashioned)
damage = CalamityUtils.CalcOldFashionedDamage(damage);
Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center + Player.velocity * 1.5f, Vector2.Zero, ModContent.ProjectileType<PauldronDash>(), damage, 16f, Player.whoAmI);
HasReducedDashFirstFrame = true;
}
float numberOfDusts = 10f;
@@ -299,7 +317,13 @@ namespace CalamityMod.CalPlayer
GeneralParticleHandler.SpawnParticle(spark2);
if (Player.miscCounter % 5 == 0 && Player.velocity != Vector2.Zero) //every other frame spawn the hitbox
Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center + Player.velocity * 1.5f, Vector2.Zero, ModContent.ProjectileType<PauldronDash>(), 175, 10f, Player.whoAmI);
{
int damage = 175;
if (oldFashioned)
damage = CalamityUtils.CalcOldFashionedDamage(damage);
Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center + Player.velocity * 1.5f, Vector2.Zero, ModContent.ProjectileType<PauldronDash>(), damage, 10f, Player.whoAmI);
}
}
else
HasReducedDashFirstFrame = false;
@@ -319,6 +343,28 @@ namespace CalamityMod.CalPlayer
else
HasReducedDashFirstFrame = false;
}
if (oceanCrest)
{
bool surface = Player.Center.Y < Main.worldSurface * 16.0;
bool GetEffects = ((Main.raining && surface) || Player.dripping || (Player.wet && !Player.lavaWet && !Player.honeyWet));
if (GetEffects)
{
if (oceanCrestTimer < 300)
oceanCrestTimer += 5;
if (Player.StandingStill(0.1f) && !ZoneAbyss && Player.breath < 201 && Player.miscCounter % 2 == 0)
Player.breath += 1;
}
else
if (oceanCrestTimer > 0)
oceanCrestTimer--;
if (oceanCrestTimer > 0 || GetEffects)
Player.pickSpeed -= 0.15f; // 15% mining speed
Vector3 Light = new Vector3(0.090f, 0.180f, 0.200f);
Lighting.AddLight(Player.Center, Light * (0.55f + (oceanCrestTimer * 0.0035f)));
}
}
#endregion
@@ -895,8 +941,8 @@ namespace CalamityMod.CalPlayer
providenceBurnIntensity = (Main.npc[CalamityGlobalNPC.holyBoss].ModNPC as ProvidenceBoss).CalculateBurnIntensity();
ProvidenceBurnEffectDrawer.ParticleSpawnRate = int.MaxValue;
// If the burn intensity is great enough, cause the player to ignite into flames.
if (providenceBurnIntensity > 0.45f)
// If the player has holy inferno, cause the player to ignite into flames.
if (hInferno)
ProvidenceBurnEffectDrawer.ParticleSpawnRate = 1;
// Otherwise, if the intensity is too weak, but still present, cause the player to release holy cinders.
@@ -907,17 +953,24 @@ namespace CalamityMod.CalPlayer
{
if (!Main.rand.NextBool(3))
continue;
Dust holyCinder = Dust.NewDustDirect(Player.position, Player.width, Player.head, (int)CalamityDusts.ProfanedFire);
Dust holyCinder = Dust.NewDustDirect(Player.position, Player.width, Player.height, (int)CalamityDusts.ProfanedFire);
holyCinder.velocity = Main.rand.NextVector2Circular(3.5f, 3.5f);
holyCinder.velocity.Y -= Main.rand.NextFloat(1f, 3f);
holyCinder.scale = Main.rand.NextFloat(1.15f, 1.45f);
holyCinder.noGravity = true;
}
}
ProvidenceBurnEffectDrawer.Update();
if (hInferno && holyInfernoFadeIntensity < 1f)
{
holyInfernoFadeIntensity = MathHelper.Clamp(holyInfernoFadeIntensity + 0.015f, 0f, 1f);
}
else if (!hInferno && holyInfernoFadeIntensity > 0f)
{
holyInfernoFadeIntensity = MathHelper.Clamp(holyInfernoFadeIntensity - 0.01f, 0f, 1f);
}
// Transformer immunity to Electrified
if (transformer)
Player.buffImmune[BuffID.Electrified] = true;
@@ -1101,6 +1154,9 @@ namespace CalamityMod.CalPlayer
if (!tentaclesPresent[i])
{
int damage = (int)Player.GetBestClassDamage().ApplyTo(390);
if (oldFashioned)
damage = CalamityUtils.CalcOldFashionedDamage(damage);
var source = Player.GetSource_FromThis(OmegaBlueHelmet.TentacleEntitySourceContext);
Vector2 vel = new Vector2(Main.rand.Next(-13, 14), Main.rand.Next(-13, 14)) * 0.25f;
Projectile.NewProjectile(source, Player.Center, vel, ModContent.ProjectileType<OmegaBlueTentacle>(), damage, 8f, Main.myPlayer, Main.rand.Next(120), i);
@@ -1156,7 +1212,7 @@ namespace CalamityMod.CalPlayer
Vector2 dustLineEnd = Player.Center;
Vector2 currentDustPos = default;
Vector2 spinningpoint = new Vector2(0f, -3f).RotatedByRandom(MathHelper.Pi);
Vector2 value5 = new Vector2(2.1f, 2f);
Vector2 healerDustVel = new Vector2(2.1f, 2f);
Color dustColor = Main.hslToRgb(Main.rgbToHsl(new Color(255, 200, Main.DiscoB)).X, 1f, 0.5f);
dustColor.A = 255;
for (int i = 0; i < maxHealDustIterations; i++)
@@ -1164,18 +1220,18 @@ namespace CalamityMod.CalPlayer
if (i % dustDivisor == 0)
{
currentDustPos = Vector2.Lerp(dustLineStart, dustLineEnd, i / (float)maxHealDustIterations);
int dust = Dust.NewDust(currentDustPos, 0, 0, 267, 0f, 0f, 0, dustColor, 1f);
Main.dust[dust].position = currentDustPos;
Main.dust[dust].velocity = spinningpoint.RotatedBy(MathHelper.TwoPi * i / maxHealDustIterations) * value5 * (0.8f + Main.rand.NextFloat() * 0.4f) + Player.velocity;
Main.dust[dust].noGravity = true;
Main.dust[dust].scale = 1f;
Main.dust[dust].fadeIn = Main.rand.NextFloat() * 2f;
Dust dust2 = Dust.CloneDust(dust);
Dust dust3 = dust2;
dust3.scale /= 2f;
dust3 = dust2;
dust3.fadeIn /= 2f;
dust2.color = new Color(255, 255, 255, 255);
int holyDust = Dust.NewDust(currentDustPos, 0, 0, 267, 0f, 0f, 0, dustColor, 1f);
Main.dust[holyDust].position = currentDustPos;
Main.dust[holyDust].velocity = spinningpoint.RotatedBy(MathHelper.TwoPi * i / maxHealDustIterations) * healerDustVel * (0.8f + Main.rand.NextFloat() * 0.4f) + Player.velocity;
Main.dust[holyDust].noGravity = true;
Main.dust[holyDust].scale = 1f;
Main.dust[holyDust].fadeIn = Main.rand.NextFloat() * 2f;
Dust dustClone = Dust.CloneDust(holyDust);
Dust extraDust = dustClone;
extraDust.scale /= 2f;
extraDust = dustClone;
extraDust.fadeIn /= 2f;
dustClone.color = new Color(255, 255, 255, 255);
}
}
}
@@ -1208,7 +1264,11 @@ namespace CalamityMod.CalPlayer
{
unstableSelectedTarget = Main.npc[target];
unstableSelectedTarget.Calamity().arcZapCooldown = 18;
Projectile.NewProjectile(Player.GetSource_FromThis(), new Vector2(Player.Center.X, Player.Center.Y - 20f), new Vector2(0f, -2f), ModContent.ProjectileType<ArcZap>(), 18, 0f, Player.whoAmI, target, 3f);
int damage = 18;
if (oldFashioned)
damage = CalamityUtils.CalcOldFashionedDamage(damage);
Projectile.NewProjectile(Player.GetSource_FromThis(), new Vector2(Player.Center.X, Player.Center.Y - 20f), new Vector2(0f, -2f), ModContent.ProjectileType<ArcZap>(), damage, 0f, Player.whoAmI, target, 3f);
target = -1;
}
}
@@ -1283,6 +1343,12 @@ namespace CalamityMod.CalPlayer
if (expiredCooldowns.Count > 0)
SyncCooldownRemoval(Main.netMode == NetmodeID.Server, expiredCooldowns);
if (DragonsBreathAudioCooldown > 0)
DragonsBreathAudioCooldown--;
if (DragonsBreathAudioCooldown2 > 0)
DragonsBreathAudioCooldown2--;
if (PhotoAudioCooldown > 0)
PhotoAudioCooldown--;
if (fullRageSoundCountdownTimer > 0)
--fullRageSoundCountdownTimer;
if (plagueTaintedSMGDroneCooldown > 0)
@@ -1345,8 +1411,6 @@ namespace CalamityMod.CalPlayer
xerocDmg = 0f;
if (hideOfDeusMeleeBoostTimer > 0)
hideOfDeusMeleeBoostTimer--;
if (gaelRageAttackCooldown > 0)
gaelRageAttackCooldown--;
if (evolutionLifeRegenCounter > 0)
evolutionLifeRegenCounter--;
if (hurtSoundTimer > 0)
@@ -1373,6 +1437,8 @@ namespace CalamityMod.CalPlayer
titanCooldown--;
if (hideOfDeusTimer > 0)
hideOfDeusTimer--;
if (murasamaHitCooldown > 0)
murasamaHitCooldown--;
if (hellbornBoost > 0)
hellbornBoost--;
if (persecutedEnchantSummonTimer < 1800)
@@ -1402,10 +1468,11 @@ namespace CalamityMod.CalPlayer
if (Player.miscCounter % 100 == 0)
canFireBloodflareMageProjectile = true;
if (Player.miscCounter % 120 == 0)
canFireAtaxiaRogueProjectile = true;
if (Player.miscCounter % 150 == 0)
{
canFireGodSlayerRangedProjectile = true;
canFireBloodflareRangedProjectile = true;
canFireAtaxiaRogueProjectile = true;
}
if (reaverRegenCooldown < 60 && reaverRegen)
reaverRegenCooldown++;
@@ -1733,7 +1800,7 @@ namespace CalamityMod.CalPlayer
}
Lighting.AddLight((int)(Player.Center.X / 16f), (int)(Player.Center.Y / 16f), light[0], light[1], light[2]);
//Permafrost's Concoction bonuses/debuffs
// Permafrost's Concoction bonuses/debuffs
if (permafrostsConcoction)
{
Player.manaCost *= 0.85f;
@@ -1745,7 +1812,7 @@ namespace CalamityMod.CalPlayer
Player.statDefense += 30;
Player.frozen = true;
Player.velocity.X = 0f;
Player.velocity.Y = -0.4f; //should negate gravity
Player.velocity.Y = -0.4f; // Should negate gravity
int ice = Dust.NewDust(Player.position, Player.width, Player.height, 88);
Main.dust[ice].noGravity = true;
@@ -1886,6 +1953,9 @@ namespace CalamityMod.CalPlayer
lightningVel.Normalize();
lightningVel *= Main.rand.NextFloat(1f, 2f);
int damage = (int)Player.GetTotalDamage<RogueDamageClass>().ApplyTo(30);
if (oldFashioned)
damage = CalamityUtils.CalcOldFashionedDamage(damage);
int projectile = Projectile.NewProjectile(source, Player.Center, lightningVel, ModContent.ProjectileType<BlunderBoosterLightning>(), damage, 0, Player.whoAmI, Main.rand.Next(2), 0f);
Main.projectile[projectile].timeLeft = Main.rand.Next(180, 240);
if (projectile.WithinBounds(Main.maxProjectiles))
@@ -1910,6 +1980,9 @@ namespace CalamityMod.CalPlayer
cloudVelocity.Normalize();
cloudVelocity *= Main.rand.NextFloat(0f, 1f);
int damage = (int)Player.GetTotalDamage<RogueDamageClass>().ApplyTo(20);
if (oldFashioned)
damage = CalamityUtils.CalcOldFashionedDamage(damage);
int projectile = Projectile.NewProjectile(source, Player.Center, cloudVelocity, ModContent.ProjectileType<PlaguedFuelPackCloud>(), damage, 0, Player.whoAmI, 0, 0);
Main.projectile[projectile].timeLeft = Main.rand.Next(180, 240);
if (projectile.WithinBounds(Main.maxProjectiles))
@@ -2056,6 +2129,7 @@ namespace CalamityMod.CalPlayer
// Breath Loss Multiplier, depending on gear
double breathLossMult = 1D -
(Player.gills ? 0.2 : 0D) - // 0.8
(oceanCrest ? 0.2 : 0D) - // 0.8
(Player.accDivingHelm ? 0.25 : 0D) - // 0.75
(Player.arcticDivingGear ? 0.25 : 0D) - // 0.75
(aquaticEmblem ? 0.25 : 0D) - // 0.75
@@ -2119,6 +2193,7 @@ namespace CalamityMod.CalPlayer
// Tick (frame) multiplier, depending on gear
double tickMult = 1D +
(Player.gills ? 4D : 0D) + // 5
(oceanCrest ? 4D : 0D) + // 5
(Player.ignoreWater ? 5D : 0D) + // 10
(Player.accDivingHelm ? 10D : 0D) + // 20
(Player.arcticDivingGear ? 10D : 0D) + // 30
@@ -2395,7 +2470,7 @@ namespace CalamityMod.CalPlayer
#region Other Buff Effects
private void OtherBuffEffects()
{
if (gravityNormalizer)
{
Player.buffImmune[BuffID.VortexDebuff] = true;
@@ -2424,11 +2499,11 @@ namespace CalamityMod.CalPlayer
}
}
// Cobalt armor set effects.
// Cobalt armor set effects
if (CobaltSet)
CobaltArmorSetChange.ApplyMovementSpeedBonuses(Player);
// Adamantite armor set effects.
// Adamantite armor set effects
if (AdamantiteSet)
Player.statDefense += AdamantiteSetDefenseBoost;
@@ -2462,7 +2537,7 @@ namespace CalamityMod.CalPlayer
Player.GetDamage<MeleeDamageClass>() += 0.2f;
}
if (tFury)
if (brutalCarnage)
{
Player.GetDamage<MeleeDamageClass>() += 0.25f;
Player.GetCritChance<MeleeDamageClass>() += 10;
@@ -2527,7 +2602,7 @@ namespace CalamityMod.CalPlayer
if (tortShell)
{
if (tortShellPostHit == 1)
SoundEngine.PlaySound(SoundID.NPCHit24 with {Volume = 0.5f}, Player.Center);
SoundEngine.PlaySound(SoundID.NPCHit24 with { Volume = 0.5f }, Player.Center);
if (tortShellPostHit > 0)
{
@@ -2550,22 +2625,41 @@ namespace CalamityMod.CalPlayer
if (eGauntlet)
{
Player.kbGlove = true;
Player.GetDamage<MeleeDamageClass>() += 0.15f;
Player.GetCritChance<MeleeDamageClass>() += 5;
}
if (bloodPactBoost)
// Gauntlet Melee Speed, prevents glove stacking for melee speed
if (gloveLevel > 0)
{
Player.GetDamage<GenericDamageClass>() += 0.05f;
Player.statDefense += 20;
Player.longInvince = true;
Player.crimsonRegen = true;
healingPotBonus += 0.5f;
// Determine the glove the player benefits from in priority of latest in progression
float gloveAttackSpeed = (gloveLevel == 5 ? 0.15f : gloveLevel == 4 ? 0.14f : gloveLevel == 3 ? 0.12f : gloveLevel <= 2 ? 0.10f : 0);
Player.GetAttackSpeed<MeleeDamageClass>() += gloveAttackSpeed; // Give the player attack speed based on the glove they have
}
// 50% movement speed bonus so that you don't feel like a snail in the early game.
// Disabled while Overhaul is enabled, because Overhaul does very similar things to make movement more snappy.
// Bloodflare Core's heal over time
if (bloodflareCore && bloodflareCoreRemainingHealOverTime > 0 && Player.miscCounter % BloodflareCore.HealFrameCooldown == 0)
{
Player.statLife += 1;
Player.HealEffect(1, false);
// Produce an implosion of blood themed dust so it's obvious an effect is occurring
for (int i = 0; i < 3; ++i)
{
Vector2 offset = Main.rand.NextVector2Unit() * Main.rand.NextFloat(23f, 33f);
Vector2 dustPos = Player.Center + offset;
Vector2 dustVel = offset * -0.08f;
Dust d = Dust.NewDustDirect(dustPos, 0, 0, 90, 0.08f, 0.08f);
d.velocity = dustVel;
d.noGravity = true;
}
// Decrement the remaining possible heal over time
--bloodflareCoreRemainingHealOverTime;
}
// 50% movement speed bonus so that you don't feel like a snail in the early game
// Disabled while Overhaul is enabled, because Overhaul does very similar things to make movement more snappy
if (CalamityMod.Instance.overhaul is null && CalamityConfig.Instance.FasterBaseSpeed)
Player.moveSpeed += BalancingConstants.DefaultMoveSpeedBoost;
@@ -2648,6 +2742,9 @@ namespace CalamityMod.CalPlayer
Player.GetCritChance<GenericDamageClass>() += MoscowMule.CritBoost;
}
if (oldFashioned)
Player.GetDamage<GenericDamageClass>() -= OldFashioned.DamageStatReduction;
if (whiteWine)
Player.GetDamage<MagicDamageClass>() += 0.08f;
@@ -2714,6 +2811,7 @@ namespace CalamityMod.CalPlayer
(soaring ? 0.1 : 0D) +
(prismaticGreaves ? 0.1 : 0D) +
(plagueReaper ? 0.05 : 0D) +
(ascendantInsignia ? 0.05 : 0D) + // Added to soaring insignia's flight to get 30%
(Player.empressBrooch ? 0.25 : 0D);
if (blueCandle)
@@ -2736,7 +2834,7 @@ namespace CalamityMod.CalPlayer
if (profanedCrystalBuffs)
{
bool offenseBuffs = pscState == (int)ProfanedSoulCrystal.ProfanedSoulCrystalState.Buffs || (Main.dayTime && !Player.wet) || Player.lavaWet;
if (offenseBuffs)
if (offenseBuffs || pscState == (int)ProfanedSoulCrystal.ProfanedSoulCrystalState.Empowered)
flightTimeMult += 0.1;
}
@@ -2798,9 +2896,6 @@ namespace CalamityMod.CalPlayer
Player.findTreasure = true;
}
if (shellBoost)
Player.moveSpeed += 0.3f;
if (tarraSet)
{
if (!tarraMelee)
@@ -2950,23 +3045,43 @@ namespace CalamityMod.CalPlayer
for (int I = 0; I < 3; I++)
{
float ai1 = I * 120;
int damage = (int)Player.GetTotalDamage<SummonDamageClass>().ApplyTo(3750);
int baseDamage = 3750;
if (oldFashioned)
baseDamage = CalamityUtils.CalcOldFashionedDamage(baseDamage);
int damage = (int)Player.GetTotalDamage<SummonDamageClass>().ApplyTo(baseDamage);
int projectile = Projectile.NewProjectile(source, Player.Center.X + (float)(Math.Sin(I * 120) * 550), Player.Center.Y + (float)(Math.Cos(I * 120) * 550), 0f, 0f,
ModContent.ProjectileType<GhostlyMine>(), damage, 1f, Player.whoAmI, ai1, 0f);
if (projectile.WithinBounds(Main.maxProjectiles))
{
Main.projectile[projectile].originalDamage = 3750;
Main.projectile[projectile].originalDamage = baseDamage;
Main.projectile[projectile].DamageType = DamageClass.Generic;
}
}
}
}
if (yInsignia)
if (ascendantInsignia)
{
Player.GetDamage<MeleeDamageClass>() += 0.15f;
if (Player.statLife <= (int)(Player.statLifeMax2 * 0.5))
Player.GetDamage<GenericDamageClass>() += 0.1f;
if (CalamityKeybinds.AscendantInsigniaHotKey.JustPressed && ascendantInsigniaCooldown <= 0)
{
var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType<AscendantInsignia>()));
Projectile.NewProjectileDirect(source, Player.Center - Vector2.UnitY * 45f, Vector2.Zero, ModContent.ProjectileType<AscendantAura>(), 0, 0f);
SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/AscendantActivate"));
ascendantInsigniaCooldown = 2400;
ascendantInsigniaBuffTime = 240; //4 seconds
}
if (ascendantInsigniaCooldown > 0 && ascendantInsigniaBuffTime <= 0)
ascendantInsigniaCooldown--;
if (ascendantInsigniaBuffTime == 1)
Player.AddCooldown(AscendEffect.ID, 2400);
if (ascendantInsigniaBuffTime > 0)
{
ascendantTrail = true;
infiniteFlight = true;
ascendantInsigniaBuffTime--;
}
}
if (deepDiver && Player.IsUnderwater())
@@ -3009,6 +3124,9 @@ namespace CalamityMod.CalPlayer
{
const int BaseDamage = 120;
int damage = (int)Player.GetTotalDamage<SummonDamageClass>().ApplyTo(BaseDamage);
if (oldFashioned)
damage = CalamityUtils.CalcOldFashionedDamage(damage);
// https://github.com/tModLoader/tModLoader/wiki/IEntitySource#detailed-list
var source = Player.GetSource_FromThis(TarragonHeadSummon.LifeAuraEntitySourceContext);
float range = 300f;
@@ -3080,6 +3198,9 @@ namespace CalamityMod.CalPlayer
{
const int BaseDamage = 50;
int damage = (int)Player.GetBestClassDamage().ApplyTo(BaseDamage);
if (oldFashioned)
damage = CalamityUtils.CalcOldFashionedDamage(damage);
// https://github.com/tModLoader/tModLoader/wiki/IEntitySource#detailed-list
var source = Player.GetSource_FromThis(HydrothermicArmor.InfernoPotionEntitySourceContext);
float range = 300f;
@@ -3117,7 +3238,7 @@ namespace CalamityMod.CalPlayer
}
if (dArtifact)
Player.GetDamage<GenericDamageClass>() += 0.25f;
Player.GetDamage<GenericDamageClass>() *= 1.2f;
if (trippy)
Player.GetDamage<GenericDamageClass>() += 0.5f;
@@ -3144,6 +3265,8 @@ namespace CalamityMod.CalPlayer
int guardianAmt = 1;
float babCheck = profanedCrystal ? 1f : 0f;
int babDamage = profanedCrystal ? 346 : 52;
if (oldFashioned)
babDamage = CalamityUtils.CalcOldFashionedDamage(babDamage);
if (Player.ownedProjectileCounts[ModContent.ProjectileType<MiniGuardianHealer>()] < guardianAmt)
{
@@ -3174,8 +3297,8 @@ namespace CalamityMod.CalPlayer
bool empowered = pscState == (int)ProfanedSoulCrystal.ProfanedSoulCrystalState.Empowered;
Player.lavaImmune = true;
Player.fireWalk = true;
Player.buffImmune[ModContent.BuffType<HolyFlames>()] = Main.dayTime;
Player.buffImmune[ModContent.BuffType<Nightwither>()] = !Main.dayTime;
Player.buffImmune[ModContent.BuffType<HolyFlames>()] = Main.dayTime || empowered;
Player.buffImmune[ModContent.BuffType<Nightwither>()] = !Main.dayTime || empowered;
Player.buffImmune[BuffID.OnFire] = true;
Player.buffImmune[BuffID.Burning] = true;
Player.buffImmune[BuffID.Daybreak] = true;
@@ -3203,39 +3326,6 @@ namespace CalamityMod.CalPlayer
}
}
if (plaguebringerPistons)
{
//Spawn bees while sprinting or dashing
pistonsCounter++;
if (pistonsCounter % 12 == 0)
{
if (Player.velocity.Length() >= 5f && Player.whoAmI == Main.myPlayer)
{
int beeCount = 1;
if (Main.rand.NextBool(3))
++beeCount;
if (Main.rand.NextBool(3))
++beeCount;
if (Player.strongBees && Main.rand.NextBool(3))
++beeCount;
int damage = (int)Player.GetTotalDamage<SummonDamageClass>().ApplyTo(30);
// TODO -- should be from accessory, can't do that because this code is in the wrong place.
// This needs to be part of the update accessory function of the accessory itself to have the right entity source
// https://github.com/tModLoader/tModLoader/wiki/IEntitySource#detailed-list
var source = Player.GetSource_FromThis("PlaguebringerPistonBees");
for (int index = 0; index < beeCount; ++index)
{
int bee = Projectile.NewProjectile(source, Player.Center.X, Player.Center.Y, Main.rand.NextFloat(-35f, 35f) * 0.02f, Main.rand.NextFloat(-35f, 35f) * 0.02f, (Main.rand.NextBool(4) ? ModContent.ProjectileType<PlagueBeeSmall>() : Player.beeType()), damage, Player.beeKB(0f), Player.whoAmI, 0f, 0f);
Main.projectile[bee].usesLocalNPCImmunity = true;
Main.projectile[bee].localNPCHitCooldown = 10;
Main.projectile[bee].penetrate = 2;
if (bee.WithinBounds(Main.maxProjectiles))
Main.projectile[bee].DamageType = DamageClass.Generic;
}
}
}
}
List<int> summonDeleteList = new List<int>()
{
ModContent.ProjectileType<BrimstoneElementalMinion>(),
@@ -3276,6 +3366,9 @@ namespace CalamityMod.CalPlayer
{
var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType<BlunderBooster>()));
int damage = (int)Player.GetTotalDamage<RogueDamageClass>().ApplyTo(30);
if (oldFashioned)
damage = CalamityUtils.CalcOldFashionedDamage(damage);
if (Player.ownedProjectileCounts[ModContent.ProjectileType<BlunderBoosterAura>()] < 1)
Projectile.NewProjectile(source, Player.Center, Vector2.Zero, ModContent.ProjectileType<BlunderBoosterAura>(), damage, 0f, Player.whoAmI, 0f, 0f);
}
@@ -3335,6 +3428,9 @@ namespace CalamityMod.CalPlayer
{
var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType<CryoStone>()));
int damage = (int)Player.GetBestClassDamage().ApplyTo(70);
if (oldFashioned)
damage = CalamityUtils.CalcOldFashionedDamage(damage);
if (Player.whoAmI == Main.myPlayer && Player.ownedProjectileCounts[ModContent.ProjectileType<CryonicShield>()] == 0)
Projectile.NewProjectile(source, Player.Center, Vector2.Zero, ModContent.ProjectileType<CryonicShield>(), damage, 0f, Player.whoAmI);
}
@@ -3355,6 +3451,9 @@ namespace CalamityMod.CalPlayer
{
float shootSpeed = 18f;
int dmg = (int)Player.GetTotalDamage<MagicDamageClass>().ApplyTo(30);
if (oldFashioned)
dmg = CalamityUtils.CalcOldFashionedDamage(dmg);
Vector2 startPos = Player.RotatedRelativePoint(Player.MountedCenter, true);
Vector2 velocity = Main.MouseWorld - startPos;
if (Player.gravDir == -1f)
@@ -3833,7 +3932,7 @@ namespace CalamityMod.CalPlayer
// (in addition to the player taking more defense damage, of course).
if (totalDefenseDamage > 0)
{
//Used to cleanse all defense damage by accessories
// Used to cleanse all defense damage by accessories
if (CleansingEffect == 1)
{
totalDefenseDamage = 0;
@@ -3891,39 +3990,6 @@ namespace CalamityMod.CalPlayer
Player.statDefense -= currentDefenseDamage;
}
// Bloodflare Core's defense reduction
// This is intentionally after defense damage.
// This defense still comes back over time if you take off Bloodflare Core while you're missing defense.
// However, removing the item means you won't get healed as the defense comes back.
ref int lostDef = ref bloodflareCoreLostDefense;
if (lostDef > 0)
{
// Defense regeneration occurs every six frames while defense is missing
if (Player.miscCounter % 6 == 0)
{
--lostDef;
if (bloodflareCore)
{
Player.statLife += 1;
Player.HealEffect(1, false);
// Produce an implosion of blood themed dust so it's obvious an effect is occurring
for (int i = 0; i < 3; ++i)
{
Vector2 offset = Main.rand.NextVector2Unit() * Main.rand.NextFloat(23f, 33f);
Vector2 dustPos = Player.Center + offset;
Vector2 dustVel = offset * -0.08f;
Dust d = Dust.NewDustDirect(dustPos, 0, 0, 90, 0.08f, 0.08f);
d.velocity = dustVel;
d.noGravity = true;
}
}
}
// Actually apply Bloodflare Core defense reduction
Player.statDefense -= lostDef;
}
// Defense can never be reduced below zero, no matter what
if (Player.statDefense < 0)
Player.statDefense *= 0;
@@ -4249,7 +4315,7 @@ namespace CalamityMod.CalPlayer
Player.potionDelay = potionTimer;
if (potionTimer == 1)
{
//Reduced duration than normal
// Reduced duration than normal
int duration = HadalStew.SicknessDuration;
if (Player.pStone)
duration = (int)(duration * 0.75);
+97 -9
View File
@@ -10,6 +10,7 @@ using CalamityMod.EntitySources;
using CalamityMod.Items.Accessories;
using CalamityMod.Items.Armor.Prismatic;
using CalamityMod.Items.Armor.Reaver;
using CalamityMod.Items.Potions.Alcohol;
using CalamityMod.Items.VanillaArmorChanges;
using CalamityMod.Items.Weapons.Ranged;
using CalamityMod.NPCs;
@@ -23,6 +24,7 @@ using CalamityMod.Projectiles.Rogue;
using CalamityMod.Projectiles.Summon;
using CalamityMod.Projectiles.Typeless;
using Microsoft.Xna.Framework;
using MonoMod.Cil;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
@@ -344,7 +346,11 @@ namespace CalamityMod.CalPlayer
ProjectileID.StarCloakStar,
ProjectileID.StarCannonStar
});
int astralStarDamage = (int)Player.GetBestClassDamage().ApplyTo(120);
if (oldFashioned)
astralStarDamage = CalamityUtils.CalcOldFashionedDamage(astralStarDamage);
Projectile star = CalamityUtils.ProjectileRain(source, position, 400f, 100f, 500f, 800f, 12f, projectileType, astralStarDamage, 5f, Player.whoAmI);
if (star.whoAmI.WithinBounds(Main.maxProjectiles))
star.DamageType = DamageClass.Generic;
@@ -360,6 +366,9 @@ namespace CalamityMod.CalPlayer
{
// Ataxia True Melee Geysers: 15%, softcap starts at 300 base damage
int geyserDamage = CalamityUtils.DamageSoftCap(damage * 0.15, 45);
if (oldFashioned)
geyserDamage = CalamityUtils.CalcOldFashionedDamage(geyserDamage);
Projectile.NewProjectile(source, position, Vector2.Zero, ProjectileType<ChaoticGeyser>(), geyserDamage, 2f, Player.whoAmI, 0f, 0f);
}
if (soaring)
@@ -397,6 +406,9 @@ namespace CalamityMod.CalPlayer
if (alchFlask && Player.ownedProjectileCounts[ProjectileType<PlagueSeeker>()] < 3 && hasClass)
{
int seekerDamage = (int)Player.GetBestClassDamage().ApplyTo(30);
if (oldFashioned)
seekerDamage = CalamityUtils.CalcOldFashionedDamage(seekerDamage);
Projectile projectile = CalamityUtils.SpawnOrb(proj, seekerDamage, ProjectileType<PlagueSeeker>(), 400f, 12f);
if (projectile.whoAmI.WithinBounds(Main.maxProjectiles))
Main.projectile[projectile.whoAmI].DamageType = DamageClass.Generic;
@@ -423,7 +435,11 @@ namespace CalamityMod.CalPlayer
ProjectileID.StarCloakStar,
ProjectileID.StarCannonStar
});
int astralStarDamage = (int)Player.GetBestClassDamage().ApplyTo(120);
if (oldFashioned)
astralStarDamage = CalamityUtils.CalcOldFashionedDamage(astralStarDamage);
Projectile star = CalamityUtils.ProjectileRain(source, position, 400f, 100f, 500f, 800f, 25f, projectileType, astralStarDamage, 5f, Player.whoAmI);
if (star.whoAmI.WithinBounds(Main.maxProjectiles))
star.DamageType = DamageClass.Generic;
@@ -487,6 +503,9 @@ namespace CalamityMod.CalPlayer
{
// Ataxia Melee Geysers: 15%, softcap starts at 240 base damage
int geyserDamage = CalamityUtils.DamageSoftCap(proj.damage * 0.15, 36);
if (oldFashioned)
geyserDamage = CalamityUtils.CalcOldFashionedDamage(geyserDamage);
Projectile.NewProjectile(source, proj.Center, Vector2.Zero, ProjectileType<ChaoticGeyser>(), geyserDamage, 0f, Player.whoAmI, 0f, 0f);
}
if (bloodflareMelee && proj.IsTrueMelee() && bloodflareMeleeHits < 15 && !bloodflareFrenzy && !Player.HasCooldown(BloodflareFrenzy.ID))
@@ -509,6 +528,9 @@ namespace CalamityMod.CalPlayer
{
Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f);
int leafDamage = (int)(0.25 * proj.damage);
if (oldFashioned)
leafDamage = CalamityUtils.CalcOldFashionedDamage(leafDamage);
int leaf = Projectile.NewProjectile(source, position, velocity, ProjectileID.Leaf, leafDamage, 0f, Player.whoAmI);
if (leaf.WithinBounds(Main.maxProjectiles))
{
@@ -522,6 +544,9 @@ namespace CalamityMod.CalPlayer
{
Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f);
int energyDamage = (int)(0.33 * proj.damage);
if (oldFashioned)
energyDamage = CalamityUtils.CalcOldFashionedDamage(energyDamage);
Projectile.NewProjectile(source, proj.Center, velocity, ProjectileType<TarraEnergy>(), energyDamage, 0f, proj.owner);
}
}
@@ -541,6 +566,9 @@ namespace CalamityMod.CalPlayer
if (ataxiaMage && ataxiaDmg <= 0)
{
int orbDamage = (int)(proj.damage * 0.6);
if (oldFashioned)
orbDamage = CalamityUtils.CalcOldFashionedDamage(orbDamage);
CalamityUtils.SpawnOrb(proj, orbDamage, ProjectileType<HydrothermicSphere>(), 800f, 20f);
int cooldown = (int)(orbDamage * 0.5);
ataxiaDmg += cooldown;
@@ -559,6 +587,9 @@ namespace CalamityMod.CalPlayer
Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f);
// Bloodflare Mage Fireballs: 3 x 50%, softcap starts at 500 base damage to not overly punish slow weapons
int bloodflareFireballDamage = CalamityUtils.DamageSoftCap(proj.damage * 0.5, 250);
if (oldFashioned)
bloodflareFireballDamage = CalamityUtils.CalcOldFashionedDamage(bloodflareFireballDamage);
int fire = Projectile.NewProjectile(source, position, velocity, ProjectileID.BallofFire, bloodflareFireballDamage, 0f, Player.whoAmI);
if (fire.WithinBounds(Main.maxProjectiles))
{
@@ -574,6 +605,9 @@ namespace CalamityMod.CalPlayer
SoundEngine.PlaySound(SoundID.Zombie103 , proj.Center); //So scuffed, just because zombie sounds werent ported normally
// Silva Mage Blasts: 800 + 60%, softcap on the whole combined thing starts at 1400
int silvaBurstDamage = CalamityUtils.DamageSoftCap(800.0 + 0.6 * proj.damage, 1400);
if (oldFashioned)
silvaBurstDamage = CalamityUtils.CalcOldFashionedDamage(silvaBurstDamage);
Projectile.NewProjectile(source, proj.Center, Vector2.Zero, ProjectileType<SilvaBurst>(), silvaBurstDamage, 8f, Player.whoAmI);
}
}
@@ -613,6 +647,9 @@ namespace CalamityMod.CalPlayer
if (Player.ownedProjectileCounts[ProjectileType<PhantomicDagger>()] < 3 && Main.rand.NextBool(10))
{
int damage = (int)Player.GetTotalDamage<SummonDamageClass>().ApplyTo(100);
if (oldFashioned)
damage = CalamityUtils.CalcOldFashionedDamage(damage);
Projectile.NewProjectile(source, proj.position, proj.velocity, ProjectileType<PhantomicDagger>(), damage, 1f, Player.whoAmI);
}
}
@@ -669,24 +706,36 @@ namespace CalamityMod.CalPlayer
if (nucleogenesis)
{
int apparatusDamage = (int)Player.GetTotalDamage<SummonDamageClass>().ApplyTo(60);
if (oldFashioned)
apparatusDamage = CalamityUtils.CalcOldFashionedDamage(apparatusDamage);
Projectile.NewProjectile(source, proj.Center, Vector2.Zero, ProjectileType<ApparatusExplosion>(), apparatusDamage, 4f, proj.owner);
summonProjCooldown = 100f;
}
else if (starbusterCore)
{
int starburstDamage = (int)Player.GetTotalDamage<SummonDamageClass>().ApplyTo(40);
if (oldFashioned)
starburstDamage = CalamityUtils.CalcOldFashionedDamage(starburstDamage);
Projectile.NewProjectile(source, proj.Center, Vector2.Zero, ProjectileType<SummonAstralExplosion>(), starburstDamage, 3.5f, proj.owner);
summonProjCooldown = 60f;
}
else if (nuclearFuelRod)
{
int nuclearDamage = (int)Player.GetTotalDamage<SummonDamageClass>().ApplyTo(20);
if (oldFashioned)
nuclearDamage = CalamityUtils.CalcOldFashionedDamage(nuclearDamage);
Projectile.NewProjectile(source, proj.Center, Vector2.Zero, ProjectileType<IrradiatedAura>(), nuclearDamage, 0f, proj.owner);
summonProjCooldown = 60f;
}
else if (jellyChargedBattery)
{
int batteryDamage = (int)Player.GetTotalDamage<SummonDamageClass>().ApplyTo(15);
if (oldFashioned)
batteryDamage = CalamityUtils.CalcOldFashionedDamage(batteryDamage);
CalamityUtils.SpawnOrb(proj, batteryDamage, ProjectileType<EnergyOrb>(), 800f, 15f);
summonProjCooldown = 60f;
}
@@ -700,6 +749,9 @@ namespace CalamityMod.CalPlayer
Vector2 spawnPosition = position - new Vector2(0f, 920f).RotatedByRandom(0.3f);
float speed = Main.rand.NextFloat(17f, 23f);
int hallowedDamage = (int)Player.GetTotalDamage<SummonDamageClass>().ApplyTo(50);
if (oldFashioned)
hallowedDamage = CalamityUtils.CalcOldFashionedDamage(hallowedDamage);
Projectile.NewProjectile(source, spawnPosition, Vector2.Normalize(position - spawnPosition) * speed, ProjectileType<HallowedStarSummon>(), hallowedDamage, 3f, proj.owner);
}
}
@@ -716,11 +768,12 @@ namespace CalamityMod.CalPlayer
{
int damage = (int)Player.GetTotalDamage<RogueDamageClass>().ApplyTo(DragonScales.TornadoBaseDamage);
if (oldFashioned)
damage = CalamityUtils.CalcOldFashionedDamage(damage);
int projectileIndex = Projectile.NewProjectile(spawnSource, proj.Center.X, proj.Center.Y, 0f, 0f, ProjectileType<DragonScalesInfernado>(), damage, 15f, Main.myPlayer, 10f, 9f); //First overload seems to deal with timing, second is segment amount
if (projectileIndex.WithinBounds(Main.maxProjectiles))
{
Main.projectile[projectileIndex].netUpdate = true;
}
}
if (crit && tarraThrowing && tarraThrowingCrits < 50 && !tarragonImmunity && !Player.HasCooldown(Cooldowns.TarragonImmunity.ID))
@@ -733,6 +786,9 @@ namespace CalamityMod.CalPlayer
case 0:
// Exodus Rogue Stars: 80%
int starDamage = (int)(proj.damage * 0.8);
if (oldFashioned)
starDamage = CalamityUtils.CalcOldFashionedDamage(starDamage);
CalamityUtils.SpawnOrb(proj, starDamage, ProjectileType<EmpyreanStellarDetritus>(), 800f, Main.rand.Next(15, 30));
xerocDmg += (int)(starDamage * 0.5);
break;
@@ -740,6 +796,9 @@ namespace CalamityMod.CalPlayer
case 1:
// Exodus Rogue Orbs: 60%
int orbDamage = (int)(proj.damage * 0.6);
if (oldFashioned)
orbDamage = CalamityUtils.CalcOldFashionedDamage(orbDamage);
CalamityUtils.SpawnOrb(proj, orbDamage, ProjectileType<EmpyreanMarble>(), 800f, 30f);
xerocDmg += (int)(orbDamage * 0.5);
break;
@@ -747,18 +806,27 @@ namespace CalamityMod.CalPlayer
case 2:
// Exodus Rogue Fire: 15%
int fireDamage = (int)(proj.damage * 0.15);
if (oldFashioned)
fireDamage = CalamityUtils.CalcOldFashionedDamage(fireDamage);
Projectile.NewProjectile(spawnSource, proj.Center, Vector2.Zero, ProjectileType<EmpyreanEmber>(), fireDamage, 0f, proj.owner, 0f, 0f);
break;
case 3:
// Exodus Rogue Blast: 20%
int blastDamage = (int)(proj.damage * 0.2);
if (oldFashioned)
blastDamage = CalamityUtils.CalcOldFashionedDamage(blastDamage);
Projectile.NewProjectile(spawnSource, proj.Center, Vector2.Zero, ProjectileType<EmpyreanBlast>(), blastDamage, 0f, proj.owner, 0f, 0f);
break;
case 4:
// Exodus Rogue Bubble: 60%
int bubbleDamage = (int)(proj.damage * 0.6);
if (oldFashioned)
bubbleDamage = CalamityUtils.CalcOldFashionedDamage(bubbleDamage);
CalamityUtils.SpawnOrb(proj, bubbleDamage, ProjectileType<EmpyreanGlob>(), 800f, 15f);
xerocDmg += (int)(bubbleDamage * 0.5);
break;
@@ -778,12 +846,18 @@ namespace CalamityMod.CalPlayer
Vector2 source = new Vector2(position.X + Main.rand.Next(-201, 201), Main.screenPosition.Y - 600f - Main.rand.Next(50));
Vector2 velocity = (position - source) / 40f;
int damage = (int)Player.GetTotalDamage<RogueDamageClass>().ApplyTo(120);
if (oldFashioned)
damage = CalamityUtils.CalcOldFashionedDamage(damage);
Projectile.NewProjectile(spawnSource, source, velocity, ProjectileType<NanoFlare>(), damage, 3f, proj.owner);
}
}
else if (moonCrown)
{
int lunarFlareDamage = (int)Player.GetTotalDamage<RogueDamageClass>().ApplyTo(MoonstoneCrown.BaseDamage);
if (oldFashioned)
lunarFlareDamage = CalamityUtils.CalcOldFashionedDamage(lunarFlareDamage);
float lunarFlareKB = 3f;
for (int i = 0; i < 3; i++)
{
@@ -803,6 +877,9 @@ namespace CalamityMod.CalPlayer
float speedY = (position.Y - source.Y) * 8;
Vector2 velocity = new Vector2(speedX, speedY);
int featherDamage = (int)Player.GetTotalDamage<RogueDamageClass>().ApplyTo(25);
if (oldFashioned)
featherDamage = CalamityUtils.CalcOldFashionedDamage(featherDamage);
int feather = Projectile.NewProjectile(spawnSource, source, velocity, ProjectileType<StickyFeather>(), featherDamage, 3f, proj.owner);
if (feather.WithinBounds(Main.maxProjectiles))
{
@@ -824,6 +901,9 @@ namespace CalamityMod.CalPlayer
xVector *= 10f;
yVector *= 10f;
int damage = (int)Player.GetTotalDamage<RogueDamageClass>().ApplyTo(40);
if (oldFashioned)
damage = CalamityUtils.CalcOldFashionedDamage(damage);
int eater = Projectile.NewProjectile(spawnSource, proj.Center.X, proj.Center.Y, xVector, yVector, ProjectileType<ForbiddenCircletEater>(), damage, proj.knockBack, proj.owner);
if (eater.WithinBounds(Main.maxProjectiles))
Main.projectile[eater].DamageType = DamageClass.Generic;
@@ -834,6 +914,9 @@ namespace CalamityMod.CalPlayer
if (titanHeartSet && modProj.stealthStrike && titanCooldown <= 0 && modProj.stealthStrikeHitCount < 3)
{
int damage = (int)Player.GetTotalDamage<RogueDamageClass>().ApplyTo(40);
if (oldFashioned)
damage = CalamityUtils.CalcOldFashionedDamage(damage);
Projectile.NewProjectile(spawnSource, proj.Center, Vector2.Zero, ProjectileType<SabatonBoom>(), damage, proj.knockBack, proj.owner, 1f, 0f);
SoundEngine.PlaySound(SoundID.Item14, proj.Center);
for (int dustexplode = 0; dustexplode < 360; dustexplode++)
@@ -870,6 +953,9 @@ namespace CalamityMod.CalPlayer
if (type != -1)
{
int damage = (int)Player.GetTotalDamage<RogueDamageClass>().ApplyTo(24);
if (oldFashioned)
damage = CalamityUtils.CalcOldFashionedDamage(damage);
float speed = Main.rand.NextFloat(5f, 11f);
int cloud = Projectile.NewProjectile(spawnSource, position, Vector2.One.RotatedByRandom(MathHelper.TwoPi) * speed, type, damage, proj.knockBack, Player.whoAmI);
if (cloud.WithinBounds(Main.maxProjectiles))
@@ -906,6 +992,9 @@ namespace CalamityMod.CalPlayer
{
// Umbraphile Rogue Blasts: 20%, softcap starts at 50 base damage
int umbraBlastDamage = CalamityUtils.DamageSoftCap(proj.damage * 0.20, 50);
if (oldFashioned)
umbraBlastDamage = CalamityUtils.CalcOldFashionedDamage(umbraBlastDamage);
Projectile.NewProjectile(spawnSource, proj.Center, Vector2.Zero, ProjectileType<UmbraphileBoom>(), umbraBlastDamage, 0f, Player.whoAmI);
}
if (electricianGlove && modProj.stealthStrike && modProj.stealthStrikeHitCount < 3)
@@ -914,6 +1003,9 @@ namespace CalamityMod.CalPlayer
{
Vector2 velocity = CalamityUtils.RandomVelocity(50f, 30f, 60f);
int damage = (int)Player.GetTotalDamage<RogueDamageClass>().ApplyTo(9);
if (oldFashioned)
damage = CalamityUtils.CalcOldFashionedDamage(damage);
int spark = Projectile.NewProjectile(spawnSource, position, velocity, ProjectileType<EGloveSpark>(), damage, 0f, Player.whoAmI);
if (spark.WithinBounds(Main.maxProjectiles))
{
@@ -935,16 +1027,12 @@ namespace CalamityMod.CalPlayer
{
if (eGauntlet)
{
CalamityUtils.Inflict246DebuffsNPC(target, BuffID.OnFire3);
CalamityUtils.Inflict246DebuffsNPC(target, ModContent.BuffType<ElementalMix>());
}
if (cryogenSoul)
{
CalamityUtils.Inflict246DebuffsNPC(target, BuffID.Frostburn);
}
if (yInsignia)
{
CalamityUtils.Inflict246DebuffsNPC(target, BuffType<HolyFlames>());
}
if (ataxiaFire)
{
CalamityUtils.Inflict246DebuffsNPC(target, BuffID.OnFire3, 4f);
@@ -1040,7 +1128,7 @@ namespace CalamityMod.CalPlayer
}
}
if (voidOfExtinction)
//CalamityUtils.Inflict246DebuffsNPC(target, BuffType<BrimstoneFlames>());
CalamityUtils.Inflict246DebuffsNPC(target, BuffType<BrimstoneFlames>());
if (frostFlare)
CalamityUtils.Inflict246DebuffsNPC(target, BuffID.Frostburn2);
if (omegaBlueChestplate)
@@ -1109,7 +1197,7 @@ namespace CalamityMod.CalPlayer
}
}
if (gladiatorSword && !target.IsAnEnemy(false) && target.life <= 0 && target.Calamity().gladiatorOnKill)
if (gladiatorSword && target.IsAnEnemy(false) && target.life <= 0 && target.Calamity().gladiatorOnKill)
{
target.Calamity().gladiatorOnKill = false;
Projectile.NewProjectile(Player.GetSource_FromThis(), target.Center.X, target.Center.Y, target.velocity.X / 2, target.velocity.Y / 2, ModContent.ProjectileType<GladiatorHealOrb>(), 0, 0f);
+6
View File
@@ -3,6 +3,7 @@ using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Dusts;
using CalamityMod.Enums;
using CalamityMod.Items.Accessories;
using CalamityMod.Items.Potions.Alcohol;
using CalamityMod.Particles;
using CalamityMod.Projectiles.Typeless;
using Microsoft.Xna.Framework;
@@ -73,8 +74,13 @@ namespace CalamityMod.CalPlayer.Dashes
hitContext.KnockbackFactor = kbFactor;
hitContext.PlayerImmunityFrames = AsgardianAegis.ShieldSlamIFrames;
hitContext.Damage = (int)player.GetTotalDamage<MeleeDamageClass>().ApplyTo(300f);
if (player.Calamity().oldFashioned)
hitContext.Damage = CalamityUtils.CalcOldFashionedDamage(hitContext.Damage);
int supremeExplosionDamage = (int)player.GetBestClassDamage().ApplyTo(135);
if (player.Calamity().oldFashioned)
supremeExplosionDamage = CalamityUtils.CalcOldFashionedDamage(supremeExplosionDamage);
Projectile.NewProjectile(source, player.Center, Vector2.Zero, ModContent.ProjectileType<HolyExplosionSupreme>(), supremeExplosionDamage, 20f, Main.myPlayer, 3f, 0f);
npc.AddBuff(ModContent.BuffType<GodSlayerInferno>(), 300);
}
+6
View File
@@ -2,6 +2,7 @@
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Enums;
using CalamityMod.Items.Accessories;
using CalamityMod.Items.Potions.Alcohol;
using CalamityMod.Projectiles.Typeless;
using Microsoft.Xna.Framework;
using Terraria;
@@ -70,8 +71,13 @@ namespace CalamityMod.CalPlayer.Dashes
hitContext.KnockbackFactor = kbFactor;
hitContext.PlayerImmunityFrames = AsgardsValor.ShieldSlamIFrames;
hitContext.Damage = (int)player.GetTotalDamage<MeleeDamageClass>().ApplyTo(100f);
if (player.Calamity().oldFashioned)
hitContext.Damage = CalamityUtils.CalcOldFashionedDamage(hitContext.Damage);
int holyExplosionDamage = (int)player.GetBestClassDamage().ApplyTo(60);
if (player.Calamity().oldFashioned)
holyExplosionDamage = CalamityUtils.CalcOldFashionedDamage(holyExplosionDamage);
Projectile.NewProjectile(source, player.Center, Vector2.Zero, ModContent.ProjectileType<HolyExplosion>(), holyExplosionDamage, 15f, Main.myPlayer, 0f, 0f);
npc.AddBuff(ModContent.BuffType<HolyFlames>(), 180);
}
+6
View File
@@ -2,6 +2,7 @@
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Enums;
using CalamityMod.Items.Accessories;
using CalamityMod.Items.Potions.Alcohol;
using CalamityMod.Projectiles.Typeless;
using Microsoft.Xna.Framework;
using Terraria;
@@ -73,8 +74,13 @@ namespace CalamityMod.CalPlayer.Dashes
hitContext.KnockbackFactor = kbFactor;
hitContext.PlayerImmunityFrames = ElysianAegis.ShieldSlamIFrames;
hitContext.Damage = (int)player.GetTotalDamage<MeleeDamageClass>().ApplyTo(250f);
if (player.Calamity().oldFashioned)
hitContext.Damage = CalamityUtils.CalcOldFashionedDamage(hitContext.Damage);
int supremeExplosionDamage = (int)player.GetBestClassDamage().ApplyTo(120);
if (player.Calamity().oldFashioned)
supremeExplosionDamage = CalamityUtils.CalcOldFashionedDamage(supremeExplosionDamage);
Projectile.NewProjectile(source, player.Center, Vector2.Zero, ModContent.ProjectileType<HolyExplosionSupreme>(), supremeExplosionDamage, 15f, Main.myPlayer, 1f, 0f);
npc.AddBuff(ModContent.BuffType<HolyFlames>(), 300);
}
+3
View File
@@ -3,6 +3,7 @@ using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Dusts;
using CalamityMod.Enums;
using CalamityMod.Items.Armor.GodSlayer;
using CalamityMod.Items.Potions.Alcohol;
using CalamityMod.NPCs.DevourerofGods;
using CalamityMod.Particles;
using Microsoft.Xna.Framework;
@@ -146,6 +147,8 @@ namespace CalamityMod.CalPlayer.Dashes
// This is because its immunity is meant to be completely consistent and not subject to vanilla anticheese.
hitContext.PlayerImmunityFrames = GodSlayerChestplate.DashIFrames;
hitContext.Damage = (int)player.GetBestClassDamage().ApplyTo(3000f);
if (player.Calamity().oldFashioned)
hitContext.Damage = CalamityUtils.CalcOldFashionedDamage(hitContext.Damage);
npc.AddBuff(ModContent.BuffType<GodSlayerInferno>(), 300);
}
+3
View File
@@ -1,6 +1,7 @@
using System;
using CalamityMod.Enums;
using CalamityMod.Items.Accessories;
using CalamityMod.Items.Potions.Alcohol;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.DataStructures;
@@ -59,6 +60,8 @@ namespace CalamityMod.CalPlayer.Dashes
hitContext.KnockbackFactor = kbFactor;
hitContext.PlayerImmunityFrames = OrnateShield.ShieldSlamIFrames;
hitContext.Damage = (int)player.GetTotalDamage<MeleeDamageClass>().ApplyTo(50f);
if (player.Calamity().oldFashioned)
hitContext.Damage = CalamityUtils.CalcOldFashionedDamage(hitContext.Damage);
npc.AddBuff(BuffID.Frostburn2, 180); //Great, Frostbite is ACTUALLY called Frostburn 2
}
@@ -1,6 +1,7 @@
using System;
using CalamityMod.Enums;
using CalamityMod.Items.Accessories;
using CalamityMod.Items.Potions.Alcohol;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.DataStructures;
@@ -71,6 +72,8 @@ namespace CalamityMod.CalPlayer.Dashes
hitContext.KnockbackFactor = kbFactor;
hitContext.PlayerImmunityFrames = AsgardsValor.ShieldSlamIFrames;
hitContext.Damage = (int)player.GetBestClassDamage().ApplyTo(50f);
if (player.Calamity().oldFashioned)
hitContext.Damage = CalamityUtils.CalcOldFashionedDamage(hitContext.Damage);
}
}
}
+28
View File
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using Terraria;
namespace CalamityMod.CalPlayer.Dashes
{
@@ -13,6 +14,32 @@ namespace CalamityMod.CalPlayer.Dashes
return DashIdentificationTable.TryGetValue(id, out dashEffect);
}
// A new function that allows to add in new modded dashes for Calamity to recognize, it attempts
// to make it as safe as possible.
/// <summary>
/// Attempts to add a dash effect into the dash manager. It should be executed in a Load() function.
/// </summary>
/// <param name="dashEffect">An instance of the desired dash effect to add.</param>
public static void TryAddDash(PlayerDashEffect dashEffect)
{
//If DashIdentificationTable is not loaded or modder tries to load an abstract type of
//PlayerDashEffect, then don't add the dash and stop the method.
if (DashIdentificationTable == null || dashEffect.GetType().IsAbstract) return;
string id = (string)dashEffect.GetType().GetProperty("ID").GetValue(null);
//This chunk of the code only executes if the dash isn't already added and
//the dash id isn't empty.
if (!DashIdentificationTable.ContainsKey(id) && !String.IsNullOrEmpty(id))
{
DashIdentificationTable[id] = dashEffect;
}
}
internal static void Load()
{
DashIdentificationTable = new();
@@ -32,6 +59,7 @@ namespace CalamityMod.CalPlayer.Dashes
}
}
internal static void Unload()
{
DashIdentificationTable = null;
+4
View File
@@ -1,4 +1,5 @@
using CalamityMod.Enums;
using CalamityMod.Items.Potions.Alcohol;
using CalamityMod.Particles;
using CalamityMod.Projectiles.Rogue;
using Microsoft.Xna.Framework;
@@ -42,6 +43,9 @@ namespace CalamityMod.CalPlayer.Dashes
if (Main.myPlayer == player.whoAmI && player.Calamity().statisTimer % 5 == 0)
{
int scytheDamage = (int)player.GetBestClassDamage().ApplyTo(250);
if (player.Calamity().oldFashioned)
scytheDamage = CalamityUtils.CalcOldFashionedDamage(scytheDamage);
int scythe = Projectile.NewProjectile(player.GetSource_FromAI(), player.Center, player.velocity.RotatedBy(player.direction * (AngleSwap ? 30 : -30), default) * 0.1f - player.velocity / 2f, ModContent.ProjectileType<CosmicScythe>(), scytheDamage, 5f, player.whoAmI);;
if (scythe.WithinBounds(Main.maxProjectiles))
{
@@ -0,0 +1,46 @@
using System.Collections.Generic;
using CalamityMod.Items.VanillaArmorChanges;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.DataStructures;
using Terraria.ModLoader;
namespace CalamityMod.CalPlayer.DrawLayers
{
public class AscendantTrailLayer : PlayerDrawLayer
{
public override Position GetDefaultPosition() => new AfterParent(PlayerDrawLayers.LastVanillaLayer);
public override bool GetDefaultVisibility(PlayerDrawSet drawInfo)
{
Player drawPlayer = drawInfo.drawPlayer;
if (drawInfo.shadow != 0f || drawPlayer.dead || drawPlayer.Calamity().AdrenalineTrail)
return false;
return drawPlayer.Calamity().ascendantTrail;
}
protected override void Draw(ref PlayerDrawSet drawInfo)
{
Player drawPlayer = drawInfo.drawPlayer;
List<DrawData> existingDrawData = drawInfo.DrawDataCache;
float movementSpeedInterpolant = CobaltArmorSetChange.CalculateMovementSpeedInterpolant(drawPlayer);
for (float i = 0f; i < drawPlayer.Calamity().OldPositions.Length; i += 1.2f)
{
float completionRatio = i / (float)drawPlayer.Calamity().OldPositions.Length;
float scale = MathHelper.Lerp(1f, 0.7f, completionRatio);
float opacity = MathHelper.Lerp(0.18f, 0.06f, completionRatio) * movementSpeedInterpolant;
List<DrawData> afterimages = new List<DrawData>();
for (int j = 0; j < existingDrawData.Count; j++)
{
var drawData = existingDrawData[j];
drawData.position = existingDrawData[j].position - drawPlayer.position + drawPlayer.oldPosition;
drawData.color = Color.Khaki * opacity;
drawData.scale = new Vector2(scale);
afterimages.Add(drawData);
}
drawInfo.DrawDataCache.InsertRange(0, afterimages);
}
}
}
}
+1 -1
View File
@@ -14,7 +14,7 @@ namespace CalamityMod.CalPlayer.DrawLayers
public override bool GetDefaultVisibility(PlayerDrawSet drawInfo)
{
Player drawPlayer = drawInfo.drawPlayer;
if (drawInfo.shadow != 0f || drawPlayer.dead || drawPlayer.Calamity().AdrenalineTrail)
if (drawInfo.shadow != 0f || drawPlayer.dead || drawPlayer.Calamity().AdrenalineTrail || drawPlayer.Calamity().ascendantTrail)
return false;
return drawPlayer.Calamity().auricSet;
Binary file not shown.

Before

Width:  |  Height:  |  Size: 444 B

After

Width:  |  Height:  |  Size: 349 B

+1 -1
View File
@@ -14,7 +14,7 @@ namespace CalamityMod.CalPlayer.DrawLayers
public override bool GetDefaultVisibility(PlayerDrawSet drawInfo)
{
Player drawPlayer = drawInfo.drawPlayer;
if (drawInfo.shadow != 0f || drawPlayer.dead || drawPlayer.Calamity().AdrenalineTrail)
if (drawInfo.shadow != 0f || drawPlayer.dead || drawPlayer.Calamity().AdrenalineTrail || drawPlayer.Calamity().ascendantTrail)
return false;
return drawPlayer.Calamity().CobaltSet;
@@ -4,6 +4,7 @@ using Terraria;
using Terraria.ID;
using Terraria.DataStructures;
using Terraria.ModLoader;
using CalamityMod.Items.Accessories.Vanity;
namespace CalamityMod.CalPlayer.DrawLayers
{
@@ -22,6 +23,9 @@ namespace CalamityMod.CalPlayer.DrawLayers
if (drawPlayer.armor[10].type > ItemID.None)
headItem = drawPlayer.armor[10];
if (drawPlayer.Calamity().cocosFeather)
headItem = new Item(ModContent.ItemType<CocosFeather>());
if (ModContent.GetModItem(headItem.type) is IExtendedHat extendedHatDrawer)
{
string equipSlotName = extendedHatDrawer.EquipSlotName(drawPlayer) != "" ? extendedHatDrawer.EquipSlotName(drawPlayer) : headItem.ModItem.Name;
+5 -1
View File
@@ -25,6 +25,7 @@ namespace CalamityMod
{
BossHealthBoost = Utils.Clamp(BossHealthBoost, MinBossHealthBoost, MaxBossHealthBoost);
RipperMeterShake = Utils.Clamp(RipperMeterShake, MinMeterShake, MaxMeterShake);
ParticleLimit = (int)Utils.Clamp(ParticleLimit, MinParticleLimit, MaxParticleLimit);
}
#region Graphics Changes
@@ -34,9 +35,12 @@ namespace CalamityMod
[DefaultValue(true)]
public bool Afterimages { get; set; }
private const int MinParticleLimit = 100;
private const int MaxParticleLimit = 2000;
[BackgroundColor(192, 54, 64, 192)]
[SliderColor(224, 165, 56, 128)]
[Range(0, 1000)]
[Range(MinParticleLimit, MaxParticleLimit)]
[DefaultValue(500)]
public int ParticleLimit { get; set; }
+3
View File
@@ -8,6 +8,7 @@ namespace CalamityMod
public static ModKeybind AdrenalineHotKey { get; private set; }
public static ModKeybind AngelicAllianceHotKey { get; private set; }
public static ModKeybind ArmorSetBonusHotKey { get; private set; }
public static ModKeybind AscendantInsigniaHotKey { get; private set; }
public static ModKeybind BoosterDashHotKey { get; private set; }
public static ModKeybind DashHotkey { get; private set; }
public static ModKeybind ExoChairSlowdownHotkey { get; private set; }
@@ -25,6 +26,7 @@ namespace CalamityMod
AdrenalineHotKey = KeybindLoader.RegisterKeybind(Mod, "AdrenalineMode", "B");
AngelicAllianceHotKey = KeybindLoader.RegisterKeybind(Mod, "AngelicAllianceBlessing", "G");
ArmorSetBonusHotKey = KeybindLoader.RegisterKeybind(Mod, "ArmorSetBonus", "Y");
AscendantInsigniaHotKey = KeybindLoader.RegisterKeybind(Mod, "AscendantInsigniaHotKey", "K");
BoosterDashHotKey = KeybindLoader.RegisterKeybind(Mod, "BoosterDash", "Q");
DashHotkey = KeybindLoader.RegisterKeybind(Mod, "DashDoubleTapOverride", "F");
ExoChairSlowdownHotkey = KeybindLoader.RegisterKeybind(Mod, "ExoChairSlowDown", "RightShift");
@@ -42,6 +44,7 @@ namespace CalamityMod
AdrenalineHotKey = null;
AngelicAllianceHotKey = null;
ArmorSetBonusHotKey = null;
AscendantInsigniaHotKey = null;
BoosterDashHotKey = null;
DashHotkey = null;
ExoChairSlowdownHotkey = null;
+9 -3
View File
@@ -713,7 +713,8 @@ namespace CalamityMod
"Spirit Shield",
"Briny_Coffee",
"_Skeggy_",
"just akkolite"
"just akkolite",
"J.U.N.E.S",
};
projectileDestroyExceptionList = new List<int>()
@@ -789,7 +790,7 @@ namespace CalamityMod
ProjectileType<ApotheosisWorm>(),
ProjectileType<SpiritCongregation>(),
ProjectileType<RancorLaserbeam>(),
ProjectileType<GrandStaffoftheNebulaMage_Held>(),
ProjectileType<NebulousCataclysm_Held>(),
ProjectileType<FlakKrakenProj>(),
ProjectileType<InfernadoFriendly>(),
@@ -1115,6 +1116,7 @@ namespace CalamityMod
BuffType<BrimstoneFlames>(),
BuffType<BurningBlood>(),
BuffType<BrainRot>(),
BuffType<ElementalMix>(),
BuffType<GlacialState>(),
BuffType<GodSlayerInferno>(),
BuffType<AstralInfectionDebuff>(),
@@ -1188,6 +1190,7 @@ namespace CalamityMod
BuffType<MargaritaBuff>(),
BuffType<MoonshineBuff>(),
BuffType<MoscowMuleBuff>(),
BuffType<OldFashionedBuff>(),
BuffType<RedWineBuff>(),
BuffType<RumBuff>(),
BuffType<ScrewdriverBuff>(),
@@ -1495,7 +1498,9 @@ namespace CalamityMod
needsDebuffIconDisplayList = new List<int>()
{
NPCID.WallofFleshEye
NPCID.TargetDummy,
NPCID.WallofFleshEye,
NPCType<SuperDummyNPC>()
};
// TODO -- override HoldItem => Player.scope = true; on these items
@@ -1957,6 +1962,7 @@ namespace CalamityMod
{
ProjectileID.Arkhalis,
ProjectileID.ChargedBlasterLaser,
ProjectileID.ClingerStaff,
ProjectileID.FinalFractal,
ProjectileID.FlyingKnife,
ProjectileID.LastPrismLaser,
+3 -9
View File
@@ -49,7 +49,6 @@ using CalamityMod.NPCs.StormWeaver;
using CalamityMod.NPCs.SupremeCalamitas;
using CalamityMod.NPCs.Yharon;
using CalamityMod.Particles;
using CalamityMod.Particles.Metaballs;
using CalamityMod.Projectiles;
using CalamityMod.Projectiles.BaseProjectiles;
using CalamityMod.Schematics;
@@ -306,9 +305,6 @@ namespace CalamityMod
Filters.Scene["CalamityMod:Leviathan"] = new Filter(new LevScreenShaderData("FilterMiniTower").UseColor(0f, 0f, 0.5f).UseOpacity(0.5f), EffectPriority.VeryHigh);
SkyManager.Instance["CalamityMod:Leviathan"] = new LevSky();
Filters.Scene["CalamityMod:Providence"] = new Filter(new ProvScreenShaderData("FilterMiniTower").UseColor(0.45f, 0.4f, 0.2f).UseOpacity(0.5f), EffectPriority.VeryHigh);
SkyManager.Instance["CalamityMod:Providence"] = new ProvSky();
Filters.Scene["CalamityMod:SupremeCalamitas"] = new Filter(new SCalScreenShaderData("FilterMiniTower").UseColor(1.1f, 0.3f, 0.3f).UseOpacity(0.65f), EffectPriority.VeryHigh);
SkyManager.Instance["CalamityMod:SupremeCalamitas"] = new SCalSky();
@@ -345,7 +341,6 @@ namespace CalamityMod
// However, render targets and certain other graphical objects can only be created on the main thread.
Main.QueueMainThreadAction(() =>
{
FusableParticleManager.LoadParticleRenderSets();
Main.OnPreDraw += PrepareRenderTargets;
});
@@ -376,7 +371,7 @@ namespace CalamityMod
GameShaders.Hair.BindShader(ModContent.ItemType<AdrenalineHairDye>(), new LegacyHairShaderData().UseLegacyMethod((Player player, Color newColor, ref bool lighting) => Color.Lerp(player.hairColor, new Color(0, 255, 171), ((float)player.Calamity().adrenaline / (float)player.Calamity().adrenalineMax))));
GameShaders.Hair.BindShader(ModContent.ItemType<RageHairDye>(), new LegacyHairShaderData().UseLegacyMethod((Player player, Color newColor, ref bool lighting) => Color.Lerp(player.hairColor, new Color(255, 83, 48), ((float)player.Calamity().rage / (float)player.Calamity().rageMax))));
GameShaders.Hair.BindShader(ModContent.ItemType<WingTimeHairDye>(), new LegacyHairShaderData().UseLegacyMethod((Player player, Color newColor, ref bool lighting) =>
{
{
float flightTimeInterpolant = player.wingTime / player.wingTimeMax;
if (player.mount.Active)
flightTimeInterpolant = 1f;
@@ -449,7 +444,6 @@ namespace CalamityMod
Main.QueueMainThreadAction(() =>
{
FusableParticleManager.UnloadParticleRenderSets();
Main.OnPreDraw -= PrepareRenderTargets;
});
@@ -499,7 +493,6 @@ namespace CalamityMod
public static void PrepareRenderTargets(GameTime gameTime)
{
FusableParticleManager.PrepareFusableParticleTargets();
DeathAshParticle.PrepareRenderTargets();
FluidFieldManager.Update();
}
@@ -517,7 +510,8 @@ namespace CalamityMod
saveMethodInfo.Invoke(null, new object[] { cfg });
else
Instance.Logger.Error("TML ConfigManager.Save reflection failed. Method signature has changed. Notify Calamity Devs if you see this in your log.");
} catch
}
catch
{
Instance.Logger.Error("An error occurred while manually saving Calamity mod configuration. This may be due to a complex mod conflict. It is safe to ignore this error.");
}
+4
View File
@@ -162,6 +162,9 @@ namespace CalamityMod
// Tile Entities
//
case CalamityModMessageType.UnlockAbyssChests:
Abyss.UnlockAllAbyssChests();
break;
case CalamityModMessageType.PowerCellFactory:
TEPowerCellFactory.ReadSyncPacket(mod, reader);
break;
@@ -359,6 +362,7 @@ namespace CalamityMod
UpdateCodebreakerConstituents,
UpdateCodebreakerContainedStuff,
UpdateCodebreakerDecryptCountdown,
UnlockAbyssChests,
// Draedon Summoner
CodebreakerSummonStuff,
+21
View File
@@ -0,0 +1,21 @@
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
using Terraria.Localization;
using static CalamityMod.CalamityUtils;
namespace CalamityMod.Cooldowns
{
public class AscendEffect : CooldownHandler
{
public static new string ID => "AscendEffect";
public override bool ShouldDisplay => true;
public override LocalizedText DisplayName => CalamityUtils.GetText($"UI.Cooldowns.{ID}");
public override string Texture => "CalamityMod/Cooldowns/AscendEffect";
public override Color OutlineColor => new Color(50, 50, 50);
public override Color CooldownStartColor => Color.LightGreen;
public override Color CooldownEndColor => Color.Khaki;
public override SoundStyle? EndSound => new("CalamityMod/Sounds/Item/AscendantOff");
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

+10 -1
View File
@@ -35,10 +35,19 @@ namespace CalamityMod.Cooldowns
internal CooldownInstance(Player p, string id, TagCompound tag)
{
netID = (ushort)tag.GetAsInt(NetIDSaveKey);
Cooldown cd = CooldownRegistry.Get(id);
// It is possible this cooldown does not exist. If this occurs, log it, even though it will be (mostly) harmless.
if (cd is null)
{
CalamityMod.Instance.Logger.Warn($"Cooldown \"{id}\" loaded from NBT, but was not found. This cooldown will not be applied to the player.");
return;
}
// Correct for netID mismatch if for some reason this occurs.
// The string ID of the cooldown overrides whatever the netID may have been saved as.
Cooldown cd = CooldownRegistry.Get(id);
ushort registeredNetID = cd.netID;
if (netID != registeredNetID)
{
// Log when this occurs, even though it should be harmless.
+1
View File
@@ -25,6 +25,7 @@ namespace CalamityMod.Cooldowns
{
switch (skin)
{
// TODO -- UNUSED, Core of the Blood God no longer exists.
case "bloodgod":
skinTexture = "BloodGodTotem";
outlineColor = new Color(255, 162, 205);
+19
View File
@@ -0,0 +1,19 @@
using Microsoft.Xna.Framework;
using System;
using Terraria;
using Terraria.Localization;
namespace CalamityMod.Cooldowns
{
public class GaelsRage : CooldownHandler
{
public static new string ID => "GaelsRage";
public override bool ShouldDisplay => true;
public override LocalizedText DisplayName => CalamityUtils.GetText($"UI.Cooldowns.{ID}");
public override string Texture => "CalamityMod/Cooldowns/GaelsRage";
public override Color OutlineColor => new Color(217, 106, 161);
public override Color CooldownStartColor => new Color(197, 134, 157);
public override Color CooldownEndColor => new Color(238, 151, 184);
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 434 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 222 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 203 B

+9
View File
@@ -7,6 +7,7 @@ using Terraria.ID;
using Terraria.ModLoader;
using Terraria.Audio;
using CalamityMod.Items.Armor.GemTech;
using CalamityMod.Items.Potions.Alcohol;
namespace CalamityMod.DataStructures
{
@@ -146,6 +147,9 @@ namespace CalamityMod.DataStructures
return;
int damage = (int)Owner.GetTotalDamage<MeleeDamageClass>().ApplyTo(GemTechHeadgear.MeleeShardBaseDamage);
if (Owner.Calamity().oldFashioned)
damage = CalamityUtils.CalcOldFashionedDamage(damage);
for (int i = 0; i < 14; i++)
{
Vector2 shootVelocity = Main.rand.NextVector2Unit() * Main.rand.NextFloat(0.5f, 3.25f);
@@ -162,6 +166,9 @@ namespace CalamityMod.DataStructures
return;
int damage = CalamityUtils.DamageSoftCap((int)(hitDamage * 0.32f), 400);
if (Owner.Calamity().oldFashioned)
damage = CalamityUtils.CalcOldFashionedDamage(damage);
Vector2 spawnPosition = Owner.Center + Main.rand.NextVector2Circular(Owner.width, Owner.height) * 1.35f;
Vector2 shootVelocity = (target.Center - spawnPosition) * 0.04f;
if (shootVelocity.Length() < 6f)
@@ -265,6 +272,8 @@ namespace CalamityMod.DataStructures
// Softcap the damage. This is done primarily to dampen stealth interactions.
gemDamage = CalamityUtils.DamageSoftCap(gemDamage, GemTechHeadgear.GemDamageSoftcapThreshold);
if (Owner.Calamity().oldFashioned)
gemDamage = CalamityUtils.CalcOldFashionedDamage(gemDamage);
if (Main.myPlayer == OwnerIndex)
Projectile.NewProjectile(Owner.GetSource_ItemUse(Owner.ActiveItem()), gemPosition, Vector2.Zero, ModContent.ProjectileType<GemTechArmorGem>(), gemDamage, 0f, OwnerIndex, 0f, (int)GemThatShouldBeLost);
+14 -7
View File
@@ -352,6 +352,8 @@ namespace CalamityMod
{ NPCID.SkeletronHand, new int[] { 20, 44, 55, 66, 99 } },
{ NPCID.ChaosBall, new int[] { -1, -1, -1, 40, 60 } },
{ NPCID.Deerclops, new int[] { 20, 40, 50, 60, 80 } },
{ ModContent.NPCType<SlimeGodCore>(), new int[] { 40, 80, 96, 104, 135 } },
{ ModContent.NPCType<EbonianPaladin>(), new int[] { 45, 90, 108, 118, 150 } },
{ ModContent.NPCType<SplitEbonianPaladin>(), new int[] { 40, 80, 96, 104, 135 } },
@@ -578,6 +580,10 @@ namespace CalamityMod
{ new Tuple<int, int>(NPCID.SkeletronHead, ProjectileID.Skull), new int[] { 46, 68, 84, 92, 126 } }, // 102 damage in non-rev master mode
{ new Tuple<int, int>(NPCID.Deerclops, ProjectileID.DeerclopsIceSpike), new int[] { 26, 52, 76, 84, 114 } }, // 78 damage in non-rev master mode
{ new Tuple<int, int>(NPCID.Deerclops, ProjectileID.DeerclopsRangedProjectile), new int[] { 36, 72, 88, 96, 132 } }, // 108 damage in non-rev master mode
{ new Tuple<int, int>(NPCID.Deerclops, ProjectileID.InsanityShadowHostile), new int[] { 20, 40, 60, 68, 90 } }, // 60 damage in non-rev master mode
{ new Tuple<int, int>(ModContent.NPCType<SlimeGodCore>(), ModContent.ProjectileType<UnstableEbonianGlob>()), new int[] { 42, 68, 84, 92, 126 } },
{ new Tuple<int, int>(ModContent.NPCType<SlimeGodCore>(), ModContent.ProjectileType<UnstableCrimulanGlob>()), new int[] { 38, 60, 76, 84, 114 } },
{ new Tuple<int, int>(ModContent.NPCType<EbonianPaladin>(), ModContent.ProjectileType<UnstableEbonianGlob>()), new int[] { 42, 68, 84, 92, 126 } },
@@ -605,18 +611,18 @@ namespace CalamityMod
{ new Tuple<int, int>(ModContent.NPCType<Cryogen>(), ModContent.ProjectileType<IceRain>()), new int[] { 60, 100, 120, 132, 180 } },
{ new Tuple<int, int>(ModContent.NPCType<CryogenShield>(), ModContent.ProjectileType<IceBlast>()), new int[] { 52, 92, 112, 124, 168 } },
{ new Tuple<int, int>(NPCID.Retinazer, ProjectileID.EyeLaser), new int[] { 40, 76, 92, 100, 138 } }, // 114 damage in non-rev master mode
{ new Tuple<int, int>(NPCID.Retinazer, ProjectileID.EyeLaser), new int[] { 40, 76, 116, 128, 174 } }, // 114 damage in non-rev master mode
{ new Tuple<int, int>(NPCID.Retinazer, ProjectileID.DeathLaser), new int[] {
50, // 36 in rapid fire
92, // 68 in rapid fire
112, // 84 in rapid fire
124, // 92 in rapid fire
168 } }, // 126 in rapid fire; 138 in non-rev master mode, 102 in rapid fire in non-rev master mode
124, // 93 in rapid fire
136, // 102 in rapid fire
186 } }, // 139 in rapid fire; 138 in non-rev master mode, 102 in rapid fire in non-rev master mode
{ new Tuple<int, int>(NPCID.Retinazer, ModContent.ProjectileType<ScavengerLaser>()), new int[] { 70, 120, 136, 152, 210 } },
{ new Tuple<int, int>(NPCID.Spazmatism, ProjectileID.CursedFlameHostile), new int[] { 50, 88, 108, 120, 162 } }, // 132 in non-rev master mode
{ new Tuple<int, int>(NPCID.Spazmatism, ProjectileID.CursedFlameHostile), new int[] { 50, 88, 120, 132, 180 } }, // 132 in non-rev master mode
{ new Tuple<int, int>(NPCID.Spazmatism, ProjectileID.EyeFire), new int[] { 60, 108, 0, 0, 162 } }, // Only used in non-rev modes
{ new Tuple<int, int>(NPCID.Spazmatism, ModContent.ProjectileType<Shadowflamethrower>()), new int[] { 70, 120, 136, 152, 210 } },
{ new Tuple<int, int>(NPCID.Spazmatism, ModContent.ProjectileType<ShadowflameFireball>()), new int[] { 60, 100, 120, 132, 180 } },
{ new Tuple<int, int>(NPCID.Spazmatism, ModContent.ProjectileType<Shadowflamethrower>()), new int[] { 70, 120, 148, 160, 222 } },
{ new Tuple<int, int>(NPCID.Spazmatism, ModContent.ProjectileType<ShadowflameFireball>()), new int[] { 60, 100, 128, 140, 192 } },
{ new Tuple<int, int>(ModContent.NPCType<AquaticScourgeHead>(), ModContent.ProjectileType<SulphuricAcidMist>()), new int[] { 60, 100, 120, 132, 180 } },
{ new Tuple<int, int>(ModContent.NPCType<AquaticScourgeHead>(), ModContent.ProjectileType<SandPoisonCloud>()), new int[] { 70, 120, 136, 152, 210 } },
@@ -627,6 +633,7 @@ namespace CalamityMod
{ new Tuple<int, int>(NPCID.TheDestroyerBody, ProjectileID.DeathLaser), new int[] { 44, 72, 116, 128, 174 } }, // 108 in non-rev master mode
{ new Tuple<int, int>(NPCID.TheDestroyerBody, ModContent.ProjectileType<DestroyerCursedLaser>()), new int[] { 46, 76, 128, 140, 186 } },
{ new Tuple<int, int>(NPCID.TheDestroyerBody, ModContent.ProjectileType<DestroyerElectricLaser>()), new int[] { 48, 80, 136, 152, 210 } },
{ new Tuple<int, int>(NPCID.TheDestroyerBody, ProjectileID.EyeLaser), new int[] { 40, 68, 100, 112, 144 } },
{ new Tuple<int, int>(NPCID.Probe, ProjectileID.PinkLaser), new int[] { 50, 88, 100, 112, 144 } }, // 132 in non-rev master mode
{ new Tuple<int, int>(ModContent.NPCType<BrimstoneElemental>(), ModContent.ProjectileType<BrimstoneHellfireball>()), new int[] { 80, 140, 160, 176, 234 } },
+32 -15
View File
@@ -1,5 +1,4 @@
using CalamityMod.Skies;
using Iced.Intel;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
using Terraria;
@@ -121,17 +120,20 @@ namespace CalamityMod.Effects
// Used by Acid Eels, presumably to have their snaking movements look more smooth.
internal static Effect PrimTextureOverlayShader;
// Used as a default for primitive drawing when no specific shader is supplied. This shader simply renders the vertex color data without modification.
internal static Effect StandardPrimitiveShader;
// Used by Devourer of Gods. Renders the portal that he escapes through at the end of phase 1.
internal static Effect DoGPortalShader;
// Fusable particles. See the FusableParticleManager for comments on how this system works.
// These shaders are leveraged to render the results of the fusable particle simulation to the screen.
// Metaballs. See the MetaballManager class for comments on how this system works.
// These shaders are leveraged to render the results of the metaball simulation to the screen.
// The "Base" shader draws the particles themselves.
// The "Additive" shader actually FUSES the particles into their blobby mess.
//
// Backing textures vary. The primary use of this system is Gruesome Eminence.
internal static Effect BaseFusableParticleEdgeShader;
internal static Effect AdditiveFusableParticleEdgeShader;
internal static Effect MetaballEdgeShader;
internal static Effect AdditiveMetaballEdgeShader;
// Used to render the results of Navier-Stokes fluid simulations.
internal static Effect FluidShaders;
@@ -176,17 +178,20 @@ namespace CalamityMod.Effects
#region Aqua's Shaders
internal static Effect CircularGradientWithEdge;
internal static Effect WavyOpacity;
#endregion
//
// All below shaders were added by Amber
// Authorship goes to Toasty
// All below shaders were added or created by Amber
// Authorship for the PrimitiveClearShader goes to Toasty
//
#region Amber's Shaders
internal static Effect PrimitiveClearShader;
internal static Effect HolyInfernoShader;
internal static Effect DeerclopsShadowShader;
#endregion
// Shorthand to register a loaded shader in Terraria's graphics engine
// All shaders registered this way are accessible under GameShaders.Misc
// They will use the prefix described above
@@ -335,15 +340,18 @@ namespace CalamityMod.Effects
PrimTextureOverlayShader = LoadShader("PrimTextureOverlayShader");
RegisterMiscShader(PrimTextureOverlayShader, "TrailPass", "PrimitiveTexture");
StandardPrimitiveShader = LoadShader("StandardPrimitiveShader");
RegisterMiscShader(StandardPrimitiveShader, "PrimitivePass", "StandardPrimitiveShader");
DoGPortalShader = LoadShader("ScreenShaders/DoGPortalShader");
RegisterMiscShader(DoGPortalShader, "ScreenPass", "DoGPortal");
// These two shaders are often (but not always) used together.
BaseFusableParticleEdgeShader = LoadShader("ParticleFusion/BaseFusableParticleEdgeShader");
RegisterMiscShader(BaseFusableParticleEdgeShader, "ParticlePass", "BaseFusableParticleEdge");
MetaballEdgeShader = LoadShader("Metaballs/MetaballEdgeShader");
RegisterMiscShader(MetaballEdgeShader, "ParticlePass", "MetaballEdge");
AdditiveFusableParticleEdgeShader = LoadShader("ParticleFusion/AdditiveFusableParticleEdgeShader");
RegisterMiscShader(AdditiveFusableParticleEdgeShader, "ParticlePass", "AdditiveFusableParticleEdge");
AdditiveMetaballEdgeShader = LoadShader("Metaballs/AdditiveMetaballEdgeShader");
RegisterMiscShader(AdditiveMetaballEdgeShader, "ParticlePass", "AdditiveMetaballEdge");
// This shader is not registered with the game but is invoked directly to render the results of fluid simulation.
FluidShaders = LoadShader("FluidShaders");
@@ -383,11 +391,20 @@ namespace CalamityMod.Effects
#region Loading Aqua's Shaders
CircularGradientWithEdge = LoadShader("CircularGradientWithEdge");
RegisterMiscShader(CircularGradientWithEdge, "CircularGradientWithEdgePass", "CircularGradientWithEdge");
WavyOpacity = LoadShader("WavyOpacity");
RegisterMiscShader(WavyOpacity, "WavyOpacityPass", "WavyOpacity");
#endregion
#region Loading Amber's Shaders
PrimitiveClearShader = LoadShader("PrimitiveClearShader");
RegisterScreenShader(PrimitiveClearShader, "SightLinePass", "PrimitiveClearShader");
RegisterScreenShader(PrimitiveClearShader, "AutoloadPass", "PrimitiveClearShader");
HolyInfernoShader = LoadShader("ScreenShaders/HolyInfernoShader");
RegisterMiscShader(HolyInfernoShader, "InfernoPass", "HolyInfernoShader");
DeerclopsShadowShader = LoadShader("ScreenShaders/DeerclopsShadowShader");
RegisterMiscShader(DeerclopsShadowShader, "ShadowPass", "DeerclopsShadowShader");
#endregion
}
}
@@ -12,25 +12,16 @@ float uDirection;
float3 uLightSource;
float2 uImageSize0;
float2 uImageSize1;
float edgeBorderSize;
bool borderShouldBeSolid;
float3 edgeBorderColor;
float2 screenArea;
float2 renderTargetArea;
float2 screenMoveOffset;
float2 generalBackgroundOffset;
bool invertedScreen;
float2 upscaleFactor;
float4 uShaderSpecificData;
float2 screenArea;
float2 layerOffset;
float2 singleFrameScreenOffset;
float4 PixelShaderFunction(float4 sampleColor : TEXCOORD, float2 coords : TEXCOORD0) : COLOR0
{
float2 originalCoords = coords;
if (invertedScreen)
coords.y = 1 - coords.y;
// Account for screen movements. Not doing this causes the scene to move based on that.
coords += screenMoveOffset / renderTargetArea;
coords += layerOffset + singleFrameScreenOffset;
float2 offset = 3 / screenArea;
float4 color = tex2D(uImage0, coords);
Binary file not shown.
+59
View File
@@ -0,0 +1,59 @@
sampler metaballContents : register(s0);
sampler overlayTexture : register(s1);
float2 screenSize;
float2 layerSize;
float2 layerOffset;
float4 edgeColor;
float2 singleFrameScreenOffset;
// The usage of these two methods seemingly prevents imprecision problems for some reason.
float2 convertToScreenCoords(float2 coords)
{
return coords * screenSize;
}
float2 convertFromScreenCoords(float2 coords)
{
return coords / screenSize;
}
float4 PixelShaderFunction(float4 sampleColor : COLOR0, float2 coords : TEXCOORD0) : COLOR0
{
// Calculate the base color. This is the calculated from the raw objects in the metaball render target.
float4 baseColor = tex2D(metaballContents, coords);
// Used to negate the need for an inverted if (baseColor.a > 0) by ensuring all of the edge checks fail.
float alphaOffset = (1 - any(baseColor.a));
// Check if there are any empty pixels nearby. If there are, that means this pixel is at an edge, and should be colored accordingly.
float left = tex2D(metaballContents, convertFromScreenCoords(convertToScreenCoords(coords) + float2(-2, 0))).a + alphaOffset;
float right = tex2D(metaballContents, convertFromScreenCoords(convertToScreenCoords(coords) + float2(2, 0))).a + alphaOffset;
float top = tex2D(metaballContents, convertFromScreenCoords(convertToScreenCoords(coords) + float2(0, -2))).a + alphaOffset;
float bottom = tex2D(metaballContents, convertFromScreenCoords(convertToScreenCoords(coords) + float2(0, 2))).a + alphaOffset;
// Use step instead of branching in order to determine whether neighboring pixels are invisible.
float leftHasNoAlpha = step(left, 0);
float rightHasNoAlpha = step(right, 0);
float topHasNoAlpha = step(top, 0);
float bottomHasNoAlpha = step(bottom, 0);
// Use addition instead of the OR boolean operator to get a 0-1 value for whether an edge is invisible.
// The equivalent for AND would be multiplication.
float conditionOpacityFactor = 1 - saturate(leftHasNoAlpha + rightHasNoAlpha + topHasNoAlpha + bottomHasNoAlpha);
// Calculate layer colors.
float4 layerColor = tex2D(overlayTexture, (coords + layerOffset + singleFrameScreenOffset) * screenSize / layerSize);
float4 defaultColor = layerColor * tex2D(metaballContents, coords) * sampleColor;
// Lastly, use the aforementioned condition to switch between the colors. If conditionOpacityFactor is 1, the default color is
// zeroed out and the edge is toggled, and vice versa.
return (defaultColor * conditionOpacityFactor) + (edgeColor * sampleColor * (1 - conditionOpacityFactor));
}
technique Technique1
{
pass ParticlePass
{
PixelShader = compile ps_2_0 PixelShaderFunction();
}
}
Binary file not shown.
+7 -8
View File
@@ -35,15 +35,12 @@ float4 PixelShaderFunction(float2 coords : TEXCOORD0) : COLOR0
float4 color = tex2D(uImage0, coords);
if (!any(color))
return color;
// Framed coordinates -- a UV of the NPC's current framed sprite, instead of the whole sheet
float2 framedCoords = (coords * uImageSize0 - uSourceRect.xy) / uSourceRect.zw;
// Temporal drift to make the sprite slide through the noise texture
float2 drift = float2(5 * sin(8.33 * uTime), 220 * uTime);
float2 drift = float2(5 * sin(0.04165 * uTime), 1.1 * uTime);
float2 noiseMapTexCoords = framedCoords * uSourceRect.zw + drift;
float4 noiseColor = tex2D(uImage1, noiseMapTexCoords / uImageSize1);
float2 noiseMapTexCoords = coords + drift + uWorldPosition;
float4 noiseColor = tex2D(uImage1, noiseMapTexCoords);
// Define thresholds for total pixel erasure and glowing lines.
//
@@ -61,10 +58,12 @@ float4 PixelShaderFunction(float2 coords : TEXCOORD0) : COLOR0
{
color.rgba = 0;
}
// Otherwise, if it's over the slightly lower threshold, replace it with a bright color.
else if (noiseColor.r > glowThreshold)
{
color = float4(0.4902, 1, 0, 1);
// Ensure it accounts for the original alpha.
color = float4(0.4902, 1, 0, 1) * color.a;
}
return color;
Binary file not shown.
@@ -1,78 +0,0 @@
sampler uImage0 : register(s0);
sampler uImage1 : register(s1);
float3 uColor;
float3 uSecondaryColor;
float uOpacity;
float uSaturation;
float uRotation;
float uTime;
float4 uSourceRect;
float2 uWorldPosition;
float uDirection;
float3 uLightSource;
float2 uImageSize0;
float2 uImageSize1;
float edgeBorderSize;
bool borderShouldBeSolid;
float3 edgeBorderColor;
float2 screenArea;
float2 renderTargetArea;
float2 screenMoveOffset;
float2 generalBackgroundOffset;
bool invertedScreen;
float2 upscaleFactor;
float4 uShaderSpecificData;
float4 PixelShaderFunction(float4 sampleColor : TEXCOORD, float2 coords : TEXCOORD0) : COLOR0
{
float2 originalCoords = coords;
if (invertedScreen)
coords.y = 1 - coords.y;
// Account for screen movements. Not doing this causes the scene to move based on that.
coords += screenMoveOffset / renderTargetArea;
float4 color = tex2D(uImage0, coords);
// Determine how much downscaling is required to reasonably zoom in on things.
float downscaleFactor = float2(5, 5) / upscaleFactor / max(renderTargetArea.x, renderTargetArea.y) / 2;
float2 backgroundCoords = frac((renderTargetArea * (originalCoords + generalBackgroundOffset * upscaleFactor) + uWorldPosition) * downscaleFactor);
float4 backgroundColor = tex2D(uImage1, backgroundCoords);
// Equivalent to edgeBorderSize pixels in both the X and Y direction.
float2 edgeOffset = float2(edgeBorderSize, edgeBorderSize) / renderTargetArea;
// Check if the cardinal directions are not intersecting with any other active parts of the render target.
// If one of them isn't, that means that a border should be rendered.
float4 aboveColor = tex2D(uImage0, coords + float2(0, edgeOffset.y));
float4 belowColor = tex2D(uImage0, coords - float2(0, edgeOffset.y));
float4 leftColor = tex2D(uImage0, coords + float2(edgeOffset.x, 0));
float4 rightColor = tex2D(uImage0, coords - float2(edgeOffset.x, 0));
// Invert color check thresholds based on whether the border should be solid when drawing.
float checkThreshold = 0.02;
if (!borderShouldBeSolid)
checkThreshold = 0.95;
// If any cardinal color is sufficiently close to transparency choose an edge border color.
// Opacity multipliers ensure that this does not affect completely invisible areas of the render target.
if (aboveColor.r < checkThreshold || belowColor.r < checkThreshold || leftColor.r < checkThreshold || rightColor.r < checkThreshold)
{
float borderOpacity = color.a;
// Use binary opacity if the border should be solid when drawing.
if (borderOpacity > 0 && borderShouldBeSolid)
borderOpacity = 1;
return float4(edgeBorderColor, 1) * borderOpacity;
}
return backgroundColor;
}
technique Technique1
{
pass ParticlePass
{
PixelShader = compile ps_2_0 PixelShaderFunction();
}
}
@@ -0,0 +1,52 @@
float minRadius;
float maxRadius;
float maxOpacity;
float2 screenPosition;
float2 screenSize;
float2 anchorPoint;
float InverseLerp(float a, float b, float t)
{
return saturate((t - a) / (b - a));
}
float4 PixelShaderFunction(float4 sampleColor : COLOR0, float2 uv : TEXCOORD0) : COLOR0
{
float2 worldUV = screenPosition + screenSize * uv;
float2 deerclopsUV = anchorPoint / screenSize;
float worldDistance = distance(worldUV, anchorPoint);
// Get the distance to the pixel from Deerclops
float distToDeerclops = distance(anchorPoint, worldUV);
// And get the correct opacity based on it.
float opacity = InverseLerp(0, maxRadius, distToDeerclops);
// Define the border and mix the shadow and light for a smoother transition
bool border = worldDistance < minRadius && opacity > 0;
float colorMult = 1;
if (worldDistance > minRadius && worldDistance < maxRadius)
opacity = lerp(opacity, maxOpacity, InverseLerp(minRadius, maxRadius, distToDeerclops));
opacity = clamp(opacity, 0, maxOpacity);
if (border)
{
colorMult = InverseLerp(minRadius * 0.94, minRadius, worldDistance);
}
// If the color multi has not been changed (not border pixel) and opacity is 0 OR it's within
if (colorMult == 1 && (opacity == 0 || worldDistance < minRadius))
return sampleColor;
return float4(0, 0, 0, 1) * colorMult * opacity;
}
technique Technique1
{
pass ShadowPass
{
PixelShader = compile ps_2_0 PixelShaderFunction();
}
}
Binary file not shown.
@@ -0,0 +1,94 @@
sampler diagonalNoise : register(s1);
sampler upwardNoise : register(s2);
sampler upwardPerlinTex : register(s3);
bool day;
float colorMult;
float time;
float radius;
float maxOpacity;
float burnIntensity;
float2 screenPosition;
float2 screenSize;
float2 anchorPoint;
float2 playerPosition;
float InverseLerp(float a, float b, float t)
{
return saturate((t - a) / (b - a));
}
float3 firePalette(float noise)
{
// Temperature range (in Kelvin).
float temperature = 1500. + 1500. * noise;
float3 darkColor = float3(0.81, 0.45, 0.23) * colorMult;
float3 midColor = float3(1., 0.75, 0.29) * colorMult;
float3 brightColor = float3(1., 1., 0.95) * colorMult;
if (!day)
{
darkColor.rgb = darkColor.bgr;
midColor.rgb = midColor.bgr;
brightColor.rgb = brightColor.bgr;
}
float3 fireColor;
if (noise < 0.5)
fireColor = lerp(darkColor, midColor, noise * 2.);
else
fireColor = lerp(midColor, brightColor, (noise - 0.5) * 2.);
fireColor = pow(fireColor, float3(5, 5, 5)) * (exp(1.43876719683e5 / (temperature * fireColor)) - 1.);
// Exposure level. Set to "50." For "70," change the "5" to a "7," etc.
return 1. - exp(-1.3e8 / fireColor);
}
float4 PixelShaderFunction(float4 sampleColor : COLOR0, float2 uv : TEXCOORD0) : COLOR0
{
float2 worldUV = screenPosition + screenSize * uv;
float2 provUV = anchorPoint / screenSize;
float worldDistance = distance(worldUV, anchorPoint);
float adjustedTime = time * 0.1;
// Pixelate the uvs
float2 pixelatedUV = worldUV / screenSize;
pixelatedUV.x -= worldUV.x % (1 / screenSize.x);
pixelatedUV.y -= worldUV.y % (1 / (screenSize.y / 2) * 2);
// Sample the noise textures
float noiseMesh1 = tex2D(upwardNoise, frac(pixelatedUV * 0.58 + float2(0, time * 0.25))).g;
float noiseMesh2 = tex2D(upwardPerlinTex, frac(pixelatedUV * 1.57 + float2(0, time * 0.35))).g;
float noiseMesh3 = tex2D(diagonalNoise, frac(pixelatedUV * 1.46 + float2(adjustedTime * 0.56, adjustedTime * 1.2))).g;
float noiseMesh4 = tex2D(diagonalNoise, frac(pixelatedUV * 1.57 + float2(adjustedTime * -0.56, adjustedTime * 1.2))).g;
float textureMesh = noiseMesh1 * 0.125 + noiseMesh2 * 0.2 + noiseMesh3 * 0.35 + noiseMesh4 * 0.35;
// Get the distance to the pixel from the player.
float distToPlayer = distance(playerPosition, worldUV);
// And get the correct opacity based on it.
float opacity = burnIntensity;
// Fade in quickly as the player approaches the pixels
opacity += InverseLerp(800, 500, distToPlayer);
// Define the border and mix the inferno for a smooth transition
bool border = worldDistance < radius && opacity > 0;
float colorMult = 1;
if (border)
colorMult = InverseLerp(radius * 0.94, radius, worldDistance);
opacity = clamp(opacity, 0, maxOpacity);
// If the color multi has not been changed (not border pixel) and opacity is 0 OR it's within
if (colorMult == 1 && (opacity == 0 || worldDistance < radius))
return sampleColor;
return float4(firePalette(textureMesh), 1) * colorMult * opacity;
}
technique Technique1
{
pass InfernoPass
{
PixelShader = compile ps_3_0 PixelShaderFunction();
}
}
Binary file not shown.
+57
View File
@@ -0,0 +1,57 @@
sampler uImage0 : register(s0);
sampler uImage1 : register(s1);
float3 uColor;
float3 uSecondaryColor;
float uOpacity;
float uSaturation;
float uRotation;
float uTime;
float4 uSourceRect;
float2 uWorldPosition;
float uDirection;
float3 uLightSource;
float2 uImageSize0;
float2 uImageSize1;
matrix uWorldViewProjection;
float4 uShaderSpecificData;
struct VertexShaderInput
{
float4 Position : POSITION0;
float4 Color : COLOR0;
float2 TextureCoordinates : TEXCOORD0;
};
struct VertexShaderOutput
{
float4 Position : SV_POSITION;
float4 Color : COLOR0;
float2 TextureCoordinates : TEXCOORD0;
};
VertexShaderOutput VertexShaderFunction(in VertexShaderInput input)
{
VertexShaderOutput output = (VertexShaderOutput) 0;
float4 pos = mul(input.Position, uWorldViewProjection);
output.Position = pos;
output.Color = input.Color;
output.TextureCoordinates = input.TextureCoordinates;
return output;
}
// Returns the direct output from the primitive's specified color value. Nothing fancy.
float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0
{
return input.Color;
}
technique Technique1
{
pass PrimitivePass
{
VertexShader = compile vs_2_0 VertexShaderFunction();
PixelShader = compile ps_2_0 PixelShaderFunction();
}
}
Binary file not shown.
+74
View File
@@ -0,0 +1,74 @@
sampler uImage0 : register(s0);
sampler uImage1 : register(s1);
float3 uColor;
float3 uSecondaryColor;
float uOpacity : register(C0);
float uSaturation;
float uRotation;
float uTime;
float4 uSourceRect;
float2 uWorldPosition;
float uDirection;
float3 uLightSource;
float2 uImageSize0;
float2 uImageSize1;
float4 uShaderSpecificData;
// Cosine does not work in shaders in Terraria 1.4. It returns incredibly corrupted values and nobody is sure why.
// This reimplements cosine using trigonometric identities.
//
// Discovery of malfunctioning cosine attributed to ScalarVector from SLR:
// https://discord.com/channels/103110554649894912/445276626352209920/979928448300634175
float realCos(float value)
{
return sin(value + 1.57079);
}
//Shader overall based on Ozzatron's miracle blight shader. slightly edited for a different use case.
float4 PixelShaderFunction(float2 coords : TEXCOORD0) : COLOR0
{
float4 color = tex2D(uImage0, coords);
if (!any(color))
return color;
// Framed coordinates -- a UV of the Projectile's current framed sprite, instead of the whole sheet
float2 framedCoords = (coords * uImageSize0 - uSourceRect.xy) / uSourceRect.zw;
// Temporal drift to make the sprite slide through the noise texture
float2 drift = float2(5 * sin(4 * uTime), 220 * -uTime);
float2 noiseMapTexCoords = framedCoords * uSourceRect.zw + drift;
float4 noiseColor = tex2D(uImage1, noiseMapTexCoords / uImageSize1);
// Define thresholds for total pixel erasure and glowing lines.
//
// Rapidly flickering sinewave produced by Desmos, loosely based on the Weierstrass function
// (infinitely sharp vague sinewave, periodic, continuous everywhere but differentiable nowhere)
// https://en.wikipedia.org/wiki/Weierstrass_function
float flickerOne = 0.05 * realCos(7 * uTime);
float flickerTwo = 0.06 * realCos(31 * uTime);
float flickerThree = 0.04 * sin(167 * uTime);
float fullErasureThreshold = uOpacity + flickerOne + flickerTwo + flickerThree;
float glowThreshold = fullErasureThreshold - 0.3;
// If the noise over the erasure threshold, completely erase this pixel.
if (noiseColor.r > fullErasureThreshold)
{
color.rgba = 0;
}
// Otherwise, if it's over the slightly lower threshold, change the opacity relative to how close it was to erasure
else if (noiseColor.r > glowThreshold)
{
color.rgba = color.rgba * (1 - ((noiseColor.r - glowThreshold) / (fullErasureThreshold - glowThreshold)));
}
return color;
}
technique Technique1
{
pass WavyOpacityPass
{
PixelShader = compile ps_2_0 PixelShaderFunction();
}
}
Binary file not shown.
+12 -7
View File
@@ -442,13 +442,6 @@ namespace CalamityMod.Events
{
CalamityUtils.KillAllHostileProjectiles();
HostileProjectileKillCounter = 3;
// Mark Boss Rush as complete
DownedBossSystem.downedBossRush = true;
CalamityNetcode.SyncWorld();
if (Main.netMode != NetmodeID.MultiplayerClient)
Projectile.NewProjectile(Source, npc.Center, Vector2.Zero, ModContent.ProjectileType<BossRushEndEffectThing>(), 0, 0f, Main.myPlayer);
}
};
}
@@ -744,7 +737,19 @@ namespace CalamityMod.Events
HostileProjectileKillCounter = 3;
if (BossDeathEffects.ContainsKey(npc.type))
{
BossDeathEffects[npc.type].Invoke(npc);
}
if (npc.type == Bosses[Bosses.Count -1].EntityID)
{
// Mark Boss Rush as complete
DownedBossSystem.downedBossRush = true;
CalamityNetcode.SyncWorld();
if (Main.netMode != NetmodeID.MultiplayerClient)
Projectile.NewProjectile(Source, npc.Center, Vector2.Zero, ModContent.ProjectileType<BossRushEndEffectThing>(), 0, 0f, Main.myPlayer);
}
}
// Sync the stage and progress of Boss Rush whenever a relevant boss dies.
+5
View File
@@ -1,4 +1,5 @@
using CalamityMod.CalPlayer;
using CalamityMod.Items.Potions.Alcohol;
using CalamityMod.Particles;
using CalamityMod.Projectiles.Typeless;
using Microsoft.Xna.Framework;
@@ -27,6 +28,7 @@ namespace CalamityMod.ExtraJumps
int offset = player.height;
if (player.gravDir == -1f)
offset = 0;
for (int i = 0; i < 25; ++i)
{
Dust dust = Dust.NewDustPerfect(new Vector2(player.Center.X, player.Center.Y + offset), Main.rand.NextBool(3) ? 75 : 161, new Vector2(-player.velocity.X, 6).RotatedByRandom(MathHelper.ToRadians(50f)) * Main.rand.NextFloat(0.1f, 0.8f), 100, default, Main.rand.NextFloat(1.7f, 2.2f));
@@ -45,6 +47,9 @@ namespace CalamityMod.ExtraJumps
{
var source = player.GetSource_Misc("0");
int damage = (int)player.GetTotalDamage<RogueDamageClass>().ApplyTo(20);
if (modPlayer.oldFashioned)
damage = CalamityUtils.CalcOldFashionedDamage(damage);
int bubble = Projectile.NewProjectile(source, new Vector2(player.position.X, player.position.Y + (player.gravDir == -1f ? 20 : -20)), Vector2.Zero, ModContent.ProjectileType<SulphuricAcidBubbleFriendly>(), damage, 0f, player.whoAmI, 1f, 0f);
if (bubble.WithinBounds(Main.maxProjectiles))
Main.projectile[bubble].DamageType = DamageClass.Generic;
Binary file not shown.

After

Width:  |  Height:  |  Size: 383 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 285 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 325 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 327 KiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 300 B

After

Width:  |  Height:  |  Size: 300 B

+16 -17
View File
@@ -1,5 +1,7 @@
using System;
using CalamityMod.Effects;
using CalamityMod.Graphics;
using CalamityMod.NPCs.TownNPCs;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
@@ -12,11 +14,11 @@ namespace CalamityMod.FluidSimulation
// Please do not change this system too much without contacting me first. -Dominic
public class FluidField : IDisposable
{
internal RenderTarget2D TemporaryAuxilaryTarget;
internal ManagedRenderTarget TemporaryAuxilaryTarget;
internal RenderTarget2D DivergenceField;
internal ManagedRenderTarget DivergenceField;
internal RenderTarget2D DivergencePoissonField;
internal ManagedRenderTarget DivergencePoissonField;
internal FluidFieldState VelocityField;
@@ -24,7 +26,7 @@ namespace CalamityMod.FluidSimulation
internal FluidFieldState ColorField;
internal RenderTarget2D OutputTarget;
internal ManagedRenderTarget OutputTarget;
public float Viscosity;
@@ -70,6 +72,10 @@ namespace CalamityMod.FluidSimulation
}
}
// A surface format of Vector4 is used here to allow for both 0-1 ranged colors and other things at the same time.
public RenderTarget2D FluidCreateCondition(int screen, int height) =>
new(Main.instance.GraphicsDevice, Size, Size, true, SurfaceFormat.Vector4, DepthFormat.Depth24, 0, RenderTargetUsage.PreserveContents);
internal FluidField(int size, float scale, float viscosity, float diffusionFactor, float dissipationFactor)
{
Size = size;
@@ -82,13 +88,12 @@ namespace CalamityMod.FluidSimulation
DensityField = new(size);
ColorField = new(size);
// A surface format of Vector4 is used here to allow for both 0-1 ranged colors and other things at the same time.
TemporaryAuxilaryTarget = new(Main.instance.GraphicsDevice, Size, Size, true, SurfaceFormat.Vector4, DepthFormat.Depth24, 0, RenderTargetUsage.PreserveContents);
TemporaryAuxilaryTarget = new(false, FluidCreateCondition, false);
DivergenceField = new(Main.instance.GraphicsDevice, Size, Size, true, SurfaceFormat.Vector4, DepthFormat.Depth24, 0, RenderTargetUsage.PreserveContents);
DivergencePoissonField = new(Main.instance.GraphicsDevice, Size, Size, true, SurfaceFormat.Vector4, DepthFormat.Depth24, 0, RenderTargetUsage.PreserveContents);
DivergenceField = new(false, FluidCreateCondition, false);
DivergencePoissonField = new(false, FluidCreateCondition, false);
OutputTarget = new(Main.instance.GraphicsDevice, Size, Size, true, SurfaceFormat.Color, DepthFormat.Depth24, 0, RenderTargetUsage.PreserveContents);
OutputTarget = new(false, FluidCreateCondition, false);
}
internal void ApplyThingToTarget(RenderTarget2D currentField, Action shaderPreparationsAction)
@@ -293,13 +298,7 @@ namespace CalamityMod.FluidSimulation
FluidFieldManager.Fields.Remove(this);
Disposing = true;
TemporaryAuxilaryTarget?.Dispose();
DivergenceField?.Dispose();
DivergencePoissonField?.Dispose();
VelocityField?.Dispose();
ColorField?.Dispose();
DensityField?.Dispose();
OutputTarget?.Dispose();
GC.SuppressFinalize(this);
}
public void CreateSource(int x, int y, float density, Color color, Vector2 velocity)
@@ -326,7 +325,7 @@ namespace CalamityMod.FluidSimulation
shaderPreparations?.Invoke(OutputTarget);
Main.spriteBatch.Draw(OutputTarget, drawPosition, null, Color.White, 0f, OutputTarget.Size() * 0.5f, Scale, 0, 0f);
Main.spriteBatch.Draw(OutputTarget, drawPosition, null, Color.White, 0f, OutputTarget.Size * 0.5f, Scale, 0, 0f);
Main.spriteBatch.End();
if (needsToCallEnd)
+16 -12
View File
@@ -1,5 +1,5 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using CalamityMod.Graphics;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
@@ -7,29 +7,33 @@ using Terraria.ID;
namespace CalamityMod.FluidSimulation
{
// Calculations for these are done primarily on the GPU in shaders for performance-sake.
public class FluidFieldState : IDisposable
public class FluidFieldState
{
public RenderTarget2D PreviousState;
public ManagedRenderTarget PreviousState;
public RenderTarget2D NextState;
public ManagedRenderTarget NextState;
public Queue<PixelQueueValue> PendingChanges = new();
public void Dispose()
{
PreviousState?.Dispose();
NextState?.Dispose();
}
public readonly int Size;
public readonly SurfaceFormat FieldContents;
public void SwapState() => Utils.Swap(ref PreviousState, ref NextState);
public RenderTarget2D FieldColorCreateCondition(int screen, int height) =>
new(Main.instance.GraphicsDevice, Size, Size, true, FieldContents, DepthFormat.Depth24, 0, RenderTargetUsage.PreserveContents);
public FluidFieldState(int size, SurfaceFormat fieldContents = SurfaceFormat.Color)
{
if (Main.netMode == NetmodeID.Server)
return;
PreviousState = new(Main.instance.GraphicsDevice, size, size, true, fieldContents, DepthFormat.Depth24, 0, RenderTargetUsage.PreserveContents);
NextState = new(Main.instance.GraphicsDevice, size, size, true, fieldContents, DepthFormat.Depth24, 0, RenderTargetUsage.PreserveContents);
Size = size;
FieldContents = fieldContents;
PreviousState = new(false, FieldColorCreateCondition, false);
NextState = new(false, FieldColorCreateCondition, false);
}
}
}
+24 -24
View File
@@ -28,52 +28,52 @@ namespace CalamityMod.Gores
{
gore.alpha = 100;
}
int num = 4;
int goreFrameDelay = 4;
gore.frameCounter++;
if (gore.frame <= 4)
{
int num2 = (int)(gore.position.X / 16f);
int num3 = (int)(gore.position.Y / 16f) - 1;
if (WorldGen.InWorld(num2, num3, 0) && !Main.tile[num2, num3].HasTile)
int goreXPos = (int)(gore.position.X / 16f);
int goreYPos = (int)(gore.position.Y / 16f) - 1;
if (WorldGen.InWorld(goreXPos, goreYPos, 0) && !Main.tile[goreXPos, goreYPos].HasTile)
{
gore.active = false;
}
if (gore.frame == 0)
{
num = 24 + Main.rand.Next(256);
goreFrameDelay = 24 + Main.rand.Next(256);
}
if (gore.frame == 1)
{
num = 24 + Main.rand.Next(256);
goreFrameDelay = 24 + Main.rand.Next(256);
}
if (gore.frame == 2)
{
num = 24 + Main.rand.Next(256);
goreFrameDelay = 24 + Main.rand.Next(256);
}
if (gore.frame == 3)
{
num = 24 + Main.rand.Next(96);
goreFrameDelay = 24 + Main.rand.Next(96);
}
if (gore.frame == 5)
{
num = 16 + Main.rand.Next(64);
goreFrameDelay = 16 + Main.rand.Next(64);
}
if ((int)gore.frameCounter >= num)
if ((int)gore.frameCounter >= goreFrameDelay)
{
gore.frameCounter = 0;
gore.frame += 1;
if (gore.frame == 5 && Main.netMode != NetmodeID.Server)
{
int num4 = Gore.NewGore(new EntitySource_Misc("0"), gore.position, gore.velocity, gore.type, 1f);
Main.gore[num4].frame = 9;
Main.gore[num4].velocity *= 0f;
int astralWater = Gore.NewGore(new EntitySource_Misc("0"), gore.position, gore.velocity, gore.type, 1f);
Main.gore[astralWater].frame = 9;
Main.gore[astralWater].velocity *= 0f;
}
}
}
else if (gore.frame <= 6)
{
num = 8;
if ((int)gore.frameCounter >= num)
goreFrameDelay = 8;
if ((int)gore.frameCounter >= goreFrameDelay)
{
gore.frameCounter = 0;
gore.frame += 1;
@@ -85,7 +85,7 @@ namespace CalamityMod.Gores
}
else if (gore.frame <= 9)
{
num = 6;
goreFrameDelay = 6;
gore.velocity.Y += 0.2f;
if ((double)gore.velocity.Y < 0.5)
{
@@ -95,7 +95,7 @@ namespace CalamityMod.Gores
{
gore.velocity.Y = 12f;
}
if ((int)gore.frameCounter >= num)
if ((int)gore.frameCounter >= goreFrameDelay)
{
gore.frameCounter = 0;
gore.frame += 1;
@@ -108,7 +108,7 @@ namespace CalamityMod.Gores
else
{
gore.velocity.Y += 0.1f;
if ((int)gore.frameCounter >= num)
if ((int)gore.frameCounter >= goreFrameDelay)
{
gore.frameCounter = 0;
gore.frame += 1;
@@ -120,9 +120,9 @@ namespace CalamityMod.Gores
}
}
Vector2 value3 = gore.velocity;
Vector2 goreVelCheck = gore.velocity;
gore.velocity = Collision.TileCollision(gore.position, gore.velocity, 16, 14, false, false, 1);
if (gore.velocity != value3)
if (gore.velocity != goreVelCheck)
{
if (gore.frame < 10)
{
@@ -146,12 +146,12 @@ namespace CalamityMod.Gores
}
((WaterShaderData)Filters.Scene["WaterDistortion"].GetShader()).QueueRipple(gore.position + new Vector2(8f, 8f), 1f, RippleShape.Square, 0f);
}
int num21 = (int)(gore.position.X + 8f) / 16;
int num22 = (int)(gore.position.Y + 14f) / 16;
if (Main.tile[num21, num22] != null && Main.tile[num21, num22].LiquidAmount > 0)
int goreTileX = (int)(gore.position.X + 8f) / 16;
int goreTileY = (int)(gore.position.Y + 14f) / 16;
if (Main.tile[goreTileX, goreTileY] != null && Main.tile[goreTileX, goreTileY].LiquidAmount > 0)
{
gore.velocity *= 0f;
gore.position.Y = (float)(num22 * 16 - (int)(Main.tile[num21, num22].LiquidAmount / 16));
gore.position.Y = (float)(goreTileY * 16 - (int)(Main.tile[goreTileX, goreTileY].LiquidAmount / 16));
}
}
+71
View File
@@ -0,0 +1,71 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace CalamityMod.Graphics.Drawers
{
/// <summary>
/// A class to handle drawing a visual effect to a rendertarget, then drawing the target to the screen at selected layer.
/// </summary>
public abstract class BaseDrawer
{
#region Fields/Properties
/// <summary>
/// The layer that the target should be drawn at.
/// </summary>
public abstract DrawerLayer Layer { get; }
/// <summary>
/// Whether the target should draw and be drawn to this frame.
/// </summary>
public abstract bool ShouldDraw { get; }
/// <summary>
/// The target that the visual is drawn to. Automatically handled.
/// </summary>
public ManagedRenderTarget MainTarget
{
get;
private set;
}
#endregion
#region Methods
public void Load()
{
MainTarget = new(true, ManagedRenderTarget.CreateScreenSizedTarget);
OnLoad();
}
/// <summary>
/// Called on mod load.
/// </summary>
public virtual void OnLoad()
{
}
/// <summary>
/// Called on mod unload.
/// </summary>
public virtual void OnUnload()
{
}
/// <summary>
/// Draw whatever needed to the target here.
/// </summary>
/// <param name="spriteBatch"></param>
public abstract void DrawToTarget(SpriteBatch spriteBatch);
/// <summary>
/// Draw the target here. By default, just draws the target.
/// </summary>
/// <param name="spriteBatch"></param>
public virtual void DrawTarget(SpriteBatch spriteBatch)
{
spriteBatch.Draw(MainTarget, Vector2.Zero, Color.White);
}
#endregion
}
}
+69
View File
@@ -0,0 +1,69 @@
using CalamityMod.NPCs.VanillaNPCOverrides.Bosses;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.GameContent;
using Terraria.Graphics.Shaders;
using Rectangle = Microsoft.Xna.Framework.Rectangle;
namespace CalamityMod.Graphics.Drawers
{
public class DeerclopsShadowDrawer : BaseDrawer
{
#region Fields/Properties
public override DrawerLayer Layer => DrawerLayer.AfterEverything;
public NPC deerclops => Main.npc[NPC.deerclopsBoss];
//Should only draw if not in the main menu, deerclops is active or the border is fading post-death,
//it's rev+ and the boolean for drawing the border is true.
public override bool ShouldDraw => !Main.gameMenu && DeerclopsAI.borderScalar > 0f && DeerclopsAI.shouldDrawEnrageBorder;
#endregion
#region Methods
public override void DrawToTarget(SpriteBatch spriteBatch)
{
bool shouldDraw;
bool deerclopsInactive = false;
if (NPC.deerclopsBoss >= 0 && NPC.deerclopsBoss.WithinBounds(Main.npc.Length))
shouldDraw = deerclops.HasValidTarget;
else
{
shouldDraw = DeerclopsAI.borderScalar > 0f;
deerclopsInactive = true;
}
if (shouldDraw)
{
var minRadius = DeerclopsAI.innerBorder;
var maxRadius = DeerclopsAI.outerBorder;
//Begin drawing the shadow
var blackTile = TextureAssets.MagicPixel;
var shader = GameShaders.Misc["CalamityMod:DeerclopsShadowShader"].Shader;
shader.Parameters["minRadius"].SetValue(minRadius);
shader.Parameters["maxRadius"].SetValue(maxRadius);
shader.Parameters["anchorPoint"].SetValue(DeerclopsAI.lastDeerclopsPosition);
shader.Parameters["screenPosition"].SetValue(Main.screenPosition);
shader.Parameters["screenSize"].SetValue(Main.ScreenSize.ToVector2());
shader.Parameters["maxOpacity"].SetValue(DeerclopsAI.borderScalar);
spriteBatch.EnterShaderRegion(BlendState.NonPremultiplied, shader);
Rectangle rekt = new(Main.screenWidth / 2, Main.screenHeight / 2, Main.screenWidth, Main.screenHeight);
spriteBatch.Draw(blackTile.Value, rekt, null, default, 0f, blackTile.Value.Size() * 0.5f, 0, 0f);
//Shadow drawing complete
spriteBatch.ExitShaderRegion();
}
if (deerclopsInactive)
{
//Push the border away and fade out when deerclops is deadge
DeerclopsAI.borderScalar = MathHelper.Clamp(DeerclopsAI.borderScalar - 0.015f, 0f, 1f);
DeerclopsAI.innerBorder += 30f;
DeerclopsAI.outerBorder += 30f;
}
}
#endregion
}
}
+11
View File
@@ -0,0 +1,11 @@
namespace CalamityMod.Graphics.Drawers
{
public enum DrawerLayer
{
AfterEverything,
BeforeTiles,
NPC,
Player,
Projectile
}
}
+186
View File
@@ -0,0 +1,186 @@
using System;
using System.Collections.Generic;
using System.Linq;
using log4net.Util;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Graphics.Drawers
{
public class DrawerManager : ModSystem
{
#region Fields/Properties
public static List<BaseDrawer> Drawers
{
get;
private set;
}
#endregion
#region Loading
public override void Load()
{
if (Main.netMode == NetmodeID.Server)
return;
Drawers = new();
Main.QueueMainThreadAction(() =>
{
// This hooks here, because doing it any sooner causes the screen position to be a frame behind.
On_Main.CheckMonoliths += DrawToTargets;
On_Main.DrawNPCs += DrawNPCDrawers;
On_Main.DrawProjectiles += DrawProjectileDrawers;
On_Main.DrawPlayers_AfterProjectiles += DrawPlayerDrawers;
On_Main.DrawBackgroundBlackFill += DrawBeforeTileDrawers;
On_Main.DrawInfernoRings += DrawAfterEverythingDrawers;
var drawerType = typeof(BaseDrawer);
foreach (var type in Mod.Code.GetTypes())
{
if (!type.IsAbstract && type.IsSubclassOf(drawerType))
{
var drawer = Activator.CreateInstance(type) as BaseDrawer;
drawer.Load();
Drawers.Add(drawer);
}
}
});
}
public override void Unload()
{
if (Main.netMode == NetmodeID.Server)
return;
Main.QueueMainThreadAction(() =>
{
// Supposed to be auto-unloaded, but considering TMods poor track record with actually doing this, manually unload them.
On_Main.CheckMonoliths -= DrawToTargets;
On_Main.DrawNPCs -= DrawNPCDrawers;
On_Main.DrawProjectiles -= DrawProjectileDrawers;
On_Main.DrawPlayers_AfterProjectiles -= DrawPlayerDrawers;
On_Main.DrawBackgroundBlackFill -= DrawBeforeTileDrawers;
On_Main.DrawInfernoRings -= DrawAfterEverythingDrawers;
foreach (var drawer in Drawers)
drawer.OnUnload();
Drawers = null;
});
}
#endregion
#region Drawing
private void DrawToTargets(On_Main.orig_CheckMonoliths orig)
{
orig();
if (Main.gameMenu)
return;
foreach (var drawer in Drawers)
{
if (!drawer.ShouldDraw)
continue;
drawer.MainTarget.SwapTo(Color.Transparent);
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
drawer.DrawToTarget(Main.spriteBatch);
Main.spriteBatch.End();
}
Main.instance.GraphicsDevice.SetRenderTarget(null);
}
private void DrawNPCDrawers(On_Main.orig_DrawNPCs orig, Main self, bool behindTiles)
{
orig(self, behindTiles);
if (behindTiles)
return;
var drawers = Drawers.Where(drawer => drawer.ShouldDraw && drawer.Layer is DrawerLayer.NPC);
Main.spriteBatch.End();
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer);
foreach (var drawer in drawers)
drawer.DrawTarget(Main.spriteBatch);
Main.spriteBatch.ExitShaderRegion();
}
private void DrawProjectileDrawers(On_Main.orig_DrawProjectiles orig, Main self)
{
orig(self);
var drawers = Drawers.Where(drawer => drawer.ShouldDraw && drawer.Layer is DrawerLayer.Projectile);
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer);
foreach (var drawer in drawers)
drawer.DrawTarget(Main.spriteBatch);
Main.spriteBatch.End();
}
private void DrawPlayerDrawers(On_Main.orig_DrawPlayers_AfterProjectiles orig, Main self)
{
orig(self);
var drawers = Drawers.Where(drawer => drawer.ShouldDraw && drawer.Layer is DrawerLayer.Player);
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer);
foreach (var drawer in drawers)
drawer.DrawTarget(Main.spriteBatch);
Main.spriteBatch.End();
}
private void DrawBeforeTileDrawers(On_Main.orig_DrawBackgroundBlackFill orig, Main self)
{
var drawers = Drawers.Where(drawer => drawer.ShouldDraw && drawer.Layer is DrawerLayer.BeforeTiles);
Main.spriteBatch.End();
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer);
foreach (var drawer in drawers)
drawer.DrawTarget(Main.spriteBatch);
Main.spriteBatch.End();
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.Transform);
orig(self);
}
private void DrawAfterEverythingDrawers(On_Main.orig_DrawInfernoRings orig, Main self)
{
var drawers = Drawers.Where(drawer => drawer.ShouldDraw && drawer.Layer is DrawerLayer.AfterEverything);
Main.spriteBatch.End();
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer);
foreach (var drawer in drawers)
drawer.DrawTarget(Main.spriteBatch);
Main.spriteBatch.End();
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.Transform);
orig(self);
}
#endregion
#region Misc Methods
public static T GetDrawer<T>() where T : BaseDrawer
{
if (!Drawers.Any())
return null;
return Drawers.First(drawer => drawer.GetType() == typeof(T)) as T;
}
#endregion
}
}
+77
View File
@@ -0,0 +1,77 @@
using CalamityMod.NPCs;
using CalamityMod.NPCs.Providence;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.GameContent;
using Terraria.Graphics.Shaders;
using Terraria.ModLoader;
using Rectangle = Microsoft.Xna.Framework.Rectangle;
namespace CalamityMod.Graphics.Drawers
{
public class HolyInfernoDrawer : BaseDrawer
{
#region Fields/Properties
public override DrawerLayer Layer => DrawerLayer.BeforeTiles;
public Providence Provi => (Main.npc[CalamityGlobalNPC.holyBoss].ModNPC as Providence);
//Should only draw if not in the main menu, provi is active and the boolean for drawing the border is true.
public override bool ShouldDraw => !Main.gameMenu && CalamityGlobalNPC.holyBoss != -1 &&
Main.npc[CalamityGlobalNPC.holyBoss].active && Providence.shouldDrawInfernoBorder;
#endregion
#region Methods
public override void DrawToTarget(SpriteBatch spriteBatch)
{
var npc = Main.npc[CalamityGlobalNPC.holyBoss];
var borderDistance = Providence.borderRadius;
if (npc.HasValidTarget)
{
var target = Main.player[Main.myPlayer];
var holyInfernoIntensity = target.Calamity().holyInfernoFadeIntensity;
var prov = Provi;
//Begin drawing the inferno
var blackTile = TextureAssets.MagicPixel;
var diagonalNoise = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/GreyscaleGradients/HarshNoise");
var upwardPerlinNoise = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/GreyscaleGradients/Perlin");
var upwardNoise = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/GreyscaleGradients/MeltyNoise");
var maxOpacity = 1f;
if (prov.Dying)
{
//Death animation timer ends at 345f.
maxOpacity = MathHelper.Lerp(1f, 0f, Utils.GetLerpValue(0f, 344f, prov.DeathAnimationTimer));
}
var shader = GameShaders.Misc["CalamityMod:HolyInfernoShader"].Shader;
shader.Parameters["colorMult"].SetValue(Main.dayTime ? 7.35f : 7.65f); //I want you to know it took considerable restraint to deliberately misspell colour.
shader.Parameters["time"].SetValue(Main.GlobalTimeWrappedHourly);
shader.Parameters["radius"].SetValue(borderDistance);
shader.Parameters["anchorPoint"].SetValue(npc.Center);
shader.Parameters["screenPosition"].SetValue(Main.screenPosition);
shader.Parameters["screenSize"].SetValue(Main.ScreenSize.ToVector2());
shader.Parameters["burnIntensity"].SetValue(holyInfernoIntensity);
shader.Parameters["playerPosition"].SetValue(target.Center);
shader.Parameters["maxOpacity"].SetValue(maxOpacity);
shader.Parameters["day"].SetValue(Main.dayTime);
spriteBatch.GraphicsDevice.Textures[1] = diagonalNoise.Value;
spriteBatch.GraphicsDevice.Textures[2] = upwardNoise.Value;
spriteBatch.GraphicsDevice.Textures[3] = upwardPerlinNoise.Value;
//Manual end begin for the sampler state
spriteBatch.End();
spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, SamplerState.LinearWrap, DepthStencilState.None, Main.Rasterizer, shader, Main.GameViewMatrix.TransformationMatrix);
Rectangle rekt = new(Main.screenWidth / 2, Main.screenHeight / 2, Main.screenWidth, Main.screenHeight);
spriteBatch.Draw(blackTile.Value, rekt, null, default, 0f, blackTile.Value.Size() * 0.5f, 0, 0f);
//Inferno drawing complete
spriteBatch.ExitShaderRegion();
}
}
#endregion
}
}
+93
View File
@@ -0,0 +1,93 @@
using System.Collections.Generic;
using CalamityMod.NPCs.ExoMechs.Ares;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.Graphics.Shaders;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Graphics.Drawers
{
public class MiracleBlightDrawer : BaseDrawer
{
#region Fields/Properties
/// <summary>
/// Add NPCs to this if they break with the miracle blight shader.
/// </summary>
public static List<int> ExcludedNPCs => new()
{
// List the reason why the NPC(s) are excluded :)
// The particle sets break with the visuals and this is the easiest way to fix this that isn't stupidly complex.
ModContent.NPCType<AresBody>(),
ModContent.NPCType<AresGaussNuke>(),
ModContent.NPCType<AresLaserCannon>(),
ModContent.NPCType<AresPlasmaFlamethrower>(),
ModContent.NPCType<AresTeslaCannon>(),
// Breaks with being behind tiles, and causes a funny interaction where his head goes behind his neck.
NPCID.MoonLordCore,
NPCID.MoonLordHand,
NPCID.MoonLordHead
};
/// <summary>
/// Used to determine whether the npc should return true in predraw or not, for exclusively drawing to the drawer target.
/// </summary>
public static bool ActuallyDoPreDraw
{
get;
private set;
}
public override DrawerLayer Layer => DrawerLayer.NPC;
// Unsure whether its more performant to always draw, or to check if any NPC actually has the debuff.
public override bool ShouldDraw => true;
#endregion
#region Methods
// Only draw if:
// - A Vanilla or Calamity NPC OR another mod's non boss npc.
// - The NPC is active.
// - The NPC has miracle blight.
// - The current player does not have the shrooms effect.
// - The current NPC isnt in an excluded list of NPCs.
// - The current NPC does not have the polarity effect.
// If this seems really excessive, it's because global complex effects like this are a pain in the ass to implement without having a million
// broken edge cases.
public static bool ValidToDraw(NPC npc) =>
(npc.ModNPC == null || npc.ModNPC.Mod == CalamityMod.Instance || !npc.boss) && npc.active && npc.Calamity().miracleBlight > 0
&& !(Main.LocalPlayer.Calamity().trippy && !npc.IsABestiaryIconDummy) && !ExcludedNPCs.Contains(npc.type) && npc.PolarityNPC().CurPolarity == 0;
public override void DrawToTarget(SpriteBatch spriteBatch)
{
// Indicate that NPCs with miracle blight should draw.
ActuallyDoPreDraw = true;
// Draw every npc to a single target that should have the miracle blight visual.
foreach (NPC npc in Main.npc)
{
if (ValidToDraw(npc))
Main.instance.DrawNPC(npc.whoAmI, npc.behindTiles);
}
// Indicate that NPCs with miracle blight should no longer draw.
ActuallyDoPreDraw = false;
}
public override void DrawTarget(SpriteBatch spriteBatch)
{
// Apply the shader and draw the target.
MiscShaderData blightShader = GameShaders.Misc["CalamityMod:MiracleBlight"];
blightShader.SetShaderTexture(ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/GreyscaleGradients/Neurons"), 1);
blightShader.UseOpacity(0.7f);
blightShader.Shader.Parameters["uWorldPosition"]?.SetValue(Main.screenPosition);
blightShader.Apply();
Main.spriteBatch.Draw(MainTarget, Vector2.Zero, Color.White);
}
#endregion
}
}
Loaded 100 of 1908 files, more files were not shown because too many files have changed in this diff. Show more