1 - Reverted Fargo's based shield iframe exploit fix and replaced it with an actual bugfix instead of a rewrite.
2 - Made the application of all immunity frames consistent with vanilla rules. 3 - Added balancing constants and utility helper functions for all immunity frame calculations. 4 - Buffed many dodges, reflects, and other dodge-like effects to benefit from Cross Necklace like vanilla dodges. 5 - Permafrost's Concoction now is buffed by Cross Necklace. 6 - Significantly buffed the immunity frames granted by Spectral Veil and all reflects by making them consistent with vanilla. 7 - Significantly buffed the immunity frames granted by Ark line parries by making them consistent with vanilla.
This commit is contained in:
1 parent
879fc6ddcb
commit
430ba4bcbe
27 files changed
+291
-96
No files matched your search
@@ -18,6 +18,18 @@
|
||||
internal const float BalloonJumpSpeedBoost = 0.75f;
|
||||
#endregion
|
||||
|
||||
#region Immunity Frames
|
||||
// Default immunity frame rules
|
||||
internal const int VanillaDefaultIFrames = 40;
|
||||
internal const int VanillaParryIFrames = 60;
|
||||
internal const int VanillaDodgeIFrames = 80;
|
||||
|
||||
// In vanilla, the Cross Necklace grants +40 iframes to all hits except for in PvP (where it does nothing)
|
||||
// and Brand of the Inferno (where it only gives +30 instead).
|
||||
internal const int CrossNecklaceIFrameBoost = 40;
|
||||
internal const int CrossNecklaceIFrameBoost_Parry = 30;
|
||||
#endregion
|
||||
|
||||
#region Dashes and Dodges
|
||||
// Dash cooldowns (in frames)
|
||||
internal const int UniversalDashCooldown = 30;
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using Terraria;
|
||||
using CalamityMod.Balancing;
|
||||
using CalamityMod.Items.Accessories;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
@@ -20,7 +22,10 @@ namespace CalamityMod.Buffs.StatBuffs
|
||||
if (player.buffTime[buffIndex] == 2)
|
||||
{
|
||||
SoundEngine.PlaySound(SoundID.Item27, player.Center);
|
||||
player.GiveIFrames(90, true);
|
||||
|
||||
// 17APR2024: Ozzatron: Permafrost's Concoction gives true invulnerability to everything and is boosted by Cross Necklace.
|
||||
int encasedIFrames = PermafrostsConcoction.EncasedIFrames + (player.longInvince ? BalancingConstants.CrossNecklaceIFrameBoost : 0);
|
||||
player.GiveUniversalIFrames(encasedIFrames, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -415,6 +415,7 @@ namespace CalamityMod.CalPlayer
|
||||
|
||||
#region Energy Shields
|
||||
public bool HasAnyEnergyShield => roverDrive || lunicCorpsSet || ((pSoulArtifact && !profanedCrystal) || profanedCrystalBuffs) || sponge;
|
||||
public bool freeDodgeFromShieldAbsorption = false;
|
||||
public bool drawnAnyShieldThisFrame = false;
|
||||
|
||||
// TODO -- Some way to show the player their total shield points.
|
||||
@@ -2801,7 +2802,7 @@ namespace CalamityMod.CalPlayer
|
||||
Main.dust[dustIndex].noLight = true;
|
||||
}
|
||||
|
||||
spectralVeilImmunity = 45;
|
||||
spectralVeilImmunity = SpectralVeil.VeilIFrames;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -566,8 +566,10 @@ namespace CalamityMod.CalPlayer
|
||||
if (Player.whoAmI == Main.myPlayer)
|
||||
Player.ApplyDamageToNPC(n, (int)Damage, Knockback, hitDirection, false);
|
||||
|
||||
// 17APR2024: Ozzatron: Dash iframes are not boosted by Cross Necklace at all and are fixed.
|
||||
n.Calamity().dashImmunityTime[Player.whoAmI] = NPCImmuneTime;
|
||||
Player.GiveIFrames(PlayerImmuneTime, false);
|
||||
Player.GiveUniversalIFrames(PlayerImmuneTime, false);
|
||||
|
||||
totalHurtNPCs++;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -54,7 +54,9 @@ namespace CalamityMod.CalPlayer
|
||||
#region Dodges
|
||||
private void SpectralVeilDodge()
|
||||
{
|
||||
Player.GiveIFrames(spectralVeilImmunity, true); //Set immunity before setting this variable to 0
|
||||
// 17APR2024: Ozzatron: Spectral Veil counts as a dodge. It uses vanilla dodge iframes and benefits from Cross Necklace.
|
||||
int spectralVeilIFrames = spectralVeilImmunity + (Player.longInvince ? BalancingConstants.CrossNecklaceIFrameBoost : 0);
|
||||
Player.GiveUniversalIFrames(spectralVeilIFrames, true);
|
||||
rogueStealth = rogueStealthMax;
|
||||
spectralVeilImmunity = 0;
|
||||
|
||||
@@ -79,7 +81,10 @@ namespace CalamityMod.CalPlayer
|
||||
|
||||
private void GodSlayerDodge()
|
||||
{
|
||||
Player.GiveIFrames(Player.longInvince ? 100 : 60, true);
|
||||
// 17APR2024: Ozzatron: God Slayer Dodge is a dodge. It uses vanilla dodge iframes and benefits from Cross Necklace.
|
||||
int godSlayerDodgeIFrames = Player.ComputeDodgeIFrames();
|
||||
Player.GiveUniversalIFrames(godSlayerDodgeIFrames, true);
|
||||
|
||||
SoundEngine.PlaySound(SoundID.Item67, Player.Center);
|
||||
|
||||
for (int j = 0; j < 30; j++)
|
||||
@@ -114,7 +119,9 @@ namespace CalamityMod.CalPlayer
|
||||
Player.AddCooldown(Cooldowns.CounterScarf.ID, duration);
|
||||
}
|
||||
|
||||
Player.GiveIFrames(Player.longInvince ? 100 : 60, true);
|
||||
// 17APR2024: Ozzatron: Counter Scarf is a dodge. It uses vanilla dodge iframes and benefits from Cross Necklace.
|
||||
int counterScarfIFrames = Player.ComputeDodgeIFrames();
|
||||
Player.GiveUniversalIFrames(counterScarfIFrames, true);
|
||||
|
||||
for (int j = 0; j < 100; j++)
|
||||
{
|
||||
@@ -151,10 +158,10 @@ namespace CalamityMod.CalPlayer
|
||||
int cooldownDuration = (int)MathHelper.Lerp(BalancingConstants.MirrorDodgeCooldownMin, BalancingConstants.MirrorDodgeCooldownMax, cooldownDurationScalar);
|
||||
Player.AddCooldown(GlobalDodge.ID, cooldownDuration, true, "abyssmirror");
|
||||
|
||||
// TODO -- why is this here?
|
||||
Player.noKnockback = true;
|
||||
// 17APR2024: Ozzatron: Abyssal Mirror is a dodge. It uses vanilla dodge iframes and benefits from Cross Necklace.
|
||||
int abyssalMirrorDodgeIFrames = Player.ComputeDodgeIFrames();
|
||||
Player.GiveUniversalIFrames(abyssalMirrorDodgeIFrames, true);
|
||||
|
||||
Player.GiveIFrames(Player.longInvince ? 100 : 60, true);
|
||||
rogueStealth += 0.5f;
|
||||
SoundEngine.PlaySound(SilvaHeadSummon.ActivationSound, Player.Center);
|
||||
|
||||
@@ -195,10 +202,10 @@ namespace CalamityMod.CalPlayer
|
||||
int cooldownDuration = (int)MathHelper.Lerp(BalancingConstants.MirrorDodgeCooldownMin, BalancingConstants.MirrorDodgeCooldownMax, cooldownDurationScalar);
|
||||
Player.AddCooldown(GlobalDodge.ID, cooldownDuration, true, "eclipsemirror");
|
||||
|
||||
// TODO -- why is this here?
|
||||
Player.noKnockback = true;
|
||||
// 17APR2024: Ozzatron: Eclipse Mirror is a dodge. It uses vanilla dodge iframes and benefits from Cross Necklace.
|
||||
int eclipseMirrorDodgeIFrames = Player.ComputeDodgeIFrames();
|
||||
Player.GiveUniversalIFrames(eclipseMirrorDodgeIFrames, true);
|
||||
|
||||
Player.GiveIFrames(Player.longInvince ? 100 : 60, true);
|
||||
rogueStealth += 0.5f;
|
||||
SoundEngine.PlaySound(SoundID.Item68, Player.Center);
|
||||
|
||||
@@ -915,7 +922,10 @@ namespace CalamityMod.CalPlayer
|
||||
proj.velocity *= -2f;
|
||||
proj.extraUpdates += 1;
|
||||
proj.penetrate = 1;
|
||||
Player.GiveIFrames(20, false);
|
||||
|
||||
// 17APR2024: Ozzatron: The Evolution is a reflect which also functions as a dodge. It uses vanilla dodge iframes and benefits from Cross Necklace.
|
||||
int evolutionIFrames = Player.ComputeReflectIFrames();
|
||||
Player.GiveUniversalIFrames(evolutionIFrames, true);
|
||||
|
||||
modifiers.SetMaxDamage(1);
|
||||
evolutionLifeRegenCounter = 300;
|
||||
@@ -1420,7 +1430,10 @@ namespace CalamityMod.CalPlayer
|
||||
proj.velocity *= -1f;
|
||||
proj.damage = (int)Player.GetBestClassDamage().ApplyTo(proj.damage * 8);
|
||||
proj.penetrate = 1;
|
||||
Player.GiveIFrames(20, false);
|
||||
|
||||
// 17APR2024: Ozzatron: The Transformer is a reflect which also functions as a dodge. It uses vanilla dodge iframes and benefits from Cross Necklace.
|
||||
int transformerIFrames = Player.ComputeReflectIFrames();
|
||||
Player.GiveUniversalIFrames(transformerIFrames, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1445,7 +1458,10 @@ namespace CalamityMod.CalPlayer
|
||||
proj.friendly = true;
|
||||
proj.velocity *= -1f;
|
||||
proj.penetrate = 1;
|
||||
Player.GiveIFrames(20, false);
|
||||
|
||||
// 17APR2024: Ozzatron: The Daedalus Reflect set bonus also functions as a dodge. It uses vanilla dodge iframes and benefits from Cross Necklace.
|
||||
int daedalusReflectIFrames = Player.ComputeReflectIFrames();
|
||||
Player.GiveUniversalIFrames(daedalusReflectIFrames, true);
|
||||
|
||||
int cooldownDuration = (int)MathHelper.Lerp(BalancingConstants.DaedalusReflectCooldownMin, BalancingConstants.DaedalusReflectCooldownMax, cooldownDurationScalar);
|
||||
Player.AddCooldown(GlobalDodge.ID, cooldownDuration);
|
||||
@@ -1467,6 +1483,17 @@ namespace CalamityMod.CalPlayer
|
||||
if (info.Damage < 1 /* || (godSlayerDamage && info.Damage <= 80) */)
|
||||
return true;
|
||||
|
||||
// If this hit was marked to be completely ignored due to shield absorption, then process Adrenaline changes and ignore it.
|
||||
if (freeDodgeFromShieldAbsorption)
|
||||
{
|
||||
freeDodgeFromShieldAbsorption = false;
|
||||
|
||||
// 20FEB2024: Ozzatron: Hits fully absorbed by shields remove half of your current Adrenaline.
|
||||
// If using Draedon's Heart, it pauses for half the typical duration.
|
||||
LoseAdrenalineOnHurt(info, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Gravistar Sabaton fall ram gives you a free dodge as long as you're slamming through NPCs
|
||||
// This also strikes the NPCs as a side effect
|
||||
if (gSabatonFalling)
|
||||
@@ -1488,8 +1515,11 @@ namespace CalamityMod.CalPlayer
|
||||
|
||||
Projectile.NewProjectile(Player.GetSource_FromThis(), n.Center, Vector2.Zero, ModContent.ProjectileType<DirectStrike>(), damage, 0, Main.myPlayer);
|
||||
|
||||
// 17APR2024: Ozzatron: Gravistar Sabaton gives iframes when passing through enemies for projectile safety.
|
||||
// This is a fixed and intentionally very low number of iframes, and is not boosted by Cross Necklace.
|
||||
n.Calamity().dashImmunityTime[Player.whoAmI] = 4;
|
||||
Player.GiveIFrames(5, false);
|
||||
Player.GiveUniversalIFrames(GravistarSabaton.PassthroughIFrames, false);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1668,8 +1698,12 @@ namespace CalamityMod.CalPlayer
|
||||
{
|
||||
if (!Player.HasCooldown(ParryCooldown.ID))
|
||||
{
|
||||
Player.GiveIFrames(60, true);
|
||||
// 17APR2024: Ozzatron: Blazing Core is a parry. It uses vanilla parry iframes and benefits from Cross Necklace.
|
||||
int blazingCoreParryIFrames = Player.ComputeParryIFrames();
|
||||
Player.GiveUniversalIFrames(blazingCoreParryIFrames, true);
|
||||
|
||||
blazingCoreEmpoweredParry = true;
|
||||
|
||||
modifiers.SetMaxDamage(1); //ONLY REDUCE DAMAGE IF NOT ON COOLDOWN
|
||||
modifiers.DisableSound(); //prevents hurt sound from playing, had no idea this was a thing
|
||||
}
|
||||
@@ -1688,8 +1722,12 @@ namespace CalamityMod.CalPlayer
|
||||
{
|
||||
if (!Player.HasCooldown(ParryCooldown.ID))
|
||||
{
|
||||
Player.GiveIFrames(60, true);
|
||||
// 17APR2024: Ozzatron: Flame-Licked Shell is a parry. It uses vanilla parry iframes and benefits from Cross Necklace.
|
||||
int flameLickedShellParryIFrames = Player.ComputeParryIFrames();
|
||||
Player.GiveUniversalIFrames(flameLickedShellParryIFrames, true);
|
||||
|
||||
flameLickedShellEmpoweredParry = true;
|
||||
|
||||
modifiers.FinalDamage *= 0.1f; //90% dr
|
||||
modifiers.DisableSound();
|
||||
}
|
||||
@@ -1872,8 +1910,9 @@ namespace CalamityMod.CalPlayer
|
||||
Rectangle location = new Rectangle((int)Player.position.X, (int)Player.position.Y - 16, Player.width, Player.height);
|
||||
CombatText.NewText(location, Color.LightBlue, Language.GetTextValue(shieldDamageText));
|
||||
|
||||
// Give the player iframes for taking the a shield hit, regardless of whether or not the shields broke
|
||||
Player.GiveIFrames(Player.longInvince ? 100 : 60, true);
|
||||
// Give the player iframes for taking a shield hit, regardless of whether or not the shields broke.
|
||||
int shieldHitIFrames = Player.ComputeHitIFrames(info);
|
||||
Player.GiveIFrames(info.CooldownCounter, shieldHitIFrames, true);
|
||||
|
||||
// Spawn particles when hit with the shields up, regardless of whether or not the shields broke.
|
||||
// More particles spawn if a shield broke.
|
||||
@@ -1915,7 +1954,7 @@ namespace CalamityMod.CalPlayer
|
||||
masterChefDurabilityCD.timeLeft = LunicCorpsShieldDurability;
|
||||
|
||||
// Update PSA/PSC durability on the cooldown rack
|
||||
if ((pSoulArtifact && (!profanedCrystal || profanedCrystalBuffs)) && cooldowns.TryGetValue(Cooldowns.ProfanedSoulShield.ID, out var profanedSoulDurabilityCD))
|
||||
if (pSoulArtifact && (!profanedCrystal || profanedCrystalBuffs) && cooldowns.TryGetValue(Cooldowns.ProfanedSoulShield.ID, out var profanedSoulDurabilityCD))
|
||||
profanedSoulDurabilityCD.timeLeft = pSoulShieldDurability;
|
||||
|
||||
// Update Sponge durability on the cooldown rack.
|
||||
@@ -1944,20 +1983,12 @@ namespace CalamityMod.CalPlayer
|
||||
}
|
||||
|
||||
// If the shields completely absorbed the hit, then delete the hit using reflection.
|
||||
// 17APR2024: Ozzatron: Use Fargo's hit-nulling methodology instead of a Free Dodge so improper iframes are not granted
|
||||
if (shieldsFullyAbsorbedHit)
|
||||
{
|
||||
info.NullifyHit();
|
||||
|
||||
// Give the appropriate immunity frames.
|
||||
Player.GiveIFrames(info.CooldownCounter, Player.longInvince ? 100 : 60, true);
|
||||
freeDodgeFromShieldAbsorption = true;
|
||||
|
||||
// Cancel defense damage, if it was going to occur this frame.
|
||||
nextHitDealsDefenseDamage = false;
|
||||
|
||||
// 20FEB2024: Ozzatron: Hits fully absorbed by shields remove half of your current Adrenaline.
|
||||
// If using Draedon's Heart, it pauses for half the typical duration.
|
||||
LoseAdrenalineOnHurt(info, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2372,40 +2403,8 @@ namespace CalamityMod.CalPlayer
|
||||
|
||||
if (Player.whoAmI == Main.myPlayer)
|
||||
{
|
||||
int iFramesToAdd = 0;
|
||||
if (godSlayerThrowing && hurtInfo.Damage > 80)
|
||||
iFramesToAdd += 30;
|
||||
if (statigelSet && hurtInfo.Damage > 100)
|
||||
iFramesToAdd += 30;
|
||||
|
||||
// Deific Amulet provides 10 to 40 bonus immunity frames when you get hit which scale with your missing health.
|
||||
// If you only take 1 damage, you get 5 iframes.
|
||||
// This effect is inherited by Rampart of Deities.
|
||||
if (dAmulet)
|
||||
{
|
||||
if (hurtInfo.Damage > 1)
|
||||
{
|
||||
float lifeRatio = (float)Player.statLife / Player.statLifeMax2;
|
||||
float iframeEffectivenessRatio = Utils.GetLerpValue(1.0f, 0.25f, lifeRatio, true);
|
||||
|
||||
iFramesToAdd += (int)(iframeEffectivenessRatio * DeificAmulet.MaxBonusIFrames);
|
||||
}
|
||||
else
|
||||
iFramesToAdd += 5;
|
||||
}
|
||||
|
||||
// Ozzatron 20FEB2024: Moved extra iframes from Seraph Tracers to Rampart of Deities to counteract its loss of Charm of Myths
|
||||
// This stacks with the above Deific Amulet effect
|
||||
if (rampartOfDeities && hurtInfo.Damage > 200)
|
||||
iFramesToAdd += 30;
|
||||
|
||||
if (fabsolVodka)
|
||||
{
|
||||
if (hurtInfo.Damage == 1)
|
||||
iFramesToAdd += 5;
|
||||
else
|
||||
iFramesToAdd += 10;
|
||||
}
|
||||
// Add extra iframes on hit based on various Calamity effects.
|
||||
int iFramesToAdd = Player.GetExtraHitIFrames(hurtInfo);
|
||||
|
||||
// Give bonus immunity frames based on the type of damage dealt
|
||||
if (hurtInfo.CooldownCounter != -1)
|
||||
|
||||
@@ -1656,8 +1656,10 @@ namespace CalamityMod.CalPlayer
|
||||
if (tarraThrowing)
|
||||
{
|
||||
// The iframes from the evasion are disabled by dodge disabling effects.
|
||||
// 17APR2024: Ozzatron: Tarragon Immunity is meant to be a full invulnerability effect, so universal iframes are granted throughout its duration.
|
||||
// It has no interaction with Cross Necklace.
|
||||
if (tarragonImmunity && !disableAllDodges)
|
||||
Player.GiveIFrames(2, true);
|
||||
Player.GiveUniversalIFrames(2, true);
|
||||
|
||||
if (tarraThrowingCrits >= 50)
|
||||
{
|
||||
|
||||
@@ -78,7 +78,8 @@ namespace CalamityMod.ILEditing
|
||||
cursor.Remove();
|
||||
|
||||
// Emit a delegate which calls the Calamity utility to consistently provide iframes.
|
||||
cursor.EmitDelegate<Action<Player, int>>((p, frames) => CalamityUtils.GiveIFrames(p, frames, false));
|
||||
// 17APR2024: Ozzatron: Consistent shield slam iframes are not boosted by Cross Necklace at all and are fixed.
|
||||
cursor.EmitDelegate<Action<Player, int>>((p, frames) => CalamityUtils.GiveUniversalIFrames(p, frames, false));
|
||||
}
|
||||
|
||||
private static readonly Func<Player, int> CalamityDashEquipped = (Player p) => p.Calamity().HasCustomDash ? 1 : 0;
|
||||
|
||||
@@ -11,6 +11,7 @@ namespace CalamityMod.Items.Accessories
|
||||
|
||||
public static readonly int PassthroughDamage = 150;
|
||||
public static readonly int SlamDamage = 300;
|
||||
public static readonly int PassthroughIFrames = 5;
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
|
||||
@@ -6,6 +6,9 @@ namespace CalamityMod.Items.Accessories
|
||||
{
|
||||
public class PermafrostsConcoction : ModItem, ILocalizedModType
|
||||
{
|
||||
// Boosted by Cross Necklace.
|
||||
internal static readonly int EncasedIFrames = 90;
|
||||
|
||||
public new string LocalizationCategory => "Items.Accessories";
|
||||
public override void SetDefaults()
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using CalamityMod.Balancing;
|
||||
using CalamityMod.Rarities;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Items.Accessories
|
||||
@@ -10,6 +10,10 @@ namespace CalamityMod.Items.Accessories
|
||||
{
|
||||
public new string LocalizationCategory => "Items.Accessories";
|
||||
public const float TeleportRange = 845f;
|
||||
|
||||
// Boosted by Cross Necklace.
|
||||
internal static readonly int VeilIFrames = BalancingConstants.VanillaDodgeIFrames;
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.width = 30;
|
||||
|
||||
@@ -65,9 +65,13 @@ namespace CalamityMod.Projectiles.Melee
|
||||
|
||||
GeneralParryEffects();
|
||||
|
||||
//only get iframes if the enemy has contact damage :)
|
||||
// 17APR2024: Ozzatron: Ark of the Ancients is a parry. It uses vanilla parry iframes and benefits from Cross Necklace.
|
||||
// However, iframes are only granted if the target has contact damage. This means it won't work on Providence. Too bad. I have no sympathy for you if you are using this weapon line.
|
||||
if (target.damage > 0)
|
||||
Owner.GiveIFrames(35);
|
||||
{
|
||||
int arkParryIFrames = Owner.ComputeParryIFrames();
|
||||
Owner.GiveUniversalIFrames(arkParryIFrames, false);
|
||||
}
|
||||
|
||||
Vector2 particleOrigin = target.Hitbox.Size().Length() < 140 ? target.Center : Projectile.Center + Projectile.rotation.ToRotationVector2() * 60f;
|
||||
Particle spark = new GenericSparkle(particleOrigin, Vector2.Zero, Color.White, Color.HotPink, 1.2f, 35, 0.1f, 2);
|
||||
|
||||
@@ -121,9 +121,9 @@ namespace CalamityMod.Projectiles.Melee
|
||||
//Check for the up arrow once more so if the player has good reflexes they can avoid the dash. Gives them more control
|
||||
if (Owner.controlUp && Charge >= 5)
|
||||
{
|
||||
Owner.GiveIFrames(ArkoftheCosmos.DashIframes);
|
||||
// 17APR2024: Ozzatron: Dash iframes are not boosted by Cross Necklace at all and are fixed.
|
||||
Owner.GiveUniversalIFrames(ArkoftheCosmos.DashIframes);
|
||||
Dashing = true;
|
||||
|
||||
}
|
||||
|
||||
for (int i = 0; i < 20; i++)
|
||||
|
||||
@@ -82,9 +82,13 @@ namespace CalamityMod.Projectiles.Melee
|
||||
|
||||
GeneralParryEffects();
|
||||
|
||||
//only get iframes if the enemy has contact damage :)
|
||||
// 17APR2024: Ozzatron: Ark of the Cosmos is a parry. It uses vanilla parry iframes and benefits from Cross Necklace.
|
||||
// However, iframes are only granted if the target has contact damage. This means it won't work on Providence. Too bad. I have no sympathy for you if you are using this weapon line.
|
||||
if (target.damage > 0)
|
||||
Owner.GiveIFrames(35);
|
||||
{
|
||||
int arkParryIFrames = Owner.ComputeParryIFrames();
|
||||
Owner.GiveUniversalIFrames(arkParryIFrames, false);
|
||||
}
|
||||
|
||||
Vector2 particleOrigin = target.Hitbox.Size().Length() < 140 ? target.Center : Projectile.Center + Projectile.rotation.ToRotationVector2() * 60f;
|
||||
Particle spark = new GenericSparkle(particleOrigin, Vector2.Zero, Color.White, Color.HotPink, 1.2f, 35, 0.1f, 2);
|
||||
|
||||
@@ -82,9 +82,13 @@ namespace CalamityMod.Projectiles.Melee
|
||||
|
||||
GeneralParryEffects();
|
||||
|
||||
//only get iframes if the enemy has contact damage :)
|
||||
// 17APR2024: Ozzatron: Ark of the Elements is a parry. It uses vanilla parry iframes and benefits from Cross Necklace.
|
||||
// However, iframes are only granted if the target has contact damage. This means it won't work on Providence. Too bad. I have no sympathy for you if you are using this weapon line.
|
||||
if (target.damage > 0)
|
||||
Owner.GiveIFrames(35);
|
||||
{
|
||||
int arkParryIFrames = Owner.ComputeParryIFrames();
|
||||
Owner.GiveUniversalIFrames(arkParryIFrames, false);
|
||||
}
|
||||
|
||||
Vector2 particleOrigin = target.Hitbox.Size().Length() < 140 ? target.Center : Projectile.Center + Projectile.rotation.ToRotationVector2() * 60f;
|
||||
Particle spark = new GenericSparkle(particleOrigin, Vector2.Zero, Color.White, Color.HotPink, 1.2f, 35, 0.1f, 2);
|
||||
|
||||
@@ -182,7 +182,11 @@ namespace CalamityMod.Projectiles.Melee
|
||||
Shred += 62; //Augment the shredspeed
|
||||
if (Owner.velocity.Y > 0)
|
||||
Owner.velocity.Y = -2f; //Get "stuck" into the enemy partly
|
||||
Owner.GiveIFrames(BrokenBiomeBlade.HotAttunement_ShredIFrames); // i framez.
|
||||
|
||||
// 17APR2024: Ozzatron: Broken Biome Blade's pogo gives iframes when striking enemies in a similar manner to a bonk dash.
|
||||
// This is a fixed and intentionally very low number of iframes, and is not boosted by Cross Necklace.
|
||||
Owner.GiveUniversalIFrames(BrokenBiomeBlade.HotAttunement_ShredIFrames);
|
||||
|
||||
PogoCooldown = 20;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,7 +113,10 @@ namespace CalamityMod.Projectiles.Melee
|
||||
bounceStrength *= Owner.velocity.Y == 0 ? 0.2f : 1f; //Reduce the bounce if the player is on the ground
|
||||
Owner.velocity = -direction.SafeNormalize(Vector2.Zero) * MathHelper.Clamp(bounceStrength, 0f, 22f);
|
||||
CanBounce = 0f;
|
||||
Owner.GiveIFrames(BrokenBiomeBlade.EvilAttunement_BounceIFrames); // i frames for free!
|
||||
|
||||
// 17APR2024: Ozzatron: Broken Biome Blade's lunge gives iframes when striking enemies in a similar manner to a bonk dash.
|
||||
// This is a fixed and intentionally very low number of iframes, and is not boosted by Cross Necklace.
|
||||
Owner.GiveUniversalIFrames(BrokenBiomeBlade.EvilAttunement_BounceIFrames);
|
||||
}
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
|
||||
@@ -261,7 +261,9 @@ namespace CalamityMod.Projectiles.Melee
|
||||
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
|
||||
{
|
||||
Owner.GiveIFrames(FourSeasonsGalaxia.AndromedaAttunement_DashHitIFrames);
|
||||
// 17APR2024: Ozzatron: Galaxia's dash gives iframes when striking enemies in a similar manner to a ram dash.
|
||||
// This is a fixed and intentionally very low number of iframes, and is not boosted by Cross Necklace.
|
||||
Owner.GiveUniversalIFrames(FourSeasonsGalaxia.AndromedaAttunement_DashHitIFrames);
|
||||
}
|
||||
|
||||
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
|
||||
|
||||
@@ -82,7 +82,11 @@ namespace CalamityMod.Projectiles.Melee
|
||||
Dashing = true;
|
||||
DashStart = Owner.Center;
|
||||
Wheel.timeLeft = 60;
|
||||
Owner.GiveIFrames(FourSeasonsGalaxia.PolarisAttunement_SlashIFrames);
|
||||
|
||||
// 17APR2024: Ozzatron: Galaxia's spiral gives iframes when striking enemies in a similar manner to a ram dash.
|
||||
// This is a fixed and intentionally very low number of iframes, and is not boosted by Cross Necklace.
|
||||
Owner.GiveUniversalIFrames(FourSeasonsGalaxia.PolarisAttunement_SlashIFrames);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -269,7 +273,11 @@ namespace CalamityMod.Projectiles.Melee
|
||||
Shred += 80; //Augment the shredspeed
|
||||
if (Owner.velocity.Y > 0)
|
||||
Owner.velocity.Y = -2f; //Get "stuck" into the enemy partly
|
||||
Owner.GiveIFrames(FourSeasonsGalaxia.PolarisAttunement_ShredIFrames); // i framez.
|
||||
|
||||
// 17APR2024: Ozzatron: Galaxia's pogo gives iframes when striking enemies in a similar manner to a bonk dash.
|
||||
// This is a fixed and intentionally very low number of iframes, and is not boosted by Cross Necklace.
|
||||
Owner.GiveUniversalIFrames(FourSeasonsGalaxia.PolarisAttunement_ShredIFrames);
|
||||
|
||||
HitChargeCooldown = 20;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -235,7 +235,9 @@ namespace CalamityMod.Projectiles.Melee
|
||||
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
|
||||
{
|
||||
Owner.GiveIFrames(TrueBiomeBlade.AstralAttunement_DashHitIFrames);
|
||||
// 17APR2024: Ozzatron: Biome Blade's astral slam gives iframes when striking enemies in a similar manner to a ram dash.
|
||||
// This is a fixed and intentionally very low number of iframes, and is not boosted by Cross Necklace.
|
||||
Owner.GiveUniversalIFrames(TrueBiomeBlade.AstralAttunement_DashHitIFrames);
|
||||
}
|
||||
|
||||
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
|
||||
|
||||
@@ -202,7 +202,10 @@ namespace CalamityMod.Projectiles.Melee
|
||||
Shred += 62; //Augment the shredspeed
|
||||
if (Owner.velocity.Y > 0)
|
||||
Owner.velocity.Y = -2f; //Get "stuck" into the enemy partly
|
||||
Owner.GiveIFrames(TrueBiomeBlade.HotAttunement_ShredIFrames); // i framez. Do 5 iframes even matter? idk but you get a lot of em so lol...
|
||||
|
||||
// 17APR2024: Ozzatron: Biome Blade's pogo gives iframes when striking enemies in a similar manner to a bonk dash.
|
||||
// This is a fixed and intentionally very low number of iframes, and is not boosted by Cross Necklace.
|
||||
Owner.GiveUniversalIFrames(TrueBiomeBlade.HotAttunement_ShredIFrames);
|
||||
PogoCooldown = 20;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,7 +132,10 @@ namespace CalamityMod.Projectiles.Melee
|
||||
Owner.Calamity().LungingDown = true;
|
||||
PowerLungeStart = Owner.Center;
|
||||
dashTimer = 1f;
|
||||
Owner.GiveIFrames(TrueBiomeBlade.EvilAttunement_SlashIFrames);
|
||||
|
||||
// 17APR2024: Ozzatron: Biome Blade's lunge gives iframes when striking enemies in a similar manner to a ram dash.
|
||||
// This is a fixed and intentionally very low number of iframes, and is not boosted by Cross Necklace.
|
||||
Owner.GiveUniversalIFrames(TrueBiomeBlade.EvilAttunement_SlashIFrames);
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => OnHitEffects(Main.player[Projectile.owner].moonLeech);
|
||||
@@ -160,7 +163,11 @@ namespace CalamityMod.Projectiles.Melee
|
||||
bounceStrength *= Owner.velocity.Y == 0 ? 0.2f : 1f; //Reduce the bounce if the player is on the ground
|
||||
Owner.velocity = -direction.SafeNormalize(Vector2.Zero) * MathHelper.Clamp(bounceStrength, 0f, 22f);
|
||||
CanBounce = 0f;
|
||||
Owner.GiveIFrames(TrueBiomeBlade.EvilAttunement_BounceIFrames); // i frames for free!
|
||||
|
||||
// 17APR2024: Ozzatron: Biome Blade's bounce gives iframes when striking enemies in a similar manner to a bonk dash.
|
||||
// This is a fixed and intentionally very low number of iframes, and is not boosted by Cross Necklace.
|
||||
Owner.GiveUniversalIFrames(TrueBiomeBlade.EvilAttunement_BounceIFrames);
|
||||
|
||||
if (Owner.whoAmI == Main.myPlayer)
|
||||
{
|
||||
if (Owner.HeldItem.ModItem is TrueBiomeBlade sword)
|
||||
|
||||
@@ -73,7 +73,9 @@ namespace CalamityMod.Projectiles.Melee
|
||||
|
||||
internal void ReelBack()
|
||||
{
|
||||
Owner.GiveIFrames(PhosphorescentGauntlet.OnHitIFrames);
|
||||
// 17APR2024: Ozzatron: Phosphorescent Gauntlet gives iframes when striking enemies in a similar manner to a bonk dash.
|
||||
// This is a fixed and intentionally very low number of iframes, and is not boosted by Cross Necklace.
|
||||
Owner.GiveUniversalIFrames(PhosphorescentGauntlet.OnHitIFrames);
|
||||
|
||||
// Create some visual effects.
|
||||
if (!Main.dedServ)
|
||||
|
||||
@@ -307,9 +307,13 @@ namespace CalamityMod.Projectiles.Melee.Spears
|
||||
|
||||
target.AddBuff(BuffID.Poisoned, 180);
|
||||
|
||||
//Give a sliver of iframes to the player so its safer to ram into hordes (which is fun and should be encouraged)
|
||||
if (CurrentAttackState == AttackState.RunAttack)
|
||||
Owner.GiveIFrames(5);
|
||||
{
|
||||
// 17APR2024: Ozzatron: Redtide Spear's charge gives iframes when striking enemies in a similar manner to a ram dash.
|
||||
// This is a fixed and intentionally very low number of iframes, and is not boosted by Cross Necklace.
|
||||
int redtideRamIFrames = 5;
|
||||
Owner.GiveUniversalIFrames(redtideRamIFrames);
|
||||
}
|
||||
}
|
||||
|
||||
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
|
||||
|
||||
@@ -65,9 +65,13 @@ namespace CalamityMod.Projectiles.Melee
|
||||
|
||||
GeneralParryEffects();
|
||||
|
||||
//only get iframes if the enemy has contact damage :)
|
||||
// 17APR2024: Ozzatron: True Ark of the Ancients is a parry. It uses vanilla parry iframes and benefits from Cross Necklace.
|
||||
// However, iframes are only granted if the target has contact damage. This means it won't work on Providence. Too bad. I have no sympathy for you if you are using this weapon line.
|
||||
if (target.damage > 0)
|
||||
Owner.GiveIFrames(35);
|
||||
{
|
||||
int arkParryIFrames = Owner.ComputeParryIFrames();
|
||||
Owner.GiveUniversalIFrames(arkParryIFrames, false);
|
||||
}
|
||||
|
||||
Vector2 particleOrigin = target.Hitbox.Size().Length() < 140 ? target.Center : Projectile.Center + Projectile.rotation.ToRotationVector2() * 60f;
|
||||
Particle spark = new GenericSparkle(particleOrigin, Vector2.Zero, Color.White, Color.HotPink, 1.2f, 35, 0.1f, 2);
|
||||
|
||||
@@ -234,7 +234,9 @@ namespace CalamityMod.Projectiles.Melee
|
||||
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
|
||||
{
|
||||
Owner.GiveIFrames(OmegaBiomeBlade.ShockwaveAttunement_DashHitIFrames);
|
||||
// 17APR2024: Ozzatron: True Biome Blade's shockwave slam gives iframes when striking enemies in a similar manner to a ram dash.
|
||||
// This is a fixed and intentionally very low number of iframes, and is not boosted by Cross Necklace.
|
||||
Owner.GiveUniversalIFrames(OmegaBiomeBlade.ShockwaveAttunement_DashHitIFrames);
|
||||
}
|
||||
|
||||
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
|
||||
|
||||
@@ -116,7 +116,11 @@ namespace CalamityMod.Projectiles.Melee
|
||||
Dashing = true;
|
||||
DashStart = Owner.Center;
|
||||
Wheel.timeLeft = 60;
|
||||
Owner.GiveIFrames(OmegaBiomeBlade.SuperPogoAttunement_SlashIFrames);
|
||||
|
||||
// 17APR2024: Ozzatron: True Biome Blade's pogo gives iframes when striking enemies in a similar manner to a bonk dash.
|
||||
// This is a fixed and intentionally very low number of iframes, and is not boosted by Cross Necklace.
|
||||
Owner.GiveUniversalIFrames(OmegaBiomeBlade.SuperPogoAttunement_SlashIFrames);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -256,7 +260,11 @@ namespace CalamityMod.Projectiles.Melee
|
||||
Shred += 62; //Augment the shredspeed
|
||||
if (Owner.velocity.Y > 0)
|
||||
Owner.velocity.Y = -2f; //Get "stuck" into the enemy partly
|
||||
Owner.GiveIFrames(OmegaBiomeBlade.SuperPogoAttunement_ShredIFrames); // i framez.
|
||||
|
||||
// 17APR2024: Ozzatron: True Biome Blade's shred pogo gives iframes when striking enemies in a similar manner to a bonk dash.
|
||||
// This is a fixed and intentionally very low number of iframes, and is not boosted by Cross Necklace.
|
||||
Owner.GiveUniversalIFrames(OmegaBiomeBlade.SuperPogoAttunement_ShredIFrames);
|
||||
|
||||
PogoCooldown = 20;
|
||||
}
|
||||
}
|
||||
|
||||
+107
-3
@@ -5,6 +5,7 @@ using CalamityMod.Balancing;
|
||||
using CalamityMod.CalPlayer;
|
||||
using CalamityMod.Cooldowns;
|
||||
using CalamityMod.Events;
|
||||
using CalamityMod.Items.Accessories;
|
||||
using CalamityMod.Items.Potions.Alcohol;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
@@ -413,6 +414,103 @@ namespace CalamityMod
|
||||
#endregion
|
||||
|
||||
#region Immunity Frames
|
||||
/// <summary>
|
||||
/// Computes the appropriate amount of immunity frames to grant a player when they are struck by an attack.<br />
|
||||
/// Accounts for all Calamity effects, but not effects from other mods.
|
||||
/// </summary>
|
||||
/// <param name="player">The player whose immunity frames are being computed.</param>
|
||||
/// <returns>The amount of immunity frames the player should receive if struck.</returns>
|
||||
public static int ComputeHitIFrames(this Player player, HurtInfo hurtInfo)
|
||||
{
|
||||
// Start with vanilla immunity frames.
|
||||
int iframes = BalancingConstants.VanillaDefaultIFrames + (player.longInvince ? BalancingConstants.CrossNecklaceIFrameBoost : 0);
|
||||
|
||||
// Add on all Calamity effects.
|
||||
int calBonusIFrames = player.GetExtraHitIFrames(hurtInfo);
|
||||
|
||||
return iframes + calBonusIFrames;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the total amount of extra immunity frames from a hit granted by various Calamity effects.
|
||||
/// </summary>
|
||||
/// <param name="player">The player whose extra immunity frames are being computed.</param>
|
||||
/// <returns>The amount of extra immunity frames to grant.</returns>
|
||||
public static int GetExtraHitIFrames(this Player player, HurtInfo hurtInfo)
|
||||
{
|
||||
CalamityPlayer modPlayer = player.Calamity();
|
||||
|
||||
int extraIFrames = 0;
|
||||
if (modPlayer.godSlayerThrowing && hurtInfo.Damage > 80)
|
||||
extraIFrames += 30;
|
||||
if (modPlayer.statigelSet && hurtInfo.Damage > 100)
|
||||
extraIFrames += 30;
|
||||
|
||||
// Deific Amulet provides 10 to 40 bonus immunity frames when you get hit which scale with your missing health.
|
||||
// If you only take 1 damage, you get 5 iframes.
|
||||
// This effect is inherited by Rampart of Deities.
|
||||
if (modPlayer.dAmulet)
|
||||
{
|
||||
if (hurtInfo.Damage > 1)
|
||||
{
|
||||
float lifeRatio = (float)player.statLife / player.statLifeMax2;
|
||||
float iframeEffectivenessRatio = Utils.GetLerpValue(1.0f, 0.25f, lifeRatio, true);
|
||||
|
||||
extraIFrames += (int)(iframeEffectivenessRatio * DeificAmulet.MaxBonusIFrames);
|
||||
}
|
||||
else
|
||||
extraIFrames += 5;
|
||||
}
|
||||
|
||||
// Ozzatron 20FEB2024: Moved extra iframes from Seraph Tracers to Rampart of Deities to counteract its loss of Charm of Myths
|
||||
// This stacks with the above Deific Amulet effect
|
||||
if (modPlayer.rampartOfDeities && hurtInfo.Damage > 200)
|
||||
extraIFrames += 30;
|
||||
|
||||
if (modPlayer.fabsolVodka)
|
||||
{
|
||||
if (hurtInfo.Damage == 1)
|
||||
extraIFrames += 5;
|
||||
else
|
||||
extraIFrames += 10;
|
||||
}
|
||||
|
||||
return extraIFrames;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Computes the appropriate amount of immunity frames to grant a player when they activate a dodge.<br />
|
||||
/// Accounts for all Calamity effects, but not effects from other mods.
|
||||
/// </summary>
|
||||
/// <param name="player">The player whose immunity frames are being computed.</param>
|
||||
/// <returns>The amount of immunity frames the player should receive upon dodging.</returns>
|
||||
public static int ComputeDodgeIFrames(this Player player)
|
||||
{
|
||||
int iframes = BalancingConstants.VanillaDodgeIFrames + (player.longInvince ? BalancingConstants.CrossNecklaceIFrameBoost : 0);
|
||||
return iframes;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Computes the appropriate amount of immunity frames to grant a player when they activate a parry.<br />
|
||||
/// Accounts for all Calamity effects, but not effects from other mods.
|
||||
/// </summary>
|
||||
/// <param name="player">The player whose immunity frames are being computed.</param>
|
||||
/// <returns>The amount of immunity frames the player should receive upon parrying.</returns>
|
||||
public static int ComputeParryIFrames(this Player player)
|
||||
{
|
||||
int iframes = BalancingConstants.VanillaParryIFrames + (player.longInvince ? BalancingConstants.CrossNecklaceIFrameBoost_Parry : 0);
|
||||
return iframes;
|
||||
}
|
||||
|
||||
// Currently, reflects are functionally equivalent to dodges.
|
||||
/// <summary>
|
||||
/// Computes the appropriate amount of immunity frames to grant a player when they activate a reflect.<br />
|
||||
/// Accounts for all Calamity effects, but not effects from other mods.
|
||||
/// </summary>
|
||||
/// <param name="player">The player whose immunity frames are being computed.</param>
|
||||
/// <returns>The amount of immunity frames the player should receive upon reflecting an attack.</returns>
|
||||
public static int ComputeReflectIFrames(this Player player) => player.ComputeDodgeIFrames();
|
||||
|
||||
/// <summary>
|
||||
/// Checks whether the player has any kind of immunity frames (or "iframes" for short) available.
|
||||
/// </summary>
|
||||
@@ -433,7 +531,10 @@ namespace CalamityMod
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gives the player the specified number of immunity frames (or "iframes" for short).<br />If the player already has more iframes than you want to give them, this function does nothing.
|
||||
/// Gives the player the specified number of immunity frames (or "iframes" for short) to a specific cooldown slot.<br />
|
||||
/// If the player already has more iframes than you want to give them, this function does nothing.<br />
|
||||
/// <br />
|
||||
/// <b>This should be used for effects that need to mock or mimic the iframes that would be granted by getting hit.</b>
|
||||
/// </summary>
|
||||
/// <param name="player">The player who should be given immunity frames.</param>
|
||||
/// <param name="cooldownSlot">The immunity cooldown slot to use. See TML documentation for which is which.</param>
|
||||
@@ -461,13 +562,16 @@ namespace CalamityMod
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gives the player the specified number of immunity frames (or "iframes" for short).<br />If the player already has more iframes than you want to give them, this function does nothing.
|
||||
/// Gives the player the specified number of immunity frames (or "iframes" for short) to all cooldown slots.<br />
|
||||
/// If the player already has more iframes than you want to give them, this function does nothing.<br />
|
||||
/// <br />
|
||||
/// <b>This should be used for effects like dodges or true invulnerability that should prevent the player from being hit for a predetermined time.</b>
|
||||
/// </summary>
|
||||
/// <param name="player">The player who should be given immunity frames.</param>
|
||||
/// <param name="frames">The number of immunity frames to give.</param>
|
||||
/// <param name="blink">Whether or not the player should be blinking during this time.</param>
|
||||
/// <returns>Whether or not any immunity frames were given.</returns>
|
||||
public static bool GiveIFrames(this Player player, int frames, bool blink = false)
|
||||
public static bool GiveUniversalIFrames(this Player player, int frames, bool blink = false)
|
||||
{
|
||||
// Check to see if there is any way for the player to get iframes from this operation.
|
||||
bool anyIFramesWouldBeGiven = false;
|
||||
|
||||
Reference in new issue
Block a user